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
0191f017c5f5055ea0b4904838fe3d43d2addc59
Change version
alexguirre/VehicleGadgetsPlus
scr/Properties/AssemblyInfo.cs
scr/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using Rage.Attributes; [assembly: AssemblyTitle("Vehicle Gadgets+")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("alexguirre")] [assembly: AssemblyProduct("Vehicle Gadgets+")] [assembly: AssemblyCopyright("Copyright © 2017 alexguirre")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("32b66d4a-850b-455b-a1c2-fb0a2d221218")] [assembly: AssemblyVersion("0.1.0.*")] [assembly: Plugin("Vehicle Gadgets+", Author = "alexguirre", PrefersSingleInstance = true)]
using System.Reflection; using System.Runtime.InteropServices; using Rage.Attributes; [assembly: AssemblyTitle("Vehicle Gadgets+")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("alexguirre")] [assembly: AssemblyProduct("Vehicle Gadgets+")] [assembly: AssemblyCopyright("Copyright © 2017 alexguirre")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("32b66d4a-850b-455b-a1c2-fb0a2d221218")] [assembly: AssemblyVersion("0.0.1.*")] [assembly: Plugin("Vehicle Gadgets+", Author = "alexguirre", PrefersSingleInstance = true)]
mit
C#
033b922c344c93dcb9a6c0007e77702d0620c6da
Remove unnecessary code
SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice
src/SFA.DAS.ProviderApprenticeshipsService.Web/Controllers/AgreementController.cs
src/SFA.DAS.ProviderApprenticeshipsService.Web/Controllers/AgreementController.cs
using System.Threading.Tasks; using System.Web.Mvc; using SFA.DAS.ProviderApprenticeshipsService.Domain.Interfaces; using SFA.DAS.ProviderApprenticeshipsService.Web.Attributes; using SFA.DAS.ProviderApprenticeshipsService.Web.Models.Types; using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators; namespace SFA.DAS.ProviderApprenticeshipsService.Web.Controllers { [Authorize] [ProviderUkPrnCheck] [RoutePrefix("{providerId}/agreements")] public class AgreementController : BaseController { private readonly AgreementOrchestrator _orchestrator; public AgreementController(AgreementOrchestrator orchestrator, ICookieStorageService<FlashMessageViewModel> flashMessage) : base(flashMessage) { _orchestrator = orchestrator; } [HttpGet] [Route("")] public async Task<ActionResult> Agreements(long providerId, string organisation = "") { var model = await _orchestrator.GetAgreementsViewModel(providerId, organisation); return View(model); } } }
using System; using System.Threading.Tasks; using System.Web.Mvc; using SFA.DAS.ProviderApprenticeshipsService.Domain.Interfaces; using SFA.DAS.ProviderApprenticeshipsService.Web.Attributes; using SFA.DAS.ProviderApprenticeshipsService.Web.Models.Types; using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators; namespace SFA.DAS.ProviderApprenticeshipsService.Web.Controllers { [Authorize] [ProviderUkPrnCheck] [RoutePrefix("{providerId}/agreements")] public class AgreementController : BaseController { private readonly AgreementOrchestrator _orchestrator; private const string FileName = "organisations_and_agreements"; private const string CsvContentType = "text/csv"; private const string ExcelContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; public AgreementController(AgreementOrchestrator orchestrator, ICookieStorageService<FlashMessageViewModel> flashMessage) : base(flashMessage) { _orchestrator = orchestrator; } [HttpGet] [Route("")] public async Task<ActionResult> Agreements(long providerId, string organisation = "") { var model = await _orchestrator.GetAgreementsViewModel(providerId, organisation); return View(model); } [HttpGet] [Route("search-organisation")] public async Task<JsonResult> SearchOrganisation(long providerId, string searchTerm) { var data = await _orchestrator.GetAgreementsViewModel(providerId, searchTerm); return Json(data.CommitmentAgreements, JsonRequestBehavior.AllowGet); } } }
mit
C#
d801c2262a92782be6c34ded5917210d0a46fee1
support hosting.json file
0xFireball/PenguinUpload,0xFireball/PenguinUpload,0xFireball/PenguinUpload,0xFireball/PenguinUpload
PenguinUpload/src/PenguinUpload/Program.cs
PenguinUpload/src/PenguinUpload/Program.cs
using System.IO; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; namespace PenguinUpload { public class Program { public static void Main(string[] args) { // Load PenguinUpload Config if (File.Exists(PenguinUploadRegistry.ConfigFileName)) { var configFileContents = File.ReadAllText(PenguinUploadRegistry.ConfigFileName); JsonConvert.PopulateObject(configFileContents, PenguinUploadRegistry.Configuration); } // Load ASP.NET Core web app var config = new ConfigurationBuilder() .AddCommandLine(args) .AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "hosting.json")) .AddEnvironmentVariables(prefix: "ASPNETCORE_") .Build(); var host = new WebHostBuilder() .UseConfiguration(config) .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } } }
using System.IO; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; namespace PenguinUpload { public class Program { public static void Main(string[] args) { // Load PenguinUpload Config if (File.Exists(PenguinUploadRegistry.ConfigFileName)) { var configFileContents = File.ReadAllText(PenguinUploadRegistry.ConfigFileName); JsonConvert.PopulateObject(configFileContents, PenguinUploadRegistry.Configuration); } // Load ASP.NET Core web app var config = new ConfigurationBuilder() .AddCommandLine(args) .AddEnvironmentVariables(prefix: "ASPNETCORE_") .Build(); var host = new WebHostBuilder() .UseConfiguration(config) .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } } }
apache-2.0
C#
e156972474c0cfbe2f249e82f98a753193e46136
Revert "Tests bumped"
SpainHoliday/sepawriter
SepaWriter.Test/Properties/AssemblyInfo.cs
SepaWriter.Test/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("SpainHoliday.SepaWriter.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Spain-Holiday.com")] [assembly: AssemblyProduct("SpainHoliday.SepaWriter.Test")] [assembly: AssemblyCopyright("")] [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("6f7c5715-db1c-4412-b13f-22dc715fe9a9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SpainHoliday.SepaWriter.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Spain-Holiday.com")] [assembly: AssemblyProduct("SpainHoliday.SepaWriter.Test")] [assembly: AssemblyCopyright("")] [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("6f7c5715-db1c-4412-b13f-22dc715fe9a9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1.*")] [assembly: AssemblyFileVersion("1.0.1.*")]
apache-2.0
C#
42f923d4949c1b4571d3e46c3a80523bb84dbdcb
Fix 'connect to receiving employer' link
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerAccounts.Web/Views/Transfers/TransferConnectionInvitationAuthorization.cshtml
src/SFA.DAS.EmployerAccounts.Web/Views/Transfers/TransferConnectionInvitationAuthorization.cshtml
@using SFA.DAS.Authorization @using SFA.DAS.Common.Domain.Types; @using SFA.DAS.Authorization @using SFA.DAS.Authorization.Mvc @model TransferConnectionInvitationAuthorizationViewModel <p>Employers who pay the apprenticeship levy can connect with other employers and transfer up to @Model.TransferAllowancePercentage.ToString("N0")% of their previous year's annual funds.</p> @if (Html.IsAuthorized(FeatureType.Transfers)) { switch (Model.AuthorizationResult) { case AuthorizationResult.Ok: <p>Before starting a connection, both the sending and receiving employers need to read and understand the <a href="https://www.gov.uk/government/publications/apprenticeship-funding-and-performance-management-rules-2017-to-2018">rules for sending and receiving transfers</a>.</p> <p>Only the sending employer can start a connection.</p> if (Model.IsValidSender) { <div class="grid-row"> <div class="column-two-thirds"> <a class="button" href="@Url.Action("Index", "TransferConnectionInvitations" )">Connect to a receiving employer</a> </div> </div> } break; case AuthorizationResult.FeatureAgreementNotSigned: <p>Before starting a connection, both the sending and receiving employers need to read and understand the <a href="https://www.gov.uk/government/publications/apprenticeship-funding-and-performance-management-rules-2017-to-2018">rules for sending and receiving transfers</a> and sign the updated organisation agreement with ESFA.</p> <div class="grid-row"> <div class="column-two-thirds"> <a class="button" href="@Url.Action("Index", "EmployerAgreement" )">Sign ESFA agreement</a> </div> </div> break; default: throw new ArgumentOutOfRangeException(); } }
@using SFA.DAS.Authorization @using SFA.DAS.EmployerAccounts.Web.Extensions @switch (Model.AuthorizationResult) { case AuthorizationResult.Ok: <div class="grid-row"> <div class="column-two-thirds"> <p><a href="@Url.EmployerProjectionsAction("forecasting/estimations/start-transfer")">Estimate</a> the number of apprentices you can fund with your transfer allowance.</p> <p>Employers who pay the apprenticeship levy can connect with other employers and transfer up to @Model.TransferAllowancePercentage.ToString("N0")% of their previous year's annual funds.</p> <p>Before starting a connection, both the sending and receiving employers need to read and understand the <a href="https://www.gov.uk/government/publications/apprenticeship-funding-and-performance-management-rules-2017-to-2018">rules for sending and receiving transfers</a>.</p> <p>Only the sending employer can start a connection.</p> </div> </div> if (Model.IsValidSender) { <div class="grid-row"> <div class="column-two-thirds"> <a class="button" href="@Url.Action("Index", "TransferConnectionInvitations")">Connect to a receiving employer</a> </div> </div> } break; case AuthorizationResult.FeatureAgreementNotSigned: <div class="grid-row"> <div class="column-two-thirds"> <p><a href="@Url.EmployerProjectionsAction("forecasting/estimations/start-transfer")">Estimate</a> the number of apprentices you can fund with your transfer allowance.</p> <p>Employers who pay the apprenticeship levy can connect with other employers and transfer up to @Model.TransferAllowancePercentage.ToString("N0")% of their previous year's annual funds.</p> <p>Before starting a connection, both the sending and receiving employers need to read and understand the <a href="https://www.gov.uk/government/publications/apprenticeship-funding-and-performance-management-rules-2017-to-2018">rules for sending and receiving transfers</a> and sign the updated organisation agreement with ESFA.</p> </div> </div> <div class="grid-row"> <div class="column-two-thirds"> <a class="button" href="@Url.Action("Index", "EmployerAgreement")">Sign ESFA agreement</a> </div> </div> break; default: throw new ArgumentOutOfRangeException(); }
mit
C#
3da0f78da33ecc8b1639a1c09f52ee34de0eca3c
Use the same EventStore server for all tests to eliminate TCP self connects
rasmus/EventFlow,AntoineGa/EventFlow
Source/EventFlow.EventStores.EventStore.Tests/IntegrationTests/EventStoreEventStoreTests.cs
Source/EventFlow.EventStores.EventStore.Tests/IntegrationTests/EventStoreEventStoreTests.cs
// The MIT License (MIT) // // Copyright (c) 2015 Rasmus Mikkelsen // Copyright (c) 2015 eBay Software Foundation // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Net; using System.Threading; using EventFlow.Configuration; using EventFlow.EventStores.EventStore.Extensions; using EventFlow.Extensions; using EventFlow.MetadataProviders; using EventFlow.TestHelpers; using EventFlow.TestHelpers.Suites; using EventStore.ClientAPI; using EventStore.ClientAPI.SystemData; using NUnit.Framework; namespace EventFlow.EventStores.EventStore.Tests.IntegrationTests { [TestFixture] [Timeout(30000)] [Category(Categories.Integration)] public class EventStoreEventStoreTests : TestSuiteForEventStore { private IDisposable _eventStore; [TestFixtureSetUp] public void SetUp() { _eventStore = EventStoreRunner.StartAsync().Result; // TODO: Argh, remove .Result } [TestFixtureTearDown] public void TearDown() { _eventStore.DisposeSafe("EventStore shutdown"); } protected override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions) { var connectionSettings = ConnectionSettings.Create() .EnableVerboseLogging() .KeepReconnecting() .KeepRetrying() .SetDefaultUserCredentials(new UserCredentials("admin", "changeit")) .Build(); var resolver = eventFlowOptions .AddMetadataProvider<AddGuidMetadataProvider>() .UseEventStoreEventStore(new IPEndPoint(IPAddress.Loopback, 1113), connectionSettings) .CreateResolver(); return resolver; } } }
// The MIT License (MIT) // // Copyright (c) 2015 Rasmus Mikkelsen // Copyright (c) 2015 eBay Software Foundation // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Net; using System.Threading; using EventFlow.Configuration; using EventFlow.EventStores.EventStore.Extensions; using EventFlow.Extensions; using EventFlow.MetadataProviders; using EventFlow.TestHelpers; using EventFlow.TestHelpers.Suites; using EventStore.ClientAPI; using EventStore.ClientAPI.SystemData; using NUnit.Framework; namespace EventFlow.EventStores.EventStore.Tests.IntegrationTests { [Timeout(120000)] [Category(Categories.Integration)] public class EventStoreEventStoreTests : TestSuiteForEventStore { private IDisposable _eventStore; [SetUp] public void SetUp() { _eventStore = EventStoreRunner.StartAsync().Result; // TODO: Argh, remove .Result } [TearDown] public void TearDown() { _eventStore.DisposeSafe("EventStore shutdown"); } protected override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions) { var connectionSettings = ConnectionSettings.Create() .EnableVerboseLogging() .KeepReconnecting() .KeepRetrying() .SetDefaultUserCredentials(new UserCredentials("admin", "changeit")) .Build(); var resolver = eventFlowOptions .AddMetadataProvider<AddGuidMetadataProvider>() .UseEventStoreEventStore(new IPEndPoint(IPAddress.Loopback, 1113), connectionSettings) .CreateResolver(); return resolver; } } }
mit
C#
8580b737f13784ad5ca3d39650c471fd7260ca90
Fix expiry date on create new poll
tpkelly/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,stevenhillcox/voting-application,stevenhillcox/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,tpkelly/voting-application
VotingApplication/VotingApplication.Web/Api/Models/DBViewModels/PollCreationRequestModel.cs
VotingApplication/VotingApplication.Web/Api/Models/DBViewModels/PollCreationRequestModel.cs
using System; using System.ComponentModel.DataAnnotations; namespace VotingApplication.Web.Api.Models.DBViewModels { public class PollCreationRequestModel { [Required] public string Name { get; set; } [Required] public string Creator { get; set; } [Required] public string VotingStrategy { get; set; } [EmailAddress] public string Email { get; set; } [Range(1, int.MaxValue)] public int MaxPoints { get; set; } [Range(1, int.MaxValue)] public int MaxPerVote { get; set; } public long TemplateId { get; set; } public bool InviteOnly { get; set; } public bool NamedVoting { get; set; } public bool RequireAuth { get; set; } public bool Expires { get; set; } public DateTimeOffset? ExpiryDate { get; set; } public bool OptionAdding { get; set; } } }
using System; using System.ComponentModel.DataAnnotations; namespace VotingApplication.Web.Api.Models.DBViewModels { public class PollCreationRequestModel { [Required] public string Name { get; set; } [Required] public string Creator { get; set; } [Required] public string VotingStrategy { get; set; } [EmailAddress] public string Email { get; set; } [Range(1, int.MaxValue)] public int MaxPoints { get; set; } [Range(1, int.MaxValue)] public int MaxPerVote { get; set; } public long TemplateId { get; set; } public bool InviteOnly { get; set; } public bool NamedVoting { get; set; } public bool RequireAuth { get; set; } public bool Expires { get; set; } public DateTimeOffset ExpiryDate { get; set; } public bool OptionAdding { get; set; } } }
apache-2.0
C#
4ab7a212303a4e6eac324f902d4140cc003f6c0d
Update HMRC Policy Only Null 404s
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/ExecutionPolicies/HmrcExecutionPolicy.cs
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/ExecutionPolicies/HmrcExecutionPolicy.cs
using System; using HMRC.ESFA.Levy.Api.Types.Exceptions; using Polly; using SFA.DAS.EAS.Domain.Http; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EAS.Infrastructure.ExecutionPolicies { [PolicyName(Name)] public class HmrcExecutionPolicy : ExecutionPolicy { public const string Name = "HMRC Policy"; private readonly ILog _logger; private readonly Policy TooManyRequestsPolicy; private readonly Policy ServiceUnavailablePolicy; private readonly Policy InternalServerErrorPolicy; private readonly Policy RequestTimeoutPolicy; public HmrcExecutionPolicy(ILog logger) { _logger = logger; TooManyRequestsPolicy = Policy.Handle<TooManyRequestsException>().WaitAndRetryForeverAsync((i) => new TimeSpan(0, 0, 10), (ex, ts) => OnRetryableFailure(ex)); RequestTimeoutPolicy = Policy.Handle<RequestTimeOutException>().WaitAndRetryForeverAsync((i) => new TimeSpan(0, 0, 10), (ex, ts) => OnRetryableFailure(ex)); ServiceUnavailablePolicy = CreateAsyncRetryPolicy<ServiceUnavailableException>(5, new TimeSpan(0, 0, 10), OnRetryableFailure); InternalServerErrorPolicy = CreateAsyncRetryPolicy<InternalServerErrorException>(5, new TimeSpan(0, 0, 10), OnRetryableFailure); RootPolicy = Policy.WrapAsync(TooManyRequestsPolicy, ServiceUnavailablePolicy, InternalServerErrorPolicy, RequestTimeoutPolicy); } protected override T OnException<T>(Exception ex) { if (ex is ResourceNotFoundException) { _logger.Info($"Resource not found - {ex.Message}"); return default(T); } if (ex is ApiHttpException exception) { _logger.Info($"ApiHttpException - {ex.Message}"); switch (exception.HttpCode) { case 404: return default(T); } } _logger.Error(ex, $"Exceeded retry limit - {ex.Message}"); throw ex; } private void OnRetryableFailure(Exception ex) { _logger.Info($"Error calling HMRC - {ex.Message} - Will retry"); } } }
using System; using Polly; using SFA.DAS.EAS.Domain.Http; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EAS.Infrastructure.ExecutionPolicies { [PolicyName(Name)] public class HmrcExecutionPolicy : ExecutionPolicy { public const string Name = "HMRC Policy"; private readonly ILog _logger; private readonly Policy TooManyRequestsPolicy; private readonly Policy ServiceUnavailablePolicy; private readonly Policy InternalServerErrorPolicy; private readonly Policy RequestTimeoutPolicy; public HmrcExecutionPolicy(ILog logger) { _logger = logger; TooManyRequestsPolicy = Policy.Handle<TooManyRequestsException>().WaitAndRetryForeverAsync((i) => new TimeSpan(0, 0, 10), (ex, ts) => OnRetryableFailure(ex)); RequestTimeoutPolicy = Policy.Handle<RequestTimeOutException>().WaitAndRetryForeverAsync((i) => new TimeSpan(0, 0, 10), (ex, ts) => OnRetryableFailure(ex)); ServiceUnavailablePolicy = CreateAsyncRetryPolicy<ServiceUnavailableException>(5, new TimeSpan(0, 0, 10), OnRetryableFailure); InternalServerErrorPolicy = CreateAsyncRetryPolicy<InternalServerErrorException>(5, new TimeSpan(0, 0, 10), OnRetryableFailure); RootPolicy = Policy.WrapAsync(TooManyRequestsPolicy, ServiceUnavailablePolicy, InternalServerErrorPolicy, RequestTimeoutPolicy); } protected override T OnException<T>(Exception ex) { if (ex is ResourceNotFoundException) { _logger.Info($"Resource not found - {ex.Message}"); return default(T); } if (ex is HMRC.ESFA.Levy.Api.Types.Exceptions.ApiHttpException) { _logger.Info($"ApiHttpException - {ex.Message}"); return default(T); } _logger.Error(ex, $"Exceeded retry limit - {ex.Message}"); throw ex; } private void OnRetryableFailure(Exception ex) { _logger.Info($"Error calling HMRC - {ex.Message} - Will retry"); } } }
mit
C#
f11c92e35d8cd008a85fb0cb7c6ce1cc03cac742
Update BeforeGateway.cshtml
odises/nopPlugins
Payments/v3.8/mellat/src/Nop.Plugin.Payments.Mellat/Views/PaymentMellat/BeforeGateway.cshtml
Payments/v3.8/mellat/src/Nop.Plugin.Payments.Mellat/Views/PaymentMellat/BeforeGateway.cshtml
@using Nop.Plugin.Payments.Mellat.Models @model BeforeGatewayModel <form id="Gateway__PostForm" name="Gateway__PostForm" action="https://bpm.shaparak.ir/pgwchannel/startpay.mellat" method="POST"> <input type="hidden" name="RefId" value="@Model.RefId"> </form> <script language="javascript"> var myForm = document.Gateway__PostForm; myForm.submit(); </script>
@using Nop.Plugin.Payments.Mellat.Models @model BeforeGatewayModel <form id="Gateway__PostForm" name="Gateway__PostForm" action="https://pgw.bpm.bankmellat.ir/pgwchannel/startpay.mellat" method="POST"> <input type="hidden" name="RefId" value="@Model.RefId"> </form> <script language="javascript"> var myForm = document.Gateway__PostForm; myForm.submit(); </script>
mit
C#
53a153acb66e336913aae97c05ed37dcfced5d75
Revert "xoa console.writeline"
toannvqo/dnn_publish
Components/ProductController.cs
Components/ProductController.cs
using DotNetNuke.Data; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Christoc.Modules.DNNModule1.Components { public class ProductController { public Product GetProduct(int productId) { Product p; using (IDataContext ctx = DataContext.Instance()) { // comment Console.WriteLine("hello world"); Console.WriteLine("hello world"); var rep = ctx.GetRepository<Product>(); p = rep.GetById(productId); } return p; } public IEnumerable<Product> getAll() { IEnumerable<Product> p; using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); p = rep.Get(); } return p; } public void CreateProduct(Product p) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); rep.Insert(p); } } public void DeleteProduct(int productId) { var p = GetProduct(productId); DeleteProduct(p); } public void DeleteProduct(Product p) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); rep.Delete(p); } } public void UpdateProduct(Product p) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); rep.Update(p); } } } }
using DotNetNuke.Data; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Christoc.Modules.DNNModule1.Components { public class ProductController { public Product GetProduct(int productId) { Product p; using (IDataContext ctx = DataContext.Instance()) { // comment Console.WriteLine("hello world"); var rep = ctx.GetRepository<Product>(); p = rep.GetById(productId); } return p; } public IEnumerable<Product> getAll() { IEnumerable<Product> p; using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); p = rep.Get(); } return p; } public void CreateProduct(Product p) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); rep.Insert(p); } } public void DeleteProduct(int productId) { var p = GetProduct(productId); DeleteProduct(p); } public void DeleteProduct(Product p) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); rep.Delete(p); } } public void UpdateProduct(Product p) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Product>(); rep.Update(p); } } } }
mit
C#
3a11ead9e884002b2406c1ba028be294b6f99353
Update description
pauljz/pvc-cloudfront
src/Properties/AssemblyInfo.cs
src/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("Pvc.CloudFront")] [assembly: AssemblyDescription("PVC plugin for uploading files to S3 and then invalidating the CloudFront cache.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Paul Zumbrun")] [assembly: AssemblyProduct("Pvc.CloudFront")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("Paul Zumbrun")] [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("57dd8320-ea1b-4860-b799-f5de297be2db")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Pvc.CloudFront")] [assembly: AssemblyDescription("PVC plugin: CloudFront")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Paul Zumbrun")] [assembly: AssemblyProduct("Pvc.CloudFront")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("Paul Zumbrun")] [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("57dd8320-ea1b-4860-b799-f5de297be2db")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")]
mit
C#
e3e42df5134fe2e21d44fbbfac0098fc984fb6ff
Mark the SubAppMetadata constructor as a JSON constructor
NFig/NFig
NFig/Metadata/SubAppMetadata.cs
NFig/Metadata/SubAppMetadata.cs
using Newtonsoft.Json; namespace NFig.Metadata { /// <summary> /// Metadata specific to a sub-app. This includes the default values applicable to the sub-app. /// </summary> public class SubAppMetadata<TTier, TDataCenter> where TTier : struct where TDataCenter : struct { /// <summary> /// The name of the root application. /// </summary> public string AppName { get; } /// <summary> /// The ID of the sub-app, or null if this is the root application. /// </summary> public int? SubAppId { get; } /// <summary> /// The name of the sub-app, or null if this is the root application. /// </summary> public string SubAppName { get; } /// <summary> /// The default values applicable to each setting. Each setting will have one or more default values. Only defaults applicable to the current tier are /// included. /// </summary> public ListBySetting<DefaultValue<TTier, TDataCenter>> DefaultsBySetting { get; } [JsonConstructor] internal SubAppMetadata(string appName, int? subAppId, string subAppName, ListBySetting<DefaultValue<TTier, TDataCenter>> defaultsBySetting) { AppName = appName; SubAppId = subAppId; SubAppName = subAppName; DefaultsBySetting = defaultsBySetting; } } }
namespace NFig.Metadata { /// <summary> /// Metadata specific to a sub-app. This includes the default values applicable to the sub-app. /// </summary> public class SubAppMetadata<TTier, TDataCenter> where TTier : struct where TDataCenter : struct { /// <summary> /// The name of the root application. /// </summary> public string AppName { get; } /// <summary> /// The ID of the sub-app, or null if this is the root application. /// </summary> public int? SubAppId { get; } /// <summary> /// The name of the sub-app, or null if this is the root application. /// </summary> public string SubAppName { get; } /// <summary> /// The default values applicable to each setting. Each setting will have one or more default values. Only defaults applicable to the current tier are /// included. /// </summary> public ListBySetting<DefaultValue<TTier, TDataCenter>> DefaultsBySetting { get; } internal SubAppMetadata(string appName, int? subAppId, string subAppName, ListBySetting<DefaultValue<TTier, TDataCenter>> defaultsBySetting) { AppName = appName; SubAppId = subAppId; SubAppName = subAppName; DefaultsBySetting = defaultsBySetting; } } }
mit
C#
9df3a986d8bbeaa74ae79b6dcc4b5ff22674eda8
Fix incorrect reference assembly path
gkhanna79/cli,schellap/cli,AbhitejJohn/cli,MichaelSimons/cli,weshaggard/cli,danquirk/cli,marono/cli,johnbeisner/cli,mlorbetske/cli,JohnChen0/cli,schellap/cli,borgdylan/dotnet-cli,anurse/Cli,nguerrera/cli,jonsequitur/cli,blackdwarf/cli,marono/cli,gkhanna79/cli,stuartleeks/dotnet-cli,EdwardBlair/cli,AbhitejJohn/cli,weshaggard/cli,jonsequitur/cli,johnbeisner/cli,FubarDevelopment/cli,marono/cli,EdwardBlair/cli,borgdylan/dotnet-cli,EdwardBlair/cli,naamunds/cli,mlorbetske/cli,jonsequitur/cli,johnbeisner/cli,danquirk/cli,naamunds/cli,stuartleeks/dotnet-cli,schellap/cli,borgdylan/dotnet-cli,krwq/cli,ravimeda/cli,blackdwarf/cli,mylibero/cli,harshjain2/cli,AbhitejJohn/cli,naamunds/cli,harshjain2/cli,JohnChen0/cli,blackdwarf/cli,livarcocc/cli-1,JohnChen0/cli,livarcocc/cli-1,jonsequitur/cli,danquirk/cli,mylibero/cli,dasMulli/cli,weshaggard/cli,gkhanna79/cli,schellap/cli,MichaelSimons/cli,FubarDevelopment/cli,svick/cli,danquirk/cli,Faizan2304/cli,jkotas/cli,JohnChen0/cli,nguerrera/cli,jkotas/cli,krwq/cli,naamunds/cli,mlorbetske/cli,krwq/cli,AbhitejJohn/cli,livarcocc/cli-1,marono/cli,MichaelSimons/cli,schellap/cli,marono/cli,blackdwarf/cli,FubarDevelopment/cli,borgdylan/dotnet-cli,mylibero/cli,ravimeda/cli,harshjain2/cli,nguerrera/cli,gkhanna79/cli,stuartleeks/dotnet-cli,weshaggard/cli,ravimeda/cli,Faizan2304/cli,Faizan2304/cli,svick/cli,krwq/cli,jkotas/cli,mylibero/cli,stuartleeks/dotnet-cli,borgdylan/dotnet-cli,FubarDevelopment/cli,dasMulli/cli,gkhanna79/cli,jkotas/cli,jkotas/cli,nguerrera/cli,mylibero/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,naamunds/cli,weshaggard/cli,schellap/cli,krwq/cli,danquirk/cli,mlorbetske/cli,MichaelSimons/cli,dasMulli/cli,svick/cli
src/Microsoft.Extensions.DependencyModel/Resolution/DotNetReferenceAssembliesPathResolver.cs
src/Microsoft.Extensions.DependencyModel/Resolution/DotNetReferenceAssembliesPathResolver.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using Microsoft.Extensions.EnvironmentAbstractions; using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.Extensions.DependencyModel.Resolution { public class DotNetReferenceAssembliesPathResolver { public static readonly string DotNetReferenceAssembliesPathEnv = "DOTNET_REFERENCE_ASSEMBLIES_PATH"; internal static string Resolve(IEnvironment envirnment, IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment) { var path = envirnment.GetEnvironmentVariable(DotNetReferenceAssembliesPathEnv); if (!string.IsNullOrEmpty(path)) { return path; } return GetDefaultDotNetReferenceAssembliesPath(fileSystem, runtimeEnvironment); } public static string Resolve() { return Resolve(EnvironmentWrapper.Default, FileSystemWrapper.Default, PlatformServices.Default.Runtime); } private static string GetDefaultDotNetReferenceAssembliesPath(IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment) { var os = runtimeEnvironment.OperatingSystemPlatform; if (os == Platform.Windows) { return null; } if (os == Platform.Darwin && fileSystem.Directory.Exists("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks")) { return "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks"; } if (fileSystem.Directory.Exists("/usr/local/lib/mono/xbuild-frameworks")) { return "/usr/local/lib/mono/xbuild-frameworks"; } if (fileSystem.Directory.Exists("/usr/lib/mono/xbuild-frameworks")) { return "/usr/lib/mono/xbuild-frameworks"; } return null; } } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using Microsoft.Extensions.EnvironmentAbstractions; using Microsoft.Extensions.PlatformAbstractions; namespace Microsoft.Extensions.DependencyModel.Resolution { public class DotNetReferenceAssembliesPathResolver { public static readonly string DotNetReferenceAssembliesPathEnv = "DOTNET_REFERENCE_ASSEMBLIES_PATH"; internal static string Resolve(IEnvironment envirnment, IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment) { var path = envirnment.GetEnvironmentVariable(DotNetReferenceAssembliesPathEnv); if (!string.IsNullOrEmpty(path)) { return path; } return GetDefaultDotNetReferenceAssembliesPath(fileSystem, runtimeEnvironment); } public static string Resolve() { return Resolve(EnvironmentWrapper.Default, FileSystemWrapper.Default, PlatformServices.Default.Runtime); } private static string GetDefaultDotNetReferenceAssembliesPath(IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment) { var os = runtimeEnvironment.OperatingSystemPlatform; if (os == Platform.Windows) { return null; } if (os == Platform.Darwin && fileSystem.Directory.Exists("/Library/Framework/Mono.Framework/Versions/Current/lib/mono/xbuild-frameworks")) { return "/Library/Framework/Mono.Framework/Versions/Current/lib/mono/xbuild-frameworks"; } if (fileSystem.Directory.Exists("/usr/local/lib/mono/xbuild-frameworks")) { return "/usr/local/lib/mono/xbuild-frameworks"; } if (fileSystem.Directory.Exists("/usr/lib/mono/xbuild-frameworks")) { return "/usr/lib/mono/xbuild-frameworks"; } return null; } } }
mit
C#
7bc8101ce376d36b6a76a413efc5ee83523dc0f4
add using
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Backend/Program.cs
WalletWasabi.Backend/Program.cs
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using NBitcoin; using NBitcoin.RPC; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using WalletWasabi.Logging; namespace WalletWasabi.Backend { public class Program { #pragma warning disable IDE1006 // Naming Styles public static async Task Main(string[] args) #pragma warning restore IDE1006 // Naming Styles { try { var endPoint = "http://localhost:37127/"; using var host = Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => webBuilder .UseStartup<Startup>() .UseUrls(endPoint)) .Build(); await host.RunWithTasksAsync(); } catch (Exception ex) { Logger.LogCritical(ex); } } } }
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using NBitcoin; using NBitcoin.RPC; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using WalletWasabi.Logging; namespace WalletWasabi.Backend { public class Program { #pragma warning disable IDE1006 // Naming Styles public static async Task Main(string[] args) #pragma warning restore IDE1006 // Naming Styles { try { var endPoint = "http://localhost:37127/"; var host = Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => webBuilder .UseStartup<Startup>() .UseUrls(endPoint)) .Build(); await host.RunWithTasksAsync(); } catch (Exception ex) { Logger.LogCritical(ex); } } } }
mit
C#
2d2e6096e07f207b4a1ba5a2375a92d4c668fe41
change date time format
Paymentsense/Dapper.SimpleSave
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Event/NotificationTransactionDto.cs
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Event/NotificationTransactionDto.cs
using System; using System.Runtime.Serialization; using PS.Mothership.Core.Common.Template.Event; namespace PS.Mothership.Core.Common.Dto.Event { [DataContract] public class NotificationTransactionDto { [DataMember] public Guid NotificationGuid { get; set; } [DataMember] public Guid EventGuid { get; set; } [DataMember] public Guid UpdatedSessionGuid { get; set; } [DataMember] public EventNotificationMethodEnum NotificationMethodKey { get; set; } [DataMember] public DateTimeOffset ScheduledDate { get; set; } [DataMember] public DateTimeOffset UpdateDate { get; set; } } }
using System; using System.Runtime.Serialization; using PS.Mothership.Core.Common.Template.Event; namespace PS.Mothership.Core.Common.Dto.Event { [DataContract] public class NotificationTransactionDto { [DataMember] public Guid NotificationGuid { get; set; } [DataMember] public Guid EventGuid { get; set; } [DataMember] public Guid UpdatedSessionGuid { get; set; } [DataMember] public EventNotificationMethodEnum NotificationMethodKey { get; set; } [DataMember] public DateTime ScheduledDate { get; set; } [DataMember] public DateTime UpdateDate { get; set; } } }
mit
C#
1bbba86dcda4b616fa1cdec94df13d19793a69f7
Add Initialize() method to ITabsterPlugin
GetTabster/Tabster.Plugin.TextFile
TextFilePlugin.cs
TextFilePlugin.cs
#region using System; using Tabster.Core.Plugins; #endregion namespace TextFile { public class TextFilePlugin : ITabsterPlugin { #region Implementation of ITabsterPlugin public string Author { get { return "Nate Shoffner"; } } public string Copyright { get { return "Copyright © Nate Shoffner 2014"; } } public string Description { get { return "Supports importing and exporting to/from text (.txt) files. "; } } public string DisplayName { get { return "Textfile support"; } } public Version Version { get { return new Version("1.0"); } } public Uri Website { get { return new Uri("http://nateshoffner.com"); } } public void Activate() { // not implemented } public void Deactivate() { // not implemented } public void Initialize() { // not implemented } public Type[] Types { get { return new[] {typeof (TextFileExporter), typeof (TextFileImporter)}; } } #endregion } }
#region using System; using Tabster.Core.Plugins; #endregion namespace TextFile { public class TextFilePlugin : ITabsterPlugin { #region Implementation of ITabsterPlugin public string Author { get { return "Nate Shoffner"; } } public string Copyright { get { return "Copyright © Nate Shoffner 2014"; } } public string Description { get { return "Supports importing and exporting to/from text (.txt) files. "; } } public string DisplayName { get { return "Textfile support"; } } public Version Version { get { return new Version("1.0"); } } public Uri Website { get { return new Uri("http://nateshoffner.com"); } } public void Activate() { // not implemented } public void Deactivate() { // not implemented } public Type[] Types { get { return new[] {typeof (TextFileExporter), typeof (TextFileImporter)}; } } #endregion } }
apache-2.0
C#
4d72e3115ebc871efa7a42989b2b69d16f76697c
Throw ArgumentException with clearer error rather than rely on exception from .First()
AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell
src/ResourceManager/Network/Commands.Network/VirtualNetwork/Subnet/GetAzureVirtualNetworkSubnetConfigCommand.cs
src/ResourceManager/Network/Commands.Network/VirtualNetwork/Subnet/GetAzureVirtualNetworkSubnetConfigCommand.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft 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 Microsoft.Azure.Commands.Network.Models; using System; using System.Linq; using System.Management.Automation; namespace Microsoft.Azure.Commands.Network { [Cmdlet(VerbsCommon.Get, "AzureRmVirtualNetworkSubnetConfig"), OutputType(typeof(PSSubnet))] public class GetAzureVirtualNetworkSubnetConfigCommand : NetworkBaseCmdlet { [Parameter( Mandatory = false, HelpMessage = "The name of the subnet")] public string Name { get; set; } [Parameter( Mandatory = true, ValueFromPipeline = true, HelpMessage = "The virtualNetwork")] public PSVirtualNetwork VirtualNetwork { get; set; } public override void Execute() { base.Execute(); if (!string.IsNullOrEmpty(this.Name)) { var subnet = this.VirtualNetwork.Subnets.FirstOrDefault( resource => string.Equals(resource.Name, this.Name, StringComparison.CurrentCultureIgnoreCase)); if (subnet == null) { throw new ArgumentException("Subnet with the specified name does not exist"); } WriteObject(subnet); } else { var subnets = this.VirtualNetwork.Subnets; WriteObject(subnets, true); } } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft 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 Microsoft.Azure.Commands.Network.Models; using System.Linq; using System.Management.Automation; namespace Microsoft.Azure.Commands.Network { [Cmdlet(VerbsCommon.Get, "AzureRmVirtualNetworkSubnetConfig"), OutputType(typeof(PSSubnet))] public class GetAzureVirtualNetworkSubnetConfigCommand : NetworkBaseCmdlet { [Parameter( Mandatory = false, HelpMessage = "The name of the subnet")] public string Name { get; set; } [Parameter( Mandatory = true, ValueFromPipeline = true, HelpMessage = "The virtualNetwork")] public PSVirtualNetwork VirtualNetwork { get; set; } public override void Execute() { base.Execute(); if (!string.IsNullOrEmpty(this.Name)) { var subnet = this.VirtualNetwork.Subnets.First( resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); WriteObject(subnet); } else { var subnets = this.VirtualNetwork.Subnets; WriteObject(subnets, true); } } } }
apache-2.0
C#
4d312e3b7592d761466f31801e8be96616d8ecab
Fix eichenwalde crash
overtools/OWLib,kerzyte/OWLib
OWLib/Types/Map/Map0B.cs
OWLib/Types/Map/Map0B.cs
using System.IO; using System.Runtime.InteropServices; namespace OWLib.Types.Map { public class Map0B : IMapFormat { public ushort Identifier => 0xB; public string Name => "Prop Models"; [StructLayout(LayoutKind.Sequential, Pack = 4)] public unsafe struct Map0BHeader { public ulong binding; public ulong unk0; public MapVec3 position; public MapVec3 scale; public MapQuat rotation; public ushort extraCount; public ushort unk1; public fixed uint unk2[11]; } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct Map0BExtra { public uint unk1; public uint unk2; } private Map0BHeader header; public Map0BHeader Header => header; private Map0BExtra[] extra; public Map0BExtra[] Extra => extra; public ulong ModelKey = 0; public ulong MaterialKey = 0; public void Read(Stream data) { using(BinaryReader reader = new BinaryReader(data, System.Text.Encoding.Default, true)) { header = reader.Read<Map0BHeader>(); extra = new Map0BExtra[header.extraCount]; for(uint i = 0; i < header.extraCount; ++i) { extra[i] = reader.Read<Map0BExtra>(); } } } } }
using System.IO; using System.Runtime.InteropServices; namespace OWLib.Types.Map { public class Map0B : IMapFormat { public ushort Identifier => 0xB; public string Name => "Prop Models"; [StructLayout(LayoutKind.Sequential, Pack = 4)] public unsafe struct Map0BHeader { public ulong binding; public ulong unk1; public MapVec3 position; public MapVec3 scale; public MapQuat rotation; public uint extraCount; public fixed uint unk[11]; } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct Map0BExtra { public uint unk1; public uint unk2; } private Map0BHeader header; public Map0BHeader Header => header; private Map0BExtra[] extra; public Map0BExtra[] Extra => extra; public ulong ModelKey = 0; public ulong MaterialKey = 0; public void Read(Stream data) { using(BinaryReader reader = new BinaryReader(data, System.Text.Encoding.Default, true)) { header = reader.Read<Map0BHeader>(); extra = new Map0BExtra[header.extraCount]; for(uint i = 0; i < header.extraCount; ++i) { extra[i] = reader.Read<Map0BExtra>(); } } } } }
mit
C#
1ec305e10d4ba70ee06a9f21bb3087e0d2e245e9
Update TaskChain to use ContinueWithSequential internally
NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,smoogipooo/osu
osu.Game/Utils/TaskChain.cs
osu.Game/Utils/TaskChain.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using System.Threading; using System.Threading.Tasks; using osu.Game.Extensions; namespace osu.Game.Utils { /// <summary> /// A chain of <see cref="Task"/>s that run sequentially. /// </summary> public class TaskChain { private readonly object taskLock = new object(); private Task lastTaskInChain = Task.CompletedTask; /// <summary> /// Adds a new task to the end of this <see cref="TaskChain"/>. /// </summary> /// <param name="action">The action to be executed.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for this task. Does not affect further tasks in the chain.</param> /// <returns>The awaitable <see cref="Task"/>.</returns> public Task Add(Action action, CancellationToken cancellationToken = default) { lock (taskLock) return lastTaskInChain = lastTaskInChain.ContinueWithSequential(action, cancellationToken); } /// <summary> /// Adds a new task to the end of this <see cref="TaskChain"/>. /// </summary> /// <param name="task">The task to be executed.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for this task. Does not affect further tasks in the chain.</param> /// <returns>The awaitable <see cref="Task"/>.</returns> public Task Add(Func<Task> task, CancellationToken cancellationToken = default) { lock (taskLock) return lastTaskInChain = lastTaskInChain.ContinueWithSequential(task, cancellationToken); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using System.Threading; using System.Threading.Tasks; namespace osu.Game.Utils { /// <summary> /// A chain of <see cref="Task"/>s that run sequentially. /// </summary> public class TaskChain { private readonly object finalTaskLock = new object(); private Task? finalTask; /// <summary> /// Adds a new task to the end of this <see cref="TaskChain"/>. /// </summary> /// <param name="action">The action to be executed.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for this task. Does not affect further tasks in the chain.</param> /// <returns>The awaitable <see cref="Task"/>.</returns> public async Task Add(Action action, CancellationToken cancellationToken = default) { Task? previousTask; Task currentTask; lock (finalTaskLock) { previousTask = finalTask; finalTask = currentTask = new Task(action, cancellationToken); } if (previousTask != null) await previousTask; currentTask.Start(); await currentTask; } } }
mit
C#
733ce5f0258bb34948c1017075278610b915fa9a
Simplify Example App More
jwmarsden/Kinetic3
Kinetic/Kinetic-Example/K3TestApplication1.cs
Kinetic/Kinetic-Example/K3TestApplication1.cs
using System; using System.Drawing; using Kinetic.Base; using Kinetic.IO; using Kinetic.Common; using Kinetic.Math; using Kinetic.Scene; using Kinetic.Resource; using Kinetic.Render; using OpenTK; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; namespace KineticExample { public class K3TestApplication1: BaseApplication { Texture _kineticBannerTexture = null; public K3TestApplication1 () { } public override void Initialize() { MainDisplay.SetTitle("Kinetic K3"); string[] extensions = MainDisplay.SupportedExtensions(); Console.Write("Supported Extensions: "); foreach (string extension in extensions) { Console.Write(string.Format("{0}", extension)); } Console.Write("\r\n"); _kineticBannerTexture = ResourceManager.ImportTexture(MainRenderer.Catalog, "KineticBanner", "KineticBanner.jpg"); } public override void Update(long time) { } public override void ApplicationRender() { MainRenderer.DrawTexture(_kineticBannerTexture); } public static void Main (string[] args) { Console.WriteLine("Running Application."); K3TestApplication1 k3App1 = new K3TestApplication1(); k3App1.start(); } } }
using System; using System.Drawing; using Kinetic.Base; using Kinetic.IO; using Kinetic.Common; using Kinetic.Math; using Kinetic.Scene; using Kinetic.Resource; using Kinetic.Render; using OpenTK; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; namespace KineticExample { public class K3TestApplication1: BaseApplication { Texture _kineticBannerTexture = null; public K3TestApplication1 () { } public override void Initialize() { Display display = _displays[0]; display.SetTitle("Kinetic K3"); string[] extensions = display.SupportedExtensions(); Console.Write("Supported Extensions: "); foreach (string extension in extensions) { Console.Write(string.Format("{0}", extension)); } Console.Write("\r\n"); _kineticBannerTexture = ResourceManager.ImportTexture(MainRenderer.Catalog, "KineticBanner", "KineticBanner.jpg"); } public override void Update(long time) { } public override void ApplicationRender() { MainRenderer.DrawTexture(_kineticBannerTexture); } public static void Main (string[] args) { Console.WriteLine("Running Application."); K3TestApplication1 k3App1 = new K3TestApplication1(); k3App1.start(); } } }
apache-2.0
C#
5e15cc805de34106dcf36215d2228437edb50e6d
bump to v0.1.18
abelsilva/swaggerwcf
src/SwaggerWcf/Properties/AssemblyInfo.cs
src/SwaggerWcf/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("SwaggerWcf")] [assembly: AssemblyDescription("Swagger for WCF")] [assembly: AssemblyCompany("abelsilva")] [assembly: AssemblyProduct("SwaggerWcf")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif // 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("d2eeaa63-60e5-4fda-8b62-e05dc8be8b5f")] // 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.1.18")] [assembly: AssemblyFileVersion("0.1.18")] [assembly: AssemblyInformationalVersion("0.1.18")]
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("SwaggerWcf")] [assembly: AssemblyDescription("Swagger for WCF")] [assembly: AssemblyCompany("abelsilva")] [assembly: AssemblyProduct("SwaggerWcf")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif // 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("d2eeaa63-60e5-4fda-8b62-e05dc8be8b5f")] // 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.1.17")] [assembly: AssemblyFileVersion("0.1.17")] [assembly: AssemblyInformationalVersion("0.1.17")]
apache-2.0
C#
e8c4754b989ac2fafbcd50e7ed5e3c727c2d6922
fix 'secrets.json' was not found
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Configuration/AppConfigurations.cs
aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Configuration/AppConfigurations.cs
using System.Collections.Concurrent; using Microsoft.Extensions.Configuration; using Abp.Extensions; using Abp.Reflection.Extensions; namespace AbpCompanyName.AbpProjectName.Configuration { public static class AppConfigurations { private static readonly ConcurrentDictionary<string, IConfigurationRoot> _configurationCache; static AppConfigurations() { _configurationCache = new ConcurrentDictionary<string, IConfigurationRoot>(); } public static IConfigurationRoot Get(string path, string environmentName = null, bool addUserSecrets = false) { var cacheKey = path + "#" + environmentName + "#" + addUserSecrets; return _configurationCache.GetOrAdd( cacheKey, _ => BuildConfiguration(path, environmentName, addUserSecrets) ); } private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null, bool addUserSecrets = false) { var builder = new ConfigurationBuilder() .SetBasePath(path) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); if (!environmentName.IsNullOrWhiteSpace()) { builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true); } builder = builder.AddEnvironmentVariables(); if (addUserSecrets) { builder.AddUserSecrets(typeof(AppConfigurations).GetAssembly(), optional: true); } return builder.Build(); } } }
using System.Collections.Concurrent; using Microsoft.Extensions.Configuration; using Abp.Extensions; using Abp.Reflection.Extensions; namespace AbpCompanyName.AbpProjectName.Configuration { public static class AppConfigurations { private static readonly ConcurrentDictionary<string, IConfigurationRoot> _configurationCache; static AppConfigurations() { _configurationCache = new ConcurrentDictionary<string, IConfigurationRoot>(); } public static IConfigurationRoot Get(string path, string environmentName = null, bool addUserSecrets = false) { var cacheKey = path + "#" + environmentName + "#" + addUserSecrets; return _configurationCache.GetOrAdd( cacheKey, _ => BuildConfiguration(path, environmentName, addUserSecrets) ); } private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null, bool addUserSecrets = false) { var builder = new ConfigurationBuilder() .SetBasePath(path) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); if (!environmentName.IsNullOrWhiteSpace()) { builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true); } builder = builder.AddEnvironmentVariables(); if (addUserSecrets) { builder.AddUserSecrets(typeof(AppConfigurations).GetAssembly()); } return builder.Build(); } } }
mit
C#
01b1690708bf289a24b6a30bfca8ce0e820ed0a9
Add AssertConfigurationIsValid test for missing ctor parameter
kendaleiv/di-servicelocation-structuremap,kendaleiv/di-servicelocation-structuremap,kendaleiv/di-servicelocation-structuremap
Tests/ValidationTests.cs
Tests/ValidationTests.cs
using Core; using StructureMap; using System; using Xunit; namespace Tests { public class ValidationTests { [Fact] public void MissingRequiredConstructorArgument() { var container = new Container(x => { x.For<IService>().Use<ServiceWithCtorArg>(); }); Assert.Throws<StructureMapConfigurationException>( () => container.AssertConfigurationIsValid()); } [Fact] public void VerifyValidConfiguration() { var container = new Container(x => { x.For<IService>().Use<Service>(); }); container.AssertConfigurationIsValid(); } [Fact] public void VerifyInvalidConfiguration() { var container = new Container(x => { x.For<IService>().Use<BrokenService>(); }); Assert.Throws<StructureMapConfigurationException>( () => container.AssertConfigurationIsValid()); } public class BrokenService : IService { public string Id { get; private set; } [ValidationMethod] public void BrokenMethod() { throw new ApplicationException(); } } } }
using Core; using StructureMap; using System; using Xunit; namespace Tests { public class ValidationTests { [Fact] public void VerifyValidConfiguration() { var container = new Container(x => { x.For<IService>().Use<Service>(); }); container.AssertConfigurationIsValid(); } [Fact] public void VerifyInvalidConfiguration() { var container = new Container(x => { x.For<IService>().Use<BrokenService>(); }); Assert.Throws<StructureMapConfigurationException>( () => container.AssertConfigurationIsValid()); } public class BrokenService : IService { public string Id { get; private set; } [ValidationMethod] public void BrokenMethod() { throw new ApplicationException(); } } } }
mit
C#
3bde637695324eb018e94a3b57c4688537733d2d
Fix warning
solarwinds/OrionSDK
Src/SwqlStudio/MainForm.ApplicationService.cs
Src/SwqlStudio/MainForm.ApplicationService.cs
using System.Windows.Forms; using SwqlStudio.Metadata; using SwqlStudio.Subscriptions; namespace SwqlStudio { partial class MainForm : IApplicationService { public SubscriptionManager SubscriptionManager { get; } = new SubscriptionManager(); public void AddTextToEditor(string text, ConnectionInfo info) { if (info == null) info = ActiveConnectionInfo; CreateQueryTab(info.Title, info); ActiveQueryTab.QueryText = text; } public void OpenActivityMonitor(string title, ConnectionInfo info) { var tab = new TabPage(title) { BorderStyle = BorderStyle.None, Padding = new Padding(0) }; var activityMonitorTab = new ActivityMonitorTab { ConnectionInfo = info, Dock = DockStyle.Fill, ApplicationService = this }; tab.Controls.Add(activityMonitorTab); fileTabs.Controls.Add(tab); fileTabs.SelectedTab = tab; activityMonitorTab.Start(); } public void OpenInvokeTab(string title, ConnectionInfo info, Verb verb) { var tab = new TabPage(title) { BorderStyle = BorderStyle.None, Padding = new Padding(0) }; var invokeVerbTab = new InvokeVerbTab { ConnectionInfo = info, Dock = DockStyle.Fill, ApplicationService = this, Verb = verb }; tab.Controls.Add(invokeVerbTab); fileTabs.Controls.Add(tab); fileTabs.SelectedTab = tab; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using SwqlStudio.Metadata; using SwqlStudio.Subscriptions; namespace SwqlStudio { partial class MainForm : IApplicationService { public event EventHandler<IndicationEventArgs> IndicationReceived; public SubscriptionManager SubscriptionManager { get; } = new SubscriptionManager(); public void AddTextToEditor(string text, ConnectionInfo info) { if (info == null) info = ActiveConnectionInfo; CreateQueryTab(info.Title, info); ActiveQueryTab.QueryText = text; } public void OpenActivityMonitor(string title, ConnectionInfo info) { var tab = new TabPage(title) { BorderStyle = BorderStyle.None, Padding = new Padding(0) }; var activityMonitorTab = new ActivityMonitorTab { ConnectionInfo = info, Dock = DockStyle.Fill, ApplicationService = this }; tab.Controls.Add(activityMonitorTab); fileTabs.Controls.Add(tab); fileTabs.SelectedTab = tab; activityMonitorTab.Start(); } public void OpenInvokeTab(string title, ConnectionInfo info, Verb verb) { var tab = new TabPage(title) { BorderStyle = BorderStyle.None, Padding = new Padding(0) }; var invokeVerbTab = new InvokeVerbTab { ConnectionInfo = info, Dock = DockStyle.Fill, ApplicationService = this, Verb = verb }; tab.Controls.Add(invokeVerbTab); fileTabs.Controls.Add(tab); fileTabs.SelectedTab = tab; } } }
apache-2.0
C#
97658c2c8c479c035458ffaa41db3311f8f2435e
Use anchor tag helper instead of hard coded href
seancpeters/templating,mlorbetske/templating,seancpeters/templating,seancpeters/templating,mlorbetske/templating,seancpeters/templating
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Pages/Account/Manage/Disable2fa.cshtml
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Pages/Account/Manage/Disable2fa.cshtml
@page @model Disable2faModel @{ ViewData["Title"] = "Disable two-factor authentication (2FA)"; ViewData["ActivePage"] = "TwoFactorAuthentication"; } <h2>@ViewData["Title"]</h2> <div class="alert alert-warning" role="alert"> <p> <span class="glyphicon glyphicon-warning-sign"></span> <strong>This action only disables 2FA.</strong> </p> <p> Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key used in an authenticator app you should <a asp-page="./ResetAuthenticator">reset your authenticator keys.</a> </p> </div> <div> <form method="post" class="form-group"> <button class="btn btn-danger" type="submit">Disable 2FA</button> </form> </div>
@page @model Disable2faModel @{ ViewData["Title"] = "Disable two-factor authentication (2FA)"; ViewData["ActivePage"] = "TwoFactorAuthentication"; } <h2>@ViewData["Title"]</h2> <div class="alert alert-warning" role="alert"> <p> <span class="glyphicon glyphicon-warning-sign"></span> <strong>This action only disables 2FA.</strong> </p> <p> Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key used in an authenticator app you should <a href="./ResetAuthenticator">reset your authenticator keys.</a> </p> </div> <div> <form method="post" class="form-group"> <button class="btn btn-danger" type="submit">Disable 2FA</button> </form> </div>
mit
C#
4e1592406296bf142e833a60bdb395ae4c8e222e
Add missing property ExpressionBlockNode::Expression:IExpression
jcracknell/emd,jcracknell/emd
cs/src/emd.cs/Nodes/ExpressionBlockNode.cs
cs/src/emd.cs/Nodes/ExpressionBlockNode.cs
using emd.cs.Expressions; using pegleg.cs.Parsing; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace emd.cs.Nodes { public class ExpressionBlockNode : IBlockNode { private readonly IExpression _expression; private readonly SourceRange _sourceRange; public ExpressionBlockNode(IExpression expression, SourceRange sourceRange) { if(null == expression) throw ExceptionBecause.ArgumentNull(() => expression); if(null == sourceRange) throw ExceptionBecause.ArgumentNull(() => sourceRange); _expression = expression; _sourceRange = sourceRange; } public SourceRange SourceRange { get { return _sourceRange; } } public IExpression Expression { get { return _expression; } } public void HandleWith(INodeHandler handler) { handler.Handle(this); } public T HandleWith<T>(INodeHandler<T> handler) { return handler.Handle(this); } } }
using emd.cs.Expressions; using pegleg.cs.Parsing; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace emd.cs.Nodes { public class ExpressionBlockNode : IBlockNode { private readonly IExpression _expression; private readonly SourceRange _sourceRange; public ExpressionBlockNode(IExpression expression, SourceRange sourceRange) { if(null == expression) throw ExceptionBecause.ArgumentNull(() => expression); if(null == sourceRange) throw ExceptionBecause.ArgumentNull(() => sourceRange); _expression = expression; _sourceRange = sourceRange; } public SourceRange SourceRange { get { return _sourceRange; } } public void HandleWith(INodeHandler handler) { handler.Handle(this); } public T HandleWith<T>(INodeHandler<T> handler) { return handler.Handle(this); } } }
mit
C#
94e65a324456172971e1b387f039ec1fd7343c0d
Fix settings checkboxes not being searchable
ppy/osu,ppy/osu,peppy/osu,ZLima12/osu,NeoAdonis/osu,johnneijzen/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu,2yangk23/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,2yangk23/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,ZLima12/osu
osu.Game/Overlays/Settings/SettingsCheckbox.cs
osu.Game/Overlays/Settings/SettingsCheckbox.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings { public class SettingsCheckbox : SettingsItem<bool> { private OsuCheckbox checkbox; private string labelText; protected override Drawable CreateControl() => checkbox = new OsuCheckbox(); public override string LabelText { get => labelText; set => checkbox.LabelText = labelText = value; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings { public class SettingsCheckbox : SettingsItem<bool> { private OsuCheckbox checkbox; protected override Drawable CreateControl() => checkbox = new OsuCheckbox(); public override string LabelText { set => checkbox.LabelText = value; } } }
mit
C#
cf1dc2c93dc4f7acd829ebec441edf79139e6afb
Fix PublishLater view
geertdoornbos/Orchard,SeyDutch/Airbrush,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,huoxudong125/Orchard,jtkech/Orchard,sfmskywalker/Orchard,planetClaire/Orchard-LETS,xkproject/Orchard,Morgma/valleyviewknolls,xkproject/Orchard,LaserSrl/Orchard,AEdmunds/beautiful-springtime,smartnet-developers/Orchard,AdvantageCS/Orchard,mgrowan/Orchard,austinsc/Orchard,neTp9c/Orchard,kouweizhong/Orchard,Inner89/Orchard,angelapper/Orchard,Dolphinsimon/Orchard,marcoaoteixeira/Orchard,tobydodds/folklife,austinsc/Orchard,jtkech/Orchard,fassetar/Orchard,bedegaming-aleksej/Orchard,Cphusion/Orchard,arminkarimi/Orchard,armanforghani/Orchard,grapto/Orchard.CloudBust,Praggie/Orchard,Anton-Am/Orchard,jerryshi2007/Orchard,qt1/orchard4ibn,jerryshi2007/Orchard,Serlead/Orchard,Dolphinsimon/Orchard,jimasp/Orchard,aaronamm/Orchard,phillipsj/Orchard,sebastienros/msc,omidnasri/Orchard,enspiral-dev-academy/Orchard,dozoft/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,sfmskywalker/Orchard,mgrowan/Orchard,jchenga/Orchard,TaiAivaras/Orchard,Fogolan/OrchardForWork,spraiin/Orchard,infofromca/Orchard,dburriss/Orchard,dozoft/Orchard,Praggie/Orchard,angelapper/Orchard,planetClaire/Orchard-LETS,hhland/Orchard,MetSystem/Orchard,salarvand/orchard,Anton-Am/Orchard,qt1/orchard4ibn,Cphusion/Orchard,armanforghani/Orchard,spraiin/Orchard,SouleDesigns/SouleDesigns.Orchard,cryogen/orchard,abhishekluv/Orchard,Fogolan/OrchardForWork,AndreVolksdorf/Orchard,emretiryaki/Orchard,kouweizhong/Orchard,Serlead/Orchard,ehe888/Orchard,SeyDutch/Airbrush,m2cms/Orchard,Lombiq/Orchard,oxwanawxo/Orchard,jchenga/Orchard,RoyalVeterinaryCollege/Orchard,dburriss/Orchard,vard0/orchard.tan,jtkech/Orchard,sfmskywalker/Orchard,cooclsee/Orchard,jimasp/Orchard,vairam-svs/Orchard,kgacova/Orchard,MetSystem/Orchard,yonglehou/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,escofieldnaxos/Orchard,patricmutwiri/Orchard,luchaoshuai/Orchard,DonnotRain/Orchard,stormleoxia/Orchard,JRKelso/Orchard,JRKelso/Orchard,SzymonSel/Orchard,Codinlab/Orchard,KeithRaven/Orchard,mvarblow/Orchard,gcsuk/Orchard,rtpHarry/Orchard,harmony7/Orchard,andyshao/Orchard,li0803/Orchard,OrchardCMS/Orchard-Harvest-Website,OrchardCMS/Orchard,escofieldnaxos/Orchard,vairam-svs/Orchard,asabbott/chicagodevnet-website,li0803/Orchard,TalaveraTechnologySolutions/Orchard,salarvand/Portal,jaraco/orchard,sfmskywalker/Orchard,MpDzik/Orchard,Cphusion/Orchard,arminkarimi/Orchard,OrchardCMS/Orchard-Harvest-Website,Dolphinsimon/Orchard,gcsuk/Orchard,MpDzik/Orchard,vard0/orchard.tan,luchaoshuai/Orchard,jimasp/Orchard,Ermesx/Orchard,planetClaire/Orchard-LETS,bigfont/orchard-cms-modules-and-themes,infofromca/Orchard,Praggie/Orchard,OrchardCMS/Orchard,dburriss/Orchard,m2cms/Orchard,SzymonSel/Orchard,jaraco/orchard,yersans/Orchard,smartnet-developers/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,huoxudong125/Orchard,alejandroaldana/Orchard,hannan-azam/Orchard,asabbott/chicagodevnet-website,Sylapse/Orchard.HttpAuthSample,brownjordaninternational/OrchardCMS,AdvantageCS/Orchard,planetClaire/Orchard-LETS,IDeliverable/Orchard,sfmskywalker/Orchard,RoyalVeterinaryCollege/Orchard,OrchardCMS/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,rtpHarry/Orchard,johnnyqian/Orchard,dcinzona/Orchard-Harvest-Website,hhland/Orchard,LaserSrl/Orchard,bigfont/orchard-continuous-integration-demo,salarvand/Portal,geertdoornbos/Orchard,emretiryaki/Orchard,phillipsj/Orchard,TaiAivaras/Orchard,cryogen/orchard,qt1/Orchard,hhland/Orchard,JRKelso/Orchard,mvarblow/Orchard,sebastienros/msc,SouleDesigns/SouleDesigns.Orchard,IDeliverable/Orchard,MpDzik/Orchard,kgacova/Orchard,openbizgit/Orchard,alejandroaldana/Orchard,OrchardCMS/Orchard,alejandroaldana/Orchard,Codinlab/Orchard,Ermesx/Orchard,gcsuk/Orchard,dcinzona/Orchard-Harvest-Website,Fogolan/OrchardForWork,xiaobudian/Orchard,rtpHarry/Orchard,jaraco/orchard,qt1/Orchard,armanforghani/Orchard,yonglehou/Orchard,smartnet-developers/Orchard,dcinzona/Orchard,dozoft/Orchard,jersiovic/Orchard,stormleoxia/Orchard,tobydodds/folklife,Morgma/valleyviewknolls,bigfont/orchard-cms-modules-and-themes,enspiral-dev-academy/Orchard,qt1/orchard4ibn,luchaoshuai/Orchard,stormleoxia/Orchard,caoxk/orchard,xkproject/Orchard,abhishekluv/Orchard,Anton-Am/Orchard,cooclsee/Orchard,marcoaoteixeira/Orchard,qt1/orchard4ibn,spraiin/Orchard,neTp9c/Orchard,jerryshi2007/Orchard,jersiovic/Orchard,emretiryaki/Orchard,qt1/Orchard,huoxudong125/Orchard,Ermesx/Orchard,harmony7/Orchard,qt1/Orchard,xiaobudian/Orchard,MpDzik/Orchard,grapto/Orchard.CloudBust,Sylapse/Orchard.HttpAuthSample,mvarblow/Orchard,kouweizhong/Orchard,andyshao/Orchard,KeithRaven/Orchard,RoyalVeterinaryCollege/Orchard,Morgma/valleyviewknolls,brownjordaninternational/OrchardCMS,patricmutwiri/Orchard,marcoaoteixeira/Orchard,andyshao/Orchard,asabbott/chicagodevnet-website,MetSystem/Orchard,kgacova/Orchard,rtpHarry/Orchard,Fogolan/OrchardForWork,mgrowan/Orchard,hannan-azam/Orchard,DonnotRain/Orchard,bedegaming-aleksej/Orchard,hhland/Orchard,vard0/orchard.tan,jagraz/Orchard,dcinzona/Orchard,jerryshi2007/Orchard,infofromca/Orchard,bedegaming-aleksej/Orchard,jagraz/Orchard,phillipsj/Orchard,NIKASoftwareDevs/Orchard,mgrowan/Orchard,sfmskywalker/Orchard,huoxudong125/Orchard,IDeliverable/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,sebastienros/msc,Lombiq/Orchard,yonglehou/Orchard,OrchardCMS/Orchard-Harvest-Website,kgacova/Orchard,Serlead/Orchard,openbizgit/Orchard,marcoaoteixeira/Orchard,planetClaire/Orchard-LETS,vard0/orchard.tan,salarvand/orchard,stormleoxia/Orchard,jimasp/Orchard,AdvantageCS/Orchard,omidnasri/Orchard,NIKASoftwareDevs/Orchard,KeithRaven/Orchard,OrchardCMS/Orchard-Harvest-Website,alejandroaldana/Orchard,yonglehou/Orchard,smartnet-developers/Orchard,TaiAivaras/Orchard,mvarblow/Orchard,jagraz/Orchard,Inner89/Orchard,fassetar/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,oxwanawxo/Orchard,NIKASoftwareDevs/Orchard,bigfont/orchard-cms-modules-and-themes,andyshao/Orchard,bedegaming-aleksej/Orchard,kouweizhong/Orchard,austinsc/Orchard,SzymonSel/Orchard,omidnasri/Orchard,Serlead/Orchard,jtkech/Orchard,emretiryaki/Orchard,bigfont/orchard-cms-modules-and-themes,TaiAivaras/Orchard,ericschultz/outercurve-orchard,AndreVolksdorf/Orchard,DonnotRain/Orchard,Serlead/Orchard,fortunearterial/Orchard,DonnotRain/Orchard,JRKelso/Orchard,MpDzik/Orchard,hbulzy/Orchard,yersans/Orchard,asabbott/chicagodevnet-website,harmony7/Orchard,SeyDutch/Airbrush,jagraz/Orchard,aaronamm/Orchard,AEdmunds/beautiful-springtime,LaserSrl/Orchard,qt1/Orchard,salarvand/orchard,patricmutwiri/Orchard,TalaveraTechnologySolutions/Orchard,ehe888/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,dcinzona/Orchard-Harvest-Website,Ermesx/Orchard,grapto/Orchard.CloudBust,MetSystem/Orchard,omidnasri/Orchard,neTp9c/Orchard,openbizgit/Orchard,tobydodds/folklife,vard0/orchard.tan,hannan-azam/Orchard,Ermesx/Orchard,grapto/Orchard.CloudBust,MpDzik/Orchard,aaronamm/Orchard,salarvand/Portal,TalaveraTechnologySolutions/Orchard,abhishekluv/Orchard,xiaobudian/Orchard,infofromca/Orchard,arminkarimi/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,AdvantageCS/Orchard,AEdmunds/beautiful-springtime,oxwanawxo/Orchard,SzymonSel/Orchard,infofromca/Orchard,xiaobudian/Orchard,jaraco/orchard,dcinzona/Orchard,Praggie/Orchard,enspiral-dev-academy/Orchard,qt1/orchard4ibn,KeithRaven/Orchard,openbizgit/Orchard,IDeliverable/Orchard,TaiAivaras/Orchard,Morgma/valleyviewknolls,arminkarimi/Orchard,aaronamm/Orchard,mvarblow/Orchard,bigfont/orchard-continuous-integration-demo,Morgma/valleyviewknolls,austinsc/Orchard,jersiovic/Orchard,Anton-Am/Orchard,TalaveraTechnologySolutions/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,fassetar/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,AndreVolksdorf/Orchard,rtpHarry/Orchard,Fogolan/OrchardForWork,qt1/orchard4ibn,dcinzona/Orchard-Harvest-Website,Praggie/Orchard,omidnasri/Orchard,oxwanawxo/Orchard,salarvand/Portal,yersans/Orchard,sebastienros/msc,escofieldnaxos/Orchard,ericschultz/outercurve-orchard,cooclsee/Orchard,DonnotRain/Orchard,dburriss/Orchard,TalaveraTechnologySolutions/Orchard,ehe888/Orchard,TalaveraTechnologySolutions/Orchard,abhishekluv/Orchard,RoyalVeterinaryCollege/Orchard,ericschultz/outercurve-orchard,AndreVolksdorf/Orchard,Codinlab/Orchard,cryogen/orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,luchaoshuai/Orchard,angelapper/Orchard,huoxudong125/Orchard,li0803/Orchard,oxwanawxo/Orchard,hhland/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,escofieldnaxos/Orchard,jersiovic/Orchard,Lombiq/Orchard,smartnet-developers/Orchard,tobydodds/folklife,johnnyqian/Orchard,hannan-azam/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,OrchardCMS/Orchard-Harvest-Website,spraiin/Orchard,fortunearterial/Orchard,Inner89/Orchard,marcoaoteixeira/Orchard,RoyalVeterinaryCollege/Orchard,armanforghani/Orchard,Lombiq/Orchard,Dolphinsimon/Orchard,geertdoornbos/Orchard,dozoft/Orchard,bedegaming-aleksej/Orchard,LaserSrl/Orchard,gcsuk/Orchard,sfmskywalker/Orchard,escofieldnaxos/Orchard,bigfont/orchard-continuous-integration-demo,m2cms/Orchard,omidnasri/Orchard,johnnyqian/Orchard,geertdoornbos/Orchard,andyshao/Orchard,enspiral-dev-academy/Orchard,vairam-svs/Orchard,alejandroaldana/Orchard,OrchardCMS/Orchard-Harvest-Website,harmony7/Orchard,m2cms/Orchard,xkproject/Orchard,IDeliverable/Orchard,arminkarimi/Orchard,caoxk/orchard,Inner89/Orchard,neTp9c/Orchard,xiaobudian/Orchard,Inner89/Orchard,TalaveraTechnologySolutions/Orchard,emretiryaki/Orchard,fassetar/Orchard,KeithRaven/Orchard,hbulzy/Orchard,yersans/Orchard,LaserSrl/Orchard,fortunearterial/Orchard,gcsuk/Orchard,patricmutwiri/Orchard,salarvand/orchard,bigfont/orchard-cms-modules-and-themes,AdvantageCS/Orchard,hannan-azam/Orchard,SouleDesigns/SouleDesigns.Orchard,fassetar/Orchard,sfmskywalker/Orchard,harmony7/Orchard,xkproject/Orchard,cryogen/orchard,yersans/Orchard,brownjordaninternational/OrchardCMS,hbulzy/Orchard,SouleDesigns/SouleDesigns.Orchard,jersiovic/Orchard,austinsc/Orchard,dcinzona/Orchard-Harvest-Website,omidnasri/Orchard,jchenga/Orchard,dcinzona/Orchard-Harvest-Website,jchenga/Orchard,jerryshi2007/Orchard,hbulzy/Orchard,caoxk/orchard,jagraz/Orchard,Sylapse/Orchard.HttpAuthSample,cooclsee/Orchard,vairam-svs/Orchard,angelapper/Orchard,yonglehou/Orchard,OrchardCMS/Orchard,jimasp/Orchard,kgacova/Orchard,fortunearterial/Orchard,Codinlab/Orchard,geertdoornbos/Orchard,luchaoshuai/Orchard,spraiin/Orchard,salarvand/Portal,tobydodds/folklife,grapto/Orchard.CloudBust,NIKASoftwareDevs/Orchard,jtkech/Orchard,phillipsj/Orchard,phillipsj/Orchard,Cphusion/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,vairam-svs/Orchard,salarvand/orchard,Dolphinsimon/Orchard,Sylapse/Orchard.HttpAuthSample,Codinlab/Orchard,AndreVolksdorf/Orchard,aaronamm/Orchard,stormleoxia/Orchard,dburriss/Orchard,sebastienros/msc,Anton-Am/Orchard,fortunearterial/Orchard,SeyDutch/Airbrush,johnnyqian/Orchard,armanforghani/Orchard,dozoft/Orchard,MetSystem/Orchard,brownjordaninternational/OrchardCMS,Sylapse/Orchard.HttpAuthSample,tobydodds/folklife,omidnasri/Orchard,enspiral-dev-academy/Orchard,dcinzona/Orchard,cooclsee/Orchard,neTp9c/Orchard,ehe888/Orchard,grapto/Orchard.CloudBust,vard0/orchard.tan,hbulzy/Orchard,ehe888/Orchard,Lombiq/Orchard,jchenga/Orchard,caoxk/orchard,ericschultz/outercurve-orchard,brownjordaninternational/OrchardCMS,li0803/Orchard,openbizgit/Orchard,TalaveraTechnologySolutions/Orchard,omidnasri/Orchard,NIKASoftwareDevs/Orchard,JRKelso/Orchard,dcinzona/Orchard,AEdmunds/beautiful-springtime,m2cms/Orchard,Cphusion/Orchard,SeyDutch/Airbrush,kouweizhong/Orchard,mgrowan/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,patricmutwiri/Orchard,angelapper/Orchard,bigfont/orchard-continuous-integration-demo,abhishekluv/Orchard,li0803/Orchard,abhishekluv/Orchard
src/Orchard.Web/Core/PublishLater/Views/Parts/PublishLater.Metadata.SummaryAdmin.cshtml
src/Orchard.Web/Core/PublishLater/Views/Parts/PublishLater.Metadata.SummaryAdmin.cshtml
@using Orchard.ContentManagement; @using Orchard.Core.Common.Models; @using Orchard.Core.PublishLater.Models; @{ PublishLaterPart publishLaterPart = Model.ContentPart; DateTime? versionPublishedUtc = publishLaterPart.As<CommonPart>() == null ? null : publishLaterPart.As<CommonPart>().VersionPublishedUtc; } <ul class="pageStatus"> <li>@* Published or not *@ @if (publishLaterPart.HasPublished()) { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/online.gif")" alt="@T("Online")" title="@T("The page is currently online")" /> <text>@T("Published")&nbsp;&#124;&nbsp;</text> } else { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/offline.gif")" alt="@T("Offline")" title="@T("The page is currently offline")" /> <text>@T("Not Published")&nbsp;&#124;&nbsp;</text> } </li> <li> @* Does the page have a draft *@ @if (publishLaterPart.HasDraft()) { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/draft.gif")" alt="@T("Draft")" title="@T("The page has a draft")" /><text> @T("Draft")&nbsp;&#124;&nbsp;</text> } else { <text>@T("No Draft")&nbsp;&#124;&nbsp;</text> } </li> @if ((((DateTime?)Model.ScheduledPublishUtc).HasValue && ((DateTime?)Model.ScheduledPublishUtc).Value > DateTime.UtcNow) || (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue)) { <li> @if (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue) { @T("Published: {0}", Html.DateTimeRelative(versionPublishedUtc.Value, T)) } else { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/scheduled.gif")" alt="@T("Scheduled")" title="@T("The page is scheduled for publishing")" /><text> @T("Scheduled") </text> @Html.DateTime(((DateTime?)Model.ScheduledPublishUtc).Value, T("M/d/yyyy h:mm tt")) }&nbsp;&#124;&nbsp;</li> } </ul>
@using Orchard.ContentManagement; @using Orchard.Core.Common.Models; @using Orchard.Core.PublishLater.Models; @{ PublishLaterPart publishLaterPart = Model.ContentPart; DateTime? versionPublishedUtc = publishLaterPart.As<CommonPart>() == null ? null : publishLaterPart.As<CommonPart>().VersionPublishedUtc; } <ul class="pageStatus"> <li>@* Published or not *@ @if (publishLaterPart.HasPublished()) { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/online.gif")" alt="@T("Online")" title="@T("The page is currently online")" /> <text>@T("Published")&nbsp;&#124;&nbsp;</text> } else { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/offline.gif")" alt="@T("Offline")" title="@T("The page is currently offline")" /> <text>@T("Not Published")&nbsp;&#124;&nbsp;</text> } </li> <li> @* Does the page have a draft *@ @if (publishLaterPart.HasDraft()) { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/draft.gif")" alt="@T("Draft")" title="@T("The page has a draft")" /><text> @T("Draft")&nbsp;&#124;&nbsp;</text> } else { <text>@T("No Draft")&nbsp;&#124;&nbsp;</text> } </li> @if ((((DateTime?)Model.ScheduledPublishUtc).HasValue && Model.ScheduledPublishUtc.Value > DateTime.UtcNow) || (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue)) { <li> @if (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue) { @T("Published: {0}", Html.DateTimeRelative(versionPublishedUtc.Value, T)) } else { <img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/scheduled.gif")" alt="@T("Scheduled")" title="@T("The page is scheduled for publishing")" /><text> @T("Scheduled") </text> @Html.DateTime((DateTime)Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt")) }&nbsp;&#124;&nbsp;</li> } </ul>
bsd-3-clause
C#
d6ace31b93f4ecdeaccc1a78b4de3418d963ab54
Update Start.cs
DYanis/UniversalNumeralSystems
ConvertorFromDecimalToBaseNumeralSystem/ConvertorFromDecimalToBaseNumeralSystem/Start.cs
ConvertorFromDecimalToBaseNumeralSystem/ConvertorFromDecimalToBaseNumeralSystem/Start.cs
using System; using System.Collections.Generic; using System.Linq; internal class Start { internal static void Main() { // Add numeral system keys. List<string> keys = new List<string>(); keys.Add("ZZZ0"); // 1 keys.Add("ZZZ1"); // 2 keys.Add("ZZZ2"); // 3 keys.Add("ZZZ3"); // 4 keys.Add("ZZZ4"); // 5 keys.Add("ZZZ5"); // 6 keys.Add("ZZZ6"); // 7 keys.Add("ZZZ7"); // 8 ulong decimalNumber = ulong.Parse(Console.ReadLine()); string convertedNumber = ConvertFromDecimalToBase(keys, decimalNumber); Console.WriteLine(convertedNumber); } internal static string ConvertFromDecimalToBase(List<string> keys, ulong decimalNumber) { if (decimalNumber == 0) { return keys[0]; } string baseNumber = string.Empty; while (decimalNumber > 0) { baseNumber = keys[(int)(decimalNumber % (ulong)keys.Count)] + baseNumber; decimalNumber /= (ulong)keys.Count; } return baseNumber; } }
using System; using System.Collections.Generic; using System.Linq; internal class Start { internal static void Main() { // Add numeral system keys. List<string> keys = new List<string>(); keys.Add("ZZZ0"); // 1 keys.Add("ZZZ1"); // 2 keys.Add("ZZZ2"); // 3 keys.Add("ZZZ3"); // 4 keys.Add("ZZZ4"); // 5 keys.Add("ZZZ5"); // 6 keys.Add("ZZZ6"); // 7 keys.Add("ZZZ7"); // 8 ulong decimalNumber = ulong.Parse(Console.ReadLine()); string convertedNumber = ConvertorFromDecimalToBase(keys, decimalNumber); Console.WriteLine(convertedNumber); } internal static string ConvertorFromDecimalToBase(List<string> keys, ulong decimalNumber) { if (decimalNumber == 0) { return keys[0]; } string baseNumber = string.Empty; while (decimalNumber > 0) { baseNumber = keys[(int)(decimalNumber % (ulong)keys.Count)] + baseNumber; decimalNumber /= (ulong)keys.Count; } return baseNumber; } }
mit
C#
7c222d046a4cc12046c55dc1451a6bede21d65aa
Allow deletion and reading of saved package information.
Craftitude-Team/Craftitude-Launcher,Craftitude-Team/Craftitude-Launcher
Craftitude-Api/RepositoryCache.cs
Craftitude-Api/RepositoryCache.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; using System.IO; using YaTools.Yaml; using Raven; using Raven.Client; using Raven.Client.Document; using Raven.Client.Embedded; using Raven.Storage; using Raven.Database; namespace Craftitude { public class RepositoryCache : IDisposable { internal EmbeddableDocumentStore _db; internal Cache _cache; internal RepositoryCache(Cache cache, string cacheId) { _cache = cache; _db = new EmbeddableDocumentStore() { DataDirectory = Path.Combine(_cache._path, cacheId) }; if (!Directory.Exists(_db.DataDirectory)) Directory.CreateDirectory(_db.DataDirectory); _db.Initialize(); } public void Dispose() { if (!_db.WasDisposed) _db.Dispose(); } public void DeletePackage(string id, Package package) { using (var session = _db.OpenSession()) { session.Delete(package); session.SaveChanges(); } } public void SavePackage(string id, Package package) { using (var session = _db.OpenSession()) { session.Store(package, id); session.SaveChanges(); } } public Package[] GetPackages(params string[] IDs) { using (var session = _db.OpenSession()) { return session.Load<Package>(IDs); } } public Package GetPackage(string ID) { using (var session = _db.OpenSession()) { return session.Load<Package>(ID); } } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; using System.IO; using YaTools.Yaml; using Raven; using Raven.Client; using Raven.Client.Document; using Raven.Client.Embedded; using Raven.Storage; using Raven.Database; namespace Craftitude { public class RepositoryCache : IDisposable { internal EmbeddableDocumentStore _db; internal Cache _cache; internal RepositoryCache(Cache cache, string cacheId) { _cache = cache; _db = new EmbeddableDocumentStore() { DataDirectory = Path.Combine(_cache._path, cacheId) }; if (!Directory.Exists(_db.DataDirectory)) Directory.CreateDirectory(_db.DataDirectory); _db.Initialize(); } public void Dispose() { if (!_db.WasDisposed) _db.Dispose(); } public void SavePackage(string id, Package package) { using (var session = _db.OpenSession()) { session.Store(package, id); } } } }
agpl-3.0
C#
b82ab2d43d32d8326e276a8a2ea3f1cfff5a3109
Split apart and made generic the interfaces for maps following interface segregation and CQRS
Journeyman08/Game
Engine/Engine/Mappings/Mapping.cs
Engine/Engine/Mappings/Mapping.cs
using Engine.Mappings.Coordinates; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Engine.Mappings { public interface IMapWriteable<T> { bool can_move(ICoordinate<T> startCoord, ICoordinate<T> endCoord); bool move(ICoordinate<T> startCoord, ICoordinate<T> endCoord); } public interface IMapReadable<T, S> { void print(); S get_pos(ICoordinate<T> coord); bool pos_exists(ICoordinate<T> coord); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Engine.Mappings { public interface IMapping<T> { void print(); T get_pos(ICoordinate coord); bool pos_exists(ICoordinate coord); bool add_to_pos(T addition, ICoordinate coord); bool remove_from_pos(ICoordinate coord); } public interface IMapUpdatable { bool can_move(ICoordinate startCoord, ICoordinate endCoord); bool move(ICoordinate startCoord, ICoordinate endCoord); } public interface IMapUpdateReadable<T> { void print(); T get_pos(ICoordinate coord); bool pos_exists(ICoordinate coord); } }
mit
C#
d2e2e44339e7307ce950576bf2e16ba8f91f77a6
Update MainStart
kawansoft/AceQL.Client
AceQL.Client.Tests/MainStart.cs
AceQL.Client.Tests/MainStart.cs
/* * This file is part of AceQL C# Client SDK. * AceQL C# Client SDK: Remote SQL access over HTTP with AceQL HTTP. * Copyright (C) 2017, KawanSoft SAS * (http://www.kawansoft.com). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AceQL.Client.Tests { class MainStart { static void Main(string[] args) { int mainToLaunch = 1; if (mainToLaunch == 1) { AceQLTest.TheMain(args); } else if (mainToLaunch == 2) { AceQLTestColumnAsKeyName.TheMain(args); } } } }
/* * This file is part of AceQL C# Client SDK. * AceQL C# Client SDK: Remote SQL access over HTTP with AceQL HTTP. * Copyright (C) 2017, KawanSoft SAS * (http://www.kawansoft.com). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AceQL.Client.Tests { class MainStart { static void Main(string[] args) { int mainToLaunch = 1; if (mainToLaunch == 1) { AceQLTest.TheMain(args); } else if (mainToLaunch == 2) { AceQLTestColumnAsKeyName.TheMain(args); } } } }
apache-2.0
C#
60fffea837e6933413f5b945eb55e47eeb25ce8d
fix 404
yar229/Mail.Ru-.net-cloud-client
MailRuCloudApi/SplittedCloud.cs
MailRuCloudApi/SplittedCloud.cs
using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace MailRuCloudApi { public class SplittedCloud : MailRuCloud { public SplittedCloud(string login, string password) : base(login, password) { } public override async Task<Entry> GetItems(string path) { Entry entry = await base.GetItems(path); if (null == entry) return null; var groupedFiles = entry.Files .GroupBy(f => Regex.Match(f.Name, @"(?<name>.*?)(\.wdmrc\.(crc|\d\d\d))?\Z").Groups["name"].Value, file => file) .Select(group => group.Count() == 1 ? group.First() : new SplittedFile(group.ToList())) .ToList(); var newEntry = new Entry(entry.Folders, groupedFiles, entry.FullPath); return newEntry; } } }
using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace MailRuCloudApi { public class SplittedCloud : MailRuCloud { public SplittedCloud(string login, string password) : base(login, password) { } public override async Task<Entry> GetItems(string path) { Entry entry = await base.GetItems(path); var groupedFiles = entry.Files .GroupBy(f => Regex.Match(f.Name, @"(?<name>.*?)(\.wdmrc\.(crc|\d\d\d))?\Z").Groups["name"].Value, file => file) .Select(group => group.Count() == 1 ? group.First() : new SplittedFile(group.ToList())) .ToList(); var newEntry = new Entry(entry.Folders, groupedFiles, entry.FullPath); return newEntry; } } }
mit
C#
91e881f5794556a5c5d3af89f17bd9cf923a9268
Update RuleUpdater.cs
win120a/ACClassRoomUtil,win120a/ACClassRoomUtil
ProcessBlockUtil/RuleUpdater.cs
ProcessBlockUtil/RuleUpdater.cs
/* Copyright (C) 2011-2014 AC Inc. (Andy Cheung) 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.Diagnostics; using System.ServiceProcess; using System.Threading; namespace ACProcessBlockUtil { class RuleUpdater { } }
apache-2.0
C#
7857565c47786a59825b2be7562f1e71bd14ade2
Make ReflectionExtension internal
Miaplaza/expression-utils
ExpressionUtils/ReflectionExtension.cs
ExpressionUtils/ReflectionExtension.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; namespace MiaPlaza.ExpressionUtils { /// <summary> /// Collects custom extension-methods to ease things we do with reflection /// </summary> internal static class ReflectionExtension { private static readonly BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy; /// <summary> /// Determines the implementation of an interface-property in an implementing type. /// </summary> public static PropertyInfo GetImplementationInfo(this PropertyInfo interfaceProperty, Type implementingType) { var interfaceGetter = interfaceProperty.GetGetMethod(); if (interfaceGetter != null) { var getterImpl = GetImplementationInfo(interfaceGetter, implementingType); return implementingType.GetProperties(bindingFlags | BindingFlags.GetProperty).FirstOrDefault(p => p.GetGetMethod(true) == getterImpl) ?? GetImplementationInfo(interfaceProperty, implementingType.BaseType); } var interfaceSetter = interfaceProperty.GetSetMethod(); if (interfaceSetter != null) { var setterImpl = GetImplementationInfo(interfaceSetter, implementingType); return implementingType.GetProperties(bindingFlags | BindingFlags.SetProperty).FirstOrDefault(p => p.GetSetMethod(true) == setterImpl) ?? GetImplementationInfo(interfaceProperty, implementingType.BaseType); } throw new InvalidOperationException("Properties must have at least a getter or setter!"); } /// <summary> /// Determines the implementation of an interface-property in an implementing type. /// </summary> public static MethodInfo GetImplementationInfo(this MethodInfo interfaceMethod, Type implementingType) { var interfaceType = interfaceMethod.DeclaringType; if(!interfaceType.IsInterface) throw new InvalidOperationException("Method is no interface-declaration!"); var interfaceMap = implementingType.GetInterfaceMap(interfaceType); for (int i = 0; i < interfaceMap.InterfaceMethods.Length; i++) if (interfaceMap.InterfaceMethods[i] == interfaceMethod) return interfaceMap.TargetMethods[i]; throw new InvalidOperationException("Interfaces must be implemented completly!"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; namespace MiaPlaza.ExpressionUtils { /// <summary> /// Collects custom extension-methods to ease things we do with reflection /// </summary> public static class ReflectionExtension { private static readonly BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy; /// <summary> /// Determines the implementation of an interface-property in an implementing type. /// </summary> public static PropertyInfo GetImplementationInfo(this PropertyInfo interfaceProperty, Type implementingType) { var interfaceGetter = interfaceProperty.GetGetMethod(); if (interfaceGetter != null) { var getterImpl = GetImplementationInfo(interfaceGetter, implementingType); return implementingType.GetProperties(bindingFlags | BindingFlags.GetProperty).FirstOrDefault(p => p.GetGetMethod(true) == getterImpl) ?? GetImplementationInfo(interfaceProperty, implementingType.BaseType); } var interfaceSetter = interfaceProperty.GetSetMethod(); if (interfaceSetter != null) { var setterImpl = GetImplementationInfo(interfaceSetter, implementingType); return implementingType.GetProperties(bindingFlags | BindingFlags.SetProperty).FirstOrDefault(p => p.GetSetMethod(true) == setterImpl) ?? GetImplementationInfo(interfaceProperty, implementingType.BaseType); } throw new InvalidOperationException("Properties must have at least a getter or setter!"); } /// <summary> /// Determines the implementation of an interface-property in an implementing type. /// </summary> public static MethodInfo GetImplementationInfo(this MethodInfo interfaceMethod, Type implementingType) { var interfaceType = interfaceMethod.DeclaringType; if(!interfaceType.IsInterface) throw new InvalidOperationException("Method is no interface-declaration!"); var interfaceMap = implementingType.GetInterfaceMap(interfaceType); for (int i = 0; i < interfaceMap.InterfaceMethods.Length; i++) if (interfaceMap.InterfaceMethods[i] == interfaceMethod) return interfaceMap.TargetMethods[i]; throw new InvalidOperationException("Interfaces must be implemented completly!"); } } }
mit
C#
dd2e037b9930cdf15b92d75e88626d9a334176da
Remove duplicates from sorted list - slower lol
Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews
LeetCode/remote/remove_duplicates_from_sorted_list.cs
LeetCode/remote/remove_duplicates_from_sorted_list.cs
// https://leetcode.com/submissions/detail/52724586/ // // // Submission Details // 164 / 164 test cases passed. // Status: Accepted // Runtime: 160 ms // // Submitted: 0 minutes ago // /** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int x) { val = x; } * } */ public class Solution { public ListNode DeleteDuplicates(ListNode head) { if (head == null || head.next == null) { return head; } head.next = DeleteDuplicates(head.next); return head.val == head.next.val ? head.next : head; } } // // Submission Details // 164 / 164 test cases passed. // Status: Accepted // Runtime: 164 ms // // Submitted: 0 minutes ago // /** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int x) { val = x; } * } */ public class Solution { public ListNode DeleteDuplicates(ListNode head) { var dummy = new ListNode(int.MaxValue); var it = dummy; while (head != null) { var next = head.next; if (it.val != head.val) { it.next = head; it = it.next; it.next = null; } head = next; } return dummy.next; } }
// https://leetcode.com/submissions/detail/52724586/ // // // Submission Details // 164 / 164 test cases passed. // Status: Accepted // Runtime: 160 ms // // Submitted: 0 minutes ago // /** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int x) { val = x; } * } */ public class Solution { public ListNode DeleteDuplicates(ListNode head) { if (head == null || head.next == null) { return head; } head.next = DeleteDuplicates(head.next); return head.val == head.next.val ? head.next : head; } }
mit
C#
58e4f2fa379b387d50e328c54101bdfb49ba4757
Check key is null if it's not defined [RED]
SuperDrew/MbDotNet,mattherman/MbDotNet,mattherman/MbDotNet
MbDotNet.Tests/Models/Imposters/HttpsImposterTests.cs
MbDotNet.Tests/Models/Imposters/HttpsImposterTests.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using MbDotNet.Enums; using MbDotNet.Models; using MbDotNet.Models.Imposters; namespace MbDotNet.Tests.Imposters { /// <summary> /// Summary description for ImposterTests /// </summary> [TestClass] public class HttpsImposterTests { #region Constructor Tests [TestMethod] public void Constructor_SetsPort() { const int port = 123; var imposter = new HttpsImposter(port, null); Assert.AreEqual(port, imposter.Port); } [TestMethod] public void Constructor_SetsProtocol() { var imposter = new HttpsImposter(123, null); Assert.AreEqual("https", imposter.Protocol); } [TestMethod] public void Constructor_SetsName() { const string expectedName = "Service"; var imposter = new HttpsImposter(123, expectedName); Assert.AreEqual(expectedName, imposter.Name); } [TestMethod] public void Constructor_InitializesStubsCollection() { var imposter = new HttpsImposter(123, null); Assert.IsNotNull(imposter.Stubs); } [TestMethod] public void Constructor_SetsKey() { var testKeyValue = "testKey"; var imposter = new HttpsImposter(123, null, testKeyValue); Assert.AreEqual(imposter.Key, testKeyValue); } [TestMethod] public void Constructor_SetsKeyAsNullWhenMissing() { var imposter = new HttpsImposter(123, null); Assert.IsNull(imposter.Key); } #endregion #region Stub Tests [TestMethod] public void AddStub_AddsStubToCollection() { var imposter = new HttpsImposter(123, null); imposter.AddStub(); Assert.AreEqual(1, imposter.Stubs.Count); } #endregion } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using MbDotNet.Enums; using MbDotNet.Models; using MbDotNet.Models.Imposters; namespace MbDotNet.Tests.Imposters { /// <summary> /// Summary description for ImposterTests /// </summary> [TestClass] public class HttpsImposterTests { #region Constructor Tests [TestMethod] public void Constructor_SetsPort() { const int port = 123; var imposter = new HttpsImposter(port, null); Assert.AreEqual(port, imposter.Port); } [TestMethod] public void Constructor_SetsProtocol() { var imposter = new HttpsImposter(123, null); Assert.AreEqual("https", imposter.Protocol); } [TestMethod] public void Constructor_SetsName() { const string expectedName = "Service"; var imposter = new HttpsImposter(123, expectedName); Assert.AreEqual(expectedName, imposter.Name); } [TestMethod] public void Constructor_InitializesStubsCollection() { var imposter = new HttpsImposter(123, null); Assert.IsNotNull(imposter.Stubs); } [TestMethod] public void Constructor_SetsKey() { var testKeyValue = "testKey"; var imposter = new HttpsImposter(123, null, testKeyValue); Assert.AreEqual(imposter.Key, testKeyValue); } #endregion #region Stub Tests [TestMethod] public void AddStub_AddsStubToCollection() { var imposter = new HttpsImposter(123, null); imposter.AddStub(); Assert.AreEqual(1, imposter.Stubs.Count); } #endregion } }
mit
C#
eda8d1ee51cfb1525806d54caa2f91b3f316a02c
Add headers
jkereako/PillBlasta
Assets/Scripts/Weapon/Weapon.cs
Assets/Scripts/Weapon/Weapon.cs
using UnityEngine; public enum FireMode { Automatic, Burst, Single} ; [RequireComponent(typeof(MuzzleFlash))] public class Weapon: MonoBehaviour { [Header("Weapon attributes")] public FireMode fireMode; public int burstCount = 3; public float fireRate = 100; public float muzzleVelocity = 35; [Header("Referenced objects")] public Transform muzzle; public Transform ejector; public Projectile projectile; public Transform shell; float nextShotTime; int shotsRemaining; float angleDampaningVelocity; Vector3 postitionDampaningVelocity; float recoilAngle; void Start() { Initialize(); } void LateUpdate() { // Reset the position of the weapon. Vector3 postitionDampaning; postitionDampaning = Vector3.SmoothDamp( transform.localPosition, Vector3.zero, ref postitionDampaningVelocity, 0.1f ); recoilAngle = Mathf.SmoothDamp(recoilAngle, 0, ref angleDampaningVelocity, 0.1f); transform.localPosition = postitionDampaning; transform.localEulerAngles += Vector3.left * recoilAngle; } public void OnTriggerPull() { if (shotsRemaining == 0 || Time.time < nextShotTime) { return; } Fire(); switch (fireMode) { case FireMode.Single: case FireMode.Burst: shotsRemaining -= 1; break; } } public void OnTriggerRelease() { Initialize(); } public void Aim(Vector3 point) { transform.LookAt(point); } void Fire() { Projectile aProjectile; MuzzleFlash muzzleFlash = GetComponent<MuzzleFlash>(); nextShotTime = Time.time + fireRate / 1000; aProjectile = Instantiate(projectile, muzzle.position, muzzle.rotation); aProjectile.SetSpeed(muzzleVelocity); Instantiate(shell, ejector.position, ejector.rotation); muzzleFlash.Animate(); AnimateRecoil(); } void AnimateRecoil() { recoilAngle += 8.0f; Mathf.Clamp(recoilAngle, 0, 30); // Move the weapon backward transform.localPosition -= Vector3.forward * 0.2f; } void Initialize() { switch (fireMode) { case FireMode.Single: shotsRemaining = 1; break; case FireMode.Burst: shotsRemaining = burstCount; break; case FireMode.Automatic: shotsRemaining = -1; break; } } }
using UnityEngine; public enum FireMode { Automatic, Burst, Single} ; [RequireComponent(typeof(MuzzleFlash))] public class Weapon: MonoBehaviour { public FireMode fireMode; public Transform muzzle; public Transform ejector; public Projectile projectile; public Transform shell; public int burstCount = 3; public float fireRate = 100; public float muzzleVelocity = 35; float nextShotTime; int shotsRemaining; float angleDampaningVelocity; Vector3 postitionDampaningVelocity; float recoilAngle; void Start() { Initialize(); } void LateUpdate() { // Reset the position of the weapon. Vector3 postitionDampaning; postitionDampaning = Vector3.SmoothDamp( transform.localPosition, Vector3.zero, ref postitionDampaningVelocity, 0.1f ); recoilAngle = Mathf.SmoothDamp(recoilAngle, 0, ref angleDampaningVelocity, 0.1f); transform.localPosition = postitionDampaning; transform.localEulerAngles += Vector3.left * recoilAngle; } public void OnTriggerPull() { if (shotsRemaining == 0 || Time.time < nextShotTime) { return; } Fire(); switch (fireMode) { case FireMode.Single: case FireMode.Burst: shotsRemaining -= 1; break; } } public void OnTriggerRelease() { Initialize(); } public void Aim(Vector3 point) { transform.LookAt(point); } void Fire() { Projectile aProjectile; MuzzleFlash muzzleFlash = GetComponent<MuzzleFlash>(); nextShotTime = Time.time + fireRate / 1000; aProjectile = Instantiate(projectile, muzzle.position, muzzle.rotation); aProjectile.SetSpeed(muzzleVelocity); Instantiate(shell, ejector.position, ejector.rotation); muzzleFlash.Animate(); AnimateRecoil(); } void AnimateRecoil() { recoilAngle += 8.0f; Mathf.Clamp(recoilAngle, 0, 30); // Move the weapon backward transform.localPosition -= Vector3.forward * 0.2f; } void Initialize() { switch (fireMode) { case FireMode.Single: shotsRemaining = 1; break; case FireMode.Burst: shotsRemaining = burstCount; break; case FireMode.Automatic: shotsRemaining = -1; break; } } }
mit
C#
e731c3f773d0e1ca641767b9afbdabcf0fd95a1e
Fix reservation
Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS
src/IFS.Web/Views/Upload/_UploadForm.Reservation.cshtml
src/IFS.Web/Views/Upload/_UploadForm.Reservation.cshtml
@model UploadModel <input asp-for="Expiration" type="hidden" value="@Model.Expiration.ToString("O")" /> <hr /> <div class="hidden"> <h4>Protect this download</h4> <div class="form-group"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="cbPasswordProtect" value="True" asp-for="EnablePasswordProtection"> <label class="custom-control-label" for="cbPasswordProtect">Password-protect this download</label> </div> </div> <div id="pPasswordProtect" class="form-group"> <label asp-for="Password">Download password</label> <input asp-for="Password" class="form-control" /> </div> </div>
@model UploadModel <input asp-for="Expiration" type="hidden" value="@Model.Expiration.ToString("O")" />
mit
C#
8aec42166d0a08f4ddf992c0027fd51182d8d0a1
Fix wording in PrincipalExtensions.cs summary (#17859)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Identity/Extensions.Core/src/PrincipalExtensions.cs
src/Identity/Extensions.Core/src/PrincipalExtensions.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. using System.Linq; using Microsoft.AspNetCore.Identity; namespace System.Security.Claims { /// <summary> /// Claims related extensions for <see cref="ClaimsPrincipal"/>. /// </summary> public static class PrincipalExtensions { /// <summary> /// Returns the value for the first claim of the specified type, otherwise null if the claim is not present. /// </summary> /// <param name="principal">The <see cref="ClaimsPrincipal"/> instance this method extends.</param> /// <param name="claimType">The claim type whose first value should be returned.</param> /// <returns>The value of the first instance of the specified claim type, or null if the claim is not present.</returns> public static string FindFirstValue(this ClaimsPrincipal principal, string claimType) { if (principal == null) { throw new ArgumentNullException(nameof(principal)); } var claim = principal.FindFirst(claimType); return claim != null ? claim.Value : null; } } }
// 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. using System.Linq; using Microsoft.AspNetCore.Identity; namespace System.Security.Claims { /// <summary> /// Claims related extensions for <see cref="ClaimsPrincipal"/>. /// </summary> public static class PrincipalExtensions { /// <summary> /// Returns the value for the first claim of the specified type otherwise null the claim is not present. /// </summary> /// <param name="principal">The <see cref="ClaimsPrincipal"/> instance this method extends.</param> /// <param name="claimType">The claim type whose first value should be returned.</param> /// <returns>The value of the first instance of the specified claim type, or null if the claim is not present.</returns> public static string FindFirstValue(this ClaimsPrincipal principal, string claimType) { if (principal == null) { throw new ArgumentNullException(nameof(principal)); } var claim = principal.FindFirst(claimType); return claim != null ? claim.Value : null; } } }
apache-2.0
C#
8d92330ad666dfee00e2fedb3f91882ccbbecd4c
Fix broken comments
kasperhhk/Umbraco-CMS,arknu/Umbraco-CMS,Phosworks/Umbraco-CMS,rasmusfjord/Umbraco-CMS,tompipe/Umbraco-CMS,Pyuuma/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,Phosworks/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,aadfPT/Umbraco-CMS,lars-erik/Umbraco-CMS,rasmuseeg/Umbraco-CMS,NikRimington/Umbraco-CMS,TimoPerplex/Umbraco-CMS,aaronpowell/Umbraco-CMS,leekelleher/Umbraco-CMS,gavinfaux/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,jchurchley/Umbraco-CMS,KevinJump/Umbraco-CMS,neilgaietto/Umbraco-CMS,engern/Umbraco-CMS,rustyswayne/Umbraco-CMS,dawoe/Umbraco-CMS,rasmusfjord/Umbraco-CMS,abryukhov/Umbraco-CMS,WebCentrum/Umbraco-CMS,kasperhhk/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,gkonings/Umbraco-CMS,leekelleher/Umbraco-CMS,gavinfaux/Umbraco-CMS,romanlytvyn/Umbraco-CMS,KevinJump/Umbraco-CMS,kgiszewski/Umbraco-CMS,TimoPerplex/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,abjerner/Umbraco-CMS,neilgaietto/Umbraco-CMS,aaronpowell/Umbraco-CMS,marcemarc/Umbraco-CMS,Phosworks/Umbraco-CMS,arknu/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mittonp/Umbraco-CMS,rustyswayne/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,Phosworks/Umbraco-CMS,madsoulswe/Umbraco-CMS,WebCentrum/Umbraco-CMS,KevinJump/Umbraco-CMS,neilgaietto/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,aaronpowell/Umbraco-CMS,jchurchley/Umbraco-CMS,kgiszewski/Umbraco-CMS,kasperhhk/Umbraco-CMS,abryukhov/Umbraco-CMS,engern/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,Spijkerboer/Umbraco-CMS,arknu/Umbraco-CMS,base33/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,rasmuseeg/Umbraco-CMS,romanlytvyn/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,aadfPT/Umbraco-CMS,base33/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,romanlytvyn/Umbraco-CMS,NikRimington/Umbraco-CMS,Spijkerboer/Umbraco-CMS,romanlytvyn/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mittonp/Umbraco-CMS,neilgaietto/Umbraco-CMS,marcemarc/Umbraco-CMS,gavinfaux/Umbraco-CMS,robertjf/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,gavinfaux/Umbraco-CMS,robertjf/Umbraco-CMS,rustyswayne/Umbraco-CMS,mittonp/Umbraco-CMS,bjarnef/Umbraco-CMS,neilgaietto/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,rasmusfjord/Umbraco-CMS,kasperhhk/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rasmuseeg/Umbraco-CMS,base33/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,TimoPerplex/Umbraco-CMS,engern/Umbraco-CMS,aadfPT/Umbraco-CMS,gkonings/Umbraco-CMS,madsoulswe/Umbraco-CMS,engern/Umbraco-CMS,sargin48/Umbraco-CMS,rasmusfjord/Umbraco-CMS,rustyswayne/Umbraco-CMS,gkonings/Umbraco-CMS,abryukhov/Umbraco-CMS,mittonp/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,gkonings/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,sargin48/Umbraco-CMS,sargin48/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,lars-erik/Umbraco-CMS,gkonings/Umbraco-CMS,gavinfaux/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,engern/Umbraco-CMS,hfloyd/Umbraco-CMS,tompipe/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,lars-erik/Umbraco-CMS,abjerner/Umbraco-CMS,sargin48/Umbraco-CMS,umbraco/Umbraco-CMS,Pyuuma/Umbraco-CMS,jchurchley/Umbraco-CMS,Pyuuma/Umbraco-CMS,marcemarc/Umbraco-CMS,Pyuuma/Umbraco-CMS,Spijkerboer/Umbraco-CMS,rasmusfjord/Umbraco-CMS,sargin48/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,bjarnef/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,lars-erik/Umbraco-CMS,TimoPerplex/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,kgiszewski/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,bjarnef/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,kasperhhk/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,mittonp/Umbraco-CMS,Phosworks/Umbraco-CMS,romanlytvyn/Umbraco-CMS,madsoulswe/Umbraco-CMS,lars-erik/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,rustyswayne/Umbraco-CMS,NikRimington/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,leekelleher/Umbraco-CMS,WebCentrum/Umbraco-CMS,Pyuuma/Umbraco-CMS
src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs
src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs
using System; namespace Umbraco.Core.PropertyEditors { /// <summary> /// Maps a property source value to a data object. /// </summary> // todo: drop IPropertyEditorValueConverter support (when?). [Obsolete("Use IPropertyValueConverter.")] public interface IPropertyEditorValueConverter { /// <summary> /// Returns a value indicating whether this provider applies to the specified property. /// </summary> /// <param name="datatypeGuid">A Guid identifying the property datatype.</param> /// <param name="contentTypeAlias">The content type alias.</param> /// <param name="propertyTypeAlias">The property alias.</param> /// <returns>True if this provider applies to the specified property.</returns> bool IsConverterFor(Guid datatypeGuid, string contentTypeAlias, string propertyTypeAlias); /// <summary> /// Attempts to convert a source value specified into a property model. /// </summary> /// <param name="sourceValue">The source value.</param> /// <returns>An <c>Attempt</c> representing the result of the conversion.</returns> /// <remarks>The source value is dependent on the content cache. With the Xml content cache it /// is always a string, but with other caches it may be an object (numeric, time...) matching /// what is in the database. Be prepared.</remarks> Attempt<object> ConvertPropertyValue(object sourceValue); } }
using System; namespace Umbraco.Core.PropertyEditors { /// Maps a property source value to a data object. /// </summary> // todo: drop IPropertyEditorValueConverter support (when?). [Obsolete("Use IPropertyValueConverter.")] public interface IPropertyEditorValueConverter { /// <summary> /// Returns a value indicating whether this provider applies to the specified property. /// </summary> /// <param name="datatypeGuid">A Guid identifying the property datatype.</param> /// <param name="contentTypeAlias">The content type alias.</param> /// <param name="propertyTypeAlias">The property alias.</param> /// <returns>True if this provider applies to the specified property.</returns> bool IsConverterFor(Guid datatypeGuid, string contentTypeAlias, string propertyTypeAlias); /// <summary> /// Attempts to convert a source value specified into a property model. /// </summary> /// <param name="sourceValue">The source value.</param> /// <returns>An <c>Attempt</c> representing the result of the conversion.</returns> /// <remarks>The source value is dependent on the content cache. With the Xml content cache it /// is always a string, but with other caches it may be an object (numeric, time...) matching /// what is in the database. Be prepared.</remarks> Attempt<object> ConvertPropertyValue(object sourceValue); } }
mit
C#
4391f221179160d5aa9426c5f8babc425a9671ac
Return correct positions from simple league
TheEadie/PlayerRank,TheEadie/PlayerRank
UnitTests/SimpleLeagueTests.cs
UnitTests/SimpleLeagueTests.cs
using System.Linq; using PlayerRank.Scoring; using PlayerRank.Scoring.Simple; using Xunit; namespace PlayerRank.UnitTests { public class SimpleLeagueTests { [Fact] public void CanRecordSimpleGameByScores() { var league = new League(); var game = new Game(); game.AddResult("Foo", new Points(5)); game.AddResult("Bar", new Points(1)); league.RecordGame(game); Assert.Equal(new Points(5), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Foo").Select(x => x.Points).Single()); Assert.Equal(new Points(1), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Bar").Select(x => x.Points).Single()); } [Fact] public void CanRecordSimpleGameByPositions() { var league = new League(); var game = new Game(); game.AddResult("Foo", new Position(2)); game.AddResult("Bar", new Position(1)); league.RecordGame(game); Assert.Equal(new Position(2), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Foo").Select(x => x.Position).Single()); Assert.Equal(new Position(1), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Bar").Select(x => x.Position).Single()); } [Fact] public void CanRecordMultipleSimpleGame() { var league = new League(); var game = new Game(); game.AddResult("Foo", new Points(5)); game.AddResult("Bar", new Points(1)); var game2 = new Game(); game2.AddResult("Foo", new Points(3)); game2.AddResult("Bar", new Points(2)); league.RecordGame(game); league.RecordGame(game2); Assert.Equal(new Points(8), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Foo").Select(x => x.Points).Single()); Assert.Equal(new Points(3), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Bar").Select(x => x.Points).Single()); } } }
using System.Linq; using PlayerRank.Scoring; using PlayerRank.Scoring.Simple; using Xunit; namespace PlayerRank.UnitTests { public class SimpleLeagueTests { [Fact] public void CanRecordSimpleGameByScores() { var league = new League(); var game = new Game(); game.AddResult("Foo", new Points(5)); game.AddResult("Bar", new Points(1)); league.RecordGame(game); Assert.Equal(new Points(5), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Foo").Select(x => x.Points).Single()); Assert.Equal(new Points(1), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Bar").Select(x => x.Points).Single()); } [Fact] public void CanRecordSimpleGameByPositions() { var league = new League(); var game = new Game(); game.AddResult("Foo", new Position(2)); game.AddResult("Bar", new Position(1)); league.RecordGame(game); Assert.Equal(new Points(0), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Foo").Select(x => x.Points).Single()); Assert.Equal(new Points(0), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Bar").Select(x => x.Points).Single()); } [Fact] public void CanRecordMultipleSimpleGame() { var league = new League(); var game = new Game(); game.AddResult("Foo", new Points(5)); game.AddResult("Bar", new Points(1)); var game2 = new Game(); game2.AddResult("Foo", new Points(3)); game2.AddResult("Bar", new Points(2)); league.RecordGame(game); league.RecordGame(game2); Assert.Equal(new Points(8), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Foo").Select(x => x.Points).Single()); Assert.Equal(new Points(3), league.GetLeaderBoard(new SimpleScoringStrategy()).Where(x => x.Name == "Bar").Select(x => x.Points).Single()); } } }
mit
C#
4bdb40853caed8e38fa37e63fd43714644e84a18
write initial algorithm structure
TheGoodFella/LotteryWinner
LotteryWinner/LotteryWinner/Program.cs
LotteryWinner/LotteryWinner/Program.cs
using System; using System.Threading; using System.Collections.Generic; namespace LotteryWinner { class Program { /// <summary> /// locker obj /// </summary> static private Object locker = new Object(); static private char separator = ','; static void Main(string[] args) { //thread list List<Thread> threads = new List<Thread>(); //minimum number of tha lottery range int lotteryMin = 1; //maximum number of tha lottery range int lotteryMax = 90; //numbers I chose int[] myNumbers; Console.Write("choose your numbers separated by a comma: "); myNumbers = FillMyNumbers(Console.ReadLine()); foreach (var item in myNumbers) { Console.WriteLine(item.ToString()); } Console.ReadKey(); } /// <summary> /// create an array filled by the number I chose, written in the string separated by comma /// </summary> /// <param name="numbers"></param> /// <returns></returns> static int[] FillMyNumbers(string numbers) { string[] Snumbers = numbers.Split(separator); int[] n = new int[Snumbers.Length]; for (int i = 0; i < Snumbers.Length; i++) { n[i] = int.Parse(Snumbers[i]); } return n; } static void IncreaseCounter() { //critical section lock(locker) { } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LotteryWinner { class Program { static void Main(string[] args) { } } }
mit
C#
489eb0e1dc2f0dc2abcb04d506cdb9bcebd48879
Remove unused ISerializationConverterProvider instance
couchbaselabs/Linq2Couchbase,brantburnett/Linq2Couchbase
Src/Couchbase.Linq/QueryGeneration/N1QlQueryGenerationContext.cs
Src/Couchbase.Linq/QueryGeneration/N1QlQueryGenerationContext.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Couchbase.Core.Serialization; using Couchbase.Core.Version; using Couchbase.Linq.QueryGeneration.MemberNameResolvers; using Couchbase.Linq.Serialization; using Couchbase.Linq.Versioning; using Newtonsoft.Json.Serialization; using Remotion.Linq.Clauses.Expressions; namespace Couchbase.Linq.QueryGeneration { /// <summary> /// Used to pass query generation context between various classes /// </summary> internal class N1QlQueryGenerationContext { public N1QlExtentNameProvider ExtentNameProvider { get; set; } public IMemberNameResolver MemberNameResolver { get; set; } public IMethodCallTranslatorProvider MethodCallTranslatorProvider { get; set; } public ParameterAggregator ParameterAggregator { get; set; } public ITypeSerializer Serializer { get; set; } public ClusterVersion ClusterVersion { get; set; } /// <summary> /// Stores a reference to the current grouping subquery /// </summary> public QuerySourceReferenceExpression GroupingQuerySource { get; set; } /// <summary> /// If true, indicates that the document metadata should also be included in the select projection as "__metadata" /// </summary> public bool SelectDocumentMetadata { get; set; } public N1QlQueryGenerationContext() { ExtentNameProvider = new N1QlExtentNameProvider(); ParameterAggregator = new ParameterAggregator(); } /// <summary> /// Clones this N1QlQueryGenerationContext for use within a union secondary query /// </summary> public N1QlQueryGenerationContext CloneForUnion() { // In the future we may want some properties get new values when working in a union // This method provides a simple point for this extension return new N1QlQueryGenerationContext() { ExtentNameProvider = ExtentNameProvider, MemberNameResolver = MemberNameResolver, MethodCallTranslatorProvider = MethodCallTranslatorProvider, ParameterAggregator = ParameterAggregator, Serializer = Serializer, ClusterVersion = ClusterVersion }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Couchbase.Core.Serialization; using Couchbase.Core.Version; using Couchbase.Linq.QueryGeneration.MemberNameResolvers; using Couchbase.Linq.Serialization; using Couchbase.Linq.Versioning; using Newtonsoft.Json.Serialization; using Remotion.Linq.Clauses.Expressions; namespace Couchbase.Linq.QueryGeneration { /// <summary> /// Used to pass query generation context between various classes /// </summary> internal class N1QlQueryGenerationContext { private ISerializationConverterProvider _serializationFormatProvider; public N1QlExtentNameProvider ExtentNameProvider { get; set; } public IMemberNameResolver MemberNameResolver { get; set; } public IMethodCallTranslatorProvider MethodCallTranslatorProvider { get; set; } public ParameterAggregator ParameterAggregator { get; set; } public ITypeSerializer Serializer { get; set; } public ClusterVersion ClusterVersion { get; set; } /// <summary> /// Stores a reference to the current grouping subquery /// </summary> public QuerySourceReferenceExpression GroupingQuerySource { get; set; } /// <summary> /// If true, indicates that the document metadata should also be included in the select projection as "__metadata" /// </summary> public bool SelectDocumentMetadata { get; set; } public N1QlQueryGenerationContext() { ExtentNameProvider = new N1QlExtentNameProvider(); ParameterAggregator = new ParameterAggregator(); } /// <summary> /// Clones this N1QlQueryGenerationContext for use within a union secondary query /// </summary> public N1QlQueryGenerationContext CloneForUnion() { // In the future we may want some properties get new values when working in a union // This method provides a simple point for this extension return new N1QlQueryGenerationContext() { ExtentNameProvider = ExtentNameProvider, MemberNameResolver = MemberNameResolver, MethodCallTranslatorProvider = MethodCallTranslatorProvider, ParameterAggregator = ParameterAggregator, Serializer = Serializer, ClusterVersion = ClusterVersion }; } } }
apache-2.0
C#
35e52b6e45b7edef491353004695ec2653e3057e
Use Dictionary<object, object> instead of Hashtable (the latter does not exist in RT.)
l8s/Eto,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1
Source/Eto/Forms/GenerateActionArgs.cs
Source/Eto/Forms/GenerateActionArgs.cs
using System; using System.Collections; using System.Collections.Generic; namespace Eto.Forms { public interface IActionGenerator { void Generate(GenerateActionArgs args); } public class GenerateActionArgs : EventArgs { #region Members readonly ActionCollection actions; readonly ActionItemCollection menu; readonly ActionItemCollection toolBar; readonly Dictionary<object, object> arguments = new Dictionary<object, object>(); #endregion #region Properties public Generator Generator { get { return actions.Generator; } } public ActionCollection Actions { get { return actions; } } public ActionItemCollection Menu { get { return menu; } } public ActionItemCollection ToolBar { get { return toolBar; } } public Dictionary<object, object> Arguments { get { return arguments; } } #endregion public GenerateActionArgs() : this((Generator)null) { } public GenerateActionArgs(Generator generator) : this(generator, null) { } public GenerateActionArgs(Control control) : this(control.Generator, control) { } public GenerateActionArgs(Generator g, Control control) { this.actions = new ActionCollection(g, control); this.menu = new ActionItemCollection(actions); this.toolBar = new ActionItemCollection(actions); } public GenerateActionArgs(ActionCollection actions, ActionItemCollection menu, ActionItemCollection toolBar) { this.actions = actions; this.menu = menu; this.toolBar = toolBar; } public void CopyArguments(GenerateActionArgs args) { foreach (var de in args.arguments) { arguments[de.Key] = de.Value; } } public void Merge(GenerateActionArgs args) { toolBar.Merge(args.toolBar); menu.Merge(args.Menu); } public object GetArgument(object key, object defaultValue) { return !arguments.ContainsKey(key) ? defaultValue : arguments[key]; } public void Clear() { actions.Clear(); menu.Clear(); toolBar.Clear(); } } }
using System; using System.Collections; namespace Eto.Forms { public interface IActionGenerator { void Generate(GenerateActionArgs args); } public class GenerateActionArgs : EventArgs { #region Members readonly ActionCollection actions; readonly ActionItemCollection menu; readonly ActionItemCollection toolBar; readonly Hashtable arguments = new Hashtable(); #endregion #region Properties public Generator Generator { get { return actions.Generator; } } public ActionCollection Actions { get { return actions; } } public ActionItemCollection Menu { get { return menu; } } public ActionItemCollection ToolBar { get { return toolBar; } } public Hashtable Arguments { get { return arguments; } } #endregion public GenerateActionArgs() : this((Generator)null) { } public GenerateActionArgs(Generator generator) : this(generator, null) { } public GenerateActionArgs(Control control) : this(control.Generator, control) { } public GenerateActionArgs(Generator g, Control control) { this.actions = new ActionCollection(g, control); this.menu = new ActionItemCollection(actions); this.toolBar = new ActionItemCollection(actions); } public GenerateActionArgs(ActionCollection actions, ActionItemCollection menu, ActionItemCollection toolBar) { this.actions = actions; this.menu = menu; this.toolBar = toolBar; } public void CopyArguments(GenerateActionArgs args) { foreach (DictionaryEntry de in args.arguments) { arguments[de.Key] = de.Value; } } public void Merge(GenerateActionArgs args) { toolBar.Merge(args.toolBar); menu.Merge(args.Menu); } public object GetArgument(object key, object defaultValue) { return !arguments.ContainsKey(key) ? defaultValue : arguments[key]; } public void Clear() { actions.Clear(); menu.Clear(); toolBar.Clear(); } } }
bsd-3-clause
C#
b04378b1ea7424b108e69aa5b639c3ff3efecad6
add SourceKind.ModifierGroup
WarHub/wham
src/WarHub.ArmouryModel.Source/Foundation/SourceKind.cs
src/WarHub.ArmouryModel.Source/Foundation/SourceKind.cs
namespace WarHub.ArmouryModel.Source { public enum SourceKind { Unknown, // types CharacteristicType, CharacteristicTypeList, CostType, CostTypeList, ProfileType, ProfileTypeList, // entries CategoryEntry, CategoryEntryList, DataIndexEntry, DataIndexEntryList, DataIndexRepositoryUrl, DataIndexRepositoryUrlList, ForceEntry, ForceEntryList, Metadata, MetadataList, SelectionEntry, SelectionEntryList, SelectionEntryGroup, SelectionEntryGroupList, // selectors + modifiers Condition, ConditionList, ConditionGroup, ConditionGroupList, Constraint, ConstraintList, Modifier, ModifierList, ModifierGroup, ModifierGroupList, Repeat, RepeatList, // infos Characteristic, CharacteristicList, Cost, CostList, InfoGroup, InfoGroupList, Profile, ProfileList, Publication, PublicationList, Rule, RuleList, // links CatalogueLink, CatalogueLinkList, CategoryLink, CategoryLinkList, EntryLink, EntryLinkList, InfoLink, InfoLinkList, // roster elements CostLimit, CostLimitList, Category, CategoryList, Force, ForceList, Selection, SelectionList, // top elements Catalogue, CatalogueList, Gamesystem, GamesystemList, Roster, RosterList, DataIndex, DataIndexList, Datablob, DatablobList, } }
namespace WarHub.ArmouryModel.Source { public enum SourceKind { Unknown, // types CostType, CostTypeList, CharacteristicType, CharacteristicTypeList, ProfileType, ProfileTypeList, // entries SelectionEntry, SelectionEntryList, SelectionEntryGroup, SelectionEntryGroupList, CategoryEntry, CategoryEntryList, ForceEntry, ForceEntryList, DataIndexEntry, DataIndexEntryList, DataIndexRepositoryUrl, DataIndexRepositoryUrlList, Metadata, MetadataList, // selectors + modifiers Condition, ConditionList, ConditionGroup, ConditionGroupList, Constraint, ConstraintList, Repeat, RepeatList, Modifier, ModifierList, // infos Cost, CostList, Characteristic, CharacteristicList, Profile, ProfileList, Publication, PublicationList, Rule, RuleList, // links CategoryLink, CategoryLinkList, EntryLink, EntryLinkList, InfoLink, InfoLinkList, CatalogueLink, CatalogueLinkList, // roster elements CostLimit, CostLimitList, Category, CategoryList, Force, ForceList, Selection, SelectionList, // top elements Catalogue, CatalogueList, Gamesystem, GamesystemList, Roster, RosterList, DataIndex, DataIndexList, Datablob, DatablobList, } }
mit
C#
1c69e16b1eb8b81e729ee1beb1f7fba3a7d8d8e7
Initialize ModelEvents on change of Model
MMDaemon/Voxel-Editor,MMDaemon/Voxel-Editor
VoxelEditor/Controller/MainController.cs
VoxelEditor/Controller/MainController.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using DMS.Application; using OpenTK; using VoxelEditor.Common.Enums; using VoxelEditor.Model; using VoxelEditor.View; using VoxelEditor.View.Editor; using VoxelEditor.Common.EventArguments; using VoxelEditor.Model.Editor; using VoxelEditor.Model.Menu; using VoxelEditor.View.Menu; namespace VoxelEditor.Controller { class MainController { private readonly ExampleApplication _app; private readonly InputHandler _inputHandler; private readonly StateHandler _stateHandler; private readonly List<IModel> _inactiveModels; private IModel _model; private IView _view; private readonly Stopwatch _timeSource; public MainController() { _app = new ExampleApplication(); _inputHandler = new InputHandler((GameWindow)_app.GameWindow); _stateHandler = new StateHandler(); InitializeStateHandler(); _inactiveModels = new List<IModel>(); SetModelViewInstances(State.Start); _timeSource = new Stopwatch(); _app.Update += Update; _app.Render += Render; _model.ModelEvent += (sender, args) => _view.ProcessModelEvent((ModelEventArgs)args); _model.StateChanged += StateChanged; _timeSource.Start(); _app.Run(); } public void Update(float updatePeriod) { _model.Update((float)_timeSource.Elapsed.TotalSeconds, _inputHandler.ModelInput); } public void Render() { _view.Render(_model.ViewModel); } private void InitializeStateHandler() { _stateHandler.AddStateInformation(State.Start, typeof(EditorModel), typeof(EditorView)); _stateHandler.AddStateInformation(State.Menu, typeof(MenuModel), typeof(MenuView)); _stateHandler.AddStateInformation(State.Editor, typeof(EditorModel), typeof(EditorView)); } private void StateChanged(object sender, System.EventArgs e) { if (((StateChangedEventArgs)e).Temporary) { _inactiveModels.Add(_model); } SetModelViewInstances(((StateChangedEventArgs)e).State); } private void SetModelViewInstances(State state) { StateInformation stateInformation = _stateHandler.GetStateInformation(state); IModel existingModel = (from inactiveModel in _inactiveModels where inactiveModel.GetType() == stateInformation.ModelType select inactiveModel).FirstOrDefault(); if (existingModel != null) { _model = existingModel; _inactiveModels.Remove(existingModel); } else { _model = (IModel)Activator.CreateInstance(stateInformation.ModelType); _model.ModelEvent += (sender, args) => _view.ProcessModelEvent((ModelEventArgs)args); _model.StateChanged += StateChanged; } _view = (IView)Activator.CreateInstance(stateInformation.ViewType); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using DMS.Application; using OpenTK; using VoxelEditor.Common.Enums; using VoxelEditor.Model; using VoxelEditor.View; using VoxelEditor.View.Editor; using VoxelEditor.Common.EventArguments; using VoxelEditor.Model.Editor; using VoxelEditor.Model.Menu; using VoxelEditor.View.Menu; namespace VoxelEditor.Controller { class MainController { private readonly ExampleApplication _app; private readonly InputHandler _inputHandler; private readonly StateHandler _stateHandler; private readonly List<IModel> _inactiveModels; private IModel _model; private IView _view; private readonly Stopwatch _timeSource; public MainController() { _app = new ExampleApplication(); _inputHandler = new InputHandler((GameWindow)_app.GameWindow); _stateHandler = new StateHandler(); InitializeStateHandler(); _inactiveModels = new List<IModel>(); SetModelViewInstances(State.Start); _timeSource = new Stopwatch(); _app.Update += Update; _app.Render += Render; _model.ModelEvent += (sender, args) => _view.ProcessModelEvent((ModelEventArgs)args); _model.StateChanged += StateChanged; _timeSource.Start(); _app.Run(); } public void Update(float updatePeriod) { _model.Update((float)_timeSource.Elapsed.TotalSeconds, _inputHandler.ModelInput); } public void Render() { _view.Render(_model.ViewModel); } private void InitializeStateHandler() { _stateHandler.AddStateInformation(State.Start, typeof(EditorModel), typeof(EditorView)); _stateHandler.AddStateInformation(State.Menu, typeof(MenuModel), typeof(MenuView)); _stateHandler.AddStateInformation(State.Editor, typeof(EditorModel), typeof(EditorView)); } private void StateChanged(object sender, System.EventArgs e) { if (((StateChangedEventArgs)e).Temporary) { _inactiveModels.Add(_model); } SetModelViewInstances(((StateChangedEventArgs)e).State); } private void SetModelViewInstances(State state) { StateInformation stateInformation = _stateHandler.GetStateInformation(state); IModel existingModel = (from inactiveModel in _inactiveModels where inactiveModel.GetType() == stateInformation.ModelType select inactiveModel).FirstOrDefault(); if (existingModel != null) { _model = existingModel; _inactiveModels.Remove(existingModel); } else { _model = (IModel)Activator.CreateInstance(stateInformation.ModelType); } _view = (IView)Activator.CreateInstance(stateInformation.ViewType); } } }
apache-2.0
C#
a56f79514406dc89fad36b2c65303f7a1f5f4402
Refresh tray menu if icon already exists when attempting to initialise
danielchalmers/SteamAccountSwitcher
SteamAccountSwitcher/TrayIconHelper.cs
SteamAccountSwitcher/TrayIconHelper.cs
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using Hardcodet.Wpf.TaskbarNotification; using SteamAccountSwitcher.Properties; namespace SteamAccountSwitcher { public static class TrayIconHelper { public static readonly ObservableCollection<object> AccountMenuItems = new ObservableCollection<object>(); public static void ShowRunningInTrayBalloon() { ShowTrayBalloon("Running in tray\nDouble click icon to open", BalloonIcon.Info); } private static void ShowTrayBalloon(string text, BalloonIcon icon) { App.TrayIcon?.ShowBalloonTip(Resources.AppName, text, icon); } public static void CreateTrayIcon() { if (App.TrayIcon == null) { App.TrayIcon = (TaskbarIcon) Application.Current.FindResource("TrayIcon"); } RefreshTrayIconMenu(); } public static void RefreshTrayIconMenu() { AccountMenuItems.Clear(); var items = GetAccountMenuItems(); foreach (var item in items) { AccountMenuItems.Add(item); } } private static IEnumerable<Control> GetAccountMenuItems() { if (App.Accounts == null || App.Accounts.Count <= 0) { yield break; } foreach (var account in App.Accounts) { var item = new MenuItem {Header = account.GetDisplayName()}; if (Settings.Default.ColorCodeAccountMenuItems) { item.Foreground = new SolidColorBrush(account.TextColor); item.Background = new SolidColorBrush(account.Color); } item.Click += (sender, args) => account.SwitchTo(false); yield return item; } yield return new Separator(); } } }
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using Hardcodet.Wpf.TaskbarNotification; using SteamAccountSwitcher.Properties; namespace SteamAccountSwitcher { public static class TrayIconHelper { public static readonly ObservableCollection<object> AccountMenuItems = new ObservableCollection<object>(); public static void ShowRunningInTrayBalloon() { ShowTrayBalloon("Running in tray\nDouble click icon to open", BalloonIcon.Info); } private static void ShowTrayBalloon(string text, BalloonIcon icon) { App.TrayIcon?.ShowBalloonTip(Resources.AppName, text, icon); } public static void CreateTrayIcon() { if (App.TrayIcon != null) { return; } App.TrayIcon = (TaskbarIcon) Application.Current.FindResource("TrayIcon"); RefreshTrayIconMenu(); } public static void RefreshTrayIconMenu() { AccountMenuItems.Clear(); var items = GetAccountMenuItems(); foreach (var item in items) { AccountMenuItems.Add(item); } } private static IEnumerable<Control> GetAccountMenuItems() { if (App.Accounts == null || App.Accounts.Count <= 0) { yield break; } foreach (var account in App.Accounts) { var item = new MenuItem {Header = account.GetDisplayName()}; if (Settings.Default.ColorCodeAccountMenuItems) { item.Foreground = new SolidColorBrush(account.TextColor); item.Background = new SolidColorBrush(account.Color); } item.Click += (sender, args) => account.SwitchTo(false); yield return item; } yield return new Separator(); } } }
mit
C#
debff062692653a80c91b83ac3bef3b5f06c68a3
add an X to click into.
hfoffani/WinFormTagsEditor
WinFormTagsEditor/WinFormTagsEditor.cs
WinFormTagsEditor/WinFormTagsEditor.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace WinFormTagsEditor { public partial class WinFormTagsEditor: UserControl { private string head = @" <script> document.attachEvent('onclick', function(event) { clickedon = event.srcElement.id; if (clickedon == 'T2') { alert('You clicked inside Tag 2.') } else { alert('You clicked outside Tag 2.') } }); </script> <style> body { background-color:gray; } .highlightme { background-color:#FFFF00; } p { background-color:#FFFFFF; } </style> "; private string templatetag = @"<span class='highlightme'>{0}</span><span id='T{1}'>x</span>"; public IList<string> Tags { get; private set; } public WinFormTagsEditor() { InitializeComponent(); Tags = new List<string>(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.webBrowser1.DocumentText = getcontent(); } private string getcontent() { var sb = new StringBuilder(); sb.AppendLine(head); sb.AppendLine(@"<div id='A'>"); int i = 0; foreach (var t in this.Tags) { sb.AppendLine(string.Format(templatetag, t, ++i)); } sb.AppendLine("</div>"); return sb.ToString(); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace WinFormTagsEditor { public partial class WinFormTagsEditor: UserControl { private string head = @" <script> document.attachEvent('onclick', function(event) { var specifiedElement = document.getElementById('T2'); var isClickInside = specifiedElement.contains(event.srcElement); if (isClickInside) { alert('You clicked inside Tag 2.') } else { alert('You clicked outside Tag 2.') } }); </script> <style> body { background-color:gray; } .highlightme { background-color:#FFFF00; } p { background-color:#FFFFFF; } </style> "; private string templatetag = @"<span class='highlightme' id='T{1}'>{0}</span>"; public IList<string> Tags { get; private set; } public WinFormTagsEditor() { InitializeComponent(); Tags = new List<string>(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.webBrowser1.DocumentText = getcontent(); } private string getcontent() { var sb = new StringBuilder(); sb.AppendLine(head); sb.AppendLine(@"<div id='A'>"); int i = 0; foreach (var t in this.Tags) { sb.AppendLine(string.Format(templatetag, t, ++i)); } sb.AppendLine("</div>"); return sb.ToString(); } } }
apache-2.0
C#
92152aa22e19bff6200ee67e3764e882300cf502
Update Viktor.cs
FireBuddy/adevade
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") { //var endpoint = sender.Path.Last(); // var missileDist = End.To2D().Distance(args.Start.To2D()); // var delay = missileDist / 1.5f + 600; // spellData.SpellDelay = delay; // SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") { var endpoint = sender.Path.Last(); // var missileDist = End.To2D().Distance(args.Start.To2D()); // var delay = missileDist / 1.5f + 600; // spellData.SpellDelay = delay; // SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
mit
C#
dc47fa3c4caaeead1f267680ec29ae83f35f32e4
Update VBEDriver.cs
jp2masa/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,trivalik/Cosmos,tgiphil/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,tgiphil/Cosmos,trivalik/Cosmos,trivalik/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos,fanoI/Cosmos,fanoI/Cosmos
source/Cosmos.HAL/Drivers/VBEDriver.cs
source/Cosmos.HAL/Drivers/VBEDriver.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Cosmos.HAL.Drivers { public class VBEDriver { private Core.IOGroup.VBE IO = Core.Global.BaseIOGroups.VBE; public VBEDriver() { if (Cosmos.HAL.PCI.GetDevice(1234, 1111) == null){ throw new Exception("No BGA adapter found.."); } } private void vbe_write(ushort index, ushort value) { IO.VbeIndex.Word = index; IO.VbeData.Word = value; } public void vbe_set(ushort xres, ushort yres, ushort bpp) { //Disable Display vbe_write(0x4, 0x00); //Set Display Xres vbe_write(0x1, xres); //SetDisplay Yres vbe_write(0x2, yres); //SetDisplay bpp vbe_write(0x3, bpp); //Enable Display and LFB vbe_write(0x4, (ushort)(0x01 | 0x40)); } public void set_vram(uint index, byte value) { IO.VGAMemoryBlock[index] = value; } public byte get_vram(uint index) { return IO.VGAMemoryBlock[index]; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Cosmos.HAL.Drivers { public class VBEDriver { private Core.IOGroup.VBE IO = Core.Global.BaseIOGroups.VBE; private void vbe_write(ushort index, ushort value) { IO.VbeIndex.Word = index; IO.VbeData.Word = value; } public void vbe_set(ushort xres, ushort yres, ushort bpp) { if (Cosmos.HAL.PCI.GetDevice(1234, 1111) == null){ throw new Exception("No BGA adapter found.."); } //Disable Display vbe_write(0x4, 0x00); //Set Display Xres vbe_write(0x1, xres); //SetDisplay Yres vbe_write(0x2, yres); //SetDisplay bpp vbe_write(0x3, bpp); //Enable Display and LFB vbe_write(0x4, (ushort)(0x01 | 0x40)); } public void set_vram(uint index, byte value) { IO.VGAMemoryBlock[index] = value; } public byte get_vram(uint index) { return IO.VGAMemoryBlock[index]; } } }
bsd-3-clause
C#
ef3d146953d214cd4fb281fdcb67b24b958dfaf3
add response type
hidden-sound-team/Hidden-Sound-API
HiddenSound.API/Areas/Mobile/Controllers/DevicesController.cs
HiddenSound.API/Areas/Mobile/Controllers/DevicesController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using HiddenSound.API.Areas.Mobile.Models.Requests; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace HiddenSound.API.Areas.Mobile.Controllers { [Area("Mobile")] [Route("Mobile/[controller]")] public class DevicesController : Controller { [HttpPost("[action]")] [Authorize] [ProducesResponseType(400)] public IActionResult Link([FromBody] DeviceLinkRequest request) { if (ModelState.IsValid) { return Ok(); } return BadRequest(ModelState); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using HiddenSound.API.Areas.Mobile.Models.Requests; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace HiddenSound.API.Areas.Mobile.Controllers { [Area("Mobile")] [Route("Mobile/[controller]")] public class DevicesController : Controller { [HttpPost("[action]")] [Authorize] public IActionResult Link([FromBody] DeviceLinkRequest request) { if (ModelState.IsValid) { return Ok(); } return BadRequest(ModelState); } } }
apache-2.0
C#
7a4de6640e6f1387b468b5da5e735d74d3eb27f9
Add link to example prefab in PrefabRepository
mikelovesrobots/daft-pong,mikelovesrobots/unity3d-game-of-life,jshou/party-game,mikelovesrobots/daft-pong,mikelovesrobots/unity3d-base,mikelovesrobots/throw-a-ball-tutorial
app/Assets/Scripts/PrefabRepository.cs
app/Assets/Scripts/PrefabRepository.cs
using UnityEngine; using System.Collections; public class PrefabRepository : MonoBehaviour { public GameObject ExamplePrefab; private static PrefabRepository instance; public static PrefabRepository Instance { get { if (instance == null) { instance = GameObject.Find("/Global/PrefabRepository").GetComponent<PrefabRepository>(); } return instance; } } }
using UnityEngine; using System.Collections; public class PrefabRepository : MonoBehaviour { private static PrefabRepository instance; public static PrefabRepository Instance { get { if (instance == null) { instance = GameObject.Find("/Global/PrefabRepository").GetComponent<PrefabRepository>(); } return instance; } } }
mit
C#
60a615aa850424c5ca42d335a96d0558097d762a
Fix assertion in unit-test to work on net5.0
skarpdev/dotnet-version-cli
test/CsProj/FileSystem/DotNetFileSystemProviderTests.cs
test/CsProj/FileSystem/DotNetFileSystemProviderTests.cs
using System; using System.IO; using System.Linq; using Skarp.Version.Cli.CsProj.FileSystem; using Xunit; namespace Skarp.Version.Cli.Test.CsProj.FileSystem { public class DotNetFileSystemProviderTests { private readonly DotNetFileSystemProvider _provider; public DotNetFileSystemProviderTests() { _provider = new DotNetFileSystemProvider(); } [Fact] public void List_works() { // List files in the current directory running from (the build output folder) var files = _provider.List("./").ToList(); Assert.NotEmpty(files); Assert.Contains("./dotnet-version.dll", files); } [Theory] [InlineData("./dotnet-version.dll", false)] [InlineData("../../../dotnet-version-test.csproj", true)] public void IsCsProjectFile_works(string path, bool isCsProj) { Assert.Equal(_provider.IsCsProjectFile(path), isCsProj); } [Fact] public void Cwd_works() { var cwd = _provider.Cwd(); Assert.Contains($"Debug{Path.DirectorySeparatorChar}net", cwd); } [Fact] public void LoadAllContent_works() { var content = _provider.LoadContent("../../../dotnet-version-test.csproj"); Assert.Contains("<ProjectGuid>fb420acf-9e12-42b6-b724-1eee9cbf251e</ProjectGuid>", content); } [Fact] public void WriteAllContent_works() { var path = "./test-file.txt"; var content = "this is content"; _provider.WriteAllContent(path, content); var loadedContent = File.ReadAllText(path); Assert.Equal(content, loadedContent); } } }
using System; using System.IO; using System.Linq; using Skarp.Version.Cli.CsProj.FileSystem; using Xunit; namespace Skarp.Version.Cli.Test.CsProj.FileSystem { public class DotNetFileSystemProviderTests { private readonly DotNetFileSystemProvider _provider; public DotNetFileSystemProviderTests() { _provider = new DotNetFileSystemProvider(); } [Fact] public void List_works() { // List files in the current directory running from (the build output folder) var files = _provider.List("./").ToList(); Assert.NotEmpty(files); Assert.Contains("./dotnet-version.dll", files); } [Theory] [InlineData("./dotnet-version.dll", false)] [InlineData("../../../dotnet-version-test.csproj", true)] public void IsCsProjectFile_works(string path, bool isCsProj) { Assert.Equal(_provider.IsCsProjectFile(path), isCsProj); } [Fact] public void Cwd_works() { var cwd = _provider.Cwd(); Assert.Contains($"netcoreapp", cwd); } [Fact] public void LoadAllContent_works() { var content = _provider.LoadContent("../../../dotnet-version-test.csproj"); Assert.Contains("<ProjectGuid>fb420acf-9e12-42b6-b724-1eee9cbf251e</ProjectGuid>", content); } [Fact] public void WriteAllContent_works() { var path = "./test-file.txt"; var content = "this is content"; _provider.WriteAllContent(path, content); var loadedContent = File.ReadAllText(path); Assert.Equal(content, loadedContent); } } }
mit
C#
142e348d9a41baa0b231de93d2edf1f35e8aa287
Update code task
roman-yagodin/R7.Documents,roman-yagodin/R7.Documents,roman-yagodin/R7.Documents
R7.Documents.Dnn/Components/HttpOffContextHelper.cs
R7.Documents.Dnn/Components/HttpOffContextHelper.cs
using System.Linq; using DotNetNuke.Entities.Portals; namespace R7.Documents.Components { // TODO: Replace with PortalHelper.GetPortalSettingsOutOfHttpContext public static class HttpOffContextHelper { /// <summary> /// Gets the portal settings with portal alias info outside HTTP context. /// Could be useful along with e.g. Globals.NavigateURL(). /// </summary> /// <returns>The portal settings.</returns> /// <param name="portalId">Portal identifier.</param> /// <param name="tabId">Tab identifier.</param> /// <param name="cultureCode">Culture code.</param> public static PortalSettings GetPortalSettings (int portalId, int tabId, string cultureCode) { var portalAliases = PortalAliasController.Instance.GetPortalAliasesByPortalId (portalId).ToList (); var portalSettings = new PortalSettings (portalId); var portalAlias = default (PortalAliasInfo); if (!string.IsNullOrEmpty (cultureCode)) { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary && pa.CultureCode == cultureCode); if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (pa => pa.CultureCode == cultureCode); } } else { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary && pa.CultureCode == portalSettings.DefaultLanguage); if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary && pa.CultureCode == ""); } } if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary); if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (); } } return new PortalSettings (tabId, portalAlias); } } }
// // HttpOffContextHelper.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2018 Roman M. Yagodin // // 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.Linq; using DotNetNuke.Entities.Portals; namespace R7.Documents.Components { // TODO: Move to the base library public static class HttpOffContextHelper { /// <summary> /// Gets the portal settings with portal alias info outside HTTP context. /// Could be useful along with e.g. Globals.NavigateURL(). /// </summary> /// <returns>The portal settings.</returns> /// <param name="portalId">Portal identifier.</param> /// <param name="tabId">Tab identifier.</param> /// <param name="cultureCode">Culture code.</param> public static PortalSettings GetPortalSettings (int portalId, int tabId, string cultureCode) { var portalAliases = PortalAliasController.Instance.GetPortalAliasesByPortalId (portalId).ToList (); var portalSettings = new PortalSettings (portalId); var portalAlias = default (PortalAliasInfo); if (!string.IsNullOrEmpty (cultureCode)) { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary && pa.CultureCode == cultureCode); if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (pa => pa.CultureCode == cultureCode); } } else { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary && pa.CultureCode == portalSettings.DefaultLanguage); if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary && pa.CultureCode == ""); } } if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (pa => pa.IsPrimary); if (portalAlias == null) { portalAlias = portalAliases.FirstOrDefault (); } } return new PortalSettings (tabId, portalAlias); } } }
mit
C#
e343b757e9da9f1ac205ec958c295510ee589f7d
Add ml to NodeRole enum (#4049)
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/Cluster/NodesInfo/NodeRole.cs
src/Nest/Cluster/NodesInfo/NodeRole.cs
using System.Runtime.Serialization; using Elasticsearch.Net; namespace Nest { [StringEnum] public enum NodeRole { [EnumMember(Value = "master")] Master, [EnumMember(Value = "data")] Data, [EnumMember(Value = "client")] Client, [EnumMember(Value = "ingest")] Ingest, [EnumMember(Value = "ml")] MachineLearning } }
using System.Runtime.Serialization; using Elasticsearch.Net; namespace Nest { [StringEnum] public enum NodeRole { [EnumMember(Value = "master")] Master, [EnumMember(Value = "data")] Data, [EnumMember(Value = "client")] Client, [EnumMember(Value = "ingest")] Ingest } }
apache-2.0
C#
26a417613d8aa739bf6167539a452ac0acb9bf93
Update src/Swan.Lite/Parsers/ArgumentParser.TypeResolver.cs
unosquare/swan
src/Swan.Lite/Parsers/ArgumentParser.TypeResolver.cs
src/Swan.Lite/Parsers/ArgumentParser.TypeResolver.cs
using System; using System.Linq; using System.Reflection; using Swan.Reflection; namespace Swan.Parsers { /// <summary> /// Provides methods to parse command line arguments. /// </summary> public partial class ArgumentParser { private sealed class TypeResolver<T> { public bool HasVerb { get; } private bool _hasVerb = false; private readonly string _selectedVerb; private PropertyInfo[]? _properties; public TypeResolver(string selectedVerb) { _selectedVerb = selectedVerb; } public PropertyInfo[]? Properties => _properties?.Any() == true ? _properties : null; public object? GetOptionsObject(T instance) { _properties = PropertyTypeCache.DefaultCache.Value.RetrieveAllProperties<T>(true).ToArray(); if (!_properties.Any(x => x.GetCustomAttributes(typeof(VerbOptionAttribute), false).Any())) return instance; _hasVerb = true; var selectedVerb = string.IsNullOrWhiteSpace(_selectedVerb) ? null : _properties.FirstOrDefault(x => AttributeCache.DefaultCache.Value.RetrieveOne<VerbOptionAttribute>(x).Name == _selectedVerb); if (selectedVerb == null) return null; var type = instance.GetType(); var verbProperty = type.GetProperty(selectedVerb.Name); if (verbProperty?.GetValue(instance) == null) { var propertyInstance = Activator.CreateInstance(selectedVerb.PropertyType); verbProperty?.SetValue(instance, propertyInstance); } _properties = PropertyTypeCache.DefaultCache.Value.RetrieveAllProperties(selectedVerb.PropertyType, true) .ToArray(); return verbProperty?.GetValue(instance); } } } }
using System; using System.Linq; using System.Reflection; using Swan.Reflection; namespace Swan.Parsers { /// <summary> /// Provides methods to parse command line arguments. /// </summary> public partial class ArgumentParser { private sealed class TypeResolver<T> { public bool HasVerb { get => _hasVerb; } private bool _hasVerb = false; private readonly string _selectedVerb; private PropertyInfo[]? _properties; public TypeResolver(string selectedVerb) { _selectedVerb = selectedVerb; } public PropertyInfo[]? Properties => _properties?.Any() == true ? _properties : null; public object? GetOptionsObject(T instance) { _properties = PropertyTypeCache.DefaultCache.Value.RetrieveAllProperties<T>(true).ToArray(); if (!_properties.Any(x => x.GetCustomAttributes(typeof(VerbOptionAttribute), false).Any())) return instance; _hasVerb = true; var selectedVerb = string.IsNullOrWhiteSpace(_selectedVerb) ? null : _properties.FirstOrDefault(x => AttributeCache.DefaultCache.Value.RetrieveOne<VerbOptionAttribute>(x).Name == _selectedVerb); if (selectedVerb == null) return null; var type = instance.GetType(); var verbProperty = type.GetProperty(selectedVerb.Name); if (verbProperty?.GetValue(instance) == null) { var propertyInstance = Activator.CreateInstance(selectedVerb.PropertyType); verbProperty?.SetValue(instance, propertyInstance); } _properties = PropertyTypeCache.DefaultCache.Value.RetrieveAllProperties(selectedVerb.PropertyType, true) .ToArray(); return verbProperty?.GetValue(instance); } } } }
mit
C#
4050cb88ea476cce8bf0363d0f9a4c6d9f63e523
Fix potential nullref
ZLima12/osu,ppy/osu,johnneijzen/osu,peppy/osu,johnneijzen/osu,DrabWeb/osu,smoogipooo/osu,peppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,naoey/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,EVAST9919/osu,DrabWeb/osu,2yangk23/osu,NeoAdonis/osu,naoey/osu,NeoAdonis/osu,EVAST9919/osu,DrabWeb/osu,peppy/osu-new,naoey/osu,ppy/osu,ZLima12/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu
osu.Game/Screens/Multi/Match/Components/ReadyButton.cs
osu.Game/Screens/Multi/Match/Components/ReadyButton.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osuTK; namespace osu.Game.Screens.Multi.Match.Components { public class ReadyButton : HeaderButton { public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>(); [Resolved] private BeatmapManager beatmaps { get; set; } public ReadyButton() { RelativeSizeAxes = Axes.Y; Size = new Vector2(200, 1); Text = "Start"; } [BackgroundDependencyLoader] private void load() { beatmaps.ItemAdded += beatmapAdded; Beatmap.BindValueChanged(updateEnabledState, true); } private void updateEnabledState(BeatmapInfo beatmap) { if (beatmap?.OnlineBeatmapID == null) { Enabled.Value = false; return; } Enabled.Value = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID) != null; } private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) { if (model.Beatmaps.Any(b => b.OnlineBeatmapID == Beatmap.Value.OnlineBeatmapID)) Schedule(() => Enabled.Value = true); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); if (beatmaps != null) beatmaps.ItemAdded -= beatmapAdded; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osuTK; namespace osu.Game.Screens.Multi.Match.Components { public class ReadyButton : HeaderButton { public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>(); [Resolved] private BeatmapManager beatmaps { get; set; } public ReadyButton() { RelativeSizeAxes = Axes.Y; Size = new Vector2(200, 1); Text = "Start"; } [BackgroundDependencyLoader] private void load() { beatmaps.ItemAdded += beatmapAdded; Beatmap.BindValueChanged(updateEnabledState, true); } private void updateEnabledState(BeatmapInfo beatmap) { if (beatmap?.OnlineBeatmapID == null) { Enabled.Value = false; return; } Enabled.Value = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID) != null; } private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) { if (model.Beatmaps.Any(b => b.OnlineBeatmapID == Beatmap.Value.OnlineBeatmapID)) Schedule(() => Enabled.Value = true); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); beatmaps.ItemAdded -= beatmapAdded; } } }
mit
C#
87cd390eed6f7a23d1db3b7d1ad3726065deb288
Increase Cassandra delay after startup (90 sec)
lecaillon/Evolve
test/Evolve.Test.Utilities/CassandraDockerContainer.cs
test/Evolve.Test.Utilities/CassandraDockerContainer.cs
using System; namespace Evolve.Test.Utilities { public class CassandraDockerContainer { private DockerContainer _container; public string Id => _container.Id; public string ExposedPort => "9042"; public string HostPort => "9042"; public string ClusterName => "evolve"; public string DataCenter => "dc1"; public TimeSpan DelayAfterStartup => TimeSpan.FromSeconds(90); public bool Start(bool fromScratch = false) { _container = new DockerContainerBuilder(new DockerContainerBuilderOptions { FromImage = "cassandra", Tag = "latest", Name = "cassandra-evolve", Env = new[] { $"CASSANDRA_CLUSTER_NAME={ClusterName}", $"CASSANDRA_DC={DataCenter}", "CASSANDRA_RACK=rack1" }, ExposedPort = $"{ExposedPort}/tcp", HostPort = HostPort, DelayAfterStartup = DelayAfterStartup, RemovePreviousContainer = fromScratch }).Build(); return _container.Start(); } public void Remove() => _container.Remove(); public bool Stop() => _container.Stop(); public void Dispose() => _container?.Dispose(); } }
using System; namespace Evolve.Test.Utilities { public class CassandraDockerContainer { private DockerContainer _container; public string Id => _container.Id; public string ExposedPort => "9042"; public string HostPort => "9042"; public string ClusterName => "evolve"; public string DataCenter => "dc1"; public TimeSpan DelayAfterStartup => TimeSpan.FromMinutes(1); public bool Start(bool fromScratch = false) { _container = new DockerContainerBuilder(new DockerContainerBuilderOptions { FromImage = "cassandra", Tag = "latest", Name = "cassandra-evolve", Env = new[] { $"CASSANDRA_CLUSTER_NAME={ClusterName}", $"CASSANDRA_DC={DataCenter}", "CASSANDRA_RACK=rack1" }, ExposedPort = $"{ExposedPort}/tcp", HostPort = HostPort, DelayAfterStartup = DelayAfterStartup, RemovePreviousContainer = fromScratch }).Build(); return _container.Start(); } public void Remove() => _container.Remove(); public bool Stop() => _container.Stop(); public void Dispose() => _container?.Dispose(); } }
mit
C#
af3f33a0434bdc93442e35d57eb39bf15e6d3cfe
Optimize FindDocuments command, close #18
kotorihq/kotori-core
KotoriCore/Database/DocumentDb/Commands/FindDocuments.cs
KotoriCore/Database/DocumentDb/Commands/FindDocuments.cs
using System; using System.Threading.Tasks; using KotoriCore.Commands; using KotoriCore.Domains; using KotoriCore.Exceptions; using KotoriCore.Helpers; using KotoriCore.Database.DocumentDb.Helpers; using System.Linq; namespace KotoriCore.Database.DocumentDb { partial class DocumentDb { async Task<CommandResult<SimpleDocument>> HandleAsync(FindDocuments command) { var projectUri = command.ProjectId.ToKotoriUri(); var documentTypeUri = command.DocumentTypeId.ToKotoriUri(true); var sql = DocumentDbHelpers.CreateDynamicQuery ( command.Instance, projectUri, documentTypeUri, command.Top, command.Select, command.Filter, command.OrderBy, command.Drafts, command.Future ); var documents = await _repoDocument.GetListAsync(sql); var simpleDocuments = documents.Select(d => new SimpleDocument ( d.Identifier != null ? new Uri(d.Identifier).ToKotoriIdentifier() : null, d.Slug, d.Meta, d.Content, d.Date?.DateTime, d.Modified?.DateTime, d.Draft )); return new CommandResult<SimpleDocument>(simpleDocuments); } } }
using System; using System.Threading.Tasks; using KotoriCore.Commands; using KotoriCore.Domains; using KotoriCore.Exceptions; using KotoriCore.Helpers; using KotoriCore.Database.DocumentDb.Helpers; using System.Linq; namespace KotoriCore.Database.DocumentDb { partial class DocumentDb { async Task<CommandResult<SimpleDocument>> HandleAsync(FindDocuments command) { var projectUri = command.ProjectId.ToKotoriUri(); var project = await FindProjectAsync(command.Instance, projectUri); if (project == null) throw new KotoriValidationException("Project does not exist."); var documentTypeUri = command.DocumentTypeId.ToKotoriUri(true); var documentType = await FindDocumentTypeAsync(command.Instance, projectUri, documentTypeUri); if (documentType == null) throw new KotoriValidationException("Document type does not exist."); var sql = DocumentDbHelpers.CreateDynamicQuery ( command.Instance, projectUri, documentTypeUri, command.Top, command.Select, command.Filter, command.OrderBy, command.Drafts, command.Future ); var documents = await _repoDocument.GetListAsync(sql); var simpleDocuments = documents.Select(d => new SimpleDocument ( d.Identifier != null ? new Uri(d.Identifier).ToKotoriIdentifier() : null, d.Slug, d.Meta, d.Content, d.Date?.DateTime, d.Modified?.DateTime, d.Draft )); return new CommandResult<SimpleDocument>(simpleDocuments); } } }
mit
C#
3ee21dc5353558594e8c5864a8b2375c0a642cd9
Fix unfinished doc comment
Joe4evr/Discord.Addons
src/Discord.Addons.MpGame/Extensions/IBufferStrategy.cs
src/Discord.Addons.MpGame/Extensions/IBufferStrategy.cs
namespace Discord.Addons { /// <summary> /// Defines a strategy to use for managing temporary buffers. /// </summary> /// <typeparam name="T">The object type.</typeparam> internal interface IBufferStrategy<T> { /// <summary> /// Gets a buffer of the specified size. /// </summary> /// <param name="size">The minimum wanted size.</param> /// <returns>An arry that is at least <paramref name="size"/> elements long.</returns> T[] GetBuffer(int size); /// <summary> /// Returns the buffer if it was rented from a pool. /// </summary> /// <param name="buffer">The buffer to return.</param> void ReturnBuffer(T[] buffer); } }
namespace Discord.Addons { /// <summary> /// Defines a strategy to use for managing temporary buffers. /// </summary> /// <typeparam name="T">The object type.</typeparam> internal interface IBufferStrategy<T> { /// <summary> /// Gets a buffer of the specified size. /// </summary> /// <param name="size">The minimum wanted size.</param> /// <returns>An arry that has at least <paramref name="size"/></returns> T[] GetBuffer(int size); /// <summary> /// Returns the buffer if it was rented from a pool. /// </summary> /// <param name="buffer">The buffer to return.</param> void ReturnBuffer(T[] buffer); } }
mit
C#
2a8d3a5d957f0ec11d7e780f3cd84b954ea77628
Prepare for the November 2016 release
OfficeDev/PnP-Sites-Core,phillipharding/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,phillipharding/PnP-Sites-Core,OfficeDev/PnP-Sites-Core
Core/OfficeDevPnP.Core/Properties/AssemblyInfo.cs
Core/OfficeDevPnP.Core/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; 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("OfficeDevPnP.Core")] #if SP2013 [assembly: AssemblyDescription("Office Dev PnP Core library for SharePoint 2013")] #elif SP2016 [assembly: AssemblyDescription("Office Dev PnP Core library for SharePoint 2016")] #else [assembly: AssemblyDescription("Office Dev PnP Core library for SharePoint Online")] #endif [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OfficeDevPnP.Core")] [assembly: AssemblyCopyright("Copyright © Microsoft 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // 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("065331b6-0540-44e1-84d5-d38f09f17f9e")] // 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: // Convention: // Major version = current version 2 // Minor version = Sequence...version 0 was with January release...so 1=Feb 2=Mar, 3=Apr, 4=May, 5=Jun, 6=Aug, 7=Sept,... // Third part = version indenpendant showing the release month in YYMM // Fourth part = 0 normally or a sequence number when we do an emergency release [assembly: AssemblyVersion("2.9.1611.0")] [assembly: AssemblyFileVersion("2.9.1611.0")] [assembly: InternalsVisibleTo("OfficeDevPnP.Core.Tests")]
using System.Reflection; using System.Resources; 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("OfficeDevPnP.Core")] #if SP2013 [assembly: AssemblyDescription("Office Dev PnP Core library for SharePoint 2013")] #elif SP2016 [assembly: AssemblyDescription("Office Dev PnP Core library for SharePoint 2016")] #else [assembly: AssemblyDescription("Office Dev PnP Core library for SharePoint Online")] #endif [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OfficeDevPnP.Core")] [assembly: AssemblyCopyright("Copyright © Microsoft 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // 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("065331b6-0540-44e1-84d5-d38f09f17f9e")] // 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: // Convention: // Major version = current version 2 // Minor version = Sequence...version 0 was with January release...so 1=Feb 2=Mar, 3=Apr, 4=May, 5=Jun, 6=Aug, 7=Sept,... // Third part = version indenpendant showing the release month in YYMM // Fourth part = 0 normally or a sequence number when we do an emergency release [assembly: AssemblyVersion("2.8.1610.0")] [assembly: AssemblyFileVersion("2.8.1610.0")] [assembly: InternalsVisibleTo("OfficeDevPnP.Core.Tests")]
mit
C#
05c164fb31f84daa82866249b6872537821e4d2c
Update version number for next release
phillipharding/PnP-Sites-Core,itacs/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,itacs/PnP-Sites-Core,PieterVeenstra/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,Puzzlepart/PnP-Sites-Core,PieterVeenstra/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,Puzzlepart/PnP-Sites-Core,phillipharding/PnP-Sites-Core,comblox/PnP-Sites-Core,m-carter1/PnP-Sites-Core,comblox/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,Oaden/PnP-Sites-Core,BobGerman/PnP-Sites-Core,m-carter1/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,Oaden/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,BobGerman/PnP-Sites-Core
Core/OfficeDevPnP.Core/Properties/AssemblyInfo.cs
Core/OfficeDevPnP.Core/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; 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("OfficeDevPnP.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OfficeDevPnP.Core")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // 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("065331b6-0540-44e1-84d5-d38f09f17f9e")] // 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: // Convention: // Major version = current version 1 // Minor version = Sequence...version 0 was with March release...so 1=April, 2=May, 3=June, 4=August, 6=September, 7=October, 8=November, 9=December // Third part = version indenpendant showing the release month in MMYY // Fourth part = 0 [assembly: AssemblyVersion("1.8.1115.0")] [assembly: AssemblyFileVersion("1.8.1115.0")] [assembly: InternalsVisibleTo("OfficeDevPnP.Core.Tests")]
using System.Reflection; using System.Resources; 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("OfficeDevPnP.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OfficeDevPnP.Core")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // 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("065331b6-0540-44e1-84d5-d38f09f17f9e")] // 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: // Convention: // Major version = current version 1 // Minor version = Sequence...version 0 was with March release...so 1=April, 2=May, 3=June, 4=August, 6=September, 7=October, 8=November, 9=December // Third part = version indenpendant showing the release month in MMYY // Fourth part = 0 [assembly: AssemblyVersion("1.7.1015.0")] [assembly: AssemblyFileVersion("1.7.1015.0")] [assembly: InternalsVisibleTo("OfficeDevPnP.Core.Tests")]
mit
C#
21ce9631122893b3c8c212e5fe13ab42b602aa36
Move test to root namespace
Simution/NServiceBus.Recoverability.RetrySuccessNotification
src/Tests/Config/RetrySuccessNotificationConfigTests.cs
src/Tests/Config/RetrySuccessNotificationConfigTests.cs
using System.Linq; using NServiceBus; using NServiceBus.Configuration.AdvanceExtensibility; using NServiceBus.Features; using NUnit.Framework; [TestFixture] public class RetrySuccessNotificationConfigTests { [Test] public void Notification_Address_Can_Be_Set() { var endpointConfiguration = new EndpointConfiguration("test"); var config = endpointConfiguration.RetrySuccessNotifications(); const string testAddress = "Test"; config.SendRetrySuccessNotificationsTo(testAddress); var settings = endpointConfiguration.GetSettings(); var settingRetrieved = settings.TryGet(RetrySuccessNotification.AddressKey, out string notificationAddress); Assert.IsTrue(settingRetrieved, "Setting was not set"); Assert.AreEqual(testAddress, notificationAddress, "Incorrect Notification Address value"); } [Test] public void Trigger_Headers_Can_Be_Added() { var endpointConfiguration = new EndpointConfiguration("test"); var config = endpointConfiguration.RetrySuccessNotifications(); const string testHeader = "Test"; config.AddRetrySuccessNotificationTriggerHeaders(testHeader); var settings = endpointConfiguration.GetSettings(); var settingRetrieved = settings.TryGet(RetrySuccessNotification.TriggerHeadersKey, out string[] triggerHeaders); var expectedHeaders = RetrySuccessNotification.DefaultTriggerHeaders.Union(new[] { testHeader }); Assert.IsTrue(settingRetrieved, "Setting was not set"); Assert.That(triggerHeaders, Is.EquivalentTo(expectedHeaders), "Headers are missing"); } [Test] public void Copy_Message_Body_Setting_Can_Be_Set() { var endpointConfiguration = new EndpointConfiguration("test"); var config = endpointConfiguration.RetrySuccessNotifications(); config.CopyMessageBodyInNotification = true; var settings = endpointConfiguration.GetSettings(); var settingRetrieved = settings.TryGet(RetrySuccessNotification.CopyBody, out bool copyBodySetting); Assert.IsTrue(settingRetrieved, "Setting was not set"); Assert.IsTrue(copyBodySetting, "Incorrect Copy Body Setting value"); } }
namespace NServiceBus.Recoverability.RetrySucessNotification.ComponentTests { using System.Linq; using NServiceBus; using Configuration.AdvanceExtensibility; using Features; using NUnit.Framework; [TestFixture] public class RetrySuccessNotificationConfigTests { [Test] public void Notification_Address_Can_Be_Set() { var endpointConfiguration = new EndpointConfiguration("test"); var config = endpointConfiguration.RetrySuccessNotifications(); const string testAddress = "Test"; config.SendRetrySuccessNotificationsTo(testAddress); var settings = endpointConfiguration.GetSettings(); var settingRetrieved = settings.TryGet(RetrySuccessNotification.AddressKey, out string notificationAddress); Assert.IsTrue(settingRetrieved, "Setting was not set"); Assert.AreEqual(testAddress, notificationAddress, "Incorrect Notification Address value"); } [Test] public void Trigger_Headers_Can_Be_Added() { var endpointConfiguration = new EndpointConfiguration("test"); var config = endpointConfiguration.RetrySuccessNotifications(); const string testHeader = "Test"; config.AddRetrySuccessNotificationTriggerHeaders(testHeader); var settings = endpointConfiguration.GetSettings(); var settingRetrieved = settings.TryGet(RetrySuccessNotification.TriggerHeadersKey, out string[] triggerHeaders); var expectedHeaders = RetrySuccessNotification.DefaultTriggerHeaders.Union(new[] { testHeader }); Assert.IsTrue(settingRetrieved, "Setting was not set"); Assert.That(triggerHeaders, Is.EquivalentTo(expectedHeaders), "Headers are missing"); } [Test] public void Copy_Message_Body_Setting_Can_Be_Set() { var endpointConfiguration = new EndpointConfiguration("test"); var config = endpointConfiguration.RetrySuccessNotifications(); config.CopyMessageBodyInNotification = true; var settings = endpointConfiguration.GetSettings(); var settingRetrieved = settings.TryGet(RetrySuccessNotification.CopyBody, out bool copyBodySetting); Assert.IsTrue(settingRetrieved, "Setting was not set"); Assert.IsTrue(copyBodySetting, "Incorrect Copy Body Setting value"); } } }
mit
C#
aba3c932fe4df9fdb6ebce735e698b70d93b7641
Fix custom font manager
SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia
src/Web/Avalonia.Web.Blazor/BlazorSingleViewLifetime.cs
src/Web/Avalonia.Web.Blazor/BlazorSingleViewLifetime.cs
using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Media; namespace Avalonia.Web.Blazor { public class BlazorSingleViewLifetime : ISingleViewApplicationLifetime { public Control MainView { get; set; } } public static class BlazorSingleViewLifetimeExtensions { public static AvaloniaBlazorAppBuilder SetupWithBlazorSingleViewLifetime<TApp>() where TApp : Application, new() { var builder = AvaloniaBlazorAppBuilder.Configure<TApp>() .UseSkia() .With(new SkiaOptions() { CustomGpuFactory = () => new BlazorSkiaGpu() }) .SetupWithLifetime(new BlazorSingleViewLifetime()); AvaloniaLocator.CurrentMutable.Bind<FontManager>().ToConstant(new FontManager(new CustomFontManagerImpl())); return builder; } } }
using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Platform; namespace Avalonia.Web.Blazor { public class BlazorSingleViewLifetime : ISingleViewApplicationLifetime { public Control MainView { get; set; } } public static class BlazorSingleViewLifetimeExtensions { public static AvaloniaBlazorAppBuilder SetupWithBlazorSingleViewLifetime<TApp>() where TApp : Application, new() { var builder = AvaloniaBlazorAppBuilder.Configure<TApp>() .UseSkia() .With(new SkiaOptions() { CustomGpuFactory = () => new BlazorSkiaGpu() }) .SetupWithLifetime(new BlazorSingleViewLifetime()); AvaloniaLocator.CurrentMutable.Bind<IFontManagerImpl>().ToConstant(new CustomFontManagerImpl()); return builder; } } }
mit
C#
b6c806dc2fe5c3227b3d6ad554ac2b74849bc1c7
Add StreamButtonClick in ButtonExt
ronnelreposo/cardiotocography
cardio/cardio/Ext/ButtonExt.cs
cardio/cardio/Ext/ButtonExt.cs
using System; using System.Windows.Controls; using static System.Reactive.Linq.Observable; namespace cardio.Ext { /// <summary> /// Represents Button Extension /// </summary> static class ButtonExt { /// <summary> /// Disables the button /// </summary> /// <param name="button">Given button to be disbaled</param> /// <returns>button</returns> internal static Button Disable (this Button button) { if ( !button.IsEnabled ) return button; button.IsEnabled = false; return button; } /// <summary> /// Enables the button /// </summary> /// <param name="button">Given button to enabled</param> /// <returns>button</returns> internal static Button Enable (this Button button) { if ( button.IsEnabled ) return button; button.IsEnabled = true; return button; } /// <summary> /// Converts Button Click to Stream of Button /// </summary> /// <param name="button">The given button</param> /// <returns>The sender button</returns> internal static IObservable<Button> StreamButtonClick(this Button button) { return from evt in FromEventPattern(button, "Click") select evt.Sender as Button; } } }
using System.Windows.Controls; namespace cardio.Ext { /// <summary> /// Represents Button Extension /// </summary> static class ButtonExt { /// <summary> /// Disables the button /// </summary> /// <param name="button">Given button to be disbaled</param> /// <returns>button</returns> internal static Button Disable (this Button button) { if ( !button.IsEnabled ) return button; button.IsEnabled = false; return button; } /// <summary> /// Enables the button /// </summary> /// <param name="button">Given button to enabled</param> /// <returns>button</returns> internal static Button Enable (this Button button) { if ( button.IsEnabled ) return button; button.IsEnabled = true; return button; } } }
mit
C#
ddfac15670ad981f3b7786383ff92b77700f27d2
Fix error in custom action code
SunburstApps/WordPerfectIndexer,SunburstApps/WordPerfectIndexer
IndexerSetup.RegisterProperties/RegisterAction.cs
IndexerSetup.RegisterProperties/RegisterAction.cs
using System; using System.IO; using System.Runtime.InteropServices; using Microsoft.Deployment.WindowsInstaller; namespace IndexerSetup.RegisterProperties { public class RegisterAction { [CustomAction] public static ActionResult RegisterPropDescFile(Session session) { session.Log("Registering property description file..."); string propdescPath = Path.Combine(session.GetTargetPath("INSTALLFOLDER"), "WordPerfectIndexer.propdesc"); bool registerSucceeded = PSRegisterPropertySchema(propdescPath); if (registerSucceeded) return ActionResult.Success; else return ActionResult.Failure; } [DllImport("propsys.dll", CharSet = CharSet.Unicode)] public static extern bool PSRegisterPropertySchema(string propdescPath); } }
using System; using System.IO; using System.Runtime.InteropServices; using Microsoft.Deployment.WindowsInstaller; namespace IndexerSetup.RegisterProperties { public class RegisterAction { [CustomAction] public static ActionResult RegisterPropDescFile(Session session) { session.Log("Registering property description file..."); string propdescPath = Path.Combine(session.GetTargetPath("INSTALLDIR"), "WordPerfectIndexer.propdesc"); bool registerSucceeded = PSRegisterPropertySchema(propdescPath); if (registerSucceeded) return ActionResult.Success; else return ActionResult.Failure; } [DllImport("propsys.dll", CharSet = CharSet.Unicode)] public static extern bool PSRegisterPropertySchema(string propdescPath); } }
mpl-2.0
C#
a09e6b02968ef810c423b3716534b0d9985523e5
Update WebDownloader.cs
milkshakesoftware/PreMailer.Net
PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs
PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs
using System; using System.IO; using System.Net; namespace PreMailer.Net.Downloaders { public class WebDownloader : IWebDownloader { private static IWebDownloader _sharedDownloader; public static IWebDownloader SharedDownloader { get { if (_sharedDownloader == null) { _sharedDownloader = new WebDownloader(); } return _sharedDownloader; } set { _sharedDownloader = value; } } public string DownloadString(Uri uri) { var request = WebRequest.Create(uri); using (var response = (HttpWebResponse)request.GetResponse()) { string Charset = response.CharacterSet; Encoding encoding = Encoding.GetEncoding( Charset ); using( var stream = response.GetResponseStream( ) ) using( var reader = new StreamReader( stream, encoding ) ) { return reader.ReadToEnd( ); } } } } }
using System; using System.IO; using System.Net; namespace PreMailer.Net.Downloaders { public class WebDownloader : IWebDownloader { private static IWebDownloader _sharedDownloader; public static IWebDownloader SharedDownloader { get { if (_sharedDownloader == null) { _sharedDownloader = new WebDownloader(); } return _sharedDownloader; } set { _sharedDownloader = value; } } public string DownloadString(Uri uri) { var request = WebRequest.Create(uri); using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } } }
mit
C#
a6fbc0f966dc0611135a5b7f42f006905419a593
fix compile
IndiegameGarden/Pixie
Pixie1/Pixie1/Behaviors/ReverseControlBehavior.cs
Pixie1/Pixie1/Behaviors/ReverseControlBehavior.cs
 using TTengine.Core; namespace Pixie1.Behaviors { public class ReverseControlBehavior: ThingControl { public ReverseControlBehavior() : base() { } protected override void OnUpdate(ref UpdateParams p) { base.OnUpdate(ref p); ParentThing.TargetMove = -ParentThing.TargetMove; } } }
 using TTengine.Core; namespace Pixie1.Behaviors { public class ReverseControlBehavior: ThingControl { public ReverseControlBehavior() : base() { } protected override void OnUpdate(UpdateParams p) { base.OnUpdate(ref p); ParentThing.TargetMove = -ParentThing.TargetMove; } } }
bsd-2-clause
C#
20475c850f21819bcbb2b4da8e5a9bc168380de6
implement ICloneable and override Equals on WorkItem so that equality checking can prevent unnecessary signalr broadcasts
acas/tfs-monitor,acas/tfs-monitor,acas/tfs-monitor
TfsMonitor.Api/Work/WorkItem.cs
TfsMonitor.Api/Work/WorkItem.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; namespace TfsMonitor.Api.Work { public class WorkItem: ICloneable { public int WorkItemID { get; set; } public string Type {get; set;} public string Project { get; set; } public string Title { get; set; } public string Assignee { get; set; } public string State { get; set; } /// <summary> /// If all CanRead properties on this WorkItem equal the corresponding properties on the comparison object, /// they are considered equal. The properties' implemented Equals method will be used. /// </summary> /// <param name="comparison"></param> /// <returns></returns> public override bool Equals(object comparison) { PropertyInfo[] properties = this.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead) { if (!object.Equals(propertyInfo.GetValue(this), propertyInfo.GetValue(comparison))) { return false; } } } return true; } public override int GetHashCode() { return base.GetHashCode(); } /// <summary> /// Returns copy of the Build object, only the CanWrite properties are set. It's not a deep copy - the reference types retain references. /// </summary> /// <returns></returns> public object Clone() { WorkItem cloned = new WorkItem(); PropertyInfo[] properties = this.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { propertyInfo.SetValue(cloned, propertyInfo.GetValue(this)); } } return cloned; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TfsMonitor.Api.Work { public class WorkItem { public int WorkItemID; public string Type; public string Project; public string Title; public string Assignee; public string State; } }
mit
C#
e1b298eccf2a01dfa35e676c2cf6b10bd33ffb3b
Return search by term URL if no other URL is associated with term was found
roman-yagodin/R7.News,roman-yagodin/R7.News,roman-yagodin/R7.News
R7.News/Controls/ViewModels/TermLinksViewModel.cs
R7.News/Controls/ViewModels/TermLinksViewModel.cs
// // TermLinksViewModel.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2016 Roman M. Yagodin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using DotNetNuke.Common; using DotNetNuke.Entities.Content.Taxonomy; using DotNetNuke.Entities.Portals; using DotNetNuke.R7.ViewModels; using R7.News.Providers; namespace R7.News.Controls.ViewModels { public class TermLinksViewModel { public ViewModelContext Context { get; protected set; } public Term Term { get; protected set; } public int TermId { get { return Term.TermId; } } public string Name { get { return Term.Name; } } public string Url { get { var url = TermUrlManager.GetUrl (Term); if (!string.IsNullOrEmpty (url)) { int tabId; if (int.TryParse (url, out tabId)) { // url contains tabId return Globals.NavigateURL (tabId); } // url of another type return Globals.LinkClick (url, Context.Module.TabId, Context.Module.ModuleId); } // REVIEW: SearchTabId could be undefined // return term search link return Globals.NavigateURL (PortalSettings.Current.SearchTabId) + "?Tag=" + Term.Name; } } public TermLinksViewModel (Term term, ViewModelContext context) { Term = term; Context = context; } } }
// // TermLinksViewModel.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2016 Roman M. Yagodin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using DotNetNuke.Common; using DotNetNuke.Entities.Content.Taxonomy; using DotNetNuke.R7.ViewModels; using R7.News.Providers; namespace R7.News.Controls.ViewModels { public class TermLinksViewModel { public ViewModelContext Context { get; protected set; } public Term Term { get; protected set; } public int TermId { get { return Term.TermId; } } public string Name { get { return Term.Name; } } public string Url { get { return Globals.LinkClick (TermUrlManager.GetUrl (Term), Context.Module.TabId, Context.Module.ModuleId); } } public TermLinksViewModel (Term term, ViewModelContext context) { Term = term; Context = context; } } }
agpl-3.0
C#
e08525110a6d0eab322d43bbe39a570cf46fc4e8
Enable localhost
mtmk/akkadotnetexamples,mtmk/akkadotnetexamples
containerized/shared/Common.cs
containerized/shared/Common.cs
using System; using System.IO; using System.Threading; using Akka.Actor; using Akka.Configuration; using Akka.Event; namespace shared { public static class Common { public static ActorSystem CreateSystem(string configFile) { Console.WriteLine("Starting.."); StandardOutLogger.UseColors = false; var conf = File.ReadAllText(configFile) .Replace("{{OWN_HOST}}", Environment.GetEnvironmentVariable("OWN_HOST") ?? (Environment.CommandLine.Contains("--local") ? "localhost" : System.Net.Dns.GetHostName())) .Replace("{{SEED_NODE_HOST}}", Environment.GetEnvironmentVariable("SEED_NODE_HOST") ?? "localhost") .Replace("{{SEED_NODE_PORT}}", Environment.GetEnvironmentVariable("SEED_NODE_PORT") ?? "8080"); Console.WriteLine(conf); var config = ConfigurationFactory.ParseString(conf); return ActorSystem.Create("acme", config); } public static void WaitForExit() { var r = new ManualResetEvent(false); Console.CancelKeyPress += (_,e) => { Console.WriteLine("Caught ctrl-c.."); e.Cancel = true; r.Set(); }; r.WaitOne(); Console.WriteLine("Exiting.."); } public static void Shutdown(ActorSystem sys) { CoordinatedShutdown.Get(sys).Run().Wait(TimeSpan.FromSeconds(10)); Console.WriteLine("Bye"); } } }
using System; using System.IO; using System.Threading; using Akka.Actor; using Akka.Configuration; using Akka.Event; namespace shared { public static class Common { public static ActorSystem CreateSystem(string configFile) { Console.WriteLine("Starting.."); StandardOutLogger.UseColors = false; var conf = File.ReadAllText(configFile) .Replace("{{OWN_HOST}}", Environment.GetEnvironmentVariable("OWN_HOST") ?? System.Net.Dns.GetHostName()) .Replace("{{SEED_NODE_HOST}}", Environment.GetEnvironmentVariable("SEED_NODE_HOST") ?? "localhost") .Replace("{{SEED_NODE_PORT}}", Environment.GetEnvironmentVariable("SEED_NODE_PORT") ?? "8080"); Console.WriteLine(conf); var config = ConfigurationFactory.ParseString(conf); return ActorSystem.Create("acme", config); } public static void WaitForExit() { var r = new ManualResetEvent(false); Console.CancelKeyPress += (_,e) => { Console.WriteLine("Caught ctrl-c.."); e.Cancel = true; r.Set(); }; r.WaitOne(); Console.WriteLine("Exiting.."); } public static void Shutdown(ActorSystem sys) { CoordinatedShutdown.Get(sys).Run().Wait(TimeSpan.FromSeconds(10)); Console.WriteLine("Bye"); } } }
mit
C#
716a4c2a2c334cf85dc040afbab725080539d1fe
Update Label.cs
thakyZ/VoidEngine,vvoid-inc/VoidEngine
VoidEngine/Label.cs
VoidEngine/Label.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; namespace VoidEngine { /// <summary> /// The Label class for the VoidEngine /// </summary> public class Label { protected string text; protected SpriteFont texture; protected Vector2 position; /// <summary> /// Creates the Label. /// </summary> /// <param name="text">The text that will be in the label.</param> public Label(Vector2 position, SpriteFont texture, string text) { this.text = text; this.texture = texture; this.position = position; } public virtual void Update(GameTime gameTime, string text) { this.text = text; } public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch) { Vector2 FontOrigin = texture.MeasureString(text) / 2; // Draw the string spriteBatch.DrawString(texture, text, position, Color.White, 0, FontOrigin, 0.5f, SpriteEffects.None, 0.5f); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; namespace VoidEngine { /// <summary> /// The Label class for the VoidEngine /// </summary> public class Label { /// <summary> /// Creates the Label. /// </summary> /// <param name="text">The text that will be in the label.</param> public Label(string text) { } } }
mit
C#
36cabe72cf854cbfd05f01fb0d03dc91e9717078
Make DimmedLoadingLayer block input when active
smoogipoo/osu,EVAST9919/osu,2yangk23/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,smoogipoo/osu,ppy/osu,EVAST9919/osu,johnneijzen/osu,peppy/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,peppy/osu
osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs
osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.Color4Extensions; using osuTK; namespace osu.Game.Graphics.UserInterface { public class DimmedLoadingLayer : OverlayContainer { private const float transition_duration = 250; private readonly LoadingAnimation loading; public DimmedLoadingLayer(float dimAmount = 0.5f, float iconScale = 1f) { RelativeSizeAxes = Axes.Both; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(dimAmount), }, loading = new LoadingAnimation { Scale = new Vector2(iconScale) }, }; } protected override void PopIn() { this.FadeIn(transition_duration, Easing.OutQuint); loading.Show(); } protected override void PopOut() { this.FadeOut(transition_duration, Easing.OutQuint); loading.Hide(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.Color4Extensions; using osuTK; namespace osu.Game.Graphics.UserInterface { public class DimmedLoadingLayer : VisibilityContainer { private const float transition_duration = 250; private readonly LoadingAnimation loading; public DimmedLoadingLayer(float dimAmount = 0.5f, float iconScale = 1f) { RelativeSizeAxes = Axes.Both; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(dimAmount), }, loading = new LoadingAnimation { Scale = new Vector2(iconScale) }, }; } protected override void PopIn() { this.FadeIn(transition_duration, Easing.OutQuint); loading.Show(); } protected override void PopOut() { this.FadeOut(transition_duration, Easing.OutQuint); loading.Hide(); } } }
mit
C#
4419b4cfa53e26db14bca25cff79b1cfc82c1019
Use IsDefault for RazorSpan's
sharwell/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,weltkante/roslyn,diryboy/roslyn,brettfo/roslyn,heejaechang/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,genlu/roslyn,heejaechang/roslyn,bartdesmet/roslyn,physhi/roslyn,jmarolf/roslyn,bartdesmet/roslyn,stephentoub/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,AlekseyTs/roslyn,aelij/roslyn,gafter/roslyn,tmat/roslyn,genlu/roslyn,tannergooding/roslyn,jasonmalinowski/roslyn,gafter/roslyn,dotnet/roslyn,physhi/roslyn,weltkante/roslyn,wvdd007/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,tmat/roslyn,stephentoub/roslyn,tmat/roslyn,mgoertz-msft/roslyn,brettfo/roslyn,aelij/roslyn,KevinRansom/roslyn,heejaechang/roslyn,mavasani/roslyn,aelij/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,sharwell/roslyn,physhi/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,mavasani/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,gafter/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,diryboy/roslyn,panopticoncentral/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,stephentoub/roslyn,jmarolf/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,AmadeusW/roslyn
src/Tools/ExternalAccess/Razor/RazorSpanMappingServiceWrapper.cs
src/Tools/ExternalAccess/Razor/RazorSpanMappingServiceWrapper.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { internal sealed class RazorSpanMappingServiceWrapper : ISpanMappingService { private readonly IRazorSpanMappingService _razorSpanMappingService; public RazorSpanMappingServiceWrapper(IRazorSpanMappingService razorSpanMappingService) { _razorSpanMappingService = razorSpanMappingService ?? throw new ArgumentNullException(nameof(razorSpanMappingService)); } public async Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken) { var razorSpans = await _razorSpanMappingService.MapSpansAsync(document, spans, cancellationToken).ConfigureAwait(false); var roslynSpans = new MappedSpanResult[razorSpans.Length]; for (var i = 0; i < razorSpans.Length; i++) { var razorSpan = razorSpans[i]; if (razorSpan.IsDefault) { // Unmapped location roslynSpans[i] = default; } else { roslynSpans[i] = new MappedSpanResult(razorSpan.FilePath, razorSpan.LinePositionSpan, razorSpan.Span); } } return roslynSpans.ToImmutableArray(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { internal sealed class RazorSpanMappingServiceWrapper : ISpanMappingService { private readonly IRazorSpanMappingService _razorSpanMappingService; public RazorSpanMappingServiceWrapper(IRazorSpanMappingService razorSpanMappingService) { _razorSpanMappingService = razorSpanMappingService ?? throw new ArgumentNullException(nameof(razorSpanMappingService)); } public async Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken) { var razorSpans = await _razorSpanMappingService.MapSpansAsync(document, spans, cancellationToken).ConfigureAwait(false); var roslynSpans = new MappedSpanResult[razorSpans.Length]; for (var i = 0; i < razorSpans.Length; i++) { var razorSpan = razorSpans[i]; if (razorSpan.FilePath == null) { // Unmapped location roslynSpans[i] = default; } else { roslynSpans[i] = new MappedSpanResult(razorSpan.FilePath, razorSpan.LinePositionSpan, razorSpan.Span); } } return roslynSpans.ToImmutableArray(); } } }
mit
C#
e99647f3eb088f55697dbf5b823e1a28834afdd7
fix missing theory attribute
mruhul/Bolt.Common.Extensions
src/Bolt.Common.Extensions.UnitTests/EnumExtensionsTest.cs
src/Bolt.Common.Extensions.UnitTests/EnumExtensionsTest.cs
using Shouldly; using Xunit; namespace Bolt.Common.Extensions.UnitTests { public class EnumExtensionsTest { [Theory] [InlineData("", null)] [InlineData(null, null)] [InlineData("red", Color.Red)] [InlineData("Red", Color.Red)] [InlineData("reds", null)] public void ToEnumTest(string source, Color? expectedResult) { source.ToEnum<Color>().ShouldBe(expectedResult); } [Theory] [InlineData(null, Color.None)] [InlineData(Color.Red, Color.Red)] public void NullSafeTest(Color? source, Color expected) { source.NullSafe().ShouldBe(expected); } } public enum Color { None = 0, [System.ComponentModel.Description("Red Color")] Red = 1, Green = 2, Blue = 3 } }
using Shouldly; using Xunit; namespace Bolt.Common.Extensions.UnitTests { public class EnumExtensionsTest { [Theory] [InlineData("", null)] [InlineData(null, null)] [InlineData("red", Color.Red)] [InlineData("Red", Color.Red)] [InlineData("reds", null)] public void ToEnumTest(string source, Color? expectedResult) { source.ToEnum<Color>().ShouldBe(expectedResult); } [InlineData(null, Color.None)] [InlineData(Color.Red, Color.Red)] public void NullSafeTest(Color? source, Color expected) { source.NullSafe().ShouldBe(expected); } } public enum Color { None = 0, [System.ComponentModel.Description("Red Color")] Red = 1, Green = 2, Blue = 3 } }
mit
C#
0af74e4a4807b270b8ad49de909bb1eb52122b71
Make Tables module-level setting
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University.Launchpad/Components/LaunchpadSettings.cs
R7.University.Launchpad/Components/LaunchpadSettings.cs
// // LaunchpadSettings.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2014-2017 Roman M. Yagodin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Collections.Generic; using System.Linq; using DotNetNuke.Entities.Modules.Settings; using R7.DotNetNuke.Extensions.Utilities; namespace R7.University.Launchpad.Components { /// <summary> /// Provides strong typed access to settings used by module /// </summary> [Serializable] public class LaunchpadSettings { [TabModuleSetting (Prefix = "Launchpad_")] public int PageSize { get; set; } = 20; [ModuleSetting (Prefix = "Launchpad_", ParameterName = "Tables")] public string TablesInternal { get; set; } = string.Empty; private List<string> tables; public List<string> Tables { get { return tables ?? (tables = TablesInternal.Split (new [] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList ()); } set { tables = value; TablesInternal = TextUtils.FormatList (";", value.ToArray ()); } } } }
// // LaunchpadSettings.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2014-2017 Roman M. Yagodin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Collections.Generic; using System.Linq; using DotNetNuke.Entities.Modules.Settings; using R7.DotNetNuke.Extensions.Utilities; namespace R7.University.Launchpad.Components { /// <summary> /// Provides strong typed access to settings used by module /// </summary> [Serializable] public class LaunchpadSettings { [TabModuleSetting (Prefix = "Launchpad_")] public int PageSize { get; set; } = 20; [TabModuleSetting (Prefix = "Launchpad_", ParameterName = "Tables")] public string TablesInternal { get; set; } = string.Empty; private List<string> tables; public List<string> Tables { get { return tables ?? (tables = TablesInternal.Split (new [] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList ()); } set { tables = value; TablesInternal = TextUtils.FormatList (";", value.ToArray ()); } } } }
agpl-3.0
C#
b6bda54f21f2a5724857905f02cfb558247cc67d
use path attribute instead of file
darrenkopp/SassyStudio
SassyStudio.Compiler/Parsing/XmlDoc/FileReferenceTag.cs
SassyStudio.Compiler/Parsing/XmlDoc/FileReferenceTag.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SassyStudio.Compiler.Parsing { public class FileReferenceTag : XmlDocumentationTag { public ISassDocument Document { get; protected set; } public XmlAttribute Filename { get; protected set; } protected override void OnAttributeParsed(XmlAttribute attribute, ITextProvider text) { if (attribute.Name != null && IsPathAttribute(text.GetText(attribute.Name.Start, attribute.Name.Length))) Filename = attribute; } private bool IsPathAttribute(string attributeName) { switch (attributeName) { case "file": case "path": return true; default: return false; } } public void ResolveImports(ITextProvider text, ISassDocument document, IDocumentManager documentManager) { try { if (Filename == null || Filename.Value == null) return; var path = ImportResolver.ResolvePath(Filename.Value, text, document.Source.Directory); if (string.IsNullOrEmpty(path)) return; var importFile = new FileInfo(path); if (importFile.Exists) Document = documentManager.Import(importFile, document); } catch (Exception ex) { OutputLogger.Log(ex, "Failed to process reference file."); } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SassyStudio.Compiler.Parsing { public class FileReferenceTag : XmlDocumentationTag { public ISassDocument Document { get; protected set; } public XmlAttribute Filename { get; protected set; } protected override void OnAttributeParsed(XmlAttribute attribute, ITextProvider text) { if (attribute.Name != null && text.GetText(attribute.Name.Start, attribute.Name.Length) == "file") Filename = attribute; } public void ResolveImports(ITextProvider text, ISassDocument document, IDocumentManager documentManager) { try { if (Filename == null || Filename.Value == null) return; var path = ImportResolver.ResolvePath(Filename.Value, text, document.Source.Directory); if (string.IsNullOrEmpty(path)) return; var importFile = new FileInfo(path); if (importFile.Exists) Document = documentManager.Import(importFile, document); } catch (Exception ex) { OutputLogger.Log(ex, "Failed to process reference file."); } } } }
mit
C#
5c14210fa363da12def4ebfeb9b6a32f3852b683
Add remove functions to Tasker
Huex/VKDiscordBot
VKDiscordBot/Services/Tasker.cs
VKDiscordBot/Services/Tasker.cs
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using VKDiscordBot.Models; namespace VKDiscordBot.Services { public class Tasker : BotServiceBase { private List<RepetitiveTask> _tasks; public Tasker() { _tasks = new List<RepetitiveTask>(); } public void Add(RepetitiveTask task) { _tasks.Add(task); RaiseLog(Discord.LogSeverity.Verbose, $"Added new repetitive task: {task.Id}"); } public void AddAndStart(RepetitiveTask task) { Add(task); task.Start(); } public void Remove(RepetitiveTask task) { if (_tasks.Contains(task)) { _tasks.Remove(task); RaiseLog(Discord.LogSeverity.Verbose, $"Removed repetitive task: {task.Id}"); } } public void Remove(int taskId) { var task = _tasks.Find(t => t.Id == taskId); if (task != null) { Remove(task); } } public RepetitiveTask Find(Predicate<RepetitiveTask> match) { return _tasks.Find(match); } } }
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using VKDiscordBot.Models; namespace VKDiscordBot.Services { public class Tasker : BotServiceBase { private List<RepetitiveTask> _tasks; public Tasker() { _tasks = new List<RepetitiveTask>(); } public void Add(RepetitiveTask task) { _tasks.Add(task); RaiseLog(Discord.LogSeverity.Verbose, $"Added new repetitive task: {task.Id}"); } public void AddAndStart(RepetitiveTask task) { Add(task); task.Start(); } public RepetitiveTask Find(Predicate<RepetitiveTask> match) { return _tasks.Find(match); } } }
mit
C#
faa083922eaba77db4c801bee00ab42761463428
Fix ModelTestBase.
quartz-software/kephas,quartz-software/kephas
src/TestingFramework/Kephas.Testing.Model/ModelTestBase.cs
src/TestingFramework/Kephas.Testing.Model/ModelTestBase.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ModelTestBase.cs" company="Kephas Software SRL"> // Copyright (c) Kephas Software SRL. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // </copyright> // <summary> // Implements the model test base class. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace Kephas.Model.Tests { using System; using System.Collections.Generic; using System.Reflection; using System.Threading; using System.Threading.Tasks; using Kephas.Composition; using Kephas.Model.Runtime; using Kephas.Testing.Composition; using NSubstitute; /// <summary> /// A model test base. /// </summary> public abstract class ModelTestBase : CompositionTestBase { public IRuntimeModelRegistry GetModelRegistry(params Type[] elements) { var registry = Substitute.For<IRuntimeModelRegistry>(); registry.GetRuntimeElementsAsync(Arg.Any<CancellationToken>()) .Returns(Task.FromResult<IEnumerable<object>>(elements)); return registry; } public ICompositionContext CreateContainerForModel(params Type[] elements) { var container = this.CreateContainer( assemblies: new [] { typeof(IModelSpace).GetTypeInfo().Assembly }, config: b => b.WithFactory(() => this.GetModelRegistry(elements), isSingleton: true, allowMultiple: true)); return container; } public ICompositionContext CreateContainerForModel(Type[] parts, Type[] elements) { var container = this.CreateContainer( assemblies: new[] { typeof(IModelSpace).GetTypeInfo().Assembly }, parts: parts, config: b => b.WithFactory(() => this.GetModelRegistry(elements), isSingleton: true, allowMultiple: true)); return container; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ModelTestBase.cs" company="Kephas Software SRL"> // Copyright (c) Kephas Software SRL. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // </copyright> // <summary> // Implements the model test base class. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace Kephas.Model.Tests { using System; using System.Collections.Generic; using System.Reflection; using System.Threading; using System.Threading.Tasks; using Kephas.Composition; using Kephas.Model.Runtime; using Kephas.Testing.Composition; using NSubstitute; /// <summary> /// A model test base. /// </summary> public abstract class ModelTestBase : CompositionTestBase { public IRuntimeModelRegistry GetModelRegistry(params Type[] elements) { var registry = Substitute.For<IRuntimeModelRegistry>(); registry.GetRuntimeElementsAsync(Arg.Any<CancellationToken>()) .Returns(Task.FromResult<IEnumerable<object>>(elements)); return registry; } public ICompositionContext CreateContainerForModel(params Type[] elements) { var container = this.CreateContainer( assemblies: new [] { typeof(IModelSpace).GetTypeInfo().Assembly }, config: b => b.WithFactory(() => this.GetModelRegistry(elements), isSingleton: true)); return container; } public ICompositionContext CreateContainerForModel(Type[] parts, Type[] elements) { var container = this.CreateContainer( assemblies: new[] { typeof(IModelSpace).GetTypeInfo().Assembly }, parts: parts, config: b => b.WithFactory(() => this.GetModelRegistry(elements), isSingleton: true)); return container; } } }
mit
C#
e0b4ef593e8577d036016144705ac21d750db0fe
test automatic challenge after redirecting from another site
VahidN/DNTIdentity,VahidN/DNTIdentity,VahidN/DNTIdentity
src/ASPNETCoreIdentitySample/Controllers/HomeController.cs
src/ASPNETCoreIdentitySample/Controllers/HomeController.cs
using DNTBreadCrumb.Core; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using ASPNETCoreIdentitySample.Common.IdentityToolkit; namespace ASPNETCoreIdentitySample.Controllers { [BreadCrumb(Title = "خانه", UseDefaultRouteUrl = true, Order = 0)] public class HomeController : Controller { [BreadCrumb(Title = "ایندکس", Order = 1)] public IActionResult Index() { return View(); } [BreadCrumb(Title = "خطا", Order = 1)] public IActionResult Error() { return View(); } /// <summary> /// To test automatic challenge after redirecting from another site /// Sample URL: http://localhost:5000/Home/CallBackResult?token=1&status=2&orderId=3&terminalNo=4&rrn=5 /// </summary> [Authorize] public IActionResult CallBackResult(long token, string status, string orderId, string terminalNo, string rrn) { var userId = User.Identity.GetUserId(); return Json(new { userId, token, status, orderId, terminalNo, rrn }); } } }
using DNTBreadCrumb.Core; using Microsoft.AspNetCore.Mvc; namespace ASPNETCoreIdentitySample.Controllers { [BreadCrumb(Title = "خانه", UseDefaultRouteUrl = true, Order = 0)] public class HomeController : Controller { [BreadCrumb(Title = "ایندکس", Order = 1)] public IActionResult Index() { return View(); } [BreadCrumb(Title = "خطا", Order = 1)] public IActionResult Error() { return View(); } } }
apache-2.0
C#
96cb161ea7259d271c25eb5643c0d30794768f15
Update RoslynSyntaxClassificationServiceFactory.cs
jasonmalinowski/roslyn,KevinRansom/roslyn,physhi/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,diryboy/roslyn,tmat/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,genlu/roslyn,tmat/roslyn,heejaechang/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,tmat/roslyn,brettfo/roslyn,tannergooding/roslyn,mavasani/roslyn,eriawan/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,tannergooding/roslyn,mavasani/roslyn,genlu/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,brettfo/roslyn,sharwell/roslyn,gafter/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,physhi/roslyn,ErikSchierboom/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,KevinRansom/roslyn,davkean/roslyn,diryboy/roslyn,davkean/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,aelij/roslyn,gafter/roslyn,wvdd007/roslyn,heejaechang/roslyn,AmadeusW/roslyn,eriawan/roslyn,physhi/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,KevinRansom/roslyn,stephentoub/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,mavasani/roslyn,sharwell/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,genlu/roslyn,aelij/roslyn,jmarolf/roslyn,davkean/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,gafter/roslyn,aelij/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,brettfo/roslyn
src/VisualStudio/LiveShare/Impl/Client/Classification/RoslynSyntaxClassificationServiceFactory.cs
src/VisualStudio/LiveShare/Impl/Client/Classification/RoslynSyntaxClassificationServiceFactory.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using Microsoft.CodeAnalysis.Classification; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Experiments; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Classification { internal abstract class RoslynSyntaxClassificationServiceFactory : ILanguageServiceFactory { private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory; private readonly RemoteLanguageServiceWorkspace _remoteLanguageServiceWorkspace; private readonly ClassificationTypeMap _classificationTypeMap; private readonly IThreadingContext _threadingContext; public RoslynSyntaxClassificationServiceFactory(AbstractLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext) { _roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory)); _remoteLanguageServiceWorkspace = remoteLanguageServiceWorkspace ?? throw new ArgumentNullException(nameof(remoteLanguageServiceWorkspace)); _classificationTypeMap = classificationTypeMap ?? throw new ArgumentNullException(nameof(classificationTypeMap)); _threadingContext = threadingContext ?? throw new ArgumentNullException(nameof(threadingContext)); } public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { return new RoslynSyntaxClassificationService(_roslynLspClientServiceFactory, _remoteLanguageServiceWorkspace, languageServices.GetOriginalLanguageService<ISyntaxClassificationService>(), _classificationTypeMap, _threadingContext); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using Microsoft.CodeAnalysis.Classification; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Experiments; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Classification { internal abstract class RoslynSyntaxClassificationServiceFactory : ILanguageServiceFactory { private readonly AbstractLspClientServiceFactory _roslynLspClientServiceFactory; private readonly RemoteLanguageServiceWorkspace _remoteLanguageServiceWorkspace; private readonly ClassificationTypeMap _classificationTypeMap; private readonly IThreadingContext _threadingContext; public RoslynSyntaxClassificationServiceFactory(AbstractLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext) { _roslynLspClientServiceFactory = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory)); _remoteLanguageServiceWorkspace = remoteLanguageServiceWorkspace ?? throw new ArgumentNullException(nameof(remoteLanguageServiceWorkspace)); _classificationTypeMap = classificationTypeMap ?? throw new ArgumentNullException(nameof(classificationTypeMap)); _threadingContext = threadingContext ?? throw new ArgumentNullException(nameof(threadingContext)); } public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { var experimentationService = languageServices.WorkspaceServices.GetService<IExperimentationService>(); return new RoslynSyntaxClassificationService(_roslynLspClientServiceFactory, _remoteLanguageServiceWorkspace, languageServices.GetOriginalLanguageService<ISyntaxClassificationService>(), _classificationTypeMap, _threadingContext); } } }
mit
C#
4ea9172ef5a80fd95e73f6bf7102548b136d1f38
Update SubHeader.cshtml
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Support.Web/Views/Account/SubHeader.cshtml
src/SFA.DAS.EAS.Support.Web/Views/Account/SubHeader.cshtml
@model SFA.DAS.EAS.Support.Core.Models.Account @{ Layout = null; } <div class="grid-row"> <div class="column-full"> <h5 class="heading-small"> <a href="/" class="govuk-back-link"> Home </a> </h5> <h1 class="heading-large"> @(Model?.DasAccountName) @if (!string.IsNullOrEmpty(Model?.PublicHashedAccountId)) { <span class="heading-secondary"> Account ID @(Model?.PublicHashedAccountId), created @Model.DateRegistered.ToString("dd/MM/yyyy")</span> } <span class="heading-secondary"> Levy Status @Model.ApprenticeshipEmployerType</span> </h1> </div> </div>
@model SFA.DAS.EAS.Support.Core.Models.Account @{ Layout = null; } <div class="grid-row"> <div class="column-full"> <h1 class="heading-large"> @(Model?.DasAccountName) @if (!string.IsNullOrEmpty(Model?.PublicHashedAccountId)) { <span class="heading-secondary"> Account ID @(Model?.PublicHashedAccountId), created @Model.DateRegistered.ToString("dd/MM/yyyy")</span> } <span class="heading-secondary"> Levy Status @Model.ApprenticeshipEmployerType</span> </h1> </div> </div>
mit
C#
3f2712f853474a927292ba90d616d46389f689a3
Update ProviderPronim2i.cs
ACBrNet/ACBr.Net.NFSe
src/ACBr.Net.NFSe/Providers/Pronim2/ProviderPronim2i.cs
src/ACBr.Net.NFSe/Providers/Pronim2/ProviderPronim2i.cs
// *********************************************************************** // Assembly : ACBr.Net.NFSe // Author : Felipe Silveira/Transis // Created : 14-02-2020 // // *********************************************************************** // <copyright file="ProviderFiorilli.cs" company="ACBr.Net"> // The MIT License (MIT) // Copyright (c) 2020 Grupo ACBr.Net // // 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. // </copyright> // <summary></summary> // *********************************************************************** using ACBr.Net.NFSe.Configuracao; namespace ACBr.Net.NFSe.Providers { // ReSharper disable once InconsistentNaming internal sealed class ProviderPronim2 : ProviderABRASF201 { #region Constructors public ProviderPronim2(ConfigNFSe config, ACBrMunicipioNFSe municipio) : base(config, municipio) { Name = "Pronim2"; } #endregion Constructors #region Methods protected override IABRASF2Client GetClient(TipoUrl tipo) { return new Pronim2ServiceClient(this, tipo); } #endregion Methods } }
// *********************************************************************** // Assembly : ACBr.Net.NFSe // Author : Rafael Dias // Created : 29-01-2020 // // Last Modified By : Rafael Dias // Last Modified On : 29-01-2020 // *********************************************************************** // <copyright file="ProviderFiorilli.cs" company="ACBr.Net"> // The MIT License (MIT) // Copyright (c) 2016 Grupo ACBr.Net // // 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. // </copyright> // <summary></summary> // *********************************************************************** using ACBr.Net.NFSe.Configuracao; namespace ACBr.Net.NFSe.Providers { // ReSharper disable once InconsistentNaming internal sealed class ProviderPronim2 : ProviderABRASF201 { #region Constructors public ProviderPronim2(ConfigNFSe config, ACBrMunicipioNFSe municipio) : base(config, municipio) { Name = "Pronim2"; } #endregion Constructors #region Methods protected override IABRASF2Client GetClient(TipoUrl tipo) { return new Pronim2ServiceClient(this, tipo); } #endregion Methods } }
mit
C#
471c4d634ea5d3f54c7e056cdfe2f77b8d06ee1f
update tests to use auth (of course!)
thefilter/AspNetCore.Identity.Elastic,thefilter/AspNetCore.Identity.Elastic
src/AspNetCore.Identity.Elastic/ElasticClientFactory.cs
src/AspNetCore.Identity.Elastic/ElasticClientFactory.cs
using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using Nest; using Elasticsearch.Net; using Newtonsoft.Json; [assembly: InternalsVisibleTo("AspNetCore.Identity.Elastic.Tests")] namespace AspNetCore.Identity.Elastic { internal static class ElasticClientFactory { public static IElasticClient Create(Uri node, string defaultIndex) { var settings = new ConnectionSettings( new SingleNodeConnectionPool(node), new HttpConnection(), new SerializerFactory(DefineSerializationSettings)); settings.MapDefaultTypeIndices(m => m .Add(typeof(ElasticIdentityUser), defaultIndex)); settings.BasicAuthentication("elastic","changeme"); var transport = new Transport<IConnectionSettingsValues>(settings); return new ElasticClient(settings); } private static void DefineSerializationSettings( JsonSerializerSettings jsonSerializerSettings, IConnectionSettingsValues connectionSettingsValues) { var dateTimeConverter = new UtcIsoDateTimeConverter(); if (jsonSerializerSettings.Converters == null) { jsonSerializerSettings.Converters = new List<JsonConverter>(); } jsonSerializerSettings.Converters.Add(dateTimeConverter); jsonSerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; } } }
using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using Nest; using Elasticsearch.Net; using Newtonsoft.Json; [assembly: InternalsVisibleTo("AspNetCore.Identity.Elastic.Tests")] namespace AspNetCore.Identity.Elastic { internal static class ElasticClientFactory { public static IElasticClient Create(Uri node, string defaultIndex) { var settings = new ConnectionSettings( new SingleNodeConnectionPool(node), new HttpConnection(), new SerializerFactory(DefineSerializationSettings)); settings.MapDefaultTypeIndices(m => m .Add(typeof(ElasticIdentityUser), defaultIndex)); var transport = new Transport<IConnectionSettingsValues>(settings); return new ElasticClient(settings); } private static void DefineSerializationSettings( JsonSerializerSettings jsonSerializerSettings, IConnectionSettingsValues connectionSettingsValues) { var dateTimeConverter = new UtcIsoDateTimeConverter(); if (jsonSerializerSettings.Converters == null) { jsonSerializerSettings.Converters = new List<JsonConverter>(); } jsonSerializerSettings.Converters.Add(dateTimeConverter); jsonSerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; } } }
apache-2.0
C#
102b1b64eb565209afd2340a2b9d927b820e3f54
Add CreateHiddenitem test
hermanussen/Sitecore.FakeDb,sergeyshushlyapin/Sitecore.FakeDb,pveller/Sitecore.FakeDb
src/Sitecore.FakeDb.Tests/Data/Items/ItemAppearanceTest.cs
src/Sitecore.FakeDb.Tests/Data/Items/ItemAppearanceTest.cs
namespace Sitecore.FakeDb.Tests.Data.Items { using FluentAssertions; using Sitecore.Data.Items; using Xunit; public class ItemAppearanceTest { [Fact] public void ShouldReadDefaultItemAppearance() { // arrange & act using (var db = new Db { new DbItem("home") }) { var item = db.GetItem("/sitecore/content/home"); // assert item.Appearance.ContextMenu.Should().BeEmpty(); item.Appearance.DisplayName.Should().Be("home"); item.Appearance.HelpLink.Should().BeEmpty(); item.Appearance.Hidden.Should().BeFalse(); item.Appearance.Icon.Should().Be("/sitecore/client/images/document16x16.gif"); item.Appearance.LongDescription.Should().BeEmpty(); item.Appearance.ReadOnly.Should().BeFalse(); item.Appearance.Ribbon.Should().BeEmpty(); item.Appearance.ShortDescription.Should().BeEmpty(); item.Appearance.Skin.Should().BeEmpty(); item.Appearance.Sortorder.Should().Be(0); item.Appearance.Style.Should().BeEmpty(); item.Appearance.Thumbnail.Should().Be("/sitecore/client/images/document16x16.gif"); } } [Fact] public void ShouldHideItem() { // arrange using (var db = new Db { new DbItem("home") }) { var item = db.GetItem("/sitecore/content/home"); // act using (new EditContext(item)) { item.Appearance.DisplayName = "Home"; item.Appearance.Hidden = true; item.Appearance.ReadOnly = true; } // assert item.Appearance.DisplayName.Should().Be("Home"); item.Appearance.Hidden.Should().BeTrue(); item.Appearance.ReadOnly.Should().BeTrue(); } } [Fact] public void ShouldCreateReadonlyItem() { // arrange using (var db = new Db { new DbItem("home") { { FieldIDs.ReadOnly, "1" } } }) { var item = db.GetItem("/sitecore/content/home"); // assert item.Appearance.ReadOnly.Should().BeTrue(); } } } }
namespace Sitecore.FakeDb.Tests.Data.Items { using FluentAssertions; using Sitecore.Data.Items; using Xunit; public class ItemAppearanceTest { [Fact] public void ShouldReadDefaultItemAppearance() { // arrange & act using (var db = new Db { new DbItem("home") }) { var item = db.GetItem("/sitecore/content/home"); // assert item.Appearance.ContextMenu.Should().BeEmpty(); item.Appearance.DisplayName.Should().Be("home"); item.Appearance.HelpLink.Should().BeEmpty(); item.Appearance.Hidden.Should().BeFalse(); item.Appearance.Icon.Should().Be("/sitecore/client/images/document16x16.gif"); item.Appearance.LongDescription.Should().BeEmpty(); item.Appearance.ReadOnly.Should().BeFalse(); item.Appearance.Ribbon.Should().BeEmpty(); item.Appearance.ShortDescription.Should().BeEmpty(); item.Appearance.Skin.Should().BeEmpty(); item.Appearance.Sortorder.Should().Be(0); item.Appearance.Style.Should().BeEmpty(); item.Appearance.Thumbnail.Should().Be("/sitecore/client/images/document16x16.gif"); } } [Fact] public void ShouldHideItem() { // arrange using (var db = new Db { new DbItem("home") }) { var item = db.GetItem("/sitecore/content/home"); // act using (new EditContext(item)) { item.Appearance.DisplayName = "Home"; item.Appearance.Hidden = true; item.Appearance.ReadOnly = true; } // assert item.Appearance.DisplayName.Should().Be("Home"); item.Appearance.Hidden.Should().BeTrue(); item.Appearance.ReadOnly.Should().BeTrue(); } } } }
mit
C#
76a09557f45443a9d021c7a4c23fd91ac947f17a
Set next.
julianpaulozzi/katanaproject,evicertia/Katana,PxAndy/Katana,HongJunRen/katanaproject,abrodersen/katana,tomi85/Microsoft.Owin,abrodersen/katana,eocampo/KatanaProject301,eocampo/KatanaProject301,PxAndy/Katana,HongJunRen/katanaproject,HongJunRen/katanaproject,abrodersen/katana,abrodersen/katana,evicertia/Katana,PxAndy/Katana,evicertia/Katana,abrodersen/katana,julianpaulozzi/katanaproject,tomi85/Microsoft.Owin,eocampo/KatanaProject301,tomi85/Microsoft.Owin,HongJunRen/katanaproject,eocampo/KatanaProject301,HongJunRen/katanaproject,evicertia/Katana,tomi85/Microsoft.Owin,eocampo/KatanaProject301,evicertia/Katana,julianpaulozzi/katanaproject,PxAndy/Katana,julianpaulozzi/katanaproject,HongJunRen/katanaproject,julianpaulozzi/katanaproject,eocampo/KatanaProject301,abrodersen/katana,evicertia/Katana,julianpaulozzi/katanaproject
src/Microsoft.Owin.Diagnostics/WelcomePageMiddleware.cs
src/Microsoft.Owin.Diagnostics/WelcomePageMiddleware.cs
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Owin.Diagnostics.Views; namespace Microsoft.Owin.Diagnostics { using AppFunc = Func<IDictionary<string, object>, Task>; /// <summary> /// This middleware provides a default web page for new applications. /// </summary> public class WelcomePageMiddleware { private readonly AppFunc _next; private readonly WelcomePageOptions _options; /// <summary> /// Creates a default web page for new applications. /// </summary> /// <param name="next"></param> /// <param name="options"></param> public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options) { if (next == null) { throw new ArgumentNullException("next"); } if (options == null) { throw new ArgumentNullException("options"); } _next = next; _options = options; } /// <summary> /// Process an individual request. /// </summary> /// <param name="environment"></param> /// <returns></returns> public Task Invoke(IDictionary<string, object> environment) { IOwinContext context = new OwinContext(environment); IOwinRequest request = context.Request; if (!_options.Path.HasValue || _options.Path == request.Path) { // Dynamically generated for LOC. var welcomePage = new WelcomePage(); welcomePage.Execute(context); return Task.FromResult(0); } return _next(environment); } } }
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Owin.Diagnostics.Views; namespace Microsoft.Owin.Diagnostics { using AppFunc = Func<IDictionary<string, object>, Task>; /// <summary> /// This middleware provides a default web page for new applications. /// </summary> public class WelcomePageMiddleware { private readonly AppFunc _next; private readonly WelcomePageOptions _options; /// <summary> /// Creates a default web page for new applications. /// </summary> /// <param name="next"></param> /// <param name="options"></param> public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options) { if (next == null) { throw new ArgumentNullException("next"); } if (options == null) { throw new ArgumentNullException("options"); } _options = options; } /// <summary> /// Process an individual request. /// </summary> /// <param name="environment"></param> /// <returns></returns> public Task Invoke(IDictionary<string, object> environment) { IOwinContext context = new OwinContext(environment); IOwinRequest request = context.Request; if (!_options.Path.HasValue || _options.Path == request.Path) { // Dynamically generated for LOC. var welcomePage = new WelcomePage(); welcomePage.Execute(context); return Task.FromResult(0); } return _next(environment); } } }
apache-2.0
C#
659b95cf43083b7115cdf74c4bbeb0e87771bba4
update expec. response for generated iframe
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
test/StockportWebappTests/Unit/Parsers/FormBuilderParserTests.cs
test/StockportWebappTests/Unit/Parsers/FormBuilderParserTests.cs
using FluentAssertions; using StockportWebapp.Parsers; using Xunit; namespace StockportWebappTests_Unit.Unit.Parsers { public class FormBuilderTagParserTests { private readonly FormBuilderTagParser _parser; public FormBuilderTagParserTests() { _parser = new FormBuilderTagParser(); } [Fact] public void Parse_Should_Parse_Form_Into_IFrame() { var tag = "https://www.stockport.gov.uk/"; var response = _parser.Parse("{{FORM:" + tag + "}}"); var outputHtml = $"<iframe sandbox='allow-forms allow-scripts allow-top-navigation-by-user-activation allow-same-origin' class='mapframe' allowfullscreen src='https://www.stockport.gov.uk/'></iframe>"; response.Should().Be(outputHtml); } [Fact] public void Parse_Should_Parse_Form_WithOptional_Iframe_Title() { var tag = "https://www.stockport.gov.uk/;iframe optional title"; var response = _parser.Parse("{{FORM:" + tag + "}}"); var outputHtml = $"<iframe sandbox='allow-forms allow-scripts allow-top-navigation-by-user-activation allow-same-origin' title=\"iframe optional title\" class='mapframe' allowfullscreen src='https://www.stockport.gov.uk/'></iframe>"; response.Should().Be(outputHtml); } } }
using FluentAssertions; using StockportWebapp.Parsers; using Xunit; namespace StockportWebappTests_Unit.Unit.Parsers { public class FormBuilderTagParserTests { private readonly FormBuilderTagParser _parser; public FormBuilderTagParserTests() { _parser = new FormBuilderTagParser(); } [Fact] public void Parse_Should_Parse_Form_Into_IFrame() { var tag = "https://www.stockport.gov.uk/"; var response = _parser.Parse("{{FORM:" + tag + "}}"); var outputHtml = $"<iframe sandbox='allow-scripts allow-forms' class='mapframe' allowfullscreen src='https://www.stockport.gov.uk/'></iframe>"; response.Should().Be(outputHtml); } [Fact] public void Parse_Should_Parse_Form_WithOptional_Iframe_Title() { var tag = "https://www.stockport.gov.uk/;iframe optional title"; var response = _parser.Parse("{{FORM:" + tag + "}}"); var outputHtml = $"<iframe sandbox='allow-scripts allow-forms' title=\"iframe optional title\" class='mapframe' allowfullscreen src='https://www.stockport.gov.uk/'></iframe>"; response.Should().Be(outputHtml); } } }
mit
C#
b1bf6fa8b0a10770d6b404c6ded0a6b0853bc3d7
Remove unnecessary code
Ninputer/VBF
src/Compilers/Compilers.Common/CompilationErrorList.cs
src/Compilers/Compilers.Common/CompilationErrorList.cs
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VBF.Compilers { public class CompilationErrorList : IReadOnlyList<CompilationError> { private List<CompilationError> m_errors; private CompilationErrorManager m_errorManager; public void AddError(int id, SourceSpan errorPosition, params object[] args) { CodeContract.RequiresArgumentInRange(m_errorManager.ContainsErrorDefinition(id), "id", "Error id is invalid"); var errorInfo = m_errorManager.GetErrorInfo(id); var errorMessage = String.Format(errorInfo.MessageTemplate, args); m_errors.Add(new CompilationError(errorInfo, errorPosition, errorMessage)); } public CompilationError this[int index] { get { return m_errors[index]; } } public int Count { get { return m_errors.Count; } } public IEnumerator<CompilationError> GetEnumerator() { foreach (var item in m_errors) { yield return item; } } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } public CompilationErrorList(CompilationErrorManager errorManager) { CodeContract.RequiresArgumentNotNull(errorManager, "errorManager"); m_errors = new List<CompilationError>(); m_errorManager = errorManager; } } }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VBF.Compilers { public class CompilationErrorList : IReadOnlyList<CompilationError> { private List<CompilationError> m_errors; private CompilationErrorManager m_errorManager; public void AddError(int id, SourceSpan errorPosition, params object[] args) { CodeContract.RequiresArgumentInRange(m_errorManager.ContainsErrorDefinition(id), "id", "Error id is invalid"); var errorInfo = m_errorManager.GetErrorInfo(id); var errorMessage = String.Format(errorInfo.MessageTemplate, args); m_errors.Add(new CompilationError(errorInfo, errorPosition, errorMessage)); } public CompilationError this[int index] { get { return m_errors[index]; } } public int Count { get { return m_errors.Count; } } public IEnumerator<CompilationError> GetEnumerator() { foreach (var item in m_errors) { yield return item; } } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } public CompilationErrorList(CompilationErrorManager errorManager) { CodeContract.RequiresArgumentNotNull(errorManager, "errorManager"); m_errors = new List<CompilationError>(); m_errorManager = errorManager; } internal ReadOnlyCollection<CompilationError> AsReadOnly() { return m_errors.AsReadOnly(); } internal void Clear() { m_errors.Clear(); } } }
apache-2.0
C#
10030c49883600910266f31cf4927629c726b745
Check for null argument
arthot/xsp,murador/xsp,stormleoxia/xsp,murador/xsp,murador/xsp,stormleoxia/xsp,arthot/xsp,stormleoxia/xsp,arthot/xsp,stormleoxia/xsp,arthot/xsp,murador/xsp
src/Mono.WebServer.FastCgi/Server/FakeGenericServer.cs
src/Mono.WebServer.FastCgi/Server/FakeGenericServer.cs
// // OnDemandServer.cs // // Author: // Leonardo Taglialegne <leonardo.taglialegne@gmail.com> // // Copyright (c) 2013 Leonardo Taglialegne. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.FastCgi; using System.IO; using Mono.WebServer.Log; using System.Collections.Generic; namespace Mono.WebServer.FastCgi { public class FakeGenericServer<T> : IGenericServer<T> where T : IConnection { IGenericServer<T> backend; public event EventHandler RequestReceived; public FakeGenericServer (IGenericServer<T> server) { if (server == null) throw new ArgumentNullException ("server"); backend = server; } public void Start (bool background, int backlog) { } public void Stop () { } public void EndConnection(T connection) { } public int MaxConnections { get { return backend.MaxConnections; } set { backend.MaxConnections = value; } } public int ConnectionCount { get { return backend.ConnectionCount; } } public bool Started { get { return backend.Started; } } public bool CanAccept { get { return backend.CanAccept; } } public IEnumerable<T> Connections { get { return backend.Connections; } } } }
// // OnDemandServer.cs // // Author: // Leonardo Taglialegne <leonardo.taglialegne@gmail.com> // // Copyright (c) 2013 Leonardo Taglialegne. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.FastCgi; using System.IO; using Mono.WebServer.Log; using System.Collections.Generic; namespace Mono.WebServer.FastCgi { public class FakeGenericServer<T> : IGenericServer<T> where T : IConnection { IGenericServer<T> backend; public event EventHandler RequestReceived; public FakeGenericServer (IGenericServer<T> server) { backend = server; } public void Start (bool background, int backlog) { } public void Stop () { } public void EndConnection(T connection) { } public int MaxConnections { get { return backend.MaxConnections; } set { backend.MaxConnections = value; } } public int ConnectionCount { get { return backend.ConnectionCount; } } public bool Started { get { return backend.Started; } } public bool CanAccept { get { return backend.CanAccept; } } public IEnumerable<T> Connections { get { return backend.Connections; } } } }
mit
C#
01871952854d85d080de51390df533f3ddbc4a21
Add PaymentIntent to filter lists of Disputes
stripe/stripe-dotnet
src/Stripe.net/Services/Disputes/DisputeListOptions.cs
src/Stripe.net/Services/Disputes/DisputeListOptions.cs
namespace Stripe { using Newtonsoft.Json; /// <summary> /// The optional arguments you can pass. <a href="https://stripe.com/docs/api#list_disputes">Stripe Documentation</a>. /// </summary> public class DisputeListOptions : ListOptionsWithCreated { /// <summary> /// Only return disputes that are associated with the Charge specified by this Charge ID. /// </summary> [JsonProperty("charge")] public string Charge { get; set; } /// <summary> /// Only return disputes that are associated with the PaymentIntent specified by this PaymentIntent ID. /// </summary> [JsonProperty("payment_intent")] public string PaymentIntent { get; set; } } }
namespace Stripe { using Newtonsoft.Json; /// <summary> /// The optional arguments you can pass. <a href="https://stripe.com/docs/api#list_disputes">Stripe Documentation</a>. /// </summary> public class DisputeListOptions : ListOptionsWithCreated { /// <summary> /// Only return disputes that are associated with the Charge specified by this Charge ID. /// </summary> [JsonProperty("charge")] public string Charge { get; set; } } }
apache-2.0
C#
9120c1db75288649291a1baed7bada2ab5e72521
Add logs to show what is happening when processing Foscam
chadly/cams,chadly/vlc-rtsp,chadly/vlc-rtsp,chadly/vlc-rtsp
src/FoscamCamera.cs
src/FoscamCamera.cs
using System; using System.IO; using System.Text.RegularExpressions; namespace Cams { public class FoscamCamera : Camera { public override void Process(string outputDir) { Console.WriteLine($"{Name} (Foscam): {RawFilePath}"); var files = Directory.GetFiles(Path.Combine(RawFilePath, "record"), "*.mkv"); foreach (string file in files) ProcessFile(file, outputDir); Console.WriteLine(); } bool ProcessFile(string file, string outputBase) { var match = Regex.Match(file, @"alarm_(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2}).mkv"); if (!match.Success) { Console.WriteLine($"Filename is in an unexpected format: {file}"); return false; } int year = int.Parse(match.Groups[1].Value); int month = int.Parse(match.Groups[2].Value); int day = int.Parse(match.Groups[3].Value); int hour = int.Parse(match.Groups[4].Value); int minute = int.Parse(match.Groups[5].Value); int second = int.Parse(match.Groups[6].Value); DateTime date = new DateTime(year, month, day, hour, minute, second); DateTime threshold = DateTime.Now.AddMinutes(Settings.MinutesToWaitBeforeProcessing); if (date >= threshold) { Console.WriteLine($"File was written less than five minutes ago: {file}"); return false; } string outputFile = Path.Combine(outputBase, date.ToString("yyyy-MM-dd"), Name, $"{date.ToString("HH-mm-ss")}.mp4"); string outputDir = new FileInfo(outputFile).DirectoryName; Directory.CreateDirectory(outputDir); if (!VideoConverter.CodecCopy(file, outputFile)) { Console.WriteLine($"Failed to convert {file}"); return false; } //cleanup File.Delete(file); Console.WriteLine($"Converted {outputFile}"); return true; } } }
using System; using System.IO; using System.Text.RegularExpressions; namespace Cams { public class FoscamCamera : Camera { public override void Process(string outputDir) { var files = Directory.GetFiles(Path.Combine(RawFilePath, "record"), "*.mkv"); foreach (string file in files) { ProcessFile(file, outputDir); } } bool ProcessFile(string file, string outputBase) { var match = Regex.Match(file, @"alarm_(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2}).mkv"); if (!match.Success) { Console.WriteLine($"Filename is in an unexpected format: {file}"); return false; } int year = int.Parse(match.Groups[1].Value); int month = int.Parse(match.Groups[2].Value); int day = int.Parse(match.Groups[3].Value); int hour = int.Parse(match.Groups[4].Value); int minute = int.Parse(match.Groups[5].Value); int second = int.Parse(match.Groups[6].Value); DateTime date = new DateTime(year, month, day, hour, minute, second); DateTime threshold = DateTime.Now.AddMinutes(Settings.MinutesToWaitBeforeProcessing); if (date >= threshold) { Console.WriteLine($"File was written less than five minutes ago: {file}"); return false; } string outputFile = Path.Combine(outputBase, date.ToString("yyyy-MM-dd"), Name, $"{date.ToString("HH-mm-ss")}.mp4"); string outputDir = new FileInfo(outputFile).DirectoryName; Directory.CreateDirectory(outputDir); if (!VideoConverter.CodecCopy(file, outputFile)) { Console.WriteLine($"Failed to convert {file}"); return false; } //cleanup File.Delete(file); Console.WriteLine($"Converted {outputFile}"); return true; } } }
mit
C#
23a8142c688ca2c551155916f14638cd3cda3f15
Update 20180327.LuckWheelManager.cs
twilightspike/cuddly-disco,twilightspike/cuddly-disco
main/20180327.LuckWheelManager.cs
main/20180327.LuckWheelManager.cs
using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using System; public class LuckWheelManager: MonoBehaviour{ /*stuffset*/ private bool _beStarted; private float[] _angleSector; private float _angleFinal; private float _angleBegin; private float _lerpRotateTimeNow; /*message_how much*/ public int PressCost = 250; //pay how much on playing public int MoneyPrevTotal; public int MoneyNowTotal = 1000; /*ui_basuc*/ public Button buttonPress; public GameObject circleWheel; /*message_win or lose*/ public Text MoneyDeltaText; public Text MoneyNowText; /*action*/ private void Awake(){ MoneyPrevTotal = MoneyNowTotal; MoneyNowText.text = MoneyNowTotal.ToString(); } public void SpinWheel(){ } void RewardByAngle(){ } void Update(){} }
using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using System; public class LuckWheelManager: MonoBehaviour{ /*stuffset*/ private bool _beStarted; private float[] _angleSector; private float _angleFinal; private float _angleBegin; private float _lerpRotateTimeNow; /*message_how much*/ public int PressCost = 250; //pay how much on playing public int MoneyPrevTotal; public int MoneyNowTotal = 1000; /*ui_basuc*/ public Button buttonPress; public GameObject circleWheel; /*message_win or lose*/ public Text MoneyDeltaText; public Text MoneyNowText; /*action*/ private void Awake(){ } public void SpinWheel(){ } void RewardByAngle(){ } void Update(){} }
mit
C#
2fafe65fb024cac8f8953afc16026e129141ff7f
add sealed modifier for StringParser
acple/ParsecSharp
ParsecSharp/Parser/Text/Implementations/PrimitiveParser.String.cs
ParsecSharp/Parser/Text/Implementations/PrimitiveParser.String.cs
using System; using System.Linq; namespace ParsecSharp.Internal.Parsers { internal sealed class StringParser : PrimitiveParser<char, string> { private readonly string _text; private readonly StringComparison _comparison; public StringParser(string text, StringComparison comparison) { this._text = text; this._comparison = comparison; } protected sealed override Result<char, string> Run<TState>(TState state) { var result = ParsecState.AsEnumerable<char, TState>(state).Take(this._text.Length).ToArray(); var text = new string(result.Select(x => x.Current).ToArray()); return (string.Equals(text, this._text, this._comparison)) ? Result.Success<char, TState, string>(text, (result.Length == 0) ? state : result.Last().Next) : Result.Failure<char, TState, string>($"Expected '{this._text}' but was '{text}'", state); } } }
using System; using System.Linq; namespace ParsecSharp.Internal.Parsers { internal class StringParser : PrimitiveParser<char, string> { private readonly string _text; private readonly StringComparison _comparison; public StringParser(string text, StringComparison comparison) { this._text = text; this._comparison = comparison; } protected sealed override Result<char, string> Run<TState>(TState state) { var result = ParsecState.AsEnumerable<char, TState>(state).Take(this._text.Length).ToArray(); var text = new string(result.Select(x => x.Current).ToArray()); return (string.Equals(text, this._text, this._comparison)) ? Result.Success<char, TState, string>(text, (result.Length == 0) ? state : result.Last().Next) : Result.Failure<char, TState, string>($"Expected '{this._text}' but was '{text}'", state); } } }
mit
C#
a3b3361b0f67f5c75db023765031c4e544d01047
Revert "WIP #AG377 - Ignore another test to try and fix hanging tests"
csf-dev/agiil,csf-dev/agiil,csf-dev/agiil,csf-dev/agiil
Tests/Agiil.Tests.Web/Services/ApplicationBaseUriProviderTests.cs
Tests/Agiil.Tests.Web/Services/ApplicationBaseUriProviderTests.cs
using System; using System.Web; using System.Web.Mvc; using Agiil.Web.Services; using Moq; using NUnit.Framework; namespace Agiil.Tests.Web.Services { [TestFixture,Parallelizable] public class ApplicationBaseUriProviderTests { [Test] public void GetBaseUri_returns_root_of_the_domain_when_the_request_has_a_long_path() { // Arrange var requestUri = new Uri("http://example.com/foo/bar/baz"); var expectedUri = new Uri("http://example.com/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } [Test] public void GetBaseUri_returns_root_of_the_domain_when_the_request_has_a_port() { // Arrange var requestUri = new Uri("http://example.com:8080/foo"); var expectedUri = new Uri("http://example.com:8080/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } [Test] public void GetBaseUri_returns_root_of_the_domain_when_the_request_is_https() { // Arrange var requestUri = new Uri("https://example.com/foo"); var expectedUri = new Uri("https://example.com/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } [Test] public void GetBaseUri_returns_root_of_the_application_when_url_helper_indicates_a_path() { // Arrange var requestUri = new Uri("https://example.com/foo/bar/baz"); var urlHelper = Mock.Of<UrlHelper>(x => x.Content("~") == "/foo/"); var expectedUri = new Uri("https://example.com/foo/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), urlHelper); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } } }
using System; using System.Web; using System.Web.Mvc; using Agiil.Web.Services; using Moq; using NUnit.Framework; namespace Agiil.Tests.Web.Services { [TestFixture,Parallelizable] public class ApplicationBaseUriProviderTests { [Test] public void GetBaseUri_returns_root_of_the_domain_when_the_request_has_a_long_path() { // Arrange var requestUri = new Uri("http://example.com/foo/bar/baz"); var expectedUri = new Uri("http://example.com/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } [Test] public void GetBaseUri_returns_root_of_the_domain_when_the_request_has_a_port() { // Arrange var requestUri = new Uri("http://example.com:8080/foo"); var expectedUri = new Uri("http://example.com:8080/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } [Test] public void GetBaseUri_returns_root_of_the_domain_when_the_request_is_https() { // Arrange var requestUri = new Uri("https://example.com/foo"); var expectedUri = new Uri("https://example.com/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), null); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } [Test, Ignore("Attempt to fix hanging tests #AG377")] public void GetBaseUri_returns_root_of_the_application_when_url_helper_indicates_a_path() { // Arrange var requestUri = new Uri("https://example.com/foo/bar/baz"); var urlHelper = Mock.Of<UrlHelper>(x => x.Content("~") == "/foo/"); var expectedUri = new Uri("https://example.com/foo/"); var sut = new ApplicationBaseUriProvider(Mock.Of<HttpRequestBase>(x => x.Url == requestUri), urlHelper); // Act var result = sut.GetBaseUri(); // Assert Assert.That(result, Is.EqualTo(expectedUri)); } } }
mit
C#
9e5030c5f7799d6da704702e0bafaa855997ddc5
Allow ObjectStacks with no upper limit of cached objects.
smoogipooo/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,naoey/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,naoey/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,RedNesto/osu-framework,default0/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,default0/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,paparony03/osu-framework,DrabWeb/osu-framework
osu.Framework/Allocation/ObjectStack.cs
osu.Framework/Allocation/ObjectStack.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; namespace osu.Framework.Allocation { public class ObjectStack<T> where T : new() { private int maxAmountObjects; private readonly Stack<T> freeObjects = new Stack<T>(); private HashSet<T> usedObjects = new HashSet<T>(); public ObjectStack(int maxAmountObjects = -1) { this.maxAmountObjects = maxAmountObjects; } private T findFreeObject() { T o = freeObjects.Count > 0 ? freeObjects.Pop() : new T(); if (maxAmountObjects == -1 || usedObjects.Count < maxAmountObjects) usedObjects.Add(o); return o; } private void returnFreeObject(T o) { if (usedObjects.Remove(o)) // We are here if the element was successfully found and removed freeObjects.Push(o); } /// <summary> /// Reserve an object from the pool. This is used to avoid excessive amounts of heap allocations. /// </summary> /// <returns>The reserved object.</returns> public T ReserveObject() { T o; lock (freeObjects) o = findFreeObject(); return o; } /// <summary> /// Frees a previously reserved object for future reservations. /// </summary> /// <param name="o">The object to be freed. If the object has not previously been reserved then this method does nothing.</param> public void FreeObject(T o) { lock (freeObjects) returnFreeObject(o); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; namespace osu.Framework.Allocation { public class ObjectStack<T> where T : new() { private int maxAmountObjects; private readonly Stack<T> freeObjects = new Stack<T>(); private HashSet<T> usedObjects = new HashSet<T>(); public ObjectStack(int maxAmountObjects) { this.maxAmountObjects = maxAmountObjects; } private T findFreeObject() { T o = freeObjects.Count > 0 ? freeObjects.Pop() : new T(); if (usedObjects.Count < maxAmountObjects) usedObjects.Add(o); return o; } private void returnFreeObject(T o) { if (usedObjects.Remove(o)) // We are here if the element was successfully found and removed freeObjects.Push(o); } /// <summary> /// Reserve an object from the pool. This is used to avoid excessive amounts of heap allocations. /// </summary> /// <returns>The reserved object.</returns> public T ReserveObject() { T o; lock (freeObjects) o = findFreeObject(); return o; } /// <summary> /// Frees a previously reserved object for future reservations. /// </summary> /// <param name="o">The object to be freed. If the object has not previously been reserved then this method does nothing.</param> public void FreeObject(T o) { lock (freeObjects) returnFreeObject(o); } } }
mit
C#
379971578dbc7cdc80c352ae35a46d0025602784
Remove culling notice from HasEffect
NeoAdonis/osu,smoogipoo/osu,peppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,ppy/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu
osu.Game/Beatmaps/Timing/BreakPeriod.cs
osu.Game/Beatmaps/Timing/BreakPeriod.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Screens.Play; namespace osu.Game.Beatmaps.Timing { public class BreakPeriod { /// <summary> /// The minimum duration required for a break to have any effect. /// </summary> public const double MIN_BREAK_DURATION = 650; /// <summary> /// The break start time. /// </summary> public double StartTime; /// <summary> /// The break end time. /// </summary> public double EndTime; /// <summary> /// The break duration. /// </summary> public double Duration => EndTime - StartTime; /// <summary> /// Whether the break has any effect. /// </summary> public bool HasEffect => Duration >= MIN_BREAK_DURATION; /// <summary> /// Constructs a new break period. /// </summary> /// <param name="startTime">The start time of the break period.</param> /// <param name="endTime">The end time of the break period.</param> public BreakPeriod(double startTime, double endTime) { StartTime = startTime; EndTime = endTime; } /// <summary> /// Whether this break contains a specified time. /// </summary> /// <param name="time">The time to check in milliseconds.</param> /// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns> public bool Contains(double time) => time >= StartTime && time <= EndTime - BreakOverlay.BREAK_FADE_DURATION; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Screens.Play; namespace osu.Game.Beatmaps.Timing { public class BreakPeriod { /// <summary> /// The minimum duration required for a break to have any effect. /// </summary> public const double MIN_BREAK_DURATION = 650; /// <summary> /// The break start time. /// </summary> public double StartTime; /// <summary> /// The break end time. /// </summary> public double EndTime; /// <summary> /// The break duration. /// </summary> public double Duration => EndTime - StartTime; /// <summary> /// Whether the break has any effect. Breaks that are too short are culled before they are added to the beatmap. /// </summary> public bool HasEffect => Duration >= MIN_BREAK_DURATION; /// <summary> /// Constructs a new break period. /// </summary> /// <param name="startTime">The start time of the break period.</param> /// <param name="endTime">The end time of the break period.</param> public BreakPeriod(double startTime, double endTime) { StartTime = startTime; EndTime = endTime; } /// <summary> /// Whether this break contains a specified time. /// </summary> /// <param name="time">The time to check in milliseconds.</param> /// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns> public bool Contains(double time) => time >= StartTime && time <= EndTime - BreakOverlay.BREAK_FADE_DURATION; } }
mit
C#
9803e63e6f0c9a2a14f6427c9faafb629c5ef2ac
Update IPC usage to return `null`
peppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,ppy/osu
osu.Game/IPC/ArchiveImportIPCChannel.cs
osu.Game/IPC/ArchiveImportIPCChannel.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using System.IO; using System.Linq; using System.Threading.Tasks; using osu.Framework.Platform; using osu.Game.Database; namespace osu.Game.IPC { public class ArchiveImportIPCChannel : IpcChannel<ArchiveImportMessage> { private readonly ICanAcceptFiles importer; public ArchiveImportIPCChannel(IIpcHost host, ICanAcceptFiles importer = null) : base(host) { this.importer = importer; MessageReceived += msg => { Debug.Assert(importer != null); ImportAsync(msg.Path).ContinueWith(t => { if (t.Exception != null) throw t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); return null; }; } public async Task ImportAsync(string path) { if (importer == null) { // we want to contact a remote osu! to handle the import. await SendMessageAsync(new ArchiveImportMessage { Path = path }).ConfigureAwait(false); return; } if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant())) await importer.Import(path).ConfigureAwait(false); } } public class ArchiveImportMessage { public string Path; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using System.IO; using System.Linq; using System.Threading.Tasks; using osu.Framework.Platform; using osu.Game.Database; namespace osu.Game.IPC { public class ArchiveImportIPCChannel : IpcChannel<ArchiveImportMessage> { private readonly ICanAcceptFiles importer; public ArchiveImportIPCChannel(IIpcHost host, ICanAcceptFiles importer = null) : base(host) { this.importer = importer; MessageReceived += msg => { Debug.Assert(importer != null); ImportAsync(msg.Path).ContinueWith(t => { if (t.Exception != null) throw t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); }; } public async Task ImportAsync(string path) { if (importer == null) { // we want to contact a remote osu! to handle the import. await SendMessageAsync(new ArchiveImportMessage { Path = path }).ConfigureAwait(false); return; } if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant())) await importer.Import(path).ConfigureAwait(false); } } public class ArchiveImportMessage { public string Path; } }
mit
C#
31f3bbcfdfab08cc65ecfb3e40040ef9f618e5b2
Bump nuget id to keep future versions working
Smartrak/Smartrak.Library
FakeDbSet.ContextGenerator/Properties/AssemblyInfo.cs
FakeDbSet.ContextGenerator/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("Smartrak.EFMockContext")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Smartrak")] [assembly: AssemblyProduct("Smartrak.EFMockContext")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fa90ebcc-cbc8-48bb-9ea5-466f0af198cd")] // 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(AssemblyMeta.Version)] [assembly: AssemblyFileVersion(AssemblyMeta.Version)] [assembly: AssemblyInformationalVersion(AssemblyMeta.Version)] internal static class AssemblyMeta { public const string Version = "1.0.4"; }
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("Smartrak.EFMockContext")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Smartrak")] [assembly: AssemblyProduct("Smartrak.EFMockContext")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fa90ebcc-cbc8-48bb-9ea5-466f0af198cd")] // 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.2")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: AssemblyInformationalVersion("1.0.2")]
mit
C#
d3f7dae8ac24961a8b7e9a6fb149461c356ef199
Test Major/Minor versions - Commit 1
ravi-msi/practicegit,ravi-msi/practicegit,ravi-msi/practicegit
PracticeGit/PracticeGit/Controllers/HomeController.cs
PracticeGit/PracticeGit/Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; // ADDED FIRST LINE namespace PracticeGit.Controllers { public class HomeController : Controller { public ActionResult Index() { ViewBag.Title = "Home Page"; return View(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace PracticeGit.Controllers { public class HomeController : Controller { public ActionResult Index() { ViewBag.Title = "Home Page"; return View(); } } }
mit
C#