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
2be4648650aad1ce171adc0915b6ce8ec7d690cb
Fix Top_level_projection_track_entities_before_passing_to_client_method
azabluda/InfoCarrier.Core
test/InfoCarrier.Core.FunctionalTests/InMemory/LazyLoadProxyInfoCarrierTest.cs
test/InfoCarrier.Core.FunctionalTests/InMemory/LazyLoadProxyInfoCarrierTest.cs
// Copyright (c) on/off it-solutions gmbh. All rights reserved. // Licensed under the MIT license. See license.txt file in the project root for license information. namespace InfoCarrier.Core.FunctionalTests.InMemory { using System.Linq; using InfoCarrier.Core.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.TestUtilities; using Xunit; public class LazyLoadProxyInfoCarrierTest : LazyLoadProxyTestBase<LazyLoadProxyInfoCarrierTest.TestFixture> { public LazyLoadProxyInfoCarrierTest(TestFixture fixture) : base(fixture) { } [ConditionalFact] public override void Top_level_projection_track_entities_before_passing_to_client_method() { using (var context = this.CreateContext(lazyLoadingEnabled: true)) { var query = (from p in context.Set<Parent>() select p).FirstOrDefault(); // [ClientEval] Cannot use DtoFactory.CreateDto on the server side var dto = DtoFactory.CreateDto(query); Assert.NotNull(((dynamic)dto).Single); } } private static class DtoFactory { public static object CreateDto(Parent parent) { return new { parent.Id, parent.Single, parent.Single.ParentId, }; } } public class TestFixture : LoadFixtureBase { private ITestStoreFactory testStoreFactory; protected override ITestStoreFactory TestStoreFactory => InfoCarrierTestStoreFactory.EnsureInitialized( ref this.testStoreFactory, InfoCarrierTestStoreFactory.InMemory, this.ContextType, this.OnModelCreating); } } }
// Copyright (c) on/off it-solutions gmbh. All rights reserved. // Licensed under the MIT license. See license.txt file in the project root for license information. namespace InfoCarrier.Core.FunctionalTests.InMemory { using InfoCarrier.Core.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.TestUtilities; public class LazyLoadProxyInfoCarrierTest : LazyLoadProxyTestBase<LazyLoadProxyInfoCarrierTest.TestFixture> { public LazyLoadProxyInfoCarrierTest(TestFixture fixture) : base(fixture) { } public class TestFixture : LoadFixtureBase { private ITestStoreFactory testStoreFactory; protected override ITestStoreFactory TestStoreFactory => InfoCarrierTestStoreFactory.EnsureInitialized( ref this.testStoreFactory, InfoCarrierTestStoreFactory.InMemory, this.ContextType, this.OnModelCreating); } } }
mit
C#
02a1e50443b1254aaa00b603e152b7c9df61522f
make read-only service method no track
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Services/Services/FilterListService.cs
src/FilterLists.Services/Services/FilterListService.cs
using System.Collections.Generic; using System.Threading.Tasks; using AutoMapper.QueryableExtensions; using FilterLists.Data; using FilterLists.Data.Entities; using FilterLists.Services.Models; using Microsoft.EntityFrameworkCore; namespace FilterLists.Services.Services { public class FilterListService { private readonly FilterListsDbContext filterListsDbContext; public FilterListService(FilterListsDbContext filterListsDbContext) { this.filterListsDbContext = filterListsDbContext; } public async Task<IEnumerable<FilterListSummaryDto>> GetAllSummaries() { return await filterListsDbContext.Set<FilterList>().AsNoTracking().ProjectTo<FilterListSummaryDto>() .ToListAsync(); } } }
using System.Collections.Generic; using System.Threading.Tasks; using AutoMapper.QueryableExtensions; using FilterLists.Data; using FilterLists.Data.Entities; using FilterLists.Services.Models; using Microsoft.EntityFrameworkCore; namespace FilterLists.Services.Services { public class FilterListService { private readonly FilterListsDbContext filterListsDbContext; public FilterListService(FilterListsDbContext filterListsDbContext) { this.filterListsDbContext = filterListsDbContext; } public async Task<IEnumerable<FilterListSummaryDto>> GetAllSummaries() { return await filterListsDbContext.Set<FilterList>().ProjectTo<FilterListSummaryDto>().ToListAsync(); } } }
mit
C#
90450a56a6551dee92da0b1d2c9ad7ee1e0d0287
Add Privacy Policy content
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
src/LondonTravel.Site/Views/PrivacyPolicy/Index.cshtml
src/LondonTravel.Site/Views/PrivacyPolicy/Index.cshtml
@{ ViewBag.MetaDescription = SR.PrivacyPolicyMetaDescription; ViewBag.Title = SR.PrivacyPolicyMetaTitle; } <div> <h1>@SR.PrivacyPolicyTitle</h1> <p> Your privacy is important to us. </p> <p> It is London Travel's policy to respect your privacy regarding any information we may collect while operating our website. Accordingly, we have developed this privacy policy in order for you to understand how we collect, use, communicate, disclose and otherwise make use of personal information. We have outlined our privacy policy below. </p> <ul> <li>We will collect personal information by lawful and fair means and, where appropriate, with the knowledge or consent of the individual concerned.</li> <li>Before or at the time of collecting personal information, we will identify the purposes for which information is being collected.</li> <li>We will collect and use personal information solely for fulfilling those purposes specified by us and for other ancillary purposes, unless we obtain the consent of the individual concerned or as required by law.</li> <li>Personal data should be relevant to the purposes for which it is to be used, and, to the extent necessary for those purposes, should be accurate, complete, and up-to-date.</li> <li>We will protect personal information by using reasonable security safeguards against loss or theft, as well as unauthorized access, disclosure, copying, use or modification.</li> <li>We will make readily available to customers information about our policies and practices relating to the management of personal information.</li> <li>We will only retain personal information for as long as necessary for the fulfilment of those purposes.</li> </ul> <p> We are committed to conducting our business in accordance with these principles in order to ensure that the confidentiality of personal information is protected and maintained. London Travel may change this privacy policy from time to time at London Travel's sole discretion. </p> </div>
@{ ViewBag.MetaDescription = SR.PrivacyPolicyMetaDescription; ViewBag.Title = SR.PrivacyPolicyMetaTitle; } <div> <h1>@SR.PrivacyPolicyTitle</h1> <p> @* TODO Add content *@ This is where the Privacy Policy for the London Travel Alexa skill will be. </p> </div>
apache-2.0
C#
edfe6ea6a4ccaaf3f4cba1b7f88f28705318ddbc
Add XmlnsPrefix
MahApps/MahApps.Metro.IconPacks
src/MahApps.Metro.IconPacks/Properties/AssemblyInfo.cs
src/MahApps.Metro.IconPacks/Properties/AssemblyInfo.cs
using System.Runtime.InteropServices; #if !(NETFX_CORE || WINDOWS_UWP) using System.Windows; using System.Windows.Markup; [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: XmlnsPrefix(@"http://metro.mahapps.com/winfx/xaml/iconpacks", "iconpacks")] [assembly: XmlnsDefinition(@"http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks")] [assembly: XmlnsDefinition(@"http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks.Converter")] #endif [assembly: ComVisible(false)]
using System.Runtime.InteropServices; #if !(NETFX_CORE || WINDOWS_UWP) using System.Windows; using System.Windows.Markup; [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks")] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/iconpacks", "MahApps.Metro.IconPacks.Converter")] #endif [assembly: ComVisible(false)]
mit
C#
55b38430b433320bbb9fc0f425ddc8589fc34a77
Fix /Puzzle/Mixed
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/ChessVariantsTraining/Utilities.cs
src/ChessVariantsTraining/Utilities.cs
using System; namespace ChessVariantsTraining { public static class Utilities { public static string SanitizeHtml(string unsafeHtml) { return unsafeHtml.Replace("&", "&amp;") .Replace("<", "&lt;") .Replace(">", "&gt;") .Replace("\"", "&quot;"); } public static string NormalizeVariantNameCapitalization(string variant) { string variantUpper = variant.ToUpperInvariant(); switch (variantUpper) { case "ANTICHESS": return "Antichess"; case "ATOMIC": return "Atomic"; case "HORDE": return "Horde"; case "KINGOFTHEHILL": return "KingOfTheHill"; case "RACINGKINGS": return "RacingKings"; case "THREECHECK": return "ThreeCheck"; case "MIXED": return "Mixed"; default: throw new NotImplementedException(variant + " is not implemented."); } } } }
using System; namespace ChessVariantsTraining { public static class Utilities { public static string SanitizeHtml(string unsafeHtml) { return unsafeHtml.Replace("&", "&amp;") .Replace("<", "&lt;") .Replace(">", "&gt;") .Replace("\"", "&quot;"); } public static string NormalizeVariantNameCapitalization(string variant) { string variantUpper = variant.ToUpperInvariant(); switch (variantUpper) { case "ANTICHESS": return "Antichess"; case "ATOMIC": return "Atomic"; case "HORDE": return "Horde"; case "KINGOFTHEHILL": return "KingOfTheHill"; case "RACINGKINGS": return "RacingKings"; case "THREECHECK": return "ThreeCheck"; default: throw new NotImplementedException(variant + " is not implemented."); } } } }
agpl-3.0
C#
02b75232c544d7d41144556f33c2426bd6779a33
Update MainWindow.xaml.cs
Virusface/Cauldron,Capgemini/Cauldron,reflection-emit/Cauldron
Samples/Win32_WPF_ParameterPassing/MainWindow.xaml.cs
Samples/Win32_WPF_ParameterPassing/MainWindow.xaml.cs
using Cauldron.Core.Reflection; using Cauldron; using System.Diagnostics; using System.Windows; namespace Win32_WPF_ParameterPassing { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); // This is only meant for Lazy people // So that they don't have to open the console separately var process = Process.Start(new ProcessStartInfo { FileName = "cmd", WorkingDirectory = ApplicationInfo.ApplicationPath.FullName }); this.Unloaded += (s, e) => process.Kill(); // This is the only relevant line here. // This can be also added via Behaviour / Action // As long as the Window is loaded and a Window handle exists, // then everything is fine. this.Loaded += (s, e) => this.AddHookParameterPassing(); } } }
using Cauldron.Core.Reflection; using Cauldron; using System.Diagnostics; using System.Windows; namespace Win32_WPF_ParameterPassing { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); // This is online meant for Lazy people // So that they don't have to open the console separately var process = Process.Start(new ProcessStartInfo { FileName = "cmd", WorkingDirectory = ApplicationInfo.ApplicationPath.FullName }); this.Unloaded += (s, e) => process.Kill(); // This is the only relevant line here. // This can be also added via Behaviour / Action // As long as the Window is loaded and a Window handle exists, // then everything is fine. this.Loaded += (s, e) => this.AddHookParameterPassing(); } } }
mit
C#
ce2189cf170f651fea7cd3a99b88c081cc0f6b4e
add description to assembly info.
T-Alex/Common
TAlex.Common.Configuration/Properties/AssemblyInfo.cs
TAlex.Common.Configuration/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("TAlex.Common.Configuration")] [assembly: AssemblyDescription("Configuration Providers Library.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("T-Alex Software")] [assembly: AssemblyProduct("TAlex.Common.Configuration")] [assembly: AssemblyCopyright("Copyright © 2015 T-Alex Software")] [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("cae48921-9961-4a74-b0f0-8382e8226b21")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TAlex.Common.Configuration")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("T-Alex Software")] [assembly: AssemblyProduct("TAlex.Common.Configuration")] [assembly: AssemblyCopyright("Copyright © 2015 T-Alex Software")] [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("cae48921-9961-4a74-b0f0-8382e8226b21")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
fbac74faf1730ceeddad1a5820d6d3405dd5de0c
Change version to 3.5.1
WaltChen/NDatabase,WaltChen/NDatabase
src/Properties/AssemblyInfo.cs
src/Properties/AssemblyInfo.cs
using System; 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("NDatabase")] [assembly: AssemblyDescription("C# Lightweight Object Database")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NDatabase")] [assembly: AssemblyProduct("NDatabase")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("NDatabase")] [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("480da8c2-ad2e-4aac-aacd-36a8cfa5581f")] [assembly: CLSCompliant(true)] // 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("3.5.1.*")] [assembly: AssemblyFileVersion("3.5.1.0")] [assembly: AssemblyInformationalVersion("3.5.1-stable")] [assembly: InternalsVisibleTo("NDatabase.UnitTests")] [assembly: InternalsVisibleTo("NDatabase.Old.UnitTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
using System; 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("NDatabase")] [assembly: AssemblyDescription("C# Lightweight Object Database")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NDatabase")] [assembly: AssemblyProduct("NDatabase")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("NDatabase")] [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("480da8c2-ad2e-4aac-aacd-36a8cfa5581f")] [assembly: CLSCompliant(true)] // 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("3.5.0.*")] [assembly: AssemblyFileVersion("3.5.0.0")] [assembly: AssemblyInformationalVersion("3.5.0-stable")] [assembly: InternalsVisibleTo("NDatabase.UnitTests")] [assembly: InternalsVisibleTo("NDatabase.Old.UnitTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
apache-2.0
C#
27a2ae5742e51adad73db9166a27b076785b25aa
Make recompense
agrc/deq-enviro,agrc/deq-enviro,agrc/deq-enviro,agrc/deq-enviro
api/Deq.Search.Soe/Configuration/UserConfiguration.cs
api/Deq.Search.Soe/Configuration/UserConfiguration.cs
using Deq.Search.Soe.Extensions; using Deq.Search.Soe.Infastructure; using Deq.Search.Soe.Models.Configuration; using ESRI.ArcGIS.esriSystem; namespace Deq.Search.Soe.Configuration { #region License // // Copyright (C) 2012 AGRC // 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. // #endregion /// <summary> /// Debug configuration. Preconfigured for debug environment /// </summary> public class UserConfiguration : IConfigurable { public ApplicationFieldSettings GetFields(IPropertySet props) { var settingss = new ApplicationFieldSettings { ReturnFields = props.GetValueAsString("returnfields", true).Split(','), ProgramId = props.GetValueAsString("programid", true), SiteName = props.GetValueAsString("sitename", true) }; return settings; } } }
using Deq.Search.Soe.Extensions; using Deq.Search.Soe.Infastructure; using Deq.Search.Soe.Models.Configuration; using ESRI.ArcGIS.esriSystem; namespace Deq.Search.Soe.Configuration { #region License // // Copyright (C) 2012 AGRC // 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. // #endregion /// <summary> /// Debug configration. Preconfigured for debug environment /// </summary> public class UserConfiguration : IConfigurable { public ApplicationFieldSettings GetFields(IPropertySet props) { var settings = new ApplicationFieldSettings { ReturnFields = new[] { "ID", "NAME", "ADDRESS", "CITY", "TYPE", "OBJECTID", "ENVIROAPPLABEL" }, ProgramId = "ID", SiteName = "NAME" }; return settings; } } }
mit
C#
83c00bcae17a26b1e29f0ae3bd70b72516057d6a
write warnings to a file, not stdout
edyoung/prequel
GenerateDocs/Program.cs
GenerateDocs/Program.cs
using Prequel; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GenerateDocs { /// <summary> /// Output markdown text for info about the program's options, to keep docs in sync with code /// </summary> class Program { static void Main(string[] args) { using (var stream = new StreamWriter("warnings.md")) { for (int id = WarningInfo.MinWarningID; id <= WarningInfo.MaxWarningID; id++) { WarningID warningID = (WarningID)id; WarningInfo info = Warning.WarningTypes[warningID]; stream.WriteLine(@" ### Warning {0} : {1} {2} {3} ", (int)info.ID, info.Name, info.Level, info.Description); } } } } }
using Prequel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GenerateDocs { /// <summary> /// Output markdown text for info about the program's options, to keep docs in sync with code /// </summary> class Program { static void Main(string[] args) { for (int id = WarningInfo.MinWarningID; id <= WarningInfo.MaxWarningID; id++) { WarningID warningID = (WarningID)id; WarningInfo info = Warning.WarningTypes[warningID]; Console.WriteLine(@" ### Warning {0} : {1} {2} {3} ", (int)info.ID, info.Name, info.Level, info.Description); } } } }
mit
C#
2586453ab97a422fb06ffbab1cd7aa8a95134aae
Update the sample project a little to match the newer API.
mdavid/manos-spdy,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy
sample/mango-project/MangoProject.cs
sample/mango-project/MangoProject.cs
using Mango; using Mango.Templates.Minge; namespace MangoProject { // // A mango application is made of MangoModules and MangoApps // There really isn't any difference between a Module and an App // except that the server will load the MangoApp first. A mango // application can only have one MangoApp, but as many MangoModules // as you want. // public class MangoProject : MangoApp { // // This method is called when the server first starts, // public override void OnStartup () { // // Routing can be done by using the Get/Head/Post/Put/Delete/Trace // methods. They take a regular expression and either a method // or another module to hand off processing to. // // The regular expressions come after the method/module, because // Mango uses params to allow you to easily register multiple // regexs to the same handler // Get ("Home", Home); // // The Route method will hand off all HTTP methods to the supplied // method or module // // Route (new AdminModule (), "Admin/"); } // // Handlers can be registered with attributes too // [Get ("About")] public static void About (MangoContext ctx) { // // Templates use property lookup, so you can pass in // a strongly typed object, or you can use an anonymous // type. // RenderTemplate (ctx, "about.html", new { Title = "About", Message = "Hey, I am the about page.", }); } public static void Home (MangoContext ctx) { RenderTemplate (ctx, "home.html", new { Title = "Home", Message = "Welcome to the Mango-Project." }); } } // // Normally a different module would be in a different file, but for // demo porpoises we'll do it here. // public class AdminModule : MangoModule { public override void OnStartup () { } /// blah, blah, blah } }
using Mango; using Mango.Templates.Minge; namespace MangoProject { // // A mango application is made of MangoModules and MangoApps // There really isn't any difference between a Module and an App // except that the server will load the MangoApp first. A mango // application can only have one MangoApp, but as many MangoModules // as you want. // public class MangoProject : MangoApp { // // This method is called when the server first starts, // public override void OnStartup () { Templates.Initialize ("templates/"); // // Routing can be done by using the Get/Head/Post/Put/Delete/Trace // methods. They take a regular expression and either a method // or another module to hand off processing to. // // The regular expressions come after the method/module, because // Mango uses params to allow you to easily register multiple // regexs to the same handler // Get ("Home", Home); // // The Route method will hand off all HTTP methods to the supplied // method or module // // Route (new AdminModule (), "Admin/"); } // // Handlers can be registered with attributes too // [Get ("About")] public static void About (MangoContext ctx) { // // Templates use property lookup, so you can pass in // a strongly typed object, or you can use an anonymous // type. // RenderTemplate (ctx, "about.html", new { Title = "About", Message = "Hey, I am the about page.", }); } public static void Home (MangoContext ctx) { RenderTemplate (ctx, "home.html", new { Title = "Home", Message = "Welcome to the Mango-Project." }); } } // // Normally a different module would be in a different file, but for // demo porpoises we'll do it here. // public class AdminModule : MangoModule { public override void OnStartup () { } /// blah, blah, blah } }
mit
C#
8f491662d14e1113e2fef7181fd2ef083da83b3a
Update Index.cshtml
IBM-Bluemix/asp.net5-helloworld,IBM-Bluemix/asp.net5-helloworld
src/dotnetHelloWorld/Views/Home/Index.cshtml
src/dotnetHelloWorld/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Hello World!"; } <div class="container"> <h1>Welcome.</h1> <div id="nameInput" class="input-group-lg center-block helloInput"> <p class="lead">What is your name?</p> <input id="user_name" type="text" class="form-control" placeholder="name" aria-describedby="sizing-addon1" value="" /> </div> <p id="response" class="lead text-center"></p> // <p id="databaseNames" class="lead text-center"></p> </div> @section scripts { <script>//Submit data when enter key is pressed $('#user_name').keydown(function(e) { var name = $('#user_name').val(); if (e.which == 13 && name.length > 0) { //catch Enter key $('#nameInput').hide(); $('#response').html("loading..."); $('#response').html("Hello "+name); } });</script> }
@{ ViewData["Title"] = "Hello World!"; } <div class="container"> <h1>Welcome.</h1> <div id="nameInput" class="input-group-lg center-block helloInput"> <p class="lead">What is your name?</p> <input id="user_name" type="text" class="form-control" placeholder="name" aria-describedby="sizing-addon1" value="" /> </div> <p id="response" class="lead text-center"></p> <p id="databaseNames" class="lead text-center"></p> </div> @section scripts { <script>//Submit data when enter key is pressed $('#user_name').keydown(function(e) { var name = $('#user_name').val(); if (e.which == 13 && name.length > 0) { //catch Enter key $('#nameInput').hide(); $('#response').html("loading..."); $('#response').html("Hello "+name); } });</script> }
apache-2.0
C#
7f5771efb63954b3603f7460c91e9d0fff870eeb
Remove unneccesary consume call
northspb/RawRabbit,pardahlman/RawRabbit
src/RawRabbit/Operations/Subscriber.cs
src/RawRabbit/Operations/Subscriber.cs
using System; using System.Threading.Tasks; using RawRabbit.Common; using RawRabbit.Configuration.Subscribe; using RawRabbit.Consumer.Contract; using RawRabbit.Context; using RawRabbit.Context.Provider; using RawRabbit.Logging; using RawRabbit.Operations.Contracts; using RawRabbit.Serialization; namespace RawRabbit.Operations { public class Subscriber<TMessageContext> : OperatorBase, ISubscriber<TMessageContext> where TMessageContext : IMessageContext { private readonly IConsumerFactory _consumerFactory; private readonly IMessageContextProvider<TMessageContext> _contextProvider; private readonly ILogger _logger = LogManager.GetLogger<Subscriber<TMessageContext>>(); public Subscriber(IChannelFactory channelFactory, IConsumerFactory consumerFactory, IMessageSerializer serializer, IMessageContextProvider<TMessageContext> contextProvider) : base(channelFactory, serializer) { _consumerFactory = consumerFactory; _contextProvider = contextProvider; } public void SubscribeAsync<T>(Func<T, TMessageContext, Task> subscribeMethod, SubscriptionConfiguration config) { DeclareQueue(config.Queue); DeclareExchange(config.Exchange); BindQueue(config.Queue, config.Exchange, config.RoutingKey); SubscribeAsync(config, subscribeMethod); } private void SubscribeAsync<T>(SubscriptionConfiguration cfg, Func<T, TMessageContext, Task> subscribeMethod) { var consumer = _consumerFactory.CreateConsumer(cfg); consumer.OnMessageAsync = (o, args) => { var bodyTask = Task.Run(() => Serializer.Deserialize<T>(args.Body)); var contextTask = _contextProvider.ExtractContextAsync(args.BasicProperties.Headers[_contextProvider.ContextHeaderName]); return Task .WhenAll(bodyTask, contextTask) .ContinueWith(task => subscribeMethod(bodyTask.Result, contextTask.Result)); }; _logger.LogDebug($"Setting up a consumer on queue {cfg.Queue.QueueName} with NoAck set to {cfg.NoAck}."); } } }
using System; using System.Threading.Tasks; using RawRabbit.Common; using RawRabbit.Configuration.Subscribe; using RawRabbit.Consumer.Contract; using RawRabbit.Context; using RawRabbit.Context.Provider; using RawRabbit.Logging; using RawRabbit.Operations.Contracts; using RawRabbit.Serialization; namespace RawRabbit.Operations { public class Subscriber<TMessageContext> : OperatorBase, ISubscriber<TMessageContext> where TMessageContext : IMessageContext { private readonly IConsumerFactory _consumerFactory; private readonly IMessageContextProvider<TMessageContext> _contextProvider; private readonly ILogger _logger = LogManager.GetLogger<Subscriber<TMessageContext>>(); public Subscriber(IChannelFactory channelFactory, IConsumerFactory consumerFactory, IMessageSerializer serializer, IMessageContextProvider<TMessageContext> contextProvider) : base(channelFactory, serializer) { _consumerFactory = consumerFactory; _contextProvider = contextProvider; } public void SubscribeAsync<T>(Func<T, TMessageContext, Task> subscribeMethod, SubscriptionConfiguration config) { DeclareQueue(config.Queue); DeclareExchange(config.Exchange); BindQueue(config.Queue, config.Exchange, config.RoutingKey); SubscribeAsync(config, subscribeMethod); } private void SubscribeAsync<T>(SubscriptionConfiguration cfg, Func<T, TMessageContext, Task> subscribeMethod) { var consumer = _consumerFactory.CreateConsumer(cfg); consumer.OnMessageAsync = (o, args) => { var bodyTask = Task.Run(() => Serializer.Deserialize<T>(args.Body)); var contextTask = _contextProvider.ExtractContextAsync(args.BasicProperties.Headers[_contextProvider.ContextHeaderName]); return Task .WhenAll(bodyTask, contextTask) .ContinueWith(task => subscribeMethod(bodyTask.Result, contextTask.Result)); }; _logger.LogDebug($"Setting up a consumer on queue {cfg.Queue.QueueName} with NoAck set to {cfg.NoAck}."); consumer.Model.BasicConsume( queue: cfg.Queue.QueueName, noAck: cfg.NoAck, consumer: consumer ); } } }
mit
C#
420b4b2fe006285032448e7c065f1b68727063c5
Increment to RC6
kamsar/Unicorn,MacDennis76/Unicorn,PetersonDave/Unicorn,bllue78/Unicorn,GuitarRich/Unicorn,MacDennis76/Unicorn,PetersonDave/Unicorn,bllue78/Unicorn,rmwatson5/Unicorn,kamsar/Unicorn,GuitarRich/Unicorn,rmwatson5/Unicorn
src/Unicorn/Properties/AssemblyInfo.cs
src/Unicorn/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Unicorn")] [assembly: AssemblyDescription("Sitecore serialization helper framework")] // 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("c7d93d67-1319-4d3c-b2f8-f74fdff6fb07")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0-RC6")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Unicorn")] [assembly: AssemblyDescription("Sitecore serialization helper framework")] // 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("c7d93d67-1319-4d3c-b2f8-f74fdff6fb07")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0-RC5")]
mit
C#
77bac0cbf5a538bd46db9055bfcecd033eaeeef8
Update NewPost.cshtml
dncuug/dot-net.in.ua,dncuug/dot-net.in.ua,dncuug/dot-net.in.ua
src/WebSite/Views/Admin/NewPost.cshtml
src/WebSite/Views/Admin/NewPost.cshtml
@model Core.ViewModels.PublicationViewModel @{ ViewData["Title"] = "Add new publication"; } <h1>@ViewData["Title"]</h1> <form> <div class="form-group"> <label for="link">Link</label> <input type="url" class="form-control" id="link" placeholder="Link"> </div> <div class="form-group"> <label for="security-key">Security Key</label> <input type="password" class="form-control" id="security-key" placeholder="Security Key"> </div> <div class="form-group"> <label for="post-comment">Comment (Facebook, Telegram)</label> <input type="text" class="form-control" id="post-comment" placeholder="Telegram Comment"> </div> <div class="form-group"> <label for="category-id">Category</label> <select class="form-control" id="category-id"> </select> </div> <button type="button" id="add-post" class="btn btn-primary">Add</button> </form> <br /> <div class="progress"> <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> </div> </div> <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> <script src="/js/new-post.js"></script>
@model Core.ViewModels.PublicationViewModel @{ ViewData["Title"] = "Add new publication"; } <h1>@ViewData["Title"]</h1> <form> <div class="form-group"> <label for="link">Link</label> <input type="url" class="form-control" id="link" placeholder="Link"> </div> <div class="form-group"> <label for="security-key">Security Key</label> <input type="password" class="form-control" id="security-key" placeholder="Security Key"> </div> <div class="form-group"> <label for="post-comment">Telegram Comment</label> <input type="text" class="form-control" id="post-comment" placeholder="Telegram Comment"> </div> <div class="form-group"> <label for="category-id">Category</label> <select class="form-control" id="category-id"> </select> </div> <button type="button" id="add-post" class="btn btn-primary">Add</button> </form> <br /> <div class="progress"> <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> </div> </div> <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> <script src="/js/new-post.js"></script>
mit
C#
f37da538ac7ee42a709c302454192b23a7f01504
fix endpoint for create
MasterDevs/ChromeDevTools
source/ChromeDevTools/RemoteChromeProcess.cs
source/ChromeDevTools/RemoteChromeProcess.cs
using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; namespace MasterDevs.ChromeDevTools { public class RemoteChromeProcess : IChromeProcess { private readonly HttpClient http; public RemoteChromeProcess(string remoteDebuggingUri) : this(new Uri(remoteDebuggingUri)) { } public RemoteChromeProcess(Uri remoteDebuggingUri) { RemoteDebuggingUri = remoteDebuggingUri; http = new HttpClient { BaseAddress = RemoteDebuggingUri }; } public Uri RemoteDebuggingUri { get; } public virtual void Dispose() { http.Dispose(); } public async Task<ChromeSessionInfo[]> GetSessionInfo() { string json = await http.GetStringAsync("/json"); return JsonConvert.DeserializeObject<ChromeSessionInfo[]>(json); } public async Task<ChromeSessionInfo> StartNewSession() { string json = await http.GetStringAsync("/json/new"); return JsonConvert.DeserializeObject<ChromeSessionInfo>(json); } } }
using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; namespace MasterDevs.ChromeDevTools { public class RemoteChromeProcess : IChromeProcess { private readonly HttpClient http; public RemoteChromeProcess(string remoteDebuggingUri) : this(new Uri(remoteDebuggingUri)) { } public RemoteChromeProcess(Uri remoteDebuggingUri) { RemoteDebuggingUri = remoteDebuggingUri; http = new HttpClient { BaseAddress = RemoteDebuggingUri }; } public Uri RemoteDebuggingUri { get; } public virtual void Dispose() { http.Dispose(); } public async Task<ChromeSessionInfo[]> GetSessionInfo() { string json = await http.GetStringAsync("/json"); return JsonConvert.DeserializeObject<ChromeSessionInfo[]>(json); } public async Task<ChromeSessionInfo> StartNewSession() { string json = await http.GetStringAsync("/json"); return JsonConvert.DeserializeObject<ChromeSessionInfo>(json); } } }
mit
C#
1374409b29b5b5ffd630398ba3675e01cc5b3cea
Update AlphaStreamsSlippageModel.cs
QuantConnect/Lean,StefanoRaggi/Lean,jameschch/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,JKarathiya/Lean,QuantConnect/Lean,QuantConnect/Lean,jameschch/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,jameschch/Lean,AlexCatarino/Lean,JKarathiya/Lean,JKarathiya/Lean,jameschch/Lean,QuantConnect/Lean,StefanoRaggi/Lean,jameschch/Lean,StefanoRaggi/Lean,JKarathiya/Lean,AlexCatarino/Lean
Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Securities; using System.Collections.Generic; namespace QuantConnect.Orders.Slippage { /// <summary> /// Represents a slippage model that uses a constant percentage of slip /// </summary> public class AlphaStreamsSlippageModel : ISlippageModel { private const decimal _slippagePercent = 0.0005m; /// <summary> /// Unfortunate dictionary of ETFs and their spread on 10/10 so that we can better approximate /// slippage for the competition /// </summary> private readonly IDictionary<string, decimal> _spreads = new Dictionary<string, decimal> { {"PPLT", 0.13m}, {"DGAZ", 0.135m}, {"EDV", 0.085m}, {"SOXL", 0.1m} }; /// <summary> /// Initializes a new instance of the <see cref="AlphaStreamsSlippageModel"/> class /// </summary> public AlphaStreamsSlippageModel() { } /// <summary> /// Return a decimal cash slippage approximation on the order. /// </summary> public decimal GetSlippageApproximation(Security asset, Order order) { if (asset.Type != SecurityType.Equity) { return 0; } decimal slippagePercent; if (!_spreads.TryGetValue(asset.Symbol.Value, out slippagePercent)) { return _slippagePercent * asset.GetLastData()?.Value ?? 0; } return slippagePercent * asset.GetLastData()?.Value ?? 0; } } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Securities; namespace QuantConnect.Orders.Slippage { /// <summary> /// Represents a slippage model that uses a constant percentage of slip /// </summary> public class AlphaStreamsSlippageModel : ISlippageModel { private const decimal _slippagePercent = 0.001m; /// <summary> /// Initializes a new instance of the <see cref="AlphaStreamsSlippageModel"/> class /// </summary> public AlphaStreamsSlippageModel() { } /// <summary> /// Return a decimal cash slippage approximation on the order. /// </summary> public decimal GetSlippageApproximation(Security asset, Order order) { if (asset.Type != SecurityType.Equity) { return 0; } return _slippagePercent * asset.GetLastData()?.Value ?? 0; } } }
apache-2.0
C#
65e687e06a0c838591f633e0a9ee006dd90e3cec
Simplify ClassReport by defering to an ExecutionSummary for tallies.
fixie/fixie
src/Fixie.Execution/Listeners/ClassReport.cs
src/Fixie.Execution/Listeners/ClassReport.cs
namespace Fixie.Execution.Listeners { using System; using System.Collections.Generic; public class ClassReport { readonly List<CaseCompleted> cases; readonly ExecutionSummary summary; public ClassReport(string name) { cases = new List<CaseCompleted>(); summary = new ExecutionSummary(); Name = name; } public void Add(CaseCompleted message) { cases.Add(message); summary.Add(message); } public string Name { get; } public IReadOnlyList<CaseCompleted> Cases => cases; public int Passed => summary.Passed; public int Failed => summary.Failed; public int Skipped => summary.Skipped; public TimeSpan Duration => summary.Duration; } }
namespace Fixie.Execution.Listeners { using System; using System.Collections.Generic; using System.Linq; public class ClassReport { readonly List<CaseCompleted> cases; public ClassReport(string name) { cases = new List<CaseCompleted>(); Name = name; } public void Add(CaseCompleted caseCompleted) => cases.Add(caseCompleted); public string Name { get; } public TimeSpan Duration => new TimeSpan(cases.Sum(result => result.Duration.Ticks)); public IReadOnlyList<CaseCompleted> Cases => cases; public int Passed => cases.Count(@case => @case.Status == CaseStatus.Passed); public int Failed => cases.Count(@case => @case.Status == CaseStatus.Failed); public int Skipped => cases.Count(@case => @case.Status == CaseStatus.Skipped); } }
mit
C#
1ef498c6f4639c7a2e949b657356b535016fa2f7
Fix AssemblyVersion
dmitry-shechtman/AsyncInit
AsyncInit.Unity/Portable/Properties/AssemblyInfo.cs
AsyncInit.Unity/Portable/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Ditto.AsyncInit.Unity")] [assembly: AssemblyDescription("Unity Container Async Extensions")] [assembly: AssemblyVersion("1.5.0.*")] [assembly: ComVisible(false)]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Ditto.AsyncInit.Unity")] [assembly: AssemblyDescription("Unity Container Async Extensions")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
apache-2.0
C#
a9e47dca09003b0d1ec16820b51600a641251187
Fix mouse double click (works now also for ListViewItem)
gep13/ChocolateyGUI,gep13/ChocolateyGUI,chocolatey/ChocolateyGUI,gep13/ChocolateyGUI,chocolatey/ChocolateyGUI,gep13/ChocolateyGUI,digital-carver/ChocolateyGUI,chocolatey/ChocolateyGUI,gep13/ChocolateyGUI,chocolatey/ChocolateyGUI,chocolatey/ChocolateyGUI
Source/ChocolateyGui/Views/RemoteSourceView.xaml.cs
Source/ChocolateyGui/Views/RemoteSourceView.xaml.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright company="Chocolatey" file="RemoteSourceView.xaml.cs"> // Copyright 2014 - Present Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using Caliburn.Micro; using ChocolateyGui.Models.Messages; using ChocolateyGui.ViewModels.Items; namespace ChocolateyGui.Views { /// <summary> /// Interaction logic for RemoteSourceControl.xaml /// </summary> public partial class RemoteSourceView : IHandle<ResetScrollPositionMessage> { public RemoteSourceView(IEventAggregator eventAggregator) { if (eventAggregator == null) { throw new ArgumentNullException(nameof(eventAggregator)); } InitializeComponent(); eventAggregator.Subscribe(this); this.Loaded += RemoteSourceViewOnLoaded; } public void Handle(ResetScrollPositionMessage message) { if (Packages.Items.Count > 0) { Packages.ScrollIntoView(Packages.Items[0]); } } private void RemoteSourceViewOnLoaded(object sender, RoutedEventArgs e) { this.SearchTextBox.Focus(); } private void Packages_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { var obj = (DependencyObject)e.OriginalSource; while (obj != null && obj != Packages) { var listBoxItem = obj as ListBoxItem; if (listBoxItem != null) { var context = (IPackageViewModel)listBoxItem.DataContext; context.ViewDetails(); } obj = VisualTreeHelper.GetParent(obj); } } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright company="Chocolatey" file="RemoteSourceView.xaml.cs"> // Copyright 2014 - Present Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using Caliburn.Micro; using ChocolateyGui.Models.Messages; using ChocolateyGui.ViewModels.Items; namespace ChocolateyGui.Views { /// <summary> /// Interaction logic for RemoteSourceControl.xaml /// </summary> public partial class RemoteSourceView : IHandle<ResetScrollPositionMessage> { public RemoteSourceView(IEventAggregator eventAggregator) { if (eventAggregator == null) { throw new ArgumentNullException(nameof(eventAggregator)); } InitializeComponent(); eventAggregator.Subscribe(this); this.Loaded += RemoteSourceViewOnLoaded; } public void Handle(ResetScrollPositionMessage message) { if (Packages.Items.Count > 0) { Packages.ScrollIntoView(Packages.Items[0]); } } private void RemoteSourceViewOnLoaded(object sender, RoutedEventArgs e) { this.SearchTextBox.Focus(); } private void Packages_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { var obj = (DependencyObject)e.OriginalSource; while (obj != null && obj != Packages) { if (obj.GetType() == typeof(ListBoxItem)) { var item = (ListBoxItem)obj; var context = (IPackageViewModel)item.DataContext; context.ViewDetails(); } obj = VisualTreeHelper.GetParent(obj); } } } }
apache-2.0
C#
f0337d6c8914b85ce25b6ff4ef4a170cf37b43db
Use "." instead of ":" in env var key.
paritoshmmmec/NEventStore,jamiegaines/NEventStore,chris-evans/NEventStore,marcoaoteixeira/NEventStore,gael-ltd/NEventStore,AGiorgetti/NEventStore,D3-LucaPiombino/NEventStore,NEventStore/NEventStore,adamfur/NEventStore,nerdamigo/NEventStore,deltatre-webplu/NEventStore
src/tests/EventStore.Persistence.AcceptanceTests/EnviromentConnectionFactory.cs
src/tests/EventStore.Persistence.AcceptanceTests/EnviromentConnectionFactory.cs
namespace EventStore.Persistence.AcceptanceTests { using System; using System.Data; using System.Data.Common; using System.Diagnostics; using SqlPersistence; public class EnviromentConnectionFactory : IConnectionFactory { private readonly string providerInvariantName; private readonly string envVarKey; public EnviromentConnectionFactory(string envDatabaseName, string providerInvariantName) { this.envVarKey = "NEventStore.{0}".FormatWith(envDatabaseName); this.providerInvariantName = providerInvariantName; } public IDbConnection OpenMaster(Guid streamId) { return new ConnectionScope("master", Open); } public IDbConnection OpenReplica(Guid streamId) { return new ConnectionScope("master", Open); } private IDbConnection Open() { DbProviderFactory dbProviderFactory = DbProviderFactories.GetFactory(providerInvariantName); string connectionString = Environment.GetEnvironmentVariable(envVarKey, EnvironmentVariableTarget.Process); connectionString = connectionString.TrimStart('"').TrimEnd('"'); DbConnection connection = dbProviderFactory.CreateConnection(); Debug.Assert(connection != null, "connection != null"); connection.ConnectionString = connectionString; try { connection.Open(); } catch (Exception e) { throw new StorageUnavailableException(e.Message, e); } return connection; } } }
namespace EventStore.Persistence.AcceptanceTests { using System; using System.Data; using System.Data.Common; using System.Diagnostics; using SqlPersistence; public class EnviromentConnectionFactory : IConnectionFactory { private readonly string providerInvariantName; private readonly string envVarKey; public EnviromentConnectionFactory(string envDatabaseName, string providerInvariantName) { this.envVarKey = "NEventStore:{0}".FormatWith(envDatabaseName); this.providerInvariantName = providerInvariantName; } public IDbConnection OpenMaster(Guid streamId) { return new ConnectionScope("master", Open); } public IDbConnection OpenReplica(Guid streamId) { return new ConnectionScope("master", Open); } private IDbConnection Open() { DbProviderFactory dbProviderFactory = DbProviderFactories.GetFactory(providerInvariantName); string connectionString = Environment.GetEnvironmentVariable(envVarKey, EnvironmentVariableTarget.Process); connectionString = connectionString.TrimStart('"').TrimEnd('"'); DbConnection connection = dbProviderFactory.CreateConnection(); Debug.Assert(connection != null, "connection != null"); connection.ConnectionString = connectionString; try { connection.Open(); } catch (Exception e) { throw new StorageUnavailableException(e.Message, e); } return connection; } } }
mit
C#
3afcbcc204e0babca6398ab2bb67a8c2631892a6
Update SMSTodayAMController.cs
dkitchen/bpcc,dkitchen/bpcc
src/BPCCScheduler.Web/Controllers/SMSTodayAMController.cs
src/BPCCScheduler.Web/Controllers/SMSTodayAMController.cs
using BPCCScheduler.Models; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using Twilio; namespace BPCCScheduler.Controllers { public class SMSTodayAMController : SMSApiController { //public IEnumerable<SMSMessage> Get() public string Get() { //any appointment today after last-night midnight, but before today noon var lastNightMidnight = DateTime.Now.Date; var ret = ""; ret += lastNightMidnight.ToLongDateString(); ret += " " + lastNightMidnight.ToLongTimeString(); var todayNoon = lastNightMidnight.AddHours(12); ret += " " + todayNoon.ToLongDateString(); ret += " " + todayNoon.ToLongTimeString(); return ret; var appts = base.AppointmentContext.Appointments.ToList() //materialize for date conversion .Where(i => i.Date.ToLocalTime() > lastNightMidnight && i.Date.ToLocalTime() < todayNoon); var messages = new List<SMSMessage>(); foreach (var appt in appts) { var body = string.Format("BPCC Reminder: Appointment this morning at {0}", appt.Date.ToLocalTime().ToShortTimeString()); var cell = string.Format("+1{0}", appt.Cell); messages.Add(base.SendSmsMessage(cell, body)); } //return messages; } } }
using BPCCScheduler.Models; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using Twilio; namespace BPCCScheduler.Controllers { public class SMSTodayAMController : SMSApiController { //public IEnumerable<SMSMessage> Get() public string Get() { //any appointment today after last-night midnight, but before today noon var lastNightMidnight = DateTime.Now.Date; var ret = ""; ret += lastNightMidnight.ToLongDateString(); ret += " " + lastNightMidnight.ToLongTimeString() var todayNoon = lastNightMidnight.AddHours(12); ret += " " + todayNoon.ToLongDateString(); ret += " " + todayNoon.ToLongTimeString(); return ret; var appts = base.AppointmentContext.Appointments.ToList() //materialize for date conversion .Where(i => i.Date.ToLocalTime() > lastNightMidnight && i.Date.ToLocalTime() < todayNoon); var messages = new List<SMSMessage>(); foreach (var appt in appts) { var body = string.Format("BPCC Reminder: Appointment this morning at {0}", appt.Date.ToLocalTime().ToShortTimeString()); var cell = string.Format("+1{0}", appt.Cell); messages.Add(base.SendSmsMessage(cell, body)); } //return messages; } } }
mit
C#
48adcd43aa1e86d2e2e8aeb6885c0f3710124071
Handle Char and DateTime correctly
bluefalcon/fluentmigrator,mstancombe/fluentmigrator,FabioNascimento/fluentmigrator,istaheev/fluentmigrator,wolfascu/fluentmigrator,DefiSolutions/fluentmigrator,KaraokeStu/fluentmigrator,spaccabit/fluentmigrator,mstancombe/fluentmig,fluentmigrator/fluentmigrator,swalters/fluentmigrator,daniellee/fluentmigrator,fluentmigrator/fluentmigrator,tohagan/fluentmigrator,stsrki/fluentmigrator,mstancombe/fluentmig,istaheev/fluentmigrator,drmohundro/fluentmigrator,IRlyDontKnow/fluentmigrator,jogibear9988/fluentmigrator,modulexcite/fluentmigrator,FabioNascimento/fluentmigrator,lcharlebois/fluentmigrator,akema-fr/fluentmigrator,alphamc/fluentmigrator,igitur/fluentmigrator,schambers/fluentmigrator,lahma/fluentmigrator,lcharlebois/fluentmigrator,tommarien/fluentmigrator,MetSystem/fluentmigrator,barser/fluentmigrator,itn3000/fluentmigrator,drmohundro/fluentmigrator,wolfascu/fluentmigrator,vgrigoriu/fluentmigrator,itn3000/fluentmigrator,mstancombe/fluentmig,mstancombe/fluentmigrator,schambers/fluentmigrator,tohagan/fluentmigrator,igitur/fluentmigrator,ManfredLange/fluentmigrator,lahma/fluentmigrator,eloekset/fluentmigrator,dealproc/fluentmigrator,tohagan/fluentmigrator,dealproc/fluentmigrator,DefiSolutions/fluentmigrator,bluefalcon/fluentmigrator,IRlyDontKnow/fluentmigrator,stsrki/fluentmigrator,amroel/fluentmigrator,eloekset/fluentmigrator,amroel/fluentmigrator,spaccabit/fluentmigrator,barser/fluentmigrator,alphamc/fluentmigrator,KaraokeStu/fluentmigrator,swalters/fluentmigrator,akema-fr/fluentmigrator,ManfredLange/fluentmigrator,tommarien/fluentmigrator,DefiSolutions/fluentmigrator,daniellee/fluentmigrator,istaheev/fluentmigrator,jogibear9988/fluentmigrator,ManfredLange/fluentmigrator,vgrigoriu/fluentmigrator,lahma/fluentmigrator,daniellee/fluentmigrator,MetSystem/fluentmigrator,modulexcite/fluentmigrator
src/FluentMigrator.Runner/Generators/ConstantFormatter.cs
src/FluentMigrator.Runner/Generators/ConstantFormatter.cs
using System; namespace FluentMigrator.Runner.Generators { public class ConstantFormatter : IConstantFormatter { public string Format(object value) { if (value == null) { return "null"; } string stringValue = value as string; if (stringValue != null) { return "'" + stringValue.Replace("'", "''") + "'"; } if (value is char) { return "'" + value + "'"; } if (value is bool) { return ((bool)value) ? 1.ToString() : 0.ToString(); } if (value is Guid) { return "'" + ((Guid)value).ToString().Replace("'", "''") + "'"; } if (value is DateTime) { return "'" + ((DateTime)value).ToString("yyyy-MM-ddTHH:mm:ss")+ "'"; } return value.ToString(); } } }
using System; namespace FluentMigrator.Runner.Generators { class ConstantFormatter : IConstantFormatter { public string Format(object value) { if (value == null) { return "null"; } string stringValue = value as string; if (stringValue != null) { return "'" + stringValue.Replace("'", "''") + "'"; } if (value is char) if (value is Guid) { return "'" + value + "'"; } if (value is bool) { return ((bool)value) ? 1.ToString() : 0.ToString(); } if (value is Guid) { return "'" + ((Guid)value).ToString().Replace("'", "''") + "'"; } if (value is DateTime) { return "'" + value.ToString().Replace("'", "''") + "'"; } return value.ToString(); } } }
apache-2.0
C#
53f263b58dd7f0afb27f7cdabf4b5ff9c72b03f5
Update FluidityListViewFieldConfig.cs
mattbrailsford/umbraco-fluidity,mattbrailsford/umbraco-fluidity,mattbrailsford/umbraco-fluidity
src/Fluidity/Configuration/FluidityListViewFieldConfig.cs
src/Fluidity/Configuration/FluidityListViewFieldConfig.cs
// <copyright file="FluidityListViewFieldConfig.cs" company="Matt Brailsford"> // Copyright (c) 2017 Matt Brailsford and contributors. // Licensed under the Apache License, Version 2.0. // </copyright> using System; using System.Linq.Expressions; namespace Fluidity.Configuration { /// <summary> /// Un typed base class for a <see cref="FluidityListViewFieldConfig{TEntityType, TValueType}"/> /// </summary> public abstract class FluidityListViewFieldConfig { protected FluidityPropertyConfig _property; internal FluidityPropertyConfig Property => _property; protected string _heading; internal string Heading => _heading; protected Func<object, object, object> _format; internal Func<object, object, object> Format => _format; /// <summary> /// Initializes a new instance of the <see cref="FluidityListViewFieldConfig"/> class. /// </summary> /// <param name="propertyExpression">The property expression.</param> protected FluidityListViewFieldConfig(LambdaExpression propertyExpression) { _property = new FluidityPropertyConfig(propertyExpression); } } }
// <copyright file="FluidityListViewFieldConfig.cs" company="Matt Brailsford"> // Copyright (c) 2017 Matt Brailsford and contributors. // Licensed under the Apache License, Version 2.0. // </copyright> using System; using System.Linq.Expressions; namespace Fluidity.Configuration { /// <summary> /// Un typed base class for a <see cref="FluidityListViewFieldConfig{TEntityType, TValueType}"/> /// </summary> public abstract class FluidityListViewFieldConfig { protected FluidityPropertyConfig _property; internal FluidityPropertyConfig Property => _property; protected string _heading; internal string Heading => _heading; protected Func<object, object, object> _format; internal Func<object, object, object> Format => _format; } }
apache-2.0
C#
fdf3d179a0298b0737af069a3abed7be39d281ac
Correct SetUpAttribute xmldoc
appel1/nunit,nunit/nunit,mikkelbu/nunit,JustinRChou/nunit,jadarnel27/nunit,jadarnel27/nunit,agray/nunit,nunit/nunit,OmicronPersei/nunit,mjedrzejek/nunit,jnm2/nunit,agray/nunit,ggeurts/nunit,appel1/nunit,agray/nunit,mikkelbu/nunit,ggeurts/nunit,NikolayPianikov/nunit,jnm2/nunit,OmicronPersei/nunit,NikolayPianikov/nunit,mjedrzejek/nunit,JustinRChou/nunit
src/NUnitFramework/framework/Attributes/SetUpAttribute.cs
src/NUnitFramework/framework/Attributes/SetUpAttribute.cs
// *********************************************************************** // Copyright (c) 2009 Charlie Poole // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** namespace NUnit.Framework { using System; /// <summary> /// Attribute used to identify a method that is called /// immediately before each test is run. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)] public class SetUpAttribute : NUnitAttribute { } /// <summary> /// Attribute used to mark a class that contains one-time SetUp /// and/or TearDown methods that apply to all the tests in a /// namespace or an assembly. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)] public class PreTestAttribute : NUnitAttribute { } /// <summary> /// Attribute used to mark a class that contains one-time SetUp /// and/or TearDown methods that apply to all the tests in a /// namespace or an assembly. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)] public class PostTestAttribute : NUnitAttribute { } }
// *********************************************************************** // Copyright (c) 2009 Charlie Poole // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** namespace NUnit.Framework { using System; /// <summary> /// Attribute used to mark a class that contains one-time SetUp /// and/or TearDown methods that apply to all the tests in a /// namespace or an assembly. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)] public class SetUpAttribute : NUnitAttribute { } /// <summary> /// Attribute used to mark a class that contains one-time SetUp /// and/or TearDown methods that apply to all the tests in a /// namespace or an assembly. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)] public class PreTestAttribute : NUnitAttribute { } /// <summary> /// Attribute used to mark a class that contains one-time SetUp /// and/or TearDown methods that apply to all the tests in a /// namespace or an assembly. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)] public class PostTestAttribute : NUnitAttribute { } }
mit
C#
01227a75d3f820805a29a292c2f397e0bd9a5357
Fix xmldoc references.
RedNesto/osu-framework,smoogipooo/osu-framework,default0/osu-framework,RedNesto/osu-framework,ZLima12/osu-framework,naoey/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,naoey/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,Tom94/osu-framework
osu.Framework/Graphics/Containers/AsyncLoadContainer.cs
osu.Framework/Graphics/Containers/AsyncLoadContainer.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Threading.Tasks; using osu.Framework.Allocation; namespace osu.Framework.Graphics.Containers { /// <summary> /// A container which asynchronously loads its children. /// </summary> public class AsyncLoadContainer : Container { /// <param name="content">The content which should be asynchronously loaded. Note that the <see cref="Drawable.RelativeSizeAxes"/> and <see cref="Container{T}.AutoSizeAxes"/> of this container /// will be transferred as the default for this <see cref="AsyncLoadContainer"/>.</param> public AsyncLoadContainer(Container content) { if (content == null) throw new ArgumentNullException(nameof(content), $@"{nameof(AsyncLoadContainer)} required non-null {nameof(content)}."); this.content = content; RelativeSizeAxes = content.RelativeSizeAxes; AutoSizeAxes = content.AutoSizeAxes; } private readonly Container content; protected virtual bool ShouldLoadContent => true; [BackgroundDependencyLoader] private void load() { if (ShouldLoadContent) loadContentAsync(); } protected override void Update() { base.Update(); if (!LoadTriggered && ShouldLoadContent) loadContentAsync(); } private Task loadTask; private void loadContentAsync() { loadTask = LoadComponentAsync(content, AddInternal); } /// <summary> /// True if the load task for our content has been started. /// Will remain true even after load is completed. /// </summary> protected bool LoadTriggered => loadTask != null; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Threading.Tasks; using osu.Framework.Allocation; namespace osu.Framework.Graphics.Containers { /// <summary> /// A container which asynchronously loads its children. /// </summary> public class AsyncLoadContainer : Container { /// <param name="content">The content which should be asynchronously loaded. Note that the <see cref="RelativeSizeAxes"/> and <see cref="AutoSizeAxes"/> of this container /// will be transferred as the default for this <see cref="AsyncLoadContainer"/>'s content.</param> public AsyncLoadContainer(Container content) { if (content == null) throw new ArgumentNullException(nameof(content), $@"{nameof(AsyncLoadContainer)} required non-null {nameof(content)}."); this.content = content; RelativeSizeAxes = content.RelativeSizeAxes; AutoSizeAxes = content.AutoSizeAxes; } private readonly Container content; protected virtual bool ShouldLoadContent => true; [BackgroundDependencyLoader] private void load() { if (ShouldLoadContent) loadContentAsync(); } protected override void Update() { base.Update(); if (!LoadTriggered && ShouldLoadContent) loadContentAsync(); } private Task loadTask; private void loadContentAsync() { loadTask = LoadComponentAsync(content, AddInternal); } /// <summary> /// True if the load task for our content has been started. /// Will remain true even after load is completed. /// </summary> protected bool LoadTriggered => loadTask != null; } }
mit
C#
1f7ec13f22fdca91fba6e97db39d6fc9a0e30486
fix https://nuget.codeplex.com/workitem/3460 "NullReferenceException if requireApiKey = true, but the header X-NUGET-APIKEY isn't present"
indsoft/NuGet2,oliver-feng/nuget,mrward/NuGet.V2,indsoft/NuGet2,jholovacs/NuGet,jholovacs/NuGet,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,antiufo/NuGet2,OneGet/nuget,pratikkagda/nuget,mono/nuget,mono/nuget,oliver-feng/nuget,mrward/nuget,RichiCoder1/nuget-chocolatey,GearedToWar/NuGet2,GearedToWar/NuGet2,OneGet/nuget,xoofx/NuGet,OneGet/nuget,mrward/NuGet.V2,oliver-feng/nuget,pratikkagda/nuget,indsoft/NuGet2,ctaggart/nuget,alluran/node.net,indsoft/NuGet2,mono/nuget,dolkensp/node.net,mrward/NuGet.V2,pratikkagda/nuget,alluran/node.net,chocolatey/nuget-chocolatey,RichiCoder1/nuget-chocolatey,jmezach/NuGet2,xoofx/NuGet,xoofx/NuGet,pratikkagda/nuget,mrward/NuGet.V2,pratikkagda/nuget,ctaggart/nuget,ctaggart/nuget,mrward/nuget,GearedToWar/NuGet2,GearedToWar/NuGet2,antiufo/NuGet2,rikoe/nuget,chocolatey/nuget-chocolatey,rikoe/nuget,antiufo/NuGet2,oliver-feng/nuget,jholovacs/NuGet,akrisiun/NuGet,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,dolkensp/node.net,mrward/nuget,rikoe/nuget,jmezach/NuGet2,xoofx/NuGet,zskullz/nuget,RichiCoder1/nuget-chocolatey,dolkensp/node.net,mrward/nuget,mrward/nuget,antiufo/NuGet2,akrisiun/NuGet,dolkensp/node.net,jholovacs/NuGet,zskullz/nuget,indsoft/NuGet2,chocolatey/nuget-chocolatey,pratikkagda/nuget,mono/nuget,GearedToWar/NuGet2,chocolatey/nuget-chocolatey,OneGet/nuget,zskullz/nuget,xoofx/NuGet,chocolatey/nuget-chocolatey,RichiCoder1/nuget-chocolatey,rikoe/nuget,chocolatey/nuget-chocolatey,jmezach/NuGet2,jholovacs/NuGet,oliver-feng/nuget,mrward/NuGet.V2,ctaggart/nuget,alluran/node.net,antiufo/NuGet2,oliver-feng/nuget,xoofx/NuGet,jmezach/NuGet2,GearedToWar/NuGet2,zskullz/nuget,antiufo/NuGet2,alluran/node.net,jmezach/NuGet2,mrward/nuget,indsoft/NuGet2,jmezach/NuGet2
src/Server/Infrastructure/PackageAuthenticationService.cs
src/Server/Infrastructure/PackageAuthenticationService.cs
using System; using System.Collections.Specialized; using System.Security.Principal; using System.Web.Configuration; namespace NuGet.Server.Infrastructure { public class PackageAuthenticationService : IPackageAuthenticationService { public bool IsAuthenticated(IPrincipal user, string apiKey, string packageId) { var appSettings = WebConfigurationManager.AppSettings; return IsAuthenticatedInternal(apiKey, appSettings); } internal static bool IsAuthenticatedInternal(string apiKey, NameValueCollection appSettings) { bool value; if (!Boolean.TryParse(appSettings["requireApiKey"], out value)) { // If the setting is misconfigured, fail. return false; } if (value == false) { // If the server's configured to allow pushing without an ApiKey, all requests are assumed to be authenticated. return true; } string settingsApiKey = appSettings["apiKey"]; // No api key, no-one can push if (String.IsNullOrEmpty(settingsApiKey)) { return false; } return string.Equals(apiKey, settingsApiKey, StringComparison.OrdinalIgnoreCase); } } }
using System; using System.Collections.Specialized; using System.Security.Principal; using System.Web.Configuration; namespace NuGet.Server.Infrastructure { public class PackageAuthenticationService : IPackageAuthenticationService { public bool IsAuthenticated(IPrincipal user, string apiKey, string packageId) { var appSettings = WebConfigurationManager.AppSettings; return IsAuthenticatedInternal(apiKey, appSettings); } internal static bool IsAuthenticatedInternal(string apiKey, NameValueCollection appSettings) { bool value; if (!Boolean.TryParse(appSettings["requireApiKey"], out value)) { // If the setting is misconfigured, fail. return false; } if (value == false) { // If the server's configured to allow pushing without an ApiKey, all requests are assumed to be authenticated. return true; } string settingsApiKey = appSettings["apiKey"]; // No api key, no-one can push if (String.IsNullOrEmpty(settingsApiKey)) { return false; } return apiKey.Equals(settingsApiKey, StringComparison.OrdinalIgnoreCase); } } }
apache-2.0
C#
6fc692c0cb13f4f2762141bf131bb3fa4552a4c9
Add missing .dtd file contents.
parjong/corefx,jlin177/corefx,nchikanov/corefx,stephenmichaelf/corefx,jlin177/corefx,fgreinacher/corefx,krytarowski/corefx,krk/corefx,Ermiar/corefx,mmitche/corefx,richlander/corefx,jlin177/corefx,Ermiar/corefx,mmitche/corefx,YoupHulsebos/corefx,rubo/corefx,ravimeda/corefx,zhenlan/corefx,the-dwyer/corefx,twsouthwick/corefx,dhoehna/corefx,stone-li/corefx,ericstj/corefx,stone-li/corefx,twsouthwick/corefx,fgreinacher/corefx,JosephTremoulet/corefx,elijah6/corefx,weltkante/corefx,cydhaselton/corefx,richlander/corefx,MaggieTsang/corefx,ravimeda/corefx,gkhanna79/corefx,wtgodbe/corefx,nbarbettini/corefx,zhenlan/corefx,billwert/corefx,alexperovich/corefx,twsouthwick/corefx,nchikanov/corefx,YoupHulsebos/corefx,stephenmichaelf/corefx,zhenlan/corefx,stone-li/corefx,axelheer/corefx,nbarbettini/corefx,ravimeda/corefx,rahku/corefx,wtgodbe/corefx,mazong1123/corefx,gkhanna79/corefx,twsouthwick/corefx,Petermarcu/corefx,yizhang82/corefx,stone-li/corefx,tijoytom/corefx,Petermarcu/corefx,seanshpark/corefx,yizhang82/corefx,ViktorHofer/corefx,Ermiar/corefx,cydhaselton/corefx,richlander/corefx,marksmeltzer/corefx,weltkante/corefx,Jiayili1/corefx,rubo/corefx,nchikanov/corefx,MaggieTsang/corefx,jlin177/corefx,JosephTremoulet/corefx,rahku/corefx,seanshpark/corefx,zhenlan/corefx,shimingsg/corefx,axelheer/corefx,mmitche/corefx,nbarbettini/corefx,nbarbettini/corefx,rahku/corefx,MaggieTsang/corefx,axelheer/corefx,elijah6/corefx,shimingsg/corefx,YoupHulsebos/corefx,stone-li/corefx,cydhaselton/corefx,stephenmichaelf/corefx,JosephTremoulet/corefx,ericstj/corefx,zhenlan/corefx,rjxby/corefx,elijah6/corefx,parjong/corefx,billwert/corefx,JosephTremoulet/corefx,mmitche/corefx,seanshpark/corefx,the-dwyer/corefx,parjong/corefx,axelheer/corefx,ptoonen/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,the-dwyer/corefx,ravimeda/corefx,weltkante/corefx,wtgodbe/corefx,seanshpark/corefx,axelheer/corefx,zhenlan/corefx,shimingsg/corefx,twsouthwick/corefx,billwert/corefx,richlander/corefx,mazong1123/corefx,seanshpark/corefx,alexperovich/corefx,rjxby/corefx,stephenmichaelf/corefx,gkhanna79/corefx,DnlHarvey/corefx,twsouthwick/corefx,YoupHulsebos/corefx,ViktorHofer/corefx,Ermiar/corefx,gkhanna79/corefx,wtgodbe/corefx,parjong/corefx,stephenmichaelf/corefx,tijoytom/corefx,ptoonen/corefx,billwert/corefx,krytarowski/corefx,ravimeda/corefx,krytarowski/corefx,billwert/corefx,alexperovich/corefx,yizhang82/corefx,ravimeda/corefx,dhoehna/corefx,stephenmichaelf/corefx,rubo/corefx,weltkante/corefx,alexperovich/corefx,mazong1123/corefx,fgreinacher/corefx,JosephTremoulet/corefx,tijoytom/corefx,Ermiar/corefx,krk/corefx,tijoytom/corefx,Petermarcu/corefx,dhoehna/corefx,billwert/corefx,elijah6/corefx,rjxby/corefx,DnlHarvey/corefx,DnlHarvey/corefx,cydhaselton/corefx,rjxby/corefx,rjxby/corefx,marksmeltzer/corefx,ptoonen/corefx,nbarbettini/corefx,wtgodbe/corefx,cydhaselton/corefx,nbarbettini/corefx,BrennanConroy/corefx,mmitche/corefx,ericstj/corefx,tijoytom/corefx,dotnet-bot/corefx,nchikanov/corefx,Petermarcu/corefx,Jiayili1/corefx,yizhang82/corefx,dotnet-bot/corefx,shimingsg/corefx,dhoehna/corefx,krk/corefx,seanshpark/corefx,marksmeltzer/corefx,MaggieTsang/corefx,Jiayili1/corefx,dhoehna/corefx,MaggieTsang/corefx,weltkante/corefx,ViktorHofer/corefx,weltkante/corefx,stephenmichaelf/corefx,YoupHulsebos/corefx,ViktorHofer/corefx,Jiayili1/corefx,the-dwyer/corefx,dotnet-bot/corefx,seanshpark/corefx,krk/corefx,gkhanna79/corefx,nchikanov/corefx,parjong/corefx,rahku/corefx,cydhaselton/corefx,marksmeltzer/corefx,krytarowski/corefx,jlin177/corefx,gkhanna79/corefx,krk/corefx,rubo/corefx,ptoonen/corefx,shimingsg/corefx,yizhang82/corefx,rubo/corefx,stone-li/corefx,MaggieTsang/corefx,JosephTremoulet/corefx,dotnet-bot/corefx,gkhanna79/corefx,mazong1123/corefx,tijoytom/corefx,shimingsg/corefx,fgreinacher/corefx,krk/corefx,rahku/corefx,mazong1123/corefx,mmitche/corefx,weltkante/corefx,DnlHarvey/corefx,dhoehna/corefx,tijoytom/corefx,elijah6/corefx,alexperovich/corefx,Ermiar/corefx,ViktorHofer/corefx,billwert/corefx,yizhang82/corefx,dhoehna/corefx,richlander/corefx,the-dwyer/corefx,Jiayili1/corefx,zhenlan/corefx,ericstj/corefx,MaggieTsang/corefx,krytarowski/corefx,krytarowski/corefx,nchikanov/corefx,mmitche/corefx,marksmeltzer/corefx,dotnet-bot/corefx,Petermarcu/corefx,jlin177/corefx,elijah6/corefx,richlander/corefx,ViktorHofer/corefx,Ermiar/corefx,rahku/corefx,rjxby/corefx,axelheer/corefx,ravimeda/corefx,richlander/corefx,wtgodbe/corefx,rjxby/corefx,marksmeltzer/corefx,dotnet-bot/corefx,BrennanConroy/corefx,the-dwyer/corefx,ericstj/corefx,ericstj/corefx,krk/corefx,mazong1123/corefx,alexperovich/corefx,the-dwyer/corefx,nchikanov/corefx,Petermarcu/corefx,wtgodbe/corefx,twsouthwick/corefx,BrennanConroy/corefx,ptoonen/corefx,nbarbettini/corefx,ptoonen/corefx,DnlHarvey/corefx,alexperovich/corefx,shimingsg/corefx,yizhang82/corefx,krytarowski/corefx,parjong/corefx,Petermarcu/corefx,rahku/corefx,mazong1123/corefx,ericstj/corefx,elijah6/corefx,parjong/corefx,Jiayili1/corefx,ptoonen/corefx,ViktorHofer/corefx,YoupHulsebos/corefx,jlin177/corefx,Jiayili1/corefx,stone-li/corefx,YoupHulsebos/corefx,cydhaselton/corefx,dotnet-bot/corefx,DnlHarvey/corefx,marksmeltzer/corefx
src/System.Security.Cryptography.Xml/tests/TestHelpers.cs
src/System.Security.Cryptography.Xml/tests/TestHelpers.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.IO; namespace System.Security.Cryptography.Xml.Tests { internal static class TestHelpers { public static TempFile CreateTestDtdFile(string testName) { if (testName == null) throw new ArgumentNullException(nameof(testName)); var file = new TempFile( Path.Combine(Directory.GetCurrentDirectory(), testName + ".dtd") ); File.WriteAllText(file.Path, "<!-- presence, not content, required -->"); return file; } public static TempFile CreateTestTextFile(string testName, string content) { if (testName == null) throw new ArgumentNullException(nameof(testName)); if (content == null) throw new ArgumentNullException(nameof(content)); var file = new TempFile( Path.Combine(Directory.GetCurrentDirectory(), testName + ".txt") ); File.WriteAllText(file.Path, content); return file; } } }
// 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.IO; namespace System.Security.Cryptography.Xml.Tests { internal static class TestHelpers { public static TempFile CreateTestDtdFile(string testName) { if (testName == null) throw new ArgumentNullException(nameof(testName)); var file = new TempFile( Path.Combine(Directory.GetCurrentDirectory(), testName + ".dtd") ); return file; } public static TempFile CreateTestTextFile(string testName, string content) { if (testName == null) throw new ArgumentNullException(nameof(testName)); if (content == null) throw new ArgumentNullException(nameof(content)); var file = new TempFile( Path.Combine(Directory.GetCurrentDirectory(), testName + ".txt") ); File.WriteAllText(file.Path, content); return file; } } }
mit
C#
ac547b06ad4c5ae9d402aa85062a498095f4dacf
add test for serializing and deserializing 'null' string
bjornicus/confluent-kafka-dotnet,bjornicus/confluent-kafka-dotnet
test/Confluent.Kafka.UnitTests/Serialization/String.cs
test/Confluent.Kafka.UnitTests/Serialization/String.cs
// Copyright 2016-2017 Confluent 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. // // Refer to LICENSE for more information. using Xunit; using System.Text; namespace Confluent.Kafka.Serialization.Tests { public class StringTests { [Fact] public void SerializeDeserialize() { Assert.Equal("hello world", new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize("hello world"))); Assert.Equal("ឆ្មាត្រូវបានហែលទឹក", new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize("ឆ្មាត្រូវបានហែលទឹក"))); Assert.Equal("вы не банан", new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize("вы не банан"))); Assert.Equal(null, new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize(null))); // TODO: check some serialize / deserialize operations that are not expected to work, including some // cases where Deserialize can be expected to throw an exception. } } }
// Copyright 2016-2017 Confluent 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. // // Refer to LICENSE for more information. using Xunit; using System.Text; namespace Confluent.Kafka.Serialization.Tests { public class StringTests { [Fact] public void SerializeDeserialize() { Assert.Equal("hello world", new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize("hello world"))); Assert.Equal("ឆ្មាត្រូវបានហែលទឹក", new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize("ឆ្មាត្រូវបានហែលទឹក"))); Assert.Equal("вы не банан", new StringDeserializer(Encoding.UTF8).Deserialize(new StringSerializer(Encoding.UTF8).Serialize("вы не банан"))); // TODO: check some serialize / deserialize operations that are not expected to work, including some // cases where Deserialize can be expected to throw an exception. } } }
apache-2.0
C#
de95de8c5267af3e12d331142f6226ba5cec3df2
Add default values to options
mvno/Okanshi,mvno/Okanshi,mvno/Okanshi
Okanshi.InfluxDBObserver/InfluxDbObserverOptions.cs
Okanshi.InfluxDBObserver/InfluxDbObserverOptions.cs
using System; using System.Collections.Generic; using System.Linq; namespace Okanshi.Observers { public class InfluxDbObserverOptions { public string DatabaseName { get; } public string RetentionPolicy { get; set; } public Func<Tag, bool> TagToFieldSelector { get; set; } = x => false; public IEnumerable<string> TagsToIgnore { get; set; } = Enumerable.Empty<string>(); public InfluxDbObserverOptions(string databaseName) { DatabaseName = databaseName; } } }
using System; using System.Collections; using System.Collections.Generic; namespace Okanshi.Observers { public class InfluxDbObserverOptions { public string DatabaseName { get; } public string RetentionPolicy { get; set; } public Func<Tag, bool> TagToFieldSelector { get; set; } public IEnumerable<string> TagsToIgnore { get; set; } public InfluxDbObserverOptions(string databaseName) { DatabaseName = databaseName; } } }
mit
C#
d92edc8d62b5bc1e82764a2abcbac1030ded90e6
Replace string with nameof
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Base/Logging/LogArea.cs
src/Avalonia.Base/Logging/LogArea.cs
namespace Avalonia.Logging { /// <summary> /// Specifies the area in which a log event occurred. /// </summary> public static class LogArea { /// <summary> /// The log event comes from the property system. /// </summary> public const string Property = nameof(Property); /// <summary> /// The log event comes from the binding system. /// </summary> public const string Binding = nameof(Binding); /// <summary> /// The log event comes from the animations system. /// </summary> public const string Animations = nameof(Animations); /// <summary> /// The log event comes from the visual system. /// </summary> public const string Visual = nameof(Visual); /// <summary> /// The log event comes from the layout system. /// </summary> public const string Layout = nameof(Layout); /// <summary> /// The log event comes from the control system. /// </summary> public const string Control = nameof(Control); /// <summary> /// The log event comes from Win32 Platform. /// </summary> public const string Win32Platform = nameof(Win32Platform); /// <summary> /// The log event comes from X11 Platform. /// </summary> public const string X11Platform = nameof(X11Platform); /// <summary> /// The log event comes from Android Platform. /// </summary> public const string AndroidPlatform = nameof(AndroidPlatform); /// <summary> /// The log event comes from iOS Platform. /// </summary> public const string IOSPlatform = nameof(IOSPlatform); /// <summary> /// The log event comes from LinuxFramebuffer Platform /// </summary> public const string LinuxFramebufferPlatform = nameof(LinuxFramebufferPlatform); /// <summary> /// The log event comes from FreeDesktop Platform /// </summary> public const string FreeDesktopPlatform = nameof(FreeDesktopPlatform); /// <summary> /// The log event comes from macOS Platform /// </summary> public const string macOSPlatform = nameof(macOSPlatform); } }
namespace Avalonia.Logging { /// <summary> /// Specifies the area in which a log event occurred. /// </summary> public static class LogArea { /// <summary> /// The log event comes from the property system. /// </summary> public const string Property = "Property"; /// <summary> /// The log event comes from the binding system. /// </summary> public const string Binding = "Binding"; /// <summary> /// The log event comes from the animations system. /// </summary> public const string Animations = "Animations"; /// <summary> /// The log event comes from the visual system. /// </summary> public const string Visual = "Visual"; /// <summary> /// The log event comes from the layout system. /// </summary> public const string Layout = "Layout"; /// <summary> /// The log event comes from the control system. /// </summary> public const string Control = "Control"; /// <summary> /// The log event comes from Win32 Platform. /// </summary> public const string Win32Platform = nameof(Win32Platform); /// <summary> /// The log event comes from X11 Platform. /// </summary> public const string X11Platform = nameof(X11Platform); /// <summary> /// The log event comes from Android Platform. /// </summary> public const string AndroidPlatform = nameof(AndroidPlatform); /// <summary> /// The log event comes from iOS Platform. /// </summary> public const string IOSPlatform = nameof(IOSPlatform); /// <summary> /// The log event comes from LinuxFramebuffer Platform /// </summary> public const string LinuxFramebufferPlatform = nameof(LinuxFramebufferPlatform); /// <summary> /// The log event comes from FreeDesktop Platform /// </summary> public const string FreeDesktopPlatform = nameof(FreeDesktopPlatform); /// <summary> /// The log event comes from macOS Platform /// </summary> public const string macOSPlatform = nameof(macOSPlatform); } }
mit
C#
821ba2830aaece371c5fcc3b3868d6d2fd0330f5
implement Call, SMS and unshare
atabaksahraei/ifn661
healthbook/healthbook/View/PatientShareView.xaml.cs
healthbook/healthbook/View/PatientShareView.xaml.cs
using Xamarin.Forms; using healthbook.ViewModel; using xBeacons; using System; using healthbook.Model.BL; using System.Text; using ImageCircle.Forms.Plugin.iOS; using System.Collections.Generic; using System.Linq; namespace healthbook { public partial class PatientShareView : ContentPage { #region const public const string CONTEXT = "PatientShareView"; #endregion #region var public PatientShareViewModel Vm { get { return (PatientShareViewModel)BindingContext; } } #endregion public PatientShareView () { BindingContext = new PatientShareViewModel (); InitializeComponent (); ImageCircleRenderer.Init (); ToolbarItems.Add (new ToolbarItem ("refresh", null, async () => { Vm.refresh (); })); } void OnTapGestureRecognizerTappedDoc (object sender, EventArgs args) { DocClickHelper (); } async void DocClickHelper() { if (Vm.Doc != null) { List<String> docPatientList = new List<string>(Vm.Doc.MyPatientIds); string tmpPatient = docPatientList.Where (item => item == Vm.Me.Id).FirstOrDefault(); if (String.IsNullOrEmpty (tmpPatient)) { Vm.Doc.AddPatient (Vm.Me.Id); DisplayAlert ("Sharing", "Shared", "OK"); } else { var action = await DisplayActionSheet ("ActionSheet: Send to?", "Cancel", null, "remove Sharing", "Call", "SOS Call", "Message"); switch (action) { case "Call": #if __IOS__ var call = Foundation.NSUrl.FromString(String.Format("tel:{0}", Vm.Doc.PhoneNumber)); UIKit.UIApplication.SharedApplication.OpenUrl(call); #endif break; case "remove Sharing": Vm.Doc.RemovePatient (Vm.Me.Id); Vm.SyncToCloud (); DisplayAlert ("Sharing remove", "Sharing removed", "OK"); break; case "SOS Call": #if __IOS__ var sosCall = Foundation.NSUrl.FromString(String.Format("tel:{0}", Vm.Doc.SOSNumber)); UIKit.UIApplication.SharedApplication.OpenUrl(sosCall); #endif break; case "Message": #if __IOS__ var messageTo = Foundation.NSUrl.FromString(String.Format("sms:{0}", Vm.Doc.SMSNumber)); UIKit.UIApplication.SharedApplication.OpenUrl(messageTo); #endif break; } } } } } }
using Xamarin.Forms; using healthbook.ViewModel; using xBeacons; using System; using healthbook.Model.BL; using System.Text; using ImageCircle.Forms.Plugin.iOS; using System.Collections.Generic; using System.Linq; namespace healthbook { public partial class PatientShareView : ContentPage { #region const public const string CONTEXT = "PatientShareView"; #endregion #region var public PatientShareViewModel Vm { get { return (PatientShareViewModel)BindingContext; } } #endregion public PatientShareView () { BindingContext = new PatientShareViewModel (); InitializeComponent (); ImageCircleRenderer.Init (); ToolbarItems.Add (new ToolbarItem ("refresh", null, async () => { Vm.refresh (); })); } void OnTapGestureRecognizerTappedDoc (object sender, EventArgs args) { if (Vm.Doc != null) { List<String> docPatientList = new List<string>(Vm.Doc.MyPatientIds); string tmpPatient = docPatientList.Where (item => item == Vm.Me.Id).FirstOrDefault(); if (String.IsNullOrEmpty (tmpPatient)) { Vm.Doc.AddPatient (Vm.Me.Id); DisplayAlert ("Sharing", "Shared", "OK"); } else { Vm.Doc.RemovePatient (Vm.Me.Id); DisplayAlert ("Sharing", "Sharing removed", "OK"); } Vm.SyncToCloud (); } } } }
mit
C#
d7f21d03bad081f75308e450f0628467bc5324b3
Allow chaining of ignored members
derekgreer/expectedObjects
src/ExpectedObjects/ConfigurationContextExtensions.cs
src/ExpectedObjects/ConfigurationContextExtensions.cs
using System; using System.Collections.Generic; using System.Linq.Expressions; using ExpectedObjects.Strategies; namespace ExpectedObjects { public static class ConfigurationContextExtensions { internal static IConfigurationContext UseAllStrategies(this IConfigurationContext configurationContext) { configurationContext.PushStrategy<DefaultComparisonStrategy>(); configurationContext.PushStrategy<KeyValuePairComparisonStrategy>(); configurationContext.PushStrategy<ClassComparisonStrategy>(); configurationContext.PushStrategy<EnumerableComparisonStrategy>(); configurationContext.PushStrategy<EqualsOverrideComparisonStrategy>(); configurationContext.PushStrategy<PrimitiveComparisonStrategy>(); configurationContext.PushStrategy<ComparableComparisonStrategy>(); return configurationContext; } public static IConfigurationContext UseStrategies(this IConfigurationContext configurationContext, IEnumerable<IComparisonStrategy> strategies) { configurationContext.ClearStrategies(); foreach (var strategy in strategies) configurationContext.PushStrategy(strategy); return configurationContext; } /// <summary> /// Requires the order of <see cref="IEnumerable" /> members to be in the expected order. /// </summary> /// <param name="configurationContext"></param> /// <returns></returns> public static IConfigurationContext UseOrdinalComparison(this IConfigurationContext configurationContext) { configurationContext.ReplaceStrategy<EnumerableComparisonStrategy, OrdinalEnumerableComparisonStrategy>(); return configurationContext; } /// <summary> /// Ignores the specified member in comparisons. /// </summary> /// <typeparam name="T">expected object type</typeparam> /// <typeparam name="TMember">member type</typeparam> /// <param name="configurationContext"></param> /// <param name="memberExpression">member expression</param> /// <returns></returns> public static IConfigurationContext<T> Ignore<T, TMember>(this IConfigurationContext<T> configurationContext, Expression<Func<T, TMember>> memberExpression) { configurationContext.Member(memberExpression).UsesComparison(Expect.Ignored()); return configurationContext; } } }
using System; using System.Collections.Generic; using System.Linq.Expressions; using ExpectedObjects.Strategies; namespace ExpectedObjects { public static class ConfigurationContextExtensions { internal static IConfigurationContext UseAllStrategies(this IConfigurationContext configurationContext) { configurationContext.PushStrategy<DefaultComparisonStrategy>(); configurationContext.PushStrategy<KeyValuePairComparisonStrategy>(); configurationContext.PushStrategy<ClassComparisonStrategy>(); configurationContext.PushStrategy<EnumerableComparisonStrategy>(); configurationContext.PushStrategy<EqualsOverrideComparisonStrategy>(); configurationContext.PushStrategy<PrimitiveComparisonStrategy>(); configurationContext.PushStrategy<ComparableComparisonStrategy>(); return configurationContext; } public static IConfigurationContext UseStrategies(this IConfigurationContext configurationContext, IEnumerable<IComparisonStrategy> strategies) { configurationContext.ClearStrategies(); foreach (var strategy in strategies) configurationContext.PushStrategy(strategy); return configurationContext; } /// <summary> /// Requires the order of <see cref="IEnumerable" /> members to be in the expected order. /// </summary> /// <param name="configurationContext"></param> /// <returns></returns> public static IConfigurationContext UseOrdinalComparison(this IConfigurationContext configurationContext) { configurationContext.ReplaceStrategy<EnumerableComparisonStrategy, OrdinalEnumerableComparisonStrategy>(); return configurationContext; } /// <summary> /// Ignores the specified member in comparisons. /// </summary> /// <typeparam name="T">expected object type</typeparam> /// <typeparam name="TMember">member type</typeparam> /// <param name="configurationContext"></param> /// <param name="memberExpression">member expression</param> /// <returns></returns> public static IConfigurationContext Ignore<T, TMember>(this IConfigurationContext<T> configurationContext, Expression<Func<T, TMember>> memberExpression) { configurationContext.Member(memberExpression).UsesComparison(Expect.Ignored()); return configurationContext; } } }
mit
C#
25c3959810078ff3600fcf55621aa0f0cf2107de
add a hello world sample
oneminot/iTextSharpSample
iTextSharpSample/iTextSharpSample.Console/Program.cs
iTextSharpSample/iTextSharpSample.Console/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using iTextSharp.text; namespace iTextSharpSample.Console { class Program { static void Main(string[] args) { var myDocument = new iTextSharp.text.Document(); iTextSharp.text.pdf.PdfWriter.GetInstance(myDocument, new FileStream("test.pdf", FileMode.CreateNew)); myDocument.Open(); myDocument.Add(new Paragraph("Hello, world!")); myDocument.Close(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace iTextSharpSample.Console { class Program { static void Main(string[] args) { } } }
agpl-3.0
C#
f56802e8ac323127968d709ce581cee6012135d4
Update JsonReflectionUtilities.cs
RSuter/NJsonSchema,NJsonSchema/NJsonSchema
src/NJsonSchema/Generation/JsonReflectionUtilities.cs
src/NJsonSchema/Generation/JsonReflectionUtilities.cs
//----------------------------------------------------------------------- // <copyright file="JsonReflectionUtilities.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, [email protected]</author> //----------------------------------------------------------------------- using System; using System.Linq; using System.Reflection; using Newtonsoft.Json.Serialization; using NJsonSchema.Infrastructure; namespace NJsonSchema.Generation { /// <summary>Utility methods for reflection.</summary> public static class JsonReflectionUtilities { private static readonly Lazy<CamelCasePropertyNamesContractResolver> CamelCaseResolverLazy = new Lazy<CamelCasePropertyNamesContractResolver>(); private static readonly Lazy<DefaultContractResolver> SnakeCaseResolverLazy = new Lazy<DefaultContractResolver>(() => new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() }); /// <summary>Gets the name of the property for JSON serialization.</summary> /// <returns>The name.</returns> /// <exception cref="NotSupportedException">The PropertyNameHandling is not supported.</exception> public static string GetPropertyName(MemberInfo property, PropertyNameHandling propertyNameHandling) { var propertyName = ReflectionCache.GetPropertiesAndFields(property.DeclaringType) .First(p => p.MemberInfo.Name == property.Name).GetName(); switch (propertyNameHandling) { case PropertyNameHandling.Default: return propertyName; case PropertyNameHandling.CamelCase: return CamelCaseResolverLazy.Value.GetResolvedPropertyName(propertyName); case PropertyNameHandling.SnakeCase: return SnakeCaseResolverLazy.Value.GetResolvedPropertyName(propertyName); default: throw new NotSupportedException($"The PropertyNameHandling '{propertyNameHandling}' is not supported."); } } } }
//----------------------------------------------------------------------- // <copyright file="JsonReflectionUtilities.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, [email protected]</author> //----------------------------------------------------------------------- using System; using System.Linq; using System.Reflection; using Newtonsoft.Json.Serialization; using NJsonSchema.Infrastructure; namespace NJsonSchema.Generation { /// <summary>Utility methods for reflection.</summary> public static class JsonReflectionUtilities { private static readonly Lazy<CamelCasePropertyNamesContractResolver> CamelCaseResolverLazy = new Lazy<CamelCasePropertyNamesContractResolver>(); private static readonly Lazy<DefaultContractResolver> SnakeCaseResolverLazy = new Lazy<DefaultContractResolver>(() => new DefaultContractResolver {NamingStrategy = new SnakeCaseNamingStrategy()}); /// <summary>Gets the name of the property for JSON serialization.</summary> /// <returns>The name.</returns> /// <exception cref="NotSupportedException">The PropertyNameHandling is not supported.</exception> public static string GetPropertyName(MemberInfo property, PropertyNameHandling propertyNameHandling) { var propertyName = ReflectionCache.GetPropertiesAndFields(property.DeclaringType) .First(p => p.MemberInfo.Name == property.Name).GetName(); switch (propertyNameHandling) { case PropertyNameHandling.Default: return propertyName; case PropertyNameHandling.CamelCase: return CamelCaseResolverLazy.Value.GetResolvedPropertyName(propertyName); case PropertyNameHandling.SnakeCase: return SnakeCaseResolverLazy.Value.GetResolvedPropertyName(propertyName); default: throw new NotSupportedException($"The PropertyNameHandling '{propertyNameHandling}' is not supported."); } } } }
mit
C#
a1c406ca947947645917d6990e7079f63436f581
Update ValidationAttribute.cs
WebApiContrib/WebAPIContrib.Core,WebApiContrib/WebAPIContrib.Core
src/WebApiContrib.Core/Filters/ValidationAttribute.cs
src/WebApiContrib.Core/Filters/ValidationAttribute.cs
using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using System.Collections.Generic; namespace WebApiContrib.Core.Filters { public class ValidationAttribute : ActionFilterAttribute { public bool AllowNulls { get; set; } public override void OnActionExecuting(ActionExecutingContext actionContext) { if (!AllowNulls) { var nullArguments = actionContext.ActionArguments .Where(arg => arg.Value == null) .Select(arg => new Error { Name = arg.Key, Message = "Value cannot be null." }).ToArray(); if (nullArguments.Any()) { actionContext.Result = new BadRequestObjectResult(nullArguments); return; } } if (!actionContext.ModelState.IsValid) { var errors = actionContext.ModelState .Where(e => e.Value.Errors.Count > 0) .Select(e => new Error { Name = e.Key, Message = e.Value.Errors.First().ErrorMessage }).ToArray(); actionContext.Result = new BadRequestObjectResult(errors); } } private class Error { public string Name { get; set; } public string Message { get; set; } } } }
using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using System.Collections.Generic; namespace WebApiContrib.Core.Filters { public class ValidationAttribute : ActionFilterAttribute { public bool AllowNull { get; set; } public override void OnActionExecuting(ActionExecutingContext actionContext) { if (!AllowNull) { var nullArguments = actionContext.ActionArguments .Where(arg => arg.Value == null) .Select(arg => new Error { Name = arg.Key, Message = "Value cannot be null." }).ToArray(); if (nullArguments.Any()) { actionContext.Result = new BadRequestObjectResult(nullArguments); return; } } if (!actionContext.ModelState.IsValid) { var errors = actionContext.ModelState .Where(e => e.Value.Errors.Count > 0) .Select(e => new Error { Name = e.Key, Message = e.Value.Errors.First().ErrorMessage }).ToArray(); actionContext.Result = new BadRequestObjectResult(errors); } } private class Error { public string Name { get; set; } public string Message { get; set; } } } }
mit
C#
abc2da739692e82a84a7d086464bee96a7d7597d
Test method removed
drussilla/LearnWordsFast,drussilla/LearnWordsFast
src/LearnWordsFast/ApiControllers/UserController.cs
src/LearnWordsFast/ApiControllers/UserController.cs
using System.Threading.Tasks; using LearnWordsFast.DAL.Models; using LearnWordsFast.ViewModels; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Mvc; namespace LearnWordsFast.ApiControllers { [Route("api/user")] public class UserController : ApiController { private readonly SignInManager<User> _signInManager; private readonly UserManager<User> _userManager; public UserController(SignInManager<User> signInManager, UserManager<User> userManager) { _signInManager = signInManager; _userManager = userManager; } [HttpPost("login")] public async Task<IActionResult> Login([FromBody]LoginViewModel loginViewModel) { var result = await _signInManager.PasswordSignInAsync(loginViewModel.Email, loginViewModel.Password, true, false); if (!result.Succeeded) { return Error(result.ToString()); } return Ok(); } [Authorize] [HttpPost("logout")] public async void Logout() { await _signInManager.SignOutAsync(); } [HttpPost("create")] public async Task<IActionResult> Create([FromBody]RegisterViewModel registerViewModel) { var user = new User {Email = registerViewModel.Email}; var result = await _userManager.CreateAsync(user, registerViewModel.Password); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent: false); return Created("/api/user/" + user.Id); } return Error(result.ToString()); } } }
using System.Threading.Tasks; using LearnWordsFast.DAL.Models; using LearnWordsFast.ViewModels; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Mvc; namespace LearnWordsFast.ApiControllers { [Route("api/user")] public class UserController : ApiController { private readonly SignInManager<User> _signInManager; private readonly UserManager<User> _userManager; public UserController(SignInManager<User> signInManager, UserManager<User> userManager) { _signInManager = signInManager; _userManager = userManager; } [HttpPost("login")] public async Task<IActionResult> Login([FromBody]LoginViewModel loginViewModel) { var result = await _signInManager.PasswordSignInAsync(loginViewModel.Email, loginViewModel.Password, true, false); if (!result.Succeeded) { return Error(result.ToString()); } return Ok(); } [Authorize] [HttpPost("logout")] public async void Logout() { await _signInManager.SignOutAsync(); } [HttpPost("create")] public async Task<IActionResult> Create([FromBody]RegisterViewModel registerViewModel) { var user = new User {Email = registerViewModel.Email}; var result = await _userManager.CreateAsync(user, registerViewModel.Password); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent: false); return Created("/api/user/" + user.Id); } return Error(result.ToString()); } [HttpGet("test")] [Authorize] public string Test() { return Context.User.Identity.Name; } } }
mit
C#
13add0c355eb4b06a9a97c5f55f13a23a65f25e7
Update the ViewModel we return as JSON to the Upgrade Installer Step - Has logic for checking latest logic (Needs bullet proof testing & discussion most likely)
lars-erik/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,NikRimington/Umbraco-CMS,gavinfaux/Umbraco-CMS,kgiszewski/Umbraco-CMS,romanlytvyn/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,romanlytvyn/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,hfloyd/Umbraco-CMS,sargin48/Umbraco-CMS,neilgaietto/Umbraco-CMS,marcemarc/Umbraco-CMS,neilgaietto/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,jchurchley/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,aadfPT/Umbraco-CMS,rustyswayne/Umbraco-CMS,base33/Umbraco-CMS,rasmusfjord/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,rustyswayne/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,rasmuseeg/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,kgiszewski/Umbraco-CMS,hfloyd/Umbraco-CMS,base33/Umbraco-CMS,NikRimington/Umbraco-CMS,umbraco/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,umbraco/Umbraco-CMS,tcmorris/Umbraco-CMS,gavinfaux/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,aaronpowell/Umbraco-CMS,bjarnef/Umbraco-CMS,jchurchley/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,base33/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,aaronpowell/Umbraco-CMS,gavinfaux/Umbraco-CMS,rasmuseeg/Umbraco-CMS,aadfPT/Umbraco-CMS,rasmusfjord/Umbraco-CMS,lars-erik/Umbraco-CMS,dawoe/Umbraco-CMS,romanlytvyn/Umbraco-CMS,NikRimington/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,neilgaietto/Umbraco-CMS,tcmorris/Umbraco-CMS,neilgaietto/Umbraco-CMS,aaronpowell/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,jchurchley/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tompipe/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,KevinJump/Umbraco-CMS,rustyswayne/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmusfjord/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,kgiszewski/Umbraco-CMS,umbraco/Umbraco-CMS,madsoulswe/Umbraco-CMS,lars-erik/Umbraco-CMS,rustyswayne/Umbraco-CMS,lars-erik/Umbraco-CMS,lars-erik/Umbraco-CMS,robertjf/Umbraco-CMS,rasmusfjord/Umbraco-CMS,sargin48/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,gavinfaux/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,WebCentrum/Umbraco-CMS,rasmuseeg/Umbraco-CMS,sargin48/Umbraco-CMS,rustyswayne/Umbraco-CMS,WebCentrum/Umbraco-CMS,hfloyd/Umbraco-CMS,neilgaietto/Umbraco-CMS,KevinJump/Umbraco-CMS,WebCentrum/Umbraco-CMS,dawoe/Umbraco-CMS,romanlytvyn/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,aadfPT/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,arknu/Umbraco-CMS,tompipe/Umbraco-CMS,dawoe/Umbraco-CMS,romanlytvyn/Umbraco-CMS,tcmorris/Umbraco-CMS,gavinfaux/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,sargin48/Umbraco-CMS,robertjf/Umbraco-CMS,rasmusfjord/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,sargin48/Umbraco-CMS
src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs
src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs
using Semver; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Web.Install.Models; namespace Umbraco.Web.Install.InstallSteps { /// <summary> /// This step is purely here to show the button to commence the upgrade /// </summary> [InstallSetupStep(InstallationType.Upgrade, "Upgrade", "upgrade", 1, "Upgrading Umbraco to the latest and greatest version.")] internal class UpgradeStep : InstallSetupStep<object> { public override bool RequiresExecution(object model) { return true; } public override InstallSetupResult Execute(object model) { return null; } public override object ViewModel { get { var currentVersion = CurrentVersion().GetVersion(3).ToString(); var newVersion = UmbracoVersion.Current.ToString(); var reportUrl = string.Format("https://our.umbraco.org/contribute/releases/compare?from={0}&to={1}&notes=1", currentVersion, newVersion); return new { currentVersion = currentVersion, newVersion = newVersion, reportUrl = reportUrl }; } } /// <summary> /// Gets the Current Version of the Umbraco Site before an upgrade /// by using the last/most recent Umbraco Migration that has been run /// </summary> /// <returns>A SemVersion of the latest Umbraco DB Migration run</returns> private SemVersion CurrentVersion() { //Set a default version of 0.0.0 var version = new SemVersion(0); //If we have a db context available, if we don't then we are not installed anyways if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured && ApplicationContext.Current.DatabaseContext.CanConnect) { version = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema().DetermineInstalledVersionByMigrations(ApplicationContext.Current.Services.MigrationEntryService); } return version; } } }
using Umbraco.Web.Install.Models; namespace Umbraco.Web.Install.InstallSteps { /// <summary> /// This step is purely here to show the button to commence the upgrade /// </summary> [InstallSetupStep(InstallationType.Upgrade, "Upgrade", "upgrade", 1, "Upgrading Umbraco to the latest and greatest version.")] internal class UpgradeStep : InstallSetupStep<object> { public override bool RequiresExecution(object model) { return true; } public override InstallSetupResult Execute(object model) { return null; } } }
mit
C#
b3be4015e1dd30ce275e86b15638c8b4a381125d
Add calibrate command to the factory to be able to be parsed
admoexperience/admo-kinect,admoexperience/admo-kinect
classes/lib/CommandFactory.cs
classes/lib/CommandFactory.cs
using System; using System.Collections.Generic; using Admo.classes.lib.commands; using NLog; using Newtonsoft.Json; namespace Admo.classes.lib { class CommandFactory { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Dictionary<string, Type> Commmands = new Dictionary<string, Type>() { { "screenshot", typeof(ScreenshotCommand)}, { "checkin", typeof(CheckinCommand)}, { "updateConfig", typeof(UpdateConfigCommand)}, { "calibrate", typeof(CalibrateCommand)}, }; public static BaseCommand ParseCommand(string rawCommand) { dynamic rawOjbect = JsonConvert.DeserializeObject(rawCommand); string cmd = rawOjbect.command; if (Commmands.ContainsKey(cmd)) { return (BaseCommand) Activator.CreateInstance(Commmands[cmd]); } Logger.Error("Unkown command ["+cmd+"]"); return new UnknownCommand(); } } }
using System; using System.Collections.Generic; using Admo.classes.lib.commands; using NLog; using Newtonsoft.Json; namespace Admo.classes.lib { class CommandFactory { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Dictionary<string, Type> Commmands = new Dictionary<string, Type>() { { "screenshot", typeof(ScreenshotCommand)}, { "checkin", typeof(CheckinCommand)}, { "updateConfig", typeof(UpdateConfigCommand)}, }; public static BaseCommand ParseCommand(string rawCommand) { dynamic rawOjbect = JsonConvert.DeserializeObject(rawCommand); string cmd = rawOjbect.command; if (Commmands.ContainsKey(cmd)) { return (BaseCommand) Activator.CreateInstance(Commmands[cmd]); } Logger.Error("Unkown command ["+cmd+"]"); return new UnknownCommand(); } } }
mit
C#
e030266e9575f3d24be45cc8fc3b61d88a32b182
Fix test name
NeoAdonis/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,2yangk23/osu,ppy/osu,EVAST9919/osu,johnneijzen/osu,smoogipoo/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,2yangk23/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,peppy/osu
osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs
osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Overlays.Notifications; using osu.Game.Tests.Visual; namespace osu.Game.Tests.Online { [HeadlessTest] public class TestSceneBeatmapManager : OsuTestScene { private BeatmapManager beatmaps; private ProgressNotification recentNotification; private static readonly BeatmapSetInfo test_model = new BeatmapSetInfo { OnlineBeatmapSetID = 1 }; [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps) { this.beatmaps = beatmaps; beatmaps.PostNotification = n => recentNotification = n as ProgressNotification; } [TestCase(true)] [TestCase(false)] public void TestCancelDownloadRequest(bool closeFromRequest) { AddStep("download beatmap", () => beatmaps.Download(test_model)); if (closeFromRequest) AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel()); else AddStep("cancel download from notification", () => recentNotification.Close()); AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null); AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Overlays.Notifications; using osu.Game.Tests.Visual; namespace osu.Game.Tests.Online { [HeadlessTest] public class TestSceneBeatmapManager : OsuTestScene { private BeatmapManager beatmaps; private ProgressNotification recentNotification; private static readonly BeatmapSetInfo test_model = new BeatmapSetInfo { OnlineBeatmapSetID = 1 }; [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps) { this.beatmaps = beatmaps; beatmaps.PostNotification = n => recentNotification = n as ProgressNotification; } [TestCase(true)] [TestCase(false)] public void TestCancelDownloadFromRequest(bool closeFromRequest) { AddStep("download beatmap", () => beatmaps.Download(test_model)); if (closeFromRequest) AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel()); else AddStep("cancel download from notification", () => recentNotification.Close()); AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null); AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled); } } }
mit
C#
f1238c18ab385cc9923e4644a30927336529ec1b
Fix typo
OdeToCode/AddFeatureFolders
src/OdeToCode.AddFeatureFolders/FeatureFolderOptions.cs
src/OdeToCode.AddFeatureFolders/FeatureFolderOptions.cs
using System; using Microsoft.AspNetCore.Mvc.ApplicationModels; namespace OdeToCode.AddFeatureFolders { /// <summary> /// Options to control the behavior of feature folders /// </summary> public class FeatureFolderOptions { public FeatureFolderOptions() { FeatureFolderName = "Features"; DeriveFeatureFolderName = null; FeatureNamePlaceholder = "{Feature}"; DefaultViewLocation = @"\Features\{0}\{1}.cshtml"; } /// <summary> /// The name of the root feature folder on disk (default: 'Features') /// </summary> public string FeatureFolderName { get; set; } /// <summary> /// Given a ControllerModel object, returns the path to the feature folder. /// Only set this property if you want to override the default logic. /// The default logic takes the namespace of a Controller and assumes the /// namespace maps to a folder. Examples: /// Project.Name.Features.Admin.ManageUsers -> Features\Admin\ManageUsers /// Project.Name.Features.Admin -> Features\Admin /// Note the name "Features" is set by the FeatureFolderName property. /// </summary> public Func<ControllerModel, string> DeriveFeatureFolderName { get; set; } /// <summary> /// Used internally in RazorOptions.ViewLocationFormats strings. The Default is {Feature}, /// so the first format string in Razor options will be {Feature}\{0}.cshtml. Razor places /// the view name into the {0} placeholder, the FeatureViewLocationExander class in this project /// replaces {Feature} with the feature path derived from the ControllerModel /// </summary> public string FeatureNamePlaceholder { get; set; } /// <summary> /// The default view location. Helps intellisense find razor views. Example: /// "\Features\{0}\{1}.cshtml". /// Razor replaces the controller name into {0} placeholder & view name into the {1} placeholder. /// </summary> public string DefaultViewLocation { get; set; } } }
using System; using Microsoft.AspNetCore.Mvc.ApplicationModels; namespace OdeToCode.AddFeatureFolders { /// <summary> /// Options to control the behavior of feature folders /// </summary> public class FeatureFolderOptions { public FeatureFolderOptions() { FeatureFolderName = "Features"; DeriveFeatureFolderName = null; FeatureNamePlaceholder = "{Feature}"; DefaultViewLocation = @"\Features\{0}\{1}.cshtml"; } /// <summary> /// The name of the root feature folder on disk (default: 'Features') /// </summary> public string FeatureFolderName { get; set; } /// <summary> /// Given a ControllerModel object, returns the path to the feature folder. /// Only set this property if you want to override the default logic. /// The default logic takes the namespace of a Controller and assumes the /// namespace maps to a folder. Examples: /// Project.Name.Features.Admin.ManageUsers -> Features\Admin\ManageUsers /// Project.Name.Features.Admin -> Features\Admin /// Note the name "Features" is set by the FeatureFolderName property. /// </summary> public Func<ControllerModel, string> DeriveFeatureFolderName { get; set; } /// <summary> /// Used internally in RazorOptions.ViewLocationFormats strings. The Default is {Feature}, /// so the first format string in Razor options will be {Feature}\{0}.cshtml. Razor places /// the view name into the {0} placeholder, the FeatureViewLocationExander class in this project /// replaces {feature} with the feature path derived from the ControllerModel /// </summary> public string FeatureNamePlaceholder { get; set; } /// <summary> /// The default view location. Helps intellisense find razor views. Example: /// "\Features\{0}\{1}.cshtml". /// Razor replaces the controller name into {0} placeholder & view name into the {1} placeholder. /// </summary> public string DefaultViewLocation { get; set; } } }
mit
C#
f7d0ed8a49122b39b4111dbbbcef9c1ec7f7bcf4
Fix typo.
ogaudefroy/AspNetRoutingFeatureToggle
AspNetRoutingFeatureToggle/FeatureToggleRouteHandler.cs
AspNetRoutingFeatureToggle/FeatureToggleRouteHandler.cs
namespace AspNetRoutingFeatureToggle { using System; using System.Web; using System.Web.Routing; /// <summary> /// A custom route handler implementing A/B testing with route handling. /// </summary> public class FeatureToggleRouteHandler : IRouteHandler { private readonly Func<RequestContext, bool> _ftFuncter; private readonly IRouteHandler _actualVersionRouteHandler; private readonly IRouteHandler _nextVersionRouteHandler; /// <summary> /// Initializes a new instance of the <see cref="FeatureToggleRouteHandler"/> class. /// </summary> /// <param name="ftFuncter">The feature toggle functer.</param> /// <param name="actualVersionHandler">The actual version route handler.</param> /// <param name="nextVersionHandler">The next version route handler.</param> public FeatureToggleRouteHandler(Func<RequestContext, bool> ftFuncter, IRouteHandler actualVersionHandler, IRouteHandler nextVersionHandler) { if (ftFuncter == null) { throw new ArgumentNullException("ftFuncter"); } if (actualVersionHandler == null) { throw new ArgumentNullException("actualVersionHandler"); } if (nextVersionHandler == null) { throw new ArgumentNullException("nextVersionHandler"); } _ftFuncter = ftFuncter; _actualVersionRouteHandler = actualVersionHandler; _nextVersionRouteHandler = nextVersionHandler; } /// <summary> /// Provides the object that processes the request. /// </summary> /// <param name="requestContext">An object that encapsulates information about the request.</param> /// <returns>An object that processes the request.</returns> public IHttpHandler GetHttpHandler(RequestContext requestContext) { if (requestContext == null) { throw new ArgumentNullException("requestContext"); } return _ftFuncter(requestContext) ? _nextVersionRouteHandler.GetHttpHandler(requestContext) : _actualVersionRouteHandler.GetHttpHandler(requestContext); } } }
namespace AspNetRoutingFeatureToggle { using System; using System.Web; using System.Web.Routing; /// <summary> /// A custom route handler implementing A/B testing with route handling. /// </summary> public class FeatureToggleRouteHandler : IRouteHandler { private readonly Func<RequestContext, bool> _ftFuncer; private readonly IRouteHandler _actualVersionRouteHandler; private readonly IRouteHandler _nextVersionRouteHandler; /// <summary> /// Initializes a new instance of the <see cref="FeatureToggleRouteHandler"/> class. /// </summary> /// <param name="ftFuncter">The feature toggle functer.</param> /// <param name="actualVersionHandler"></param> /// <param name="nextVersionHandler"></param> public FeatureToggleRouteHandler(Func<RequestContext, bool> ftFuncter, IRouteHandler actualVersionHandler, IRouteHandler nextVersionHandler) { if (ftFuncter == null) { throw new ArgumentNullException("ftFuncter"); } if (actualVersionHandler == null) { throw new ArgumentNullException("actualVersionHandler"); } if (nextVersionHandler == null) { throw new ArgumentNullException("nextVersionHandler"); } _ftFuncer = ftFuncter; _actualVersionRouteHandler = actualVersionHandler; _nextVersionRouteHandler = nextVersionHandler; } /// <summary> /// Provides the object that processes the request. /// </summary> /// <param name="requestContext">An object that encapsulates information about the request.</param> /// <returns>An object that processes the request.</returns> public IHttpHandler GetHttpHandler(RequestContext requestContext) { if (requestContext == null) { throw new ArgumentNullException("requestContext"); } return _ftFuncer(requestContext) ? _nextVersionRouteHandler.GetHttpHandler(requestContext) : _actualVersionRouteHandler.GetHttpHandler(requestContext); } } }
mit
C#
0d481e4cdd11f541b515c45a17cbb14dad68183e
add implementation for WindowsPhone 8.0
B1naryStudio/Xamarin.Badge
Badge/Badge.Plugin.WindowsPhone8/BadgeImplementation.cs
Badge/Badge.Plugin.WindowsPhone8/BadgeImplementation.cs
using System.Linq; using Badge.Plugin.Abstractions; using Microsoft.Phone.Shell; namespace Badge.Plugin { /// <summary> /// Implementation for Badge /// </summary> public class BadgeImplementation : IBadge { public void ClearBadge() { SetBadge(0); } public void SetBadge(int badgeNumber, string title = null) { var shellTile = ShellTile.ActiveTiles.First(); if (shellTile == null) return; var tileData = new StandardTileData { Count = badgeNumber }; shellTile.Update(tileData); } } }
using Badge.Plugin.Abstractions; using System; namespace Badge.Plugin { /// <summary> /// Implementation for Badge /// </summary> public class BadgeImplementation : IBadge { public void ClearBadge() { throw new NotImplementedException(); } public void SetBadge(int badgeNumber, string title = null) { throw new NotImplementedException(); } } }
mit
C#
d6b9462452bdb7b02a7c91471a185b3fa0016fea
Update XPathGeometryTypeConverter.cs
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Serializer.Xaml/Converters/XPathGeometryTypeConverter.cs
src/Serializer.Xaml/Converters/XPathGeometryTypeConverter.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; #if NETSTANDARD1_3 using System.ComponentModel; #else using Portable.Xaml.ComponentModel; #endif using Core2D.Path; using Core2D.Path.Parser; namespace Serializer.Xaml.Converters { /// <summary> /// Defines <see cref="XPathGeometry"/> type converter. /// </summary> internal class XPathGeometryTypeConverter : TypeConverter { /// <inheritdoc/> public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(string); } /// <inheritdoc/> public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string); } /// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return XPathGeometryParser.Parse((string)value); } /// <inheritdoc/> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { var geometry = value as XPathGeometry; if (geometry != null) { return geometry.ToString(); } throw new NotSupportedException(); } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; #if NETSTANDARD using System.ComponentModel; #else using Portable.Xaml.ComponentModel; #endif using Core2D.Path; using Core2D.Path.Parser; namespace Serializer.Xaml.Converters { /// <summary> /// Defines <see cref="XPathGeometry"/> type converter. /// </summary> internal class XPathGeometryTypeConverter : TypeConverter { /// <inheritdoc/> public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(string); } /// <inheritdoc/> public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string); } /// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return XPathGeometryParser.Parse((string)value); } /// <inheritdoc/> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { var geometry = value as XPathGeometry; if (geometry != null) { return geometry.ToString(); } throw new NotSupportedException(); } } }
mit
C#
c783a19e41b431763eec7e725be5f97df78f0e32
Fix mania frame conversion not working at all
2yangk23/osu,ZLima12/osu,DrabWeb/osu,Frontear/osuKyzer,naoey/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,naoey/osu,DrabWeb/osu,ppy/osu,DrabWeb/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,peppy/osu,ppy/osu,2yangk23/osu,ZLima12/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,Nabile-Rahmani/osu,UselessToucan/osu,naoey/osu,EVAST9919/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu
osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs
osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Replays.Legacy; using osu.Game.Rulesets.Replays.Types; namespace osu.Game.Rulesets.Mania.Replays { public class ManiaReplayFrame : ReplayFrame, IConvertibleReplayFrame { public List<ManiaAction> Actions = new List<ManiaAction>(); public ManiaReplayFrame() { } public ManiaReplayFrame(double time, params ManiaAction[] actions) : base(time) { Actions.AddRange(actions); } public void ConvertFrom(LegacyReplayFrame legacyFrame, Beatmap beatmap) { // We don't need to fully convert, just create the converter var converter = new ManiaBeatmapConverter(beatmap.BeatmapInfo.RulesetID == 3, beatmap); // NB: Via co-op mod, osu-stable can have two stages with floor(col/2) and ceil(col/2) columns. This will need special handling // elsewhere in the game if we do choose to support the old co-op mod anyway. For now, assume that there is only one stage. var stage = new StageDefinition { Columns = converter.TargetColumns }; var normalAction = ManiaAction.Key1; var specialAction = ManiaAction.Special1; int activeColumns = (int)(legacyFrame.MouseX ?? 0); int counter = 0; while (activeColumns > 0) { var isSpecial = stage.IsSpecialColumn(counter); if ((activeColumns & 1) > 0) Actions.Add(isSpecial ? specialAction : normalAction); if (isSpecial) specialAction++; else normalAction++; counter++; activeColumns >>= 1; } } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Replays.Legacy; using osu.Game.Rulesets.Replays.Types; namespace osu.Game.Rulesets.Mania.Replays { public class ManiaReplayFrame : ReplayFrame, IConvertibleReplayFrame { public List<ManiaAction> Actions = new List<ManiaAction>(); public ManiaReplayFrame() { } public ManiaReplayFrame(double time, params ManiaAction[] actions) : base(time) { Actions.AddRange(actions); } public void ConvertFrom(LegacyReplayFrame legacyFrame, Beatmap beatmap) { // We don't need to fully convert, just create the converter var converter = new ManiaBeatmapConverter(beatmap.BeatmapInfo.RulesetID == 3, beatmap); // NB: Via co-op mod, osu-stable can have two stages with floor(col/2) and ceil(col/2) columns. This will need special handling // elsewhere in the game if we do choose to support the old co-op mod anyway. For now, assume that there is only one stage. var stage = new StageDefinition { Columns = converter.TargetColumns }; var normalAction = ManiaAction.Key1; var specialAction = ManiaAction.Special1; int activeColumns = (int)(legacyFrame.MouseX ?? 0); int counter = 0; while (activeColumns > 0) { Actions.Add((activeColumns & 1) > 0 ? specialAction : normalAction); if (stage.IsSpecialColumn(counter)) normalAction++; else specialAction++; counter++; activeColumns >>= 1; } } } }
mit
C#
07b94f5a608b1840bfb0c63695a421ae00cfcd03
Use account mycouchtester
danielwertheim/mycouch,danielwertheim/mycouch
src/Tests/MyCouch.IntegrationTests/TestClientFactory.cs
src/Tests/MyCouch.IntegrationTests/TestClientFactory.cs
namespace MyCouch.IntegrationTests { internal static class TestClientFactory { internal static IClient CreateDefault() { return new Client("http://mycouchtester:1q2w3e4r@localhost:5984/" + TestConstants.TestDbName); } } }
namespace MyCouch.IntegrationTests { internal static class TestClientFactory { internal static IClient CreateDefault() { return new Client("http://localhost:5984/" + TestConstants.TestDbName); } } }
mit
C#
150c4e8e10dd05a885f6a49af7fc49c49277f761
make properties nullable
ChrisEby/Mandrill.net,ericthornton/Mandrill.net,feinoujc/Mandrill.net
src/Mandrill.net/Model/WebHook/MandrillEventLocation.cs
src/Mandrill.net/Model/WebHook/MandrillEventLocation.cs
using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; namespace Mandrill.Model { public class MandrillEventLocation { public string CountryShort { get; set; } public string Country { get; set; } public string Region { get; set; } public string City { get; set; } public double? Latitude { get; set; } public double? Longitude { get; set; } public string PostalCode { get; set; } public string Timezone { get; set; } [OnError] internal void OnError(StreamingContext context, ErrorContext errorContext) { errorContext.Handled = true; } } }
using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; namespace Mandrill.Model { public class MandrillEventLocation { public string CountryShort { get; set; } public string Country { get; set; } public string Region { get; set; } public string City { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } public string PostalCode { get; set; } public string Timezone { get; set; } [OnError] internal void OnError(StreamingContext context, ErrorContext errorContext) { errorContext.Handled = true; } } }
mit
C#
21e6351c5354467ad641f5fee2971438b50b2ad6
Allow DI for LoginOverlay to resolve to null in non-graphical environments (fix tests)
peppy/osu,peppy/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,2yangk23/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu-new,smoogipooo/osu,2yangk23/osu,peppy/osu
osu.Game/Online/Placeholders/LoginPlaceholder.cs
osu.Game/Online/Placeholders/LoginPlaceholder.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Overlays; namespace osu.Game.Online.Placeholders { public sealed class LoginPlaceholder : Placeholder { [Resolved(CanBeNull = true)] private LoginOverlay login { get; set; } public LoginPlaceholder(string action) { AddIcon(FontAwesome.Solid.UserLock, cp => { cp.Font = cp.Font.With(size: TEXT_SIZE); cp.Padding = new MarginPadding { Right = 10 }; }); AddText(@"Please sign in to " + action); } protected override bool OnMouseDown(MouseDownEvent e) { this.ScaleTo(0.8f, 4000, Easing.OutQuint); return base.OnMouseDown(e); } protected override bool OnMouseUp(MouseUpEvent e) { this.ScaleTo(1, 1000, Easing.OutElastic); return base.OnMouseUp(e); } protected override bool OnClick(ClickEvent e) { login?.Show(); return base.OnClick(e); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Overlays; namespace osu.Game.Online.Placeholders { public sealed class LoginPlaceholder : Placeholder { [Resolved] private LoginOverlay login { get; set; } public LoginPlaceholder(string action) { AddIcon(FontAwesome.Solid.UserLock, cp => { cp.Font = cp.Font.With(size: TEXT_SIZE); cp.Padding = new MarginPadding { Right = 10 }; }); AddText(@"Please sign in to " + action); } protected override bool OnMouseDown(MouseDownEvent e) { this.ScaleTo(0.8f, 4000, Easing.OutQuint); return base.OnMouseDown(e); } protected override bool OnMouseUp(MouseUpEvent e) { this.ScaleTo(1, 1000, Easing.OutElastic); return base.OnMouseUp(e); } protected override bool OnClick(ClickEvent e) { login?.Show(); return base.OnClick(e); } } }
mit
C#
6b682936b9abd4ce311f4990a74107c52649a80a
Fix typo
henkmollema/CryptoHelper,henkmollema/CryptoHelper
test/CryptoHelper.Tests/CryptoHelperTests.cs
test/CryptoHelper.Tests/CryptoHelperTests.cs
using Xunit; namespace CryptoHelper.Tests { public class CryptoHelperTests { private const string Password = "VerySecurePassword"; [Fact] public void HashPassword_Returns_HashedPassword() { var hashed = Crypto.HashPassword(Password); Assert.NotEmpty(hashed); } [Fact] public void VeryifyHashedPasswordWithCorrectPassword_Returns_CorrectResult() { var hashed = Crypto.HashPassword(Password); var result = Crypto.VerifyHashedPassword(hashed, Password); Assert.True(result); } [Fact] public void VeryifyHashedPasswordWithIncorrectPassword_Returns_CorrectResult() { var hashed = Crypto.HashPassword(Password); var result = Crypto.VerifyHashedPassword(hashed, "WrongPassword"); Assert.False(result); } } }
using Xunit; namespace CryptoHelper.Tests { public class CryptoHelperTests { private const string Password = "VerySecuryPassword"; [Fact] public void HashPassword_Returns_HashedPassword() { var hashed = Crypto.HashPassword(Password); Assert.NotEmpty(hashed); } [Fact] public void VeryifyHashedPasswordWithCorrectPassword_Returns_CorrectResult() { var hashed = Crypto.HashPassword(Password); var result = Crypto.VerifyHashedPassword(hashed, Password); Assert.True(result); } [Fact] public void VeryifyHashedPasswordWithIncorrectPassword_Returns_CorrectResult() { var hashed = Crypto.HashPassword(Password); var result = Crypto.VerifyHashedPassword(hashed, "WrongPassword"); Assert.False(result); } } }
mit
C#
587074bd9026d7d3c565bbe416faa71bfaf50040
Increment minor version
emoacht/ManagedNativeWifi
Source/ManagedNativeWifi/Properties/AssemblyInfo.cs
Source/ManagedNativeWifi/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ManagedNativeWifi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManagedNativeWifi")] [assembly: AssemblyCopyright("Copyright © 2015-2020 emoacht")] [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("ebff4686-23e6-42bf-97ca-cf82641bcfa7")] // 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.7.0.0")] [assembly: AssemblyFileVersion("1.7.0.0")] [assembly: NeutralResourcesLanguage("en-US")] // For unit test [assembly: InternalsVisibleTo("ManagedNativeWifi.Test")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ManagedNativeWifi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManagedNativeWifi")] [assembly: AssemblyCopyright("Copyright © 2015-2019 emoacht")] [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("ebff4686-23e6-42bf-97ca-cf82641bcfa7")] // 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.5.0.0")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: NeutralResourcesLanguage("en-US")] // For unit test [assembly: InternalsVisibleTo("ManagedNativeWifi.Test")]
mit
C#
d78603a8dcacdbed34b29bcef48c076857e7a2a8
Add tests
skonves/Konves.KScript
tests/Konves.KScript.UnitTests/ExpressionTestFixture.cs
tests/Konves.KScript.UnitTests/ExpressionTestFixture.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Konves.KScript.UnitTests { [TestClass] public class ExpressionTestFixture { [TestCategory(nameof(Expression))] [TestMethod] public void EvaluateTest() { string stringValue = "string value"; decimal decimalValue = 5m; DateTime dateValue = DateTime.Parse("2015-1-1"); bool boolValue = true; IDictionary<string, object> state = new Dictionary<string, object> { { nameof(stringValue), stringValue }, { nameof(decimalValue), decimalValue }, { nameof(dateValue), dateValue }, { nameof(boolValue), boolValue } }; DoEvaluateTest($"{{{nameof(stringValue)}}} = '{stringValue}'", state, true); DoEvaluateTest($"TRUE != FALSE", state, true); DoEvaluateTest($"NOW > '2000-1-1'", state, true); DoEvaluateTest($"NULL IS NOT NULL", state, false); DoEvaluateTest($"(5) > (1)", state, true); DoEvaluateTest($"TRUE OR FALSE", state, true); DoEvaluateTest($"(5 BETWEEN 1 AND 10)", state, true); DoEvaluateTest($"'asdf' IN ['asdf','qwerty']", state, true); DoEvaluateTest($"TRUE AND NOT FALSE", state, true); } private void DoEvaluateTest(string s, IDictionary<string, object> state, bool expected) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.AreEqual(expected, result); } [TestCategory(nameof(Expression))] [ExpectedException(typeof(ArgumentException))] [TestMethod] public void EvaluateTest_BadSyntax() { DoEvaluateTest_BadSyntax("not a valid expression", null); } private void DoEvaluateTest_BadSyntax(string s, IDictionary<string, object> state) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.Fail(); } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Konves.KScript.UnitTests { [TestClass] public class ExpressionTestFixture { [TestCategory(nameof(Expression))] [TestMethod] public void EvaluateTest() { string stringValue = "string value"; decimal decimalValue = 5m; DateTime dateValue = DateTime.Parse("2015-1-1"); bool boolValue = true; IDictionary<string, object> state = new Dictionary<string, object> { { nameof(stringValue), stringValue }, { nameof(decimalValue), decimalValue }, { nameof(dateValue), dateValue }, { nameof(boolValue), boolValue } }; DoEvaluateTest($"{{{nameof(stringValue)}}} = '{stringValue}'", state, true); DoEvaluateTest($"TRUE != FALSE", state, true); DoEvaluateTest($"NOW > '2000-1-1'", state, true); DoEvaluateTest($"NULL IS NOT NULL", state, false); DoEvaluateTest($"(5) > (1)", state, true); DoEvaluateTest($"TRUE OR FALSE", state, true); DoEvaluateTest($"5 BETWEEN 1 AND 10", state, true); DoEvaluateTest($"'asdf' IN ['asdf','qwerty']", state, true); DoEvaluateTest($"TRUE AND NOT FALSE", state, true); } private void DoEvaluateTest(string s, IDictionary<string, object> state, bool expected) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.AreEqual(expected, result); } [TestCategory(nameof(Expression))] [ExpectedException(typeof(ArgumentException))] [TestMethod] public void EvaluateTest_BadSyntax() { DoEvaluateTest_BadSyntax("not a valid expression", null); } private void DoEvaluateTest_BadSyntax(string s, IDictionary<string, object> state) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.Fail(); } } }
apache-2.0
C#
161801b847ab083f2d40403747d51fd79fc6897b
add test code
jezzay/Test-Travis-CI,jezzay/Test-Travis-CI
TestWebApp/TestWebApp/Controllers/HomeController.cs
TestWebApp/TestWebApp/Controllers/HomeController.cs
using System.Web.Mvc; using Newtonsoft.Json; namespace TestWebApp.Controllers { public class HomeController : Controller { public ActionResult Index() { ViewBag.Title = "Home Page test"; var data = new {firstname = "test", lastname = "lastname"}; string json = JsonConvert.SerializeObject(data); return View(); } } }
using System.Web.Mvc; namespace TestWebApp.Controllers { public class HomeController : Controller { public ActionResult Index() { ViewBag.Title = "Home Page test"; return View(); } } }
mit
C#
399c7a87b607e8da6bf9147ed34763ee6affecb3
Update LocationId.cs
timeanddate/libtad-net
TimeAndDate.Services/DataTypes/Places/LocationId.cs
TimeAndDate.Services/DataTypes/Places/LocationId.cs
using System; namespace TimeAndDate.Services.DataTypes.Places { /// <summary> /// LocationId class represents the different kinds of IDs that Time and Date API /// does support. See <see cref="https://dev.timeanddate.com/docs/type-locationid" /> /// for detailed information. /// </summary> public class LocationId { public string TextualId { get; private set; } public int? NumericId; public Coordinates CoordinatesId { get; private set; } /// <summary> /// Create a LocationId based on a textual ID /// </summary> /// <param name='textualId'> /// Can be country code, country name, city, etc /// </param> public LocationId (string textualId) { TextualId = textualId; } /// <summary> /// Create a LocationId based on an internal integer ID /// </summary> /// <param name='numericId'> /// Usually an integer ID that is returned from a previous API call /// </param> public LocationId (int numericId) { NumericId = numericId; } /// <summary> /// Create a LocationId based on coordinates /// </summary> /// <param name='coordinates'> /// Provide an coordinate object to LocationId. /// </param> public LocationId (Coordinates coordinates) { CoordinatesId = coordinates; } public static explicit operator LocationId (Place place) { return new LocationId (place.Id); } } }
using System; namespace TimeAndDate.Services.DataTypes.Places { /// <summary> /// LocationId class represents the different kinds of IDs that Time and Date API /// does support. See <see cref="https://services.timeanddate.com/api/doc/v2/type-locationid.html" /> /// for detailed information. /// </summary> public class LocationId { public string TextualId { get; private set; } public int? NumericId; public Coordinates CoordinatesId { get; private set; } /// <summary> /// Create a LocationId based on a textual ID /// </summary> /// <param name='textualId'> /// Can be country code, country name, city, etc /// </param> public LocationId (string textualId) { TextualId = textualId; } /// <summary> /// Create a LocationId based on an internal integer ID /// </summary> /// <param name='numericId'> /// Usually an integer ID that is returned from a previous API call /// </param> public LocationId (int numericId) { NumericId = numericId; } /// <summary> /// Create a LocationId based on coordinates /// </summary> /// <param name='coordinates'> /// Provide an coordinate object to LocationId. /// </param> public LocationId (Coordinates coordinates) { CoordinatesId = coordinates; } public static explicit operator LocationId (Place place) { return new LocationId (place.Id); } } }
mit
C#
1e12f4539c0619b7520fb6fcb49a1f9b56a834f1
Revert "intentional break, don't use: unnecessary constructor"
ParagonTruss/UnitClassLibrary
UnitClassLibrary/ElectricCurrent/ElectricCurrent.cs
UnitClassLibrary/ElectricCurrent/ElectricCurrent.cs
using System; namespace UnitClassLibrary { public partial class ElectricCurrent { #region _fields and Internal Properties internal ElectricCurrentType InternalUnitType { get { return _internalUnitType; } } private ElectricCurrentType _internalUnitType; private double _intrinsicValue; public ElectricCurrentEqualityStrategy EqualityStrategy { get { return _equalityStrategy; } set { _equalityStrategy = value; } } private ElectricCurrentEqualityStrategy _equalityStrategy; #endregion #region Constructors /// <summary> Zero Constructor </summary> public ElectricCurrent(ElectricCurrentEqualityStrategy passedStrategy = null) { _intrinsicValue = 0; _internalUnitType = ElectricCurrentType.Ampere; _intrinsicValue = 0; } /// <summary> Accepts standard types for input. </summary> public ElectricCurrent(ElectricCurrentType passedElectricCurrentType, double passedInput, ElectricCurrentEqualityStrategy passedStrategy = null) { _intrinsicValue = passedInput; _internalUnitType = passedElectricCurrentType; _equalityStrategy = _chooseDefaultOrPassedStrategy(passedStrategy); } /// <summary> Copy constructor (new unit with same fields as the passed) </summary> public ElectricCurrent(ElectricCurrent passedElectricCurrent) { _intrinsicValue = passedElectricCurrent._intrinsicValue; _internalUnitType = passedElectricCurrent._internalUnitType; _equalityStrategy = passedElectricCurrent._equalityStrategy; } #endregion #region helper _methods private static ElectricCurrentEqualityStrategy _chooseDefaultOrPassedStrategy(ElectricCurrentEqualityStrategy passedStrategy) { if (passedStrategy == null) { return ElectricCurrentEqualityStrategyImplementations.DefaultConstantEquality; } else { return passedStrategy; } } private double _retrieveIntrinsicValueAsDesiredExternalUnit(ElectricCurrentType toElectricCurrentType) { return ConvertElectricCurrent(_internalUnitType, _intrinsicValue, toElectricCurrentType); } #endregion } }
using System; namespace UnitClassLibrary { public partial class ElectricCurrent { #region _fields and Internal Properties internal ElectricCurrentType InternalUnitType { get { return _internalUnitType; } } private ElectricCurrentType _internalUnitType; private double _intrinsicValue; public ElectricCurrentEqualityStrategy EqualityStrategy { get { return _equalityStrategy; } set { _equalityStrategy = value; } } private ElectricCurrentEqualityStrategy _equalityStrategy; #endregion #region Constructors /// <summary> Zero Constructor </summary> public ElectricCurrent(ElectricCurrentEqualityStrategy passedStrategy = null) { _intrinsicValue = 0; _internalUnitType = ElectricCurrentType.Ampere; _intrinsicValue = 0; } /// <summary> Accepts standard types for input. </summary> public ElectricCurrent(ElectricCurrentType passedElectricCurrentType, double passedInput, ElectricCurrentEqualityStrategy passedStrategy = null) { _intrinsicValue = passedInput; _internalUnitType = passedElectricCurrentType; _equalityStrategy = _chooseDefaultOrPassedStrategy(passedStrategy); } /// <summary> Copy constructor (new unit with same fields as the passed) </summary> public ElectricCurrent(ElectricCurrent passedElectricCurrent) { _intrinsicValue = passedElectricCurrent._intrinsicValue; _internalUnitType = passedElectricCurrent._internalUnitType; _equalityStrategy = passedElectricCurrent._equalityStrategy; } public ElectricCurrent(Distance passedDistance) { _intrinsicValue = 0; _internalUnitType = ElectricCurrentType.Ampere; _intrinsicValue = 0; } #endregion #region helper _methods private static ElectricCurrentEqualityStrategy _chooseDefaultOrPassedStrategy(ElectricCurrentEqualityStrategy passedStrategy) { if (passedStrategy == null) { return ElectricCurrentEqualityStrategyImplementations.DefaultConstantEquality; } else { return passedStrategy; } } private double _retrieveIntrinsicValueAsDesiredExternalUnit(ElectricCurrentType toElectricCurrentType) { return ConvertElectricCurrent(_internalUnitType, _intrinsicValue, toElectricCurrentType); } #endregion } }
lgpl-2.1
C#
68a739c397f727e89c6e6ad4d2b022b268838015
Add IsMouseOver method, to check whether the mouse is hovering over the menu
eamonwoortman/django-unity3d-example,eamonwoortman/django-unity3d-example,eamonwoortman/django-unity3d-example
Unity/Assets/Scripts/ExampleProject/SavegameMenu.cs
Unity/Assets/Scripts/ExampleProject/SavegameMenu.cs
using UnityEngine; using System.Collections; public class SavegameMenu : MonoBehaviour { public GUISkin Skin; public delegate void LoadSaveButtonPressed(string filename); public LoadSaveButtonPressed OnSaveButtonPressed; public LoadSaveButtonPressed OnLoadButtonPressed; private Rect windowRect = new Rect(10, 10, 200, 200); private const string NoSavegamesFound = "No savegames found"; private string[] savegameNames = new string[] { NoSavegamesFound }; private int selectedNameIndex = -1; private string saveName = ""; public bool InRect(Vector3 mousePosition) { return windowRect.Contains(mousePosition); } private void ShowWindow(int id) { GUILayout.BeginVertical(); GUILayout.Label("Save games"); bool savegamesFound = (savegameNames[0] != NoSavegamesFound); GUI.enabled = savegamesFound; selectedNameIndex = GUILayout.SelectionGrid(selectedNameIndex, savegameNames, 1); GUI.enabled = true; GUILayout.Space(100); saveName = GUILayout.TextField(saveName); GUILayout.BeginHorizontal(); GUI.enabled = (saveName != ""); if (GUILayout.Button("Save")) { if (OnSaveButtonPressed != null) { OnSaveButtonPressed(savegameNames[selectedNameIndex]); } } GUI.enabled = savegamesFound; if (GUILayout.Button("Load")) { if (OnLoadButtonPressed != null) { OnLoadButtonPressed(savegameNames[selectedNameIndex]); } } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.EndVertical(); } private void OnGUI() { GUI.skin = Skin; windowRect = GUILayout.Window(0, windowRect, ShowWindow, "Load/save game"); } public bool IsMouseOver() { Vector3 mp = Input.mousePosition; mp.y = Mathf.Abs(mp.y - Screen.height); if (InRect(mp)) { return false; } return true; } }
using UnityEngine; using System.Collections; public class SavegameMenu : MonoBehaviour { public GUISkin Skin; public delegate void LoadSaveButtonPressed(string filename); public LoadSaveButtonPressed OnSaveButtonPressed; public LoadSaveButtonPressed OnLoadButtonPressed; private Rect windowRect = new Rect(10, 10, 200, 200); private const string NoSavegamesFound = "No savegames found"; private string[] savegameNames = new string[] { NoSavegamesFound }; private int selectedNameIndex = -1; private string saveName = ""; public bool InRect(Vector3 mousePosition) { return windowRect.Contains(mousePosition); } private void ShowWindow(int id) { GUILayout.BeginVertical(); GUILayout.Label("Save games"); bool savegamesFound = (savegameNames[0] != NoSavegamesFound); GUI.enabled = savegamesFound; selectedNameIndex = GUILayout.SelectionGrid(selectedNameIndex, savegameNames, 1); GUI.enabled = true; GUILayout.Space(100); saveName = GUILayout.TextField(saveName); GUILayout.BeginHorizontal(); GUI.enabled = (saveName != ""); if (GUILayout.Button("Save")) { if (OnSaveButtonPressed != null) { OnSaveButtonPressed(savegameNames[selectedNameIndex]); } } GUI.enabled = savegamesFound; if (GUILayout.Button("Load")) { if (OnLoadButtonPressed != null) { OnLoadButtonPressed(savegameNames[selectedNameIndex]); } } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.EndVertical(); } private void OnGUI() { GUI.skin = Skin; windowRect = GUILayout.Window(0, windowRect, ShowWindow, "Load/save game"); } }
mit
C#
c9fb7c88ecfdfaaf731ff3f3ed124dfff6c64b28
Update Index.cshtml
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: August 20, 2021<br /><br /> <strong>Now offering</strong><br /><br /> Crude Fiber<br /> </div> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> We are very sorry but the lab is experiencing much longer turnarounds than normal. Most tests are subject to 6 - 8 weeks.<br /><br /> We apologize for this inconvenience. We are expanding our staffing to address this issue and hope to return to more reasonable turnaround times soon.<br /><br /> Thank you for your understanding and patience.<br /> ~ Sep. 15, 2021 </div> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: August 20, 2021<br /><br /> <strong>New Methods Under Development</strong><br /><br /> Crude Fat by Acid Hydrolysis<br /> Expected to be offered mid September, 2021 </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p> <p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and waste water, and feed in support of agricultural and environmental research.</p> <p>For new clients, please note the drop-down menu under “Lab Information” which contains an “Order Completion Help” section to help guide you in creating a work order. Also helpful under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides brief descriptions of our current methods.</p> <p>Please feel free to contact the lab with any questions.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:[email protected]">[email protected]</a></p> <p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br> Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p> </address> <p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: August 20, 2021<br /><br /> <strong>Now offering</strong><br /><br /> Crude Fiber<br /> </div> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: August 20, 2021<br /><br /> <strong>New Methods Under Development</strong><br /><br /> Crude Fat by Acid Hydrolysis<br /> Expected to be offered mid September, 2021 </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p> <p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and waste water, and feed in support of agricultural and environmental research.</p> <p>For new clients, please note the drop-down menu under “Lab Information” which contains an “Order Completion Help” section to help guide you in creating a work order. Also helpful under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides brief descriptions of our current methods.</p> <p>Please feel free to contact the lab with any questions.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:[email protected]">[email protected]</a></p> <p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br> Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p> </address> <p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p> </div>
mit
C#
7d9b0713c868e3e26ab0dac05de6662842a5d2d5
Fix FrameLoadEndEventHandler param name (wasn't updated when I previously expanded the event handler to include args)
haozhouxu/CefSharp,Haraguroicha/CefSharp,zhangjingpu/CefSharp,ruisebastiao/CefSharp,gregmartinhtc/CefSharp,ruisebastiao/CefSharp,AJDev77/CefSharp,jamespearce2006/CefSharp,windygu/CefSharp,joshvera/CefSharp,joshvera/CefSharp,Octopus-ITSM/CefSharp,AJDev77/CefSharp,illfang/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,Livit/CefSharp,battewr/CefSharp,zhangjingpu/CefSharp,joshvera/CefSharp,rover886/CefSharp,twxstar/CefSharp,Octopus-ITSM/CefSharp,Livit/CefSharp,ruisebastiao/CefSharp,AJDev77/CefSharp,Haraguroicha/CefSharp,yoder/CefSharp,Livit/CefSharp,wangzheng888520/CefSharp,yoder/CefSharp,Octopus-ITSM/CefSharp,NumbersInternational/CefSharp,NumbersInternational/CefSharp,rover886/CefSharp,VioletLife/CefSharp,twxstar/CefSharp,illfang/CefSharp,gregmartinhtc/CefSharp,rlmcneary2/CefSharp,haozhouxu/CefSharp,dga711/CefSharp,ITGlobal/CefSharp,NumbersInternational/CefSharp,wangzheng888520/CefSharp,VioletLife/CefSharp,twxstar/CefSharp,haozhouxu/CefSharp,rlmcneary2/CefSharp,jamespearce2006/CefSharp,yoder/CefSharp,Haraguroicha/CefSharp,dga711/CefSharp,jamespearce2006/CefSharp,zhangjingpu/CefSharp,NumbersInternational/CefSharp,VioletLife/CefSharp,jamespearce2006/CefSharp,wangzheng888520/CefSharp,VioletLife/CefSharp,ITGlobal/CefSharp,illfang/CefSharp,ITGlobal/CefSharp,rover886/CefSharp,dga711/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,rlmcneary2/CefSharp,ITGlobal/CefSharp,twxstar/CefSharp,Haraguroicha/CefSharp,Livit/CefSharp,Haraguroicha/CefSharp,windygu/CefSharp,battewr/CefSharp,battewr/CefSharp,joshvera/CefSharp,yoder/CefSharp,haozhouxu/CefSharp,illfang/CefSharp,rover886/CefSharp,battewr/CefSharp,wangzheng888520/CefSharp,rlmcneary2/CefSharp,ruisebastiao/CefSharp,gregmartinhtc/CefSharp,rover886/CefSharp,windygu/CefSharp,dga711/CefSharp,Octopus-ITSM/CefSharp,windygu/CefSharp
CefSharp/FrameLoadEndEventArgs.cs
CefSharp/FrameLoadEndEventArgs.cs
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { /// <summary> /// Event arguments to the FrameLoadEnd event handler set up in IWebBrowser. /// </summary> public class FrameLoadEndEventArgs : EventArgs { public FrameLoadEndEventArgs(string url, bool isMainFrame, int httpStatusCode) { Url = url; IsMainFrame = isMainFrame; HttpStatusCode = httpStatusCode; } /// <summary> /// The URL that was loaded. /// </summary> public string Url { get; private set; } /// <summary> /// Is this the Main Frame /// </summary> public bool IsMainFrame { get; private set; } /// <summary> /// Http Status Code /// </summary> public int HttpStatusCode { get; set; } }; /// <summary> /// A delegate type used to listen to FrameLoadEnd events. /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">The event arguments.</param> public delegate void FrameLoadEndEventHandler(object sender, FrameLoadEndEventArgs e); }
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { /// <summary> /// Event arguments to the FrameLoadEnd event handler set up in IWebBrowser. /// </summary> public class FrameLoadEndEventArgs : EventArgs { public FrameLoadEndEventArgs(string url, bool isMainFrame, int httpStatusCode) { Url = url; IsMainFrame = isMainFrame; HttpStatusCode = httpStatusCode; } /// <summary> /// The URL that was loaded. /// </summary> public string Url { get; private set; } /// <summary> /// Is this the Main Frame /// </summary> public bool IsMainFrame { get; private set; } /// <summary> /// Http Status Code /// </summary> public int HttpStatusCode { get; set; } }; /// <summary> /// A delegate type used to listen to FrameLoadEnd events. /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">The event arguments.</param> public delegate void FrameLoadEndEventHandler(object sender, FrameLoadEndEventArgs url); }
bsd-3-clause
C#
45b45759faa6860e1cdb82638e0e3b33e58f76b3
bump version
samiy-xx/keysndr,samiy-xx/keysndr,samiy-xx/keysndr
KeySndr.Base/Properties/AssemblyInfo.cs
KeySndr.Base/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("KeySndr.Base")] [assembly: AssemblyDescription("Base library for KeySndr server")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("blockz3d.com")] [assembly: AssemblyProduct("KeySndr.Base")] [assembly: AssemblyCopyright("Copyright © Sami Ylönen 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9413db07-5510-46a4-82b0-38485af52792")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.4.*")]
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("KeySndr.Base")] [assembly: AssemblyDescription("Base library for KeySndr server")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("blockz3d.com")] [assembly: AssemblyProduct("KeySndr.Base")] [assembly: AssemblyCopyright("Copyright © Sami Ylönen 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9413db07-5510-46a4-82b0-38485af52792")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.3.*")]
mit
C#
b939ac5dffdc486ff0a07038788eacdec23018c3
Remove C# 6 syntax usage
uoko-J-Go/IdentityServer,johnkors/Thinktecture.IdentityServer.v3,uoko-J-Go/IdentityServer,chicoribas/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,uoko-J-Go/IdentityServer,IdentityServer/IdentityServer3,roflkins/IdentityServer3,IdentityServer/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,IdentityServer/IdentityServer3,chicoribas/IdentityServer3,chicoribas/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,roflkins/IdentityServer3,roflkins/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,feanz/Thinktecture.IdentityServer.v3
source/Core/Extensions/JwtSecurityTokenExtensions.cs
source/Core/Extensions/JwtSecurityTokenExtensions.cs
/* * Copyright 2014, 2015 Dominick Baier, Brock Allen * * 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.IdentityModel.Tokens; using System.Linq; using System.Security.Cryptography.X509Certificates; namespace IdentityServer3.Core.Extensions { internal static class JwtSecurityTokenExtensions { public static X509Certificate2 GetCertificateFromToken(this JwtSecurityToken securityToken) { object values; if (securityToken.Header.TryGetValue(JwtHeaderParameterNames.X5c, out values)) { var objects = values as object[]; var rawCertificate = objects != null ? objects.Cast<string>().FirstOrDefault() : null; if (rawCertificate != null) { return new X509Certificate2(Convert.FromBase64String(rawCertificate)); } } return null; } } }
/* * Copyright 2014, 2015 Dominick Baier, Brock Allen * * 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.IdentityModel.Tokens; using System.Linq; using System.Security.Cryptography.X509Certificates; namespace IdentityServer3.Core.Extensions { internal static class JwtSecurityTokenExtensions { public static X509Certificate2 GetCertificateFromToken(this JwtSecurityToken securityToken) { object values; if (securityToken.Header.TryGetValue(JwtHeaderParameterNames.X5c, out values)) { var rawCertificate = (values as object[])?.Cast<string>().FirstOrDefault(); if (rawCertificate != null) { return new X509Certificate2(Convert.FromBase64String(rawCertificate)); } } return null; } } }
apache-2.0
C#
788542ace3393a09be7e008b7db3bff57a50f9e9
Fix for compiled speak views
Fortis-Collection/fortis
src/Fortis.Mvc/Pipelines/GetModel/GetFromView.cs
src/Fortis.Mvc/Pipelines/GetModel/GetFromView.cs
using System.Linq; using System.Web.Compilation; using System.Web.Mvc; using Fortis.Model; using Sitecore.Mvc.Pipelines.Response.GetModel; using Sitecore.Mvc.Presentation; namespace Fortis.Mvc.Pipelines.GetModel { using System.Collections.Generic; using System.IO; using System.Web; using System.Web.Caching; public class GetFromView : GetModelProcessor { private const string RenderingModelField = "Model"; private List<string> validTypes = new List<string> { "Layout", "View", "r", string.Empty }; protected virtual object GetFromViewPath(Rendering rendering, GetModelArgs args) { var path = this.GetViewPath(args); if (string.IsNullOrWhiteSpace(path)) { return null; } var filePath = HttpContext.Current.Server.MapPath(path); if (File.Exists(filePath) == false) { return false; } // Retrieve the compiled view var compiledViewType = BuildManager.GetCompiledType(path); var baseType = compiledViewType.BaseType; // Check to see if the view has been found and that it is a generic type if (baseType == null || !baseType.IsGenericType) { return null; } var modelType = baseType.GetGenericArguments()[0]; // Check to see if no model has been set if (modelType == typeof(object)) { return null; } var modelGenericArgs = modelType.GetGenericArguments(); var itemFactory = DependencyResolver.Current.GetService<IItemFactory>(); var method = itemFactory.GetType().GetMethods().FirstOrDefault(m => string.Equals(m.Name, "GetRenderingContextItems") && m.GetGenericArguments().Count().Equals(modelGenericArgs.Count())); var genericMethod = method?.MakeGenericMethod(modelGenericArgs); return genericMethod?.Invoke(itemFactory, new object[] { itemFactory }); } public override void Process(GetModelArgs args) { if (this.IsValidView(args) == false) { return; } args.Result = this.GetFromViewPath(args.Rendering, args); } protected virtual string GetViewPath(GetModelArgs args) { var rendering = args.Rendering; return rendering.Renderer is ViewRenderer ? ((ViewRenderer) rendering.Renderer).ViewPath : rendering.ToString().Replace("View: ", string.Empty); } protected virtual bool IsValidView(GetModelArgs args) { if (args == null) { return false; } if (Sitecore.Context.Site != null && Sitecore.Context.Site.Name.ToLowerInvariant() == "shell") { return false; } if (string.IsNullOrWhiteSpace(args.Rendering.RenderingItem.InnerItem[RenderingModelField]) == false) { return false; } return this.validTypes.Contains(args.Rendering.RenderingType); } } }
using System.Linq; using System.Web.Compilation; using System.Web.Mvc; using Fortis.Model; using Sitecore.Mvc.Pipelines.Response.GetModel; using Sitecore.Mvc.Presentation; namespace Fortis.Mvc.Pipelines.GetModel { using System.Web; using System.Web.Caching; public class GetFromView : GetModelProcessor { protected virtual object GetFromViewPath(Rendering rendering, GetModelArgs args) { var path = rendering.Renderer is ViewRenderer ? ((ViewRenderer)rendering.Renderer).ViewPath : rendering.ToString().Replace("View: ", string.Empty); if (string.IsNullOrWhiteSpace(path)) { return null; } // Retrieve the compiled view var compiledViewType = BuildManager.GetCompiledType(path); var baseType = compiledViewType.BaseType; // Check to see if the view has been found and that it is a generic type if (baseType == null || !baseType.IsGenericType) { return null; } var modelType = baseType.GetGenericArguments()[0]; // Check to see if no model has been set if (modelType == typeof(object)) { return null; } var modelGenericArgs = modelType.GetGenericArguments(); var itemFactory = DependencyResolver.Current.GetService<IItemFactory>(); var method = itemFactory.GetType().GetMethods().FirstOrDefault(m => string.Equals(m.Name, "GetRenderingContextItems") && m.GetGenericArguments().Count().Equals(modelGenericArgs.Count())); var genericMethod = method?.MakeGenericMethod(modelGenericArgs); return genericMethod?.Invoke(itemFactory, new object[] { itemFactory }); } public override void Process(GetModelArgs args) { if (args.Result == null) { args.Result = GetFromViewPath(args.Rendering, args); } } } }
mit
C#
e02d627f5818026cc048f3ece5e937100f2f8417
Add missing namespace from service registration
pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
src/Glimpse.Server.Web/GlimpseServerServices.cs
src/Glimpse.Server.Web/GlimpseServerServices.cs
using Glimpse.Agent; using Glimpse.Server; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using System.Collections.Generic; namespace Glimpse { public class GlimpseServerServices { public static IEnumerable<IServiceDescriptor> GetDefaultServices() { return GetDefaultServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Broker // yield return describe.Singleton<IMessageServerBus, DefaultMessageServerBus>(); } public static IEnumerable<IServiceDescriptor> GetPublisherServices() { return GetPublisherServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetPublisherServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Broker // yield return describe.Singleton<IMessagePublisher, LocalMessagePublisher>(); } } }
using Glimpse.Server; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using System.Collections.Generic; namespace Glimpse { public class GlimpseServerServices { public static IEnumerable<IServiceDescriptor> GetDefaultServices() { return GetDefaultServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Broker // yield return describe.Singleton<IMessageServerBus, DefaultMessageServerBus>(); } public static IEnumerable<IServiceDescriptor> GetPublisherServices() { return GetPublisherServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetPublisherServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Broker // yield return describe.Singleton<IMessagePublisher, LocalMessagePublisher>(); } } }
mit
C#
b1b5adec6e9101a15dcfc44372cf802cb0d4b7cf
Build fix #3
blattodephobia/BG_Composers,blattodephobia/BG_Composers
BGC.Web/Areas/Administration/Controllers/AccountController.cs
BGC.Web/Areas/Administration/Controllers/AccountController.cs
using BGC.Core; using BGC.Utilities; using BGC.Web.Areas.Administration.ViewModels; using BGC.Web.Areas.Administration.ViewModels.Permissions; using CodeShield; using Microsoft.AspNet.Identity; using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using static BGC.Core.BgcUserTokenProvider; namespace BGC.Web.Areas.Administration.Controllers { public partial class AccountController : AdministrationControllerBase { private TypeDiscoveryProvider typeDiscovery; public AccountController() { this.typeDiscovery = new TypeDiscoveryProvider(GetType(), a => a == Assembly.GetExecutingAssembly()); } public virtual ActionResult Activities() { var validActivities = (from viewModel in typeDiscovery.DiscoveredTypesInheritingFrom<PermissionViewModelBase>() from mapAttribute in viewModel.GetCustomAttributes<MappableWithAttribute>() join permission in User.GetPermissions() on mapAttribute.RelatedType equals permission.GetType() where viewModel.GetCustomAttribute<GeneratedCodeAttribute>() != null select Activator.CreateInstance(viewModel) as PermissionViewModelBase).ToList(); foreach (PermissionViewModelBase vm in validActivities.Where(activity => activity.ActivityAction != null)) { vm.ActivityUrl = Url.RouteUrl(vm.ActivityAction.GetRouteValueDictionary()); } return View(validActivities); } [AllowAnonymous] public virtual ActionResult ResetPassword(PasswordResetViewModel vm = null) { return View(vm); } [AllowAnonymous] [HttpPost] [ActionName(nameof(ResetPassword))] public virtual async Task<ActionResult> ResetPassword_Post(PasswordResetViewModel vm) { string token = await UserManager.UserTokenProvider.GenerateAsync(TokenPurposes.PasswordReset, UserManager, User); User.SetPasswordResetTokenHash(token); await UserManager.UpdateAsync(User); vm.TokenSent = true; return RedirectToAction(ResetPassword(vm)); } } }
using BGC.Core; using BGC.Utilities; using BGC.Web.Areas.Administration.ViewModels; using BGC.Web.Areas.Administration.ViewModels.Permissions; using CodeShield; using Microsoft.AspNet.Identity; using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using static BGC.Core.BgcUserTokenProvider; namespace BGC.Web.Areas.Administration.Controllers { public partial class AccountController : AdministrationControllerBase { private TypeDiscoveryProvider typeDiscovery; public AccountController() { this.typeDiscovery = new TypeDiscoveryProvider(GetType(), a => a == Assembly.GetExecutingAssembly()); } public virtual ActionResult Activities() { var validActivities = (from viewModel in typeDiscovery.DiscoveredTypesInheritingFrom<PermissionViewModelBase>() from mapAttribute in viewModel.GetCustomAttributes<MappableWithAttribute>() join permission in User.GetPermissions() on mapAttribute.RelatedType equals permission.GetType() where viewModel.GetCustomAttribute<GeneratedCodeAttribute>() != null select Activator.CreateInstance(viewModel) as PermissionViewModelBase).ToList(); foreach (PermissionViewModelBase vm in validActivities.Where(activity => activity.ActivityAction != null)) { vm.ActivityUrl = Url.RouteUrl(vm.ActivityAction.GetRouteValueDictionary()); } return View(validActivities); } [AllowAnonymous] public virtual ActionResult ResetPassword(PasswordResetViewModel vm = null) { return View(vm); } [AllowAnonymous] [HttpPost] [ActionName(nameof(ResetPassword))] public virtual async Task<ActionResult> ResetPassword_Post(PasswordResetViewModel vm) { string token = await UserManager.UserTokenProvider.GenerateAsync(TokenPurposes.PasswordReset, UserManager, User); User.SetPasswordResetTokenHash(token); await UserManager.UpdateAsync(User); return RedirectToAction(MVC.AdministrationArea.Authentication.Login(new LoginViewModel() { IsRedirectFromPasswordReset = true })); } } }
mit
C#
0db0433e29385ebec4afea35042ec512d33922d1
remove obsolete braces
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Data/W3d/W3dVertexInfluence.cs
src/OpenSage.Game/Data/W3d/W3dVertexInfluence.cs
using System.IO; using System.Runtime.InteropServices; namespace OpenSage.Data.W3d { /// <summary> /// Vertex Influences. For "skins" each vertex can be associated with a different bone. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct W3dVertexInfluence { public ushort BoneIndex; public ushort Bone2Index; public ushort BoneWeight; public ushort Bone2Weight; internal static W3dVertexInfluence Parse(BinaryReader reader) { var result = new W3dVertexInfluence { BoneIndex = reader.ReadUInt16(), Bone2Index = reader.ReadUInt16(), BoneWeight = reader.ReadUInt16(), Bone2Weight = reader.ReadUInt16() }; return result; } internal void WriteTo(BinaryWriter writer) { writer.Write(BoneIndex); writer.Write(Bone2Index); writer.Write(BoneWeight); writer.Write(Bone2Weight); } } }
using System.IO; using System.Runtime.InteropServices; namespace OpenSage.Data.W3d { /// <summary> /// Vertex Influences. For "skins" each vertex can be associated with a different bone. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct W3dVertexInfluence { public ushort BoneIndex; public ushort Bone2Index; public ushort BoneWeight; public ushort Bone2Weight; internal static W3dVertexInfluence Parse(BinaryReader reader) { var result = new W3dVertexInfluence { BoneIndex = reader.ReadUInt16(), Bone2Index = reader.ReadUInt16(), BoneWeight = (reader.ReadUInt16()), Bone2Weight = (reader.ReadUInt16()) }; return result; } internal void WriteTo(BinaryWriter writer) { writer.Write(BoneIndex); writer.Write(Bone2Index); writer.Write(BoneWeight); writer.Write(Bone2Weight); } } }
mit
C#
417da2b36a0b91cbf28b3eaaca5168be27133bcf
add homework link at home/index
hatelove/MyMvcHomework,hatelove/MyMvcHomework,hatelove/MyMvcHomework
MyMoney/MyMoney/Views/Home/Index.cshtml
MyMoney/MyMoney/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; Layout = "~/Views/Shared/_Layout.cshtml"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Day2 homework</h2> <p> 實際透過DB來存取記帳本資料 </p> <p> @Html.ActionLink("記帳本由此去", "Add", "Accounting") </p> </div> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div>
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div>
mit
C#
a152c1c969890c2479e7abda80410fca1e43f7e7
Make ExistingProject test run iff it can
ermshiperete/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge
src/LfMerge.Core.Tests/LanguageDepotProjectTests.cs
src/LfMerge.Core.Tests/LanguageDepotProjectTests.cs
// Copyright (c) 2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Linq; using System.Net.NetworkInformation; using NUnit.Framework; namespace LfMerge.Core.Tests { [TestFixture] public class LanguageDepotProjectTests { private TestEnvironment _env; [TestFixtureSetUp] public void FixtureSetup() { _env = new TestEnvironment(); var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); var uri = new Uri("mongodb://" + _env.Settings.MongoDbHostNameAndPort); if (ipGlobalProperties.GetActiveTcpListeners().Count(t => t.Port == uri.Port) == 0) { Assert.Ignore("Ignoring tests because MongoDB doesn't seem to be running on {0}.", _env.Settings.MongoDbHostNameAndPort); } } [TestFixtureTearDown] public void FixtureTearDown() { _env.Dispose(); } [Test] public void ExistingProject() { // relies on a project being manually added to MongoDB with projectCode "proja" // To make this stop being ignored, run the following command in the "scriptureforge" database of your local MongoDB: // db.projects.insert({projectCode: "proja", projectName: "ZZZ Project A for unit tests", sendReceiveProjectIdentifier: "proja-langdepot", sendReceiveProject: {name: "Fake project for unit tests", repository: "http://public.example.com", role: "manager"} }) // Setup var sut = new LanguageDepotProject(_env.Settings, _env.Logger); // Exercise try { sut.Initialize("proja"); } catch (ArgumentException e) { if (e.Message.StartsWith("Can't find project code")) Assert.Ignore("Can't run this test until a project named \"proja\" exists in local MongoDB"); else throw; } // Verify Assert.That(sut.Identifier, Is.EqualTo("proja-langdepot")); Assert.That(sut.Repository, Contains.Substring("public")); } [Test] public void NonexistingProject() { // Setup var sut = new LanguageDepotProject(_env.Settings, _env.Logger); // Exercise/Verify Assert.That(() => sut.Initialize("nonexisting"), Throws.ArgumentException); } } }
// Copyright (c) 2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Linq; using System.Net.NetworkInformation; using NUnit.Framework; namespace LfMerge.Core.Tests { [TestFixture] public class LanguageDepotProjectTests { private TestEnvironment _env; [TestFixtureSetUp] public void FixtureSetup() { _env = new TestEnvironment(); var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); var uri = new Uri("mongodb://" + _env.Settings.MongoDbHostNameAndPort); if (ipGlobalProperties.GetActiveTcpListeners().Count(t => t.Port == uri.Port) == 0) { Assert.Ignore("Ignoring tests because MongoDB doesn't seem to be running on {0}.", _env.Settings.MongoDbHostNameAndPort); } } [TestFixtureTearDown] public void FixtureTearDown() { _env.Dispose(); } [Test] [Ignore("Currently we don't have the required fields in mongodb")] public void ExistingProject() { // relies on a project being manually added to MongoDB with projectCode "proja" // Setup var sut = new LanguageDepotProject(_env.Settings, _env.Logger); // Exercise sut.Initialize("proja"); // Verify Assert.That(sut.Identifier, Is.EqualTo("proja-langdepot")); Assert.That(sut.Repository, Contains.Substring("public")); } [Test] public void NonexistingProject() { // Setup var sut = new LanguageDepotProject(_env.Settings, _env.Logger); // Exercise/Verify Assert.That(() => sut.Initialize("nonexisting"), Throws.ArgumentException); } } }
mit
C#
5859fc6535c317d2ed10d91872e2d0b51eff0861
Bump assembly version to 4.0.323.
rubyu/CreviceApp,rubyu/CreviceApp
CreviceApp/Properties/AssemblyInfo.cs
CreviceApp/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Crevice4")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Crevice4")] [assembly: AssemblyCopyright("Copyright @rubyu")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("82b56652-6380-44ed-a193-742f7eef290f")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("4.0.323.0")] [assembly: AssemblyFileVersion("4.0.323.0")] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("Crevice4Tests")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Crevice4")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Crevice4")] [assembly: AssemblyCopyright("Copyright @rubyu")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("82b56652-6380-44ed-a193-742f7eef290f")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("4.0.321.0")] [assembly: AssemblyFileVersion("4.0.321.0")] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("Crevice4Tests")]
mit
C#
292561cc5ef7deeecc1f0513db4ed591bda8ac8c
Update version, release notes and minimal api version.
maraf/Money,maraf/Money,maraf/Money
src/Money.Blazor.Host/Services/ApiVersionChecker.cs
src/Money.Blazor.Host/Services/ApiVersionChecker.cs
using Money.Events; using Money.Queries; using Neptuo; using Neptuo.Events; using Neptuo.Queries; using Neptuo.Queries.Handlers; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Money.Services { public class ApiVersionChecker : HttpQueryDispatcher.IMiddleware { private readonly Version minVersion = new Version(1, 7, 0, 0); private readonly Version maxVersion = new Version(2, 0, 0, 0); private readonly IEventDispatcher events; private Version last; public ApiVersionChecker(IEventDispatcher events) { Neptuo.Ensure.NotNull(events, "events"); this.events = events; } public bool IsPassed(Version version) { if (version != last) events.PublishAsync(new ApiVersionChanged(last = version)); return version >= minVersion && version < maxVersion; } public void Ensure(Version version) { if (!IsPassed(version)) throw new NotSupportedApiVersionException(version); } Task<object> HttpQueryDispatcher.IMiddleware.ExecuteAsync(object query, HttpQueryDispatcher dispatcher, HttpQueryDispatcher.Next next) { if (query is FindApiVersion) return Task.FromResult<object>(last); return next(query); } } }
using Money.Events; using Money.Queries; using Neptuo; using Neptuo.Events; using Neptuo.Queries; using Neptuo.Queries.Handlers; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Money.Services { public class ApiVersionChecker : HttpQueryDispatcher.IMiddleware { private readonly Version minVersion = new Version(1, 4, 0, 0); private readonly Version maxVersion = new Version(2, 0, 0, 0); private readonly IEventDispatcher events; private Version last; public ApiVersionChecker(IEventDispatcher events) { Neptuo.Ensure.NotNull(events, "events"); this.events = events; } public bool IsPassed(Version version) { if (version != last) events.PublishAsync(new ApiVersionChanged(last = version)); return version >= minVersion && version < maxVersion; } public void Ensure(Version version) { if (!IsPassed(version)) throw new NotSupportedApiVersionException(version); } Task<object> HttpQueryDispatcher.IMiddleware.ExecuteAsync(object query, HttpQueryDispatcher dispatcher, HttpQueryDispatcher.Next next) { if (query is FindApiVersion) return Task.FromResult<object>(last); return next(query); } } }
apache-2.0
C#
6f0618623a322e5985245dd404b945314d7b7c85
add debugger display for TankObject and derivatives
smellyriver/tank-inspector-pro,smellyriver/tank-inspector-pro,smellyriver/tank-inspector-pro
src/Smellyriver.TankInspector.Core/TankInspector.Pro/Data/Entities/TankObject.cs
src/Smellyriver.TankInspector.Core/TankInspector.Pro/Data/Entities/TankObject.cs
using System; using System.Diagnostics; namespace Smellyriver.TankInspector.Pro.Data.Entities { [DebuggerDisplay("{Name} ({ElementName})")] public abstract class TankObject : XQueryableWrapper, IEquatable<TankObject> { public string Key { get { return this["@key"]; } } public string ElementName { get { return base.Name; } } public new string Name { get { return this["userString"]; } } public int Price { get { return this.QueryInt("price"); } } public Currency Currency { get { return this["price/@currency"] == "gold" ? Currency.Gold : Currency.Credit; } } protected TankObject(IXQueryable data) : base(data) { } public bool Equals(TankObject other) { if (other == null) return false; return this.GetType() == other.GetType() && this.Key == other.Key; } public override bool Equals(object obj) { if (obj is TankObject) return this.Equals((TankObject)obj); return false; } public override int GetHashCode() { return (this.GetType().GetHashCode() << 16) + this.Key.GetHashCode(); } } }
using System; namespace Smellyriver.TankInspector.Pro.Data.Entities { public abstract class TankObject : XQueryableWrapper, IEquatable<TankObject> { public string Key { get { return this["@key"]; } } public string ElementName { get { return base.Name; } } public new string Name { get { return this["userString"]; } } public int Price { get { return this.QueryInt("price"); } } public Currency Currency { get { return this["price/@currency"] == "gold" ? Currency.Gold : Currency.Credit; } } protected TankObject(IXQueryable data) : base(data) { } public bool Equals(TankObject other) { if (other == null) return false; return this.GetType() == other.GetType() && this.Key == other.Key; } public override bool Equals(object obj) { if (obj is TankObject) return this.Equals((TankObject)obj); return false; } public override int GetHashCode() { return (this.GetType().GetHashCode() << 16) + this.Key.GetHashCode(); } } }
mit
C#
ad9cf5bcd30c3aa2bccd2a6ac78e8e927d1717cf
Fix a typo (#18135)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Features/JsonPatch/src/Helpers/GetValueResult.cs
src/Features/JsonPatch/src/Helpers/GetValueResult.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.JsonPatch.Helpers { /// <summary> /// Return value for the helper method used by Copy/Move. Needed to ensure we can make a different /// decision in the calling method when the value is null because it cannot be fetched (HasError = true) /// versus when it actually is null (much like why RemovedPropertyTypeResult is used for returning /// type in the Remove operation). /// </summary> public class GetValueResult { public GetValueResult(object propertyValue, bool hasError) { PropertyValue = propertyValue; HasError = hasError; } /// <summary> /// The value of the property we're trying to get /// </summary> public object PropertyValue { get; private set; } /// <summary> /// HasError: true when an error occurred, the operation didn't complete successfully /// </summary> public bool HasError { get; private set; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.JsonPatch.Helpers { /// <summary> /// Return value for the helper method used by Copy/Move. Needed to ensure we can make a different /// decision in the calling method when the value is null because it cannot be fetched (HasError = true) /// versus when it actually is null (much like why RemovedPropertyTypeResult is used for returning /// type in the Remove operation). /// </summary> public class GetValueResult { public GetValueResult(object propertyValue, bool hasError) { PropertyValue = propertyValue; HasError = hasError; } /// <summary> /// The value of the property we're trying to get /// </summary> public object PropertyValue { get; private set; } /// <summary> /// HasError: true when an error occurred, the operation didn't complete succesfully /// </summary> public bool HasError { get; private set; } } }
apache-2.0
C#
64e0519ad2fa60d3d380d101cd50e9b178716eed
Update GameManager.cs
afroraydude/First_Unity_Game,afroraydude/First_Unity_Game,afroraydude/First_Unity_Game
Real_Game/Assets/Scripts/GameManager.cs
Real_Game/Assets/Scripts/GameManager.cs
using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { // Score based stuff public float highScore = 0f; //Level based stuff public int currentLevel = 0; public int unlockedLevel; // Things that deal with GUI or whatever public Rect stopwatchRect; public Rect stopwatchBoxRect; public Rect highScoreRect; public Rect highScoreBox; public GUISkin skin; // Stuff that deals with the ingame stopwatch, which is my answer to the score system. public float startTime; private string currentTime; public string highTime; // Once the level loads this happens void Start() { //DontDestroyOnLoad(gameObject); if (PlayerPrefs.GetInt("LevelsCompleted") > 0) { currentLevel = PlayerPrefs.GetInt("LevelsCompleted"); } else { currentLevel = 0; } } // This is ran every tick void Update() { //This records the time it took to complete the level startTime += Time.deltaTime; //This puts it into a string so that it can be viewed on the GUI currentTime = string.Format ("{0:0.0}", startTime); } // GUI goes here void OnGUI() { GUI.skin = skin; GUI.Box (stopwatchBoxRect, ""); GUI.Label(stopwatchRect, currentTime, skin.GetStyle ("Stopwatch")); GUI.Label (highScoreRect, PlayerPrefs.GetString("Level" + currentLevel.ToString() + "Score")); GUI.Box (highScoreBox, ""); } /** * Alternative to the Maine Menu having to save information */ void MainMenuToLevelOne() { currentLevel +=1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } void BackToMainMenu() { currentLevel -=1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } // For when the player completes a level // TODO: Fix issue in flash were it does not care if the high score is > or < the startTime, it always overrides it. void CompleteLevel() { if(highScore > startTime || highScore == 0) { highScore = startTime; highTime = string.Format ("{0:0.0}", highScore); PlayerPrefs.SetString("Level" + currentLevel.ToString() + "Score", highTime); } if (currentLevel < 6) { currentLevel +=1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.GetInt("LevelsCompleted"); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } else { print ("Please increase level amount."); } } void AfterGrading() { } }
using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { // Score based stuff public float highScore = 0f; //Level based stuff public int currentLevel = 0; public int unlockedLevel; // Things that deal with GUI or whatever public Rect stopwatchRect; public Rect stopwatchBoxRect; public Rect highScoreRect; public Rect highScoreBox; public GUISkin skin; // Stuff that deals with the ingame stopwatch, which is my answer to the score system. public float startTime; private string currentTime; public string highTime; // Once the level loads this happens void Start() { //DontDestroyOnLoad(gameObject); if (PlayerPrefs.GetInt("LevelsCompleted") > 0) { currentLevel = PlayerPrefs.GetInt("LevelsCompleted"); } else { currentLevel = 0; } } // This is ran every tick void Update() { //This records the time it took to complete the level startTime += Time.deltaTime; //This puts it into a string so that it can be viewed on the GUI currentTime = string.Format ("{0:0.0}", startTime); } // GUI goes here void OnGUI() { GUI.skin = skin; GUI.Box (stopwatchBoxRect, ""); GUI.Label(stopwatchRect, currentTime, skin.GetStyle ("Stopwatch")); GUI.Label (highScoreRect, PlayerPrefs.GetString("Level" + currentLevel.ToString() + "Score")); GUI.Box (highScoreBox, ""); } /** * Alternative to the Maine Menu having to save information */ public void MainMenuToLevelOne() { currentLevel +=1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } public void BackToMainMenu() { currentLevel -=1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } // For when the player completes a level // TODO: Fix issue in flash were it does not care if the high score is > or < the startTime, it always overrides it. public void CompleteLevel() { if(highScore > startTime || highScore == 0) { highScore = startTime; highTime = string.Format ("{0:0.0}", highScore); PlayerPrefs.SetString("Level" + currentLevel.ToString() + "Score", highTime); } if (currentLevel < 5) { currentLevel +=1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.GetInt("LevelsCompleted"); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } else { print ("Please increase level amount."); } } }
mit
C#
224d86920e7d78cead1bedc64ca06688fec3fc76
Fix indentation; add braces around single-line if.
MetSystem/Nancy,nicklv/Nancy,blairconrad/Nancy,lijunle/Nancy,SaveTrees/Nancy,JoeStead/Nancy,phillip-haydon/Nancy,ccellar/Nancy,felipeleusin/Nancy,jchannon/Nancy,albertjan/Nancy,malikdiarra/Nancy,tareq-s/Nancy,thecodejunkie/Nancy,AlexPuiu/Nancy,ccellar/Nancy,danbarua/Nancy,joebuschmann/Nancy,davidallyoung/Nancy,jongleur1983/Nancy,jchannon/Nancy,hitesh97/Nancy,phillip-haydon/Nancy,rudygt/Nancy,sadiqhirani/Nancy,AcklenAvenue/Nancy,hitesh97/Nancy,kekekeks/Nancy,MetSystem/Nancy,EIrwin/Nancy,murador/Nancy,sloncho/Nancy,cgourlay/Nancy,fly19890211/Nancy,malikdiarra/Nancy,Worthaboutapig/Nancy,grumpydev/Nancy,sroylance/Nancy,jonathanfoster/Nancy,khellang/Nancy,nicklv/Nancy,horsdal/Nancy,SaveTrees/Nancy,phillip-haydon/Nancy,VQComms/Nancy,NancyFx/Nancy,thecodejunkie/Nancy,asbjornu/Nancy,duszekmestre/Nancy,dbabox/Nancy,sadiqhirani/Nancy,Worthaboutapig/Nancy,dbolkensteyn/Nancy,asbjornu/Nancy,AIexandr/Nancy,Worthaboutapig/Nancy,horsdal/Nancy,charleypeng/Nancy,tsdl2013/Nancy,lijunle/Nancy,davidallyoung/Nancy,davidallyoung/Nancy,sroylance/Nancy,tparnell8/Nancy,JoeStead/Nancy,ccellar/Nancy,blairconrad/Nancy,xt0rted/Nancy,duszekmestre/Nancy,jmptrader/Nancy,AcklenAvenue/Nancy,vladlopes/Nancy,sroylance/Nancy,ayoung/Nancy,phillip-haydon/Nancy,dbabox/Nancy,MetSystem/Nancy,fly19890211/Nancy,tsdl2013/Nancy,jmptrader/Nancy,malikdiarra/Nancy,danbarua/Nancy,guodf/Nancy,VQComms/Nancy,Novakov/Nancy,charleypeng/Nancy,Crisfole/Nancy,fly19890211/Nancy,VQComms/Nancy,AIexandr/Nancy,AcklenAvenue/Nancy,tareq-s/Nancy,khellang/Nancy,NancyFx/Nancy,thecodejunkie/Nancy,daniellor/Nancy,xt0rted/Nancy,EliotJones/NancyTest,AlexPuiu/Nancy,ayoung/Nancy,tsdl2013/Nancy,horsdal/Nancy,JoeStead/Nancy,murador/Nancy,adamhathcock/Nancy,danbarua/Nancy,blairconrad/Nancy,asbjornu/Nancy,charleypeng/Nancy,kekekeks/Nancy,murador/Nancy,dbolkensteyn/Nancy,guodf/Nancy,thecodejunkie/Nancy,Novakov/Nancy,jchannon/Nancy,adamhathcock/Nancy,Novakov/Nancy,Novakov/Nancy,ccellar/Nancy,ayoung/Nancy,jeff-pang/Nancy,NancyFx/Nancy,EliotJones/NancyTest,charleypeng/Nancy,khellang/Nancy,jchannon/Nancy,rudygt/Nancy,tsdl2013/Nancy,cgourlay/Nancy,xt0rted/Nancy,Worthaboutapig/Nancy,MetSystem/Nancy,sloncho/Nancy,jeff-pang/Nancy,anton-gogolev/Nancy,grumpydev/Nancy,asbjornu/Nancy,anton-gogolev/Nancy,albertjan/Nancy,Crisfole/Nancy,Crisfole/Nancy,vladlopes/Nancy,grumpydev/Nancy,joebuschmann/Nancy,tparnell8/Nancy,cgourlay/Nancy,lijunle/Nancy,nicklv/Nancy,sadiqhirani/Nancy,wtilton/Nancy,felipeleusin/Nancy,dbabox/Nancy,anton-gogolev/Nancy,charleypeng/Nancy,xt0rted/Nancy,duszekmestre/Nancy,AlexPuiu/Nancy,adamhathcock/Nancy,anton-gogolev/Nancy,cgourlay/Nancy,vladlopes/Nancy,jonathanfoster/Nancy,albertjan/Nancy,jeff-pang/Nancy,davidallyoung/Nancy,blairconrad/Nancy,rudygt/Nancy,wtilton/Nancy,AcklenAvenue/Nancy,wtilton/Nancy,EIrwin/Nancy,damianh/Nancy,jeff-pang/Nancy,NancyFx/Nancy,albertjan/Nancy,asbjornu/Nancy,hitesh97/Nancy,tareq-s/Nancy,AlexPuiu/Nancy,damianh/Nancy,lijunle/Nancy,joebuschmann/Nancy,daniellor/Nancy,tareq-s/Nancy,kekekeks/Nancy,adamhathcock/Nancy,grumpydev/Nancy,wtilton/Nancy,EIrwin/Nancy,danbarua/Nancy,vladlopes/Nancy,joebuschmann/Nancy,horsdal/Nancy,jongleur1983/Nancy,jonathanfoster/Nancy,sloncho/Nancy,khellang/Nancy,SaveTrees/Nancy,fly19890211/Nancy,rudygt/Nancy,sroylance/Nancy,sloncho/Nancy,ayoung/Nancy,jonathanfoster/Nancy,sadiqhirani/Nancy,hitesh97/Nancy,jmptrader/Nancy,guodf/Nancy,dbabox/Nancy,tparnell8/Nancy,tparnell8/Nancy,AIexandr/Nancy,jongleur1983/Nancy,EliotJones/NancyTest,nicklv/Nancy,EliotJones/NancyTest,felipeleusin/Nancy,daniellor/Nancy,felipeleusin/Nancy,jchannon/Nancy,murador/Nancy,JoeStead/Nancy,EIrwin/Nancy,VQComms/Nancy,SaveTrees/Nancy,VQComms/Nancy,AIexandr/Nancy,duszekmestre/Nancy,jongleur1983/Nancy,daniellor/Nancy,davidallyoung/Nancy,jmptrader/Nancy,dbolkensteyn/Nancy,damianh/Nancy,malikdiarra/Nancy,dbolkensteyn/Nancy,AIexandr/Nancy,guodf/Nancy
src/Nancy.Demo.Authentication.Basic/UserValidator.cs
src/Nancy.Demo.Authentication.Basic/UserValidator.cs
namespace Nancy.Demo.Authentication.Basic { using Nancy.Authentication.Basic; using Nancy.Security; public class UserValidator : IUserValidator { public IUserIdentity Validate(string username, string password) { if (username == "demo" && password == "demo") { return new DemoUserIdentity { UserName = username }; } // Not recognised => anonymous. return null; } } }
namespace Nancy.Demo.Authentication.Basic { using Nancy.Authentication.Basic; using Nancy.Security; public class UserValidator : IUserValidator { public IUserIdentity Validate(string username, string password) { if (username == "demo" && password == "demo") return new DemoUserIdentity { UserName = username }; // Not recognised => anonymous. return null; } } }
mit
C#
97e7ec326a6dc5969d2c84e9d957b57bfd277531
Update Program.cs
brentstineman/ServiceFabricPubSub,mcollier/ServiceFabricPubSub,digimaun/ServiceFabricPubSub,flyingoverclouds/ServiceFabricPubSub
src/ServiceFabricPubSub/SubscriberService/Program.cs
src/ServiceFabricPubSub/SubscriberService/Program.cs
using Microsoft.ServiceFabric.Services.Runtime; using System; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; namespace SubscriberService { internal static class Program { /// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { // The ServiceManifest.XML file defines one or more service type names. // Registering a service maps a service type name to a .NET type. // When Service Fabric creates an instance of this service type, // an instance of the class is created in this host process. ServiceRuntime.RegisterServiceAsync("SubscriberServiceType", context => new SubscriberService(context)).GetAwaiter().GetResult(); ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(SubscriberService).Name); // Prevents this host process from terminating so services keeps running. Thread.Sleep(Timeout.Infinite); } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); throw; } } } }
using Microsoft.ServiceFabric.Services.Runtime; using System; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; namespace SubscriberService { internal static class Program { /// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { // The ServiceManifest.XML file defines one or more service type names. // Registering a service maps a service type name to a .NET type. // When Service Fabric creates an instance of this service type, // an instance of the class is created in this host process. ServiceRuntime.RegisterServiceAsync("SubscriberService2Type", context => new SubscriberService(context)).GetAwaiter().GetResult(); ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(SubscriberService).Name); // Prevents this host process from terminating so services keeps running. Thread.Sleep(Timeout.Infinite); } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); throw; } } } }
mit
C#
38f66234324e8cc8b1358c4cc94b12df6b1571ca
Modify the signature of Parser<TToken, TResult>, make TOutput covariance
linerlock/parseq
Parseq/Parser.cs
Parseq/Parser.cs
/* * Parseq - a monadic parser combinator library for C# * * Copyright (c) 2012 - 2013 WATANABE TAKAHISA <[email protected]> All rights reserved. * * 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 Parseq { public delegate IReply<TToken, TResult> Parser<TToken, out TResult>(IStream<TToken> stream); }
/* * Parseq - a monadic parser combinator library for C# * * Copyright (c) 2012 - 2013 WATANABE TAKAHISA <[email protected]> All rights reserved. * * 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 Parseq { public delegate Reply<TToken,TResult> Parser<TToken,TResult>(IStream<TToken> stream); }
mit
C#
9a8b378d8ec88179904a597020e023aa4eaa2558
Update SteamLoginPatch.cs
TorchAPI/Torch
Torch.Server/Patches/SteamLoginPatch.cs
Torch.Server/Patches/SteamLoginPatch.cs
using System.Reflection; using NLog; using Steamworks; using Torch.Managers.PatchManager; using Torch.Utils; namespace Torch.Patches { [PatchShim] public static class SteamLoginPatch { private static readonly ILogger Log = LogManager.GetCurrentClassLogger(); #pragma warning disable CS0649 [ReflectedMethodInfo(null, "LogOnAnonymous", TypeName = "VRage.Steam.MySteamGameServer, VRage.Steam")] private static readonly MethodInfo LoginMethod; [ReflectedMethodInfo(typeof(SteamLoginPatch), nameof(Prefix))] private static readonly MethodInfo PrefixMethod; #pragma warning restore CS0649 public static void Patch(PatchContext context) { context.GetPattern(LoginMethod).Prefixes.Add(PrefixMethod); } private static bool Prefix() { #pragma warning disable CS0618 var token = TorchBase.Instance.Config.LoginToken; #pragma warning restore CS0618 if (string.IsNullOrEmpty(token)) return true; Log.Info("Logging in to Steam with GSLT"); SteamGameServer.LogOn(token); return false; } } }
using System.Reflection; using NLog; using Steamworks; using Torch.Managers.PatchManager; using Torch.Utils; namespace Torch.Patches { [PatchShim] public static class SteamLoginPatch { private static readonly ILogger Log = LogManager.GetCurrentClassLogger(); #pragma warning disable CS0649 [ReflectedMethodInfo(null, "LogOnAnonymous", TypeName = "VRage.Steam.MySteamGameServer, VRage.Steam")] private static readonly MethodInfo LoginMethod; [ReflectedMethodInfo(typeof(SteamLoginPatch), nameof(Prefix))] private static readonly MethodInfo PrefixMethod; #pragma warning restore CS0649 public static void Patch(PatchContext context) { Log.Info("Disabled temp"); return; context.GetPattern(LoginMethod).Prefixes.Add(PrefixMethod); } private static bool Prefix() { #pragma warning disable CS0618 var token = TorchBase.Instance.Config.LoginToken; #pragma warning restore CS0618 if (string.IsNullOrEmpty(token)) return true; Log.Info("Logging in to Steam with GSLT"); SteamGameServer.LogOn(token); return false; } } }
apache-2.0
C#
12cf30459808c0a9ab04043693d87b6cd21d5505
Update ModDaycore icon
peppy/osu-new,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,2yangk23/osu,UselessToucan/osu,ppy/osu,EVAST9919/osu,peppy/osu,EVAST9919/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,2yangk23/osu
osu.Game/Rulesets/Mods/ModDaycore.cs
osu.Game/Rulesets/Mods/ModDaycore.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; namespace osu.Game.Rulesets.Mods { public abstract class ModDaycore : ModHalfTime { public override string Name => "Daycore"; public override string Acronym => "DC"; public override IconUsage? Icon => null; public override string Description => "Whoaaaaa..."; private readonly BindableNumber<double> tempoAdjust = new BindableDouble(1); private readonly BindableNumber<double> freqAdjust = new BindableDouble(1); protected ModDaycore() { SpeedChange.BindValueChanged(val => { freqAdjust.Value = SpeedChange.Default; tempoAdjust.Value = val.NewValue / SpeedChange.Default; }, true); } public override void ApplyToTrack(Track track) { // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied) track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust); track.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; namespace osu.Game.Rulesets.Mods { public abstract class ModDaycore : ModHalfTime { public override string Name => "Daycore"; public override string Acronym => "DC"; public override IconUsage? Icon => FontAwesome.Solid.Question; public override string Description => "Whoaaaaa..."; private readonly BindableNumber<double> tempoAdjust = new BindableDouble(1); private readonly BindableNumber<double> freqAdjust = new BindableDouble(1); protected ModDaycore() { SpeedChange.BindValueChanged(val => { freqAdjust.Value = SpeedChange.Default; tempoAdjust.Value = val.NewValue / SpeedChange.Default; }, true); } public override void ApplyToTrack(Track track) { // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied) track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust); track.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust); } } }
mit
C#
87d77b07ed246662bb54457431e754385cd9a101
Use temporary redirect to swagger
RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates
Source/Content/ApiTemplate/Controllers/HomeController.cs
Source/Content/ApiTemplate/Controllers/HomeController.cs
namespace ApiTemplate.Controllers { using ApiTemplate.Constants; using Microsoft.AspNetCore.Mvc; [Route("")] [ApiExplorerSettings(IgnoreApi = true)] public class HomeController : ControllerBase { /// <summary> /// Redirects to the swagger page. /// </summary> /// <returns>A 301 Moved Permanently response.</returns> [HttpGet("", Name = HomeControllerRoute.GetIndex)] public IActionResult Index() => this.Redirect("/swagger"); } }
namespace ApiTemplate.Controllers { using ApiTemplate.Constants; using Microsoft.AspNetCore.Mvc; [Route("")] [ApiExplorerSettings(IgnoreApi = true)] public class HomeController : ControllerBase { /// <summary> /// Redirects to the swagger page. /// </summary> /// <returns>A 301 Moved Permanently response.</returns> [HttpGet("", Name = HomeControllerRoute.GetIndex)] public IActionResult Index() => this.RedirectPermanent("/swagger"); } }
mit
C#
8abb6c09c71656982d28530c686ee8b896f3870e
remove OverrideIsNamespaceAllowed
signumsoftware/framework,signumsoftware/extensions,signumsoftware/extensions,AlejandroCano/extensions,signumsoftware/framework,MehdyKarimpour/extensions,AlejandroCano/extensions,MehdyKarimpour/extensions
Signum.React.Extensions/UserQueries/UserQueryServer.cs
Signum.React.Extensions/UserQueries/UserQueryServer.cs
using Signum.React.Json; using Signum.Utilities; using System.Linq; using System.Reflection; using Signum.Entities.UserQueries; using Signum.Engine.Basics; using Signum.React.UserAssets; using Signum.React.Facades; using Signum.Engine.UserQueries; using Signum.Engine.Authorization; using Microsoft.AspNetCore.Builder; using Signum.Entities.Authorization; using Signum.Entities.DynamicQuery; namespace Signum.React.UserQueries { public static class UserQueryServer { public static void Start(IApplicationBuilder app) { UserAssetServer.Start(app); SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); EntityJsonConverter.AfterDeserilization.Register((UserQueryEntity uq) => { if (uq.Query != null) { var qd = QueryLogic.Queries.QueryDescription(uq.Query.ToQueryName()); uq.ParseData(qd); } }); EntityPackTS.AddExtension += ep => { if (ep.entity.IsNew || !UserQueryPermission.ViewUserQuery.IsAuthorized()) return; var userQueries = UserQueryLogic.GetUserQueriesEntity(ep.entity.GetType()); if (userQueries.Any()) ep.extension.Add("userQueries", userQueries); }; } } }
using Signum.React.Json; using Signum.Utilities; using System.Linq; using System.Reflection; using Signum.Entities.UserQueries; using Signum.Engine.Basics; using Signum.React.UserAssets; using Signum.React.Facades; using Signum.Engine.UserQueries; using Signum.Engine.Authorization; using Microsoft.AspNetCore.Builder; using Signum.Entities.Authorization; using Signum.Entities.DynamicQuery; namespace Signum.React.UserQueries { public static class UserQueryServer { public static void Start(IApplicationBuilder app) { UserAssetServer.Start(app); ReflectionServer.OverrideIsNamespaceAllowed.Add(typeof(ColumnOptionsMode).Namespace!, () => TypeAuthLogic.GetAllowed(typeof(UserQueryEntity)).MaxUI() > TypeAllowedBasic.None); SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); EntityJsonConverter.AfterDeserilization.Register((UserQueryEntity uq) => { if (uq.Query != null) { var qd = QueryLogic.Queries.QueryDescription(uq.Query.ToQueryName()); uq.ParseData(qd); } }); EntityPackTS.AddExtension += ep => { if (ep.entity.IsNew || !UserQueryPermission.ViewUserQuery.IsAuthorized()) return; var userQueries = UserQueryLogic.GetUserQueriesEntity(ep.entity.GetType()); if (userQueries.Any()) ep.extension.Add("userQueries", userQueries); }; } } }
mit
C#
7421f95d0e46f099bb5462f74c1d55e31bc6d47f
Fix build
sboulema/CodeNav,sboulema/CodeNav
CodeNav.Shared/CodeViewUserControlTop.xaml.cs
CodeNav.Shared/CodeViewUserControlTop.xaml.cs
using System.Collections.Generic; using System.Threading.Tasks; using System.Windows.Controls; using CodeNav.Helpers; using CodeNav.Models; using Microsoft.VisualStudio.PlatformUI; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Text.Outlining; using Task = System.Threading.Tasks.Task; namespace CodeNav { public partial class CodeViewUserControlTop : ICodeViewUserControl { private readonly RowDefinition _row; public CodeDocumentViewModel CodeDocumentViewModel { get; set; } public CodeViewUserControlTop(RowDefinition row = null) { InitializeComponent(); // Setup viewmodel as datacontext CodeDocumentViewModel = new CodeDocumentViewModel(); DataContext = CodeDocumentViewModel; _row = row; VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged; } private void VSColorTheme_ThemeChanged(ThemeChangedEventArgs e) => UpdateDocument(); public void FilterBookmarks() => VisibilityHelper.SetCodeItemVisibility(CodeDocumentViewModel); public void RegionsCollapsed(RegionsCollapsedEventArgs e) => OutliningHelper.RegionsCollapsed(e, CodeDocumentViewModel.CodeDocument); public void RegionsExpanded(RegionsExpandedEventArgs e) => OutliningHelper.RegionsExpanded(e, CodeDocumentViewModel.CodeDocument); public void ToggleAll(bool isExpanded, List<CodeItem> root = null) { OutliningHelper.ToggleAll(root ?? CodeDocumentViewModel.CodeDocument, isExpanded); } public void UpdateDocument(string filePath = "") => DocumentHelper.UpdateDocument(this, CodeDocumentViewModel, null, _row, filePath).FireAndForget(); public void HighlightCurrentItem(int lineNumber) { HighlightHelper.HighlightCurrentItem(CodeDocumentViewModel, lineNumber).FireAndForget(); // Force NotifyPropertyChanged CodeDocumentViewModel.CodeDocumentTop = null; } public async Task RegisterDocumentEvents() { // Todo: Implement events } } }
using System.Collections.Generic; using System.Windows.Controls; using CodeNav.Helpers; using CodeNav.Models; using Microsoft.VisualStudio.PlatformUI; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Text.Outlining; namespace CodeNav { /// <summary> /// Interaction logic for CodeViewUserControl.xaml /// </summary> public partial class CodeViewUserControlTop : ICodeViewUserControl { private readonly RowDefinition _row; public CodeDocumentViewModel CodeDocumentViewModel { get; set; } public CodeViewUserControlTop(RowDefinition row = null) { InitializeComponent(); // Setup viewmodel as datacontext CodeDocumentViewModel = new CodeDocumentViewModel(); DataContext = CodeDocumentViewModel; _row = row; VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged; } private void VSColorTheme_ThemeChanged(ThemeChangedEventArgs e) => UpdateDocument(); public void FilterBookmarks() => VisibilityHelper.SetCodeItemVisibility(CodeDocumentViewModel); public void RegionsCollapsed(RegionsCollapsedEventArgs e) => OutliningHelper.RegionsCollapsed(e, CodeDocumentViewModel.CodeDocument); public void RegionsExpanded(RegionsExpandedEventArgs e) => OutliningHelper.RegionsExpanded(e, CodeDocumentViewModel.CodeDocument); public void ToggleAll(bool isExpanded, List<CodeItem> root = null) { OutliningHelper.ToggleAll(root ?? CodeDocumentViewModel.CodeDocument, isExpanded); } public void UpdateDocument(string filePath = "") => DocumentHelper.UpdateDocument(this, CodeDocumentViewModel, null, _row, filePath).FireAndForget(); public void HighlightCurrentItem(int lineNumber) { HighlightHelper.HighlightCurrentItem(CodeDocumentViewModel, lineNumber).FireAndForget(); // Force NotifyPropertyChanged CodeDocumentViewModel.CodeDocumentTop = null; } } }
mit
C#
ab7257db18788af8410dfc09e26218d182fd13df
update version to 2.0.0 (service cache support)
sportingsolutions/SS.Integration.UnifiedDataAPIClient.DotNet,sportingsolutions/SS.Integration.UnifiedDataAPIClient.DotNet
SportingSolutions.Udapi.Sdk/Properties/AssemblyInfo.cs
SportingSolutions.Udapi.Sdk/Properties/AssemblyInfo.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.225 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("SportingSolutions.Udapi.Sdk")] [assembly: AssemblyDescription("Sporting Solutions Unified Data API Sdk")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("SportingSolutions.Udapi.Sdk")] [assembly: AssemblyCompany("Sporting Solutions Ltd.")] [assembly: AssemblyCopyright("Copyright (c) Sporting Solutions Ltd. 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0.0")] [assembly: InternalsVisibleTo("SportingSolutions.Udapi.Sdk.Tests")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.225 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("SportingSolutions.Udapi.Sdk")] [assembly: AssemblyDescription("Sporting Solutions Unified Data API Sdk")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("SportingSolutions.Udapi.Sdk")] [assembly: AssemblyCompany("Sporting Solutions Ltd.")] [assembly: AssemblyCopyright("Copyright (c) Sporting Solutions Ltd. 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.3.1.0")] [assembly: AssemblyFileVersion("1.3.1.0")] [assembly: AssemblyInformationalVersion("1.3.1.0")] [assembly: InternalsVisibleTo("SportingSolutions.Udapi.Sdk.Tests")]
apache-2.0
C#
329e5b2b6472bed433faa6e5b8952e38cc0b1b1c
fix NRE
gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer
Client/Systems/VesselImmortalSys/VesselImmortalEvents.cs
Client/Systems/VesselImmortalSys/VesselImmortalEvents.cs
using LunaClient.Base; using LunaClient.Systems.Lock; using LunaClient.Systems.SettingsSys; using LunaCommon.Locks; namespace LunaClient.Systems.VesselImmortalSys { public class VesselImmortalEvents : SubSystem<VesselImmortalSystem> { /// <summary> /// Set vessel immortal state just when the vessel loads /// </summary> public void VesselLoaded(Vessel vessel) { if(vessel == null) return; if (FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.id == vessel.id) return; var isOurs = LockSystem.LockQuery.ControlLockBelongsToPlayer(vessel.id, SettingsSystem.CurrentSettings.PlayerName) || LockSystem.LockQuery.UpdateLockBelongsToPlayer(vessel.id, SettingsSystem.CurrentSettings.PlayerName); System.SetVesselImmortalState(vessel, !isOurs); } /// <summary> /// Handles the vessel immortal state when someone gets a lock /// </summary> public void OnLockAcquire(LockDefinition lockDefinition) { if(lockDefinition.Type < LockType.Update) return; var vessel = FlightGlobals.FindVessel(lockDefinition.VesselId); System.SetVesselImmortalState(vessel, lockDefinition.PlayerName != SettingsSystem.CurrentSettings.PlayerName); } /// <summary> /// Makes our active vessel mortal if we finished spectating /// </summary> public void FinishSpectating() { System.SetVesselImmortalState(FlightGlobals.ActiveVessel, false); } /// <summary> /// Makes our active vessel immortal if we are spectating /// </summary> public void StartSpectating() { System.SetVesselImmortalState(FlightGlobals.ActiveVessel, true); } } }
using LunaClient.Base; using LunaClient.Systems.Lock; using LunaClient.Systems.SettingsSys; using LunaCommon.Locks; namespace LunaClient.Systems.VesselImmortalSys { public class VesselImmortalEvents : SubSystem<VesselImmortalSystem> { /// <summary> /// Set vessel immortal state just when the vessel loads /// </summary> public void VesselLoaded(Vessel vessel) { if(vessel == null) return; if (FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.id == vessel.id) return; var isOurs = LockSystem.LockQuery.ControlLockBelongsToPlayer(vessel.id, SettingsSystem.CurrentSettings.PlayerName) || LockSystem.LockQuery.UpdateLockBelongsToPlayer(vessel.id, SettingsSystem.CurrentSettings.PlayerName); System.SetVesselImmortalState(vessel, !isOurs); } /// <summary> /// Handles the vessel immortal state when someone gets a lock /// </summary> public void OnLockAcquire(LockDefinition lockDefinition) { if(lockDefinition.Type < LockType.Update) return; var vessel = FlightGlobals.FindVessel(lockDefinition.VesselId); if (!vessel.loaded) return; System.SetVesselImmortalState(vessel, lockDefinition.PlayerName != SettingsSystem.CurrentSettings.PlayerName); } /// <summary> /// Makes our active vessel mortal if we finished spectating /// </summary> public void FinishSpectating() { System.SetVesselImmortalState(FlightGlobals.ActiveVessel, false); } /// <summary> /// Makes our active vessel immortal if we are spectating /// </summary> public void StartSpectating() { System.SetVesselImmortalState(FlightGlobals.ActiveVessel, true); } } }
mit
C#
56b075af9fd1dded7a4a925303a489975d3c36eb
Update version
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/API/Treehopper/Properties/AssemblyInfo.cs
NET/API/Treehopper/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; // 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("Treehopper")] [assembly: AssemblyDescription("Treehopper is an open-source platform for connecting your computer to the physical world")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Treehopper LLC")] [assembly: AssemblyProduct("Treehopper")] [assembly: AssemblyCopyright("Copyright © 2018 Treehopper, LLC")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
using System.Reflection; using System.Resources; // 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("Treehopper")] [assembly: AssemblyDescription("Treehopper is an open-source platform for connecting your computer to the physical world")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Treehopper LLC")] [assembly: AssemblyProduct("Treehopper")] [assembly: AssemblyCopyright("Copyright © 2016 Treehopper, LLC")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
mit
C#
02b96212a3db6998e0e26dc920c5e1e91b8c2bf5
Fix a null-requiredBy value.
benjamin-bader/stiletto,benjamin-bader/stiletto
Stiletto.Fody/Validation/CompilerParameterizedBinding.cs
Stiletto.Fody/Validation/CompilerParameterizedBinding.cs
/* * Copyright © 2013 Ben Bader * * 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 Stiletto.Fody.Generators; using Stiletto.Internal; namespace Stiletto.Fody.Validation { /// <summary> /// Wraps both <see cref="Lazy&lt;T&gt;"/> and <see cref="IProvider&lt;T&gt;"/> /// bindings for post-build graph validation. /// </summary> public class CompilerParameterizedBinding : Binding { private readonly string elementKey; private Binding elementBinding; public CompilerParameterizedBinding(LazyBindingGenerator generator) : base(generator.Key, null, false, generator.Key) { elementKey = generator.LazyKey; } public CompilerParameterizedBinding(ProviderBindingGenerator generator) : base(generator.Key, null, false, generator.Key) { elementKey = generator.ProviderKey; } public override void Resolve(Resolver resolver) { elementBinding = resolver.RequestBinding(elementKey, RequiredBy); } public override void GetDependencies(ISet<Binding> injectDependencies, ISet<Binding> propertyDependencies) { injectDependencies.Add(elementBinding); } public override object Get() { throw new NotSupportedException("Compiler validation should never call Binding.Get()."); } public override void InjectProperties(object target) { throw new NotSupportedException("Compiler validation should never call Binding.InjectProperties(object)."); } } }
/* * Copyright © 2013 Ben Bader * * 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 Stiletto.Fody.Generators; using Stiletto.Internal; namespace Stiletto.Fody.Validation { /// <summary> /// Wraps both <see cref="Lazy&lt;T&gt;"/> and <see cref="IProvider&lt;T&gt;"/> /// bindings for post-build graph validation. /// </summary> public class CompilerParameterizedBinding : Binding { private readonly string elementKey; private Binding elementBinding; public CompilerParameterizedBinding(LazyBindingGenerator generator) : base(generator.Key, null, false, generator.Key) { elementKey = generator.LazyKey; } public CompilerParameterizedBinding(ProviderBindingGenerator generator) : base(generator.Key, null, false, generator.Key) { elementKey = generator.ProviderKey; } public override void Resolve(Resolver resolver) { elementBinding = resolver.RequestBinding(elementKey, null); } public override void GetDependencies(ISet<Binding> injectDependencies, ISet<Binding> propertyDependencies) { injectDependencies.Add(elementBinding); } public override object Get() { throw new NotSupportedException("Compiler validation should never call Binding.Get()."); } public override void InjectProperties(object target) { throw new NotSupportedException("Compiler validation should never call Binding.InjectProperties(object)."); } } }
apache-2.0
C#
d3c6b500ae7de5c5b2069c8fc003d533efa53f73
Fix BasicTabControl not working by default
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework
osu.Framework/Graphics/UserInterface/BasicTabControl.cs
osu.Framework/Graphics/UserInterface/BasicTabControl.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Sprites; using osuTK.Graphics; namespace osu.Framework.Graphics.UserInterface { public class BasicTabControl<T> : TabControl<T> { protected override Dropdown<T> CreateDropdown() => new BasicTabControlDropdown(); protected override TabItem<T> CreateTabItem(T value) => new BasicTabItem(value); public class BasicTabItem : TabItem<T> { private readonly SpriteText text; public BasicTabItem(T value) : base(value) { AutoSizeAxes = Axes.Both; Add(text = new SpriteText { Margin = new MarginPadding(2), Text = value.ToString(), Font = new FontUsage(size: 18), }); } protected override void OnActivated() => text.Colour = Color4.MediumPurple; protected override void OnDeactivated() => text.Colour = Color4.White; } public class BasicTabControlDropdown : BasicDropdown<T> { public BasicTabControlDropdown() { Menu.Anchor = Anchor.TopRight; Menu.Origin = Anchor.TopRight; Header.Anchor = Anchor.TopRight; Header.Origin = Anchor.TopRight; } } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Sprites; using osuTK.Graphics; namespace osu.Framework.Graphics.UserInterface { public class BasicTabControl<T> : TabControl<T> { protected override Dropdown<T> CreateDropdown() => new BasicDropdown<T>(); protected override TabItem<T> CreateTabItem(T value) => new BasicTabItem(value); public class BasicTabItem : TabItem<T> { private readonly SpriteText text; public BasicTabItem(T value) : base(value) { AutoSizeAxes = Axes.Both; Add(text = new SpriteText { Margin = new MarginPadding(2), Text = value.ToString(), Font = new FontUsage(size: 18), }); } protected override void OnActivated() => text.Colour = Color4.MediumPurple; protected override void OnDeactivated() => text.Colour = Color4.White; } } }
mit
C#
1c2d930b8ca27f8bc0493270c6f3018a5d04951a
Add NULL-check
whitestone-no/Cambion
src/Serializers/MessagePack/MessagePackSerializer.cs
src/Serializers/MessagePack/MessagePackSerializer.cs
using System; using System.IO; using System.Threading.Tasks; using Whitestone.Cambion.Interfaces; using Whitestone.Cambion.Types; using MessagePack_Serializer = MessagePack.MessagePackSerializer; namespace Whitestone.Cambion.Serializer.MessagePack { public class MessagePackSerializer : ISerializer { public async Task<byte[]> SerializeAsync(MessageWrapper message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } byte[] messageBytes; using (MemoryStream ms = new MemoryStream()) { await MessagePack_Serializer.Typeless.SerializeAsync(ms, message).ConfigureAwait(false); messageBytes = ms.ToArray(); } return messageBytes; } public async Task<MessageWrapper> DeserializeAsync(byte[] serialized) { MessageWrapper message; using (MemoryStream ms = new MemoryStream(serialized)) { message = await MessagePack_Serializer.Typeless.DeserializeAsync(ms).ConfigureAwait(false) as MessageWrapper; } return message; } } }
using System.IO; using System.Threading.Tasks; using Whitestone.Cambion.Interfaces; using Whitestone.Cambion.Types; using MessagePack_Serializer = MessagePack.MessagePackSerializer; namespace Whitestone.Cambion.Serializer.MessagePack { public class MessagePackSerializer : ISerializer { public async Task<byte[]> SerializeAsync(MessageWrapper message) { byte[] messageBytes; using (MemoryStream ms = new MemoryStream()) { await MessagePack_Serializer.Typeless.SerializeAsync(ms, message).ConfigureAwait(false); messageBytes = ms.ToArray(); } return messageBytes; } public async Task<MessageWrapper> DeserializeAsync(byte[] serialized) { MessageWrapper message; using (MemoryStream ms = new MemoryStream(serialized)) { message = await MessagePack_Serializer.Typeless.DeserializeAsync(ms).ConfigureAwait(false) as MessageWrapper; } return message; } } }
mit
C#
a1780c9c6bf2aa034f6f01fb35bf2bf2ec9537bd
make mice randomly squeak
fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation
UnityProject/Assets/Scripts/NPC/AI/MouseAI.cs
UnityProject/Assets/Scripts/NPC/AI/MouseAI.cs
using UnityEngine; using System.Collections.Generic; using System.Collections; /// <summary> /// AI brain for mice /// used to get hunted by Runtime and squeak /// </summary> public class MouseAI : MobAI { private string mouseName; private string capMouseName; private float timeForNextRandomAction; private float timeWaiting; protected override void Awake() { base.Awake(); mouseName = mobName.ToLower(); capMouseName = char.ToUpper(mouseName[0]) + mouseName.Substring(1); BeginExploring(MobExplore.Target.food); } protected override void UpdateMe() { if (health.IsDead || health.IsCrit || health.IsCardiacArrest) return; base.UpdateMe(); MonitorExtras(); } void MonitorExtras() { //TODO eat cables if haven't eaten in a while timeWaiting += Time.deltaTime; if (timeWaiting > timeForNextRandomAction) { timeWaiting = 0f; timeForNextRandomAction = Random.Range(3f,30f); DoRandomSqueek(); } } public override void OnPetted(GameObject performer) { Squeak(); StartFleeing(performer.transform, 3f); } protected override void OnAttackReceived(GameObject damagedBy) { Squeak(); StartFleeing(damagedBy.transform, 5f); } private void Squeak() { SoundManager.PlayNetworkedAtPos("MouseSqueek", gameObject.transform.position, Random.Range(.6f,1.2f)); Chat.AddActionMsgToChat(gameObject, $"{capMouseName} squeaks!", $"{capMouseName} squeaks!"); } private void DoRandomSqueek() { Squeak(); } }
using UnityEngine; using System.Collections.Generic; using System.Collections; /// <summary> /// AI brain for mice /// used to get hunted by Runtime and squeak /// </summary> public class MouseAI : MobAI { private string mouseName; private string capMouseName; private float timeForNextRandomAction; private float timeWaiting; protected override void Awake() { base.Awake(); mouseName = mobName.ToLower(); capMouseName = char.ToUpper(mouseName[0]) + mouseName.Substring(1); BeginExploring(MobExplore.Target.food); } protected override void UpdateMe() { if (health.IsDead || health.IsCrit || health.IsCardiacArrest) return; base.UpdateMe(); MonitorExtras(); } void MonitorExtras() { //TODO eat cables if haven't eaten in a while if (IsPerformingTask) return; timeWaiting += Time.deltaTime; if (timeWaiting > timeForNextRandomAction) { timeWaiting = 0f; timeForNextRandomAction = Random.Range(1f,30f); DoRandomAction(Random.Range(1,2)); } } public override void OnPetted(GameObject performer) { Squeak(); StartFleeing(performer.transform, 3f); } protected override void OnAttackReceived(GameObject damagedBy) { Squeak(); StartFleeing(damagedBy.transform, 5f); } private void Squeak() { SoundManager.PlayNetworkedAtPos("MouseSqueek", gameObject.transform.position, Random.Range(.6f,1.2f)); Chat.AddActionMsgToChat(gameObject, $"{capMouseName} squeaks!", $"{capMouseName} squeaks!"); } private void DoRandomAction(int randAction) { switch (randAction) { case 1: Squeak(); break; case 3: BeginExploring(exploreDuration: 10f); break; } } }
agpl-3.0
C#
1449a4edfb81850fbf8116ced7f9fdf8ae6b549e
Mark exception as serializable
CoraleStudios/Colore
src/Colore/ColoreException.cs
src/Colore/ColoreException.cs
// --------------------------------------------------------------------------------------- // <copyright file="ColoreException.cs" company="Corale"> // Copyright © 2015-2019 by Adam Hellberg and Brandon Scott. // // 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. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Colore { using System; using JetBrains.Annotations; /// <inheritdoc /> /// <summary> /// Generic Colore library exception. /// </summary> [Serializable] public class ColoreException : Exception { /// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="ColoreException" /> class. /// </summary> [PublicAPI] public ColoreException() { } /// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="ColoreException" /> class. /// </summary> /// <param name="message">Message describing the exception.</param> [PublicAPI] public ColoreException(string message) : base(message) { } /// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="ColoreException" /> class. /// </summary> /// <param name="message">Exception message.</param> /// <param name="innerException">Inner exception object.</param> public ColoreException(string message, Exception innerException) : base(message, innerException) { } } }
// --------------------------------------------------------------------------------------- // <copyright file="ColoreException.cs" company="Corale"> // Copyright © 2015-2019 by Adam Hellberg and Brandon Scott. // // 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. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Colore { using System; using JetBrains.Annotations; /// <inheritdoc /> /// <summary> /// Generic Colore library exception. /// </summary> public class ColoreException : Exception { /// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="ColoreException" /> class. /// </summary> [PublicAPI] public ColoreException() { } /// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="ColoreException" /> class. /// </summary> /// <param name="message">Message describing the exception.</param> [PublicAPI] public ColoreException(string message) : base(message) { } /// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="ColoreException" /> class. /// </summary> /// <param name="message">Exception message.</param> /// <param name="innerException">Inner exception object.</param> public ColoreException(string message, Exception innerException) : base(message, innerException) { } } }
mit
C#
de1b763d963f8be612d93889e08e43f67c98d0d5
Update IControllerModelConvention.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/IControllerModelConvention.cs
src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/IControllerModelConvention.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.Mvc.ApplicationModels { /// <summary> /// Allows customization of the <see cref="ControllerModel"/>. /// </summary> /// <remarks> /// To use this interface, create an <see cref="System.Attribute"/> class which implements the interface and /// place it on a controller class. /// /// <see cref="IControllerModelConvention"/> customizations run after /// <see cref="IApplicationModelConvention"/> customizations and before /// <see cref="IActionModelConvention"/> customizations. /// </remarks> public interface IControllerModelConvention { /// <summary> /// Called to apply the convention to the <see cref="ControllerModel"/>. /// </summary> /// <param name="controller">The <see cref="ControllerModel"/>.</param> void Apply(ControllerModel controller); } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.Mvc.ApplicationModels { /// <summary> /// Allows customization of the of the <see cref="ControllerModel"/>. /// </summary> /// <remarks> /// To use this interface, create an <see cref="System.Attribute"/> class which implements the interface and /// place it on a controller class. /// /// <see cref="IControllerModelConvention"/> customizations run after /// <see cref="IApplicationModelConvention"/> customizations and before /// <see cref="IActionModelConvention"/> customizations. /// </remarks> public interface IControllerModelConvention { /// <summary> /// Called to apply the convention to the <see cref="ControllerModel"/>. /// </summary> /// <param name="controller">The <see cref="ControllerModel"/>.</param> void Apply(ControllerModel controller); } }
apache-2.0
C#
af4fb2e155a9a5740681eadc91cb5a86b81a2f78
Use FallbackCredentials
SharpeRAD/Cake.AWS.S3
src/S3.Tests/Tests/S3Tests.cs
src/S3.Tests/Tests/S3Tests.cs
#region Using Statements using System; using System.Diagnostics; using Xunit; using Cake.Core; using Cake.Core.IO; using Cake.Core.Diagnostics; #endregion namespace Cake.AWS.S3.Tests { public class S3Tests { [Fact] public void Test_Syn() { SyncSettings settings = CakeHelper.CreateEnvironment().CreateSyncSettings(); settings.BucketName = "cake-aws-s3"; settings.KeyPrefix = "tests"; IS3Manager manager = CakeHelper.CreateS3Manager(); manager.Sync(new DirectoryPath("../../"), settings); } } }
#region Using Statements using System; using Xunit; using Cake.Core; using Cake.Core.IO; using Cake.Core.Diagnostics; #endregion namespace Cake.AWS.S3.Tests { public class S3Tests { [Fact] public void Test_Syn() { IS3Manager manager = CakeHelper.CreateS3Manager(); manager.Sync(new DirectoryPath("../../"), new SyncSettings() { AccessKey = Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID", EnvironmentVariableTarget.User), SecretKey = Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", EnvironmentVariableTarget.User), BucketName = "cake-aws-s3", KeyPrefix = "tests" }); } } }
mit
C#
1a4339fbdb52b3db33a87b88d0a60ca5447ec013
Use the connection's cancellation token (#189)
andrasm/prometheus-net
Prometheus.AspNetCore/MetricServerMiddleware.cs
Prometheus.AspNetCore/MetricServerMiddleware.cs
using Microsoft.AspNetCore.Http; using System.IO; using System.Threading.Tasks; namespace Prometheus { /// <summary> /// Prometheus metrics export middleware for ASP.NET Core. /// /// You should use IApplicationBuilder.UseMetricServer extension method instead of using this class directly. /// </summary> public sealed class MetricServerMiddleware { public MetricServerMiddleware(RequestDelegate next, Settings settings) { _registry = settings.Registry ?? Metrics.DefaultRegistry; } public sealed class Settings { public CollectorRegistry? Registry { get; set; } } private readonly CollectorRegistry _registry; public async Task Invoke(HttpContext context) { var response = context.Response; try { // We first touch the response.Body only in the callback because touching // it means we can no longer send headers (the status code). var serializer = new TextSerializer(delegate { response.ContentType = PrometheusConstants.ExporterContentType; response.StatusCode = StatusCodes.Status200OK; return response.Body; }); await _registry.CollectAndSerializeAsync(serializer, context.RequestAborted); } catch (ScrapeFailedException ex) { // This can only happen before any serialization occurs, in the pre-collect callbacks. // So it should still be safe to update the status code and write an error message. response.StatusCode = StatusCodes.Status503ServiceUnavailable; if (!string.IsNullOrWhiteSpace(ex.Message)) { using (var writer = new StreamWriter(response.Body, PrometheusConstants.ExportEncoding, bufferSize: -1, leaveOpen: true)) await writer.WriteAsync(ex.Message); } } } } }
using Microsoft.AspNetCore.Http; using System.IO; using System.Threading.Tasks; namespace Prometheus { /// <summary> /// Prometheus metrics export middleware for ASP.NET Core. /// /// You should use IApplicationBuilder.UseMetricServer extension method instead of using this class directly. /// </summary> public sealed class MetricServerMiddleware { public MetricServerMiddleware(RequestDelegate next, Settings settings) { _registry = settings.Registry ?? Metrics.DefaultRegistry; } public sealed class Settings { public CollectorRegistry? Registry { get; set; } } private readonly CollectorRegistry _registry; public async Task Invoke(HttpContext context) { var response = context.Response; try { // We first touch the response.Body only in the callback because touching // it means we can no longer send headers (the status code). var serializer = new TextSerializer(delegate { response.ContentType = PrometheusConstants.ExporterContentType; response.StatusCode = StatusCodes.Status200OK; return response.Body; }); await _registry.CollectAndSerializeAsync(serializer, default); } catch (ScrapeFailedException ex) { // This can only happen before any serialization occurs, in the pre-collect callbacks. // So it should still be safe to update the status code and write an error message. response.StatusCode = StatusCodes.Status503ServiceUnavailable; if (!string.IsNullOrWhiteSpace(ex.Message)) { using (var writer = new StreamWriter(response.Body, PrometheusConstants.ExportEncoding, bufferSize: -1, leaveOpen: true)) await writer.WriteAsync(ex.Message); } } } } }
mit
C#
866e4c38db08e45c46f6c09766b520e1201c327a
Add some documentation
rucila/FileHelpers,MarcosMeli/FileHelpers,guillaumejay/FileHelpers,rucila/FileHelpers,jawn/FileHelpers,senthilmsv/FileHelpers,jawn/FileHelpers,regisbsb/FileHelpers,phaufe/FileHelpers,tablesmit/FileHelpers,xavivars/FileHelpers,regisbsb/FileHelpers,tablesmit/FileHelpers,p07r0457/FileHelpers,phaufe/FileHelpers,jbparker/FileHelpers,mcavigelli/FileHelpers,neildobson71/FileHelpers,CarbonEdge/FileHelpers,modulexcite/FileHelpers,aim00ver/FileHelpers,merkt/FileHelpers
FileHelpers.Tests/Tests/Helpers/ForwardReaderTests.cs
FileHelpers.Tests/Tests/Helpers/ForwardReaderTests.cs
using System; using FileHelpers; using FileHelpers.Detection; using FileHelpers.Dynamic; using NUnit.Framework; using System.Collections.Generic; using System.IO; namespace FileHelpers.Tests { [TestFixture] public class ForwardReaderTests { [Test(Description="Check if we read forward 0,0 it discards nothing")] public void BasicProperties() { var reader = new ForwardReader(new NewLineDelimitedRecordReader(new StreamReader(FileTest.Good.CustomersTab.Path)), 0, 0); reader.DiscardForward.AssertEqualTo(false); reader.FowardLines.AssertEqualTo(0); reader.LineNumber.AssertEqualTo(0); reader.ReadNextLine(); reader.LineNumber.AssertEqualTo(1); } // TODO: Add more tests for forward reader } }
using System; using FileHelpers; using FileHelpers.Detection; using FileHelpers.Dynamic; using NUnit.Framework; using System.Collections.Generic; using System.IO; namespace FileHelpers.Tests { [TestFixture] public class ForwardReaderTests { [Test] public void BasicProperties() { var reader = new ForwardReader(new NewLineDelimitedRecordReader(new StreamReader(FileTest.Good.CustomersTab.Path)), 0, 0); reader.DiscardForward.AssertEqualTo(false); reader.FowardLines.AssertEqualTo(0); reader.LineNumber.AssertEqualTo(0); reader.ReadNextLine(); reader.LineNumber.AssertEqualTo(1); } } }
mit
C#
a6f279b6d31b47a53e867fe63c3bc419ac8eef2f
Fix restart service bug
michael-reichenauer/GitMind
GitMind/ApplicationHandling/Private/RestartService.cs
GitMind/ApplicationHandling/Private/RestartService.cs
using System; using System.Diagnostics; using GitMind.ApplicationHandling.SettingsHandling; using GitMind.Utils; namespace GitMind.ApplicationHandling.Private { internal class RestartService : IRestartService { private static readonly char[] QuoteChar = "\"".ToCharArray(); public bool TriggerRestart(string workingFolder) { string folder = workingFolder; string targetPath = ProgramPaths.GetInstallFilePath(); string arguments = string.IsNullOrWhiteSpace(folder) ? "/run" : $"/run /d:\"{folder}\""; Log.Info($"Restarting: {targetPath} {arguments}"); return StartProcess(targetPath, arguments); } private static bool StartProcess(string targetPath, string arguments) { try { Process process = new Process(); process.StartInfo.FileName = Quote(targetPath); process.StartInfo.Arguments = arguments; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.Start(); return true; } catch (Exception e) { Log.Exception(e, $"Failed to start {targetPath} {arguments}"); return false; } } private static string Quote(string text) { text = text.Trim(); text = text.Trim(QuoteChar); return $"\"{text}\""; } } }
using System; using System.Diagnostics; using GitMind.ApplicationHandling.SettingsHandling; using GitMind.Utils; namespace GitMind.ApplicationHandling.Private { internal class RestartService : IRestartService { private static readonly char[] QuoteChar = "\"".ToCharArray(); public bool TriggerRestart(string workingFolder) { string folder = workingFolder; string targetPath = ProgramPaths.GetInstallFilePath(); string arguments = string.IsNullOrWhiteSpace(folder) ? "/run" : $"/run d:/\"{folder}\""; Log.Info($"Restarting: {targetPath} {arguments}"); return StartProcess(targetPath, arguments); } private static bool StartProcess(string targetPath, string arguments) { try { Process process = new Process(); process.StartInfo.FileName = Quote(targetPath); process.StartInfo.Arguments = arguments; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.Start(); return true; } catch (Exception e) { Log.Exception(e, $"Failed to start {targetPath} {arguments}"); return false; } } private static string Quote(string text) { text = text.Trim(); text = text.Trim(QuoteChar); return $"\"{text}\""; } } }
mit
C#
24a7c28ecd1cfbab72379a36ae1c273705de3822
Implement IOptions<MemcachedClientOptions>
cnblogs/EnyimMemcachedCore,DukeCheng/EnyimMemcachedCore,DukeCheng/EnyimMemcachedCore,cnblogs/EnyimMemcachedCore
Enyim.Caching/Configuration/MemcachedClientOptions.cs
Enyim.Caching/Configuration/MemcachedClientOptions.cs
using Enyim.Caching.Memcached; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Enyim.Caching.Configuration { public class MemcachedClientOptions : IOptions<MemcachedClientOptions> { public MemcachedProtocol Protocol { get; set; } = MemcachedProtocol.Binary; public SocketPoolConfiguration SocketPool { get; set; } = new SocketPoolConfiguration(); public List<Server> Servers { get; set; } = new List<Server>(); public Authentication Authentication { get; set; } public string KeyTransformer { get; set; } public ITranscoder Transcoder { get; set; } public MemcachedClientOptions Value => this; public void AddServer(string address, int port) { Servers.Add(new Server { Address = address, Port = port }); } public void AddPlainTextAuthenticator(string zone, string userName, string password) { Authentication = new Authentication { Type = typeof(PlainTextAuthenticator).ToString(), Parameters = new Dictionary<string, string> { { $"{nameof(zone)}", zone }, { $"{nameof(userName)}", userName}, { $"{nameof(password)}", password} } }; } } public class Server { public string Address { get; set; } public int Port { get; set; } } public class Authentication { public string Type { get; set; } public Dictionary<string, string> Parameters { get; set; } } }
using Enyim.Caching.Memcached; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Enyim.Caching.Configuration { public class MemcachedClientOptions { public MemcachedProtocol Protocol { get; set; } = MemcachedProtocol.Binary; public SocketPoolConfiguration SocketPool { get; set; } = new SocketPoolConfiguration(); public List<Server> Servers { get; set; } = new List<Server>(); public Authentication Authentication { get; set; } public string KeyTransformer { get; set; } public ITranscoder Transcoder { get; set; } public void AddServer(string address, int port) { Servers.Add(new Server { Address = address, Port = port }); } public void AddPlainTextAuthenticator(string zone, string userName, string password) { Authentication = new Authentication { Type = typeof(PlainTextAuthenticator).ToString(), Parameters = new Dictionary<string, string> { { $"{nameof(zone)}", zone }, { $"{nameof(userName)}", userName}, { $"{nameof(password)}", password} } }; } } public class Server { public string Address { get; set; } public int Port { get; set; } } public class Authentication { public string Type { get; set; } public Dictionary<string, string> Parameters { get; set; } } }
apache-2.0
C#
14fdbe964fdf0522d98fb0421d4018f7daffe405
Fix for pull request issue resetting pull requests. (#655)
tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools
tools/check-enforcer/Azure.Sdk.Tools.CheckEnforcer/Handlers/PullRequestHandler.cs
tools/check-enforcer/Azure.Sdk.Tools.CheckEnforcer/Handlers/PullRequestHandler.cs
using Azure.Sdk.Tools.CheckEnforcer.Configuration; using Azure.Sdk.Tools.CheckEnforcer.Integrations.GitHub; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Primitives; using Microsoft.Identity.Client; using Octokit; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Azure.Sdk.Tools.CheckEnforcer.Handlers { public class PullRequestHandler : Handler<PullRequestEventPayload> { public PullRequestHandler(IGlobalConfigurationProvider globalConfigurationProvider, IGitHubClientProvider gitHubClientProvider, IRepositoryConfigurationProvider repositoryConfigurationProvider, ILogger logger) : base(globalConfigurationProvider, gitHubClientProvider, repositoryConfigurationProvider, logger) { } protected override async Task HandleCoreAsync(HandlerContext<PullRequestEventPayload> context, CancellationToken cancellationToken) { var payload = context.Payload; var installationId = payload.Installation.Id; var repositoryId = payload.Repository.Id; var sha = payload.PullRequest.Head.Sha; var runIdentifier = $"{installationId}/{repositoryId}/{sha}"; var action = payload.Action; var pullRequestNumber = payload.PullRequest.Number; Logger.LogInformation( "Received {action} action on PR# {pullRequestNumber} against {runIdentifier}", action, pullRequestNumber, runIdentifier ); if (action == "opened" || action == "reopened") { var configuration = await this.RepositoryConfigurationProvider.GetRepositoryConfigurationAsync(installationId, repositoryId, sha, cancellationToken); if (configuration.IsEnabled) { await CreateCheckAsync(context.Client, installationId, repositoryId, sha, false, cancellationToken); if (action == "reopened") { await EvaluatePullRequestAsync(context.Client, installationId, repositoryId, sha, cancellationToken); } } } else { Logger.LogInformation( "Ignoring pull request event because action was not 'opened' or 'reopened'. It was {action}.", action ); } } } }
using Azure.Sdk.Tools.CheckEnforcer.Configuration; using Azure.Sdk.Tools.CheckEnforcer.Integrations.GitHub; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Primitives; using Microsoft.Identity.Client; using Octokit; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Azure.Sdk.Tools.CheckEnforcer.Handlers { public class PullRequestHandler : Handler<PullRequestEventPayload> { public PullRequestHandler(IGlobalConfigurationProvider globalConfigurationProvider, IGitHubClientProvider gitHubClientProvider, IRepositoryConfigurationProvider repositoryConfigurationProvider, ILogger logger) : base(globalConfigurationProvider, gitHubClientProvider, repositoryConfigurationProvider, logger) { } protected override async Task HandleCoreAsync(HandlerContext<PullRequestEventPayload> context, CancellationToken cancellationToken) { var payload = context.Payload; var installationId = payload.Installation.Id; var repositoryId = payload.Repository.Id; var sha = payload.PullRequest.Head.Sha; var runIdentifier = $"{installationId}/{repositoryId}/{sha}"; var action = payload.Action; var pullRequestNumber = payload.PullRequest.Number; Logger.LogInformation( "Received {action} action on PR# {pullRequestNumber} against {runIdentifier}", action, pullRequestNumber, runIdentifier ); var configuration = await this.RepositoryConfigurationProvider.GetRepositoryConfigurationAsync(installationId, repositoryId, sha, cancellationToken); if (configuration.IsEnabled) { await CreateCheckAsync(context.Client, installationId, repositoryId, sha, false, cancellationToken); } } } }
mit
C#
3ab029bc4afa8b816c3face2798b2b126f32666c
Split another code.
sdcb/sdmap
sdmap/test/sdmap.test/IntegratedTest/NamespaceTest.cs
sdmap/test/sdmap.test/IntegratedTest/NamespaceTest.cs
using sdmap.Runtime; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace sdmap.test.IntegratedTest { public class NamespaceTest { [Fact] public void CanReferenceOtherInOneNamespace() { var code = "namespace ns{sql v1{1#include<v2>} \r\n" + "sql v2{2}}"; var rt = new SdmapRuntime(); rt.AddSourceCode(code); var result = rt.Emit("ns.v1", new { A = true }); Assert.Equal("12", result); } [Fact] public void CanCombineTwoNs() { var code = "namespace ns1{sql sql{1#include<ns2.sql>}} \r\n" + "namespace ns2{sql sql{2}}"; var rt = new SdmapRuntime(); rt.AddSourceCode(code); var result = rt.Emit("ns1.sql", null); Assert.Equal("12", result); } } }
using sdmap.Runtime; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace sdmap.test.IntegratedTest { public class NamespaceTest { [Fact] public void CanReferenceOtherInOneNamespace() { var code = "namespace ns{sql v1{1#include<v2>} sql v2{2}}"; var rt = new SdmapRuntime(); rt.AddSourceCode(code); var result = rt.Emit("ns.v1", new { A = true }); Assert.Equal("12", result); } [Fact] public void CanCombineTwoNs() { var code = "namespace ns1{sql sql{1#include<ns2.sql>}} \r\n" + "namespace ns2{sql sql{2}}"; var rt = new SdmapRuntime(); rt.AddSourceCode(code); var result = rt.Emit("ns1.sql", null); Assert.Equal("12", result); } } }
mit
C#
c825ac7f797501f73d680e6ef53de34b5c9f4227
Update MT ContactsSample thumbnail
xamarin/Xamarin.Mobile,orand/Xamarin.Mobile,haithemaraissia/Xamarin.Mobile,moljac/Xamarin.Mobile,xamarin/Xamarin.Mobile,nexussays/Xamarin.Mobile
MonoTouch/Samples/ContactsSample/DetailContactView.cs
MonoTouch/Samples/ContactsSample/DetailContactView.cs
using System; using Xamarin.Contacts; using MonoTouch.UIKit; using System.Text; using System.Globalization; using System.Drawing; namespace ContactsSample { /// <summary> /// Detail contact view. This view displays the details of a contact. /// </summary> public class DetailContactView : UIViewController { Contact contact; UIImageView contactImage; UILabel nameLabel; UILabel phoneLabel; UILabel emailLabel; public DetailContactView (Contact c) { this.contact = c; } public override void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.White; // // position and display the contact thumbnail image // contactImage = new UIImageView(new RectangleF(210, 5, 60, 60)); this.View.AddSubview(contactImage); contactImage.Image = contact.GetThumbnail(); // // position and display the contact Display name // nameLabel = new UILabel(new RectangleF(5, 5, 200, 30)); this.View.AddSubview(nameLabel); nameLabel.Text = contact.DisplayName; // // position and display the first phone number in the contact object // // A more complete implementation may display all the phone numbers in // a table, or query for a specific type of phone number // phoneLabel = new UILabel(new RectangleF(5, 40, 200, 30)); this.View.AddSubview(phoneLabel); String phoneString = String.Empty; foreach(var phone in contact.Phones) { phoneString = String.Format("{0}: {1}", phone.Label, phone.Number); break; //just take the first phone number in this example } phoneLabel.Text = phoneString; // // position and display the first email in the contact object // // A more complete implementation may display all the email addresses in // a table, or query for a specific type of email // emailLabel = new UILabel(new RectangleF(5, 80, 200, 30)); this.View.AddSubview(emailLabel); String emailString = String.Empty; foreach(var email in contact.Emails) { emailString = String.Format("{0}: {1}", email.Label, email.Address); break; //just take the first email in this example } emailLabel.Text = emailString; } } }
using System; using Xamarin.Contacts; using MonoTouch.UIKit; using System.Text; using System.Globalization; using System.Drawing; namespace ContactsSample { /// <summary> /// Detail contact view. This view displays the details of a contact. /// </summary> public class DetailContactView : UIViewController { Contact contact; UIImageView contactImage; UILabel nameLabel; UILabel phoneLabel; UILabel emailLabel; public DetailContactView (Contact c) { this.contact = c; } public override void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.White; // // position and display the contact thumbnail image // contactImage = new UIImageView(new RectangleF(210, 5, 60, 60)); this.View.AddSubview(contactImage); contactImage.Image = contact.PhotoThumbnail; // // position and display the contact Display name // nameLabel = new UILabel(new RectangleF(5, 5, 200, 30)); this.View.AddSubview(nameLabel); nameLabel.Text = contact.DisplayName; // // position and display the first phone number in the contact object // // A more complete implementation may display all the phone numbers in // a table, or query for a specific type of phone number // phoneLabel = new UILabel(new RectangleF(5, 40, 200, 30)); this.View.AddSubview(phoneLabel); String phoneString = String.Empty; foreach(var phone in contact.Phones) { phoneString = String.Format("{0}: {1}", phone.Label, phone.Number); break; //just take the first phone number in this example } phoneLabel.Text = phoneString; // // position and display the first email in the contact object // // A more complete implementation may display all the email addresses in // a table, or query for a specific type of email // emailLabel = new UILabel(new RectangleF(5, 80, 200, 30)); this.View.AddSubview(emailLabel); String emailString = String.Empty; foreach(var email in contact.Emails) { emailString = String.Format("{0}: {1}", email.Label, email.Address); break; //just take the first email in this example } emailLabel.Text = emailString; } } }
apache-2.0
C#
57758bd9f24dd42e959d0d7c11c54ee4deb43f34
Make codefixer for explicit interface polymorph analyzer
FonsDijkstra/CConst
CConst/CConst/ConstPolymorphismCodeFixProvider.cs
CConst/CConst/ConstPolymorphismCodeFixProvider.cs
using System; using System.Composition; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Rename; using Microsoft.CodeAnalysis.Text; namespace FonsDijkstra.CConst { [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(ConstPolymorphismCodeFixProvider)), Shared] public class ConstPolymorphismCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds { get { return ImmutableArray.Create(ConstPolymorphismAnalyzer.OverrideDiagnosticId, ConstPolymorphismAnalyzer.ExplicitInterfaceDiagnosticId); } } public sealed override FixAllProvider GetFixAllProvider() { return WellKnownFixAllProviders.BatchFixer; } public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken); var method = root.FindNode(context.Span) as MethodDeclarationSyntax; if (method != null) { context.RegisterCodeFix( CodeAction.Create( "Add const declaration", c => method.AddConstAttributeAsync(context.Document, c), nameof(ConstPolymorphismCodeFixProvider) + "_add"), context.Diagnostics.Single()); } } } }
using System; using System.Composition; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Rename; using Microsoft.CodeAnalysis.Text; namespace FonsDijkstra.CConst { [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(ConstPolymorphismCodeFixProvider)), Shared] public class ConstPolymorphismCodeFixProvider : CodeFixProvider { public const string DiagnosticId = ConstPolymorphismAnalyzer.OverrideDiagnosticId; public sealed override ImmutableArray<string> FixableDiagnosticIds { get { return ImmutableArray.Create(DiagnosticId); } } public sealed override FixAllProvider GetFixAllProvider() { return WellKnownFixAllProviders.BatchFixer; } public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken); var method = root.FindNode(context.Span) as MethodDeclarationSyntax; if (method != null) { context.RegisterCodeFix( CodeAction.Create( "Add const declaration", c => method.AddConstAttributeAsync(context.Document, c), DiagnosticId + "_add"), context.Diagnostics.Single()); } } } }
mit
C#
7eed2b3a0662cd880f9bf52b03483b856a8b1cd4
Use new automatic test running functionality
yawaramin/TDDUnit
Program.cs
Program.cs
using System; namespace TDDUnit { class TestTestCase : TestCase { public TestTestCase(string name) : base(name) { } public override void SetUp() { base.SetUp(); m_result = new TestResult(); } public void TestTemplateMethod() { WasRunObj test = new WasRunObj("TestMethod"); test.Run(m_result); Assert.Equal("SetUp TestMethod TearDown ", test.Log); } public void TestResult() { WasRunObj test = new WasRunObj("TestMethod"); test.Run(m_result); Assert.Equal("1 run, 0 failed", m_result.Summary); } public void TestFailedResult() { WasRunObj test = new WasRunObj("TestBrokenMethod"); test.Run(m_result); Assert.Equal("1 run, 1 failed", m_result.Summary); } public void TestFailedResultFormatting() { m_result.TestStarted(); m_result.TestFailed(); Assert.Equal("1 run, 1 failed", m_result.Summary); } public void TestFailedSetUp() { WasRunSetUpFailed test = new WasRunSetUpFailed("TestMethod"); m_result.TestStarted(); try { test.Run(new TestResult()); } catch (Exception) { m_result.TestFailed(); } Assert.Equal("1 run, 0 failed", m_result.Summary); } public void TestSuite() { TestSuite suite = new TestSuite(); suite.Add(new WasRunObj("TestMethod")); suite.Add(new WasRunObj("TestBrokenMethod")); suite.Run(m_result); Assert.Equal("2 run, 1 failed", m_result.Summary); } public void TestRunAllTests() { TestSuite suite = new TestSuite(typeof (WasRunObj)); suite.Run(m_result); Assert.Equal("2 run, 1 failed", m_result.Summary); } private TestResult m_result; } class Program { static void Main() { TestSuite suite = new TestSuite(typeof (TestTestCase)); TestResult result = new TestResult(); suite.Run(result); Console.WriteLine(result.Summary); } } }
using System; namespace TDDUnit { class TestTestCase : TestCase { public TestTestCase(string name) : base(name) { } public override void SetUp() { base.SetUp(); m_result = new TestResult(); } public void TestTemplateMethod() { WasRunObj test = new WasRunObj("TestMethod"); test.Run(m_result); Assert.Equal("SetUp TestMethod TearDown ", test.Log); } public void TestResult() { WasRunObj test = new WasRunObj("TestMethod"); test.Run(m_result); Assert.Equal("1 run, 0 failed", m_result.Summary); } public void TestFailedResult() { WasRunObj test = new WasRunObj("TestBrokenMethod"); test.Run(m_result); Assert.Equal("1 run, 1 failed", m_result.Summary); } public void TestFailedResultFormatting() { m_result.TestStarted(); m_result.TestFailed(); Assert.Equal("1 run, 1 failed", m_result.Summary); } public void TestFailedSetUp() { WasRunSetUpFailed test = new WasRunSetUpFailed("TestMethod"); m_result.TestStarted(); try { test.Run(new TestResult()); } catch (Exception) { m_result.TestFailed(); } Assert.Equal("1 run, 0 failed", m_result.Summary); } public void TestSuite() { TestSuite suite = new TestSuite(); suite.Add(new WasRunObj("TestMethod")); suite.Add(new WasRunObj("TestBrokenMethod")); suite.Run(m_result); Assert.Equal("2 run, 1 failed", m_result.Summary); } public void TestRunAllTests() { TestSuite suite = new TestSuite(typeof (WasRunObj)); suite.Run(m_result); Assert.Equal("2 run, 1 failed", m_result.Summary); } private TestResult m_result; } class Program { static void Main() { TestSuite suite = new TestSuite(); suite.Add(new TestTestCase("TestTemplateMethod")); suite.Add(new TestTestCase("TestResult")); suite.Add(new TestTestCase("TestFailedResult")); suite.Add(new TestTestCase("TestFailedResultFormatting")); suite.Add(new TestTestCase("TestFailedSetUp")); suite.Add(new TestTestCase("TestRunAllTests")); TestResult result = new TestResult(); suite.Run(result); Console.WriteLine(result.Summary); } } }
apache-2.0
C#
8367f69af8f4b20a868ee7691376d2aa2a4e3b2f
Update AssemblyInfo.cs
skid9000/Crunchyroll-Downloader
Crunchyroll-Downloader/Properties/AssemblyInfo.cs
Crunchyroll-Downloader/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Crunchyroll Downloader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tuto-Craft")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Tuto-Craft Corporation Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: NeutralResourcesLanguage("en")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Crunchyroll Downloader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tuto-Craft")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Tuto-Craft Corporation Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguage("en")]
agpl-3.0
C#
4dd43562c871beda6f04507bbbf7a30c90af0fed
Update unit tests
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade.Core.Tests/Base/TestSuiteTest.cs
src/Arkivverket.Arkade.Core.Tests/Base/TestSuiteTest.cs
using Arkivverket.Arkade.Core.Base; using Arkivverket.Arkade.Core.Testing; using FluentAssertions; using Xunit; namespace Arkivverket.Arkade.Core.Tests.Base { public class TestSuiteTest { private readonly TestResult _testResultWithError = new TestResult(ResultType.Error, new Location(""), "feil"); private readonly TestResult _testResultWithSuccess = new TestResult(ResultType.Success, new Location(""), "feil"); [Fact] public void FindNumberOfErrorsShouldReturnOneError() { var testSuite = new TestSuite(); TestRun testRun = new ArkadeTestMock("test with error", TestType.ContentAnalysis).GetTestRun(); testRun.Results.Add(new TestResult(ResultType.Error, new Location(""), "feil")); testSuite.AddTestRun(testRun); testSuite.FindNumberOfErrors().Should().Be(1); } [Fact] public void FindNumberOfErrorsShouldReturnTwoErrors() { TestSuite testSuite = CreateTestSuite(_testResultWithError, _testResultWithError, _testResultWithSuccess); testSuite.FindNumberOfErrors().Should().Be(2); } [Fact] public void FindNumberOfErrorsShouldZeroErrorsWhenNoTestResults() { TestSuite testSuite = CreateTestSuite(null); testSuite.FindNumberOfErrors().Should().Be(0); } [Fact] public void FindNumberOfErrorsShouldZeroErrorsWhenOnlySuccessResults() { TestSuite testSuite = CreateTestSuite(_testResultWithSuccess, _testResultWithSuccess); testSuite.FindNumberOfErrors().Should().Be(0); } private static TestSuite CreateTestSuite(params TestResult[] testResults) { var testSuite = new TestSuite(); TestRun testRun = new ArkadeTestMock("test with error", TestType.ContentAnalysis).GetTestRun(); if (testResults != null) { foreach (var testResult in testResults) { testRun.Results.Add(testResult); } } testSuite.AddTestRun(testRun); return testSuite; } } }
using Arkivverket.Arkade.Core.Base; using Arkivverket.Arkade.Core.Testing; using FluentAssertions; using Xunit; namespace Arkivverket.Arkade.Core.Tests.Base { public class TestSuiteTest { private readonly TestResult _testResultWithError = new TestResult(ResultType.Error, new Location(""), "feil"); private readonly TestResult _testResultWithSuccess = new TestResult(ResultType.Success, new Location(""), "feil"); [Fact] public void FindNumberOfErrorsShouldReturnOneError() { var testSuite = new TestSuite(); TestRun testRun = new ArkadeTestMock("test with error", TestType.ContentAnalysis).GetTestRun(); testRun.Add(new TestResult(ResultType.Error, new Location(""), "feil")); testSuite.AddTestRun(testRun); testSuite.FindNumberOfErrors().Should().Be(1); } [Fact] public void FindNumberOfErrorsShouldReturnTwoErrors() { TestSuite testSuite = CreateTestSuite(_testResultWithError, _testResultWithError, _testResultWithSuccess); testSuite.FindNumberOfErrors().Should().Be(2); } [Fact] public void FindNumberOfErrorsShouldZeroErrorsWhenNoTestResults() { TestSuite testSuite = CreateTestSuite(null); testSuite.FindNumberOfErrors().Should().Be(0); } [Fact] public void FindNumberOfErrorsShouldZeroErrorsWhenOnlySuccessResults() { TestSuite testSuite = CreateTestSuite(_testResultWithSuccess, _testResultWithSuccess); testSuite.FindNumberOfErrors().Should().Be(0); } private static TestSuite CreateTestSuite(params TestResult[] testResults) { var testSuite = new TestSuite(); TestRun testRun = new ArkadeTestMock("test with error", TestType.ContentAnalysis).GetTestRun(); if (testResults != null) { foreach (var testResult in testResults) { testRun.Add(testResult); } } testSuite.AddTestRun(testRun); return testSuite; } } }
agpl-3.0
C#
ca74fa9c050150697b904d95bec19533f50a7731
Increase assembly version to 1.0.
safakgur/Dawn.SocketAwaitable
src/Dawn.SocketAwaitable/Properties/AssemblyInfo.cs
src/Dawn.SocketAwaitable/Properties/AssemblyInfo.cs
// Copyright // ---------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="https://github.com/safakgur/Dawn.SocketAwaitable"> // MIT // </copyright> // <license> // This source code is subject to terms and conditions of The MIT License (MIT). // A copy of the license can be found in the License.txt file at the root of this distribution. // </license> // <summary> // Contains the attributes that provide information about the assembly. // </summary> // ---------------------------------------------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Dawn.SocketAwaitable")] [assembly: AssemblyCompany("https://github.com/safakgur/Dawn.SocketAwaitable")] [assembly: AssemblyDescription("Provides utilities for asynchronous socket operations.")] [assembly: AssemblyProduct("Dawn Framework")] [assembly: AssemblyCopyright("MIT")] [assembly: CLSCompliant(true)] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif
// Copyright // ---------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="https://github.com/safakgur/Dawn.SocketAwaitable"> // MIT // </copyright> // <license> // This source code is subject to terms and conditions of The MIT License (MIT). // A copy of the license can be found in the License.txt file at the root of this distribution. // </license> // <summary> // Contains the attributes that provide information about the assembly. // </summary> // ---------------------------------------------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Dawn.SocketAwaitable")] [assembly: AssemblyCompany("https://github.com/safakgur/Dawn.SocketAwaitable")] [assembly: AssemblyDescription("Provides utilities for asynchronous socket operations.")] [assembly: AssemblyProduct("Dawn Framework")] [assembly: AssemblyCopyright("MIT")] [assembly: CLSCompliant(true)] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif
mit
C#