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
6d3f8aa3ee85eccf62d81bc32cbdc3d18eace716
Fix typo in Tasky GetItem
realm/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet
component/samples/Tasky/TaskySharedCode/TodoDatabaseADO.cs
component/samples/Tasky/TaskySharedCode/TodoDatabaseADO.cs
using System; using System.Linq; using System.Collections.Generic; using Realms; using System.IO; namespace Tasky.Shared { /// <summary> /// TaskDatabase uses ADO.NET to create the [Items] table and create,read,update,delete data /// </summary> public class TodoDatabase { private Realm realm; public TodoDatabase () { realm = Realm.GetInstance(); } public TodoItem CreateTodoItem() { var result = realm.CreateObject<TodoItem>(); result.ID = Guid.NewGuid().ToString(); return result; } public Transaction BeginTransaction() { return realm.BeginWrite(); } public IEnumerable<TodoItem> GetItems () { return realm.All<TodoItem>().ToList(); } public TodoItem GetItem (string id) { return realm.All<TodoItem>().Single(i => i.ID == id); } public void SaveItem (TodoItem item) { // Nothing to see here... } public string DeleteItem(string id) { realm.Remove(GetItem(id)); return id; } } }
using System; using System.Linq; using System.Collections.Generic; using Realms; using System.IO; namespace Tasky.Shared { /// <summary> /// TaskDatabase uses ADO.NET to create the [Items] table and create,read,update,delete data /// </summary> public class TodoDatabase { private Realm realm; public TodoDatabase () { realm = Realm.GetInstance(); } public TodoItem CreateTodoItem() { var result = realm.CreateObject<TodoItem>(); result.ID = Guid.NewGuid().ToString(); return result; } public Transaction BeginTransaction() { return realm.BeginWrite(); } public IEnumerable<TodoItem> GetItems () { return realm.All<TodoItem>().ToList(); } public TodoItem GetItem (string id) { return realm.All<TodoItem>().single(i => i.ID == id); } public void SaveItem (TodoItem item) { // Nothing to see here... } public string DeleteItem(string id) { realm.Remove(GetItem(id)); return id; } } }
apache-2.0
C#
e94bdd9303db0ffba6fc380f3e5f138af91ff6be
Allow partially-trusted callers again.
google/protobuf,google/protobuf,Livefyre/protobuf,google/protobuf,google/protobuf,google/protobuf,google/protobuf,Livefyre/protobuf,google/protobuf,google/protobuf,Livefyre/protobuf,google/protobuf,Livefyre/protobuf,google/protobuf,Livefyre/protobuf,google/protobuf
csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
#region Copyright notice and license // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Security; // 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("Google.Protobuf")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Google.Protobuf")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AllowPartiallyTrustedCallers] #if SIGNED [assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" + "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" + "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" + "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" + "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" + "c5ae9cb6")] #else [assembly: InternalsVisibleTo("Google.Protobuf.Test")] #endif [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyInformationalVersion("3.0.0-alpha4")]
#region Copyright notice and license // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion using System.Reflection; using System.Runtime.CompilerServices; // 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("Google.Protobuf")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Google.Protobuf")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] #if SIGNED [assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" + "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" + "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" + "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" + "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" + "c5ae9cb6")] #else [assembly: InternalsVisibleTo("Google.Protobuf.Test")] #endif [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyInformationalVersion("3.0.0-alpha4")]
bsd-3-clause
C#
0a56e22fa0da644e69c3a692960928b7dd9cc5e3
Remove unused using statement
smoogipoo/osu,smoogipoo/osu,ppy/osu,peppy/osu,smoogipooo/osu,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu
osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.cs
osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.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 NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; using osuTK; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class TestSceneNoSpinnerStacking : TestSceneOsuPlayer { protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { OverallDifficulty = 10 }, Ruleset = ruleset } }; for (int i = 0; i < 512; i++) { if (i % 32 < 20) beatmap.HitObjects.Add(new Spinner { Position = new Vector2(256, 192), StartTime = i * 200, EndTime = (i * 200) + 100 }); } return beatmap; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; using osuTK; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class TestSceneNoSpinnerStacking : TestSceneOsuPlayer { protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { OverallDifficulty = 10 }, Ruleset = ruleset } }; for (int i = 0; i < 512; i++) { if (i % 32 < 20) beatmap.HitObjects.Add(new Spinner { Position = new Vector2(256, 192), StartTime = i * 200, EndTime = (i * 200) + 100 }); } return beatmap; } } }
mit
C#
7d4d3929c6a266ba850d36cca51bca25832367ff
Fix sample project.
e-rik/XRoadLib,janno-p/XRoadLib,e-rik/XRoadLib
samples/Calculator/Handler/CalculatorHandler.cs
samples/Calculator/Handler/CalculatorHandler.cs
using System; using System.Collections.Generic; using XRoadLib; using XRoadLib.Handler; using XRoadLib.Serialization; namespace Calculator.Handler { public class CalculatorHandler : XRoadRequestHandler { private readonly IServiceProvider serviceProvider; public CalculatorHandler(IServiceProvider serviceProvider, IEnumerable<IXRoadProtocol> supportedProtocols, string storagePath) : base(supportedProtocols, storagePath) { this.serviceProvider = serviceProvider; } protected override object GetServiceObject(XRoadContext context) { var service = serviceProvider.GetService(context.ServiceMap.OperationDefinition.MethodInfo.DeclaringType); if (service != null) return service; throw new NotImplementedException(); } } }
using System; using System.Collections.Generic; using XRoadLib; using XRoadLib.Handler; using XRoadLib.Serialization.Mapping; namespace Calculator.Handler { public class CalculatorHandler : XRoadRequestHandler { private readonly IServiceProvider serviceProvider; public CalculatorHandler(IServiceProvider serviceProvider, IEnumerable<IXRoadProtocol> supportedProtocols, string storagePath) : base(supportedProtocols, storagePath) { this.serviceProvider = serviceProvider; } protected override object GetServiceObject(IServiceMap serviceMap) { var service = serviceProvider.GetService(serviceMap.Definition.MethodInfo.DeclaringType); if (service != null) return service; throw new NotImplementedException(); } } }
mit
C#
ea30e6897525406fd887d16aa0a944e67feffe2e
Update Download All_Videos
Ziggeo/ZiggeoCSharpSDK,Ziggeo/ZiggeoCSharpSDK
demos/Ziggeo_Download_All_videos.cs
demos/Ziggeo_Download_All_videos.cs
using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using Newtonsoft.Json.Linq; using Newtonsoft.Json; namespace Download_All_Videos { public class Download_All_Videos { public static void Main(string[] args) { Ziggeo ziggeo = new Ziggeo("APP_TOKEN", "PRIVATE_KEY", "ENCRYPTION_KEY"); dynamic AllVideos = JsonConvert.DeserializeObject(ziggeo.videos().index()); if (AllVideos != null) { foreach (var item in AllVideos) { dynamic videoToDownload = JsonConvert.DeserializeObject(ziggeo.videos().get(item.token)); string file_extension = videoToDownload.defaultstream.video_type; string file_name = videoToDownload.defaultstream.video_token + "." + file_extension; System.Console.WriteLine("downloading" + file_name); var file_content = ziggeo.videos().download_video(videoToDownload); string file_path = "your file path" + file_name; File.WriteAllText(file_path, (file_content)); } } } } }
using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using Newtonsoft.Json.Linq; using Newtonsoft.Json; namespace Delete_all_videos { public class Delete_All_Videos { public static void Main(string[] args) { Ziggeo ziggeo = new Ziggeo("APP_TOKEN", "PRIVATE_KEY", "ENCRYPTION_KEY"); while (true) { dynamic AllVideos = JsonConvert.DeserializeObject(ziggeo.videos().index()); if (AllVideos.count() == 0) break; foreach (var item in AllVideos) { System.Console.WriteLine("Deleting" + item.token); ziggeo.videos().delete(item.token); } } } } }
apache-2.0
C#
d9f1da005251757fcee83de2600f65ecd15f4ba9
Fix missed method rename.
akrisiun/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,Perspex/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia
src/Avalonia.Animation/DisposeAnimationInstanceObservable.cs
src/Avalonia.Animation/DisposeAnimationInstanceObservable.cs
// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using Avalonia.Animation.Utils; using Avalonia.Collections; using Avalonia.Data; using Avalonia.Reactive; namespace Avalonia.Animation { /// <summary> /// Manages the lifetime of animation instances as determined by its selector state. /// </summary> internal class DisposeAnimationInstanceObservable<T> : IObserver<bool>, IDisposable { private IDisposable _lastInstance; private bool _lastMatch; private Animator<T> _animator; private Animation _animation; private Animatable _control; private Action _onComplete; public DisposeAnimationInstanceObservable(Animator<T> animator, Animation animation, Animatable control, Action onComplete) { this._animator = animator; this._animation = animation; this._control = control; this._onComplete = onComplete; } public void Dispose() { _lastInstance?.Dispose(); } public void OnCompleted() { } public void OnError(Exception error) { _lastInstance?.Dispose(); } void IObserver<bool>.OnNext(bool matchVal) { if (matchVal != _lastMatch) { _lastInstance?.Dispose(); if (matchVal) { _lastInstance = _animator.Run(_animation, _control, _onComplete); } _lastMatch = matchVal; } } } }
// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using Avalonia.Animation.Utils; using Avalonia.Collections; using Avalonia.Data; using Avalonia.Reactive; namespace Avalonia.Animation { /// <summary> /// Manages the lifetime of animation instances as determined by its selector state. /// </summary> internal class DisposeAnimationInstanceObservable<T> : IObserver<bool>, IDisposable { private IDisposable _lastInstance; private bool _lastMatch; private Animator<T> _animator; private Animation _animation; private Animatable _control; private Action _onComplete; public DisposeAnimationInstanceObservable(Animator<T> animator, Animation animation, Animatable control, Action onComplete) { this._animator = animator; this._animation = animation; this._control = control; this._onComplete = onComplete; } public void Dispose() { _lastInstance?.Dispose(); } public void OnCompleted() { } public void OnError(Exception error) { _lastInstance?.Dispose(); } void IObserver<bool>.OnNext(bool matchVal) { if (matchVal != _lastMatch) { _lastInstance?.Dispose(); if (matchVal) { _lastInstance = _animator.RunAnimation(_animation, _control, _onComplete); } _lastMatch = matchVal; } } } }
mit
C#
5dc135d6114f1b27b6f61b244942e28c5dc0c03b
Remove [Authorize] attribute
GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu
src/Dangl.WebDocumentation/Controllers/ProjectsController.cs
src/Dangl.WebDocumentation/Controllers/ProjectsController.cs
using System.IO; using System.Linq; using System.Threading.Tasks; using Dangl.WebDocumentation.Models; using Dangl.WebDocumentation.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.StaticFiles; namespace Dangl.WebDocumentation.Controllers { public class ProjectsController : Controller { private readonly IProjectFilesService _projectFilesService; private readonly IProjectsService _projectsService; private readonly UserManager<ApplicationUser> _userManager; public ProjectsController(UserManager<ApplicationUser> userManager, IProjectFilesService projectFilesService, IProjectsService projectsService) { _projectFilesService = projectFilesService; _projectsService = projectsService; _userManager = userManager; } /// <summary> /// Returns a requested file for the project if the user has access or the project is public. /// </summary> /// <param name="projectName"></param> /// <param name="pathToFile"></param> /// <returns></returns> [HttpGet] [Route("Projects/{projectName}/{version}/{*pathToFile}")] public async Task<IActionResult> GetFile(string projectName, string version, string pathToFile) { var userId = _userManager.GetUserId(User); var hasProjectAccess = await _projectsService.UserHasAccessToProject(projectName, userId); if (!hasProjectAccess) { // HttpNotFound for either the project not existing or the user not having access return NotFound(); } var projectFile = await _projectFilesService.GetFileForProject(projectName, version, pathToFile); if (projectFile == null) { return NotFound(); } return File(projectFile.FileStream, projectFile.MimeType); } } }
using System.IO; using System.Linq; using System.Threading.Tasks; using Dangl.WebDocumentation.Models; using Dangl.WebDocumentation.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.StaticFiles; namespace Dangl.WebDocumentation.Controllers { [Authorize] public class ProjectsController : Controller { private readonly IProjectFilesService _projectFilesService; private readonly IProjectsService _projectsService; private readonly UserManager<ApplicationUser> _userManager; public ProjectsController(UserManager<ApplicationUser> userManager, IProjectFilesService projectFilesService, IProjectsService projectsService) { _projectFilesService = projectFilesService; _projectsService = projectsService; _userManager = userManager; } /// <summary> /// Returns a requested file for the project if the user has access or the project is public. /// </summary> /// <param name="projectName"></param> /// <param name="pathToFile"></param> /// <returns></returns> [HttpGet] [Route("Projects/{projectName}/{version}/{*pathToFile}")] public async Task<IActionResult> GetFile(string projectName, string version, string pathToFile) { var userId = _userManager.GetUserId(User); var hasProjectAccess = await _projectsService.UserHasAccessToProject(projectName, userId); if (!hasProjectAccess) { // HttpNotFound for either the project not existing or the user not having access return NotFound(); } var projectFile = await _projectFilesService.GetFileForProject(projectName, version, pathToFile); if (projectFile == null) { return NotFound(); } return File(projectFile.FileStream, projectFile.MimeType); } } }
mit
C#
0eaad3f6b8c3a2da7f3636ad4a8cbff8dcdef1f4
Remove unneeded setter
peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
src/Glimpse.Server.Web/Options/DefaultAllowRemoteProvider.cs
src/Glimpse.Server.Web/Options/DefaultAllowRemoteProvider.cs
using System; using System.Collections.Generic; using Microsoft.Framework.OptionsModel; namespace Glimpse.Server.Options { public class DefaultAllowRemoteProvider : IAllowRemoteProvider { public DefaultAllowRemoteProvider(IOptions<GlimpseServerWebOptions> optionsAccessor) { AllowRemote = optionsAccessor.Options.AllowRemote; } public bool AllowRemote { get; } } }
using System; using System.Collections.Generic; using Microsoft.Framework.OptionsModel; namespace Glimpse.Server.Options { public class DefaultAllowRemoteProvider : IAllowRemoteProvider { public DefaultAllowRemoteProvider(IOptions<GlimpseServerWebOptions> optionsAccessor) { AllowRemote = optionsAccessor.Options.AllowRemote; } public bool AllowRemote { get; private set; } } }
mit
C#
9d3d4c685f7ec7b92f73fe8aa5926c9308d38020
Fix MongoDB SSL configuration when no SSL settings are specified (#36)
diogodamiani/IdentityServer4.MongoDB,diogodamiani/IdentityServer4.MongoDB,diogodamiani/IdentityServer4.MongoDB
src/IdentityServer4.MongoDB/DbContexts/MongoDBContextBase.cs
src/IdentityServer4.MongoDB/DbContexts/MongoDBContextBase.cs
using IdentityServer4.MongoDB.Configuration; using Microsoft.Extensions.Options; using MongoDB.Driver; using System; namespace IdentityServer4.MongoDB.DbContexts { public class MongoDBContextBase : IDisposable { private readonly IMongoClient _client; public MongoDBContextBase(IOptions<MongoDBConfiguration> settings) { if (settings.Value == null) throw new ArgumentNullException(nameof(settings), "MongoDBConfiguration cannot be null."); if (settings.Value.ConnectionString == null) throw new ArgumentNullException(nameof(settings), "MongoDBConfiguration.ConnectionString cannot be null."); var mongoUrl = MongoUrl.Create(settings.Value.ConnectionString); if (settings.Value.Database == null && mongoUrl.DatabaseName == null) throw new ArgumentNullException(nameof(settings), "MongoDBConfiguration.Database cannot be null."); var clientSettings = MongoClientSettings.FromUrl(mongoUrl); if (settings.Value.SslSettings != null) { clientSettings.SslSettings = settings.Value.SslSettings; clientSettings.UseTls = true; } else { clientSettings.UseTls = false; } _client = new MongoClient(clientSettings); Database = _client.GetDatabase(settings.Value.Database ?? mongoUrl.DatabaseName); } protected IMongoDatabase Database { get; } public void Dispose() { // TODO } } }
using IdentityServer4.MongoDB.Configuration; using Microsoft.Extensions.Options; using MongoDB.Driver; using System; namespace IdentityServer4.MongoDB.DbContexts { public class MongoDBContextBase : IDisposable { private readonly IMongoClient _client; public MongoDBContextBase(IOptions<MongoDBConfiguration> settings) { if (settings.Value == null) throw new ArgumentNullException(nameof(settings), "MongoDBConfiguration cannot be null."); if (settings.Value.ConnectionString == null) throw new ArgumentNullException(nameof(settings), "MongoDBConfiguration.ConnectionString cannot be null."); var mongoUrl = MongoUrl.Create(settings.Value.ConnectionString); if (settings.Value.Database == null && mongoUrl.DatabaseName == null) throw new ArgumentNullException(nameof(settings), "MongoDBConfiguration.Database cannot be null."); var clientSettings = MongoClientSettings.FromUrl(mongoUrl); if (clientSettings.SslSettings != null) { clientSettings.SslSettings = settings.Value.SslSettings; clientSettings.UseTls = true; } else { clientSettings.UseTls = false; } _client = new MongoClient(clientSettings); Database = _client.GetDatabase(settings.Value.Database ?? mongoUrl.DatabaseName); } protected IMongoDatabase Database { get; } public void Dispose() { // TODO } } }
apache-2.0
C#
c8a0de9d9b53d21cd52f2bf0841ac0761803eab5
Remove menuitem
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Shell/MainMenu/HelpMainMenuItems.cs
WalletWasabi.Gui/Shell/MainMenu/HelpMainMenuItems.cs
using AvalonStudio.MainMenu; using AvalonStudio.Menus; using System.Composition; namespace WalletWasabi.Gui.Shell.MainMenu { internal class HelpMainMenuItems { [ImportingConstructor] public HelpMainMenuItems(IMenuItemFactory menuItemFactory) { MenuItemFactory = menuItemFactory; } private IMenuItemFactory MenuItemFactory { get; } #region MainMenu [ExportMainMenuItem("Help")] [DefaultOrder(2)] public IMenuItem Tools => MenuItemFactory.CreateHeaderMenuItem("Help", null); #endregion MainMenu #region Group [ExportMainMenuDefaultGroup("Help", "About")] [DefaultOrder(0)] public object AboutGroup => null; [ExportMainMenuDefaultGroup("Help", "Support")] [DefaultOrder(1)] public object SupportGroup => null; [ExportMainMenuDefaultGroup("Help", "Legal")] [DefaultOrder(2)] public object LegalGroup => null; #endregion Group #region MenuItem [ExportMainMenuItem("Help", "About")] [DefaultOrder(0)] [DefaultGroup("About")] public IMenuItem About => MenuItemFactory.CreateCommandMenuItem("Help.About"); [ExportMainMenuItem("Help", "User Support")] [DefaultOrder(1)] [DefaultGroup("Support")] public IMenuItem UserSupport => MenuItemFactory.CreateCommandMenuItem("Help.UserSupport"); [ExportMainMenuItem("Help", "Report Bug")] [DefaultOrder(2)] [DefaultGroup("Support")] public IMenuItem ReportBug => MenuItemFactory.CreateCommandMenuItem("Help.ReportBug"); [ExportMainMenuItem("Help", "Documentation")] [DefaultOrder(3)] [DefaultGroup("Support")] public IMenuItem Docs => MenuItemFactory.CreateCommandMenuItem("Help.Documentation"); #endregion MenuItem } }
using AvalonStudio.MainMenu; using AvalonStudio.Menus; using System.Composition; namespace WalletWasabi.Gui.Shell.MainMenu { internal class HelpMainMenuItems { [ImportingConstructor] public HelpMainMenuItems(IMenuItemFactory menuItemFactory) { MenuItemFactory = menuItemFactory; } private IMenuItemFactory MenuItemFactory { get; } #region MainMenu [ExportMainMenuItem("Help")] [DefaultOrder(2)] public IMenuItem Tools => MenuItemFactory.CreateHeaderMenuItem("Help", null); #endregion MainMenu #region Group [ExportMainMenuDefaultGroup("Help", "About")] [DefaultOrder(0)] public object AboutGroup => null; [ExportMainMenuDefaultGroup("Help", "Support")] [DefaultOrder(1)] public object SupportGroup => null; [ExportMainMenuDefaultGroup("Help", "Legal")] [DefaultOrder(2)] public object LegalGroup => null; #endregion Group #region MenuItem [ExportMainMenuItem("Help", "About")] [DefaultOrder(0)] [DefaultGroup("About")] public IMenuItem About => MenuItemFactory.CreateCommandMenuItem("Help.About"); [ExportMainMenuItem("Help", "User Support")] [DefaultOrder(1)] [DefaultGroup("Support")] public IMenuItem UserSupport => MenuItemFactory.CreateCommandMenuItem("Help.UserSupport"); [ExportMainMenuItem("Help", "Report Bug")] [DefaultOrder(2)] [DefaultGroup("Support")] public IMenuItem ReportBug => MenuItemFactory.CreateCommandMenuItem("Help.ReportBug"); [ExportMainMenuItem("Help", "Documentation")] [DefaultOrder(3)] [DefaultGroup("Support")] public IMenuItem Docs => MenuItemFactory.CreateCommandMenuItem("Help.Documentation"); [ExportMainMenuItem("Help", "Legal Documents")] [DefaultOrder(4)] [DefaultGroup("Legal")] public IMenuItem LegalDocuments => MenuItemFactory.CreateCommandMenuItem("Help.LegalDocuments"); #endregion MenuItem } }
mit
C#
e2b3e0996babc54e5f42cba5f031033c8eb17321
Add callback to timer
gigi81/sharpuv,gigi81/sharpuv
SharpUV/Timer.cs
SharpUV/Timer.cs
#region License /** * Copyright (c) 2012 Luigi Grilli * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using Libuv; namespace SharpUV { public class Timer : UvHandle { public event EventHandler Tick; private TimeSpan _repeat; private Action _callback; public Timer() : this(Loop.Default) { } public Timer(Loop loop) : base(loop, uv_handle_type.UV_TIMER) { CheckError(Uvi.uv_timer_init(this.Loop.Handle, this.Handle)); } public TimeSpan Delay { get; set; } public TimeSpan Repeat { get { return _repeat; } set { if (value < TimeSpan.Zero) throw new ArgumentException("value"); CheckError(Uvi.uv_timer_set_repeat(this.Handle, value.TotalMilliseconds)); _repeat = value; } } public void Start(Action callback = null) { CheckError(Uvi.uv_timer_start(this.Handle, this.OnTick, this.Delay.TotalMilliseconds, this.Repeat.TotalMilliseconds)); _callback = callback; } public void Stop() { CheckError(Uvi.uv_timer_stop(this.Handle)); _callback = null; } public void Again() { CheckError(Uvi.uv_timer_again(this.Handle)); } private void OnTick(IntPtr watcher, int status) { this.OnTick(); if (this.Tick != null) this.Tick(this, EventArgs.Empty); if (_callback != null) _callback(); } protected virtual void OnTick() { } } }
#region License /** * Copyright (c) 2012 Luigi Grilli * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using Libuv; namespace SharpUV { public class Timer : UvHandle { private TimeSpan _repeat; public Timer() : this(Loop.Default) { } public Timer(Loop loop) : base(loop, uv_handle_type.UV_TIMER) { CheckError(Uvi.uv_timer_init(this.Loop.Handle, this.Handle)); } public TimeSpan Delay { get; set; } public TimeSpan Repeat { get { return _repeat; } set { if (value < TimeSpan.Zero) throw new ArgumentException("value"); CheckError(Uvi.uv_timer_set_repeat(this.Handle, value.TotalMilliseconds)); _repeat = value; } } public void Start() { CheckError(Uvi.uv_timer_start(this.Handle, this.OnTick, this.Delay.TotalMilliseconds, this.Repeat.TotalMilliseconds)); } public void Stop() { CheckError(Uvi.uv_timer_stop(this.Handle)); } public void Again() { CheckError(Uvi.uv_timer_again(this.Handle)); } private void OnTick(IntPtr watcher, int status) { this.OnTick(); } protected virtual void OnTick() { } } }
mit
C#
7c5bd2db7ba7f3731f2c499c315af0ef860cb6aa
Allow using `ThemedDropdown` even if `OverlayColourProvider` not available
NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu
osu.Game/Graphics/UserInterfaceV2/ThemedDropdown.cs
osu.Game/Graphics/UserInterfaceV2/ThemedDropdown.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 osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; namespace osu.Game.Graphics.UserInterfaceV2 { /// <summary> /// A variant of <see cref="OsuDropdown{T}"/> that uses the nearest <see cref="OverlayColourProvider"/> for theming purposes, if one is available. /// </summary> public class ThemedDropdown<T> : OsuDropdown<T> { [BackgroundDependencyLoader(true)] private void load(OverlayColourProvider? colourProvider) { if (colourProvider == null) return; AccentColour = colourProvider.Light4; } protected override DropdownHeader CreateHeader() => new ThemedDropdownHeader(); protected override DropdownMenu CreateMenu() => new ThemedDropdownMenu(); protected class ThemedDropdownMenu : OsuDropdownMenu { [BackgroundDependencyLoader(true)] private void load(OverlayColourProvider? colourProvider) { if (colourProvider == null) return; BackgroundColour = colourProvider.Background5; ((IHasAccentColour)ContentContainer).AccentColour = colourProvider.Highlight1; } } protected class ThemedDropdownHeader : OsuDropdownHeader { [BackgroundDependencyLoader(true)] private void load(OverlayColourProvider? colourProvider) { if (colourProvider == null) return; BackgroundColour = colourProvider.Background5; BackgroundColourHover = colourProvider.Light4; } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; namespace osu.Game.Graphics.UserInterfaceV2 { /// <summary> /// A variant of <see cref="OsuDropdown{T}"/> that uses the nearest <see cref="OverlayColourProvider"/> for theming purposes. /// </summary> public class ThemedDropdown<T> : OsuDropdown<T> { [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { AccentColour = colourProvider.Light4; } protected override DropdownHeader CreateHeader() => new ThemedDropdownHeader(); protected override DropdownMenu CreateMenu() => new ThemedDropdownMenu(); protected class ThemedDropdownMenu : OsuDropdownMenu { [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { BackgroundColour = colourProvider.Background5; ((IHasAccentColour)ContentContainer).AccentColour = colourProvider.Highlight1; } } protected class ThemedDropdownHeader : OsuDropdownHeader { [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { BackgroundColour = colourProvider.Background5; BackgroundColourHover = colourProvider.Light4; } } } }
mit
C#
0e541caa377c3256043cbbf769f20694fd75d26f
add dep
YarGU-Demidov/math-site,YarGU-Demidov/math-site,YarGU-Demidov/math-site,YarGU-Demidov/math-site,YarGU-Demidov/math-site
src/MathSite/Configuration/SiteConfiguration.cs
src/MathSite/Configuration/SiteConfiguration.cs
using System; using MathSite.Controllers; using MathSite.Db; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace MathSite { public partial class Startup { public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceScopeFactory service) { ConfigureLoggers(loggerFactory); service.SeedData(); var cookieHttpOnly = true; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); cookieHttpOnly = false; } else { app.UseExceptionHandler("/Home/Error"); } app.UseStatusCodePagesWithRedirects("~/errors/{0}"); ConfigureAuthentication(app, cookieHttpOnly); ConfigureRoutes(app); } private void ConfigureLoggers(ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(LogLevel.Debug); } private static void ConfigureAuthentication(IApplicationBuilder app, bool cookieHttpOnly) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme = "Auth", LoginPath = new PathString("/login/"), AccessDeniedPath = new PathString("/forbidden/"), AutomaticAuthenticate = true, AutomaticChallenge = true, CookieHttpOnly = cookieHttpOnly, LogoutPath = new PathString("/logout/"), ReturnUrlParameter = "returnUrl", ExpireTimeSpan = TimeSpan.FromDays(365), }); } private static void ConfigureRoutes(IApplicationBuilder app) { app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute("areaRoute", "{area:exists}/{controller=Home}/{action=Index}"); routes.MapRoute( "default", "{controller=Home}/{action=Index}/{id?}"); }); } } }
using System; using MathSite.Db; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace MathSite { public partial class Startup { public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceScopeFactory service) { ConfigureLoggers(loggerFactory); service.SeedData(); var cookieHttpOnly = true; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); cookieHttpOnly = false; } else { app.UseExceptionHandler("/Home/Error"); } app.UseStatusCodePagesWithRedirects("~/errors/{0}"); ConfigureAuthentication(app, cookieHttpOnly); ConfigureRoutes(app); } private void ConfigureLoggers(ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(LogLevel.Debug); } private static void ConfigureAuthentication(IApplicationBuilder app, bool cookieHttpOnly) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme = "Auth", LoginPath = new PathString("/login/"), AccessDeniedPath = new PathString("/forbidden/"), AutomaticAuthenticate = true, AutomaticChallenge = true, CookieHttpOnly = cookieHttpOnly, LogoutPath = new PathString("/logout/"), ReturnUrlParameter = "returnUrl", ExpireTimeSpan = TimeSpan.FromDays(365), }); } private static void ConfigureRoutes(IApplicationBuilder app) { app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute("areaRoute", "{area:exists}/{controller=Home}/{action=Index}"); routes.MapRoute( "default", "{controller=Home}/{action=Index}/{id?}"); }); } } }
mit
C#
2dad8c8d1aa70968da9f9d7fc0ed8967fbf0bbf3
Change the hash algorithm used to make nuget FIPS compliant, although I have no idea what the heck it is.
oliver-feng/nuget,jholovacs/NuGet,zskullz/nuget,jmezach/NuGet2,mrward/nuget,mono/nuget,mrward/nuget,antiufo/NuGet2,chocolatey/nuget-chocolatey,themotleyfool/NuGet,antiufo/NuGet2,chester89/nugetApi,mrward/nuget,RichiCoder1/nuget-chocolatey,xoofx/NuGet,jmezach/NuGet2,atheken/nuget,dolkensp/node.net,GearedToWar/NuGet2,pratikkagda/nuget,pratikkagda/nuget,jholovacs/NuGet,akrisiun/NuGet,GearedToWar/NuGet2,pratikkagda/nuget,antiufo/NuGet2,xoofx/NuGet,alluran/node.net,xero-github/Nuget,chocolatey/nuget-chocolatey,antiufo/NuGet2,OneGet/nuget,zskullz/nuget,jholovacs/NuGet,mono/nuget,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,indsoft/NuGet2,jholovacs/NuGet,xoofx/NuGet,OneGet/nuget,GearedToWar/NuGet2,jmezach/NuGet2,ctaggart/nuget,jmezach/NuGet2,chester89/nugetApi,pratikkagda/nuget,oliver-feng/nuget,dolkensp/node.net,indsoft/NuGet2,xoofx/NuGet,RichiCoder1/nuget-chocolatey,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,mrward/NuGet.V2,pratikkagda/nuget,oliver-feng/nuget,rikoe/nuget,mrward/nuget,rikoe/nuget,mrward/nuget,mrward/NuGet.V2,alluran/node.net,akrisiun/NuGet,themotleyfool/NuGet,anurse/NuGet,rikoe/nuget,anurse/NuGet,OneGet/nuget,dolkensp/node.net,mrward/NuGet.V2,oliver-feng/nuget,mono/nuget,kumavis/NuGet,antiufo/NuGet2,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,indsoft/NuGet2,mrward/NuGet.V2,mrward/NuGet.V2,GearedToWar/NuGet2,ctaggart/nuget,GearedToWar/NuGet2,mono/nuget,indsoft/NuGet2,chocolatey/nuget-chocolatey,oliver-feng/nuget,xoofx/NuGet,indsoft/NuGet2,GearedToWar/NuGet2,jmezach/NuGet2,indsoft/NuGet2,atheken/nuget,chocolatey/nuget-chocolatey,jholovacs/NuGet,OneGet/nuget,zskullz/nuget,RichiCoder1/nuget-chocolatey,rikoe/nuget,alluran/node.net,pratikkagda/nuget,ctaggart/nuget,alluran/node.net,xoofx/NuGet,dolkensp/node.net,jmezach/NuGet2,themotleyfool/NuGet,mrward/nuget,chocolatey/nuget-chocolatey,chocolatey/nuget-chocolatey,zskullz/nuget,ctaggart/nuget,kumavis/NuGet
src/Core/Utility/CryptoHashProvider.cs
src/Core/Utility/CryptoHashProvider.cs
using System; using System.Linq; using System.Security.Cryptography; namespace NuGet { public class CryptoHashProvider : IHashProvider { /// <remarks> /// TODO: Eventually we need to change the server to start using MD5 /// </remarks> private const string SHA512HashAlgorithm = "SHA512"; /// <remarks> /// SHA512CNG is much faster in Windows Vista and higher. /// </remarks> private static readonly bool _useSHA512Cng = Environment.OSVersion.Version >= new Version(6, 0); private readonly string _hashAlgorithm; public CryptoHashProvider() : this(null) { } public CryptoHashProvider(string hashAlgorithm) { if (String.IsNullOrEmpty(hashAlgorithm)) { hashAlgorithm = SHA512HashAlgorithm; } _hashAlgorithm = hashAlgorithm; } public byte[] CalculateHash(byte[] data) { using (var hashAlgorithm = GetHashAlgorithm()) { return hashAlgorithm.ComputeHash(data); } } public bool VerifyHash(byte[] data, byte[] hash) { byte[] dataHash = CalculateHash(data); return Enumerable.SequenceEqual(dataHash, hash); } private HashAlgorithm GetHashAlgorithm() { if (_hashAlgorithm.Equals(SHA512HashAlgorithm, StringComparison.OrdinalIgnoreCase)) { return _useSHA512Cng ? (HashAlgorithm)new SHA512Cng() : (HashAlgorithm)new SHA512CryptoServiceProvider(); } return HashAlgorithm.Create(_hashAlgorithm); } } }
using System; using System.Linq; using System.Security.Cryptography; namespace NuGet { public class CryptoHashProvider : IHashProvider { /// <remarks> /// TODO: Eventually we need to change the server to start using MD5 /// </remarks> private const string SHA512HashAlgorithm = "SHA512"; /// <remarks> /// SHA512CNG is much faster in Windows Vista and higher. /// </remarks> private static readonly bool _useSHA512Cng = Environment.OSVersion.Version >= new Version(6, 0); private readonly string _hashAlgorithm; public CryptoHashProvider() : this(null) { } public CryptoHashProvider(string hashAlgorithm) { if (String.IsNullOrEmpty(hashAlgorithm)) { hashAlgorithm = SHA512HashAlgorithm; } _hashAlgorithm = hashAlgorithm; } public byte[] CalculateHash(byte[] data) { using (var hashAlgorithm = GetHashAlgorithm()) { return hashAlgorithm.ComputeHash(data); } } public bool VerifyHash(byte[] data, byte[] hash) { byte[] dataHash = CalculateHash(data); return Enumerable.SequenceEqual(dataHash, hash); } private HashAlgorithm GetHashAlgorithm() { if (_hashAlgorithm.Equals(SHA512HashAlgorithm, StringComparison.OrdinalIgnoreCase)) { return _useSHA512Cng ? SHA512Cng.Create() : SHA512CryptoServiceProvider.Create(); } return HashAlgorithm.Create(_hashAlgorithm); } } }
apache-2.0
C#
139193173ac2423026891bb332f068c291fe9f31
Add Powershell filter
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/SaggieHaim.cs
src/Firehose.Web/Authors/SaggieHaim.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class SaggieHaim : IAmACommunityMember { public string FirstName => "Saggie"; public string LastName => "Haim"; public string ShortBioOrTagLine => "Blogging about powershell and automation"; public string StateOrRegion => "Israel"; public string EmailAddress => "contact@saggiehaim.net"; public string TwitterHandle => "saggiehaim"; public string GravatarHash => "933957374d006887d1ac1928e1a02a48"; public string GitHubHandle => "SaggieHaim"; public GeoPosition Position => new GeoPosition(32.0853, 34.7818); public Uri WebSite => new Uri("https://www.saggiehaim.net//"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.saggiehaim.net/feed/"); } } // Filter for Powershell Posts public bool Filter(SyndicationItem item) { // This filters out only the posts that have the "PowerShell" category return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell")); } } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class SaggieHaim : IAmACommunityMember { public string FirstName => "Saggie"; public string LastName => "Haim"; public string ShortBioOrTagLine => "Blogging about powershell and automation"; public string StateOrRegion => "Israel"; public string EmailAddress => "contact@saggiehaim.net"; public string TwitterHandle => "saggiehaim"; public string GravatarHash => "933957374d006887d1ac1928e1a02a48"; public string GitHubHandle => "SaggieHaim"; public GeoPosition Position => new GeoPosition(32.0853, 34.7818); public Uri WebSite => new Uri("https://www.saggiehaim.net//"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.saggiehaim.net/feed/"); } } } }
mit
C#
e047bc8b7dea44122fefce1bc642f6252ba7280d
Upgrade version to 0.2.0-alpha
soroshsabz/PCLAppConfig,mrbrl/PCLAppConfig
src/Lib/PCLAppConfig/Properties/AssemblyInfo.cs
src/Lib/PCLAppConfig/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PCLAppConfig")] [assembly: AssemblyDescription("Cross platform Xamarin forms App settings reader")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ben Ishiyama-levy (Monovo), Seyyed Soroosh Hosseinalipour")] [assembly: AssemblyProduct("PCLAppConfig")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.2.0")] [assembly: AssemblyFileVersion("0.2.0")] [assembly: AssemblyInformationalVersion("0.2.0-alpha")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PCLAppConfig")] [assembly: AssemblyDescription("Cross platform Xamarin forms App settings reader")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ben Ishiyama-levy (Monovo), Seyyed Soroosh Hosseinalipour")] [assembly: AssemblyProduct("PCLAppConfig")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0")] [assembly: AssemblyFileVersion("0.1.0")] [assembly: AssemblyInformationalVersion("0.1.0-alpha")]
apache-2.0
C#
27b32e73a0d6fde9fe7500851444a886b483d3bc
Improve warnings for small operations number (#1407)
PerfDotNet/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet
src/BenchmarkDotNet/Analysers/MinIterationTimeAnalyser.cs
src/BenchmarkDotNet/Analysers/MinIterationTimeAnalyser.cs
using System.Collections.Generic; using System.Linq; using BenchmarkDotNet.Engines; using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Reports; using Perfolizer.Horology; namespace BenchmarkDotNet.Analysers { public class MinIterationTimeAnalyser : AnalyserBase { private static readonly TimeInterval MinSufficientIterationTime = 100 * TimeInterval.Millisecond; public override string Id => "MinIterationTime"; public static readonly IAnalyser Default = new MinIterationTimeAnalyser(); private MinIterationTimeAnalyser() { } protected override IEnumerable<Conclusion> AnalyseReport(BenchmarkReport report, Summary summary) { var target = report.AllMeasurements.Where(m => m.Is(IterationMode.Workload, IterationStage.Actual)).ToArray(); if (target.IsEmpty()) yield break; var minActualIterationTime = TimeInterval.FromNanoseconds(target.Min(m => m.Nanoseconds)); if (minActualIterationTime < MinSufficientIterationTime) yield return CreateWarning($"The minimum observed iteration time is {minActualIterationTime} which is very small. It's recommended to increase it to at least {MinSufficientIterationTime} using more operations.", report); } } }
using System.Collections.Generic; using System.Linq; using BenchmarkDotNet.Engines; using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Reports; using Perfolizer.Horology; namespace BenchmarkDotNet.Analysers { public class MinIterationTimeAnalyser : AnalyserBase { private static readonly TimeInterval MinSufficientIterationTime = 100 * TimeInterval.Millisecond; public override string Id => "MinIterationTime"; public static readonly IAnalyser Default = new MinIterationTimeAnalyser(); private MinIterationTimeAnalyser() { } protected override IEnumerable<Conclusion> AnalyseReport(BenchmarkReport report, Summary summary) { var target = report.AllMeasurements.Where(m => m.Is(IterationMode.Workload, IterationStage.Actual)).ToArray(); if (target.IsEmpty()) yield break; var minActualIterationTime = TimeInterval.FromNanoseconds(target.Min(m => m.Nanoseconds)); if (minActualIterationTime < MinSufficientIterationTime) yield return CreateWarning($"The minimum observed iteration time is {minActualIterationTime} which is very small. It's recommended to increase it.", report); } } }
mit
C#
e52bbc2f57b62c7f64c3bf4991485db090dd8732
Fix Json serialization on MetadataResource
peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
src/Glimpse.Server/Internal/Resources/MetadataResource.cs
src/Glimpse.Server/Internal/Resources/MetadataResource.cs
using System.Collections.Generic; using System.Threading.Tasks; using Glimpse.Internal; using Glimpse.Server.Configuration; using Glimpse.Server.Resources; using Microsoft.AspNet.Http; using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using Glimpse.Internal.Extensions; using Newtonsoft.Json.Serialization; namespace Glimpse.Server.Internal.Resources { public class MetadataResource : IResource { private readonly IMetadataProvider _metadataProvider; private readonly JsonSerializer _jsonSerializer; private Metadata _metadata; public MetadataResource(IMetadataProvider metadataProvider, JsonSerializer jsonSerializer) { _metadataProvider = metadataProvider; _jsonSerializer = jsonSerializer; _jsonSerializer.ContractResolver = new CamelCasePropertyNamesContractResolver(); _jsonSerializer.Converters.Add(new TimeSpanConverter()); _jsonSerializer.Converters.Add(new StringValuesConverter()); } public async Task Invoke(HttpContext context, IDictionary<string, string> parameters) { var metadata = GetMetadata(); var response = context.Response; response.Headers[HeaderNames.ContentType] = "application/json"; await response.WriteAsync(_jsonSerializer.Serialize(metadata)); } private Metadata GetMetadata() { if (_metadata != null) return _metadata; _metadata = _metadataProvider.BuildInstance(); return _metadata; } public string Name => "metadata"; public IEnumerable<ResourceParameter> Parameters => new [] { +ResourceParameter.Hash }; public ResourceType Type => ResourceType.Client; } }
using System.Collections.Generic; using System.Threading.Tasks; using Glimpse.Server.Configuration; using Glimpse.Server.Resources; using Microsoft.AspNet.Http; using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using Glimpse.Internal.Extensions; namespace Glimpse.Server.Internal.Resources { public class MetadataResource : IResource { private readonly IMetadataProvider _metadataProvider; private readonly JsonSerializer _jsonSerializer; private Metadata _metadata; public MetadataResource(IMetadataProvider metadataProvider, JsonSerializer jsonSerializer) { _metadataProvider = metadataProvider; _jsonSerializer = jsonSerializer; } public async Task Invoke(HttpContext context, IDictionary<string, string> parameters) { var metadata = GetMetadata(); var response = context.Response; response.Headers[HeaderNames.ContentType] = "application/json"; await response.WriteAsync(_jsonSerializer.Serialize(metadata)); } private Metadata GetMetadata() { if (_metadata != null) return _metadata; _metadata = _metadataProvider.BuildInstance(); return _metadata; } public string Name => "metadata"; public IEnumerable<ResourceParameter> Parameters => new [] { +ResourceParameter.Hash }; public ResourceType Type => ResourceType.Client; } }
mit
C#
305e440f50683a9a58959815bd99409129b79615
Update GUIRenderer.cs
maritaria/terratech-mod,Exund/nuterra,Nuterra/Nuterra
src/Sylver/GUIRenderer.cs
src/Sylver/GUIRenderer.cs
using System; using UnityEngine; namespace Sylver { public class GUIRenderer : MonoBehaviour { public GUIRenderer() { this._style = new GUIStyle(); this._style.richText = true; this._style.alignment = TextAnchor.MiddleCenter; this._content = new GUIContent(); } public void OnGUI() { if (!Singleton.playerTank) { return; } if (!Singleton.Manager<DebugUtil>.inst.hideGUI) { this._content.text = string.Format(GUIRenderer.DisplayFormat, SylverMod.FriendlyAIName); this._style.fontSize = Screen.height / 60; Vector2 position = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.925f); Vector2 vector = this._style.CalcSize(this._content); position.y -= vector.y * 0.5f; position.x -= vector.x * 0.5f; GUI.Label(new Rect(position, vector), this._content, this._style); } } static GUIRenderer() { } private GUIContent _content; private GUIStyle _style; public static readonly string DisplayFormat = "{0}<color=white><b> will be spawned</b></color>"; } }
using System; using UnityEngine; namespace Sylver { public class GUIRenderer : MonoBehaviour { public GUIRenderer() { this._style = new GUIStyle(); this._style.richText = true; this._style.alignment = TextAnchor.MiddleCenter; this._content = new GUIContent(); } public void OnGUI() { if (!Singleton.playerTank) { return; } if (!Singleton.Manager<DebugUtil>.inst.hideGUI) { this._content.text = string.Format(GUIRenderer.DisplayFormat, SylverMod.FriendlyAIName); this._style.fontSize = Screen.height / 60; Vector2 position = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.925f); Vector2 vector = this._style.CalcSize(this._content); position.y -= vector.y * 0.5f; position.x -= vector.x * 0.5f; GUI.Label(new Rect(position, vector), this._content, this._style); } } static GUIRenderer() { } private GUIContent _content; private GUIStyle _style; public static readonly string DisplayFormat = "{0}<color=white><b> will be spawned</b></color>"; } }
mit
C#
af96733dfd5c07ec6986dd5b9b220bf75440bb28
Test working
heynickc/exceptions_performance
ExceptionsPerformance/XmlParsingExample.cs
ExceptionsPerformance/XmlParsingExample.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using Xunit; using Xunit.Abstractions; namespace ExceptionsPerformance { public class XmlParsingExample { private readonly ITestOutputHelper _output; public XmlParsingExample(ITestOutputHelper output) { _output = output; } [Fact] public void Build_sample_data() { double errorRate = 1; // 10% of the time our users mess up int count = 10; // 10000 entries by a user var doc = BuildSampleData(errorRate, count); _output.WriteLine(doc.ToString()); } static XDocument BuildSampleData(double errorRate, int count) { Random random = new Random(1); string bad_prefix = @"X"; XDocument doc = new XDocument( new XDeclaration("1.0", "utf-8", "yes"), new XComment("Sample Data From Who Knows Where"), new XElement("sampleData")); for (int i = 0; i < count; i++) { string input = random.Next().ToString(); if (random.NextDouble() < errorRate) { input = bad_prefix + input; } var el = new XElement("item", new XElement("property", new XAttribute("name", "Cost"), input) ); doc.Element("sampleData").Add(el); } return doc; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using Xunit; using Xunit.Abstractions; namespace ExceptionsPerformance { public class XmlParsingExample { private readonly ITestOutputHelper _output; public XmlParsingExample(ITestOutputHelper output) { _output = output; } [Fact] public void Build_sample_data() { double errorRate = .1; // 10% of the time our users mess up int count = 50000; // 10000 entries by a user var doc = BuildSampleData(errorRate, count); _output.WriteLine(doc.ToString()); } static XDocument BuildSampleData(double errorRate, int count) { Random random = new Random(1); string bad_prefix = @"X"; XDocument doc = new XDocument( new XDeclaration("1.0", "utf-8", "yes"), new XComment("Sample Data From Who Knows Where"), new XElement("sampleData")); for (int i = 0; i < count; i++) { string input = random.Next().ToString(); if (random.NextDouble() < errorRate) { input = bad_prefix + input; } var el = new XElement("item", new XElement("property", new XAttribute("name", "Cost"), input) ); doc.Element("sampleData").Add(el); } return doc; } } }
mit
C#
fbdbfa1241139848a38c66d2d3313529b30fc8b8
Reduce allocations in string.ToLower/ToUpper on Unix
JosephTremoulet/coreclr,swgillespie/coreclr,russellhadley/coreclr,tijoytom/coreclr,sjsinju/coreclr,tijoytom/coreclr,dpodder/coreclr,ktos/coreclr,parjong/coreclr,manu-silicon/coreclr,jamesqo/coreclr,yeaicc/coreclr,Dmitry-Me/coreclr,ZhichengZhu/coreclr,stormleoxia/coreclr,krk/coreclr,sperling/coreclr,Djuffin/coreclr,taylorjonl/coreclr,sperling/coreclr,bitcrazed/coreclr,ramarag/coreclr,sejongoh/coreclr,dpodder/coreclr,naamunds/coreclr,geertdoornbos/coreclr,ramarag/coreclr,vinnyrom/coreclr,sjsinju/coreclr,ramarag/coreclr,roncain/coreclr,mmitche/coreclr,vinnyrom/coreclr,mocsy/coreclr,rartemev/coreclr,Djuffin/coreclr,ruben-ayrapetyan/coreclr,mmitche/coreclr,vinnyrom/coreclr,yeaicc/coreclr,cydhaselton/coreclr,andschwa/coreclr,geertdoornbos/coreclr,JosephTremoulet/coreclr,cmckinsey/coreclr,botaberg/coreclr,geertdoornbos/coreclr,JosephTremoulet/coreclr,mocsy/coreclr,cydhaselton/coreclr,SlavaRa/coreclr,jhendrixMSFT/coreclr,sejongoh/coreclr,chuck-mitchell/coreclr,bartonjs/coreclr,KrzysztofCwalina/coreclr,dasMulli/coreclr,qiudesong/coreclr,wtgodbe/coreclr,cshung/coreclr,AlfredoMS/coreclr,sagood/coreclr,AlexGhiondea/coreclr,Dmitry-Me/coreclr,krytarowski/coreclr,swgillespie/coreclr,wkchoy74/coreclr,James-Ko/coreclr,AlfredoMS/coreclr,kyulee1/coreclr,manu-silicon/coreclr,andschwa/coreclr,sejongoh/coreclr,tijoytom/coreclr,poizan42/coreclr,manu-silicon/coreclr,wateret/coreclr,chuck-mitchell/coreclr,andschwa/coreclr,JonHanna/coreclr,mskvortsov/coreclr,roncain/coreclr,sperling/coreclr,poizan42/coreclr,hseok-oh/coreclr,russellhadley/coreclr,KrzysztofCwalina/coreclr,josteink/coreclr,ramarag/coreclr,sejongoh/coreclr,russellhadley/coreclr,ZhichengZhu/coreclr,LLITCHEV/coreclr,taylorjonl/coreclr,yizhang82/coreclr,cmckinsey/coreclr,sjsinju/coreclr,SlavaRa/coreclr,martinwoodward/coreclr,iamjasonp/coreclr,bartdesmet/coreclr,alexperovich/coreclr,shahid-pk/coreclr,martinwoodward/coreclr,orthoxerox/coreclr,poizan42/coreclr,AlexGhiondea/coreclr,qiudesong/coreclr,taylorjonl/coreclr,rartemev/coreclr,Lucrecious/coreclr,cmckinsey/coreclr,LLITCHEV/coreclr,LLITCHEV/coreclr,bartdesmet/coreclr,chuck-mitchell/coreclr,jhendrixMSFT/coreclr,James-Ko/coreclr,cmckinsey/coreclr,gkhanna79/coreclr,krk/coreclr,mocsy/coreclr,bartonjs/coreclr,wateret/coreclr,sagood/coreclr,roncain/coreclr,iamjasonp/coreclr,roncain/coreclr,dpodder/coreclr,pgavlin/coreclr,roncain/coreclr,Lucrecious/coreclr,swgillespie/coreclr,JosephTremoulet/coreclr,Djuffin/coreclr,mocsy/coreclr,schellap/coreclr,AlexGhiondea/coreclr,josteink/coreclr,cydhaselton/coreclr,pgavlin/coreclr,shahid-pk/coreclr,ramarag/coreclr,krytarowski/coreclr,andschwa/coreclr,orthoxerox/coreclr,hseok-oh/coreclr,bitcrazed/coreclr,Lucrecious/coreclr,blackdwarf/coreclr,wateret/coreclr,ruben-ayrapetyan/coreclr,LLITCHEV/coreclr,rartemev/coreclr,yizhang82/coreclr,Godin/coreclr,dpodder/coreclr,JonHanna/coreclr,swgillespie/coreclr,taylorjonl/coreclr,Godin/coreclr,Godin/coreclr,gkhanna79/coreclr,blackdwarf/coreclr,krk/coreclr,geertdoornbos/coreclr,jamesqo/coreclr,parjong/coreclr,Lucrecious/coreclr,rartemev/coreclr,roncain/coreclr,schellap/coreclr,krk/coreclr,benpye/coreclr,shahid-pk/coreclr,wateret/coreclr,yeaicc/coreclr,cshung/coreclr,ZhichengZhu/coreclr,bartdesmet/coreclr,ktos/coreclr,schellap/coreclr,bartonjs/coreclr,Dmitry-Me/coreclr,ragmani/coreclr,botaberg/coreclr,YongseopKim/coreclr,sejongoh/coreclr,pgavlin/coreclr,wtgodbe/coreclr,bitcrazed/coreclr,jhendrixMSFT/coreclr,Djuffin/coreclr,Lucrecious/coreclr,ragmani/coreclr,krytarowski/coreclr,russellhadley/coreclr,schellap/coreclr,qiudesong/coreclr,swgillespie/coreclr,swgillespie/coreclr,JonHanna/coreclr,AlexGhiondea/coreclr,pgavlin/coreclr,bartdesmet/coreclr,benpye/coreclr,ragmani/coreclr,botaberg/coreclr,blackdwarf/coreclr,russellhadley/coreclr,dpodder/coreclr,AlexGhiondea/coreclr,Godin/coreclr,stormleoxia/coreclr,chuck-mitchell/coreclr,schellap/coreclr,sejongoh/coreclr,schellap/coreclr,gkhanna79/coreclr,gkhanna79/coreclr,ZhichengZhu/coreclr,botaberg/coreclr,swgillespie/coreclr,JonHanna/coreclr,yizhang82/coreclr,wkchoy74/coreclr,parjong/coreclr,hseok-oh/coreclr,mocsy/coreclr,wateret/coreclr,dasMulli/coreclr,rartemev/coreclr,wtgodbe/coreclr,martinwoodward/coreclr,sejongoh/coreclr,jamesqo/coreclr,dpodder/coreclr,poizan42/coreclr,kyulee1/coreclr,mocsy/coreclr,neurospeech/coreclr,shahid-pk/coreclr,martinwoodward/coreclr,blackdwarf/coreclr,bitcrazed/coreclr,dasMulli/coreclr,martinwoodward/coreclr,neurospeech/coreclr,cydhaselton/coreclr,andschwa/coreclr,naamunds/coreclr,Dmitry-Me/coreclr,AlfredoMS/coreclr,shahid-pk/coreclr,benpye/coreclr,cmckinsey/coreclr,roncain/coreclr,dasMulli/coreclr,chuck-mitchell/coreclr,kyulee1/coreclr,orthoxerox/coreclr,benpye/coreclr,orthoxerox/coreclr,mskvortsov/coreclr,sjsinju/coreclr,wtgodbe/coreclr,naamunds/coreclr,wkchoy74/coreclr,manu-silicon/coreclr,Godin/coreclr,cshung/coreclr,shahid-pk/coreclr,mskvortsov/coreclr,cydhaselton/coreclr,KrzysztofCwalina/coreclr,ramarag/coreclr,benpye/coreclr,yeaicc/coreclr,yizhang82/coreclr,mskvortsov/coreclr,josteink/coreclr,ktos/coreclr,bartdesmet/coreclr,chuck-mitchell/coreclr,naamunds/coreclr,ruben-ayrapetyan/coreclr,AlfredoMS/coreclr,James-Ko/coreclr,martinwoodward/coreclr,andschwa/coreclr,martinwoodward/coreclr,James-Ko/coreclr,YongseopKim/coreclr,alexperovich/coreclr,JonHanna/coreclr,ktos/coreclr,manu-silicon/coreclr,Godin/coreclr,mokchhya/coreclr,josteink/coreclr,Djuffin/coreclr,YongseopKim/coreclr,sagood/coreclr,wkchoy74/coreclr,vinnyrom/coreclr,Dmitry-Me/coreclr,taylorjonl/coreclr,SlavaRa/coreclr,stormleoxia/coreclr,krytarowski/coreclr,naamunds/coreclr,mmitche/coreclr,alexperovich/coreclr,parjong/coreclr,stormleoxia/coreclr,ragmani/coreclr,tijoytom/coreclr,ZhichengZhu/coreclr,YongseopKim/coreclr,ZhichengZhu/coreclr,mmitche/coreclr,yeaicc/coreclr,SlavaRa/coreclr,neurospeech/coreclr,dasMulli/coreclr,geertdoornbos/coreclr,parjong/coreclr,stormleoxia/coreclr,krk/coreclr,rartemev/coreclr,yizhang82/coreclr,Godin/coreclr,benpye/coreclr,poizan42/coreclr,neurospeech/coreclr,yizhang82/coreclr,jhendrixMSFT/coreclr,geertdoornbos/coreclr,kyulee1/coreclr,neurospeech/coreclr,taylorjonl/coreclr,dasMulli/coreclr,alexperovich/coreclr,yeaicc/coreclr,pgavlin/coreclr,KrzysztofCwalina/coreclr,jhendrixMSFT/coreclr,russellhadley/coreclr,blackdwarf/coreclr,botaberg/coreclr,krytarowski/coreclr,ragmani/coreclr,AlfredoMS/coreclr,cmckinsey/coreclr,iamjasonp/coreclr,cshung/coreclr,stormleoxia/coreclr,SlavaRa/coreclr,krk/coreclr,benpye/coreclr,cshung/coreclr,bitcrazed/coreclr,KrzysztofCwalina/coreclr,sperling/coreclr,JonHanna/coreclr,sjsinju/coreclr,wateret/coreclr,KrzysztofCwalina/coreclr,sagood/coreclr,jhendrixMSFT/coreclr,gkhanna79/coreclr,sperling/coreclr,dasMulli/coreclr,orthoxerox/coreclr,naamunds/coreclr,andschwa/coreclr,James-Ko/coreclr,mokchhya/coreclr,tijoytom/coreclr,iamjasonp/coreclr,sagood/coreclr,poizan42/coreclr,iamjasonp/coreclr,KrzysztofCwalina/coreclr,stormleoxia/coreclr,sperling/coreclr,wtgodbe/coreclr,kyulee1/coreclr,mocsy/coreclr,bartonjs/coreclr,hseok-oh/coreclr,blackdwarf/coreclr,shahid-pk/coreclr,josteink/coreclr,pgavlin/coreclr,schellap/coreclr,orthoxerox/coreclr,geertdoornbos/coreclr,cshung/coreclr,mokchhya/coreclr,yeaicc/coreclr,YongseopKim/coreclr,chuck-mitchell/coreclr,alexperovich/coreclr,jamesqo/coreclr,James-Ko/coreclr,bartonjs/coreclr,neurospeech/coreclr,sjsinju/coreclr,ktos/coreclr,bartonjs/coreclr,ktos/coreclr,vinnyrom/coreclr,parjong/coreclr,sagood/coreclr,ruben-ayrapetyan/coreclr,ragmani/coreclr,Dmitry-Me/coreclr,kyulee1/coreclr,mskvortsov/coreclr,Lucrecious/coreclr,qiudesong/coreclr,naamunds/coreclr,mokchhya/coreclr,jhendrixMSFT/coreclr,ruben-ayrapetyan/coreclr,cydhaselton/coreclr,josteink/coreclr,AlfredoMS/coreclr,ZhichengZhu/coreclr,mskvortsov/coreclr,JosephTremoulet/coreclr,hseok-oh/coreclr,LLITCHEV/coreclr,iamjasonp/coreclr,krytarowski/coreclr,tijoytom/coreclr,wkchoy74/coreclr,hseok-oh/coreclr,Djuffin/coreclr,LLITCHEV/coreclr,jamesqo/coreclr,SlavaRa/coreclr,jamesqo/coreclr,vinnyrom/coreclr,cmckinsey/coreclr,bartdesmet/coreclr,qiudesong/coreclr,alexperovich/coreclr,wkchoy74/coreclr,Dmitry-Me/coreclr,taylorjonl/coreclr,ramarag/coreclr,sperling/coreclr,mokchhya/coreclr,ruben-ayrapetyan/coreclr,bitcrazed/coreclr,wkchoy74/coreclr,blackdwarf/coreclr,LLITCHEV/coreclr,mmitche/coreclr,bartdesmet/coreclr,AlexGhiondea/coreclr,YongseopKim/coreclr,botaberg/coreclr,vinnyrom/coreclr,gkhanna79/coreclr,JosephTremoulet/coreclr,manu-silicon/coreclr,mokchhya/coreclr,mokchhya/coreclr,wtgodbe/coreclr,mmitche/coreclr,Lucrecious/coreclr,manu-silicon/coreclr,bartonjs/coreclr,josteink/coreclr,bitcrazed/coreclr,ktos/coreclr,qiudesong/coreclr
src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Diagnostics.Contracts; using System.Text; namespace System.Globalization { public partial class TextInfo { private readonly bool m_needsTurkishCasing; ////////////////////////////////////////////////////////////////////////// //// //// TextInfo Constructors //// //// Implements CultureInfo.TextInfo. //// ////////////////////////////////////////////////////////////////////////// internal unsafe TextInfo(CultureData cultureData) { m_cultureData = cultureData; m_cultureName = m_cultureData.CultureName; m_textInfoName = m_cultureData.STEXTINFO; m_needsTurkishCasing = NeedsTurkishCasing(m_textInfoName); } [System.Security.SecuritySafeCritical] private unsafe string ChangeCase(string s, bool toUpper) { Contract.Assert(s != null); if (s.Length == 0) { return string.Empty; } string result = string.FastAllocateString(s.Length); fixed (char* pBuf = result) { Interop.GlobalizationInterop.ChangeCase(s, s.Length, pBuf, result.Length, toUpper, m_needsTurkishCasing); } return result; } [System.Security.SecuritySafeCritical] private unsafe char ChangeCase(char c, bool toUpper) { char dst = default(char); Interop.GlobalizationInterop.ChangeCase(&c, 1, &dst, 1, toUpper, m_needsTurkishCasing); return dst; } // ----------------------------- // ---- PAL layer ends here ---- // ----------------------------- private bool NeedsTurkishCasing(string localeName) { Contract.Assert(localeName != null); return CultureInfo.GetCultureInfo(localeName).CompareInfo.Compare("i", "I", CompareOptions.IgnoreCase) != 0; } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Diagnostics.Contracts; using System.Text; namespace System.Globalization { public partial class TextInfo { private readonly bool m_needsTurkishCasing; ////////////////////////////////////////////////////////////////////////// //// //// TextInfo Constructors //// //// Implements CultureInfo.TextInfo. //// ////////////////////////////////////////////////////////////////////////// internal unsafe TextInfo(CultureData cultureData) { m_cultureData = cultureData; m_cultureName = m_cultureData.CultureName; m_textInfoName = m_cultureData.STEXTINFO; m_needsTurkishCasing = NeedsTurkishCasing(m_textInfoName); } [System.Security.SecuritySafeCritical] private unsafe string ChangeCase(string s, bool toUpper) { Contract.Assert(s != null); char[] buf = new char[s.Length]; fixed(char* pBuf = buf) { Interop.GlobalizationInterop.ChangeCase(s, s.Length, pBuf, buf.Length, toUpper, m_needsTurkishCasing); } return new string(buf); } [System.Security.SecuritySafeCritical] private unsafe char ChangeCase(char c, bool toUpper) { char* pSrc = stackalloc char[1]; char* pDst = stackalloc char[1]; pSrc[0] = c; Interop.GlobalizationInterop.ChangeCase(pSrc, 1, pDst, 1, toUpper, m_needsTurkishCasing); return pDst[0]; } // ----------------------------- // ---- PAL layer ends here ---- // ----------------------------- private bool NeedsTurkishCasing(string localeName) { Contract.Assert(localeName != null); return CultureInfo.GetCultureInfo(localeName).CompareInfo.Compare("i", "I", CompareOptions.IgnoreCase) != 0; } } }
mit
C#
6ecb83247fd74752bb021869714336b0d363b560
Use newly created vector object
eivindveg/PG3300-Innlevering1
SnakeMess/Component.cs
SnakeMess/Component.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool // Changes to this file will be lost if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; public abstract class Component { private Vector position { get; set; } }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool // Changes to this file will be lost if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; public abstract class Component { private Vector2D position { get; set; } }
mit
C#
205d3ed896d228f58006bc98562e72368233537d
fix settings not getting injected
NeoAdonis/osu,ZLima12/osu,DrabWeb/osu,DrabWeb/osu,EVAST9919/osu,smoogipoo/osu,Nabile-Rahmani/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,NeoAdonis/osu,2yangk23/osu,peppy/osu,Frontear/osuKyzer,peppy/osu,ppy/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,ZLima12/osu,naoey/osu,ppy/osu,naoey/osu,UselessToucan/osu,DrabWeb/osu,peppy/osu,2yangk23/osu,naoey/osu,UselessToucan/osu,johnneijzen/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu-new
osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs
osu.Game/Overlays/Toolbar/ToolbarSettingsButton.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 osu.Framework.Allocation; using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { public class ToolbarSettingsButton : ToolbarOverlayToggleButton { public ToolbarSettingsButton() { Icon = FontAwesome.fa_gear; TooltipMain = "Settings"; TooltipSub = "Change your settings"; } [BackgroundDependencyLoader(true)] private void load(MainSettings settings) { StateContainer = settings; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { public class ToolbarSettingsButton : ToolbarOverlayToggleButton { public ToolbarSettingsButton() { Icon = FontAwesome.fa_gear; TooltipMain = "Settings"; TooltipSub = "Change your settings"; } [BackgroundDependencyLoader(true)] private void load(SettingsOverlay settings) { StateContainer = settings; } } }
mit
C#
f79287afa63c72c050f45af59ab13c5c0be3873a
Remove unused method
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University/Data/UniversityRepository.cs
R7.University/Data/UniversityRepository.cs
// // UniversityRepository.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 System.Collections.Generic; using System.Linq; using R7.DotNetNuke.Extensions.Data; namespace R7.University.Data { public class UniversityRepository { [Obsolete] public Dal2DataProvider DataProvider; public UniversityRepository (Dal2DataProvider dataProvider) { DataProvider = dataProvider; } #region Singleton implementation private static readonly Lazy<UniversityRepository> instance = new Lazy<UniversityRepository> ( () => new UniversityRepository (UniversityDataProvider.Instance) ); public static UniversityRepository Instance { get { return instance.Value; } } #endregion public IEnumerable<EduLevelInfo> GetEduLevels () { return DataProvider.GetObjects<EduLevelInfo> (); } public IEnumerable<EduLevelInfo> GetEduProgramLevels () { return DataProvider.GetObjects<EduLevelInfo> ().Where (el => el.ParentEduLevelId == null); } public IEnumerable<DocumentTypeInfo> GetDocumentTypes () { return DataProvider.GetObjects<DocumentTypeInfo> (); } } }
// // UniversityRepository.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 System.Collections.Generic; using System.Linq; using R7.DotNetNuke.Extensions.Data; namespace R7.University.Data { public class UniversityRepository { [Obsolete] public Dal2DataProvider DataProvider; public UniversityRepository (Dal2DataProvider dataProvider) { DataProvider = dataProvider; } #region Singleton implementation private static readonly Lazy<UniversityRepository> instance = new Lazy<UniversityRepository> ( () => new UniversityRepository (UniversityDataProvider.Instance) ); public static UniversityRepository Instance { get { return instance.Value; } } #endregion public IEnumerable<EduLevelInfo> GetEduLevels () { return DataProvider.GetObjects<EduLevelInfo> (); } public IEnumerable<EduLevelInfo> GetEduProgramLevels () { return DataProvider.GetObjects<EduLevelInfo> ().Where (el => el.ParentEduLevelId == null); } public IEnumerable<EduLevelInfo> GetEduProgramProfileLevels () { return DataProvider.GetObjects<EduLevelInfo> ().Where (el => el.ParentEduLevelId != null); } public IEnumerable<DocumentTypeInfo> GetDocumentTypes () { return DataProvider.GetObjects<DocumentTypeInfo> (); } } }
agpl-3.0
C#
61b95f6a4d63a67f25642c5637852ac4ef3938c8
document my code
michaKFromParis/octokit.net,dampir/octokit.net,eriawan/octokit.net,thedillonb/octokit.net,daukantas/octokit.net,shiftkey-tester/octokit.net,gabrielweyer/octokit.net,alfhenrik/octokit.net,mminns/octokit.net,rlugojr/octokit.net,chunkychode/octokit.net,chunkychode/octokit.net,takumikub/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,Red-Folder/octokit.net,magoswiat/octokit.net,shana/octokit.net,ivandrofly/octokit.net,dlsteuer/octokit.net,hitesh97/octokit.net,brramos/octokit.net,M-Zuber/octokit.net,cH40z-Lord/octokit.net,fake-organization/octokit.net,nsrnnnnn/octokit.net,hahmed/octokit.net,SLdragon1989/octokit.net,gdziadkiewicz/octokit.net,Sarmad93/octokit.net,shiftkey/octokit.net,ChrisMissal/octokit.net,alfhenrik/octokit.net,bslliw/octokit.net,darrelmiller/octokit.net,octokit/octokit.net,dampir/octokit.net,Sarmad93/octokit.net,editor-tools/octokit.net,shiftkey/octokit.net,devkhan/octokit.net,khellang/octokit.net,kdolan/octokit.net,SmithAndr/octokit.net,editor-tools/octokit.net,khellang/octokit.net,geek0r/octokit.net,octokit-net-test-org/octokit.net,M-Zuber/octokit.net,TattsGroup/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,shana/octokit.net,eriawan/octokit.net,naveensrinivasan/octokit.net,mminns/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,devkhan/octokit.net,nsnnnnrn/octokit.net,ivandrofly/octokit.net,SmithAndr/octokit.net,kolbasov/octokit.net,gdziadkiewicz/octokit.net,fffej/octokit.net,thedillonb/octokit.net,forki/octokit.net,adamralph/octokit.net,gabrielweyer/octokit.net,SamTheDev/octokit.net,octokit-net-test/octokit.net,shiftkey-tester/octokit.net,octokit/octokit.net,TattsGroup/octokit.net
Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs
Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs
using System; using System.Reactive; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { public class ObservableOrganizationTeamsClient : IObservableOrganizationTeamsClient { readonly IConnection _connection; readonly ITeamsClient _client; /// <summary> /// Initializes a new Organization Teams API client. /// </summary> /// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param> public ObservableOrganizationTeamsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _connection = client.Connection; _client = client.Organization.Team; } /// <summary> /// Returns all <see cref="Team" />s for the current org. /// </summary> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>A list of the orgs's teams <see cref="TeamItem"/>s.</returns> public IObservable<Team> GetAllTeams(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); return _connection.GetAndFlattenAllPages<Team>(ApiUrls.OrganizationTeams(org)); } /// <summary> /// Returns newly created <see cref="Team" /> for the current org. /// </summary> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>Newly created <see cref="Team"/></returns> public IObservable<Team> CreateTeam(string org, NewTeam team) { return _client.CreateTeam(org, team).ToObservable(); } /// <summary> /// Returns updated <see cref="Team" /> for the current org. /// </summary> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>Updated <see cref="Team"/></returns> public IObservable<Team> UpdateTeam(int id, UpdateTeam team) { return _client.UpdateTeam(id, team).ToObservable(); } /// <summary> /// Delete a team - must have owner permissions to this /// </summary> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns></returns> public IObservable<Unit> DeleteTeam(int id) { return _client.DeleteTeam(id).ToObservable(); } } }
using System; using System.Reactive; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { public class ObservableOrganizationTeamsClient : IObservableOrganizationTeamsClient { readonly IConnection _connection; readonly ITeamsClient _client; /// <summary> /// Initializes a new Organization Teams API client. /// </summary> /// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param> public ObservableOrganizationTeamsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _connection = client.Connection; _client = client.Organization.Team; } public IObservable<Team> GetAllTeams(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); return _connection.GetAndFlattenAllPages<Team>(ApiUrls.OrganizationTeams(org)); } public IObservable<Team> CreateTeam(string org, NewTeam team) { return _client.CreateTeam(org, team).ToObservable(); } public IObservable<Team> UpdateTeam(int id, UpdateTeam team) { return _client.UpdateTeam(id, team).ToObservable(); } public IObservable<Unit> DeleteTeam(int id) { return _client.DeleteTeam(id).ToObservable(); } } }
mit
C#
3c0946831bdeded9a333d129cbc728bc897a7fd3
Remove WriteMessage calls from TeamCityOutputSink
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/OutputSinks/TeamCityOutputSink.cs
source/Nuke.Common/OutputSinks/TeamCityOutputSink.cs
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using JetBrains.Annotations; using Nuke.Common.BuildServers; using Nuke.Common.Utilities; namespace Nuke.Common.OutputSinks { [UsedImplicitly] [ExcludeFromCodeCoverage] internal class TeamCityOutputSink : ConsoleOutputSink { private readonly TeamCity _teamCity; internal TeamCityOutputSink(TeamCity teamCity) { _teamCity = teamCity; } public override IDisposable WriteBlock(string text) { return DelegateDisposable.CreateBracket( () => _teamCity.OpenBlock(text), () => _teamCity.CloseBlock(text)); } public override void Warn(string text, string details = null) { _teamCity.WriteWarning(text); if (details != null) _teamCity.WriteWarning(details); } public override void Error(string text, string details = null) { _teamCity.WriteError(text, details); _teamCity.AddBuildProblem(text); } } }
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using JetBrains.Annotations; using Nuke.Common.BuildServers; using Nuke.Common.Utilities; namespace Nuke.Common.OutputSinks { [UsedImplicitly] [ExcludeFromCodeCoverage] internal class TeamCityOutputSink : ConsoleOutputSink { private readonly TeamCity _teamCity; internal TeamCityOutputSink(TeamCity teamCity) { _teamCity = teamCity; } public override void Write(string text) { _teamCity.WriteMessage(text); } public override IDisposable WriteBlock(string text) { return DelegateDisposable.CreateBracket( () => _teamCity.OpenBlock(text), () => _teamCity.CloseBlock(text)); } public override void Warn(string text, string details = null) { _teamCity.WriteWarning(text); if (details != null) _teamCity.WriteWarning(details); } public override void Error(string text, string details = null) { _teamCity.WriteError(text, details); _teamCity.AddBuildProblem(text); } public override void Success(string text) { _teamCity.WriteMessage(text); } } }
mit
C#
05990136597058794aee9f88c5bbf7c4a7f9efc8
Add [Serializable] attribute
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
Source/NSubstitute/Exceptions/CannotReturnNullforValueType.cs
Source/NSubstitute/Exceptions/CannotReturnNullforValueType.cs
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class CannotReturnNullForValueType : SubstituteException { const string Description = "Cannot return null for {0} because it is a value type. If you want to return the default value for this type use \"default({0})\"."; public CannotReturnNullForValueType(Type valueType) : base(string.Format(Description, valueType.Name)) {} protected CannotReturnNullForValueType(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { public class CannotReturnNullForValueType : SubstituteException { const string Description = "Cannot return null for {0} because it is a value type. If you want to return the default value for this type use \"default({0})\"."; public CannotReturnNullForValueType(Type valueType) : base(string.Format(Description, valueType.Name)) {} protected CannotReturnNullForValueType(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
bsd-3-clause
C#
15331556d442c705ae0ac536e38c1562d92222a3
Update IndexModule.cs
LeedsSharp/AppVeyorDemo
src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs
src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs
namespace AppVeyorDemo.Modules { using System.Configuration; using AppVeyorDemo.Models; using Nancy; public class IndexModule : NancyModule { public IndexModule() { Get["/"] = parameters => { var model = new IndexViewModel { HelloName = "AppVeyor", ServerName = ConfigurationManager.AppSettings["Server_Name"] }; return View["index", model]; }; } } }
namespace AppVeyorDemo.Modules { using System.Configuration; using AppVeyorDemo.Models; using Nancy; public class IndexModule : NancyModule { public IndexModule() { Get["/"] = parameters => { var model = new IndexViewModel { HelloName = "Leeds#", ServerName = ConfigurationManager.AppSettings["Server_Name"] }; return View["index", model]; }; } } }
apache-2.0
C#
22c7cb9330fb0d926e3d54e44a160b67eae2d2d4
use getter.
SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia
src/Avalonia.Controls/TransitioningContentControl.cs
src/Avalonia.Controls/TransitioningContentControl.cs
using System; using System.Threading; using Avalonia.Animation; namespace Avalonia.Controls; /// <summary> /// Displays <see cref="Content"/> according to a <see cref="FuncDataTemplate"/>. /// Uses <see cref="PageTransition"/> to move between the old and new content values. /// </summary> public class TransitioningContentControl : ContentControl { private CancellationTokenSource? _lastTransitionCts; private object? _displayedContent; /// <summary> /// Defines the <see cref="PageTransition"/> property. /// </summary> public static readonly StyledProperty<IPageTransition?> PageTransitionProperty = AvaloniaProperty.Register<TransitioningContentControl, IPageTransition?>(nameof(PageTransition), new CrossFade(TimeSpan.FromSeconds(0.5))); /// <summary> /// Defines the <see cref="DisplayedContent"/> property. /// </summary> public static readonly DirectProperty<TransitioningContentControl, object?> DisplayedContentProperty = AvaloniaProperty.RegisterDirect<TransitioningContentControl, object?>(nameof(DisplayedContent), o => o.DisplayedContent); /// <summary> /// Gets or sets the animation played when content appears and disappears. /// </summary> public IPageTransition? PageTransition { get => GetValue(PageTransitionProperty); set => SetValue(PageTransitionProperty, value); } /// <summary> /// Gets or sets the content displayed whenever there is no page currently routed. /// </summary> public object? DisplayedContent { get => _displayedContent; private set => SetAndRaise(DisplayedContentProperty, ref _displayedContent, value); } protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change) { base.OnPropertyChanged(change); if (change.Property == ContentProperty) { UpdateContentWithTransition(Content); } } /// <summary> /// Updates the content with transitions. /// </summary> /// <param name="content">New content to set.</param> private async void UpdateContentWithTransition(object? content) { _lastTransitionCts?.Cancel(); _lastTransitionCts = new CancellationTokenSource(); if (PageTransition != null) await PageTransition.Start(this, null, true, _lastTransitionCts.Token); DisplayedContent = content; if (PageTransition != null) await PageTransition.Start(null, this, true, _lastTransitionCts.Token); } }
using System; using System.Threading; using Avalonia.Animation; namespace Avalonia.Controls; /// <summary> /// Displays <see cref="Content"/> according to a <see cref="FuncDataTemplate"/>. /// Uses <see cref="PageTransition"/> to move between the old and new content values. /// </summary> public class TransitioningContentControl : ContentControl { private CancellationTokenSource? _lastTransitionCts; private object? _displayedContent; /// <summary> /// Defines the <see cref="PageTransition"/> property. /// </summary> public static readonly StyledProperty<IPageTransition?> PageTransitionProperty = AvaloniaProperty.Register<TransitioningContentControl, IPageTransition?>(nameof(PageTransition), new CrossFade(TimeSpan.FromSeconds(0.5))); /// <summary> /// Defines the <see cref="DisplayedContent"/> property. /// </summary> public static readonly DirectProperty<TransitioningContentControl, object?> DisplayedContentProperty = AvaloniaProperty.RegisterDirect<TransitioningContentControl, object?>(nameof(DisplayedContent), o => o.DisplayedContent); /// <summary> /// Gets or sets the animation played when content appears and disappears. /// </summary> public IPageTransition? PageTransition { get => GetValue(PageTransitionProperty); set => SetValue(PageTransitionProperty, value); } /// <summary> /// Gets or sets the content displayed whenever there is no page currently routed. /// </summary> public object? DisplayedContent { get => _displayedContent; private set => SetAndRaise(DisplayedContentProperty, ref _displayedContent, value); } protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change) { base.OnPropertyChanged(change); if (change.Property == ContentProperty) { UpdateContentWithTransition(change.NewValue.GetValueOrDefault()); } } /// <summary> /// Updates the content with transitions. /// </summary> /// <param name="content">New content to set.</param> private async void UpdateContentWithTransition(object? content) { _lastTransitionCts?.Cancel(); _lastTransitionCts = new CancellationTokenSource(); if (PageTransition != null) await PageTransition.Start(this, null, true, _lastTransitionCts.Token); DisplayedContent = content; if (PageTransition != null) await PageTransition.Start(null, this, true, _lastTransitionCts.Token); } }
mit
C#
0e6407f9015c4209737eb63dbaf4999a4f08b1a0
Add new HandleReturnValue attribute to HttpTrigger.
Azure/azure-webjobs-sdk-extensions
src/WebJobs.Extensions.Http/HttpTriggerAttribute.cs
src/WebJobs.Extensions.Http/HttpTriggerAttribute.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using Microsoft.Azure.WebJobs.Description; using Microsoft.Azure.WebJobs.Extensions.Http; namespace Microsoft.Azure.WebJobs { /// <summary> /// Attribute used for http triggered functions. /// </summary> [Binding(TriggerHandlesReturnValue = true)] [AttributeUsage(AttributeTargets.Parameter)] public sealed class HttpTriggerAttribute : Attribute { /// <summary> /// Constructs a new instance. /// </summary> public HttpTriggerAttribute() { AuthLevel = AuthorizationLevel.Function; } /// <summary> /// Constructs a new instance. /// </summary> /// <param name="methods">The http methods to allow.</param> public HttpTriggerAttribute(params string[] methods) : this() { Methods = methods; } /// <summary> /// Constructs a new instance. /// </summary> /// <param name="authLevel">The <see cref="AuthorizationLevel"/> to apply.</param> /// <param name="methods">The http methods to allow.</param> public HttpTriggerAttribute(AuthorizationLevel authLevel, params string[] methods) { AuthLevel = authLevel; Methods = methods; } /// <summary> /// Gets or sets the route template for the function. Can include /// route parameters using WebApi supported syntax. If not specified, /// will default to the function name. /// </summary> public string Route { get; set; } /// <summary> /// Gets the http methods that are supported for the function. /// </summary> public string[] Methods { get; private set; } /// <summary> /// Gets the authorization level for the function. /// </summary> public AuthorizationLevel AuthLevel { get; private set; } /// <summary> /// Gets or sets the WebHook type, if this function represents a WebHook. /// </summary> public string WebHookType { get; set; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using Microsoft.Azure.WebJobs.Description; using Microsoft.Azure.WebJobs.Extensions.Http; namespace Microsoft.Azure.WebJobs { /// <summary> /// Attribute used for http triggered functions. /// </summary> [Binding] [AttributeUsage(AttributeTargets.Parameter)] public sealed class HttpTriggerAttribute : Attribute { /// <summary> /// Constructs a new instance. /// </summary> public HttpTriggerAttribute() { AuthLevel = AuthorizationLevel.Function; } /// <summary> /// Constructs a new instance. /// </summary> /// <param name="methods">The http methods to allow.</param> public HttpTriggerAttribute(params string[] methods) : this() { Methods = methods; } /// <summary> /// Constructs a new instance. /// </summary> /// <param name="authLevel">The <see cref="AuthorizationLevel"/> to apply.</param> /// <param name="methods">The http methods to allow.</param> public HttpTriggerAttribute(AuthorizationLevel authLevel, params string[] methods) { AuthLevel = authLevel; Methods = methods; } /// <summary> /// Gets or sets the route template for the function. Can include /// route parameters using WebApi supported syntax. If not specified, /// will default to the function name. /// </summary> public string Route { get; set; } /// <summary> /// Gets the http methods that are supported for the function. /// </summary> public string[] Methods { get; private set; } /// <summary> /// Gets the authorization level for the function. /// </summary> public AuthorizationLevel AuthLevel { get; private set; } /// <summary> /// Gets or sets the WebHook type, if this function represents a WebHook. /// </summary> public string WebHookType { get; set; } } }
mit
C#
a68b344bf0b67b2ea05029f6cdb69510c2594071
Test fix for appveyor CS0840
CKCobra/ZendeskApi_v2,mattnis/ZendeskApi_v2,mwarger/ZendeskApi_v2
ZendeskApi_v2/Models/Targets/BaseTarget.cs
ZendeskApi_v2/Models/Targets/BaseTarget.cs
using System; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace ZendeskApi_v2.Models.Targets { public class BaseTarget { [JsonProperty("id")] public long? Id { get; set; } [JsonProperty("title")] public string Title { get; set; } [JsonProperty("type")] public virtual string Type { get; private set; } [JsonProperty("active")] public bool Active { get; set; } [JsonProperty("created_at")] [JsonConverter(typeof(IsoDateTimeConverter))] public DateTimeOffset? CreatedAt { get; set; } } }
using System; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace ZendeskApi_v2.Models.Targets { public class BaseTarget { [JsonProperty("id")] public long? Id { get; set; } [JsonProperty("title")] public string Title { get; set; } [JsonProperty("type")] public virtual string Type { get; } [JsonProperty("active")] public bool Active { get; set; } [JsonProperty("created_at")] [JsonConverter(typeof(IsoDateTimeConverter))] public DateTimeOffset? CreatedAt { get; set; } } }
apache-2.0
C#
c36ff2dfb996325435ce3ffca105523f8aecd0bc
Remove TODO about BytesPerPosting() - this could be non-deterministic or expensive, not to mention, it is internal anyway
sisve/lucenenet,apache/lucenenet,NightOwl888/lucenenet,sisve/lucenenet,apache/lucenenet,jeme/lucenenet,jeme/lucenenet,apache/lucenenet,apache/lucenenet,laimis/lucenenet,jeme/lucenenet,NightOwl888/lucenenet,NightOwl888/lucenenet,laimis/lucenenet,jeme/lucenenet,NightOwl888/lucenenet
src/Lucene.Net.Core/Index/ParallelPostingsArray.cs
src/Lucene.Net.Core/Index/ParallelPostingsArray.cs
using System; namespace Lucene.Net.Index { /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 ArrayUtil = Lucene.Net.Util.ArrayUtil; using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator; internal class ParallelPostingsArray { internal static readonly int BYTES_PER_POSTING = 3 * RamUsageEstimator.NUM_BYTES_INT; internal readonly int Size; internal readonly int[] TextStarts; internal readonly int[] IntStarts; internal readonly int[] ByteStarts; internal ParallelPostingsArray(int size) { this.Size = size; TextStarts = new int[size]; IntStarts = new int[size]; ByteStarts = new int[size]; } internal virtual int BytesPerPosting() { return BYTES_PER_POSTING; } internal virtual ParallelPostingsArray NewInstance(int size) { return new ParallelPostingsArray(size); } internal ParallelPostingsArray Grow() { int newSize = ArrayUtil.Oversize(Size + 1, BytesPerPosting()); ParallelPostingsArray newArray = NewInstance(newSize); CopyTo(newArray, Size); return newArray; } internal virtual void CopyTo(ParallelPostingsArray toArray, int numToCopy) { Array.Copy(TextStarts, 0, toArray.TextStarts, 0, numToCopy); Array.Copy(IntStarts, 0, toArray.IntStarts, 0, numToCopy); Array.Copy(ByteStarts, 0, toArray.ByteStarts, 0, numToCopy); } } }
using System; namespace Lucene.Net.Index { /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 ArrayUtil = Lucene.Net.Util.ArrayUtil; using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator; internal class ParallelPostingsArray { internal static readonly int BYTES_PER_POSTING = 3 * RamUsageEstimator.NUM_BYTES_INT; internal readonly int Size; internal readonly int[] TextStarts; internal readonly int[] IntStarts; internal readonly int[] ByteStarts; internal ParallelPostingsArray(int size) { this.Size = size; TextStarts = new int[size]; IntStarts = new int[size]; ByteStarts = new int[size]; } internal virtual int BytesPerPosting() // LUCENENET TODO: Make property { return BYTES_PER_POSTING; } internal virtual ParallelPostingsArray NewInstance(int size) { return new ParallelPostingsArray(size); } internal ParallelPostingsArray Grow() { int newSize = ArrayUtil.Oversize(Size + 1, BytesPerPosting()); ParallelPostingsArray newArray = NewInstance(newSize); CopyTo(newArray, Size); return newArray; } internal virtual void CopyTo(ParallelPostingsArray toArray, int numToCopy) { Array.Copy(TextStarts, 0, toArray.TextStarts, 0, numToCopy); Array.Copy(IntStarts, 0, toArray.IntStarts, 0, numToCopy); Array.Copy(ByteStarts, 0, toArray.ByteStarts, 0, numToCopy); } } }
apache-2.0
C#
6580d501151b13b3aa4a52e75236d0cb0a1e70a9
adjust the order of header properties
mayswind/C3D.NET
C3D.DataViewer/Controls/ucHeader.cs
C3D.DataViewer/Controls/ucHeader.cs
using System; using System.Windows.Forms; namespace C3D.DataViewer.Controls { public partial class ucHeader : UserControl { public ucHeader(C3DFile file) { InitializeComponent(); this.lvItems.Items.Add(new ListViewItem(new String[] { "File Format", file.CreateProcessorType.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Number Format", file.Header.ScaleFactor > 0 ? "INT" : "REAL" })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Point Count", file.Header.PointCount.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "First Frame Index", file.Header.FirstFrameIndex.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Last Frame Index", file.Header.LastFrameIndex.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Scale Factor", file.Header.ScaleFactor.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Frame Rate", file.Header.FrameRate.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Measurement Count", file.Header.AnalogMeasurementCount.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Samples Per Frame", file.Header.AnalogSamplesPerFrame.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Max Interpolation Gaps", file.Header.MaxInterpolationGaps.ToString() })); } } }
using System; using System.Windows.Forms; namespace C3D.DataViewer.Controls { public partial class ucHeader : UserControl { public ucHeader(C3DFile file) { InitializeComponent(); this.lvItems.Items.Add(new ListViewItem(new String[] { "File Format", file.CreateProcessorType.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Number Format", file.Header.ScaleFactor > 0 ? "INT" : "REAL" })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Point Count", file.Header.PointCount.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Measurement Count", file.Header.AnalogMeasurementCount.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "First Frame Index", file.Header.FirstFrameIndex.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Last Frame Index", file.Header.LastFrameIndex.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Max Interpolation Gaps", file.Header.MaxInterpolationGaps.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Scale Factor", file.Header.ScaleFactor.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Samples Per Frame", file.Header.AnalogSamplesPerFrame.ToString() })); this.lvItems.Items.Add(new ListViewItem(new String[] { "Frame Rate", file.Header.FrameRate.ToString() })); } } }
mit
C#
855b8e89a5677052cda5301a1e6d1ef2867a83f5
Bump version to 14.4.3.31532
HearthSim/HearthDb
HearthDb/Properties/AssemblyInfo.cs
HearthDb/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("HearthDb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HearthSim")] [assembly: AssemblyProduct("HearthDb")] [assembly: AssemblyCopyright("Copyright © HearthSim 2019")] [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("7ed14243-e02b-4b94-af00-a67a62c282f0")] // 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("14.4.3.31532")] [assembly: AssemblyFileVersion("14.4.3.31532")]
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("HearthDb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HearthSim")] [assembly: AssemblyProduct("HearthDb")] [assembly: AssemblyCopyright("Copyright © HearthSim 2019")] [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("7ed14243-e02b-4b94-af00-a67a62c282f0")] // 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("14.4.0.31268")] [assembly: AssemblyFileVersion("14.4.0.31268")]
mit
C#
4b1ccd8cbc743c8d1d5bc92faad514c0fc561b9b
Update FlowersHandler.cs
justinkruit/DiscordBot,Blacnova/NadekoBot,N1SMOxGT-R/NeoBot,PravEF/EFNadekoBot,Midnight-Myth/Mitternacht-NEW,Track44/Nadeko,Grinjr/NadekoBot,Uleyethis/FightBot,blitz4694/NadekoBot,rumlefisk/NadekoBot,WoodenGlaze/NadekoBot,Taknok/NadekoBot,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Youngsie1997/NadekoBot,miraai/NadekoBot,kyoryo/DiscordBot,dtshady/NadekoBot,Midnight-Myth/Mitternacht-NEW,halitalf/NadekoMods,shikhir-arora/NadekoBot,Reiuiji/NadekoBot,justinkruit/WIABot,ScarletKuro/NadekoBot,ShadowNoire/NadekoBot,gfrewqpoiu/NadekoBot,N1SMOxGT-R/NeoBot,kyoryo/DiscordBot,Nielk1/NadekoBot,powered-by-moe/MikuBot,blitz4694/NadekoBot,dtshady/NadekoBot,kyoryo/DiscordBot
NadekoBot/Classes/FlowersHandler.cs
NadekoBot/Classes/FlowersHandler.cs
using System.Threading.Tasks; namespace NadekoBot.Classes { internal static class FlowersHandler { public static async Task AddFlowersAsync(Discord.User u, string reason, int amount, bool silent = false) { if (amount <= 0) return; await Task.Run(() => { DbHandler.Instance.InsertData(new DataModels.CurrencyTransaction { Reason = reason, UserId = (long)u.Id, Value = amount, }); }).ConfigureAwait(false); if (silent) return; var flows = ""; //Maximum displayed will be ~40 int i; for (i = 0; i < 40 && i < amount; i++) { flows += NadekoBot.Config.CurrencySign; } if (i < amount) { flows += $" and {amount - i} more {NadekoBot.Config.CurrencySign}!"; } await u.SendMessage("👑Congratulations!👑\nYou received: " + flows).ConfigureAwait(false); } public static bool RemoveFlowers(Discord.User u, string reason, int amount) { if (amount <= 0) return false; var uid = (long)u.Id; var state = DbHandler.Instance.FindOne<DataModels.CurrencyState>(cs => cs.UserId == uid); if (state.Value < amount) return false; DbHandler.Instance.InsertData(new DataModels.CurrencyTransaction { Reason = reason, UserId = (long)u.Id, Value = -amount, }); return true; } } }
using System.Threading.Tasks; namespace NadekoBot.Classes { internal static class FlowersHandler { public static async Task AddFlowersAsync(Discord.User u, string reason, int amount, bool silent = false) { if (amount <= 0) return; await Task.Run(() => { DbHandler.Instance.InsertData(new DataModels.CurrencyTransaction { Reason = reason, UserId = (long)u.Id, Value = amount, }); }).ConfigureAwait(false); if (silent) return; var flows = ""; for (var i = 0; i < amount; i++) { flows += NadekoBot.Config.CurrencySign; } await u.SendMessage("👑Congratulations!👑\nYou received: " + flows).ConfigureAwait(false); } public static bool RemoveFlowers(Discord.User u, string reason, int amount) { if (amount <= 0) return false; var uid = (long)u.Id; var state = DbHandler.Instance.FindOne<DataModels.CurrencyState>(cs => cs.UserId == uid); if (state.Value < amount) return false; DbHandler.Instance.InsertData(new DataModels.CurrencyTransaction { Reason = reason, UserId = (long)u.Id, Value = -amount, }); return true; } } }
unlicense
C#
1e06820f71a9a15333195b02d67dd0b77013f119
Fix issue of file opened via Finder doesn't always display.
kevintavog/Radish.net,kevintavog/Radish.net
src/Cocoa/AppDelegate.cs
src/Cocoa/AppDelegate.cs
using System; using System.Drawing; using MonoMac.Foundation; using MonoMac.AppKit; using MonoMac.ObjCRuntime; using NLog; using Radish.Support; using System.IO; namespace Radish { public partial class AppDelegate : NSApplicationDelegate { private static Logger logger = LogManager.GetCurrentClassLogger(); private MainWindowController controller; private string filename; public AppDelegate() { } public override void FinishedLaunching(NSObject notification) { var urlList = new NSFileManager().GetUrls(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User); Preferences.Load(Path.Combine( urlList[0].Path, "Preferences", "com.rangic.Radish.json")); controller = new MainWindowController(); controller.Window.MakeKeyAndOrderFront(this); if (filename != null) { controller.OpenFolderOrFile(filename); } } public override bool OpenFile(NSApplication sender, string filename) { if (controller == null) { this.filename = filename; logger.Info("OpenFile '{0}'", filename); return true; } return controller.OpenFolderOrFile(filename); } } }
using System; using System.Drawing; using MonoMac.Foundation; using MonoMac.AppKit; using MonoMac.ObjCRuntime; using NLog; using Radish.Support; using System.IO; namespace Radish { public partial class AppDelegate : NSApplicationDelegate { private static Logger logger = LogManager.GetCurrentClassLogger(); MainWindowController controller; public AppDelegate() { } public override void FinishedLaunching(NSObject notification) { var urlList = new NSFileManager().GetUrls(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User); Preferences.Load(Path.Combine( urlList[0].Path, "Preferences", "com.rangic.Radish.json")); if (controller == null) { controller = new MainWindowController(); controller.Window.MakeKeyAndOrderFront(this); } } public override bool OpenFile(NSApplication sender, string filename) { logger.Info("OpenFile '{0}'", filename); if (controller == null) { controller = new MainWindowController(); controller.Window.MakeKeyAndOrderFront(this); } return controller.OpenFolderOrFile(filename); } } }
mit
C#
6fff529a2bab6eafba261c15696e4aa9178a0905
Revert "Revert "Changed Regex for owners to make sure the string is at the end of the task description""
jawsthegame/PivotalExtension,jawsthegame/PivotalExtension
PivotalTrackerDotNet/Domain/Task.cs
PivotalTrackerDotNet/Domain/Task.cs
using System.Collections.Generic; using System.Text.RegularExpressions; using System.Linq; namespace PivotalTrackerDotNet.Domain { public class Task { public int Id { get; set; } public string Description { get; set; } public bool Complete { get; set; } public int ParentStoryId { get; set; } public int ProjectId { get; set; } static readonly AuthenticationToken Token = AuthenticationService.Authenticate("v5core", "changeme"); protected static List<Person> Members; static Regex FullOwnerRegex = new Regex(@"([ ]?\-[ ]?)?(\()?[A-Z]{2,3}(\/[A-Z]{2,3})*(\))?$", RegexOptions.Compiled); public string GetDescriptionWithoutOwners() { var descriptionWithoutOwners = FullOwnerRegex.Replace(Description, ""); return descriptionWithoutOwners.Length == 0 ? "(Placeholder)" : descriptionWithoutOwners.TrimEnd(); } public void SetOwners(List<Person> owners) { if (owners.Count == 0) return; var match = FullOwnerRegex.Match(Description); if (match != null) { Description = Description.Remove(match.Index); var initials = string.Join("/", owners.Select(o => o.Initials)); Description += " - " + initials; } } public List<Person> GetOwners() { if (Members == null) { Members = new MembershipService(Token).GetMembers(ProjectId); } var owners = new List<Person>(); var regex = new Regex(@"[A-Z]{2,3}(\/[A-Z]{2,3})+"); var matches = regex.Matches(Description); if (matches.Count > 0) { var membersLookup = Members.ToDictionary(m => m.Initials); var initials = matches[0].Value.Split('/'); foreach (var owner in initials) { if (membersLookup.ContainsKey(owner)) { owners.Add(membersLookup[owner]); } } } return owners; } public string GetStyle() { if (this.Complete) { return "task complete"; } else if (this.GetOwners().Any()) { return "task in-progress"; } else { return "task"; } } public string GetIdToken() { return string.Format("{0}:{1}:{2}", ProjectId, ParentStoryId, Id); } } // <?xml version="1.0" encoding="UTF-8"?> //<task> // <id type="integer">$TASK_ID</id> // <description>find shields</description> // <position>1</position> // <complete>false</complete> // <created_at type="datetime">2008/12/10 00:00:00 UTC</created_at> //</task> }
using System.Collections.Generic; using System.Text.RegularExpressions; using System.Linq; namespace PivotalTrackerDotNet.Domain { public class Task { public int Id { get; set; } public string Description { get; set; } public bool Complete { get; set; } public int ParentStoryId { get; set; } public int ProjectId { get; set; } static readonly AuthenticationToken Token = AuthenticationService.Authenticate("v5core", "changeme"); protected static List<Person> Members; static Regex FullOwnerRegex = new Regex(@"([ ]?\-[ ]?)?(\()?[A-Z]{2,3}(\/[A-Z]{2,3})*(\))?", RegexOptions.Compiled); public string GetDescriptionWithoutOwners() { var descriptionWithoutOwners = FullOwnerRegex.Replace(Description, ""); return descriptionWithoutOwners.Length == 0 ? "(Placeholder)" : descriptionWithoutOwners.TrimEnd(); } public void SetOwners(List<Person> owners) { if (owners.Count == 0) return; var match = FullOwnerRegex.Match(Description); if (match != null) { Description = Description.Remove(match.Index); var initials = string.Join("/", owners.Select(o => o.Initials)); Description += " - " + initials; } } public List<Person> GetOwners() { if (Members == null) { Members = new MembershipService(Token).GetMembers(ProjectId); } var owners = new List<Person>(); var regex = new Regex(@"[A-Z]{2,3}(\/[A-Z]{2,3})+"); var matches = regex.Matches(Description); if (matches.Count > 0) { var membersLookup = Members.ToDictionary(m => m.Initials); var initials = matches[0].Value.Split('/'); foreach (var owner in initials) { if (membersLookup.ContainsKey(owner)) { owners.Add(membersLookup[owner]); } } } return owners; } public string GetStyle() { if (this.Complete) { return "task complete"; } else if (this.GetOwners().Any()) { return "task in-progress"; } else { return "task"; } } public string GetIdToken() { return string.Format("{0}:{1}:{2}", ProjectId, ParentStoryId, Id); } } // <?xml version="1.0" encoding="UTF-8"?> //<task> // <id type="integer">$TASK_ID</id> // <description>find shields</description> // <position>1</position> // <complete>false</complete> // <created_at type="datetime">2008/12/10 00:00:00 UTC</created_at> //</task> }
mit
C#
981a3ba6fb0a1f4f618767227e5091bac4bb3efa
Update default WrapGivenTextIfNotFound value
lemestrez/aspnetboilerplate,ryancyq/aspnetboilerplate,ZhaoRd/aspnetboilerplate,luchaoshuai/aspnetboilerplate,verdentk/aspnetboilerplate,oceanho/aspnetboilerplate,s-takatsu/aspnetboilerplate,carldai0106/aspnetboilerplate,zclmoon/aspnetboilerplate,carldai0106/aspnetboilerplate,yuzukwok/aspnetboilerplate,beratcarsi/aspnetboilerplate,oceanho/aspnetboilerplate,andmattia/aspnetboilerplate,virtualcca/aspnetboilerplate,ilyhacker/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ShiningRush/aspnetboilerplate,s-takatsu/aspnetboilerplate,SXTSOFT/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,zquans/aspnetboilerplate,verdentk/aspnetboilerplate,lvjunlei/aspnetboilerplate,AlexGeller/aspnetboilerplate,Nongzhsh/aspnetboilerplate,yuzukwok/aspnetboilerplate,Nongzhsh/aspnetboilerplate,lvjunlei/aspnetboilerplate,yuzukwok/aspnetboilerplate,fengyeju/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Nongzhsh/aspnetboilerplate,jaq316/aspnetboilerplate,4nonym0us/aspnetboilerplate,AlexGeller/aspnetboilerplate,carldai0106/aspnetboilerplate,SXTSOFT/aspnetboilerplate,zclmoon/aspnetboilerplate,ShiningRush/aspnetboilerplate,zquans/aspnetboilerplate,lvjunlei/aspnetboilerplate,ryancyq/aspnetboilerplate,ShiningRush/aspnetboilerplate,4nonym0us/aspnetboilerplate,lemestrez/aspnetboilerplate,ryancyq/aspnetboilerplate,lemestrez/aspnetboilerplate,berdankoca/aspnetboilerplate,zquans/aspnetboilerplate,jaq316/aspnetboilerplate,carldai0106/aspnetboilerplate,ZhaoRd/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,ZhaoRd/aspnetboilerplate,zclmoon/aspnetboilerplate,fengyeju/aspnetboilerplate,berdankoca/aspnetboilerplate,690486439/aspnetboilerplate,jaq316/aspnetboilerplate,oceanho/aspnetboilerplate,beratcarsi/aspnetboilerplate,luchaoshuai/aspnetboilerplate,4nonym0us/aspnetboilerplate,ilyhacker/aspnetboilerplate,s-takatsu/aspnetboilerplate,verdentk/aspnetboilerplate,berdankoca/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,fengyeju/aspnetboilerplate,ryancyq/aspnetboilerplate,690486439/aspnetboilerplate,AlexGeller/aspnetboilerplate,andmattia/aspnetboilerplate,690486439/aspnetboilerplate,SXTSOFT/aspnetboilerplate,virtualcca/aspnetboilerplate
src/Abp/Configuration/Startup/LocalizationConfiguration.cs
src/Abp/Configuration/Startup/LocalizationConfiguration.cs
using System.Collections.Generic; using Abp.Localization; namespace Abp.Configuration.Startup { /// <summary> /// Used for localization configurations. /// </summary> internal class LocalizationConfiguration : ILocalizationConfiguration { /// <inheritdoc/> public IList<LanguageInfo> Languages { get; private set; } /// <inheritdoc/> public ILocalizationSourceList Sources { get; private set; } /// <inheritdoc/> public bool IsEnabled { get; set; } /// <inheritdoc/> public bool ReturnGivenTextIfNotFound { get; set; } /// <inheritdoc/> public bool WrapGivenTextIfNotFound { get; set; } /// <inheritdoc/> public bool HumanizeTextIfNotFound { get; set; } public LocalizationConfiguration() { Languages = new List<LanguageInfo>(); Sources = new LocalizationSourceList(); IsEnabled = true; ReturnGivenTextIfNotFound = true; WrapGivenTextIfNotFound = true; HumanizeTextIfNotFound = true; } } }
using System.Collections.Generic; using Abp.Localization; namespace Abp.Configuration.Startup { /// <summary> /// Used for localization configurations. /// </summary> internal class LocalizationConfiguration : ILocalizationConfiguration { /// <inheritdoc/> public IList<LanguageInfo> Languages { get; private set; } /// <inheritdoc/> public ILocalizationSourceList Sources { get; private set; } /// <inheritdoc/> public bool IsEnabled { get; set; } /// <inheritdoc/> public bool ReturnGivenTextIfNotFound { get; set; } /// <inheritdoc/> public bool WrapGivenTextIfNotFound { get; set; } /// <inheritdoc/> public bool HumanizeTextIfNotFound { get; set; } public LocalizationConfiguration() { Languages = new List<LanguageInfo>(); Sources = new LocalizationSourceList(); IsEnabled = true; ReturnGivenTextIfNotFound = true; WrapGivenTextIfNotFound = false; HumanizeTextIfNotFound = true; } } }
mit
C#
0912259ae96cba5cba9acb60e44061f1bc5b33c2
Correct string format
Kingloo/GB-Live
src/Program.cs
src/Program.cs
using System; using System.Globalization; using GBLive.Common; using GBLive.Gui; namespace GBLive { public static class Program { [STAThread] public static int Main() { App app = new App(); int exitCode = app.Run(); if (exitCode != 0) { string message = string.Format(CultureInfo.CurrentCulture, "exited with {0}", exitCode); Log.Message(message); } return exitCode; } } }
using System; using System.Globalization; using GBLive.Common; using GBLive.Gui; namespace GBLive { public static class Program { [STAThread] public static int Main() { App app = new App(); int exitCode = app.Run(); if (exitCode != 0) { string message = string.Format(CultureInfo.CurrentCulture, $"exited with {exitCode}", exitCode); Log.Message(message); } return exitCode; } } }
unlicense
C#
ce49726745c0a81c4941c9726185670e9e35e539
Update Azure Media Startup order (#1829)
xkproject/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,petedavis/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2
src/OrchardCore.Modules/OrchardCore.Media.Azure/Startup.cs
src/OrchardCore.Modules/OrchardCore.Media.Azure/Startup.cs
using System; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrchardCore.FileStorage.AzureBlob; using OrchardCore.Media.Services; using OrchardCore.Modules; namespace OrchardCore.Media.Azure { [Feature("OrchardCore.Media.Azure.Storage")] public class Startup : StartupBase { private IConfiguration _configuration; private ILogger<Startup> _logger; public Startup(IConfiguration configuration, ILogger<Startup> logger) { _configuration = configuration; _logger = logger; } public override int Order => 10; public override void ConfigureServices(IServiceCollection services) { services.Configure<MediaBlobStorageOptions>(_configuration.GetSection("Modules:OrchardCore.Media.Azure")); // Only replace default implementation if options are valid. var connectionString = _configuration.GetValue<string>($"Modules:OrchardCore.Media.Azure:{nameof(MediaBlobStorageOptions.ConnectionString)}"); var containerName = _configuration.GetValue<string>($"Modules:OrchardCore.Media.Azure:{nameof(MediaBlobStorageOptions.ContainerName)}"); if (MediaBlobStorageOptionsCheckFilter.CheckOptions(connectionString, containerName, _logger)) { services.Replace(ServiceDescriptor.Singleton<IMediaFileStore>(serviceProvider => { var options = serviceProvider.GetRequiredService<IOptions<MediaBlobStorageOptions>>().Value; var clock = serviceProvider.GetRequiredService<IClock>(); var fileStore = new BlobFileStore(options, clock); var mediaBaseUri = fileStore.BaseUri; if (!String.IsNullOrEmpty(options.PublicHostName)) mediaBaseUri = new UriBuilder(mediaBaseUri) { Host = options.PublicHostName }.Uri; return new MediaFileStore(fileStore, mediaBaseUri.ToString()); })); } services.Configure<MvcOptions>((options) => { options.Filters.Add(typeof(MediaBlobStorageOptionsCheckFilter)); }); } } }
using System; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrchardCore.FileStorage.AzureBlob; using OrchardCore.Media.Services; using OrchardCore.Modules; namespace OrchardCore.Media.Azure { [Feature("OrchardCore.Media.Azure.Storage")] public class Startup : StartupBase { private IConfiguration _configuration; private ILogger<Startup> _logger; public Startup(IConfiguration configuration, ILogger<Startup> logger) { _configuration = configuration; _logger = logger; } public override void ConfigureServices(IServiceCollection services) { services.Configure<MediaBlobStorageOptions>(_configuration.GetSection("Modules:OrchardCore.Media.Azure")); // Only replace default implementation if options are valid. var connectionString = _configuration.GetValue<string>($"Modules:OrchardCore.Media.Azure:{nameof(MediaBlobStorageOptions.ConnectionString)}"); var containerName = _configuration.GetValue<string>($"Modules:OrchardCore.Media.Azure:{nameof(MediaBlobStorageOptions.ContainerName)}"); if (MediaBlobStorageOptionsCheckFilter.CheckOptions(connectionString, containerName, _logger)) { services.Replace(ServiceDescriptor.Singleton<IMediaFileStore>(serviceProvider => { var options = serviceProvider.GetRequiredService<IOptions<MediaBlobStorageOptions>>().Value; var clock = serviceProvider.GetRequiredService<IClock>(); var fileStore = new BlobFileStore(options, clock); var mediaBaseUri = fileStore.BaseUri; if (!String.IsNullOrEmpty(options.PublicHostName)) mediaBaseUri = new UriBuilder(mediaBaseUri) { Host = options.PublicHostName }.Uri; return new MediaFileStore(fileStore, mediaBaseUri.ToString()); })); } services.Configure<MvcOptions>((options) => { options.Filters.Add(typeof(MediaBlobStorageOptionsCheckFilter)); }); } } }
bsd-3-clause
C#
fc6c29c5d2783f84fb470322120497d7bf0e4808
Add oldstate
slhad/FullScreenCheckAndRun
Source/FSCR/Main.cs
Source/FSCR/Main.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using FSCR.Libs; namespace FSCR { public partial class Main : Form { Checker checker = null; StringBuilder sb = new StringBuilder(); bool oldState = true; public Main() { InitializeComponent(); } private void bIsEnabled_Click(object sender, EventArgs e) { timerCheck.Enabled = !timerCheck.Enabled; bIsEnabled.Text = timerCheck.Enabled ? "On" : "Off"; } private void timerCheck_Tick(object sender, EventArgs e) { if (checker == null) { checker = new Checker(); } if (sb.ToString() != "") { sb.Append(Environment.NewLine); } sb.Append(DateTime.Now); bool newState = checker.check(); if (newState != oldState) { if (newState) { sb.Append(" : Fullscreen"); } else { sb.Append(" : Windowed"); } tbLog.Text = sb.ToString(); } } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using FSCR.Libs; namespace FSCR { public partial class Main : Form { Checker checker = null; StringBuilder sb = new StringBuilder(); public Main() { InitializeComponent(); } private void bIsEnabled_Click(object sender, EventArgs e) { timerCheck.Enabled = !timerCheck.Enabled; bIsEnabled.Text = timerCheck.Enabled ? "On" : "Off"; } private void timerCheck_Tick(object sender, EventArgs e) { if (checker == null) { checker = new Checker(); } if (checker.check()) { sb.Append("\nFullscreen"); } else { sb.Append("\nWindowed"); } tbLog.Text = sb.ToString(); } } }
mit
C#
5397c69e625118c3e9ddf8f36a3beffe7aa12a30
Add TODO
OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania
src/WebClient/Program.cs
src/WebClient/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; // TODO: Ar fi interesant o statistica pe tot anul, mai ales cele care s-au incheiat. Nu doar pe luni. [de la Sabin Uivarosan] namespace WebClient { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseApplicationInsights() .Build(); host.Run(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; namespace WebClient { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseApplicationInsights() .Build(); host.Run(); } } }
mit
C#
36073fff3cefbf6d59fdc5618d1bac426323a9b1
Refactor method to explicit helper. Fixes #253
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
samples/HelloMvc/Controllers/HomeController.cs
samples/HelloMvc/Controllers/HomeController.cs
using Microsoft.AspNet.Mvc; using MvcSample.Web.Models; namespace MvcSample.Web { public class HomeController : Controller { public IActionResult Index() { return View(CreateUser()); } public User CreateUser() { User user = new User() { Name = "My name", Address = "My address" }; return user; } } }
using Microsoft.AspNet.Mvc; using MvcSample.Web.Models; namespace MvcSample.Web { public class HomeController : Controller { public IActionResult Index() { return View(User()); } public User User() { User user = new User() { Name = "My name", Address = "My address" }; return user; } } }
apache-2.0
C#
0db4c879f77ba92cd9c6ba53914722f23e65cbeb
Split `LabelTests.Default` test into `Value` and `For` tests
atata-framework/atata,atata-framework/atata
test/Atata.IntegrationTests/Controls/LabelTests.cs
test/Atata.IntegrationTests/Controls/LabelTests.cs
namespace Atata.IntegrationTests.Controls; public class LabelTests : UITestFixture { private LabelPage _page; protected override void OnSetUp() => _page = Go.To<LabelPage>(); [Test] public void Value() => _page.FirstNameLabel.Should.Equal("First Name"); [Test] public void For() => _page.FirstNameLabel.For.Should.Equal("first-name"); [Test] public void WithFindByAttributeAttribute() => _page.LastNameByForLabel.Should.Equal("Last Name*"); [Test] public void WithFormatAttribute() => _page.LastNameLabel.Should.Equal("Last Name"); }
namespace Atata.IntegrationTests.Controls; public class LabelTests : UITestFixture { private LabelPage _page; protected override void OnSetUp() => _page = Go.To<LabelPage>(); [Test] public void Default() { _page.FirstNameLabel.Should.Equal("First Name"); _page.FirstNameLabel.Attributes.For.Should.Equal("first-name"); } [Test] public void WithFindByAttributeAttribute() => _page.LastNameByForLabel.Should.Equal("Last Name*"); [Test] public void WithFormatAttribute() => _page.LastNameLabel.Should.Equal("Last Name"); }
apache-2.0
C#
afec7941ffc9915fd99ba3e4fb680b0868edadee
Adjust default follow circle animations to feel nicer
peppy/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu
osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs
osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.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.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Utils; using osu.Game.Rulesets.Osu.Objects.Drawables; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Default { public class DefaultFollowCircle : FollowCircle { public DefaultFollowCircle() { InternalChild = new CircularContainer { RelativeSizeAxes = Axes.Both, Masking = true, BorderThickness = 5, BorderColour = Color4.Orange, Blending = BlendingParameters.Additive, Child = new Box { Colour = Color4.Orange, RelativeSizeAxes = Axes.Both, Alpha = 0.2f, } }; } protected override void OnTrackingChanged(ValueChangedEvent<bool> tracking) { const float duration = 300f; if (tracking.NewValue) { if (Precision.AlmostEquals(0, Alpha)) this.ScaleTo(1); this.ScaleTo(DrawableSliderBall.FOLLOW_AREA, duration, Easing.OutQuint) .FadeTo(1f, duration, Easing.OutQuint); } else { this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 1.2f, duration / 2, Easing.OutQuint) .FadeTo(0, duration / 2, Easing.OutQuint); } } protected override void OnSliderEnd() { const float fade_duration = 450f; // intentionally pile on an extra FadeOut to make it happen much faster this.FadeOut(fade_duration / 4, Easing.Out); } } }
// 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.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Osu.Objects.Drawables; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Default { public class DefaultFollowCircle : FollowCircle { public DefaultFollowCircle() { InternalChild = new CircularContainer { RelativeSizeAxes = Axes.Both, Masking = true, BorderThickness = 5, BorderColour = Color4.Orange, Blending = BlendingParameters.Additive, Child = new Box { Colour = Color4.Orange, RelativeSizeAxes = Axes.Both, Alpha = 0.2f, } }; } protected override void OnTrackingChanged(ValueChangedEvent<bool> tracking) { const float scale_duration = 300f; const float fade_duration = 300f; this.ScaleTo(tracking.NewValue ? DrawableSliderBall.FOLLOW_AREA : 1f, scale_duration, Easing.OutQuint) .FadeTo(tracking.NewValue ? 1f : 0, fade_duration, Easing.OutQuint); } protected override void OnSliderEnd() { const float fade_duration = 450f; // intentionally pile on an extra FadeOut to make it happen much faster this.FadeOut(fade_duration / 4, Easing.Out); } } }
mit
C#
7a11df07a9019fa3f411c385c659e75ff4b9041d
Add Constructor_SetsKey test [RED]
mattherman/MbDotNet,mattherman/MbDotNet,SuperDrew/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); } #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); } #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#
f38845db6d44770ccd753bfef6dd6191a51a88e0
Remove MetaData property from the CaptureResponse, as that API does not support MetaData
Viincenttt/MollieApi,Viincenttt/MollieApi
Mollie.Api/Models/Capture/Response/CaptureResponse.cs
Mollie.Api/Models/Capture/Response/CaptureResponse.cs
using System; using Mollie.Api.JsonConverters; using Newtonsoft.Json; namespace Mollie.Api.Models.Capture { public class CaptureResponse : IResponseObject{ /// <summary> /// Indicates the response contains a capture object. Will always contain capture for this endpoint. /// </summary> public string Resource { get; set; } /// <summary> /// The capture’s unique identifier, for example cpt_4qqhO89gsT. /// </summary> public string Id { get; set; } /// <summary> /// The mode used to create this capture. /// Possible values: live test /// </summary> public string Mode { get; set; } /// <summary> /// The amount captured. /// </summary> public Amount Amount { get; set; } /// <summary> /// This optional field will contain the amount that will be settled to your account, converted to the currency your account is settled in. It follows the same syntax as the amount property. /// </summary> public Amount SettlementAmount { get; set; } /// <summary> /// The unique identifier of the payment this capture was created for, for example: tr_7UhSN1zuXS /// </summary> public string PaymentId { get; set; } /// <summary> /// The unique identifier of the shipment that triggered the creation of this capture, for example: shp_3wmsgCJN4U /// </summary> public string ShipmentId { get; set; } /// <summary> /// The unique identifier of the settlement this capture was settled with, for example: stl_jDk30akdN /// </summary> public string SettlementId { get; set; } /// <summary> /// The capture’s date and time of creation, in ISO 8601 format. /// </summary> public DateTime CreatedAt { get; set; } /// <summary> /// An object with several URL objects relevant to the order. Every URL object will contain an href and a type field. /// </summary> [JsonProperty("_links")] public CaptureResponseLinks Links { get; set; } } }
using System; using Mollie.Api.JsonConverters; using Newtonsoft.Json; namespace Mollie.Api.Models.Capture { public class CaptureResponse : IResponseObject{ /// <summary> /// Indicates the response contains a capture object. Will always contain capture for this endpoint. /// </summary> public string Resource { get; set; } /// <summary> /// The capture’s unique identifier, for example cpt_4qqhO89gsT. /// </summary> public string Id { get; set; } /// <summary> /// The mode used to create this capture. /// Possible values: live test /// </summary> public string Mode { get; set; } /// <summary> /// The amount captured. /// </summary> public Amount Amount { get; set; } /// <summary> /// This optional field will contain the amount that will be settled to your account, converted to the currency your account is settled in. It follows the same syntax as the amount property. /// </summary> public Amount SettlementAmount { get; set; } /// <summary> /// The unique identifier of the payment this capture was created for, for example: tr_7UhSN1zuXS /// </summary> public string PaymentId { get; set; } /// <summary> /// The unique identifier of the shipment that triggered the creation of this capture, for example: shp_3wmsgCJN4U /// </summary> public string ShipmentId { get; set; } /// <summary> /// The unique identifier of the settlement this capture was settled with, for example: stl_jDk30akdN /// </summary> public string SettlementId { get; set; } /// <summary> /// The capture’s date and time of creation, in ISO 8601 format. /// </summary> public DateTime CreatedAt { get; set; } /// <summary> /// The optional metadata you provided upon subscription creation. Metadata can for example be used to link a plan to a /// subscription. /// </summary> [JsonConverter(typeof(RawJsonConverter))] public string Metadata { get; set; } /// <summary> /// An object with several URL objects relevant to the order. Every URL object will contain an href and a type field. /// </summary> [JsonProperty("_links")] public CaptureResponseLinks Links { get; set; } public T GetMetadata<T>(JsonSerializerSettings jsonSerializerSettings = null) { return JsonConvert.DeserializeObject<T>(this.Metadata, jsonSerializerSettings); } } }
mit
C#
28bb9c816c4a40c06c26fabcce10956bd27d57ef
Sort the array
vishipayyallore/CSharp-DotNet-Core-Samples
Samples.CSharp7/CSharp7.Logic.Programs/ValidString.cs
Samples.CSharp7/CSharp7.Logic.Programs/ValidString.cs
using System; namespace CSharp7.Logic.Programs { public static class ValidString { // Need to change the logic to have array instead of dictionary. static string isValid(string inputData) { int[] charcterCount = new int[26]; var characterRemoved = 0; foreach (var current in inputData) { charcterCount[current - 'a']++; } Array.Sort(charcterCount); foreach (var current in charcterCount) { if (current % 2 == 1) { characterRemoved++; if (characterRemoved >= 2) { break; } } } // If the Character Count contains only 1 alphabet series it should return "YES" return (characterRemoved == 2) ? "NO" : "YES"; } } } //static String isValid(String s) //{ // final String GOOD = "YES"; // final String BAD = "NO"; // if (s.isEmpty()) return BAD; // if (s.length() <= 3) return GOOD; // int[] letters = new int[26]; // for (int i = 0; i < s.length(); i++) // { // letters[s.charAt(i) - 'a']++; // } // Arrays.sort(letters); // int i = 0; // while (letters[i] == 0) // { // i++; // } // //System.out.println(Arrays.toString(letters)); // int min = letters[i]; //the smallest frequency of some letter // int max = letters[25]; // the largest frequency of some letter // String ret = BAD; // if (min == max) ret = GOOD; // else // { // // remove one letter at higher frequency or the lower frequency // if (((max - min == 1) && (max > letters[24])) || // (min == 1) && (letters[i + 1] == max)) // ret = GOOD; // } // return ret; //}
namespace CSharp7.Logic.Programs { public static class ValidString { // Need to change the logic to have array instead of dictionary. static string isValid(string inputData) { int[] charcterCount = new int[26]; var characterRemoved = 0; foreach (var current in inputData) { charcterCount[current - 'a']++; } // charcterCount.so foreach (var current in charcterCount) { if (current % 2 == 1) { characterRemoved++; if (characterRemoved >= 2) { break; } } } // If the Character Count contains only 1 alphabet series it should return "YES" return (characterRemoved == 2) ? "NO" : "YES"; } } } //static String isValid(String s) //{ // final String GOOD = "YES"; // final String BAD = "NO"; // if (s.isEmpty()) return BAD; // if (s.length() <= 3) return GOOD; // int[] letters = new int[26]; // for (int i = 0; i < s.length(); i++) // { // letters[s.charAt(i) - 'a']++; // } // Arrays.sort(letters); // int i = 0; // while (letters[i] == 0) // { // i++; // } // //System.out.println(Arrays.toString(letters)); // int min = letters[i]; //the smallest frequency of some letter // int max = letters[25]; // the largest frequency of some letter // String ret = BAD; // if (min == max) ret = GOOD; // else // { // // remove one letter at higher frequency or the lower frequency // if (((max - min == 1) && (max > letters[24])) || // (min == 1) && (letters[i + 1] == max)) // ret = GOOD; // } // return ret; //}
apache-2.0
C#
21ad788b069f9146c5188cc5c4bd817d432e4821
fix footer (#718)
reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website
input/_Footer.cshtml
input/_Footer.cshtml
<div class="container bottom-footer"> <div class="row"> <div class="col-lg-10 col-sm-10 col-xs-12" style="padding-top: 18px"> <ul class="list-inline"> <li class="list-inline-item"> <a href="https://github.com/reactiveui/reactiveui#core-team" target="_blank">Team</a> </li> <li class="list-inline-item"> <a href="/support" target="_blank">Support</a> </li> <li class="list-inline-item"> <a href="https://github.com/reactiveui/ReactiveUI/discussions" target="_blank">Discussions</a> </li> <li class="list-inline-item"> <a href="/branding" target="_blank">Branding</a> </li> <li> <a href="/source-code" target="_blank">Source Code</a> </li> <li class="list-inline-item"> <a href="/docs" target="_blank">Documentation</a> </li> <li class="list-inline-item"> <a href="/changelog" target="_blank">Changelog</a> </li> <li class="list-inline-item"> <a href="https://twitter.com/reactivexui" target="_blank">Twitter</a> </li> <li class="list-inline-item"> <a href="/contact" target="_blank">Contact Us</a> </li> </ul> </div> <div class="col-lg-2 col-sm-2 col-xs-12"> <a href="/"><img src="./assets/img/logo.png" width="64" height="64" class="footer-logo" alt="logotype" ></a> </div> </div> </div>
<div class="container bottom-footer"> <div class="row"> <div class="col-lg-10 col-sm-10 col-xs-12" style="padding-top: 18px"> <ul class="list-inline"> <li class="list-inline-item"> <a href="https://github.com/reactiveui/reactiveui#core-team" target="_blank">Team</a> </li> <li class="list-inline-item"> <a href="/support" target="_blank">Support</a> </li> <li class="list-inline-item"> <a href="https://github.com/reactiveui/ReactiveUI/discussions" target="_blank">Discussions</a> </li> <li class="list-inline-item"> <a href="/branding" target="_blank">Branding</a> </li> <li> <a href="/source-code" target="_blank">Source Code</a> </li> <li class="list-inline-item"> <a href="/docs" target="_blank">Documentation</a> </li> <li class="list-inline-item"> <a href="/changelog" target="_blank">Changelog</a> </li> <li class="list-inline-item"> <a href="https://twitter.com/reactivexui" target="_blank">Twitter</a> </li> <li class="list-inline-item"> <a href="/contact" target="_blank">Contact Us</a> </li> </ul> </div> </div> <div class="row"> <div class="col-lg-2 col-sm-2 col-xs-12"> <a href="/"><img src="./assets/img/logo.png" width="64" height="64" class="footer-logo" alt="logotype" ></a> </div> </div> </div>
mit
C#
511a4a21ad7fc222bd5234d750aa8d8e9c7450ad
Update AssemblyInfo.cs
ratishphilip/CompositionExpressionToolkit
CompositionExpressionToolkit.Ref/Properties/AssemblyInfo.cs
CompositionExpressionToolkit.Ref/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("CompositionExpressionToolkit.Ref")] [assembly: AssemblyDescription("This project contains class definitions for CompositionExpressionToolkit. These classes define the surface area for the C# compiler and Visual Studio Intellisense ")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CompositionExpressionToolkit.Ref")] [assembly: AssemblyCopyright("Copyright © 2016 Ratish Philip")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: ComVisible(false)]
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("CompositionExpressionToolkit.Ref")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CompositionExpressionToolkit.Ref")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
mit
C#
cff357f75ca00f157e0094dce12a06b9d7b50311
Rename `ToObservableExceptional` to `ToObservableExceptionalFlatten` for `IObservable<Option<T>>`
Weingartner/SolidworksAddinFramework
SolidworksAddinFramework/ObservableExceptionalExtensions.cs
SolidworksAddinFramework/ObservableExceptionalExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using System.Reactive.Threading.Tasks; using System.Threading; using LanguageExt; using ReactiveUI; using SolidworksAddinFramework.Wpf; using Weingartner.Exceptional; using Weingartner.Exceptional.Async; using Weingartner.Exceptional.Reactive; namespace SolidworksAddinFramework { public class NoneException : Exception { public NoneException() : base("None") { } } public static class ObservableExceptionalExtensions { public static IObservableExceptional<T> ToObservableExceptionalFlatten<T>(this IObservable<Option<T>> o) { return o.Select(ToExceptional).ToObservableExceptional(); } private static IExceptional<T> ToExceptional<T>(this Option<T> vo) { return vo.Match(Exceptional.Ok, () => Exceptional.Fail<T>(new NoneException())); } /// <summary> /// Converts None to a NoneException /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="U"></typeparam> /// <param name="o"></param> /// <param name="sel"></param> /// <returns></returns> public static IObservableExceptional<T> SelectOptionalFlatten<T, U>(this IObservableExceptional<U> o, Func<U, Option<T>> sel) { return o .Select(v => sel(v).ToExceptional()) .Observable .Select(v => v.SelectMany(e0 => e0)) .ToObservableExceptional(); } public static void Show(this Exception e) { // Exceptions viewer must be shown on STA thread. LogViewer.Invoke(()=> { var exceptionReporter = new ExceptionReporting.ExceptionReporter(); exceptionReporter.Show(e); }); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using System.Reactive.Threading.Tasks; using System.Threading; using LanguageExt; using ReactiveUI; using SolidworksAddinFramework.Wpf; using Weingartner.Exceptional; using Weingartner.Exceptional.Async; using Weingartner.Exceptional.Reactive; namespace SolidworksAddinFramework { public class NoneException : Exception { public NoneException() : base("None") { } } public static class ObservableExceptionalExtensions { public static IObservableExceptional<T> ToObservableExceptional<T>(this IObservable<Option<T>> o) { return o.Select(ToExceptional).ToObservableExceptional(); } private static IExceptional<T> ToExceptional<T>(this Option<T> vo) { return vo.Match(Exceptional.Ok, () => Exceptional.Fail<T>(new NoneException())); } /// <summary> /// Converts None to a NoneException /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="U"></typeparam> /// <param name="o"></param> /// <param name="sel"></param> /// <returns></returns> public static IObservableExceptional<T> SelectOptionalFlatten<T, U>(this IObservableExceptional<U> o, Func<U, Option<T>> sel) { return o .Select(v => sel(v).ToExceptional()) .Observable .Select(v => v.SelectMany(e0 => e0)) .ToObservableExceptional(); } public static void Show(this Exception e) { // Exceptions viewer must be shown on STA thread. LogViewer.Invoke(()=> { var exceptionReporter = new ExceptionReporting.ExceptionReporter(); exceptionReporter.Show(e); }); } } }
mit
C#
03c34a29ec465ae597731027fab454ecfc35d566
Update DisplayHideScrollBars.cs
maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Worksheets/Display/DisplayHideScrollBars.cs
Examples/CSharp/Worksheets/Display/DisplayHideScrollBars.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Display { public class DisplayHideScrollBars { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Hiding the vertical scroll bar of the Excel file workbook.Settings.IsVScrollBarVisible = false; //Hiding the horizontal scroll bar of the Excel file workbook.Settings.IsHScrollBarVisible = false; //Saving the modified Excel file workbook.Save(dataDir + "output.out.xls"); //Closing the file stream to free all resources fstream.Close(); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Display { public class DisplayHideScrollBars { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Hiding the vertical scroll bar of the Excel file workbook.Settings.IsVScrollBarVisible = false; //Hiding the horizontal scroll bar of the Excel file workbook.Settings.IsHScrollBarVisible = false; //Saving the modified Excel file workbook.Save(dataDir + "output.out.xls"); //Closing the file stream to free all resources fstream.Close(); } } }
mit
C#
3a0fa8690bb4e65b31f8614adeafb20cf08fc342
fix appsettings key
mdsol/Medidata.ZipkinTracerModule
src/Medidata.ZipkinTracer.Core/ZipkinConfig.cs
src/Medidata.ZipkinTracer.Core/ZipkinConfig.cs
using System; using System.Collections.Generic; using System.Configuration; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; namespace Medidata.ZipkinTracer.Core { [ExcludeFromCodeCoverage] //excluded from code coverage since this class are getters using static .net class ConfigurationManager public class ZipkinConfig : IZipkinConfig { public string ServiceName { get { return ConfigurationManager.AppSettings["ServiceName"];} } public string ZipkinServerName { get { return ConfigurationManager.AppSettings["zipkinScribeServerName"]; } } public string ZipkinServerPort { get { return ConfigurationManager.AppSettings["zipkinScribeServerPort"];} } public string SpanProcessorBatchSize { get { return ConfigurationManager.AppSettings["spanProcessorBatchSize"];} } public string FilterListCsv { get { return ConfigurationManager.AppSettings["mAuthWhitelist"];} } public string ZipkinSampleRate { get { return ConfigurationManager.AppSettings["zipkinSampleRate"];} } } }
using System; using System.Collections.Generic; using System.Configuration; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; namespace Medidata.ZipkinTracer.Core { [ExcludeFromCodeCoverage] //excluded from code coverage since this class are getters using static .net class ConfigurationManager public class ZipkinConfig : IZipkinConfig { public string ServiceName { get { return ConfigurationManager.AppSettings["ServiceName"];} } public string ZipkinServerName { get { return ConfigurationManager.AppSettings["zipkinScribeServerName"]; } } public string ZipkinServerPort { get { return ConfigurationManager.AppSettings["zipkinScribeServerPort"];} } public string SpanProcessorBatchSize { get { return ConfigurationManager.AppSettings["spanProcessorBatchSize"];} } public string FilterListCsv { get { return ConfigurationManager.AppSettings["mAuthPrivateKeyPath"];} } public string ZipkinSampleRate { get { return ConfigurationManager.AppSettings["zipkinSampleRate"];} } } }
mit
C#
4371a5b9fad83ad6eb107735ba304eeda3028037
Make StatusCodeProblemDetails public
khellang/Middleware,khellang/Middleware
src/ProblemDetails/StatusCodeProblemDetails.cs
src/ProblemDetails/StatusCodeProblemDetails.cs
using Microsoft.AspNetCore.WebUtilities; namespace Hellang.Middleware.ProblemDetails { public class StatusCodeProblemDetails : Microsoft.AspNetCore.Mvc.ProblemDetails { public StatusCodeProblemDetails(int statusCode) { Status = statusCode; Type = $"https://httpstatuses.com/{statusCode}"; Title = ReasonPhrases.GetReasonPhrase(statusCode); } } }
using Microsoft.AspNetCore.WebUtilities; namespace Hellang.Middleware.ProblemDetails { internal class StatusCodeProblemDetails : Microsoft.AspNetCore.Mvc.ProblemDetails { public StatusCodeProblemDetails(int statusCode) { Status = statusCode; Type = $"https://httpstatuses.com/{statusCode}"; Title = ReasonPhrases.GetReasonPhrase(statusCode); } } }
mit
C#
5a25aeff3cbfcfe2f4cf25ca7d1370860c668b3e
fix PatternExtensions.Pattern
signumsoftware/extensions,signumsoftware/extensions,signumsoftware/framework,AlejandroCano/extensions,MehdyKarimpour/extensions,MehdyKarimpour/extensions,signumsoftware/framework,AlejandroCano/extensions
Signum.Windows.Extensions.UIAutomation/PatternExtensions.cs
Signum.Windows.Extensions.UIAutomation/PatternExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Automation; using System.Reflection; using Signum.Utilities; namespace Signum.Windows.UIAutomation { public static class PatternExtensions { static readonly Dictionary<Type, AutomationPattern> patterns = new Dictionary<Type, AutomationPattern>(); public static P Pattern<P>(this AutomationElement ae) where P : BasePattern { AutomationPattern key = GetAutomationPatternKey(typeof(P)); return (P)ae.GetCurrentPattern(key); } public static P TryPattern<P>(this AutomationElement ae) where P : BasePattern { AutomationPattern key = GetAutomationPatternKey(typeof(P)); if (ae.GetSupportedPatterns().Contains(key)) return (P)ae.GetCurrentPattern(key); return null; } private static AutomationPattern GetAutomationPatternKey(Type patternType) { AutomationPattern key = patterns.GetOrCreate(patternType, () => (AutomationPattern)patternType.GetField("Pattern", BindingFlags.Static | BindingFlags.Public).GetValue(null)); return key; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Automation; using System.Reflection; using Signum.Utilities; namespace Signum.Windows.UIAutomation { public static class PatternExtensions { static readonly Dictionary<Type, AutomationPattern> patterns = new Dictionary<Type, AutomationPattern>(); public static P Pattern<P>(this AutomationElement ae) where P : BasePattern { AutomationPattern key = GetAutomationPatternKey(typeof(P)); var result = (P)ae.GetCurrentPattern(key); if (result == null) throw new InvalidOperationException("AutomationElement {0} does not implement pattern {1}".FormatWith(ae, typeof(P).Name)); return result; } public static P TryPattern<P>(this AutomationElement ae) where P : BasePattern { AutomationPattern key = GetAutomationPatternKey(typeof(P)); return (P)ae.GetCurrentPattern(key); } private static AutomationPattern GetAutomationPatternKey(Type patternType) { AutomationPattern key = patterns.GetOrCreate(patternType, () => (AutomationPattern)patternType.GetField("Pattern", BindingFlags.Static | BindingFlags.Public).GetValue(null)); return key; } } }
mit
C#
92587a1c130d7cbfd98dc99e602dd03fbbd7e377
Add Tasks.CompleteTask directive to converter
timheuer/alexa-skills-dotnet,stoiveyp/alexa-skills-dotnet
Alexa.NET/Response/Converters/DirectiveConverter.cs
Alexa.NET/Response/Converters/DirectiveConverter.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using Alexa.NET.Response.Directive; using Newtonsoft.Json.Linq; namespace Alexa.NET.Response.Converters { public class DirectiveConverter : JsonConverter { public override bool CanRead => true; public override bool CanWrite => false; public static Dictionary<string, Func<IDirective>> TypeFactories = new Dictionary<string, Func<IDirective>> { { "AudioPlayer.Play", () => new AudioPlayerPlayDirective() }, { "AudioPlayer.ClearQueue", () => new ClearQueueDirective() }, { "Dialog.ConfirmIntent", () => new DialogConfirmIntent() }, { "Dialog.ConfirmSlot", () => new DialogConfirmSlot() }, { "Dialog.Delegate", () => new DialogDelegate() }, { "Dialog.ElicitSlot", () => new DialogElicitSlot() }, { "Display.RenderTemplate", () => new DisplayRenderTemplateDirective() }, { "Hint", () => new HintDirective() }, { "AudioPlayer.Stop", () => new StopDirective() }, { "VideoApp.Launch", () => new VideoAppDirective() }, { "Connections.StartConnection", () => new StartConnectionDirective() }, { "Tasks.CompleteTask",() => new CompleteTaskDirective()} }; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotImplementedException(); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jsonObject = JObject.Load(reader); var typeKey = jsonObject["type"] ?? jsonObject["Type"]; var typeValue = typeKey.Value<string>(); var hasFactory = TypeFactories.ContainsKey(typeValue); if (!hasFactory) throw new Exception( $"unable to deserialize response. " + $"unrecognized directive type '{typeValue}'" ); var directive = TypeFactories[typeValue](); serializer.Populate(jsonObject.CreateReader(), directive); return directive; } public override bool CanConvert(Type objectType) { return objectType == typeof(IDirective); } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using Alexa.NET.Response.Directive; using Newtonsoft.Json.Linq; namespace Alexa.NET.Response.Converters { public class DirectiveConverter : JsonConverter { public override bool CanRead => true; public override bool CanWrite => false; public static Dictionary<string, Func<IDirective>> TypeFactories = new Dictionary<string, Func<IDirective>> { { "AudioPlayer.Play", () => new AudioPlayerPlayDirective() }, { "AudioPlayer.ClearQueue", () => new ClearQueueDirective() }, { "Dialog.ConfirmIntent", () => new DialogConfirmIntent() }, { "Dialog.ConfirmSlot", () => new DialogConfirmSlot() }, { "Dialog.Delegate", () => new DialogDelegate() }, { "Dialog.ElicitSlot", () => new DialogElicitSlot() }, { "Display.RenderTemplate", () => new DisplayRenderTemplateDirective() }, { "Hint", () => new HintDirective() }, { "AudioPlayer.Stop", () => new StopDirective() }, { "VideoApp.Launch", () => new VideoAppDirective() }, { "Connections.StartConnection", () => new StartConnectionDirective() } }; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotImplementedException(); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jsonObject = JObject.Load(reader); var typeKey = jsonObject["type"] ?? jsonObject["Type"]; var typeValue = typeKey.Value<string>(); var hasFactory = TypeFactories.ContainsKey(typeValue); if (!hasFactory) throw new Exception( $"unable to deserialize response. " + $"unrecognized directive type '{typeValue}'" ); var directive = TypeFactories[typeValue](); serializer.Populate(jsonObject.CreateReader(), directive); return directive; } public override bool CanConvert(Type objectType) { return objectType == typeof(IDirective); } } }
mit
C#
1768869aaa244322a545cd0f9dea5a5972634fef
バージョン番号を 0.92 に上げました。
omachi/SS5PlayerForUnity,SpriteStudio/SS5PlayerForUnity
Assets/Editor/SpriteStudio/MenuItem_SpriteStudio.cs
Assets/Editor/SpriteStudio/MenuItem_SpriteStudio.cs
/** SpriteStudio5 Player for Unity Copyright(C) 2003-2013 Web Technology Corp. All rights reserved. */ using UnityEngine; using UnityEditor; public sealed class MenuItem_SpriteStudio : EditorWindow { public float CollisionThicknessZ = 1.0f; public bool FlagAttachRigidBody = true; [MenuItem("Custom/SpriteStudio/Import SS5(sspj)")] static void OpenWindow() { EditorWindow.GetWindow<MenuItem_SpriteStudio>(true, "OPTPiX SpriteStudio Import-Settings"); } void OnGUI() { CollisionThicknessZ = EditorGUILayout.FloatField("Collider-Thickness", CollisionThicknessZ); EditorGUILayout.LabelField(" (Local Z-Axis Width)"); EditorGUILayout.Space(); FlagAttachRigidBody = EditorGUILayout.Toggle("Attach Rigid-Body", FlagAttachRigidBody); EditorGUILayout.LabelField(" to Collider"); EditorGUILayout.Space(); EditorGUILayout.Space(); if(true == GUILayout.Button("Import")) { LibraryEditor_SpriteStudio.SettingImport SettingImport; SettingImport.TextureSizePixelMaximum = 4096; SettingImport.CollisionThicknessZ = CollisionThicknessZ; SettingImport.FlagAttachRigidBody = FlagAttachRigidBody; LibraryEditor_SpriteStudio.Menu.ImportSSPJ(SettingImport); Close(); } } [MenuItem("Custom/SpriteStudio/About")] static void About() { string VersionText = "0.92 (Beta)"; EditorUtility.DisplayDialog( "SpriteStudio5 Player for Unity", "Version: " + VersionText + "\n\n" + "Copyright(C) 2013 Web Technology Corp.", "OK" ); } }
/** SpriteStudio5 Player for Unity Copyright(C) 2003-2013 Web Technology Corp. All rights reserved. */ using UnityEngine; using UnityEditor; public sealed class MenuItem_SpriteStudio : EditorWindow { public float CollisionThicknessZ = 1.0f; public bool FlagAttachRigidBody = true; [MenuItem("Custom/SpriteStudio/Import SS5(sspj)")] static void OpenWindow() { EditorWindow.GetWindow<MenuItem_SpriteStudio>(true, "OPTPiX SpriteStudio Import-Settings"); } void OnGUI() { CollisionThicknessZ = EditorGUILayout.FloatField("Collider-Thickness", CollisionThicknessZ); EditorGUILayout.LabelField(" (Local Z-Axis Width)"); EditorGUILayout.Space(); FlagAttachRigidBody = EditorGUILayout.Toggle("Attach Rigid-Body", FlagAttachRigidBody); EditorGUILayout.LabelField(" to Collider"); EditorGUILayout.Space(); EditorGUILayout.Space(); if(true == GUILayout.Button("Import")) { LibraryEditor_SpriteStudio.SettingImport SettingImport; SettingImport.TextureSizePixelMaximum = 4096; SettingImport.CollisionThicknessZ = CollisionThicknessZ; SettingImport.FlagAttachRigidBody = FlagAttachRigidBody; LibraryEditor_SpriteStudio.Menu.ImportSSPJ(SettingImport); Close(); } } [MenuItem("Custom/SpriteStudio/About")] static void About() { string VersionText = "0.91 (Beta)"; EditorUtility.DisplayDialog( "SpriteStudio5 Player for Unity", "Version: " + VersionText + "\n\n" + "Copyright(C) 2013 Web Technology Corp.", "OK" ); } }
mit
C#
2c229934dcb23a6cf47347409808a627fef9abf4
Fix some labels from Weeks Index
morarj/ACStalkMarket,morarj/ACStalkMarket,morarj/ACStalkMarket
ACStalkMarket/ACStalkMarket/Views/Weeks/Index.cshtml
ACStalkMarket/ACStalkMarket/Views/Weeks/Index.cshtml
 @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } <h2>Resumen de Semanas</h2> @Html.ActionLink("Nueva Semana", "New", "Weeks", new { @class = "btn btn-primary" }) <table id="weeks" class="table table-bordered table-hover"> <thead> <tr> <th>Fecha de Inicio</th> <th>Fecha de Venta</th> <th>Patrón</th> <th>Estado</th> <th>Eliminar</th> </tr> </thead> <tbody></tbody> </table>
 @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } <h2>Index</h2> @Html.ActionLink("Add Week", "New", "Weeks", new { @class = "btn btn-primary" }) <table id="weeks" class="table table-bordered table-hover"> <thead> <tr> <th>Fecha de Inicio</th> <th>Fecha de Venta</th> <th>Patrón</th> <th>Estado</th> <th>Eliminar</th> </tr> </thead> <tbody></tbody> </table>
mit
C#
21f4f9146143e002164192252563a87caee2682c
Use pre-release version while API is still fluid
sgryphon/ionfar-sharepoint-provisioning
src/IonFar.SharePoint.Provisioning/Properties/AssemblyInfo.cs
src/IonFar.SharePoint.Provisioning/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("IonFar.SharePoint.Provisioning")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IonFar.SharePoint.Provisioning")] [assembly: AssemblyCopyright("Copyright © Jack Watts 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("2f0da7e0-83e6-49c7-adcb-e898ba9bec28")] // 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.0.0")] [assembly: AssemblyVersion("0.2.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.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("IonFar.SharePoint.Provisioning")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IonFar.SharePoint.Provisioning")] [assembly: AssemblyCopyright("Copyright © Jack Watts 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("2f0da7e0-83e6-49c7-adcb-e898ba9bec28")] // 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.0.0")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.0")]
mit
C#
9875c9ea4847a55d37b8192d97d71e0fc5602a8b
use Kirkin.Linq.Expressions
KirillShlenskiy/Kirkin,KirillShlenskiy/Kirkin,KirillShlenskiy/Kirkin
src/Kirkin.Experimental/ValueConversion/ValueConverterBase.cs
src/Kirkin.Experimental/ValueConversion/ValueConverterBase.cs
using System; using System.Collections.Concurrent; using System.Linq.Expressions; using System.Reflection; using Kirkin.Linq.Expressions; namespace Kirkin.ValueConversion { /// <summary> /// Base class for types which perform value conversions from one type to another. /// </summary> public abstract class ValueConverterBase { #region Public methods /// <summary> /// Converts the value to the given type. /// </summary> public abstract T Convert<T>(object value); /// <summary> /// Converts the value to the given type. /// </summary> public object Convert(object value, Type type) { return ResolveConvertDelegate(type)(value); } #endregion #region Conversion delegate resolution private readonly ConcurrentDictionary<Type, Func<object, object>> ConvertDelegatesByReturnType = new ConcurrentDictionary<Type, Func<object, object>>(); private Func<object, object> ResolveConvertDelegate(Type type) { Func<object, object> func; return ConvertDelegatesByReturnType.TryGetValue(type, out func) ? func : ResolveConvertDelegateSlow(type); } private Func<object, object> ResolveConvertDelegateSlow(Type type) { MethodInfo interpretMethod = ExpressionUtil.InstanceMethod<ValueConverter>(vc => vc.Convert<int>(null)); // Lambda expression: // (object value) => (object)this.Convert<T>(value); ParameterExpression valueExpr = Expression.Parameter(typeof(object), "value"); Expression body = Expression.Convert( Expression.Call(Expression.Constant(this, GetType()), interpretMethod, valueExpr), typeof(object) ); Func<object, object> func = Expression .Lambda<Func<object, object>>(body, valueExpr) .Compile(); return ConvertDelegatesByReturnType.GetOrAdd(type, func); } #endregion } }
using System; using System.Collections.Concurrent; using System.Linq.Expressions; using System.Reflection; namespace Kirkin.ValueConversion { /// <summary> /// Base class for types which perform value conversions from one type to another. /// </summary> public abstract class ValueConverterBase { #region Public methods /// <summary> /// Converts the value to the given type. /// </summary> public abstract T Convert<T>(object value); /// <summary> /// Converts the value to the given type. /// </summary> public object Convert(object value, Type type) { return ResolveConvertDelegate(type)(value); } #endregion #region Conversion delegate resolution private readonly ConcurrentDictionary<Type, Func<object, object>> ConvertDelegatesByReturnType = new ConcurrentDictionary<Type, Func<object, object>>(); private Func<object, object> ResolveConvertDelegate(Type type) { Func<object, object> func; return ConvertDelegatesByReturnType.TryGetValue(type, out func) ? func : ResolveConvertDelegateSlow(type); } private Func<object, object> ResolveConvertDelegateSlow(Type type) { MethodInfo interpretMethod = InstanceMethod<ValueConverter>(vc => vc.Convert<int>(null)); // Lambda expression: // (object value) => (object)this.Convert<T>(value); ParameterExpression valueExpr = Expression.Parameter(typeof(object), "value"); Expression body = Expression.Convert( Expression.Call(Expression.Constant(this, GetType()), interpretMethod, valueExpr), typeof(object) ); Func<object, object> func = Expression .Lambda<Func<object, object>>(body, valueExpr) .Compile(); return ConvertDelegatesByReturnType.GetOrAdd(type, func); } private static MethodInfo InstanceMethod<T>(Expression<Action<T>> methodCall) { MethodCallExpression call = methodCall.Body as MethodCallExpression; if (call == null) { throw new InvalidOperationException($"The given expression is not a {nameof(MethodCallExpression)}"); } return call.Method; } #endregion } }
mit
C#
29e5a7090f4261eab445a6aca0e44b06c13693d2
Add missing copyright header
marono/cli,jonsequitur/cli,jaredpar/cli,jkotas/cli,johnbeisner/cli,MichaelSimons/cli,AbhitejJohn/cli,krwq/cli,mlorbetske/cli,stuartleeks/dotnet-cli,borgdylan/dotnet-cli,jonsequitur/cli,dasMulli/cli,nguerrera/cli,EdwardBlair/cli,stuartleeks/dotnet-cli,schellap/cli,dasMulli/cli,weshaggard/cli,gkhanna79/cli,mlorbetske/cli,nguerrera/cli,borgdylan/dotnet-cli,jkotas/cli,gkhanna79/cli,schellap/cli,schellap/cli,marono/cli,gkhanna79/cli,FubarDevelopment/cli,MichaelSimons/cli,mylibero/cli,jkotas/cli,harshjain2/cli,jaredpar/cli,nguerrera/cli,dasMulli/cli,gkhanna79/cli,blackdwarf/cli,MichaelSimons/cli,marono/cli,jkotas/cli,danquirk/cli,danquirk/cli,JohnChen0/cli,svick/cli,svick/cli,borgdylan/dotnet-cli,krwq/cli,danquirk/cli,naamunds/cli,borgdylan/dotnet-cli,mlorbetske/cli,naamunds/cli,stuartleeks/dotnet-cli,JohnChen0/cli,JohnChen0/cli,anurse/Cli,AbhitejJohn/cli,krwq/cli,danquirk/cli,livarcocc/cli-1,schellap/cli,EdwardBlair/cli,livarcocc/cli-1,borgdylan/dotnet-cli,ravimeda/cli,jaredpar/cli,Faizan2304/cli,MichaelSimons/cli,schellap/cli,johnbeisner/cli,krwq/cli,jonsequitur/cli,weshaggard/cli,Faizan2304/cli,FubarDevelopment/cli,blackdwarf/cli,svick/cli,mlorbetske/cli,jaredpar/cli,gkhanna79/cli,danquirk/cli,harshjain2/cli,marono/cli,blackdwarf/cli,marono/cli,blackdwarf/cli,weshaggard/cli,mylibero/cli,jaredpar/cli,mylibero/cli,schellap/cli,naamunds/cli,mylibero/cli,ravimeda/cli,FubarDevelopment/cli,MichaelSimons/cli,naamunds/cli,jkotas/cli,AbhitejJohn/cli,mylibero/cli,harshjain2/cli,naamunds/cli,JohnChen0/cli,ravimeda/cli,Faizan2304/cli,jonsequitur/cli,weshaggard/cli,stuartleeks/dotnet-cli,AbhitejJohn/cli,FubarDevelopment/cli,weshaggard/cli,stuartleeks/dotnet-cli,nguerrera/cli,krwq/cli,jaredpar/cli,johnbeisner/cli,EdwardBlair/cli,livarcocc/cli-1
src/Microsoft.DotNet.Tools.Pack/NuGet/ManifestContentFiles.cs
src/Microsoft.DotNet.Tools.Pack/NuGet/ManifestContentFiles.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.Xml.Serialization; namespace NuGet { public class ManifestContentFiles { public string Include { get; set; } public string Exclude { get; set; } public string BuildAction { get; set; } public string CopyToOutput { get; set; } public string Flatten { get; set; } } }
using System.Xml.Serialization; namespace NuGet { public class ManifestContentFiles { public string Include { get; set; } public string Exclude { get; set; } public string BuildAction { get; set; } public string CopyToOutput { get; set; } public string Flatten { get; set; } } }
mit
C#
097788f672e65e9c83d005a3029a3193d8f5faef
Add action type for status
grantcolley/dipstate
DevelopmentInProgress.DipState/DipStateActionType.cs
DevelopmentInProgress.DipState/DipStateActionType.cs
using System.Xml.Serialization; namespace DevelopmentInProgress.DipState { public enum DipStateActionType { [XmlEnum("1")] Status, [XmlEnum("2")] Entry, [XmlEnum("3")] Exit } }
using System.Xml.Serialization; namespace DevelopmentInProgress.DipState { public enum DipStateActionType { [XmlEnum("1")] Entry, [XmlEnum("2")] Exit } }
apache-2.0
C#
9f3b0aeec44998ca18fa38567ac4d7d41fbcb6a2
Work on students overview - #10.
henkmollema/StudentFollowingSystem,henkmollema/StudentFollowingSystem
src/StudentFollowingSystem/Views/Students/List.cshtml
src/StudentFollowingSystem/Views/Students/List.cshtml
@model IEnumerable<StudentFollowingSystem.ViewModels.StudentModel> @{ ViewBag.Title = "Studenten"; } <h2>Studenten</h2> <p> @Html.ActionLink("Nieuwe student toevoegen", "Add") </p> <table class="table"> <tr> <th> Studentnummer </th> <th> Voornaam </th> <th> Achternaam </th> <th> E-mailadres </th> <th> Status </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @item.Id </td> <td> @item.FirstName </td> <td> @item.LastName </td> <td> @item.Email </td> <td> @item.Status </td> <td> @Html.ActionLink("Wijzigen", "Edit", new { id = item.Id }) | @*@Html.ActionLink("Details", "Details", new { id = item.Id }) |*@ @Html.ActionLink("Verwijderen", "Delete", new { id = item.Id }) </td> </tr> } </table>
@model IEnumerable<StudentFollowingSystem.ViewModels.StudentModel> @{ ViewBag.Title = "Studenten"; } <h2>Studenten</h2> <p> @Html.ActionLink("Nieuwe student toevoegen", "Add") </p> <table class="table"> <tr> <th> @Html.DisplayNameFor(model => model.StudentNr) </th> <th> @Html.DisplayNameFor(model => model.FirstName) </th> <th> @Html.DisplayNameFor(model => model.LastName) </th> <th> @Html.DisplayNameFor(model => model.Email) </th> <th> @Html.DisplayNameFor(model => model.Status) </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.StudentNr) </td> <td> @Html.DisplayFor(modelItem => item.FirstName) </td> <td> @Html.DisplayFor(modelItem => item.LastName) </td> <td> @Html.DisplayFor(modelItem => item.Email) </td> <td> @Html.DisplayFor(modelItem => item.Status) </td> <td> @Html.ActionLink("Wijzigen", "Edit", new { id = item.Id }) | @*@Html.ActionLink("Details", "Details", new { id = item.Id }) |*@ @Html.ActionLink("Verwijderen", "Delete", new { id = item.Id }) </td> </tr> } </table>
mit
C#
f4ce2d5fa96f77266f409766246ed5ae4efe2b8d
Update CosmosTableExtensions.cs
tiksn/TIKSN-Framework
TIKSN.Core/Data/CosmosTable/CosmosTableExtensions.cs
TIKSN.Core/Data/CosmosTable/CosmosTableExtensions.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Table; namespace TIKSN.Data.CosmosTable { public static class CosmosTableExtensions { public static Task<IEnumerable<T>> RetrieveAllAsync<T>(this ICosmosTableQueryRepository<T> repository, CancellationToken cancellationToken) where T : ITableEntity { if (repository == null) { throw new ArgumentNullException(nameof(repository)); } var filters = new Dictionary<string, object>(); return repository.SearchAsync(filters, cancellationToken); } public static Task<IEnumerable<T>> SearchAsync<T>(this ICosmosTableQueryRepository<T> repository, string fieldName, object givenValue, CancellationToken cancellationToken) where T : ITableEntity { if (repository == null) { throw new ArgumentNullException(nameof(repository)); } var filters = new Dictionary<string, object>(); filters.Add(fieldName, givenValue); return repository.SearchAsync(filters, cancellationToken); } } }
using Microsoft.Azure.Cosmos.Table; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace TIKSN.Data.CosmosTable { public static class CosmosTableExtensions { public static Task<IEnumerable<T>> RetrieveAllAsync<T>(this ICosmosTableQueryRepository<T> repository, CancellationToken cancellationToken) where T : ITableEntity { if (repository == null) throw new System.ArgumentNullException(nameof(repository)); var filters = new Dictionary<string, object>(); return repository.SearchAsync(filters, cancellationToken); } public static Task<IEnumerable<T>> SearchAsync<T>(this ICosmosTableQueryRepository<T> repository, string fieldName, object givenValue, CancellationToken cancellationToken) where T : ITableEntity { if (repository == null) throw new System.ArgumentNullException(nameof(repository)); var filters = new Dictionary<string, object>(); filters.Add(fieldName, givenValue); return repository.SearchAsync(filters, cancellationToken); } } }
mit
C#
b5b49a401957adbf95e9fbe6eca78ea720341345
Update IconViewRenderer.cs
andreinitescu/IconApp
IconApp/IconApp.Droid/Renderers/IconViewRenderer.cs
IconApp/IconApp.Droid/Renderers/IconViewRenderer.cs
using System; using Xamarin.Forms.Platform.Android; using Android.Widget; using System.ComponentModel; using IconApp; using Xamarin.Forms; using IconApp.Droid.Renderers; using Android.Graphics; using Android.Graphics.Drawables; [assembly: ExportRendererAttribute(typeof(IconView), typeof(IconViewRenderer))] namespace IconApp.Droid.Renderers { public class IconViewRenderer : ViewRenderer<IconView, ImageView> { private bool _isDisposed; public IconViewRenderer() { base.AutoPackage = false; } protected override void Dispose(bool disposing) { if (_isDisposed) { return; } _isDisposed = true; base.Dispose(disposing); } protected override void OnElementChanged(ElementChangedEventArgs<IconView> e) { base.OnElementChanged(e); if (e.OldElement == null) { SetNativeControl(new ImageView(Context)); } UpdateBitmap(e.OldElement); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == IconView.SourceProperty.PropertyName) { UpdateBitmap(null); } else if (e.PropertyName == IconView.ForegroundProperty.PropertyName) { UpdateBitmap(null); } } private void UpdateBitmap(IconView previous = null) { if (!_isDisposed) { var d = Resources.GetDrawable(Element.Source).Mutate(); d.SetColorFilter(new LightingColorFilter(Element.Foreground.ToAndroid(), Element.Foreground.ToAndroid())); d.Alpha = Element.Foreground.ToAndroid().A; Control.SetImageDrawable(d); ((IVisualElementController)Element).NativeSizeChanged(); } } } }
using System; using Xamarin.Forms.Platform.Android; using Android.Widget; using System.ComponentModel; using IconApp; using Xamarin.Forms; using IconApp.Droid.Renderers; using Android.Graphics; using Android.Graphics.Drawables; [assembly: ExportRendererAttribute(typeof(IconView), typeof(IconViewRenderer))] namespace IconApp.Droid.Renderers { public class IconViewRenderer : ViewRenderer<IconView, ImageView> { private bool _isDisposed; public IconViewRenderer() { base.AutoPackage = false; } protected override void Dispose(bool disposing) { if (_isDisposed) { return; } _isDisposed = true; base.Dispose(disposing); } protected override void OnElementChanged(ElementChangedEventArgs<IconView> e) { base.OnElementChanged(e); if (e.OldElement == null) { SetNativeControl(new ImageView(Context)); } UpdateBitmap(e.OldElement); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == IconView.SourceProperty.PropertyName) { UpdateBitmap(null); } else if (e.PropertyName == IconView.ForegroundProperty.PropertyName) { UpdateBitmap(null); } } private void UpdateBitmap(IconView previous = null) { if (!_isDisposed) { var d = Resources.GetDrawable(Element.Source).Mutate(); d.SetColorFilter(new LightingColorFilter(Element.Foreground.ToAndroid(), Element.Foreground.ToAndroid())); Control.SetImageDrawable(d); ((IVisualElementController)Element).NativeSizeChanged(); } } } }
unlicense
C#
042730b116687edf879ff49425fd57560cdb37a0
Remove Add Printer page dialog from SyncingPrinter conclusion
mmoening/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,mmoening/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl
MatterControlLib/SetupWizard/SyncingPrintersPage.cs
MatterControlLib/SetupWizard/SyncingPrintersPage.cs
using MatterHackers.Localizations; using MatterHackers.Agg.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.PrinterControls.PrinterConnections; using MatterHackers.Agg; namespace MatterHackers.MatterControl.SetupWizard { public class SyncingPrintersPage: DialogPage { TextWidget syncingDetails; public SyncingPrintersPage() : base("Close".Localize()) { this.WindowTitle = "Sync Printer Profiles Page".Localize(); TextWidget syncingText = new TextWidget("Syncing Profiles...".Localize(),textColor: ActiveTheme.Instance.PrimaryTextColor); syncingDetails = new TextWidget("Retrieving sync information...".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize:10); syncingDetails.AutoExpandBoundsToText = true; contentRow.AddChild(syncingText); contentRow.AddChild(syncingDetails); Progress<ProgressStatus> progress = new Progress<ProgressStatus>(ReportProgress); ApplicationController.SyncPrinterProfiles("SyncingPrintersPage.ctor()", progress).ContinueWith((task) => { if (ProfileManager.Instance.ActiveProfiles.Count() == 1) { // TODO: Investigate what this was doing and re-implement //ActiveSliceSettings.ShowComPortConnectionHelp(); //Set as active printer ProfileManager.SwitchToProfile(ProfileManager.Instance.ActiveProfiles.First().ID).ConfigureAwait(false); // only close the window if we are not switching to the setup printer form UiThread.RunOnIdle(DialogWindow.Close); } else // multiple printers - close the window { UiThread.RunOnIdle(DialogWindow.Close); } }); } private void ReportProgress(ProgressStatus report) { syncingDetails.Text = report.Status; } } }
using MatterHackers.Localizations; using MatterHackers.Agg.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.PrinterControls.PrinterConnections; using MatterHackers.Agg; namespace MatterHackers.MatterControl.SetupWizard { public class SyncingPrintersPage: DialogPage { TextWidget syncingDetails; public SyncingPrintersPage() : base("Close".Localize()) { this.WindowTitle = "Sync Printer Profiles Page".Localize(); TextWidget syncingText = new TextWidget("Syncing Profiles...".Localize(),textColor: ActiveTheme.Instance.PrimaryTextColor); syncingDetails = new TextWidget("Retrieving sync information...".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize:10); syncingDetails.AutoExpandBoundsToText = true; contentRow.AddChild(syncingText); contentRow.AddChild(syncingDetails); Progress<ProgressStatus> progress = new Progress<ProgressStatus>(ReportProgress); ApplicationController.SyncPrinterProfiles("SyncingPrintersPage.ctor()", progress).ContinueWith((task) => { if (!ProfileManager.Instance.ActiveProfiles.Any()) { // Switch to setup wizard if no profiles exist UiThread.RunOnIdle(() => { this.DialogWindow.ChangeToPage(PrinterSetup.GetBestStartPage()); }); } else if (ProfileManager.Instance.ActiveProfiles.Count() == 1) { // TODO: Investigate what this was doing and re-implement //ActiveSliceSettings.ShowComPortConnectionHelp(); //Set as active printer ProfileManager.SwitchToProfile(ProfileManager.Instance.ActiveProfiles.First().ID).ConfigureAwait(false); // only close the window if we are not switching to the setup printer form UiThread.RunOnIdle(DialogWindow.Close); } else // multiple printers - close the window { UiThread.RunOnIdle(DialogWindow.Close); } }); } private void ReportProgress(ProgressStatus report) { syncingDetails.Text = report.Status; } } }
bsd-2-clause
C#
c7026d735896d5b2b2176a710123021cbf8768dd
Test target framework written as expected (characterise current lack of validation)
BenPhegan/NuGet.Extensions
NuGet.Extensions.Tests/Nuspec/NuspecBuilderTests.cs
NuGet.Extensions.Tests/Nuspec/NuspecBuilderTests.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Moq; using NuGet.Common; using NuGet.Extensions.Nuspec; using NuGet.Extensions.Tests.MSBuild; using NUnit.Framework; namespace NuGet.Extensions.Tests.Nuspec { [TestFixture] public class NuspecBuilderTests { [Test] public void AssemblyNameReplacesNullDescription() { var console = new Mock<IConsole>(); const string anyAssemblyName = "any.assembly.name"; var nullDataSource = new Mock<INuspecDataSource>().Object; var nuspecBuilder = new NuspecBuilder(anyAssemblyName); nuspecBuilder.SetMetadata(nullDataSource, new List<ManifestDependency>()); nuspecBuilder.Save(console.Object); var nuspecContents = File.ReadAllText(nuspecBuilder.FilePath); Assert.That(nuspecContents, Contains.Substring("<description>" + anyAssemblyName + "</description>")); ConsoleMock.AssertConsoleHasNoErrorsOrWarnings(console); } [TestCase("net40")] [TestCase("net35")] [TestCase("notARealTargetFramework", Description = "Characterisation: There is no validation on the target framework")] public void TargetFrameworkAppearsVerbatimInOutput(string targetFramework) { var console = new Mock<IConsole>(); var nuspecBuilder = new NuspecBuilder("anyAssemblyName"); var anyDependencies = new List<ManifestDependency>{new ManifestDependency {Id="anyDependency", Version = "0.0.0.0"}}; nuspecBuilder.SetDependencies(anyDependencies, targetFramework); nuspecBuilder.Save(console.Object); var nuspecContents = File.ReadAllText(nuspecBuilder.FilePath); var expectedAssemblyGroupStartTag = string.Format("<group targetFramework=\"{0}\">", targetFramework); Assert.That(nuspecContents, Contains.Substring(expectedAssemblyGroupStartTag)); ConsoleMock.AssertConsoleHasNoErrorsOrWarnings(console); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Moq; using NuGet.Common; using NuGet.Extensions.Nuspec; using NUnit.Framework; namespace NuGet.Extensions.Tests.Nuspec { [TestFixture] public class NuspecBuilderTests { [Test] public void AssemblyNameReplacesNullDescription() { var console = new Mock<IConsole>(); const string anyAssemblyName = "any.assembly.name"; var nullDataSource = new Mock<INuspecDataSource>().Object; var nuspecBuilder = new NuspecBuilder(anyAssemblyName); nuspecBuilder.SetMetadata(nullDataSource, new List<ManifestDependency>()); nuspecBuilder.Save(console.Object); var nuspecContents = File.ReadAllText(nuspecBuilder.FilePath); Assert.That(nuspecContents, Contains.Substring("<description>" + anyAssemblyName + "</description>")); } } }
mit
C#
4bdd9d58f3303c33cada2a467f3ead7a6714238d
Fix bug in fixture with unescaped underscore in username
AndyDingo/telegram.bot,MrRoundRobin/telegram.bot,TelegramBots/telegram.bot
test/Telegram.Bot.Tests.Integ/Framework/Extensions.cs
test/Telegram.Bot.Tests.Integ/Framework/Extensions.cs
using System; using System.Linq; using Telegram.Bot.Types; using Telegram.Bot.Types.Enums; namespace Telegram.Bot.Tests.Integ.Framework { internal static class Extensions { public static User GetUser(this Update update) { switch (update.Type) { case UpdateType.Message: return update.Message.From; case UpdateType.InlineQuery: return update.InlineQuery.From; case UpdateType.CallbackQuery: return update.CallbackQuery.From; case UpdateType.PreCheckoutQuery: return update.PreCheckoutQuery.From; case UpdateType.ShippingQuery: return update.ShippingQuery.From; case UpdateType.ChosenInlineResult: return update.ChosenInlineResult.From; default: throw new ArgumentException("Unsupported update type {0}.", update.Type.ToString()); } } public static string GetTesterMentions(this UpdateReceiver updateReceiver) { return string.Join(", ", updateReceiver.AllowedUsernames.Select(username => $"@{username}".Replace("_", "\\_")) ); } } }
using System; using System.Linq; using Telegram.Bot.Types; using Telegram.Bot.Types.Enums; namespace Telegram.Bot.Tests.Integ.Framework { internal static class Extensions { public static User GetUser(this Update update) { switch (update.Type) { case UpdateType.Message: return update.Message.From; case UpdateType.InlineQuery: return update.InlineQuery.From; case UpdateType.CallbackQuery: return update.CallbackQuery.From; case UpdateType.PreCheckoutQuery: return update.PreCheckoutQuery.From; case UpdateType.ShippingQuery: return update.ShippingQuery.From; case UpdateType.ChosenInlineResult: return update.ChosenInlineResult.From; default: throw new ArgumentException("Unsupported update type {0}.", update.Type.ToString()); } } public static string GetTesterMentions(this UpdateReceiver updateReceiver) { return string.Join(", ", updateReceiver.AllowedUsernames.Select(username => '@' + username) ); } } }
mit
C#
5e337f9ddb56b5f49e38cd60d4eea1ef23317728
Improve network game object detection codes
insthync/unity-utilities
Assets/UnityUtilities/Scripts/Misc/UnityUtils.cs
Assets/UnityUtilities/Scripts/Misc/UnityUtils.cs
using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Networking; public static class UnityUtils { public static bool IsAnyKeyUp(KeyCode[] keys) { foreach (KeyCode key in keys) { if (Input.GetKeyUp(key)) return true; } return false; } public static bool IsAnyKeyDown(KeyCode[] keys) { foreach (KeyCode key in keys) { if (Input.GetKeyDown(key)) return true; } return false; } public static bool IsAnyKey(KeyCode[] keys) { foreach (KeyCode key in keys) { if (Input.GetKey(key)) return true; } return false; } public static bool IsHeadless() { return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null; } public static bool TryGetGameObjectByNetId(NetworkInstanceId targetNetId, out GameObject output) { output = null; if (NetworkServer.active) output = NetworkServer.FindLocalObject(targetNetId); else output = ClientScene.FindLocalObject(targetNetId); if (output == null) return false; return true; } public static bool TryGetComponentByNetId<T>(NetworkInstanceId targetNetId, out T output) where T : Component { output = null; GameObject foundObject = null; if (TryGetGameObjectByNetId(targetNetId, out foundObject)) { output = foundObject.GetComponent<T>(); if (output == null) return false; return true; } return false; } }
using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Networking; public static class UnityUtils { public static bool IsAnyKeyUp(KeyCode[] keys) { foreach (KeyCode key in keys) { if (Input.GetKeyUp(key)) return true; } return false; } public static bool IsAnyKeyDown(KeyCode[] keys) { foreach (KeyCode key in keys) { if (Input.GetKeyDown(key)) return true; } return false; } public static bool IsAnyKey(KeyCode[] keys) { foreach (KeyCode key in keys) { if (Input.GetKey(key)) return true; } return false; } public static bool IsHeadless() { return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null; } public static bool TryGetByNetId<T>(NetworkInstanceId targetNetId, out T output) where T : Component { output = null; GameObject foundObject = ClientScene.FindLocalObject(targetNetId); if (foundObject == null) return false; output = foundObject.GetComponent<T>(); if (output == null) return false; return true; } }
mit
C#
8b3e749ab3e9a3b495669ba31f34e2da1eca758e
Add missing linq namespace
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Commands/AddSUTARequest.cs
Battery-Commander.Web/Commands/AddSUTARequest.cs
using System; using System.Threading; using System.Threading.Tasks; using BatteryCommander.Web.Queries; using BatteryCommander.Web.Models; using MediatR; using System.Linq; namespace BatteryCommander.Web.Commands { public class AddSUTARequest : IRequest<int> { public int Soldier { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public String Reasoning { get; set; } public String MitigationPlan { get; set; } private class Handler : IRequestHandler<AddSUTARequest, int> { private readonly Database db; private readonly IMediator dispatcher; public Handler(Database db, IMediator dispatcher) { this.db = db; this.dispatcher = dispatcher; } public async Task<int> Handle(AddSUTARequest request, CancellationToken cancellationToken) { var current_user = await dispatcher.Send(new GetCurrentUser { }); var soldier = await db .Soldiers .Where(s => s.Id == request.Soldier) .SingleOrDefaultAsync(cancellationToken); var suta = new SUTA { SoldierId = request.Soldier, StartDate = request.StartDate, EndDate = request.EndDate, Reasoning = request.Reasoning, MitigationPlan = request.MitigationPlan }; suta.Events.Add(new SUTA.Event { Author = $"{current_user ?? soldier}", // User MAY not be logged in Message = "Created" }); db.SUTAs.Add(suta); await db.SaveChangesAsync(cancellationToken); return suta.Id; } } } }
using System; using System.Threading; using System.Threading.Tasks; using BatteryCommander.Web.Queries; using BatteryCommander.Web.Models; using MediatR; namespace BatteryCommander.Web.Commands { public class AddSUTARequest : IRequest<int> { public int Soldier { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public String Reasoning { get; set; } public String MitigationPlan { get; set; } private class Handler : IRequestHandler<AddSUTARequest, int> { private readonly Database db; private readonly IMediator dispatcher; public Handler(Database db, IMediator dispatcher) { this.db = db; this.dispatcher = dispatcher; } public async Task<int> Handle(AddSUTARequest request, CancellationToken cancellationToken) { var current_user = await dispatcher.Send(new GetCurrentUser { }); var soldier = await db .Soldiers .Where(s => s.Id == request.Soldier) .SingleOrDefaultAsync(cancellationToken); var suta = new SUTA { SoldierId = request.Soldier, StartDate = request.StartDate, EndDate = request.EndDate, Reasoning = request.Reasoning, MitigationPlan = request.MitigationPlan }; suta.Events.Add(new SUTA.Event { Author = $"{current_user ?? soldier}", // User MAY not be logged in Message = "Created" }); db.SUTAs.Add(suta); await db.SaveChangesAsync(cancellationToken); return suta.Id; } } } }
mit
C#
93faa9947dc47ef1b46d2e86df442c0b0c2b1b9a
Fix naming
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
PhotoLife/PhotoLife.Web/Models/AccountViewModels.cs
PhotoLife/PhotoLife.Web/Models/AccountViewModels.cs
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using CloudinaryDotNet; namespace PhotoLife.Models { public class LoginViewModel { [Required] [Display(Name = "Email")] [EmailAddress] public string Email { get; set; } [Required] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } public class RegisterViewModel { public RegisterViewModel() { //Configuring cloudinary account Account account = new Account( Properties.Settings.Default.CloudName, Properties.Settings.Default.CloudinaryApiKey, Properties.Settings.Default.CloudinaryApiSecret); this.Cloudinary = new Cloudinary(account); } [Required] [EmailAddress] [Display(Name = "Email")] public string Email { get; set; } [Required] [Display(Name = "Username")] [StringLength(60, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] public string UserName { get; set; } [Display(Name = "Name")] [StringLength(60, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] public string Name { get; set; } [Required] [Display(Name = "Description")] [StringLength(350, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] public string Description { get; set; } [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [DataType(DataType.Password)] [Display(Name = "Confirm password")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } public string ProfilePicUrl { get; set; } public Cloudinary Cloudinary { get; set; } } }
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using CloudinaryDotNet; namespace PhotoLife.Models { public class LoginViewModel { [Required] [Display(Name = "Email")] [EmailAddress] public string Email { get; set; } [Required] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } public class RegisterViewModel { public RegisterViewModel() { //Configuring cloudinary account Account account = new Account( Properties.Settings.Default.CloudName, Properties.Settings.Default.CloudinaryApiKey, Properties.Settings.Default.CloudinaryApiSecret); this.Cloudinary = new Cloudinary(account); } [Required] [EmailAddress] [Display(Name = "Email")] public string Email { get; set; } [Required] [Display(Name = "Name")] [StringLength(60, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] public string Name { get; set; } [Required] [Display(Name = "Name")] [StringLength(60, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] public string UserName { get; set; } [Required] [Display(Name = "Description")] [StringLength(350, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] public string Description { get; set; } [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [DataType(DataType.Password)] [Display(Name = "Confirm password")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } public string ProfilePicUrl { get; set; } public Cloudinary Cloudinary { get; set; } } }
mit
C#
c84b2546698cc9c75020e0beae35e318c604b59f
Update mod description
Simie/PrecisionEngineering
Src/PrecisionEngineering/PrecisionEngineeringMod.cs
Src/PrecisionEngineering/PrecisionEngineeringMod.cs
using ICities; namespace PrecisionEngineering { public class PrecisionEngineeringMod : IUserMod { public string Name { get { return "Precision Engineering"; } } public string Description { get { return "Build roads with precision. Hold CTRL to enable angle snapping, hold SHIFT to show more information."; } } } }
using ICities; namespace PrecisionEngineering { public class PrecisionEngineeringMod : IUserMod { public string Name { get { return "Precision Engineering"; } } public string Description { get { return "Tools for creating roads with precision. Hold SHIFT to enable more information when placing roads, hold CTRL to snap to angles."; } } } }
mit
C#
6bfbe696b4dfe2ae85ddab03f8c5c93426958040
revert back to simple delete
os2kitos/kitos,os2kitos/kitos,os2kitos/kitos,os2kitos/kitos
Tools.Test.Database/Model/Tasks/DropDatabaseTask.cs
Tools.Test.Database/Model/Tasks/DropDatabaseTask.cs
namespace Tools.Test.Database.Model.Tasks { public class DropDatabaseTask : DatabaseTask { private readonly string _connectionString; public DropDatabaseTask(string connectionString) : base(connectionString) { _connectionString = connectionString; } public override bool Execute() { System.Data.Entity.Database.Delete(_connectionString); return true; } } }
using System.Data.Entity; using Infrastructure.DataAccess; namespace Tools.Test.Database.Model.Tasks { public class DropDatabaseTask : DatabaseTask { private readonly string _connectionString; public DropDatabaseTask(string connectionString) : base(connectionString) { _connectionString = connectionString; } public override bool Execute() { System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseAlways<KitosContext>()); using (var context = CreateKitosContext()) { context.Database.Initialize(true); } return true; } } }
mpl-2.0
C#
d8045179899791f405eb1f25c1a23ea01dd68133
use merge operator.
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
using ReactiveUI; using System.Collections.ObjectModel; using System.Reactive.Linq; using DynamicData; using DynamicData.Binding; namespace WalletWasabi.Fluent.ViewModels { public class HomePageViewModel : NavBarItemViewModel { private readonly ReadOnlyObservableCollection<NavBarItemViewModel> _items; public HomePageViewModel(IScreen screen, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(screen) { Title = "Home"; var list = new SourceList<NavBarItemViewModel>(); list.Add(addWalletPage); walletManager.Items.ToObservableChangeSet() .Cast(x => x as NavBarItemViewModel) .Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i=>i.Title)) .Merge(list.Connect()) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _items) .AsObservableList(); } public override string IconName => "home_regular"; public ReadOnlyObservableCollection<NavBarItemViewModel> Items => _items; } }
using ReactiveUI; using System.Collections.ObjectModel; using System.Reactive.Linq; using DynamicData; using DynamicData.Binding; namespace WalletWasabi.Fluent.ViewModels { public class HomePageViewModel : NavBarItemViewModel { private readonly ReadOnlyObservableCollection<NavBarItemViewModel> _items; public HomePageViewModel(IScreen screen, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(screen) { Title = "Home"; var list = new SourceList<NavBarItemViewModel>(); list.Add(addWalletPage); walletManager.Items.ToObservableChangeSet() .Cast(x => x as NavBarItemViewModel) .Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i=>i.Title)) .Or(list.Connect()) .Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i => i is AddWalletPageViewModel ? 1 : 0)) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _items) .AsObservableList(); } public override string IconName => "home_regular"; public ReadOnlyObservableCollection<NavBarItemViewModel> Items => _items; } }
mit
C#
b119a0909ecf30090d8852d738d3f9b6a740964d
Change samples to use PostApplicationStart instead of pre.
shiftkey/SignalR,shiftkey/SignalR
SignalR.Hosting.AspNet.Samples/App_Start/Startup.cs
SignalR.Hosting.AspNet.Samples/App_Start/Startup.cs
using System; using System.Diagnostics; using System.Threading; using System.Web.Routing; using SignalR.Hosting.AspNet.Routing; using SignalR.Samples.App_Start; using SignalR.Samples.Hubs.DemoHub; [assembly: WebActivator.PostApplicationStartMethod(typeof(Startup), "Start")] namespace SignalR.Samples.App_Start { public class Startup { public static void Start() { ThreadPool.QueueUserWorkItem(_ => { var connection = Global.Connections.GetConnection<Streaming.Streaming>(); var demoClients = Global.Connections.GetClients<DemoHub>(); while (true) { try { connection.Broadcast(DateTime.Now.ToString()); demoClients.fromArbitraryCode(DateTime.Now.ToString()); } catch (Exception ex) { Trace.TraceError("SignalR error thrown in Streaming broadcast: {0}", ex); } Thread.Sleep(2000); } }); RouteTable.Routes.MapConnection<Raw.Raw>("raw", "raw/{*operation}"); RouteTable.Routes.MapConnection<Streaming.Streaming>("streaming", "streaming/{*operation}"); } } }
using System; using System.Diagnostics; using System.Threading; using System.Web.Routing; using SignalR.Hosting.AspNet.Routing; using SignalR.Samples.App_Start; using SignalR.Samples.Hubs.DemoHub; [assembly: WebActivator.PreApplicationStartMethod(typeof(Startup), "Start")] namespace SignalR.Samples.App_Start { public class Startup { public static void Start() { ThreadPool.QueueUserWorkItem(_ => { var connection = Global.Connections.GetConnection<Streaming.Streaming>(); var demoClients = Global.Connections.GetClients<DemoHub>(); while (true) { try { connection.Broadcast(DateTime.Now.ToString()); demoClients.fromArbitraryCode(DateTime.Now.ToString()); } catch (Exception ex) { Trace.TraceError("SignalR error thrown in Streaming broadcast: {0}", ex); } Thread.Sleep(2000); } }); RouteTable.Routes.MapConnection<Raw.Raw>("raw", "raw/{*operation}"); RouteTable.Routes.MapConnection<Streaming.Streaming>("streaming", "streaming/{*operation}"); } } }
mit
C#
319ed1bf0f3517f3e53bfefd33bf750980fcc32e
Reorder if statement
ppy/osu,peppy/osu-new,2yangk23/osu,UselessToucan/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu,DrabWeb/osu,naoey/osu,NeoAdonis/osu,DrabWeb/osu,peppy/osu,ZLima12/osu,smoogipooo/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,naoey/osu,naoey/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,2yangk23/osu,ZLima12/osu,ppy/osu,johnneijzen/osu
osu.Game/Rulesets/Scoring/ScoreStore.cs
osu.Game/Rulesets/Scoring/ScoreStore.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.IO; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IPC; using osu.Game.Rulesets.Scoring.Legacy; namespace osu.Game.Rulesets.Scoring { public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles { private readonly BeatmapManager beatmaps; private readonly RulesetStore rulesets; private const string replay_folder = @"replays"; public event Action<Score> ScoreImported; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) { this.beatmaps = beatmaps; this.rulesets = rulesets; if (importHost != null) ipc = new ScoreIPCChannel(importHost, this); } public string[] HandledExtensions => new[] { ".osr" }; public void Import(params string[] paths) { foreach (var path in paths) { var score = ReadReplayFile(path); if (score != null) ScoreImported?.Invoke(score); } } public Score ReadReplayFile(string replayFilename) { if (File.Exists(replayFilename)) { using (var stream = File.OpenRead(replayFilename)) return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); return null; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.IO; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IPC; using osu.Game.Rulesets.Scoring.Legacy; namespace osu.Game.Rulesets.Scoring { public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles { private readonly BeatmapManager beatmaps; private readonly RulesetStore rulesets; private const string replay_folder = @"replays"; public event Action<Score> ScoreImported; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) { this.beatmaps = beatmaps; this.rulesets = rulesets; if (importHost != null) ipc = new ScoreIPCChannel(importHost, this); } public string[] HandledExtensions => new[] { ".osr" }; public void Import(params string[] paths) { foreach (var path in paths) { var score = ReadReplayFile(path); if (score != null) ScoreImported?.Invoke(score); } } public Score ReadReplayFile(string replayFilename) { if (!File.Exists(replayFilename)) { Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); return null; } using (var stream = File.OpenRead(replayFilename)) return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } } }
mit
C#
3fc8c23fe440644f321c9fa41ca183cf0b0ae637
Remove unnecessary `SetReplayScore` call in `ModCinema`
ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu
osu.Game/Rulesets/Mods/ModCinema.cs
osu.Game/Rulesets/Mods/ModCinema.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.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Mods { public abstract class ModCinema<T> : ModCinema, IApplicableToDrawableRuleset<T> where T : HitObject { public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset) { // AlwaysPresent required for hitsounds drawableRuleset.AlwaysPresent = true; drawableRuleset.Hide(); } } public class ModCinema : ModAutoplay, IApplicableToHUD, IApplicableToPlayer { public override string Name => "Cinema"; public override string Acronym => "CN"; public override IconUsage? Icon => OsuIcon.ModCinema; public override string Description => "Watch the video without visual distractions."; public void ApplyToHUD(HUDOverlay overlay) { overlay.ShowHud.Value = false; overlay.ShowHud.Disabled = true; } public void ApplyToPlayer(Player player) { player.ApplyToBackground(b => b.IgnoreUserSettings.Value = true); player.DimmableStoryboard.IgnoreUserSettings.Value = true; player.BreakOverlay.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 osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Mods { public abstract class ModCinema<T> : ModCinema, IApplicableToDrawableRuleset<T> where T : HitObject { public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset) { drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap, drawableRuleset.Mods)); // AlwaysPresent required for hitsounds drawableRuleset.AlwaysPresent = true; drawableRuleset.Hide(); } } public class ModCinema : ModAutoplay, IApplicableToHUD, IApplicableToPlayer { public override string Name => "Cinema"; public override string Acronym => "CN"; public override IconUsage? Icon => OsuIcon.ModCinema; public override string Description => "Watch the video without visual distractions."; public void ApplyToHUD(HUDOverlay overlay) { overlay.ShowHud.Value = false; overlay.ShowHud.Disabled = true; } public void ApplyToPlayer(Player player) { player.ApplyToBackground(b => b.IgnoreUserSettings.Value = true); player.DimmableStoryboard.IgnoreUserSettings.Value = true; player.BreakOverlay.Hide(); } } }
mit
C#
fc5d432a9f917b941bf4364ae52c1b6b2a6ff3fc
Update Source/Libraries/openXDA.Configuration/SSAMSSection.cs
GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA
Source/Libraries/openXDA.Configuration/SSAMSSection.cs
Source/Libraries/openXDA.Configuration/SSAMSSection.cs
//****************************************************************************************************** // SSAMSSection.cs - Gbtc // // Copyright © 2021, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this // file except in compliance with the License. You may obtain a copy of the License at: // // http://opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 02/08/2021 - Stephen C. Wills // Generated original version of source code. // //****************************************************************************************************** using System; using System.ComponentModel; using System.Configuration; using GSF.Configuration; namespace openXDA.Configuration { public class SSAMSSection { public const string CategoryName = "SSAMS"; private const string DefaultDataProviderString = "AssemblyName={System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}; " + "ConnectionType=System.Data.SqlClient.SqlConnection; " + "AdapterType=System.Data.SqlClient.SqlDataAdapter;"; /// <summary> /// Cron string frequency at which the SSAMS process is scheduled. /// </summary> [Setting] [DefaultValue("* 0 * * *")] public string Schedule { get; set; } /// <summary> /// Defines the connection string of the SSAMS DB. /// </summary> [Setting] [DefaultValue("Data Source=localhost; Initial Catalog=openXDA; Integrated Security=SSPI")] public string ConnectionString { get; set; } /// <summary> /// Defines the connection string of the SSAMS DB. /// </summary> [Setting] [DefaultValue(DefaultDataProviderString)] public string DataProviderString { get; set; } /// <summary> /// Command or procedure name that defines the command executed by the external DB. /// </summary> [Setting] [DefaultValue("sp_LogSsamEvent")] public string DatabaseCommand { get; set; } /// <summary> /// Parameters for the external DB procedure. /// </summary> [Setting] [DefaultValue("1,1,'OpenXDA_HEARTBEAT','','OpenXDA adapter heartbeat at {Timestamp} UTC',''")] public string CommandParameters { get; set; } } }
//****************************************************************************************************** // SSAMSSection.cs - Gbtc // // Copyright © 2021, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this // file except in compliance with the License. You may obtain a copy of the License at: // // http://opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 02/08/2021 - Stephen C. Wills // Generated original version of source code. // //****************************************************************************************************** using System; using System.ComponentModel; using System.Configuration; using GSF.Configuration; namespace openXDA.Configuration { public class SSAMSSection { public const string CategoryName = "SSAMS"; private const string DefaultDataProviderString = "AssemblyName={System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}; " + "ConnectionType=System.Data.SqlClient.SqlConnection; " + "AdapterType=System.Data.SqlClient.SqlDataAdapter;"; /// <summary> /// Cron string frequency at which the SSAMS process is scheduled. /// </summary> [Setting] [DefaultValue("* 0 * * *")] public string Schedule { get; set; } /// <summary> /// Defines the connection string of the SSAMS DB. /// </summary> [Setting] [DefaultValue("Data Source=localhost; Initial Catalog=openXDA; Integrated Security=SSPI")] public string ConnectionString { get; set; } /// <summary> /// Defines the connection string of the SSAMS DB. /// </summary> [Setting] [DefaultValue(DefaultDataProviderString)] public string DataProviderString { get; set; } /// <summary> /// Command or procedure name that defines the command executed by the external DB. /// </summary> [Setting] [DefaultValue("sp_LogSsamEvent")] public string DatabaseCommand { get; set; } /// <summary> /// Parameters for the external DB procedure. /// </summary> [Setting] [DefaultValue("1,1,'FL_PMU_{Acronym}_HEARTBEAT','','{Acronym} adapter heartbeat at {Timestamp} UTC',''")] public string CommandParameters { get; set; } } }
mit
C#
0441f7dc25c0a71cda1ad568d6911c55c411225e
fix crafting lookup no longer showing time left
Pathoschild/StardewMods
LookupAnything/Framework/Fields/ItemIconField.cs
LookupAnything/Framework/Fields/ItemIconField.cs
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewValley; namespace Pathoschild.Stardew.LookupAnything.Framework.Fields { /// <summary>A metadata field which shows an item icon.</summary> internal class ItemIconField : GenericField { /********* ** Properties *********/ /// <summary>The item for which to display an icon.</summary> private readonly Item Item; /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="label">A short field label.</param> /// <param name="item">The item for which to display an icon.</param> /// <param name="text">The text to display (if not the item name).</param> public ItemIconField(string label, Item item, string text = null) : base(label, null, hasValue: item != null) { this.Item = item; if (item != null) { this.Value = !string.IsNullOrWhiteSpace(text) ? this.FormatValue(text) : this.FormatValue(item.Name); } } /// <summary>Draw the value (or return <c>null</c> to render the <see cref="GenericField.Value"/> using the default format).</summary> /// <param name="spriteBatch">The sprite batch being drawn.</param> /// <param name="font">The recommended font.</param> /// <param name="position">The position at which to draw.</param> /// <param name="wrapWidth">The maximum width before which content should be wrapped.</param> /// <returns>Returns the drawn dimensions, or <c>null</c> to draw the <see cref="GenericField.Value"/> using the default format.</returns> public override Vector2? DrawValue(SpriteBatch spriteBatch, SpriteFont font, Vector2 position, float wrapWidth) { // get icon size float textHeight = font.MeasureString("ABC").Y; Vector2 iconSize = new Vector2(textHeight); // draw icon & text spriteBatch.DrawIcon(this.Item, position.X, position.Y, iconSize); Vector2 textSize = spriteBatch.DrawTextBlock(font, this.Value, position + new Vector2(iconSize.X + 5, 5), wrapWidth); // return size return new Vector2(wrapWidth, textSize.Y + 5); } } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewValley; namespace Pathoschild.Stardew.LookupAnything.Framework.Fields { /// <summary>A metadata field which shows an item icon.</summary> internal class ItemIconField : GenericField { /********* ** Properties *********/ /// <summary>The item for which to display an icon.</summary> private readonly Item Item; /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="label">A short field label.</param> /// <param name="item">The item for which to display an icon.</param> /// <param name="text">The text to display (if not the item name).</param> public ItemIconField(string label, Item item, string text = null) : base(label, text, hasValue: item != null) { this.Item = item; } /// <summary>Draw the value (or return <c>null</c> to render the <see cref="GenericField.Value"/> using the default format).</summary> /// <param name="spriteBatch">The sprite batch being drawn.</param> /// <param name="font">The recommended font.</param> /// <param name="position">The position at which to draw.</param> /// <param name="wrapWidth">The maximum width before which content should be wrapped.</param> /// <returns>Returns the drawn dimensions, or <c>null</c> to draw the <see cref="GenericField.Value"/> using the default format.</returns> public override Vector2? DrawValue(SpriteBatch spriteBatch, SpriteFont font, Vector2 position, float wrapWidth) { // get icon size float textHeight = font.MeasureString("ABC").Y; Vector2 iconSize = new Vector2(textHeight); // draw icon & text spriteBatch.DrawIcon(this.Item, position.X, position.Y, iconSize); Vector2 textSize = spriteBatch.DrawTextBlock(font, this.FormatValue(this.Item.Name), position + new Vector2(iconSize.X + 5, 5), wrapWidth); // return size return new Vector2(wrapWidth, textSize.Y + 5); } } }
mit
C#
78ca22232d737be71829ad9a7a0aeb7c074410b4
Add model name
tobyclh/UnityCNTK,tobyclh/UnityCNTK
Assets/UnityCNTK/Models/Model.cs
Assets/UnityCNTK/Models/Model.cs
using System.Collections; using System.Collections.Generic; using UnityEngine.Assertions; using System.Linq; using UnityEngine; using UnityEditor; using CNTK; using System.Timers; using System.Threading; using CNTK; using System; namespace UnityCNTK { // Unifying class that combine the use of both EvalDLL and CNTKLibrary // The reason we have not dropped support for EvalDLL is that it expose more native function of the full API, // which are very useful in general. public class Model : ScriptableObject { public string Name; public string relativeModelPath; public Function function; public IConvertible input; public IConvertible output; public Thread thread; public bool KeepModelLoaded = false; public DeviceDescriptor device; public virtual void LoadModel() { Assert.IsNotNull(relativeModelPath); var absolutePath = System.IO.Path.Combine(Environment.CurrentDirectory, relativeModelPath); // Downloader.DownloadPretrainedModel(Downloader.pretrainedModel.VGG16, absolutePath); } public virtual void Evaluate() { var IOValues = OnPreprocess(); thread = new Thread(() => { function.Evaluate(IOValues[0], IOValues[1], device); OnEvaluated(IOValues[1]); }); thread.IsBackground = true; thread.Start(); } public virtual List<Dictionary<Variable, Value>> OnPreprocess() { Assert.IsNotNull(device); Assert.IsNotNull(input); if (function == null) LoadModel(); var inputVar = function.Arguments.Single(); var inputDataMap = new Dictionary<Variable, Value>() { { inputVar, input.ToValue(device) } }; var outputDataMap = new Dictionary<Variable, Value>() { { function.Output, null } }; return new List<Dictionary<Variable, Value>>() { inputDataMap, outputDataMap }; } // process output data to fit user requirement public virtual void OnEvaluated(Dictionary<Variable, Value> outputDataMap) { } } }
using System.Collections; using System.Collections.Generic; using UnityEngine.Assertions; using System.Linq; using UnityEngine; using UnityEditor; using CNTK; using System.Timers; using System.Threading; using CNTK; using System; namespace UnityCNTK { // Unifying class that combine the use of both EvalDLL and CNTKLibrary // The reason we have not dropped support for EvalDLL is that it expose more native function of the full API, // which are very useful in general. public class Model : ScriptableObject { public string relativeModelPath; public Function function; public IConvertible input; public IConvertible output; public Thread thread; public bool KeepModelLoaded = false; public DeviceDescriptor device; public virtual void LoadModel() { Assert.IsNotNull(relativeModelPath); var absolutePath = System.IO.Path.Combine(Environment.CurrentDirectory, relativeModelPath); // Downloader.DownloadPretrainedModel(Downloader.pretrainedModel.VGG16, absolutePath); } public virtual void Evaluate() { var IOValues = OnPreprocess(); thread = new Thread(() => { function.Evaluate(IOValues[0], IOValues[1], device); OnEvaluated(IOValues[1]); }); thread.IsBackground = true; thread.Start(); } public virtual List<Dictionary<Variable, Value>> OnPreprocess() { Assert.IsNotNull(device); Assert.IsNotNull(input); if (function == null) LoadModel(); var inputVar = function.Arguments.Single(); var inputDataMap = new Dictionary<Variable, Value>() { { inputVar, input.ToValue(device) } }; var outputDataMap = new Dictionary<Variable, Value>() { { function.Output, null } }; return new List<Dictionary<Variable, Value>>() { inputDataMap, outputDataMap }; } // process output data to fit user requirement public virtual void OnEvaluated(Dictionary<Variable, Value> outputDataMap) { } } }
mit
C#
6b250da147b077d48c2973032fe91ba1eb6061b1
comment tweak
bogosoft/Data
Bogosoft.Data/IListExtensions.cs
Bogosoft.Data/IListExtensions.cs
using System; using System.Collections.Generic; namespace Bogosoft.Data { /// <summary> /// Extended functionality for an <see cref="IList{T}"/> implementation. /// </summary> public static class IListExtensions { /// <summary> /// Add a new computed column to the current list by providing its components separately. /// </summary> /// <typeparam name="T">The type of the object to be used when extracting a field value.</typeparam> /// <param name="columns">The current list of computed column definitions.</param> /// <param name="name"> /// A value corresponding to the name of the column. /// </param> /// <param name="type">The data type of the values in the new column.</param> /// <param name="extractor"> /// A strategy for extracting a column value from objects of the specified type. /// </param> public static IList<Column<T>> Add<T>( this IList<Column<T>> columns, string name, Type type, Func<T, object> extractor ) { columns.Add(new Column<T>(name, type, extractor)); return columns; } } }
using System; using System.Collections.Generic; namespace Bogosoft.Data { /// <summary> /// Extended functionality for an <see cref="IList{T}"/> implementation. /// </summary> public static class IListExtensions { /// <summary> /// Add a new computed column to the current list by providing its components separately. /// </summary> /// <typeparam name="T">The type of the object to be used when extracting a field value.</typeparam> /// <param name="columns">The current list of field providers.</param> /// <param name="name"> /// A value corresponding to the name of the column. /// </param> /// <param name="type">The data type of the values in the new column.</param> /// <param name="extractor"> /// A strategy for extracting a column value from objects of the specified type. /// </param> public static IList<Column<T>> Add<T>( this IList<Column<T>> columns, string name, Type type, Func<T, object> extractor ) { columns.Add(new Column<T>(name, type, extractor)); return columns; } } }
mit
C#
c0103b247d504b314fbd9a0829d53fd9ada4151a
fix NoteClient EntityOperationSettings
AlejandroCano/extensions,signumsoftware/framework,signumsoftware/extensions,signumsoftware/framework,MehdyKarimpour/extensions,MehdyKarimpour/extensions,signumsoftware/extensions,AlejandroCano/extensions
Signum.Windows.Extensions/Notes/NoteClient.cs
Signum.Windows.Extensions/Notes/NoteClient.cs
using Signum.Entities; using Signum.Entities.Notes; using Signum.Windows.Notes; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Media.Imaging; using Signum.Windows.Operations; namespace Signum.Windows.Notes { public static class NoteClient { public static void Start(params Type[] types) { if(Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod())) { if (types == null) throw new ArgumentNullException("types"); WidgetPanel.GetWidgets += (obj, mainControl) => { if (obj is Entity && types.Contains(obj.GetType()) && !((Entity)obj).IsNew && Finder.IsFindable(typeof(NoteDN))) return new NotesWidget(); return null; }; Server.SetSemiSymbolIds<NoteTypeDN>(); OperationClient.AddSettings(new List<OperationSettings> { new EntityOperationSettings<Entity>(NoteOperation.CreateNoteFromEntity) { IsVisible = _ => false } }); Navigator.AddSetting(new EntitySettings<NoteTypeDN> { View = e => new NoteType() }); Navigator.AddSetting(new EntitySettings<NoteDN> { View = e => new Note(), IsCreable = EntityWhen.Never, Icon = ExtensionsImageLoader.GetImageSortName("note2.png") }); } } } }
using Signum.Entities; using Signum.Entities.Notes; using Signum.Windows.Notes; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Media.Imaging; using Signum.Windows.Operations; namespace Signum.Windows.Notes { public static class NoteClient { public static void Start(params Type[] types) { if(Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod())) { if (types == null) throw new ArgumentNullException("types"); WidgetPanel.GetWidgets += (obj, mainControl) => { if (obj is Entity && types.Contains(obj.GetType()) && !((Entity)obj).IsNew && Finder.IsFindable(typeof(NoteDN))) return new NotesWidget(); return null; }; Server.SetSemiSymbolIds<NoteTypeDN>(); OperationClient.AddSettings(new List<OperationSettings> { new EntityOperationSettings<NoteDN>(NoteOperation.CreateNoteFromEntity) { IsVisible = _ => false } }); Navigator.AddSetting(new EntitySettings<NoteTypeDN> { View = e => new NoteType() }); Navigator.AddSetting(new EntitySettings<NoteDN> { View = e => new Note(), IsCreable = EntityWhen.Never, Icon = ExtensionsImageLoader.GetImageSortName("note2.png") }); } } } }
mit
C#
6f203b4e047155e0a1e99c03592f788d33b5ef70
Change around some properties; documentation
whampson/cascara,whampson/bft-spec
Cascara/Src/IFileObject.cs
Cascara/Src/IFileObject.cs
#region License /* Copyright (c) 2017-2018 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System; using System.Collections; using System.Collections.Generic; namespace WHampson.Cascara { /// <summary> /// Defines a file object, which is a meaningful piece of data /// made up of bytes in a <see cref="BinaryFile"/>. /// </summary> public interface IFileObject : IEnumerable<IFileObject> { /// <summary> /// Gets the position of this <see cref="IFileObject"/> relative to the start /// of the <see cref="BinaryFile"/>. /// </summary> int FilePosition { get; } /// <summary> /// Gets the position of this <see cref="IFileObject"/> relative to the start /// of the parent object. /// </summary> int Offset { get; } /// <summary> /// Gets the number of bytes that make up this <see cref="IFileObject"/>. /// </summary> int Length { get; } /// <summary> /// Gets a value indicating whether this <see cref="IFileObject"/> represents a collection. /// </summary> bool IsCollection { get; } /// <summary> /// Gets the number of elements in the collection represented by this <see cref="IFileObject"/>. /// If this <see cref="IFileObject"/> does not represent a collection, this value is -1. /// </summary> /// <seealso cref="IsCollection"/> int ElementCount { get; } /// <summary> /// Gets the element at the specified index in the collection as an <see cref="IFileObject"/>. /// If this <see cref="IFileObject"/> does not represent a collection, an /// <see cref="InvalidOperationException"/> will be thrown. /// </summary> /// <param name="index">The index of the element to get.</param> /// <returns>The element at the specified index.</returns> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown if the specified index is negative or greater than or equal to the element count. /// </exception> /// <exception cref="InvalidOperationException"> /// Thrown if this <see cref="IFileObject"/> does not represent a collection. /// </exception> /// <seealso cref="IsCollection"/> IFileObject ElementAt(int index); } }
#region License /* Copyright (c) 2017-2018 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion namespace WHampson.Cascara { public interface IFileObject { BinaryFile SourceFile { get; } int Offset { get; } int Size { get; } } }
mit
C#
f64f0cc5ff197cb0ae80b1a54412be700fdd5ea8
Update IEmbedField
velddev/IA.SDK
IA.SDK/Interfaces/IEmbedField.cs
IA.SDK/Interfaces/IEmbedField.cs
namespace IA.SDK.Interfaces { public interface IEmbedField { string Name { get; } string Value { get; } bool IsInline { get; } } }
namespace IA.SDK.Interfaces { public interface IEmbedField { string Name { get; set; } string Value { get; set; } bool IsInline { get; set; } } }
mit
C#
17838271e6092c7eb7923918a8317f0bff9e8665
Remove range constraint in destiny tuner
JLChnToZ/LuckyPlayer
LuckyPlayer/LuckyPlayer/DestinyTuner.cs
LuckyPlayer/LuckyPlayer/DestinyTuner.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JLChnToZ.LuckyPlayer { public class DestinyTuner<T> { static DestinyTuner<T> defaultInstance; public static DestinyTuner<T> Default { get { if(defaultInstance == null) defaultInstance = new DestinyTuner<T>(); return defaultInstance; } } double fineTuneOnSuccess; public double FineTuneOnSuccess { get { return fineTuneOnSuccess; } set { fineTuneOnSuccess = value; } } public DestinyTuner() { fineTuneOnSuccess = -0.0001; } public DestinyTuner(double fineTuneOnSuccess) { FineTuneOnSuccess = fineTuneOnSuccess; } protected internal virtual void TuneDestinyOnSuccess(LuckyController<T> luckyControl) { luckyControl.fineTune *= 1 + fineTuneOnSuccess; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JLChnToZ.LuckyPlayer { public class DestinyTuner<T> { static DestinyTuner<T> defaultInstance; public static DestinyTuner<T> Default { get { if(defaultInstance == null) defaultInstance = new DestinyTuner<T>(); return defaultInstance; } } double fineTuneOnSuccess; public double FineTuneOnSuccess { get { return fineTuneOnSuccess; } set { if(value < 0 || value > 1) throw new ArgumentOutOfRangeException("Value must be between 0 and 1"); fineTuneOnSuccess = value; } } public DestinyTuner() { fineTuneOnSuccess = -0.0001; } public DestinyTuner(double fineTuneOnSuccess) { FineTuneOnSuccess = fineTuneOnSuccess; } protected internal virtual void TuneDestinyOnSuccess(LuckyController<T> luckyControl) { luckyControl.fineTune *= 1 + fineTuneOnSuccess; } } }
mit
C#
45975b5b63305c69c64105136ce8efbe7e6c750a
Include required provider name in GetStorageProvider exception message. (#3797)
pherbel/orleans,SoftWar1923/orleans,brhinescot/orleans,ashkan-saeedi-mazdeh/orleans,yevhen/orleans,jokin/orleans,hoopsomuah/orleans,ibondy/orleans,benjaminpetit/orleans,dVakulen/orleans,amccool/orleans,sergeybykov/orleans,dotnet/orleans,jokin/orleans,ashkan-saeedi-mazdeh/orleans,MikeHardman/orleans,jokin/orleans,ibondy/orleans,dVakulen/orleans,Liversage/orleans,ElanHasson/orleans,galvesribeiro/orleans,dotnet/orleans,sergeybykov/orleans,jason-bragg/orleans,ashkan-saeedi-mazdeh/orleans,hoopsomuah/orleans,amccool/orleans,Liversage/orleans,brhinescot/orleans,yevhen/orleans,amccool/orleans,pherbel/orleans,galvesribeiro/orleans,waynemunro/orleans,brhinescot/orleans,jthelin/orleans,veikkoeeva/orleans,ReubenBond/orleans,Liversage/orleans,ElanHasson/orleans,dVakulen/orleans,SoftWar1923/orleans,MikeHardman/orleans,waynemunro/orleans
src/Orleans.Core/Providers/GrainStorageExtensions.cs
src/Orleans.Core/Providers/GrainStorageExtensions.cs
using Orleans.Providers; using Orleans.Runtime; using System; using System.Reflection; using Microsoft.Extensions.DependencyInjection; using System.Linq; namespace Orleans.Storage { public static class GrainStorageExtensions { /// <summary> /// Aquire the storage provider associated with the grain type. /// </summary> /// <returns></returns> public static IStorageProvider GetStorageProvider(this Grain grain, IServiceProvider services) { StorageProviderAttribute attr = grain.GetType().GetCustomAttributes<StorageProviderAttribute>(true).FirstOrDefault(); IStorageProvider storageProvider = attr != null ? services.GetServiceByName<IStorageProvider>(attr.ProviderName) : services.GetService<IStorageProvider>(); if (storageProvider == null) { ThrowMissingProviderException(grain, attr?.ProviderName); } return storageProvider; } private static void ThrowMissingProviderException(Grain grain, string name) { string errMsg; var grainTypeName = grain.GetType().GetParseableName(TypeFormattingOptions.LogFormat); if (string.IsNullOrEmpty(name)) { errMsg = $"No default storage provider found loading grain type {grainTypeName}."; } else { errMsg = $"No storage provider named \"{name}\" found loading grain type {grainTypeName}."; } throw new BadProviderConfigException(errMsg); } } }
using Orleans.Providers; using Orleans.Runtime; using System; using System.Reflection; using Microsoft.Extensions.DependencyInjection; using System.Linq; namespace Orleans.Storage { public static class GrainStorageExtensions { /// <summary> /// Aquire the storage provider associated with the grain type. /// </summary> /// <returns></returns> public static IStorageProvider GetStorageProvider(this Grain grain, IServiceProvider services) { StorageProviderAttribute attr = grain.GetType().GetTypeInfo().GetCustomAttributes<StorageProviderAttribute>(true).FirstOrDefault(); IStorageProvider storageProvider = attr != null ? services.GetServiceByName<IStorageProvider>(attr.ProviderName) : services.GetService<IStorageProvider>(); if (storageProvider == null) { var errMsg = string.Format("No storage providers found loading grain type {0}", grain.GetType().FullName); throw new BadProviderConfigException(errMsg); } return storageProvider; } } }
mit
C#
60373eab54755bddf42be120ab031b31ff28ee40
Make TreeResponse readonly
dlsteuer/octokit.net,SmithAndr/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,kdolan/octokit.net,nsnnnnrn/octokit.net,khellang/octokit.net,devkhan/octokit.net,michaKFromParis/octokit.net,hitesh97/octokit.net,Sarmad93/octokit.net,octokit/octokit.net,ivandrofly/octokit.net,octokit-net-test-org/octokit.net,chunkychode/octokit.net,shiftkey/octokit.net,SmithAndr/octokit.net,mminns/octokit.net,TattsGroup/octokit.net,gabrielweyer/octokit.net,TattsGroup/octokit.net,fffej/octokit.net,octokit-net-test/octokit.net,M-Zuber/octokit.net,thedillonb/octokit.net,shiftkey-tester/octokit.net,thedillonb/octokit.net,SamTheDev/octokit.net,rlugojr/octokit.net,dampir/octokit.net,editor-tools/octokit.net,editor-tools/octokit.net,adamralph/octokit.net,devkhan/octokit.net,chunkychode/octokit.net,naveensrinivasan/octokit.net,dampir/octokit.net,forki/octokit.net,shana/octokit.net,hahmed/octokit.net,ivandrofly/octokit.net,shana/octokit.net,eriawan/octokit.net,geek0r/octokit.net,SamTheDev/octokit.net,darrelmiller/octokit.net,octokit-net-test-org/octokit.net,alfhenrik/octokit.net,kolbasov/octokit.net,takumikub/octokit.net,SLdragon1989/octokit.net,khellang/octokit.net,cH40z-Lord/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,eriawan/octokit.net,Sarmad93/octokit.net,bslliw/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester/octokit.net,rlugojr/octokit.net,daukantas/octokit.net,M-Zuber/octokit.net,magoswiat/octokit.net,nsrnnnnn/octokit.net,ChrisMissal/octokit.net,octokit/octokit.net,brramos/octokit.net,gabrielweyer/octokit.net,hahmed/octokit.net,alfhenrik/octokit.net,gdziadkiewicz/octokit.net,shiftkey/octokit.net,mminns/octokit.net,fake-organization/octokit.net,Red-Folder/octokit.net
Octokit/Models/Response/TreeResponse.cs
Octokit/Models/Response/TreeResponse.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace Octokit { [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TreeResponse { /// <summary> /// The SHA for this Tree response. /// </summary> public string Sha { get; protected set; } /// <summary> /// The URL for this Tree response. /// </summary> public Uri Url { get; protected set; } /// <summary> /// The list of Tree Items for this Tree response. /// </summary> public IReadOnlyCollection<TreeItem> Tree { get; protected set; } internal string DebuggerDisplay { get { return String.Format(CultureInfo.InvariantCulture, "Sha: {0}", Sha); } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace Octokit { [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TreeResponse { /// <summary> /// The SHA for this Tree response. /// </summary> public string Sha { get; set; } /// <summary> /// The URL for this Tree response. /// </summary> public Uri Url { get; set; } /// <summary> /// The list of Tree Items for this Tree response. /// </summary> [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public ICollection<TreeItem> Tree { get; set; } internal string DebuggerDisplay { get { return String.Format(CultureInfo.InvariantCulture, "Sha: {0}", Sha); } } } }
mit
C#
da823b78cf1e3f51623e96d52fbde56cb07bce4d
Add GetTemplateList to interface
bcemmett/SurveyMonkeyApi
SurveyMonkey/ISurveyMonkeyApi.cs
SurveyMonkey/ISurveyMonkeyApi.cs
using System.Collections.Generic; namespace SurveyMonkey { public interface ISurveyMonkeyApi { int RequestsMade { get; } int QuotaAllotted { get; } int QuotaUsed { get; } //Endpoints List<Survey> GetSurveyList(); List<Survey> GetSurveyList(GetSurveyListSettings settings); List<Survey> GetSurveyList(int page); List<Survey> GetSurveyList(int page, GetSurveyListSettings settings); List<Survey> GetSurveyList(int page, int pageSize); List<Survey> GetSurveyList(int page, int pageSize, GetSurveyListSettings settings); Survey GetSurveyDetails(long surveyId); List<Collector> GetCollectorList(long surveyId); List<Collector> GetCollectorList(long surveyId, GetCollectorListSettings settings); List<Collector> GetCollectorList(long surveyId, int page); List<Collector> GetCollectorList(long surveyId, int page, GetCollectorListSettings settings); List<Collector> GetCollectorList(long surveyId, int page, int pageSize); List<Collector> GetCollectorList(long surveyId, int page, int pageSize, GetCollectorListSettings settings); List<Respondent> GetRespondentList(long surveyId); List<Respondent> GetRespondentList(long surveyId, GetRespondentListSettings settings); List<Respondent> GetRespondentList(long surveyId, int page); List<Respondent> GetRespondentList(long surveyId, int page, GetRespondentListSettings settings); List<Respondent> GetRespondentList(long surveyId, int page, int pageSize); List<Respondent> GetRespondentList(long surveyId, int page, int pageSize, GetRespondentListSettings settings); List<Response> GetResponses(long surveyId, List<long> respondents); Collector GetResponseCounts(long collectorId); UserDetails GetUserDetails(); List<Template> GetTemplateList(); List<Template> GetTemplateList(GetTemplateListSettings settings); List<Template> GetTemplateList(int page); List<Template> GetTemplateList(int page, GetTemplateListSettings settings); List<Template> GetTemplateList(int page, int pageSize); List<Template> GetTemplateList(int page, int pageSize, GetTemplateListSettings settings); CreateRecipientsResponse CreateRecipients(long collectorId, long emailMessageId, List<Recipient> recipients); SendFlowResponse SendFlow(long surveyId, SendFlowSettings settings); //Data processing void FillMissingSurveyInformation(List<Survey> surveys); void FillMissingSurveyInformation(Survey survey); } }
using System.Collections.Generic; namespace SurveyMonkey { public interface ISurveyMonkeyApi { int RequestsMade { get; } int QuotaAllotted { get; } int QuotaUsed { get; } //Endpoints List<Survey> GetSurveyList(); List<Survey> GetSurveyList(GetSurveyListSettings settings); List<Survey> GetSurveyList(int page); List<Survey> GetSurveyList(int page, GetSurveyListSettings settings); List<Survey> GetSurveyList(int page, int pageSize); List<Survey> GetSurveyList(int page, int pageSize, GetSurveyListSettings settings); Survey GetSurveyDetails(long surveyId); List<Collector> GetCollectorList(long surveyId); List<Collector> GetCollectorList(long surveyId, GetCollectorListSettings settings); List<Collector> GetCollectorList(long surveyId, int page); List<Collector> GetCollectorList(long surveyId, int page, GetCollectorListSettings settings); List<Collector> GetCollectorList(long surveyId, int page, int pageSize); List<Collector> GetCollectorList(long surveyId, int page, int pageSize, GetCollectorListSettings settings); List<Respondent> GetRespondentList(long surveyId); List<Respondent> GetRespondentList(long surveyId, GetRespondentListSettings settings); List<Respondent> GetRespondentList(long surveyId, int page); List<Respondent> GetRespondentList(long surveyId, int page, GetRespondentListSettings settings); List<Respondent> GetRespondentList(long surveyId, int page, int pageSize); List<Respondent> GetRespondentList(long surveyId, int page, int pageSize, GetRespondentListSettings settings); List<Response> GetResponses(long surveyId, List<long> respondents); Collector GetResponseCounts(long collectorId); UserDetails GetUserDetails(); CreateRecipientsResponse CreateRecipients(long collectorId, long emailMessageId, List<Recipient> recipients); SendFlowResponse SendFlow(long surveyId, SendFlowSettings settings); //Data processing void FillMissingSurveyInformation(List<Survey> surveys); void FillMissingSurveyInformation(Survey survey); } }
mit
C#
726183210da67e7f0695d68b52cd9178c3307751
Adjust visibility for settings members
Schlechtwetterfront/snipp
Settings/Settings.cs
Settings/Settings.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; namespace clipman.Settings { public class Settings : INotifyPropertyChanged { protected int clipLimit = 100; public int ClipLimit { get { return clipLimit; } set { clipLimit = value; RaisePropertyChanged("ClipLimit"); } } protected KeyGesture focusWindowHotkey = new KeyGesture(Key.OemTilde, ModifierKeys.Control); public KeyGesture FocusWindowHotkey { get { return focusWindowHotkey; } } protected KeyGesture focusSearchBox = new KeyGesture(Key.F, ModifierKeys.Control); public KeyGesture FocusSearchBox { get { return focusSearchBox; } } protected KeyGesture clearAndFocusSearchBox = new KeyGesture(Key.Escape); public KeyGesture ClearAndFocusSearchBox { get { return clearAndFocusSearchBox; } } protected KeyGesture copySelectedClip = new KeyGesture(Key.C, ModifierKeys.Control); public KeyGesture CopySelectedClip { get { return copySelectedClip; } } protected KeyGesture pinSelectedClip = new KeyGesture(Key.P, ModifierKeys.Control); public KeyGesture PinSelectedClip { get { return pinSelectedClip; } } protected KeyGesture quit = new KeyGesture(Key.Q, ModifierKeys.Control); public KeyGesture Quit { get { return quit; } } public event PropertyChangedEventHandler PropertyChanged; public void RaisePropertyChanged(string property) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property)); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; namespace clipman.Settings { public class Settings : INotifyPropertyChanged { protected int clipLimit = 100; public int ClipLimit { get { return clipLimit; } set { clipLimit = value; RaisePropertyChanged("ClipLimit"); } } private KeyGesture focusWindowHotkey = new KeyGesture(Key.OemTilde, ModifierKeys.Control); public KeyGesture FocusWindowHotkey { get { return focusWindowHotkey; } } private KeyGesture focusSearchBox = new KeyGesture(Key.F, ModifierKeys.Control); public KeyGesture FocusSearchBox { get { return focusSearchBox; } } private KeyGesture clearAndFocusSearchBox = new KeyGesture(Key.Escape); public KeyGesture ClearAndFocusSearchBox { get { return clearAndFocusSearchBox; } } private KeyGesture copySelectedClip = new KeyGesture(Key.C, ModifierKeys.Control); public KeyGesture CopySelectedClip { get { return copySelectedClip; } } private KeyGesture pinSelectedClip = new KeyGesture(Key.P, ModifierKeys.Control); public KeyGesture PinSelectedClip { get { return pinSelectedClip; } } private KeyGesture quit = new KeyGesture(Key.Q, ModifierKeys.Control); public KeyGesture Quit { get { return quit; } } public event PropertyChangedEventHandler PropertyChanged; public void RaisePropertyChanged(string property) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property)); } } }
apache-2.0
C#
f18240cc58dca678405d19cb9efa113d6aaeee8c
Make model to text asset so it can be loaded just like everything else
tobyclh/UnityCNTK,tobyclh/UnityCNTK
Assets/UnityCNTK/Scripts/Models/_Model.cs
Assets/UnityCNTK/Scripts/Models/_Model.cs
using System; using System.Collections.Generic; using UnityEngine; using CNTK; using UnityEngine.Events; using System.Threading; using UnityEngine.Assertions; namespace UnityCNTK { /// <summary> /// the non-generic base class for all model /// only meant to be used for model management and GUI scripting, not in-game /// </summary> public class _Model : MonoBehaviour{ public UnityEvent OnModelLoaded; public TextAsset rawModel; public Function function; private bool _isReady = false; public bool isReady { get; protected set; } /// <summary> /// Load the model automatically on start /// </summary> public bool LoadOnStart = true; protected Thread thread; public virtual void LoadModel() { Assert.IsNotNull(rawModel); Debug.Log("Started thread"); try { function = Function.Load(rawModel.bytes, CNTKManager.device); } catch (Exception e) { Debug.LogError(e); } if (OnModelLoaded != null) OnModelLoaded.Invoke(); isReady = true; Debug.Log("Model Loaded : " +rawModel.name); } public void UnloadModel() { if (function != null) { function.Dispose(); } } } }
using System; using System.Collections.Generic; using UnityEngine; using CNTK; using UnityEngine.Events; using System.Threading; using UnityEngine.Assertions; namespace UnityCNTK { /// <summary> /// the non-generic base class for all model /// only meant to be used for model management and GUI scripting, not in-game /// </summary> public class _Model : MonoBehaviour{ public UnityEvent OnModelLoaded; public string relativeModelPath; public Function function; private bool _isReady = false; public bool isReady { get; protected set; } /// <summary> /// Load the model automatically on start /// </summary> public bool LoadOnStart = true; protected Thread thread; public virtual void LoadModel() { Assert.IsNotNull(relativeModelPath); var absolutePath = System.IO.Path.Combine(Environment.CurrentDirectory, relativeModelPath); Thread loadThread = new Thread(() => { Debug.Log("Started thread"); try { function = Function.Load(absolutePath, CNTKManager.device); } catch (Exception e) { Debug.LogError(e); } if (OnModelLoaded != null) OnModelLoaded.Invoke(); isReady = true; Debug.Log("Model Loaded"); }); loadThread.Start(); } public void UnloadModel() { if (function != null) { function.Dispose(); } } } }
mit
C#
97a555ec0f76b057923d5aca4cb85f6411141103
Implement IDisposable on Timer
kendfrey/Tui
Tui/Timer.cs
Tui/Timer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tui { /// <summary> /// Allows firing events at specific times. /// </summary> public class Timer : IDisposable { System.Timers.Timer timer; Screen screen; /// <summary> /// Occurs when the interval since the last tick has elapsed. /// </summary> public event EventHandler Tick; /// <summary> /// Initializes and starts a new timer. /// </summary> /// <param name="interval">The interval between ticks.</param> /// <param name="screen">The screen containing the event loop used to process the ticks.</param> public Timer(TimeSpan interval, Screen screen) { this.screen = screen; timer = new System.Timers.Timer(interval.TotalMilliseconds); timer.Elapsed += timer_Elapsed; timer.Start(); } private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { screen.PushEvent(() => OnTick(new EventArgs())); } /// <summary> /// Raises the Tick event. /// </summary> /// <param name="e">The event data to pass to the event.</param> protected virtual void OnTick(EventArgs e) { EventHandler tick = Tick; if (tick != null) { tick(this, e); } } /// <summary> /// Stops the timer and releases all resources. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } /// <summary> /// Releases resources used by the timer. /// </summary> /// <param name="disposing">Specifies whether to release managed resources in addition to unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { timer.Dispose(); } } ~Timer() { Dispose(false); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tui { /// <summary> /// Allows firing events at specific times. /// </summary> public class Timer { System.Timers.Timer timer; Screen screen; /// <summary> /// Occurs when the interval since the last tick has elapsed. /// </summary> public event EventHandler Tick; /// <summary> /// Initializes and starts a new timer. /// </summary> /// <param name="interval">The interval between ticks.</param> /// <param name="screen">The screen containing the event loop used to process the ticks.</param> public Timer(TimeSpan interval, Screen screen) { this.screen = screen; timer = new System.Timers.Timer(interval.TotalMilliseconds); timer.Elapsed += timer_Elapsed; timer.Start(); } private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { screen.PushEvent(() => OnTick(new EventArgs())); } /// <summary> /// Raises the Tick event. /// </summary> /// <param name="e">The event data to pass to the event.</param> protected virtual void OnTick(EventArgs e) { EventHandler tick = Tick; if (tick != null) { tick(this, e); } } } }
mit
C#
5455dc18dbff1f2f96aed441e3c7286a7bfe1926
Adjust for .NET 2 and bump version
McNeight/SharpZipLib
src/AssemblyInfo.cs
src/AssemblyInfo.cs
// AssemblyInfo.cs // // Copyright (C) 2001 Mike Krueger // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give you // permission to link this library with independent modules to produce an // executable, regardless of the license terms of these independent // modules, and to copy and distribute the resulting executable under // terms of your choice, provided that you also meet, for each linked // independent module, the terms and conditions of the license of that // module. An independent module is a module which is not derived from // or based on this library. If you modify this library, you may extend // this exception to your version of the library, but you are not // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: CLSCompliant(true)] [assembly: AssemblyTitle("ICSharpCode.SharpZipLibrary")] [assembly: AssemblyDescription("A free C# compression library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("#ZipLibrary")] [assembly: AssemblyCopyright("Copyright 2001-2005 Mike Krueger")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.85.0.0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] [assembly: AssemblyDelaySign(false)] #if NET_VER_1 [assembly: AssemblyKeyFile("../ICSharpCode.SharpZipLib.key")] #endif
// AssemblyInfo.cs // // Copyright (C) 2001 Mike Krueger // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give you // permission to link this library with independent modules to produce an // executable, regardless of the license terms of these independent // modules, and to copy and distribute the resulting executable under // terms of your choice, provided that you also meet, for each linked // independent module, the terms and conditions of the license of that // module. An independent module is a module which is not derived from // or based on this library. If you modify this library, you may extend // this exception to your version of the library, but you are not // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. using System; using System.Reflection; using System.Runtime.CompilerServices; [assembly: CLSCompliant(true)] [assembly: AssemblyTitle("ICSharpCode.SharpZipLibrary")] [assembly: AssemblyDescription("A free C# compression library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("#ZipLibrary")] [assembly: AssemblyCopyright("Copyright 2001-2005 Mike Krueger")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.84.0.0")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("../ICSharpCode.SharpZipLib.key")]
mit
C#
8f98feacb546aeec163ce678f25248eff7fc5a7d
add some logging in DB checks
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
TCC.Core/Data/Databases/DatabaseBase.cs
TCC.Core/Data/Databases/DatabaseBase.cs
using System.IO; using Nostrum; using TCC.Utils; namespace TCC.Data.Databases { public abstract class DatabaseBase { protected string Language; protected abstract string FolderName { get; } protected abstract string Extension { get; } public string RelativePath => $"{FolderName}/{FolderName}-{Language}.{Extension}"; protected string FullPath => Path.Combine(App.DataPath, RelativePath); public virtual bool Exists => File.Exists(FullPath); public bool IsUpToDate => outdatedCount == 0 && Exists; protected int outdatedCount; public abstract void Load(); public virtual void CheckVersion(string customAbsPath = null, string customRelPath = null) { if (!Exists) { Log.F($"{customAbsPath ?? FullPath} not found. Skipping hash check."); return; } var localHash = HashUtils.GenerateFileHash(customAbsPath ?? FullPath); if (UpdateManager.DatabaseHashes.Count == 0) { Log.F($"No database hashes in update manager. Skipping hash check."); return; } if (!UpdateManager.DatabaseHashes.TryGetValue(customRelPath ?? RelativePath, out var remoteHash)) { Log.F($"No entry found in update manager for {customAbsPath ?? FullPath}. Skipping hash check."); return; } if (remoteHash == localHash) { return; } //Log.F($"Hash mismatch for {customRelPath ?? RelativePath} (local:{localHash} remote:{remoteHash})"); outdatedCount++; } public DatabaseBase(string lang) { Language = lang; } public virtual void Update(string custom = null) { UpdateManager.UpdateDatabase(custom ?? RelativePath); } } }
using System.IO; using Nostrum; using TCC.Utils; namespace TCC.Data.Databases { public abstract class DatabaseBase { protected string Language; protected abstract string FolderName { get; } protected abstract string Extension { get; } public string RelativePath => $"{FolderName}/{FolderName}-{Language}.{Extension}"; protected string FullPath => Path.Combine(App.DataPath, RelativePath); public virtual bool Exists => File.Exists(FullPath); public bool IsUpToDate => outdatedCount == 0 && Exists; protected int outdatedCount; public abstract void Load(); public virtual void CheckVersion(string customAbsPath = null, string customRelPath = null) { if (!Exists) return; var localHash = HashUtils.GenerateFileHash(customAbsPath ?? FullPath); if (UpdateManager.DatabaseHashes.Count == 0) return; if (!UpdateManager.DatabaseHashes.TryGetValue(customRelPath ?? RelativePath, out var remoteHash)) return; if (remoteHash == localHash) return; Log.CW($"Hash mismatch for {customRelPath ?? RelativePath}"); outdatedCount++; } public DatabaseBase(string lang) { Language = lang; } public virtual void Update(string custom = null) { UpdateManager.UpdateDatabase(custom ?? RelativePath); } } }
mit
C#
439ccc1d9bc54ddf404ce464c41fa185a42f3c49
Fix update notification
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Execution/UpdateNotificationAttribute.cs
source/Nuke.Common/Execution/UpdateNotificationAttribute.cs
// Copyright 2021 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.IO; using System.Linq; using Nuke.Common.Utilities; using static Nuke.Common.Constants; namespace Nuke.Common.Execution { internal class UpdateNotificationAttribute : BuildExtensionAttributeBase, IOnBuildCreated, IOnBuildFinished { public void OnBuildCreated(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets) { if (NukeBuild.IsLocalBuild && ShouldNotify) { Notify(); Logger.Info("Press any key to continue without update..."); Console.ReadKey(); } } public void OnBuildFinished(NukeBuild build) { if (NukeBuild.IsServerBuild && ShouldNotify) Notify(); } private bool ShouldNotify => !Directory.Exists(GetNukeDirectory(NukeBuild.RootDirectory)); private static void Notify() { Logger.Warn( new[] { "--- UPDATE RECOMMENDED FROM 5.1.0 ---", "1. Update your global tool", " dotnet tool update Nuke.GlobalTool -g", "2. Update your build", " nuke :update", "3. Confirm on update for configuration file and build scripts", " (Others are be optional)", string.Empty }.JoinNewLine()); } } }
// Copyright 2021 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.IO; using System.Linq; using Nuke.Common.Utilities; using static Nuke.Common.Constants; namespace Nuke.Common.Execution { internal class UpdateNotificationAttribute : BuildExtensionAttributeBase, IOnBuildCreated, IOnBuildFinished { public void OnBuildCreated(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets) { if (NukeBuild.IsLocalBuild && ShouldNotify) { Notify(); Logger.Info("Press any key to continue..."); Console.ReadKey(); } } public void OnBuildFinished(NukeBuild build) { if (NukeBuild.IsServerBuild && ShouldNotify) Notify(); } private bool ShouldNotify => !Directory.Exists(GetNukeDirectory(NukeBuild.RootDirectory)); private static void Notify() { Logger.Warn( new[] { "--- UPDATE RECOMMENDED FROM 5.1.0 ---", "1. Update your global tool", " dotnet tool update Nuke.GlobalTool -g", "2. Update your build", " nuke :update", "3. Confirm on update for configuration file and build scripts", " (Others are be optional)", string.Empty }.JoinNewLine()); } } }
mit
C#
c9f25e1b621065fa5aa3f855f716c623b7d26192
Build script, no dep on branch for now
danielwertheim/mynatsclient,danielwertheim/mynatsclient
buildconfig.cake
buildconfig.cake
public class BuildConfig { private const string Version = "0.4.0"; private const bool IsPreRelease = true; public readonly string SrcDir = "./src/"; public readonly string OutDir = "./build/"; public string Target { get; private set; } public string SemVer { get; private set; } public string BuildProfile { get; private set; } public bool IsTeamCityBuild { get; private set; } public static BuildConfig Create( ICakeContext context, BuildSystem buildSystem) { if (context == null) throw new ArgumentNullException("context"); var target = context.Argument("target", "Default"); var buildRevision = context.Argument("buildrevision", "0"); return new BuildConfig { Target = target, SemVer = Version + (IsPreRelease ? buildRevision : "-b" + buildRevision), BuildProfile = context.Argument("configuration", "Release"), IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity }; } }
public class BuildConfig { private const string Version = "0.3.0"; public readonly string SrcDir = "./src/"; public readonly string OutDir = "./build/"; public string Target { get; private set; } public string SemVer { get; private set; } public string BuildProfile { get; private set; } public bool IsTeamCityBuild { get; private set; } public static BuildConfig Create( ICakeContext context, BuildSystem buildSystem) { if (context == null) throw new ArgumentNullException("context"); var target = context.Argument("target", "Default"); var branch = context.Argument("branch", string.Empty); var branchIsRelease = branch.ToLower() == "release"; var buildRevision = context.Argument("buildrevision", "0"); return new BuildConfig { Target = target, SemVer = Version + (branchIsRelease ? string.Empty : "-b" + buildRevision), BuildProfile = context.Argument("configuration", "Release"), IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity }; } }
mit
C#
fb575c99e26205957ec50da4530d278e93b41932
Update CubicNoise.cs
jobtalle/CubicNoise,jobtalle/CubicNoise,jobtalle/CubicNoise,jobtalle/CubicNoise,jobtalle/CubicNoise,jobtalle/CubicNoise
c#/CubicNoise.cs
c#/CubicNoise.cs
using System; public sealed class CubicNoise { private static readonly int RND_A = 134775813; private static readonly int RND_B = 1103515245; private int seed; private int octave; private int periodx = int.MaxValue; private int periody = int.MaxValue; public CubicNoise(int seed, int octave, int periodx, int periody) { this.seed = seed; this.octave = octave; this.periodx = periodx; this.periody = periody; } public CubicNoise(int seed, int octave) { this.seed = seed; this.octave = octave; } public float sample(float x) { int xi = (int)Math.Floor(x / octave); float lerp = x / octave - xi; return interpolate( randomize(seed, tile(xi - 1, periodx), 0), randomize(seed, tile(xi, periodx), 0), randomize(seed, tile(xi + 1, periodx), 0), randomize(seed, tile(xi + 2, periodx), 0), lerp) * 0.5f + 0.25f; } public float sample(float x, float y) { int xi = (int)Math.Floor(x / octave); float lerpx = x / octave - xi; int yi = (int)Math.Floor(y / octave); float lerpy = y / octave - yi; float[] xSamples = new float[4]; for (int i = 0; i < 4; ++i) xSamples[i] = interpolate( randomize(seed, tile(xi - 1, periodx), tile(yi - 1 + i, periody)), randomize(seed, tile(xi, periodx), tile(yi - 1 + i, periody)), randomize(seed, tile(xi + 1, periodx), tile(yi - 1 + i, periody)), randomize(seed, tile(xi + 2, periodx), tile(yi - 1 + i, periody)), lerpx); return interpolate(xSamples[0], xSamples[1], xSamples[2], xSamples[3], lerpy) * 0.666666f + 0.166666f; } private static float randomize(int seed, int x, int y) { return (float)((((x ^ y) * RND_A) ^ (seed + x)) * (((RND_B * x) << 16) ^ (RND_B * y) - RND_A)) / int.MaxValue; } private static int tile(int coordinate, int period) { return coordinate % period; } private static float interpolate(float a, float b, float c, float d, float x) { float p = (d - c) - (a - b); return x * (x * (x * p + ((a - b) - p)) + (c - a)) + b; } }
using System; public sealed class CubicNoise { private static readonly int RND_A = 134775813; private static readonly int RND_B = 1103515245; private int seed; private int octave; private int periodx = int.MaxValue; private int periody = int.MaxValue; public CubicNoise(int seed, int octave, int periodx, int periody) { this.seed = seed; this.octave = octave; this.periodx = periodx; this.periody = periody; } public CubicNoise(int seed, int octave) { this.seed = seed; this.octave = octave; } public float sample(float x) { int xi = (int)Math.Floor(x / octave); float lerp = x / octave - xi; return interpolate( randomize(seed, tile(xi - 1, periodx), 0), randomize(seed, tile(xi, periodx), 0), randomize(seed, tile(xi + 1, periodx), 0), randomize(seed, tile(xi + 2, periodx), 0), lerp) * 0.5f + 0.25f; } public float sample(float x, float y) { int xi = (int)Math.Floor(x / octave); float lerpx = x / octave - xi; int yi = (int)Math.Floor(y / octave); float lerpy = y / octave - yi; float[] xSamples = new float[4]; for (int i = 0; i < 4; ++i) xSamples[i] = interpolate( randomize(seed, tile(xi - 1, periodx), tile(yi - 1 + i, periody)), randomize(seed, tile(xi, periodx), tile(yi - 1 + i, periody)), randomize(seed, tile(xi + 1, periodx), tile(yi - 1 + i, periody)), randomize(seed, tile(xi + 2, periodx), tile(yi - 1 + i, periody)), lerpx); return interpolate(xSamples[0], xSamples[1], xSamples[2], xSamples[3], lerpy) * 0.5f + 0.25f; } private static float randomize(int seed, int x, int y) { return (float)((((x ^ y) * RND_A) ^ (seed + x)) * (((RND_B * x) << 16) ^ (RND_B * y) - RND_A)) / int.MaxValue; } private static int tile(int coordinate, int period) { return coordinate % period; } private static float interpolate(float a, float b, float c, float d, float x) { float p = (d - c) - (a - b); return x * (x * (x * p + ((a - b) - p)) + (c - a)) + b; } }
unlicense
C#
a790ef106407499b4ff4b74d7907f8c1f5b26400
Bump to 2.5.0
dreadnought-friends/support-tool,iltar/support-tool
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Dreadnought Community Support Tool")] [assembly: AssemblyDescription("This community made tool gathers information which the Dreadnought Customer Support might ask of you to assist with issues or bug reports.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("support-tool")] [assembly: AssemblyCopyright("Copyright Anyone © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Dreadnought Community Support Tool")] [assembly: AssemblyDescription("This community made tool gathers information which the Dreadnought Customer Support might ask of you to assist with issues or bug reports.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("support-tool")] [assembly: AssemblyCopyright("Copyright Anyone © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.4.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
25f53e980e52be6a7a24bd09c0fd81abb527c395
Fix cast error going from object to int withou casting to long first. Yeah, obvious i know. Sorry Microsoft, won't happen again.
yungtechboy1/MiNET
src/MiNET/MiNET/UI/CustomForm.cs
src/MiNET/MiNET/UI/CustomForm.cs
#region LICENSE // The contents of this file are subject to the Common Public Attribution // License Version 1.0. (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // https://github.com/NiclasOlofsson/MiNET/blob/master/LICENSE. // The License is based on the Mozilla Public License Version 1.1, but Sections 14 // and 15 have been added to cover use of software over a computer network and // provide for limited attribution for the Original Developer. In addition, Exhibit A has // been modified to be consistent with Exhibit B. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for // the specific language governing rights and limitations under the License. // // The Original Code is Niclas Olofsson. // // The Original Developer is the Initial Developer. The Initial Developer of // the Original Code is Niclas Olofsson. // // All portions of the code written by Niclas Olofsson are Copyright (c) 2014-2017 Niclas Olofsson. // All Rights Reserved. #endregion using System; using System.Collections.Generic; using log4net; using Newtonsoft.Json; namespace MiNET.UI { public class CustomForm : Form { private static readonly ILog Log = LogManager.GetLogger(typeof (CustomForm)); public CustomForm() { Type = "custom_form"; } public List<CustomElement> Content { get; set; } public override void FromJson(string json, Player player) { var jsonSerializerSettings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.None, Formatting = Formatting.Indented, }; var parsedResult = JsonConvert.DeserializeObject<List<object>>(json); Log.Debug($"Form JSON\n{JsonConvert.SerializeObject(parsedResult, jsonSerializerSettings)}"); for (var i = 0; i < Content.Count; i++) { var element = Content[i]; if (element is Input) ((Input) element).Default = (string) parsedResult[i]; else if (element is Toggle) ((Toggle) element).Default = (bool) parsedResult[i]; else if (element is Slider) ((Slider) element).Default = (float) parsedResult[i]; else if (element is StepSlider) ((StepSlider) element).Default = (int) (long) parsedResult[i]; else if (element is Dropdown) ((Dropdown) element).Default = (int) (long) parsedResult[i]; } Execute(player); } [JsonIgnore] public Action<Player, CustomForm> ExecuteAction { get; set; } public void Execute(Player player) { ExecuteAction?.Invoke(player, this); } } }
#region LICENSE // The contents of this file are subject to the Common Public Attribution // License Version 1.0. (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // https://github.com/NiclasOlofsson/MiNET/blob/master/LICENSE. // The License is based on the Mozilla Public License Version 1.1, but Sections 14 // and 15 have been added to cover use of software over a computer network and // provide for limited attribution for the Original Developer. In addition, Exhibit A has // been modified to be consistent with Exhibit B. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for // the specific language governing rights and limitations under the License. // // The Original Code is Niclas Olofsson. // // The Original Developer is the Initial Developer. The Initial Developer of // the Original Code is Niclas Olofsson. // // All portions of the code written by Niclas Olofsson are Copyright (c) 2014-2017 Niclas Olofsson. // All Rights Reserved. #endregion using System; using System.Collections.Generic; using log4net; using Newtonsoft.Json; namespace MiNET.UI { public class CustomForm : Form { private static readonly ILog Log = LogManager.GetLogger(typeof (CustomForm)); public CustomForm() { Type = "custom_form"; } public List<CustomElement> Content { get; set; } public override void FromJson(string json, Player player) { var jsonSerializerSettings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.None, Formatting = Formatting.Indented, }; var parsedResult = JsonConvert.DeserializeObject<List<object>>(json); Log.Debug($"Form JSON\n{JsonConvert.SerializeObject(parsedResult, jsonSerializerSettings)}"); for (var i = 0; i < Content.Count; i++) { var element = Content[i]; if (element is Input) ((Input) element).Default = (string) parsedResult[i]; else if (element is Toggle) ((Toggle) element).Default = (bool) parsedResult[i]; else if (element is Slider) ((Slider) element).Default = (float) parsedResult[i]; else if (element is StepSlider) ((StepSlider) element).Default = (int) parsedResult[i]; else if (element is Dropdown) ((Dropdown) element).Default = (int) parsedResult[i]; } Execute(player); } [JsonIgnore] public Action<Player, CustomForm> ExecuteAction { get; set; } public void Execute(Player player) { ExecuteAction?.Invoke(player, this); } } }
mpl-2.0
C#
44af8709a46fa5939187be086c9011085c6cafdd
Add Debug code.
ijufumi/garbage_calendar
garbage_calendar/ViewModels/CalendarPageViewModel.cs
garbage_calendar/ViewModels/CalendarPageViewModel.cs
using System.Diagnostics; using System.Threading.Tasks; using Prism.Commands; using Prism.Mvvm; namespace garbage_calendar.ViewModels { public class CalendarPageViewModel : BindableBase { public CalendarPageViewModel() { Debug.WriteLine("Start CalendarPageViewModel()"); NextMonthClicked = new DelegateCommand<string>( async (T) => await ShowNextMonthAsync(T), T => CanShowNext ).ObservesProperty(() => CanShowNext); PrevMonthClicked = new DelegateCommand<string>( async (T) => await ShowPrevMonthAsync(T), T => CanShowPrev ).ObservesProperty(() => CanShowPrev); CellClicked = new DelegateCommand<int?>( async (T) => await CellClickAsync(T), T => CanCellClick ).ObservesProperty(() => CanCellClick); Debug.WriteLine("End CalendarPageViewModel()"); } public DelegateCommand<string> NextMonthClicked { get; } public DelegateCommand<string> PrevMonthClicked { get; } public DelegateCommand<int?> CellClicked { get; } async Task ShowNextMonthAsync(string month) { } async Task ShowPrevMonthAsync(string month) { } async Task CellClickAsync(int? day) { } private bool CanShowNext => true; private bool CanShowPrev => true; private bool CanCellClick => true; } }
using System.Runtime.CompilerServices; using System.Threading.Tasks; using Prism.Commands; using Prism.Mvvm; namespace garbage_calendar.ViewModels { public class CalendarPageViewModel : BindableBase { public CalendarPageViewModel() { NextMonthClicked = new DelegateCommand<string>( async (T) => await ShowNextMonthAsync(T), T => CanShowNext ).ObservesProperty(() => CanShowNext); PrevMonthClicked = new DelegateCommand<string>( async (T) => await ShowPrevMonthAsync(T), T => CanShowPrev ).ObservesProperty(() => CanShowPrev); CellClicked = new DelegateCommand<int?>( async (T) => await CellClickAsync(T), T => CanCellClick ).ObservesProperty(() => CanCellClick); } public DelegateCommand<string> NextMonthClicked { get; } public DelegateCommand<string> PrevMonthClicked { get; } public DelegateCommand<int?> CellClicked { get; } async Task ShowNextMonthAsync(string month) { } async Task ShowPrevMonthAsync(string month) { } async Task CellClickAsync(int? day) { } private bool CanShowNext => true; private bool CanShowPrev => true; private bool CanCellClick => true; } }
mit
C#
a02adfdbd4efb69dd44d0ed872da398bb8ba09df
Fix crash on super high bpm kiai sections
peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu
osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs
osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Default { public class KiaiFlash : BeatSyncedContainer { private const double fade_length = 80; private const float flash_opacity = 0.25f; public KiaiFlash() { EarlyActivationMilliseconds = 80; Blending = BlendingParameters.Additive; Child = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.White, Alpha = 0f, }; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) { if (!effectPoint.KiaiMode) return; Child .FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint) .Then() .FadeOut(Math.Max(0, timingPoint.BeatLength - fade_length), Easing.OutSine); } } }
// 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.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Default { public class KiaiFlash : BeatSyncedContainer { private const double fade_length = 80; private const float flash_opacity = 0.25f; public KiaiFlash() { EarlyActivationMilliseconds = 80; Blending = BlendingParameters.Additive; Child = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.White, Alpha = 0f, }; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) { if (!effectPoint.KiaiMode) return; Child .FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint) .Then() .FadeOut(timingPoint.BeatLength - fade_length, Easing.OutSine); } } }
mit
C#