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
746c1759e99455a6ced4a32037537a5ffdf6a853
Enable Ability to Change Copy In Non Page Builder Pages
tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS
Portal.CMS.Web/Areas/Admin/Views/CopyManager/_Copy.cshtml
Portal.CMS.Web/Areas/Admin/Views/CopyManager/_Copy.cshtml
@model Portal.CMS.Entities.Entities.Copy.Copy @using Portal.CMS.Web.Areas.Admin.Helpers; @{ Layout = ""; var isAdmin = UserHelper.IsAdmin; } @if (UserHelper.IsAdmin) { <script src="//cdn.tinymce.com/4/tinymce.min.js"></script> <script type="text/javascript"> $(document).ready(function () { tinymce.init({ selector: '.copy-@(Model.CopyId).admin', inline: true, plugins: ['advlist autolink lists link image charmap anchor searchreplace visualblocks code fullscreen media table contextmenu paste'], toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', setup:function(ed) { ed.on('change', function(e) { var dataParams = { "copyId": @Model.CopyId, "copyName": "@Model.CopyName", "copyBody": ed.getContent() }; $.ajax({data: dataParams, type: 'POST', cache: false, url: '/Admin/CopyManager/Inline'}); $('.copy-@(Model.CopyId)').html(ed.getContent()); }); } }); }); </script> } <div class="copy-wrapper"> @if (isAdmin) { <div class="box-title"><span class="fa fa-pencil"></span>@Model.CopyName</div> } <div class="@(UserHelper.IsAdmin ? "admin" : "") copy-@Model.CopyId copy-block"> @Html.Raw(Model.CopyBody) </div> </div>
@model Portal.CMS.Entities.Entities.Copy.Copy @using Portal.CMS.Web.Areas.Admin.Helpers; @{ Layout = ""; var isAdmin = UserHelper.IsAdmin; } @section HEADScripts { @if (UserHelper.IsAdmin) { <script src="//cdn.tinymce.com/4/tinymce.min.js"></script> <script type="text/javascript"> $(document).ready(function () { tinymce.init({ selector: '.copy-@(Model.CopyId).admin', inline: true, plugins: ['advlist autolink lists link image charmap anchor searchreplace visualblocks code fullscreen media table contextmenu paste'], toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', setup:function(ed) { ed.on('change', function(e) { var dataParams = { "copyId": @Model.CopyId, "copyName": "@Model.CopyName", "copyBody": ed.getContent() }; $.ajax({data: dataParams, type: 'POST', cache: false, url: '/Admin/CopyManager/Inline'}); $('.copy-@(Model.CopyId)').html(ed.getContent()); }); } }); }); </script> } } <div class="copy-wrapper"> @if (isAdmin) { <div class="box-title"><span class="fa fa-pencil"></span>@Model.CopyName</div> } <div class="@(UserHelper.IsAdmin ? "admin" : "") copy-@Model.CopyId copy-block"> @Html.Raw(Model.CopyBody) </div> </div>
mit
C#
278a51051898b1a5f63a869c5b875e4dd4450b50
Update for Glenn Sarti
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/GlennSarti.cs
src/Firehose.Web/Authors/GlennSarti.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 GlennSarti : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Glenn"; public string LastName => "Sarti"; public string ShortBioOrTagLine => "is a Senior Software Developer for HashiCorp."; public string StateOrRegion => "Perth WA, Australia"; public string EmailAddress => ""; public string TwitterHandle => "glennsarti"; public string GravatarHash => "aac3dafaab7a7c2063d2526ba5936305"; public Uri WebSite => new Uri("https:/sarti.dev/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://sarti.dev/feed.xml"); } } public string FeedLanguageCode => "en"; public string GitHubHandle => "glennsarti"; public bool Filter(SyndicationItem item) { return item.Categories?.Any(c => c.Name.ToLowerInvariant().Contains("powershell")) ?? false; } public GeoPosition Position => new GeoPosition(-31.9523,115.8613); } }
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 GlennSarti : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Glenn"; public string LastName => "Sarti"; public string ShortBioOrTagLine => "is a Windows Software and Infrastructure Developer for Puppet."; public string StateOrRegion => "Portland OR, USA"; public string EmailAddress => ""; public string TwitterHandle => "glennsarti"; public string GravatarHash => "aac3dafaab7a7c2063d2526ba5936305"; public Uri WebSite => new Uri("https://glennsarti.github.io/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://glennsarti.github.io/feed.xml"); } } public string FeedLanguageCode => "en"; public string GitHubHandle => "glennsarti"; public bool Filter(SyndicationItem item) { return item.Categories?.Any(c => c.Name.ToLowerInvariant().Contains("powershell")) ?? false; } public GeoPosition Position => new GeoPosition(45.5234500,-122.6762100); } }
mit
C#
c7e94042e61102cbce82fca67eb0000d345ef051
add index3, index4
kotikov1994/BlogAdd
TemplateTest1/TemplateTest1/Controllers/HomeController.cs
TemplateTest1/TemplateTest1/Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using TemplateTest1.Models; namespace TemplateTest1.Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { var model = new ArticleModel(); return View( model); } public ActionResult Index1() { var model = new ArticleModel(); return View(model); } public ActionResult Index2() { var model = new ArticleModel(); return View(model); } public ActionResult Index3() { var model = new ArticleModel(); return View(model); } public ActionResult Index4() { var model = new ArticleModel(); return View(model); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using TemplateTest1.Models; namespace TemplateTest1.Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { var model = new ArticleModel(); return View( model); } public ActionResult Index1() { var model = new ArticleModel(); return View(model); } public ActionResult Index2() { var model = new ArticleModel(); return View(model); } } }
mit
C#
d98071b0875e2959b83c99d57562553aef5e0505
fix typo in redeliver extension
phatboyg/MassTransit,MassTransit/MassTransit,MassTransit/MassTransit,phatboyg/MassTransit
src/MassTransit/RedeliverExtensions.cs
src/MassTransit/RedeliverExtensions.cs
namespace MassTransit { using System; using System.Threading.Tasks; using Context; public static class RedeliverExtensions { /// <summary> /// Redeliver uses the message scheduler to deliver the message to the queue at a future /// time. The delivery count is incremented. Moreover, if you give custom callback action, it perform before sending message to queue. /// A message scheduler must be configured on the bus for redelivery to be enabled. /// </summary> /// <typeparam name="T">The message type</typeparam> /// <param name="context">The consume context of the message</param> /// <param name="delay"> /// The delay before the message is delivered. It may take longer to receive the message if the queue is not empty. /// </param> /// <param name="callback">Operation which is executed before the message is delivered.</param> /// <returns></returns> public static Task Redeliver<T>(this ConsumeContext<T> context, TimeSpan delay, Action<ConsumeContext, SendContext> callback = null) where T : class { MessageRedeliveryContext redeliverContext = new ScheduleMessageRedeliveryContext<T>(context); return redeliverContext.ScheduleRedelivery(delay, callback); } } }
namespace MassTransit { using System; using System.Threading.Tasks; using Context; public static class RedeliverExtensions { /// <summary> /// Redeliver uses the message scheduler to deliver the message to the queue at a future /// time. The delivery count is incremented. Moreover, if you give custom callback action, it perform before sending message to queueu. /// A message scheduler must be configured on the bus for redelivery to be enabled. /// </summary> /// <typeparam name="T">The message type</typeparam> /// <param name="context">The consume context of the message</param> /// <param name="delay"> /// The delay before the message is delivered. It may take longer to receive the message if the queue is not empty. /// </param> /// <param name="callback">Operation which is executed before the message is delivered.</param> /// <returns></returns> public static Task Redeliver<T>(this ConsumeContext<T> context, TimeSpan delay, Action<ConsumeContext, SendContext> callback = null) where T : class { MessageRedeliveryContext redeliverContext = new ScheduleMessageRedeliveryContext<T>(context); return redeliverContext.ScheduleRedelivery(delay, callback); } } }
apache-2.0
C#
be5a68d9feaee6410dcd6a8918c2326a1c0b66dc
Set public methods to internal
rotorgames/Rg.Plugins.Popup,rotorgames/Rg.Plugins.Popup
src/Stubs/Rg.Plugins.Popup.Platform.cs
src/Stubs/Rg.Plugins.Popup.Platform.cs
using System; #if __ANDROID__ using Rg.Plugins.Popup.Droid.Renderers; #elif __IOS__ using Rg.Plugins.Popup.IOS.Renderers; using Rg.Plugins.Popup.IOS.Impl; #endif using Xamarin.Forms; namespace Rg.Plugins.Popup.Platform.Renderers { internal static class Loader { public static void Load() { #if __IOS__ new PopupNavigationIOS(); new ScreenHelperIos(); #endif } } #if !__PLATFORM_PCL__ [RenderWith(typeof(PopupPageRenderer))] #endif internal class _PopupPageRenderer { } }
using System; #if __ANDROID__ using Rg.Plugins.Popup.Droid.Renderers; #elif __IOS__ using Rg.Plugins.Popup.IOS.Renderers; using Rg.Plugins.Popup.IOS.Impl; #endif using Xamarin.Forms; namespace Rg.Plugins.Popup.Platform.Renderers { public static class Loader { public static void Load() { #if __IOS__ new PopupNavigationIOS(); new ScreenHelperIos(); #endif } } #if !__PLATFORM_PCL__ [RenderWith(typeof(PopupPageRenderer))] #endif public class _PopupPageRenderer { } }
mit
C#
37d4dd9be181d64eef9a1f9157e95f9269e0871c
Add option to set app name
skwasjer/SilentHunter
src/SilentHunter.Controllers.Compiler/DependencyInjection/ControllerConfigurerExtensions.cs
src/SilentHunter.Controllers.Compiler/DependencyInjection/ControllerConfigurerExtensions.cs
using System; using System.Reflection; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using SilentHunter.FileFormats.Dat.Controllers; using SilentHunter.FileFormats.DependencyInjection; namespace SilentHunter.Controllers.Compiler.DependencyInjection { public static class ControllerConfigurerExtensions { public static SilentHunterParsersConfigurer CompileFrom(this ControllerConfigurer controllerConfigurer, string controllerPath, string assemblyName = null, string applicationName = null, Func<string, bool> ignorePaths = null, params string[] dependencySearchPaths) { AddCSharpCompiler(controllerConfigurer); return controllerConfigurer.FromAssembly(s => { Assembly entryAssembly = Assembly.GetEntryAssembly(); string appName = applicationName ?? entryAssembly?.GetName().Name ?? "SilentHunter.Controllers"; var assemblyCompiler = new ControllerAssemblyCompiler(s.GetRequiredService<ICSharpCompiler>(), appName, controllerPath) { AssemblyName = assemblyName, IgnorePaths = ignorePaths, DependencySearchPaths = dependencySearchPaths }; return new ControllerAssembly(assemblyCompiler.Compile()); }); } private static void AddCSharpCompiler(IServiceCollectionProvider controllerConfigurer) { IServiceCollection services = controllerConfigurer.ServiceCollection; #if NETFRAMEWORK services.TryAddTransient<ICSharpCompiler, CSharpCompiler>(); #else services.TryAddTransient<ICSharpCompiler, RoslynCompiler>(); #endif } } }
using System; using System.Reflection; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using SilentHunter.FileFormats.Dat.Controllers; using SilentHunter.FileFormats.DependencyInjection; namespace SilentHunter.Controllers.Compiler.DependencyInjection { public static class ControllerConfigurerExtensions { public static SilentHunterParsersConfigurer CompileFrom(this ControllerConfigurer controllerConfigurer, string controllerPath, string assemblyName = null, Func<string, bool> ignorePaths = null, params string[] dependencySearchPaths) { AddCSharpCompiler(controllerConfigurer); return controllerConfigurer.FromAssembly(s => { Assembly entryAssembly = Assembly.GetEntryAssembly(); string applicationName = entryAssembly?.GetName().Name ?? "SilentHunter.Controllers"; var assemblyCompiler = new ControllerAssemblyCompiler(s.GetRequiredService<ICSharpCompiler>(), applicationName, controllerPath) { AssemblyName = assemblyName, IgnorePaths = ignorePaths, DependencySearchPaths = dependencySearchPaths }; return new ControllerAssembly(assemblyCompiler.Compile()); }); } private static void AddCSharpCompiler(IServiceCollectionProvider controllerConfigurer) { IServiceCollection services = controllerConfigurer.ServiceCollection; #if NETFRAMEWORK services.TryAddTransient<ICSharpCompiler, CSharpCompiler>(); #else services.TryAddTransient<ICSharpCompiler, RoslynCompiler>(); #endif } } }
apache-2.0
C#
b99b381cbaa8cc98807c26c1c272d4eb361219e1
Remove AssemblyLanguage attribute
Ravatsaas/PowerManagerAPI
PowerManagerAPI/Properties/AssemblyInfo.cs
PowerManagerAPI/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("PowerManagerAPI")] [assembly: AssemblyDescription("A managed wrapper for the most important functions in the Windows Power Management API (powrprof.dll)")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Binary Poetry LLC")] [assembly: AssemblyProduct("PowerManagement.ApiWrapper")] [assembly: AssemblyCopyright("Copyright © 2017 Ruben Ravatsaas, Binary Poetry LLC")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("11d90b11-3c6e-4c27-ac3e-f4a84b992628")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("PowerManagerAPI")] [assembly: AssemblyDescription("A managed wrapper for the most important functions in the Windows Power Management API (powrprof.dll)")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Binary Poetry LLC")] [assembly: AssemblyProduct("PowerManagement.ApiWrapper")] [assembly: AssemblyCopyright("Copyright © 2017 Ruben Ravatsaas, Binary Poetry LLC")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("en-US")] [assembly: ComVisible(false)] [assembly: Guid("11d90b11-3c6e-4c27-ac3e-f4a84b992628")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]
mit
C#
04396b75cd7613cc9102859576bf4422e05aea9c
Update InterlockedImpl.cs
CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos
source/Cosmos.Core_Plugs/System/Threading/InterlockedImpl.cs
source/Cosmos.Core_Plugs/System/Threading/InterlockedImpl.cs
using System.Threading; using IL2CPU.API.Attribs; namespace Cosmos.Core_Plugs.System.Threading { [Plug(Target = typeof(Interlocked))] public static class InterlockedImpl { public static int Decrement(ref int aData) { return aData -= 1; } public static int Increment(ref int aData) { return aData += 1; } } }
using System.Threading; using IL2CPU.API.Attribs; namespace Cosmos.Core_Plugs.System.Threading { [Plug(Target = typeof(Interlocked))] public static class InterlockedImpl { public static int Decrement(ref int aData) { return aData -= 1; } } }
bsd-3-clause
C#
83d9641b02f60be1b44fb793c76aa241c4dbff3a
Add Read and Write methods
Figglewatts/LSDStay
LSDStay/PSX.cs
LSDStay/PSX.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace LSDStay { public static class PSX { public static Process PSXProcess; public static IntPtr PSXHandle; public static bool FindPSX() { PSXProcess = Process.GetProcessesByName("psxfin").FirstOrDefault(); return (PSXProcess != null); } public static bool OpenPSX() { int PID = PSXProcess.Id; PSXHandle = Memory.OpenProcess((uint)Memory.ProcessAccessFlags.All, false, PID); return (PSXHandle != null); } public static void ClosePSX(IntPtr processHandle) { int result = Memory.CloseHandle(processHandle); if (result == 0) { Console.WriteLine("ERROR: Could not close psx handle"); } } public static string Read(IntPtr address, ref byte[] buffer) { int bytesRead = 0; int absoluteAddress = Memory.PSXGameOffset + (int)address; //IntPtr absoluteAddressPtr = new IntPtr(absoluteAddress); Memory.ReadProcessMemory((int)PSXHandle, absoluteAddress, buffer, buffer.Length, ref bytesRead); return "Address " + address.ToString("x2") + " contains " + Memory.FormatToHexString(buffer); } public static string Write(IntPtr address, byte[] data) { int bytesWritten; int absoluteAddress = Memory.PSXGameOffset + (int)address; IntPtr absoluteAddressPtr = new IntPtr(absoluteAddress); Memory.WriteProcessMemory(PSXHandle, absoluteAddressPtr, data, (uint)data.Length, out bytesWritten); return "Address " + address.ToString("x2") + " is now " + Memory.FormatToHexString(data); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace LSDStay { public static class PSX { public static Process FindPSX() { Process psx = Process.GetProcessesByName("psxfin").FirstOrDefault(); return psx; } public static IntPtr OpenPSX(Process psx) { int PID = psx.Id; IntPtr psxHandle = Memory.OpenProcess((uint)Memory.ProcessAccessFlags.All, false, PID); } public static void ClosePSX(IntPtr processHandle) { int result = Memory.CloseHandle(processHandle); if (result == 0) { Console.WriteLine("ERROR: Could not close psx handle"); } } } }
mit
C#
fb04f2c639b28080132d15c6d9b841a931dd0fc5
Fix Size test using explicit conversions for assertions
discosultan/VulkanCore
Tests/SizeTest.cs
Tests/SizeTest.cs
using Xunit; namespace VulkanCore.Tests { public class SizeTest { [Fact] public void ImplicitConversions() { const int intVal = 1; const long longVal = 2; Size intSize = intVal; Size longSize = longVal; Assert.Equal(intVal, (int)intSize); Assert.Equal(longVal, (long)longSize); } } }
using Xunit; namespace VulkanCore.Tests { public class SizeTest { [Fact] public void ImplicitConversions() { const int intVal = 1; const long longVal = 2; Size intSize = intVal; Size longSize = longVal; Assert.Equal(intVal, intSize); Assert.Equal(longVal, longSize); } } }
mit
C#
364738e5a0ba7a6ce3a05b2d5f70d038343c5837
Add explanatory comment to drag component
andrew-vant/dragalt
dragnavball.cs
dragnavball.cs
using KSP.UI.Screens.Flight; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; [KSPAddon(KSPAddon.Startup.Flight, false)] public class NavBallAttacher : MonoBehaviour { void Start() { print("Starting draggable navball"); // We want to drag the navball's frame around. The frame is // the grandparent of the ball itself. GameObject ball = FindObjectOfType<NavBall>().gameObject; GameObject frame = ball.transform.parent.gameObject.transform.parent.gameObject; frame.AddComponent<NavBallDrag>(); } } public class NavBallDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler { float ptrstart; float ballstart; /* This component makes the navball draggable. It works by recording * the pointer and ball's position when a drag starts, then moving the * ball however far the pointer moved along the X axis. * * Simply setting the ball to the pointer's position doesn't work; the * pointer and ball have different coordinate origins. The pointer's * X:0 is the left edge of the screen; The ball's X:0 is the center. * * Restricting movement to the X axis makes the ball frame slide along * the bottom edge of the screen. */ public void OnBeginDrag(PointerEventData evtdata) { print("Navball drag start"); print(transform.position); ptrstart = evtdata.position.x; ballstart = transform.position.x; } public void OnDrag(PointerEventData evtdata) { float x = ballstart + (evtdata.position.x - ptrstart); float y = transform.position.y; float z = transform.position.z; transform.position = new Vector3(x, y, z); print(transform.position); } public void OnEndDrag(PointerEventData evtdata) { print("Drag finished"); print(transform.position); } public void OnDrop(PointerEventData evtdata) { print("Navball dropped"); print(transform.position); } }
using KSP.UI.Screens.Flight; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; [KSPAddon(KSPAddon.Startup.Flight, false)] public class NavBallAttacher : MonoBehaviour { void Start() { print("Starting draggable navball"); // We want to drag the navball's frame around. The frame is // the grandparent of the ball itself. GameObject ball = FindObjectOfType<NavBall>().gameObject; GameObject frame = ball.transform.parent.gameObject.transform.parent.gameObject; frame.AddComponent<NavBallDrag>(); } } public class NavBallDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler { float ptrstart; float ballstart; public void OnBeginDrag(PointerEventData evtdata) { print("Navball drag start"); print(transform.position); ptrstart = evtdata.position.x; ballstart = transform.position.x; } public void OnDrag(PointerEventData evtdata) { float x = ballstart + (evtdata.position.x - ptrstart); float y = transform.position.y; float z = transform.position.z; transform.position = new Vector3(x, y, z); print(transform.position); } public void OnEndDrag(PointerEventData evtdata) { print("Drag finished"); print(transform.position); } public void OnDrop(PointerEventData evtdata) { print("Navball dropped"); print(transform.position); } }
mit
C#
72ac3c280fe4d03a576ef05c9d171b4e16c6f4ea
Update Program.cs
versionone/api-examples,versionone/api-examples
csharp/ApiDemo/ApiDemo/Program.cs
csharp/ApiDemo/ApiDemo/Program.cs
using System; using VersionOne.SDK.APIClient; namespace ApiDemo { class Program { const string BASE_URL = "https://www14.v1host.com/v1sdktesting"; private const string SecretsFile = @"C:\Users\mheffel\Documents\GitHub\api-examples\csharp\ApiDemo\client_secrets.json"; private const string CredsFile = @"C:\Users\mheffel\Documents\GitHub\api-examples\csharp\ApiDemo\stored_credentials.json"; static void Main(string[] args) { var dataConnector = new VersionOneAPIConnector(BASE_URL + "/rest-1.v1/").WithOAuth2(SecretsFile, CredsFile); var metaConnector = new VersionOneAPIConnector(BASE_URL + "/meta.v1/"); var metaModel = new MetaModel(metaConnector); var services = new Services(metaModel, dataConnector); var scopeType = metaModel.GetAssetType("Member"); var nameAttr = scopeType.GetAttributeDefinition("Name"); var descAttr = scopeType.GetAttributeDefinition("Nickname"); var worksItemsNameAttr = scopeType.GetAttributeDefinition("OwnedWorkitems.Name"); var query = new Query(scopeType); var whereAdmin = new FilterTerm(descAttr); whereAdmin.Equal("admin"); var whereNotTheAdmin = new FilterTerm(nameAttr); whereNotTheAdmin.NotEqual("theAdmin"); var andFilter = new AndFilterTerm(whereAdmin, whereNotTheAdmin); query.Filter = andFilter; query.Selection.AddRange(new[] { nameAttr, descAttr, worksItemsNameAttr }); var result = services.Retrieve(query); foreach (var asset in result.Assets) { Console.WriteLine("Name: " + asset.GetAttribute(nameAttr).Value); Console.WriteLine("Description: " + asset.GetAttribute(descAttr).Value); var workItems = asset.GetAttribute(worksItemsNameAttr).ValuesList; Console.WriteLine("Workitems count: " + workItems.Count); foreach (var workitem in workItems) { Console.WriteLine("Workitem: " + workitem); } } Console.ReadLine(); } } }
using System; using VersionOne.SDK.APIClient; namespace ApiDemo { class Program { const string BASE_URL = "https://www14.v1host.com/v1sdktesting"; private const string SecretsFile = @"C:\Users\mheffel\Documents\GitHub\api-examples\csharp\ApiDemo\client_secrets.json"; private const string CredsFile = @"C:\Users\mheffel\Documents\GitHub\api-examples\csharp\ApiDemo\stored_credentials.json"; static void Main(string[] args) { var storage = new OAuth2Client.Storage.JsonFileStorage(SecretsFile, CredsFile); var dataConnector = new VersionOneAPIConnector(BASE_URL + "/rest-1.v1/").WithOAuth2(SecretsFile, CredsFile); var metaConnector = new VersionOneAPIConnector(BASE_URL + "/meta.v1/"); var metaModel = new MetaModel(metaConnector); var services = new Services(metaModel, dataConnector); var scopeType = metaModel.GetAssetType("Member"); var nameAttr = scopeType.GetAttributeDefinition("Name"); var descAttr = scopeType.GetAttributeDefinition("Nickname"); var worksItemsNameAttr = scopeType.GetAttributeDefinition("OwnedWorkitems.Name"); var query = new Query(scopeType); var whereAdmin = new FilterTerm(descAttr); whereAdmin.Equal("admin"); var whereNotTheAdmin = new FilterTerm(nameAttr); whereNotTheAdmin.NotEqual("theAdmin"); var andFilter = new AndFilterTerm(whereAdmin, whereNotTheAdmin); query.Filter = andFilter; query.Selection.AddRange(new[] { nameAttr, descAttr, worksItemsNameAttr }); var result = services.Retrieve(query); foreach (var asset in result.Assets) { Console.WriteLine("Name: " + asset.GetAttribute(nameAttr).Value); Console.WriteLine("Description: " + asset.GetAttribute(descAttr).Value); var workItems = asset.GetAttribute(worksItemsNameAttr).ValuesList; Console.WriteLine("Workitems count: " + workItems.Count); foreach (var workitem in workItems) { Console.WriteLine("Workitem: " + workitem); } } Console.ReadLine(); } } }
mit
C#
6655f73bdb422c1c3b9c36973c04de0660870186
Replace double quote in KeyVaultSecretManager class summary (#14622)
brjohnstmsft/azure-sdk-for-net,markcowl/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net
sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/KeyVaultSecretManager.cs
sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/KeyVaultSecretManager.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Azure.Security.KeyVault.Secrets; using Microsoft.Extensions.Configuration; namespace Azure.Extensions.AspNetCore.Configuration.Secrets { /// <summary> /// Default implementation of <see cref="KeyVaultSecretManager"/> that loads all secrets /// and replaces '--' with ':' in key names. /// </summary> public class KeyVaultSecretManager { internal static KeyVaultSecretManager Instance { get; } = new KeyVaultSecretManager(); /// <summary> /// Checks if <see cref="KeyVaultSecret"/> value should be retrieved. /// </summary> /// <param name="secret">The <see cref="KeyVaultSecret"/> instance.</param> /// <returns><code>true</code> if secrets value should be loaded, otherwise <code>false</code>.</returns> public virtual string GetKey(KeyVaultSecret secret) { return secret.Name.Replace("--", ConfigurationPath.KeyDelimiter); } /// <summary> /// Maps secret to a configuration key. /// </summary> /// <param name="secret">The <see cref="KeyVaultSecret"/> instance.</param> /// <returns>Configuration key name to store secret value.</returns> public virtual bool Load(SecretProperties secret) { return true; } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Azure.Security.KeyVault.Secrets; using Microsoft.Extensions.Configuration; namespace Azure.Extensions.AspNetCore.Configuration.Secrets { /// <summary> /// Default implementation of <see cref="KeyVaultSecretManager"/> that loads all secrets /// and replaces '--' with ':" in key names. /// </summary> public class KeyVaultSecretManager { internal static KeyVaultSecretManager Instance { get; } = new KeyVaultSecretManager(); /// <summary> /// Checks if <see cref="KeyVaultSecret"/> value should be retrieved. /// </summary> /// <param name="secret">The <see cref="KeyVaultSecret"/> instance.</param> /// <returns><code>true</code> if secrets value should be loaded, otherwise <code>false</code>.</returns> public virtual string GetKey(KeyVaultSecret secret) { return secret.Name.Replace("--", ConfigurationPath.KeyDelimiter); } /// <summary> /// Maps secret to a configuration key. /// </summary> /// <param name="secret">The <see cref="KeyVaultSecret"/> instance.</param> /// <returns>Configuration key name to store secret value.</returns> public virtual bool Load(SecretProperties secret) { return true; } } }
mit
C#
1a45f68f7d3f294123b1a8efe4af4179450b57f1
Fix interface inheritance, a VM node is not a cloud node (#239)
GoogleCloudPlatform/iap-desktop,GoogleCloudPlatform/iap-desktop
sources/Google.Solutions.IapDesktop.Application/Views/ProjectExplorer/IProjectExplorerNode.cs
sources/Google.Solutions.IapDesktop.Application/Views/ProjectExplorer/IProjectExplorerNode.cs
// // Copyright 2020 Google LLC // // 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 Google.Solutions.Common.Locator; using Google.Solutions.IapDesktop.Application.Views.ConnectionSettings; using System.Collections.Generic; namespace Google.Solutions.IapDesktop.Application.Views.ProjectExplorer { public interface IProjectExplorerNode { string DisplayName { get; } } public interface IProjectExplorerCloudNode : IProjectExplorerNode { } public interface IProjectExplorerNodeWithSettings : IProjectExplorerNode { ConnectionSettingsEditor SettingsEditor { get; } } public interface IProjectExplorerProjectNode : IProjectExplorerNode, IProjectExplorerNodeWithSettings { string ProjectId { get; } IEnumerable<IProjectExplorerZoneNode> Zones { get; } } public interface IProjectExplorerZoneNode : IProjectExplorerNode, IProjectExplorerNodeWithSettings { string ProjectId { get; } string ZoneId { get; } IEnumerable<IProjectExplorerVmInstanceNode> Instances { get; } } public interface IProjectExplorerVmInstanceNode : IProjectExplorerNode, IProjectExplorerNodeWithSettings { ulong InstanceId { get; } string ProjectId { get; } string ZoneId { get; } string InstanceName { get; } InstanceLocator Reference { get; } bool IsRunning { get; } bool IsConnected { get; } void Select(); } }
// // Copyright 2020 Google LLC // // 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 Google.Solutions.Common.Locator; using Google.Solutions.IapDesktop.Application.Views.ConnectionSettings; using System.Collections.Generic; namespace Google.Solutions.IapDesktop.Application.Views.ProjectExplorer { public interface IProjectExplorerNode { string DisplayName { get; } } public interface IProjectExplorerCloudNode : IProjectExplorerNode { } public interface IProjectExplorerNodeWithSettings : IProjectExplorerCloudNode { ConnectionSettingsEditor SettingsEditor { get; } } public interface IProjectExplorerProjectNode : IProjectExplorerNode, IProjectExplorerNodeWithSettings { string ProjectId { get; } IEnumerable<IProjectExplorerZoneNode> Zones { get; } } public interface IProjectExplorerZoneNode : IProjectExplorerNode, IProjectExplorerNodeWithSettings { string ProjectId { get; } string ZoneId { get; } IEnumerable<IProjectExplorerVmInstanceNode> Instances { get; } } public interface IProjectExplorerVmInstanceNode : IProjectExplorerNode, IProjectExplorerNodeWithSettings { ulong InstanceId { get; } string ProjectId { get; } string ZoneId { get; } string InstanceName { get; } InstanceLocator Reference { get; } bool IsRunning { get; } bool IsConnected { get; } void Select(); } }
apache-2.0
C#
ceace26de5259bbd93278d763772775e0b534048
Rollback private set
elmahio/elmah.io.apps
Elmah.Io.Apps/Manifest/VariableBase.cs
Elmah.Io.Apps/Manifest/VariableBase.cs
namespace Elmah.Io.Apps.Manifest { public abstract class VariableBase : IVariable { protected VariableBase(VariableType type) { Type = type; } public VariableType Type { get; private set; } public string Key { get; set; } public string Name { get; set; } public string Description { get; set; } public bool Required { get; set; } } }
namespace Elmah.Io.Apps.Manifest { public abstract class VariableBase : IVariable { protected VariableBase(VariableType type) { Type = type; } public VariableType Type { get; } public string Key { get; set; } public string Name { get; set; } public string Description { get; set; } public bool Required { get; set; } } }
apache-2.0
C#
02b8f891edf66c0f7f987a55c03a0c3aac018e96
Reformat code
MarcinHoppe/AspNet.WebApi.Security.Samples
Filters/Filters/AuthorizationFilter.cs
Filters/Filters/AuthorizationFilter.cs
using System; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web.Http.Controllers; using System.Web.Http.Filters; namespace Filters { public class AuthorizationFilter : IAuthorizationFilter { public bool AllowMultiple => false; public Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync( HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation) { if (actionContext.RequestContext.Principal == null) { var unauthorizedResponse = actionContext.Request.CreateErrorResponse( HttpStatusCode.Unauthorized, "Add Login and Role headers."); return Task.FromResult(unauthorizedResponse); } if (actionContext.RequestContext.Principal.IsInRole("reader")) { return continuation(); } var forbiddenResponse = actionContext.Request.CreateErrorResponse( HttpStatusCode.Forbidden, "Only users in the `reader` role are authorized."); return Task.FromResult(forbiddenResponse); } } }
using System; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web.Http.Controllers; using System.Web.Http.Filters; namespace Filters { public class AuthorizationFilter : IAuthorizationFilter { public bool AllowMultiple => false; public Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync( HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation) { if (actionContext.RequestContext.Principal == null) { var response = actionContext.Request.CreateErrorResponse( HttpStatusCode.Unauthorized, "Add Login and Role headers."); return Task.FromResult(response); } if (actionContext.RequestContext.Principal.IsInRole("reader")) { return continuation(); } { var response = actionContext.Request.CreateErrorResponse( HttpStatusCode.Forbidden, "Only users in the `reader` role are authorized."); return Task.FromResult(response); } } } }
mit
C#
759ada53c0eee8c9384a4c05aa4c815c3a388d37
Fix artist details rendering
Clancey/gMusic,Clancey/gMusic
MusicPlayer.iOS/ViewControllers/ArtistDetailViewController.cs
MusicPlayer.iOS/ViewControllers/ArtistDetailViewController.cs
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Localizations; using MusicPlayer.Models; using MusicPlayer.ViewModels; using UIKit; using MusicPlayer.Data; namespace MusicPlayer.iOS.ViewControllers { internal class ArtistDetailViewController : TopTabBarController { //ArtistAlbumsViewModel model; ArtistAlbumsViewController albumsController; OnlineArtistDetailsViewController onlineController; public Artist Artist { set { Title = value.Name; SetupViewControllers(value); } } public void SetupViewControllers(Artist artist) { var onlineArtist = artist as OnlineArtist; if (onlineArtist != null) { ViewControllers = new[] { onlineController = new OnlineArtistDetailsViewController { Artist = artist, Title= Strings.Online, }, }; return; } var vcs = new List<UIViewController>(); vcs.Add(albumsController = new ArtistAlbumsViewController { Artist = artist, Title = Strings.Albums }); vcs.Add(new ArtistSongsViewController { Artist = artist, Title = Strings.Songs }); if (!Settings.DisableAllAccess) { vcs.Add (onlineController = new OnlineArtistDetailsViewController { Artist = artist, Title = Strings.Online, }); } ViewControllers = vcs.ToArray(); } //public override void LoadView() //{ // base.LoadView(); // TableView.Source = model; //} public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if(albumsController != null) albumsController.AlbumSelected = (a) => { NavigationController.PushViewController(new AlbumDetailsViewController { Album = a }, true); }; } public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); if(albumsController != null) albumsController.AlbumSelected = null; } public override void ViewSafeAreaInsetsDidChange() { base.ViewSafeAreaInsetsDidChange(); TopOffset = View.GetSafeArea().Top; } } }
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Localizations; using MusicPlayer.Models; using MusicPlayer.ViewModels; using UIKit; using MusicPlayer.Data; namespace MusicPlayer.iOS.ViewControllers { internal class ArtistDetailViewController : TopTabBarController { //ArtistAlbumsViewModel model; ArtistAlbumsViewController albumsController; OnlineArtistDetailsViewController onlineController; public ArtistDetailViewController() { HeaderHeight = 44; } public Artist Artist { set { Title = value.Name; SetupViewControllers(value); } } public void SetupViewControllers(Artist artist) { var onlineArtist = artist as OnlineArtist; if (onlineArtist != null) { ViewControllers = new[] { onlineController = new OnlineArtistDetailsViewController { Artist = artist, Title= Strings.Online, }, }; return; } var vcs = new List<UIViewController>(); vcs.Add(albumsController = new ArtistAlbumsViewController { Artist = artist, Title = Strings.Albums }); vcs.Add(new ArtistSongsViewController { Artist = artist, Title = Strings.Songs }); if (!Settings.DisableAllAccess) { vcs.Add (onlineController = new OnlineArtistDetailsViewController { Artist = artist, Title = Strings.Online, }); } ViewControllers = vcs.ToArray(); } //public override void LoadView() //{ // base.LoadView(); // TableView.Source = model; //} public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if(albumsController != null) albumsController.AlbumSelected = (a) => { NavigationController.PushViewController(new AlbumDetailsViewController { Album = a }, true); }; } public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); if(albumsController != null) albumsController.AlbumSelected = null; } } }
apache-2.0
C#
d1fb4bdfda1927ea230f08f0a977c30a3ee43fe2
Debug build
shortlegstudio/silverneedle-web,shortlegstudio/silverneedle-web,shortlegstudio/silverneedle-web
SilverNeedle/lib/Actions/CharacterGenerator/StartingWealth.cs
SilverNeedle/lib/Actions/CharacterGenerator/StartingWealth.cs
// Copyright (c) 2017 Trevor Redfern // // This software is released under the MIT License. // https://opensource.org/licenses/MIT namespace SilverNeedle.Actions.CharacterGenerator { using System.Linq; using SilverNeedle.Characters; using SilverNeedle.Utility; /// <summary> /// Hit point generator rolls hitpoints for a character /// </summary> public class StartingWealth : ICharacterDesignStep { private EntityGateway<CharacterWealth> wealthGateway; public StartingWealth(EntityGateway<CharacterWealth> wealthGateway) { this.wealthGateway = wealthGateway; } public StartingWealth() { this.wealthGateway = GatewayProvider.Get<CharacterWealth>(); } public void Process(CharacterSheet character, CharacterBuildStrategy strategy) { if(character.Level > 1) { UseStartingWealthTable(character); } else { UseClassWealth(character); } } private void UseStartingWealthTable(CharacterSheet character) { var table = wealthGateway.Find("adventurer"); var wealth = table.Levels.First(x => x.Level == character.Level); character.Inventory.CoinPurse.SetValue(wealth.Value); } private void UseClassWealth(CharacterSheet character) { ShortLog.Debug("Starting Wealth"); ShortLog.DebugFormat("Class: {0}", character.Class.Name); if (character.Class.StartingWealthDice != null) { var value = character.Class.StartingWealthDice.Roll() * 10; character.Inventory.CoinPurse.AddGold(value); } } } }
// Copyright (c) 2017 Trevor Redfern // // This software is released under the MIT License. // https://opensource.org/licenses/MIT namespace SilverNeedle.Actions.CharacterGenerator { using System.Linq; using SilverNeedle.Characters; using SilverNeedle.Utility; /// <summary> /// Hit point generator rolls hitpoints for a character /// </summary> public class StartingWealth : ICharacterDesignStep { private EntityGateway<CharacterWealth> wealthGateway; public StartingWealth(EntityGateway<CharacterWealth> wealthGateway) { this.wealthGateway = wealthGateway; } public StartingWealth() { this.wealthGateway = GatewayProvider.Get<CharacterWealth>(); } public void Process(CharacterSheet character, CharacterBuildStrategy strategy) { if(character.Level > 1) { UseStartingWealthTable(character); } else { UseClassWealth(character); } } private void UseStartingWealthTable(CharacterSheet character) { var table = wealthGateway.Find("adventurer"); var wealth = table.Levels.First(x => x.Level == character.Level); character.Inventory.CoinPurse.SetValue(wealth.Value); } private void UseClassWealth(CharacterSheet character) { if (character.Class.StartingWealthDice != null) { var value = character.Class.StartingWealthDice.Roll() * 10; character.Inventory.CoinPurse.AddGold(value); } } } }
mit
C#
e061e3c25d9891388571e972c50a599aca9e6c92
Remove unused usings
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
src/LondonTravel.Site/Identity/Amazon/AmazonExtensions.cs
src/LondonTravel.Site/Identity/Amazon/AmazonExtensions.cs
// Copyright (c) Martin Costello, 2017. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.LondonTravel.Site.Identity.Amazon { using System; using Microsoft.AspNetCore.Authentication; using Microsoft.Extensions.DependencyInjection; /// <summary> /// Extension methods to add Amazon authentication. /// </summary> public static class AmazonExtensions { public static AuthenticationBuilder AddAmazon(this AuthenticationBuilder builder, Action<AmazonOptions> configureOptions) => builder.AddAmazon(AmazonDefaults.AuthenticationScheme, configureOptions); public static AuthenticationBuilder AddAmazon(this AuthenticationBuilder builder, string authenticationScheme, Action<AmazonOptions> configureOptions) => builder.AddAmazon(authenticationScheme, AmazonDefaults.DisplayName, configureOptions); public static AuthenticationBuilder AddAmazon(this AuthenticationBuilder builder, string authenticationScheme, string displayName, Action<AmazonOptions> configureOptions) => builder.AddOAuth<AmazonOptions, AmazonHandler>(authenticationScheme, displayName, configureOptions); } }
// Copyright (c) Martin Costello, 2017. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.LondonTravel.Site.Identity.Amazon { using System; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; /// <summary> /// Extension methods to add Amazon authentication. /// </summary> public static class AmazonExtensions { public static AuthenticationBuilder AddAmazon(this AuthenticationBuilder builder, Action<AmazonOptions> configureOptions) => builder.AddAmazon(AmazonDefaults.AuthenticationScheme, configureOptions); public static AuthenticationBuilder AddAmazon(this AuthenticationBuilder builder, string authenticationScheme, Action<AmazonOptions> configureOptions) => builder.AddAmazon(authenticationScheme, AmazonDefaults.DisplayName, configureOptions); public static AuthenticationBuilder AddAmazon(this AuthenticationBuilder builder, string authenticationScheme, string displayName, Action<AmazonOptions> configureOptions) => builder.AddOAuth<AmazonOptions, AmazonHandler>(authenticationScheme, displayName, configureOptions); } }
apache-2.0
C#
8b653a4cfbefef07098b81dce5d97abd72c38b7f
Update Rte.cshtml
leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,umbraco/Umbraco-CMS,madsoulswe/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS
src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Rte.cshtml
src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Rte.cshtml
@model dynamic @using Umbraco.Web.Composing @using Umbraco.Web.Templates @{ var _htmlLocalLinkParser = Current.Factory.GetInstance<HtmlLocalLinkParser>(); var _htmlUrlParser = Current.Factory.GetInstance<HtmlUrlParser>(); var _htmlImageSourceParser = Current.Factory.GetInstance<HtmlImageSourceParser>(); var value = _htmlLocalLinkParser.EnsureInternalLinks(Model.value.ToString()); value = _htmlUrlParser.EnsureUrls(value); value = _htmlImageSourceParser.EnsureImageSources(value); } @Html.Raw(value)
@model dynamic @using Umbraco.Web.Composing @using Umbraco.Web.Templates @{ var value = TemplateUtilities.ParseInternalLinks(Model.value.ToString(), Current.UmbracoContext.UrlProvider); value = TemplateUtilities.ResolveUrlsFromTextString(value); value = TemplateUtilities.ResolveMediaFromTextString(value); } @Html.Raw(value)
mit
C#
99d07497e3b0427533922a001e25aeb9c3438deb
Fix hash check function
patchkit-net/patchkit-patcher-unity,genail/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity
src/Assets/Scripts/Data/HashUtilities.cs
src/Assets/Scripts/Data/HashUtilities.cs
using System.Collections.Generic; using System.Data.HashFunction; using System.IO; using System.Linq; using System.Text; namespace PatchKit.Unity.Patcher.Data { internal static class HashUtilities { public static string ComputeStringHash(string str) { return string.Concat(new xxHash((ulong)42).ComputeHash(Encoding.UTF8.GetBytes(str)).Select(b => b.ToString("X2"))); } public static string ComputeFileHash(string filePath) { using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { IEnumerable<string> enumerable = new xxHash((ulong)42).ComputeHash(fileStream).Select(b => b.ToString("X2")).Reverse(); return string.Concat(string.Join("", enumerable.ToArray()).ToLower().TrimStart('0')); } } } }
using System.Data.HashFunction; using System.IO; using System.Linq; using System.Text; namespace PatchKit.Unity.Patcher.Data { internal static class HashUtilities { public static string ComputeStringHash(string str) { return string.Concat(new xxHash((ulong)42).ComputeHash(Encoding.UTF8.GetBytes(str)).Select(b => b.ToString("X2"))); } public static string ComputeFileHash(string filePath) { using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { return string.Concat(new xxHash((ulong)42).ComputeHash(fileStream).Select(b => b.ToString("X2")).Reverse()).ToLower().TrimStart('0'); } } } }
mit
C#
4aa5292a50ca165b2e400d6d9538e72c71f34d98
make cloudqueues readonly
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
src/Core/Services/AzureBlockIpService.cs
src/Core/Services/AzureBlockIpService.cs
using System.Threading.Tasks; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Queue; using System; namespace Bit.Core.Services { public class AzureBlockIpService : IBlockIpService { private readonly CloudQueue _blockIpQueue; private readonly CloudQueue _unblockIpQueue; public AzureBlockIpService( GlobalSettings globalSettings) { var storageAccount = CloudStorageAccount.Parse(globalSettings.Storage.ConnectionString); var queueClient = storageAccount.CreateCloudQueueClient(); _blockIpQueue = queueClient.GetQueueReference("blockip"); _blockIpQueue.CreateIfNotExists(); _unblockIpQueue = queueClient.GetQueueReference("unblockip"); _unblockIpQueue.CreateIfNotExists(); } public async Task BlockIpAsync(string ipAddress, bool permanentBlock) { var message = new CloudQueueMessage(ipAddress); await _blockIpQueue.AddMessageAsync(message); if(!permanentBlock) { await _unblockIpQueue.AddMessageAsync(message, null, new TimeSpan(12, 0, 0), null, null); } } } }
using System.Threading.Tasks; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Queue; using System; namespace Bit.Core.Services { public class AzureBlockIpService : IBlockIpService { private CloudQueue _blockIpQueue; private CloudQueue _unblockIpQueue; public AzureBlockIpService( GlobalSettings globalSettings) { var storageAccount = CloudStorageAccount.Parse(globalSettings.Storage.ConnectionString); var queueClient = storageAccount.CreateCloudQueueClient(); _blockIpQueue = queueClient.GetQueueReference("blockip"); _blockIpQueue.CreateIfNotExists(); _unblockIpQueue = queueClient.GetQueueReference("unblockip"); _unblockIpQueue.CreateIfNotExists(); } public async Task BlockIpAsync(string ipAddress, bool permanentBlock) { var message = new CloudQueueMessage(ipAddress); await _blockIpQueue.AddMessageAsync(message); if(!permanentBlock) { await _unblockIpQueue.AddMessageAsync(message, null, new TimeSpan(12, 0, 0), null, null); } } } }
agpl-3.0
C#
87beda31de9420e529298f40f619556aa9707589
Update IsToolConverter.cs
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
src/Draw2D/Converters/IsToolConverter.cs
src/Draw2D/Converters/IsToolConverter.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; using Avalonia.Data.Converters; using Draw2D.ViewModels.Tools; namespace Draw2D.Converters { public class IsToolConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is ITool tool && parameter is string name) { return tool.Title == name; } return false; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; using Avalonia.Data.Converters; using Draw2D.ViewModels.Tools; namespace Draw2D.Converters { public class IsToolConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is ITool tool && parameter is string name) { if (tool.Title == name) { return true; } } return false; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
mit
C#
dd54737b411d0c0a482b0049f1516f64cbfb2594
Handle null value.
bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes
Orchard.Source.1.8.1/src/Orchard.Web/Modules/LccNetwork/Views/Parts/MenuWidget-SectionMenu.cshtml
Orchard.Source.1.8.1/src/Orchard.Web/Modules/LccNetwork/Views/Parts/MenuWidget-SectionMenu.cshtml
@using Orchard.UI.Navigation; @using System.Globalization; @helper RenderMenuItem(dynamic shape, bool top = false) { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; MenuItem item = shape.Item as MenuItem; var text = top ? textInfo.ToTitleCase(item.Href.Substring(1)) : // use the Href item.Text.Text; var href = item.Href; var attr = new { @class = item.Selected }; var tag = Tag(Model, "li"); @tag.StartElement @: @Html.Link(text, href, attr) @tag.EndElement } @{ var menu = Model.Menu; var collapseId = Model.Id; var tag = Tag(menu, "ul"); var items = (IList<dynamic>)Enumerable.Cast<dynamic>(menu.Items); // get the first, selected, top level item var selectedMenuItem = items.FirstOrDefault(i => i.Item.Selected); if (selectedMenuItem != null) { // check if any of its children are selected var subItems = (IList<dynamic>)Enumerable.Cast<dynamic>(selectedMenuItem.Items); selectedMenuItem.Selected = !subItems.Any(i => i.Selected); <div> <h1>@selectedMenuItem.Text</h1> @tag.StartElement @RenderMenuItem(selectedMenuItem, true) @foreach (var i in subItems) { @RenderMenuItem(i) } @tag.EndElement </div> } }
@using Orchard.UI.Navigation; @using System.Globalization; @helper RenderMenuItem(dynamic shape, bool top = false) { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; MenuItem item = shape.Item as MenuItem; var text = top ? textInfo.ToTitleCase(item.Href.Substring(1)) : // use the Href item.Text.Text; var href = item.Href; var attr = new { @class = item.Selected }; var tag = Tag(Model, "li"); @tag.StartElement @: @Html.Link(text, href, attr) @tag.EndElement } @{ var menu = Model.Menu; var collapseId = Model.Id; var tag = Tag(menu, "ul"); var items = (IList<dynamic>)Enumerable.Cast<dynamic>(menu.Items); // get the first, selected, top level item var selectedMenuItem = items.First(i => i.Item.Selected); // check if any of its children are selected var subItems = (IList<dynamic>)Enumerable.Cast<dynamic>(selectedMenuItem.Items); selectedMenuItem.Selected = !subItems.Any(i => i.Selected); } <div> <h1>@selectedMenuItem.Text</h1> @tag.StartElement @RenderMenuItem(selectedMenuItem,true) @foreach (var i in subItems) { @RenderMenuItem(i) } @tag.EndElement </div>
bsd-3-clause
C#
311ceebf3c83a7371bad5919fdd193a8ed20fe57
Allow poller to overcome Web Exceptions
rdumont/teamcity-notification-server
src/Server/TeamCity/BuildsPoller.cs
src/Server/TeamCity/BuildsPoller.cs
using System; using System.Linq; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; namespace TeamCityNotifier.NotificationServer.TeamCity { public class BuildsPoller { private readonly TimeSpan _interval; private readonly RestApiClient _client; public event Action<int> BuildStarted; public event Action<int> BuildUpdated; public event Action<int> BuildFinished; public BuildsPoller(RestApiClient client, TimeSpan interval) { _client = client; _interval = interval; } public async Task StartAsync() { var previousBuilds = new int[0]; while (true) { try { var currentBuildObjects = await _client.GetRunningBuildsAsync(); var currentBuilds = currentBuildObjects.Select(build => build.Id).ToArray(); TriggerBuildChanges(previousBuilds, currentBuilds); previousBuilds = currentBuilds; } catch (Exception exception) { if (!(exception is HttpRequestException)) throw; var builder = new StringBuilder(); builder.AppendFormat("{0}: {1}", exception.GetType().Name, exception.Message); var inner = exception.InnerException; while (inner != null) { builder.AppendFormat(" ---> {0}: {1}", inner.GetType().Name, inner.Message); inner = inner.InnerException; } builder.AppendLine(); Console.WriteLine(builder); } Thread.Sleep(_interval); } } protected void TriggerBuildChanges(int[] previousBuilds, int[] currentBuilds) { var startedBuilds = currentBuilds.Except(previousBuilds).ToArray(); foreach (var build in startedBuilds) this.BuildStarted(build); var updatedBuilds = currentBuilds.Except(startedBuilds); foreach (var build in updatedBuilds) this.BuildUpdated(build); var finishedBuilds = previousBuilds.Except(currentBuilds); foreach (var build in finishedBuilds) this.BuildFinished(build); } } }
using System; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace TeamCityNotifier.NotificationServer.TeamCity { public class BuildsPoller { private readonly TimeSpan _interval; private readonly RestApiClient _client; public event Action<int> BuildStarted; public event Action<int> BuildUpdated; public event Action<int> BuildFinished; public BuildsPoller(RestApiClient client, TimeSpan interval) { _client = client; _interval = interval; } public async Task StartAsync() { var previousBuilds = new int[0]; while (true) { var currentBuildObjects = await _client.GetRunningBuildsAsync(); var currentBuilds = currentBuildObjects.Select(build => build.Id).ToArray(); TriggerBuildChanges(previousBuilds, currentBuilds); previousBuilds = currentBuilds; Thread.Sleep(_interval); } } protected void TriggerBuildChanges(int[] previousBuilds, int[] currentBuilds) { var startedBuilds = currentBuilds.Except(previousBuilds).ToArray(); foreach (var build in startedBuilds) this.BuildStarted(build); var updatedBuilds = currentBuilds.Except(startedBuilds); foreach (var build in updatedBuilds) this.BuildUpdated(build); var finishedBuilds = previousBuilds.Except(currentBuilds); foreach (var build in finishedBuilds) this.BuildFinished(build); } } }
mit
C#
008cb76e8b45281842baa5cb31a3626d0fb656bd
Update PageNotFoundsModule.cs
ChristopherJennings/KInspector,JosefDvorak/KInspector,anibalvelarde/KInspector,anibalvelarde/KInspector,JosefDvorak/KInspector,KenticoBSoltis/KInspector,TheEskhaton/KInspector,KenticoBSoltis/KInspector,pnmcosta/KInspector,Kentico/KInspector,martbrow/KInspector,KenticoBSoltis/KInspector,TheEskhaton/KInspector,petrsvihlik/KInspector,TheEskhaton/KInspector,anibalvelarde/KInspector,Kentico/KInspector,JosefDvorak/KInspector,Kentico/KInspector,petrsvihlik/KInspector,martbrow/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,pnmcosta/KInspector,ChristopherJennings/KInspector,pnmcosta/KInspector,martbrow/KInspector,petrsvihlik/KInspector,ChristopherJennings/KInspector
KInspector.Modules/Modules/EventLog/PageNotFoundsModule.cs
KInspector.Modules/Modules/EventLog/PageNotFoundsModule.cs
using System; using Kentico.KInspector.Core; namespace Kentico.KInspector.Modules { public class PageNotFoundsModule : IModule { public ModuleMetadata GetModuleMetadata() { return new ModuleMetadata { Name = "Not found errors (404)", SupportedVersions = new[] { new Version("6.0"), new Version("7.0"), new Version("8.0"), new Version("8.1"), new Version("8.2"), new Version("9.0") }, Comment = @"Displays all the 404 errors from the event log. If there are any 404 errors, there is a broken link somewhere on your website. Check the referrer URL and fix all the broken links. You should avoid broken links on your website as it hurts SEO and generates unnecessary traffic. For the complete website analysis, you can use an external tool like www.deadlinkchecker.com.", Category = "Event log" }; } public ModuleResults GetResults(InstanceInfo instanceInfo) { var dbService = instanceInfo.DBService; var results = dbService.ExecuteAndGetTableFromFile("PageNotFoundsModule.sql"); if (results.Rows.Count > 0) { return new ModuleResults { Result = results, ResultComment = "Page not founds found! Check the referrers, if the links to these non existing pages can be removed.", Status = results.Rows.Count > 10 ? Status.Error : Status.Warning, }; } return new ModuleResults { ResultComment = "No page not founds were found in the event log.", Status = Status.Good }; } } }
using System; using Kentico.KInspector.Core; namespace Kentico.KInspector.Modules { public class PageNotFoundsModule : IModule { public ModuleMetadata GetModuleMetadata() { return new ModuleMetadata { Name = "Not found errors (404)", SupportedVersions = new[] { new Version("6.0"), new Version("7.0"), new Version("8.0"), new Version("8.1"), new Version("8.2"), new Version("9.0") }, Comment = @"Displays all the 404 errors from the event log. If there are any 404 errors, there is a broken link somewhere on your website. Check the referrer URL and fix all the broken links. You should avoid broken links on your website as it hurts SEO and generates unnecessary traffic. For the complete website analysis, you can use some external tool like www.deadlinkchecker.com.", Category = "Event log" }; } public ModuleResults GetResults(InstanceInfo instanceInfo) { var dbService = instanceInfo.DBService; var results = dbService.ExecuteAndGetTableFromFile("PageNotFoundsModule.sql"); if (results.Rows.Count > 0) { return new ModuleResults { Result = results, ResultComment = "Page not founds found! Check the referrers, if the links to these non existing pages can be removed.", Status = results.Rows.Count > 10 ? Status.Error : Status.Warning, }; } return new ModuleResults { ResultComment = "No page not founds were found in the event log.", Status = Status.Good }; } } }
mit
C#
68c796bc0cfc2485066152cc649b086ad1ecf8fc
Fix typo in XML doc for GeneratorExtensions (#58020)
mavasani/roslyn,dotnet/roslyn,weltkante/roslyn,diryboy/roslyn,diryboy/roslyn,weltkante/roslyn,dotnet/roslyn,KevinRansom/roslyn,diryboy/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,weltkante/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,dotnet/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn
src/Compilers/Core/Portable/SourceGeneration/GeneratorExtensions.cs
src/Compilers/Core/Portable/SourceGeneration/GeneratorExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Text; namespace Microsoft.CodeAnalysis { public static class GeneratorExtensions { /// <summary> /// Returns the underlying type of a given generator /// </summary> /// <remarks> /// For <see cref="IIncrementalGenerator"/>s a wrapper is created that also implements /// <see cref="ISourceGenerator"/>. This method will unwrap and return the underlying type /// in those cases. /// </remarks> /// <param name="generator">The generator to get the type of</param> /// <returns>The underlying generator type</returns> public static Type GetGeneratorType(this ISourceGenerator generator) { if (generator is IncrementalGeneratorWrapper igw) { return igw.Generator.GetType(); } return generator.GetType(); } /// <summary> /// Converts an <see cref="IIncrementalGenerator"/> into an <see cref="ISourceGenerator"/> object that can be used when constructing a <see cref="GeneratorDriver"/> /// </summary> /// <param name="incrementalGenerator">The incremental generator to wrap</param> /// <returns>A wrapped generator that can be passed to a generator driver</returns> public static ISourceGenerator AsSourceGenerator(this IIncrementalGenerator incrementalGenerator) => new IncrementalGeneratorWrapper(incrementalGenerator); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Text; namespace Microsoft.CodeAnalysis { public static class GeneratorExtensions { /// <summary> /// Returns the underlying type of a given generator /// </summary> /// <remarks> /// For <see cref="IIncrementalGenerator"/>s a wrapper is created that also implements /// <see cref="ISourceGenerator"/>. This method will unwrap and return the underlying type /// in those cases. /// </remarks> /// <param name="generator">The generator to get the type of</param> /// <returns>The underlying generator type</returns> public static Type GetGeneratorType(this ISourceGenerator generator) { if (generator is IncrementalGeneratorWrapper igw) { return igw.Generator.GetType(); } return generator.GetType(); } /// <summary> /// Converts an <see cref="IIncrementalGenerator"/> in an <see cref="ISourceGenerator"/> object that can be used when constructing a <see cref="GeneratorDriver"/> /// </summary> /// <param name="incrementalGenerator">The incremental generator to wrap</param> /// <returns>A wrapped generator that can be passed to a generator driver</returns> public static ISourceGenerator AsSourceGenerator(this IIncrementalGenerator incrementalGenerator) => new IncrementalGeneratorWrapper(incrementalGenerator); } }
mit
C#
eac903a2d571ae60720c5744893550b79fa2ba90
remove stage art switch
DutchBeastman/ProefBekwaamheidIceCubeGames
Assets/Scripts/Blocks/BlockManager.cs
Assets/Scripts/Blocks/BlockManager.cs
//Fabian Verkuijlen //Created on: 15/04/2016 using UnityEngine; using System.Collections.Generic; public class BlockManager : MonoBehaviour { [SerializeField] private int fieldWidth; [SerializeField] private int fieldHeight; //[SerializeField] private GameObject[] farmStageTiles; [SerializeField] private GameObject[] forrestStageTiles; [SerializeField]private GameObject[] specialBlocks; private GameObject[] currentStageTiles; private int stageID; private List<List<Block>> blocks; [SerializeField] private Transform playerPosition; private Vector3 nextLinePosition; private int nextLine; protected void OnEnable () { EventManager.AddListener(StaticEventNames.RESTART, StartGame); } protected void OnDisable () { EventManager.RemoveListener(StaticEventNames.RESTART, StartGame); } protected void Awake() { currentStageTiles = forrestStageTiles; Generation(); } private void StartGame () { currentStageTiles = forrestStageTiles; Reset(); } /// <summary> /// Function for the generation /// </summary> private void Generation() { blocks = new List<List<Block>>(); for (int x = 0; x < fieldWidth; x++) { List<Block> tempList = new List<Block>(); for (int y = 0; y < fieldHeight; y++) { int percentageCounter = Random.Range(0 , 100); if (percentageCounter < 93) { GameObject instantiateBlock = (GameObject)Instantiate(currentStageTiles[Random.Range(0 , currentStageTiles.Length)] , new Vector2(transform.position.x + x , transform.position.y - ( fieldHeight - y )) , Quaternion.identity); instantiateBlock.GetComponent<Block>().Position = new Vector2(x , y); tempList.Add(instantiateBlock.GetComponent<Block>()); } else { GameObject instantiateBlock = (GameObject)Instantiate(specialBlocks[Random.Range(0 , specialBlocks.Length)] , new Vector2(transform.position.x + x , transform.position.y - ( fieldHeight - y )) , Quaternion.identity); instantiateBlock.GetComponent<Block>().Position = new Vector2(x , y); tempList.Add(instantiateBlock.GetComponent<Block>()); } } blocks.Add(tempList); } } public void Reset() { stageID ++; if (stageID == 2) { stageID = 0; } switch (stageID) { case 0: currentStageTiles = forrestStageTiles; break; case 1: currentStageTiles = forrestStageTiles; break; } Invoke("Generation", 1f); RemoveBlocks(); nextLine = 0; nextLinePosition.y = nextLine; blocks = new List<List<Block>>(); } private void RemoveBlocks () { for (int x = 0; x < fieldWidth; x++) { for (int y = 0; y < fieldHeight; y++) { if (blocks != null && blocks[x][y]) { Destroy(blocks[x][y].gameObject); } } } } }
//Fabian Verkuijlen //Created on: 15/04/2016 using UnityEngine; using System.Collections.Generic; public class BlockManager : MonoBehaviour { [SerializeField] private int fieldWidth; [SerializeField] private int fieldHeight; [SerializeField] private GameObject[] farmStageTiles; [SerializeField] private GameObject[] forrestStageTiles; [SerializeField]private GameObject[] specialBlocks; private GameObject[] currentStageTiles; private int stageID; private List<List<Block>> blocks; [SerializeField] private Transform playerPosition; private Vector3 nextLinePosition; private int nextLine; protected void OnEnable () { EventManager.AddListener(StaticEventNames.RESTART, StartGame); } protected void OnDisable () { EventManager.RemoveListener(StaticEventNames.RESTART, StartGame); } protected void Awake() { currentStageTiles = farmStageTiles; Generation(); } private void StartGame () { currentStageTiles = farmStageTiles; Reset(); } /// <summary> /// Function for the generation /// </summary> private void Generation() { blocks = new List<List<Block>>(); for (int x = 0; x < fieldWidth; x++) { List<Block> tempList = new List<Block>(); for (int y = 0; y < fieldHeight; y++) { int percentageCounter = Random.Range(0 , 100); if (percentageCounter < 93) { GameObject instantiateBlock = (GameObject)Instantiate(currentStageTiles[Random.Range(0 , currentStageTiles.Length)] , new Vector2(transform.position.x + x , transform.position.y - ( fieldHeight - y )) , Quaternion.identity); instantiateBlock.GetComponent<Block>().Position = new Vector2(x , y); tempList.Add(instantiateBlock.GetComponent<Block>()); } else { GameObject instantiateBlock = (GameObject)Instantiate(specialBlocks[Random.Range(0 , specialBlocks.Length)] , new Vector2(transform.position.x + x , transform.position.y - ( fieldHeight - y )) , Quaternion.identity); instantiateBlock.GetComponent<Block>().Position = new Vector2(x , y); tempList.Add(instantiateBlock.GetComponent<Block>()); } } blocks.Add(tempList); } } public void Reset() { stageID ++; if (stageID == 2) { stageID = 0; } switch (stageID) { case 0: currentStageTiles = farmStageTiles; break; case 1: currentStageTiles = forrestStageTiles; break; } Invoke("Generation", 1f); RemoveBlocks(); nextLine = 0; nextLinePosition.y = nextLine; blocks = new List<List<Block>>(); } private void RemoveBlocks () { for (int x = 0; x < fieldWidth; x++) { for (int y = 0; y < fieldHeight; y++) { if (blocks != null && blocks[x][y]) { Destroy(blocks[x][y].gameObject); } } } } }
mit
C#
07445234d728a828a8c87f3a651cc0891e9592dd
Update GroupBox.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Core2D/Layout/GroupBox.cs
src/Core2D/Layout/GroupBox.cs
using System; using System.Collections.Generic; using Core2D.Shapes; namespace Core2D.Layout { public struct GroupBox { public readonly ShapeBox[] Boxes; public Box Bounds; public GroupBox(IList<IBaseShape> shapes) { Boxes = new ShapeBox[shapes.Count]; for (int i = 0; i < shapes.Count; i++) { Boxes[i] = new ShapeBox(shapes[i]); } Bounds = new Box(); Update(); } public void Update() { for (int i = 0; i < Boxes.Length; i++) { Boxes[i].Update(); } for (int i = 0; i < Boxes.Length; i++) { var box = Boxes[i]; if (i == 0) { Bounds.Left = box.Bounds.Left; Bounds.Top = box.Bounds.Top; Bounds.Right = box.Bounds.Right; Bounds.Bottom = box.Bounds.Bottom; } else { Bounds.Left = Math.Min(Bounds.Left, box.Bounds.Left); Bounds.Top = Math.Min(Bounds.Top, box.Bounds.Top); Bounds.Right = Math.Max(Bounds.Right, box.Bounds.Right); Bounds.Bottom = Math.Max(Bounds.Bottom, box.Bounds.Bottom); } } Bounds.CenterX = (Bounds.Left + Bounds.Right) / 2.0; Bounds.CenterY = (Bounds.Top + Bounds.Bottom) / 2.0; Bounds.Width = Math.Abs(Bounds.Right - Bounds.Left); Bounds.Height = Math.Abs(Bounds.Bottom - Bounds.Top); } } }
using System; using System.Collections.Generic; using Core2D.Shapes; namespace Core2D.Layout { public struct GroupBox { public readonly ShapeBox[] Boxes; public Box Bounds; public GroupBox(IList<IBaseShape> shapes) { Boxes = new ShapeBox[shapes.Count]; for (int i = 0; i < shapes.Count; i++) { Boxes[i] = new ShapeBox(shapes[i]); } Bounds = new Box(); Update(); } public void Update() { for (int i = 0; i < Boxes.Length; i++) { Boxes[i].Update(); } Bounds.Left = double.MaxValue; Bounds.Top = double.MaxValue; Bounds.Right = double.MinValue; Bounds.Bottom = double.MinValue; for (int i = 0; i < Boxes.Length; i++) { var box = Boxes[i]; Bounds.Left = Math.Min(Bounds.Left, box.Bounds.Left); Bounds.Top = Math.Min(Bounds.Top, box.Bounds.Top); Bounds.Right = Math.Max(Bounds.Right, box.Bounds.Right); Bounds.Bottom = Math.Max(Bounds.Bottom, box.Bounds.Bottom); } Bounds.CenterX = (Bounds.Left + Bounds.Right) / 2.0; Bounds.CenterY = (Bounds.Top + Bounds.Bottom) / 2.0; Bounds.Width = Math.Abs(Bounds.Right - Bounds.Left); Bounds.Height = Math.Abs(Bounds.Bottom - Bounds.Top); } } }
mit
C#
9a95b08671aadd5b21d0af1d882d07bc9bf38cdc
Improve DemoRunner tab styling
MatterHackers/agg-sharp,larsbrubaker/agg-sharp,jlewin/agg-sharp
examples/DemoRunner/DemoRunner.cs
examples/DemoRunner/DemoRunner.cs
using System; using System.Linq; using MatterHackers.Agg.UI; using MatterHackers.Agg.UI.Examples; using MatterHackers.VectorMath; namespace MatterHackers.Agg { internal class DemoRunner : GuiWidget { public DemoRunner() { var appWidgetFinder = PluginFinder.CreateInstancesOf<IDemoApp>().OrderBy(a => a.Title).ToList(); TabControl tabControl = new TabControl(Orientation.Vertical); AddChild(tabControl); tabControl.AnchorAll(); int count = appWidgetFinder.Count; for (int i = 0; i < count; i++) { TabPage tabPage = new TabPage(appWidgetFinder[i].Title); tabPage.AddChild(appWidgetFinder[i] as GuiWidget); tabControl.AddTab(tabPage, tabPage.Text); } // HACK: force width/height/color/position/spacing on default tab controls double maxWidth = tabControl.TabBar.Children.Select(c => c.Width).Max(); foreach (var child in tabControl.TabBar.Children) { if (child is TextTab textTab) { foreach(var viewWidget in textTab.Children) { viewWidget.BackgroundColor = new Color(viewWidget.BackgroundColor, 180); viewWidget.HAnchor = HAnchor.Absolute; viewWidget.VAnchor = VAnchor.Fit; viewWidget.Margin = 0; viewWidget.Padding = 6; viewWidget.Position = Vector2.Zero; viewWidget.Width = maxWidth; } } } AnchorAll(); } [STAThread] public static void Main(string[] args) { Clipboard.SetSystemClipboard(new WindowsFormsClipboard()); var systemWindow = new SystemWindow(640, 480); systemWindow.Title = "Demo Runner"; systemWindow.AddChild(new DemoRunner()); systemWindow.ShowAsSystemWindow(); } } }
using System; using System.Linq; using MatterHackers.Agg.UI; using MatterHackers.Agg.UI.Examples; namespace MatterHackers.Agg { internal class DemoRunner : GuiWidget { public DemoRunner() { var appWidgetFinder = PluginFinder.CreateInstancesOf<IDemoApp>().OrderBy(a => a.Title).ToList(); TabControl tabControl = new TabControl(Orientation.Vertical); AddChild(tabControl); tabControl.AnchorAll(); int count = appWidgetFinder.Count; for (int i = 0; i < count; i++) { TabPage tabPage = new TabPage(appWidgetFinder[i].Title); tabPage.AddChild(appWidgetFinder[i] as GuiWidget); tabControl.AddTab(tabPage, tabPage.Text); } AnchorAll(); } [STAThread] public static void Main(string[] args) { Clipboard.SetSystemClipboard(new WindowsFormsClipboard()); var systemWindow = new SystemWindow(640, 480); systemWindow.Title = "Demo Runner"; systemWindow.AddChild(new DemoRunner()); systemWindow.ShowAsSystemWindow(); } } }
bsd-2-clause
C#
7dc6c80711939ff8d9bb76d3c22a447ed8f17514
Patch from Alexander Kojevnikov moving the focus to the list of songs when
GNOME/hyena,dufoli/hyena,dufoli/hyena,petejohanson/hyena,arfbtwn/hyena,GNOME/hyena,arfbtwn/hyena,petejohanson/hyena
Hyena.Gui/Hyena.Data.Gui/IListView.cs
Hyena.Gui/Hyena.Data.Gui/IListView.cs
// // IListView.cs // // Authors: // Gabriel Burt <gburt@novell.com> // // Copyright (C) 2008 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Hyena.Data.Gui { public interface IListView { Hyena.Collections.SelectionProxy SelectionProxy { get; } Hyena.Collections.Selection Selection { get; } void ScrollTo (int index); void CenterOn (int index); void GrabFocus (); ColumnController ColumnController { get; set; } } public interface IListView<T> : IListView { void SetModel (IListModel<T> model); IListModel<T> Model { get; } } }
// // IListView.cs // // Authors: // Gabriel Burt <gburt@novell.com> // // Copyright (C) 2008 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Hyena.Data.Gui { public interface IListView { Hyena.Collections.SelectionProxy SelectionProxy { get; } Hyena.Collections.Selection Selection { get; } void ScrollTo (int index); void CenterOn (int index); ColumnController ColumnController { get; set; } } public interface IListView<T> : IListView { void SetModel (IListModel<T> model); IListModel<T> Model { get; } } }
mit
C#
bbcbd45447114687e1d9694caa348b681520372f
Update code
sakapon/KLibrary.Linq
KLibrary4/Linq/Linq/GroupingHelper.cs
KLibrary4/Linq/Linq/GroupingHelper.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace KLibrary.Linq { public static class GroupingHelper { public static IEnumerable<IGrouping<TKey, TSource>> GroupBySequentially<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); var queue = new Queue<TSource>(); var currentKey = default(TKey); var comparer = EqualityComparer<TKey>.Default; foreach (var item in source) { var key = keySelector(item); if (!comparer.Equals(key, currentKey)) { if (queue.Count != 0) { yield return new Grouping<TKey, TSource>(currentKey, queue.ToArray()); queue.Clear(); } currentKey = key; } queue.Enqueue(item); } if (queue.Count != 0) { yield return new Grouping<TKey, TSource>(currentKey, queue.ToArray()); queue.Clear(); } } } public class Grouping<TKey, TElement> : IGrouping<TKey, TElement> { public TKey Key { get; } protected IEnumerable<TElement> Values { get; } public Grouping(TKey key, IEnumerable<TElement> values) { Key = key; Values = values; } public IEnumerator<TElement> GetEnumerator() => Values.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace KLibrary.Linq { public static class GroupingHelper { public static IEnumerable<IGrouping<TKey, TSource>> GroupBySequentially<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); var queue = new Queue<TSource>(); var currentKey = default(TKey); var comparer = EqualityComparer<TKey>.Default; foreach (var item in source) { var key = keySelector(item); if (!comparer.Equals(key, currentKey)) { if (queue.Count != 0) { yield return new Grouping<TKey, TSource>(currentKey, queue.ToArray()); queue.Clear(); } currentKey = key; } queue.Enqueue(item); } if (queue.Count != 0) { yield return new Grouping<TKey, TSource>(currentKey, queue.ToArray()); queue.Clear(); } } } public class Grouping<TKey, TElement> : IGrouping<TKey, TElement> { public TKey Key { get; } protected IEnumerable<TElement> Values { get; } public Grouping(TKey key, IEnumerable<TElement> values) { Key = key; Values = values; } public IEnumerator<TElement> GetEnumerator() { return Values.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } }
mit
C#
9fdfa3c2a451f13ddff65fb4d1de63643a93b08f
Add static factory method for neuron
jobeland/NeuralNetwork
NeuralNetwork/NeuralNetwork/Neuron.cs
NeuralNetwork/NeuralNetwork/Neuron.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ArtificialNeuralNetwork { [Serializable] public class Neuron : INeuron { private readonly ISoma _soma; private readonly IAxon _axon; private Neuron(ISoma soma, IAxon axon) { _soma = soma; _axon = axon; } public static INeuron Create(ISoma soma, IAxon axon) { return new Neuron(soma, axon); } public void Process() { _axon.ProcessSignal(_soma.CalculateSummation()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ArtificialNeuralNetwork { [Serializable] public class Neuron : INeuron { private readonly ISoma _soma; private readonly IAxon _axon; public Neuron(ISoma soma, IAxon axon) { _soma = soma; _axon = axon; } public virtual double CalculateActivationFunction() { return 0.0; } public void Process() { _axon.ProcessSignal(_soma.CalculateSummation()); } } }
mit
C#
0a096bc1e2128c254aca1baf8342f59433f38dc5
Update the XML docs.
darrencauthon/csharp-sparkpost,kirilsi/csharp-sparkpost,kirilsi/csharp-sparkpost,SparkPost/csharp-sparkpost,darrencauthon/csharp-sparkpost
src/SparkPost/IRecipientLists.cs
src/SparkPost/IRecipientLists.cs
using System.Collections.Generic; using System.Threading.Tasks; namespace SparkPost { public interface IRecipientLists { /// <summary> /// Creates a recipient list. /// </summary> /// <param name="recipientList">The properties of the recipientList to create.</param> /// <returns>The response from the API.</returns> Task<SendRecipientListsResponse> Create(RecipientList recipientList); /// <summary> /// Retrieves an email transmission. /// </summary> /// <param name="recipientListsId">The id of the transmission to retrieve.</param> /// <returns>The response from the API.</returns> Task<RetrieveRecipientListsResponse> Retrieve(string recipientListsId); } }
using System.Collections.Generic; using System.Threading.Tasks; namespace SparkPost { public interface IRecipientLists { /// <summary> /// Sends an email transmission. /// </summary> /// <param name="recipientList">The properties of the recipientList to send.</param> /// <returns>The response from the API.</returns> Task<SendRecipientListsResponse> Create(RecipientList recipientList); /// <summary> /// Retrieves an email transmission. /// </summary> /// <param name="recipientListsId">The id of the transmission to retrieve.</param> /// <returns>The response from the API.</returns> Task<RetrieveRecipientListsResponse> Retrieve(string recipientListsId); } }
apache-2.0
C#
49e1f0fc4cf7afdecc2ef4a036fc7cde96ad44d4
fix graphical glitch on score
sungry/CS177
unityTree/Assets/_Scripts/HUDScript.cs
unityTree/Assets/_Scripts/HUDScript.cs
using UnityEngine; using System.Collections; using UnitySampleAssets._2D; public class HUDScript : MonoBehaviour { // game font set-up public Font guiFont; public int fontSize; // GUIStyle style = new GUIStyle (); //Heads up Display float playerScore; float currentSpeed; // score popup set-up Transform player; // Update is called once per frame void Update () { playerScore += (Time.deltaTime * 10); //currentSpeed = PlatformerCharacter2D.getMaxSpeed(); } public void IncreaseScore(int amount) { player = GameObject.Find ("Player").transform; playerScore += amount; } void OnDisable() { PlayerPrefs.SetInt("Score", (int)(playerScore*10)); } void OnGUI() { // style.font = guiFont; GUI.skin.font = guiFont; fontSize = GUI.skin.font.fontSize; if (playerScore > 0) { GUI.contentColor = Color.yellow; // GUI.contentColor = Color.white; GUI.skin.textArea.fontSize = 22; // GUI.skin.textArea.fontStyle = FontStyle.Bold; } else { GUI.contentColor = Color.red; } string score = ((int)(playerScore * 10)).ToString(); int len = "Score: ".Length + score.Length; GUI.TextArea(new Rect(20, 12, len*14, 30), "Score: " + (int)(playerScore * 10)); } void floatScore() { } }
using UnityEngine; using System.Collections; using UnitySampleAssets._2D; public class HUDScript : MonoBehaviour { // game font set-up public Font guiFont; public int fontSize; // GUIStyle style = new GUIStyle (); //Heads up Display float playerScore; float currentSpeed; // score popup set-up Transform player; // Update is called once per frame void Update () { playerScore += (Time.deltaTime * 10); //currentSpeed = PlatformerCharacter2D.getMaxSpeed(); } public void IncreaseScore(int amount) { player = GameObject.Find ("Player").transform; playerScore += amount; } void OnDisable() { PlayerPrefs.SetInt("Score", (int)(playerScore*10)); } void OnGUI() { // style.font = guiFont; GUI.skin.font = guiFont; fontSize = GUI.skin.font.fontSize; if (playerScore > 0) { GUI.contentColor = Color.yellow; // GUI.contentColor = Color.white; GUI.skin.textArea.fontSize = 22; // GUI.skin.textArea.fontStyle = FontStyle.Bold; } else { GUI.contentColor = Color.red; } string score = ((int)(playerScore * 10)).ToString(); int len = "Score: ".Length + score.Length; GUI.TextArea(new Rect(20, 10, len*13, 30), "Score: " + (int)(playerScore * 10)); } void floatScore() { } }
mit
C#
7ea77941719a8ffb4bddc9bcb7317210634a3db3
Add message types for nitro boosting and channel following
BundledSticksInkorperated/Discore
src/Discore/DiscordMessageType.cs
src/Discore/DiscordMessageType.cs
namespace Discore { public enum DiscordMessageType { Default = 0, RecipientAdd = 1, RecipientRemove = 2, Call = 3, ChannelNameChange = 4, ChannelIconChange = 5, ChannelPinnedMessage = 6, GuildMemberJoin = 7, UserPremiumGuildSubscription = 8, UserPremiumGuildSubscriptionTier1 = 9, UserPremiumGuildSubscriptionTier2 = 10, UserPremiumGuildSubscriptionTier3 = 11, ChannelFollowAdd = 12 } }
namespace Discore { public enum DiscordMessageType { Default = 0, RecipientAdd = 1, RecipientRemove = 2, Call = 3, ChannelNameChange = 4, ChannelIconChange = 5, ChannelPinnedMessage = 6, GuildMemberJoin = 7 } }
mit
C#
c576e3fc8cfa01832c33f8a65fd81c581720e240
Rename function name in test fixture
RivetDB/Rivet,RivetDB/Rivet,RivetDB/Rivet
Source/Test/Operations/NewUserDefinedFunctionOperationTestFixture.cs
Source/Test/Operations/NewUserDefinedFunctionOperationTestFixture.cs
using NUnit.Framework; using Rivet.Operations; namespace Rivet.Test.Operations { [TestFixture] public sealed class NewUserDefinedFunctionTestFixture { const string SchemaName = "schemaName"; const string FunctionName = "functionName"; const string Definition = "as definition"; [SetUp] public void SetUp() { } [Test] public void ShouldSetPropertiesForNewUserDefinedFunction() { var op = new NewUserDefinedFunctionOperation(SchemaName, FunctionName, Definition); Assert.AreEqual(SchemaName, op.SchemaName); Assert.AreEqual(FunctionName, op.Name); Assert.AreEqual(Definition, op.Definition); } [Test] public void ShouldWriteQueryForNewUserDefinedFunction() { var op = new NewUserDefinedFunctionOperation(SchemaName, FunctionName, Definition); const string expectedQuery = "create function [schemaName].[functionName] as definition"; Assert.AreEqual(expectedQuery, op.ToQuery()); } } }
using NUnit.Framework; using Rivet.Operations; namespace Rivet.Test.Operations { [TestFixture] public sealed class NewUserDefinedFunctionTestFixture { const string SchemaName = "schemaName"; const string FunctionName = "functionName"; const string Definition = "as definition"; [SetUp] public void SetUp() { } [Test] public void ShouldSetPropertiesForNewStoredProcedure() { var op = new NewUserDefinedFunctionOperation(SchemaName, FunctionName, Definition); Assert.AreEqual(SchemaName, op.SchemaName); Assert.AreEqual(FunctionName, op.Name); Assert.AreEqual(Definition, op.Definition); } [Test] public void ShouldWriteQueryForNewStoredProcedure() { var op = new NewUserDefinedFunctionOperation(SchemaName, FunctionName, Definition); const string expectedQuery = "create function [schemaName].[functionName] as definition"; Assert.AreEqual(expectedQuery, op.ToQuery()); } } }
apache-2.0
C#
371814a6f49f764d58db60bbb4ab4942858bc8de
Fix coal fuel efficiency.
MiPE-JP/RaNET,InPvP/MiNET,yungtechboy1/MiNET
src/MiNET/MiNET/Items/ItemCoal.cs
src/MiNET/MiNET/Items/ItemCoal.cs
namespace MiNET.Items { public class ItemCoal : Item { public ItemCoal() : base(263) { MaxStackSize = 64; FuelEfficiency = 80; } } }
namespace MiNET.Items { public class ItemCoal : Item { public ItemCoal() : base(263) { MaxStackSize = 64; FuelEfficiency = 10; } } }
mpl-2.0
C#
524567d7d6981d76966b0436ba6c1989ed871ba1
Handle null fact in WrapperFact
NRules/NRules
src/NRules/NRules/Rete/Fact.cs
src/NRules/NRules/Rete/Fact.cs
using System; using System.Diagnostics; using NRules.RuleModel; namespace NRules.Rete { [DebuggerDisplay("Fact {Object}")] internal class Fact : IFact { private object _object; public Fact() { } public Fact(object @object) { _object = @object; FactType = @object.GetType(); } public Fact(object @object, Type declaredType) { _object = @object; FactType = @object?.GetType() ?? declaredType; } public virtual Type FactType { get; } public object RawObject { get => _object; set => _object = value; } public virtual IFactSource Source { get => null; set => throw new InvalidOperationException("Source is only supported on synthetic facts"); } public virtual object Object => _object; public virtual bool IsWrapperFact => false; Type IFact.Type => FactType; object IFact.Value => Object; IFactSource IFact.Source => Source; } [DebuggerDisplay("Fact {Source.SourceType} {Object}")] internal class SyntheticFact : Fact { private IFactSource _source; public SyntheticFact(object @object) : base(@object) { } public override IFactSource Source { get => _source; set => _source = value; } } [DebuggerDisplay("Fact Tuple({WrappedTuple.Count}) -> {Object}")] internal class WrapperFact : Fact { public WrapperFact(Tuple tuple) : base(tuple) { } public override Type FactType => WrappedTuple.RightFact?.FactType; public override object Object => WrappedTuple.RightFact?.Object; public Tuple WrappedTuple => (Tuple) RawObject; public override bool IsWrapperFact => true; public override IFactSource Source { get => WrappedTuple.RightFact?.Source; set {} } } }
using System; using System.Diagnostics; using NRules.RuleModel; namespace NRules.Rete { [DebuggerDisplay("Fact {Object}")] internal class Fact : IFact { private object _object; public Fact() { } public Fact(object @object) { _object = @object; FactType = @object.GetType(); } public Fact(object @object, Type declaredType) { _object = @object; FactType = @object?.GetType() ?? declaredType; } public virtual Type FactType { get; } public object RawObject { get => _object; set => _object = value; } public virtual IFactSource Source { get => null; set => throw new InvalidOperationException("Source is only supported on synthetic facts"); } public virtual object Object => _object; public virtual bool IsWrapperFact => false; Type IFact.Type => FactType; object IFact.Value => Object; IFactSource IFact.Source => Source; } [DebuggerDisplay("Fact {Source.SourceType} {Object}")] internal class SyntheticFact : Fact { private IFactSource _source; public SyntheticFact(object @object) : base(@object) { } public override IFactSource Source { get => _source; set => _source = value; } } [DebuggerDisplay("Fact Tuple({WrappedTuple.Count}) -> {Object}")] internal class WrapperFact : Fact { public WrapperFact(Tuple tuple) : base(tuple) { } public override Type FactType => WrappedTuple.RightFact.FactType; public override object Object => WrappedTuple.RightFact.Object; public Tuple WrappedTuple => (Tuple) RawObject; public override bool IsWrapperFact => true; public override IFactSource Source { get => WrappedTuple.RightFact.Source; set => WrappedTuple.RightFact.Source = value; } } }
mit
C#
c351ba6aee81d5d8a1d2ec4b3137084d81994f0f
Update year in AssemblyInfo. (+semver: major)
ZEISS-PiWeb/PiWeb-Api
src/Properties/AssemblyInfo.cs
src/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; [assembly: AssemblyCompany( "Carl Zeiss Innovationszentrum für Messtechnik GmbH" )] [assembly: AssemblyProduct( "ZEISS PiWeb Api" )] [assembly: AssemblyCopyright( "Copyright © 2019 Carl Zeiss Innovationszentrum für Messtechnik GmbH" )] [assembly: AssemblyTrademark( "PiWeb" )] [assembly: NeutralResourcesLanguage( "en" )] [assembly: AssemblyVersion( "3.0.0" )] [assembly: AssemblyInformationalVersion("3.0.0")] [assembly: AssemblyFileVersion( "3.0.0" )]
using System.Reflection; using System.Resources; [assembly: AssemblyCompany( "Carl Zeiss Innovationszentrum für Messtechnik GmbH" )] [assembly: AssemblyProduct( "ZEISS PiWeb Api" )] [assembly: AssemblyCopyright( "Copyright © 2018 Carl Zeiss Innovationszentrum für Messtechnik GmbH" )] [assembly: AssemblyTrademark( "PiWeb" )] [assembly: NeutralResourcesLanguage( "en" )] [assembly: AssemblyVersion( "3.0.0" )] [assembly: AssemblyInformationalVersion("3.0.0")] [assembly: AssemblyFileVersion( "3.0.0" )]
bsd-3-clause
C#
68aee0c59c3e4ce72186cf48b0f8a0443abc363a
Update AssemblyInfo.cs
robbihun/pvc-sql
src/Properties/AssemblyInfo.cs
src/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Pvc.Sql")] [assembly: AssemblyDescription("PVC plugin: Sql")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rob Bihun")] [assembly: AssemblyProduct("Pvc.Sql")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("Rob Bihun")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("57dd8320-ea1b-4860-b799-f5de297be2db")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.2.0")] [assembly: AssemblyFileVersion("0.0.2.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Pvc.Sql")] [assembly: AssemblyDescription("PVC plugin: Sql")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rob Bihun")] [assembly: AssemblyProduct("Pvc.Sql")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("Rob Bihun")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("57dd8320-ea1b-4860-b799-f5de297be2db")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")]
apache-2.0
C#
762198088304f72fedd7ec987212d3f70915a2e7
update Content routing
WebmarksApp/webmarks.nancy,WebmarksApp/webmarks.nancy,WebmarksApp/webmarks.nancy
webmarks.nancy/Bootstrapper.cs
webmarks.nancy/Bootstrapper.cs
using MongoDB.Driver; using Nancy; using Nancy.Conventions; using Nancy.TinyIoc; using System; using System.Configuration; using webmarks.nancy.Models; namespace webmarks.nancy { public class Bootstrapper : DefaultNancyBootstrapper { protected override void ConfigureConventions(NancyConventions nancyConventions) { base.ConfigureConventions(nancyConventions); Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/", @"Content")); } protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); //var connString = "mongodb://localhost:27017"; //var connString = Environment.GetEnvironmentVariable("MONGOLAB_URI"); var connString = ConfigurationManager.AppSettings.Get("MONGOLAB_URI"); var databaseName = "speakersdb"; var mongoClient = new MongoClient(connString); //MongoServer server = mongoClient.GetServer(); var database = mongoClient.GetDatabase(databaseName); var collection = database.GetCollection<Speaker>("speakers"); container.Register(database); container.Register(collection); } } }
using MongoDB.Driver; using Nancy; using Nancy.Conventions; using Nancy.TinyIoc; using System; using System.Configuration; using webmarks.nancy.Models; namespace webmarks.nancy { public class Bootstrapper : DefaultNancyBootstrapper { protected override void ConfigureConventions(NancyConventions nancyConventions) { base.ConfigureConventions(nancyConventions); //Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/", @"public")); } protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); //var connString = "mongodb://localhost:27017"; //var connString = Environment.GetEnvironmentVariable("MONGOLAB_URI"); var connString = ConfigurationManager.AppSettings.Get("MONGOLAB_URI"); var databaseName = "speakersdb"; var mongoClient = new MongoClient(connString); //MongoServer server = mongoClient.GetServer(); var database = mongoClient.GetDatabase(databaseName); var collection = database.GetCollection<Speaker>("speakers"); container.Register(database); container.Register(collection); } } }
mit
C#
985d38783982d58ed387b2b306331ba9649fbf49
Support custom directory in tdocs
TheBerkin/Rant
Rant.Tools/Commands/DicDocsCommand.cs
Rant.Tools/Commands/DicDocsCommand.cs
using Rant.Vocabulary; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rant.Tools.Commands { [CommandName("tdocs", Description = "Generates a Markdown documentation file all table files in the current directory.")] [CommandParam("out", false, "Specifies the output path for the generated file. (Default: ./dictionary.md)")] internal class DicDocsCommand : Command { protected override void OnRun() { var cmdPaths = CmdLine.GetPaths(); var workingDir = cmdPaths.Length > 0 ? cmdPaths[0] : Environment.CurrentDirectory; var outputPath = CmdLine.Property("out", Path.Combine(workingDir, "dictionary.md")); var tables = Directory.GetFiles(workingDir, "*.table", SearchOption.AllDirectories) .Select(dir => RantDictionaryTable.FromStream(dir, File.Open(dir, FileMode.Open))) .OrderBy(table => table.Name); using (var writer = new StreamWriter(outputPath)) { foreach (var table in tables) { writer.WriteLine($"## {table.Name}"); writer.WriteLine($"**Entries:** {table.EntryCount}\n"); if (table.HiddenClasses.Any()) writer.WriteLine($"**Hidden classes:** {table.HiddenClasses.Select(cl => $"`{cl}`").Aggregate((c, n) => $"{c}, {n}")}\n"); // Write subtype list writer.WriteLine($"### Subtypes\n"); for (int i = 0; i < table.TermsPerEntry; i++) { writer.WriteLine($"{i + 1}. {table.GetSubtypesForIndex(i).Select(st => $"`{st}`").Aggregate((c, n) => $"{c}, {n}")}"); } writer.WriteLine(); // Write classes writer.WriteLine($"### Classes\n"); foreach (var cl in table.GetClasses().OrderBy(cl => cl)) { writer.WriteLine($"- `{cl}` ({table.GetEntries().Count(e => e.ContainsClass(cl))})"); } writer.WriteLine(); } } } } }
using Rant.Vocabulary; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rant.Tools.Commands { [CommandName("tdocs", Description = "Generates a Markdown documentation file all table files in the current directory.")] [CommandParam("out", false, "Specifies the output path for the generated file. (Default: ./dictionary.md)")] internal class DicDocsCommand : Command { protected override void OnRun() { var outputPath = CmdLine.Property("out", Path.Combine(Environment.CurrentDirectory, $"dictionary.md")); var tables = Directory.GetFiles(Environment.CurrentDirectory, "*.table", SearchOption.AllDirectories) .Select(dir => RantDictionaryTable.FromStream(dir, File.Open(dir, FileMode.Open))) .OrderBy(table => table.Name); using (var writer = new StreamWriter(outputPath)) { foreach(var table in tables) { writer.WriteLine($"## {table.Name}"); writer.WriteLine($"**Entries:** {table.EntryCount}\n"); if (table.HiddenClasses.Any()) writer.WriteLine($"**Hidden classes:** {table.HiddenClasses.Select(cl => $"`{cl}`").Aggregate((c, n) => $"{c}, {n}")}\n"); // Write subtype list writer.WriteLine($"### Subtypes\n"); for(int i = 0; i < table.TermsPerEntry; i++) { writer.WriteLine($"{i + 1}. {table.GetSubtypesForIndex(i).Select(st => $"`{st}`").Aggregate((c, n) => $"{c}, {n}")}"); } writer.WriteLine(); // Write classes writer.WriteLine($"### Classes\n"); foreach(var cl in table.GetClasses().OrderBy(cl => cl)) { writer.WriteLine($"- `{cl}` ({table.GetEntries().Count(e => e.ContainsClass(cl))})"); } writer.WriteLine(); } } } } }
mit
C#
c8dc5d0b4e7e13e401e390f5a874319fe47509f1
update versji
mburgknap/Redmine-Time-Log-2
RedmineLog/Properties/AssemblyInfo.cs
RedmineLog/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("RedmineLog")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("LiteApps")] [assembly: AssemblyProduct("RedmineLog")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("90923f4c-765b-457e-af33-c48521f7c320")] // 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("6.2.0.0")] [assembly: AssemblyFileVersion("6.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("RedmineLog")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("LiteApps")] [assembly: AssemblyProduct("RedmineLog")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("90923f4c-765b-457e-af33-c48521f7c320")] // 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("6.0.0.0")] [assembly: AssemblyFileVersion("6.0.0.0")]
mit
C#
5486ca084e66e6a8bb751a153837b72e534769ae
Resolve tests
peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.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.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.5295339534769958d, "diffcalc-test")] [TestCase(1.1514260533755143d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(9.047752485219954d, "diffcalc-test")] [TestCase(1.3985711787077566d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
// 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.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.5867229481955389d, "diffcalc-test")] [TestCase(1.0416315570967911d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(8.2730989071947896d, "diffcalc-test")] [TestCase(1.2726413186221039d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
mit
C#
205b284f7b517af45a25abaa8404f49ae46621d8
add test cases for complex types in CustomAttributes
joj/cecil,gluck/cecil,fnajera-rac-de/cecil,saynomoo/cecil,furesoft/cecil,jbevain/cecil,cgourlay/cecil,ttRevan/cecil,xen2/cecil,sailro/cecil,mono/cecil,SiliconStudio/Mono.Cecil,kzu/cecil
Test/Resources/cs/CustomAttributes.cs
Test/Resources/cs/CustomAttributes.cs
using System; using System.Collections.Generic; using System.Runtime.CompilerServices; [assembly: Foo ("bingo")] [assembly: TypeForwardedTo (typeof (System.Diagnostics.DebuggableAttribute))] enum Bingo : short { Fuel = 2, Binga = 4, } /* in System.Security.AccessControl [Flags] public enum AceFlags : byte { None = 0, ObjectInherit = 0x01, ContainerInherit = 0x02, NoPropagateInherit = 0x04, InheritOnly = 0x08, InheritanceFlags = ObjectInherit | ContainerInherit | NoPropagateInherit | InheritOnly, Inherited = 0x10, SuccessfulAccess = 0x40, FailedAccess = 0x80, AuditFlags = SuccessfulAccess | FailedAccess, } */ class FooAttribute : Attribute { internal class Token { } public FooAttribute () { } public FooAttribute (string str) { } public FooAttribute (sbyte a, byte b, bool c, bool d, ushort e, short f, char g) { } public FooAttribute (int a, uint b, float c, long d, ulong e, double f) { } public FooAttribute (char [] chars) { } public FooAttribute (object a, object b) { } public FooAttribute (Bingo bingo) { } public FooAttribute (System.Security.AccessControl.AceFlags flags) { } public FooAttribute (Type type) { } public int Bang { get { return 0; } set {} } public string Fiou { get { return "fiou"; } set {} } public object Pan; public string [] PanPan; public Type Chose; } [Foo ("bar")] class Hamster { } [Foo (null as string)] class Dentist { } [Foo (-12, 242, true, false, 4242, -1983, 'c')] class Steven { } [Foo (-100000, 200000, 12.12f, long.MaxValue, ulong.MaxValue, 64.646464)] class Seagull { } [Foo (new char [] { 'c', 'e', 'c', 'i', 'l' })] class Rifle { } [Foo ("2", 2)] class Worm { } [Foo (new object [] { "2", 2, 'c' }, new object [] { new object [] { 1, 2, 3}, null })] class Sheep { } [Foo (Bang = 42, PanPan = new string [] { "yo", "yo" }, Pan = new object [] { 1, "2", '3' }, Fiou = null)] class Angola { } [Foo (Bingo.Fuel)] class Zero { } [Foo (System.Security.AccessControl.AceFlags.NoPropagateInherit)] class Ace { } [Foo (new object [] { Bingo.Fuel, Bingo.Binga }, null, Pan = System.Security.AccessControl.AceFlags.NoPropagateInherit)] class Bzzz { } [Foo (typeof (Bingo))] class Typed { } [Foo (typeof (FooAttribute.Token))] class NestedTyped { } [Foo (Chose = typeof (Typed))] class Truc { } [Foo (Chose = (Type) null)] class Machin { } [Foo (typeof (Dictionary<,>))] class OpenGeneric<X, Y> { } [Foo (typeof (Dictionary<string, OpenGeneric<Machin, int>[,]>))] class ClosedGeneric { }
using System; using System.Runtime.CompilerServices; [assembly: Foo ("bingo")] [assembly: TypeForwardedTo (typeof (System.Diagnostics.DebuggableAttribute))] enum Bingo : short { Fuel = 2, Binga = 4, } /* in System.Security.AccessControl [Flags] public enum AceFlags : byte { None = 0, ObjectInherit = 0x01, ContainerInherit = 0x02, NoPropagateInherit = 0x04, InheritOnly = 0x08, InheritanceFlags = ObjectInherit | ContainerInherit | NoPropagateInherit | InheritOnly, Inherited = 0x10, SuccessfulAccess = 0x40, FailedAccess = 0x80, AuditFlags = SuccessfulAccess | FailedAccess, } */ class FooAttribute : Attribute { internal class Token { } public FooAttribute () { } public FooAttribute (string str) { } public FooAttribute (sbyte a, byte b, bool c, bool d, ushort e, short f, char g) { } public FooAttribute (int a, uint b, float c, long d, ulong e, double f) { } public FooAttribute (char [] chars) { } public FooAttribute (object a, object b) { } public FooAttribute (Bingo bingo) { } public FooAttribute (System.Security.AccessControl.AceFlags flags) { } public FooAttribute (Type type) { } public int Bang { get { return 0; } set {} } public string Fiou { get { return "fiou"; } set {} } public object Pan; public string [] PanPan; public Type Chose; } [Foo ("bar")] class Hamster { } [Foo (null as string)] class Dentist { } [Foo (-12, 242, true, false, 4242, -1983, 'c')] class Steven { } [Foo (-100000, 200000, 12.12f, long.MaxValue, ulong.MaxValue, 64.646464)] class Seagull { } [Foo (new char [] { 'c', 'e', 'c', 'i', 'l' })] class Rifle { } [Foo ("2", 2)] class Worm { } [Foo (new object [] { "2", 2, 'c' }, new object [] { new object [] { 1, 2, 3}, null })] class Sheep { } [Foo (Bang = 42, PanPan = new string [] { "yo", "yo" }, Pan = new object [] { 1, "2", '3' }, Fiou = null)] class Angola { } [Foo (Bingo.Fuel)] class Zero { } [Foo (System.Security.AccessControl.AceFlags.NoPropagateInherit)] class Ace { } [Foo (new object [] { Bingo.Fuel, Bingo.Binga }, null, Pan = System.Security.AccessControl.AceFlags.NoPropagateInherit)] class Bzzz { } [Foo (typeof (Bingo))] class Typed { } [Foo (typeof (FooAttribute.Token))] class NestedTyped { } [Foo (Chose = typeof (Typed))] class Truc { } [Foo (Chose = (Type) null)] class Machin { }
mit
C#
15c6ab9e7d8010c9835159222fd665309910eafb
make websocket server static
susch19/TurtlesBrain,susch19/TurtlesBrain
TurtlesBrain/WebSocketTurtleServer.cs
TurtlesBrain/WebSocketTurtleServer.cs
using Fleck; using System; using System.Collections.Generic; using System.Linq; namespace TurtlesBrain { public static class WebSocketTurtleServer { private static IWebSocketConnection socket; private static WebSocketServer webServer; private static WebSocketHttpRequest req; public static void Start(int port) { webServer = new WebSocketServer($"ws://0.0.0.0:{port}"); req = new WebSocketHttpRequest(); webServer.Start(internalSocket => { socket = internalSocket; internalSocket.OnOpen = () => { UpdateList(); Program.Info("Socket opened"); }; internalSocket.OnClose = () => Program.Info("Socket closed"); internalSocket.OnMessage = ProcessMessage; TurtleServer.GotResult += (label, result) => internalSocket.Send("result|" + label + "|" + result); }); } private static IEnumerable<string> LabelList => new[] { "list" }.Concat(ClientServer.Turtles.Select(t => t.Label)); public static void UpdateList() => socket.Send(string.Join("|", LabelList)); private static void ProcessMessage(string message) { Turtle turtle; string label = message.Split('|')[0]; string command = message.Split('|')[1]; if(ClientServer.TryGetTurtle(label, out turtle)) turtle.Execute(command); } } }
using Fleck; using System; namespace TurtlesBrain { public class WebSocketTurtleServer { private IWebSocketConnection socket; private WebSocketServer webServer; private WebSocketHttpRequest req; public WebSocketTurtleServer() { webServer = new WebSocketServer("ws://0.0.0.0:34197"); req = new WebSocketHttpRequest(); webServer.Start(internalSocket => { socket = internalSocket; internalSocket.OnOpen = () => { string turtleList = "list"; foreach (var item in Program.turtleserver.turtles) { turtleList += "|" + item.Value.Label; } internalSocket.Send(turtleList); Console.WriteLine("Socket opened"); }; internalSocket.OnClose = () => Console.WriteLine("Socket closed"); internalSocket.OnMessage = message => ProcessMessage(message); Program.turtleserver.GotResult += (label, result) => internalSocket.Send("result|" + label + "|" + result); }); } public void UpdateList() { string turtleList = "list"; foreach (var item in Program.turtleserver.turtles) { turtleList += "|" + item.Value.Label; } socket.Send(turtleList); } private void ProcessMessage(string message) { Turtle turtle; string label = message.Split('|')[0]; string command = message.Split('|')[1]; Program.turtleserver.turtles.TryGetValue(label, out turtle); if (turtle != null) { turtle.AddCommand(command, (test, result) => { }); } } } }
mit
C#
bf0201b079585f4319e3a85e813c9c5cfd34718a
Update server to send proper response
avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors
csharp/Hello/HelloServer/Program.cs
csharp/Hello/HelloServer/Program.cs
using System; using System.Threading.Tasks; using Grpc.Core; using Hello; namespace HelloServer { class HelloServerImpl : HelloService.HelloServiceBase { public override Task<HelloResp> SayHello(HelloReq request, ServerCallContext context) { return Task.FromResult(new HelloResp { Result = "Hey, " + request.Name + "!"}); } public override Task<HelloResp> SayHelloStrict(HelloReq request, ServerCallContext context) { if (request.Name.Length >= 10) { const string msg = "Length of `Name` cannot be more than 10 characters"; throw new RpcException(new Status(StatusCode.InvalidArgument, msg)); } return Task.FromResult(new HelloResp { Result = "Hey, " + request.Name + "!"}); } } class Program { const int Port = 50051; public static void Main(string[] args) { Server server = new Server { Services = { HelloService.BindService(new HelloServerImpl()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Hello server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); } } }
using System; using System.Threading.Tasks; using Grpc.Core; using Hello; namespace HelloServer { class HelloServerImpl : HelloService.HelloServiceBase { public override Task<HelloResp> SayHello(HelloReq request, ServerCallContext context) { return Task.FromResult(new HelloResp { Result = "Hey " + request.Name }); } public override Task<HelloResp> SayHelloStrict(HelloReq request, ServerCallContext context) { if (request.Name.Length >= 10) { const string msg = "Length of `Name` cannot be more than 10 characters"; throw new RpcException(new Status(StatusCode.InvalidArgument, msg)); } return Task.FromResult(new HelloResp { Result = "Hey " + request.Name }); } } class Program { const int Port = 50051; public static void Main(string[] args) { Server server = new Server { Services = { HelloService.BindService(new HelloServerImpl()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Hello server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); } } }
mit
C#
70534da641da89ff4c1a5b3efd94c5e5e925cde1
Mask sasl-init.initial-response in frame trace.
Azure/amqpnetlite,ChugR/amqpnetlite
src/Sasl/SaslInit.cs
src/Sasl/SaslInit.cs
// ------------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this // file except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------------------ namespace Amqp.Sasl { using Amqp.Framing; using Amqp.Types; sealed class SaslInit : DescribedList { public SaslInit() : base(Codec.SaslInit, 3) { } public Symbol Mechanism { get { return (Symbol)this.Fields[0]; } set { this.Fields[0] = value; } } public byte[] InitialResponse { get { return (byte[])this.Fields[1]; } set { this.Fields[1] = value; } } public string HostName { get { return (string)this.Fields[2]; } set { this.Fields[2] = value; } } #if TRACE public override string ToString() { return this.GetDebugString( "sasl-init", new object[] { "mechanism", "initial-response", "hostname" }, new object[] { this.Fields[0], "...", this.Fields[2] }); } #endif } }
// ------------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this // file except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------------------ namespace Amqp.Sasl { using Amqp.Framing; using Amqp.Types; sealed class SaslInit : DescribedList { public SaslInit() : base(Codec.SaslInit, 3) { } public Symbol Mechanism { get { return (Symbol)this.Fields[0]; } set { this.Fields[0] = value; } } public byte[] InitialResponse { get { return (byte[])this.Fields[1]; } set { this.Fields[1] = value; } } public string HostName { get { return (string)this.Fields[2]; } set { this.Fields[2] = value; } } #if TRACE public override string ToString() { return this.GetDebugString( "sasl-init", new object[] { "mechanism", "initial-response", "hostname" }, this.Fields); } #endif } }
apache-2.0
C#
d216833e635fb6ec1362d999859d73e1552afe78
Add WikiTest
ats124/backlog4net
src/Backlog4net.Test/WikiMethodsTest.cs
src/Backlog4net.Test/WikiMethodsTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Runtime.Remoting; using System.Text; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Backlog4net.Test { using Api; using Api.Option; using Backlog4net.Internal.Json; using Backlog4net.Internal.Json.Activities; using Conf; using Newtonsoft.Json; using TestConfig; [TestClass] public class WikiMethodsTest { private static BacklogClient client; private static GeneralConfig generalConfig; private static string projectKey; private static long projectId; [ClassInitialize] public static async Task SetupClient(TestContext context) { generalConfig = GeneralConfig.Instance.Value; var conf = new BacklogJpConfigure(generalConfig.SpaceKey); conf.ApiKey = generalConfig.ApiKey; client = new BacklogClientFactory(conf).NewClient(); var users = await client.GetUsersAsync(); projectKey = generalConfig.ProjectKey; var project = await client.GetProjectAsync(projectKey); projectId = project.Id; } [TestMethod] public async Task WikiTest() { var wiki = await client.CreateWikiAsync(new CreateWikiParams(projectId, "TestName", "TestContent") { MailNotify = false, }); Assert.AreEqual(wiki.ProjectId, projectId); Assert.AreNotEqual(wiki.Id, 0); Assert.AreEqual(wiki.Name, "TestName"); Assert.AreEqual(wiki.Content, "TestContent"); var wikiGet = await client.GetWikiAsync(wiki.Id); Assert.AreEqual(wikiGet.Id, wiki.Id); Assert.AreEqual(wikiGet.Name, "TestName"); Assert.AreEqual(wikiGet.Content, "TestContent"); var wikiUpdated = await client.UpdateWikiAsync(new UpdateWikiParams(wiki.Id) { Name = "TestNameUpdated", Content = "TestContentUpdated", MailNotify = false, }); Assert.AreEqual(wikiUpdated.Id, wiki.Id); Assert.AreEqual(wikiUpdated.Name, "TestNameUpdated"); Assert.AreEqual(wikiUpdated.Content, "TestContentUpdated"); var wikiDeleted = await client.DeleteWikiAsync(wiki.Id, false); Assert.AreEqual(wikiDeleted.Id, wiki.Id); Assert.AreEqual(wikiDeleted.Name, "TestNameUpdated"); Assert.AreEqual(wikiDeleted.Content, "TestContentUpdated"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Runtime.Remoting; using System.Text; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Backlog4net.Test { using Api; using Api.Option; using Backlog4net.Internal.Json; using Backlog4net.Internal.Json.Activities; using Conf; using Newtonsoft.Json; using TestConfig; [TestClass] public class WikiMethodsTest { private static BacklogClient client; private static GeneralConfig generalConfig; [ClassInitialize] public static async Task SetupClient(TestContext context) { generalConfig = GeneralConfig.Instance.Value; var conf = new BacklogJpConfigure(generalConfig.SpaceKey); conf.ApiKey = generalConfig.ApiKey; client = new BacklogClientFactory(conf).NewClient(); var users = await client.GetUsersAsync(); } } }
mit
C#
cf8e11a284b9c45882cfafd45cf3664b56a17896
Use culture insensitive comparison for invalid autoroute path (#9985)
stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2
src/OrchardCore.Modules/OrchardCore.Autoroute/Models/AutoroutePartExtensions.cs
src/OrchardCore.Modules/OrchardCore.Autoroute/Models/AutoroutePartExtensions.cs
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using Microsoft.Extensions.Localization; namespace OrchardCore.Autoroute.Models { public static class AutoroutePartExtensions { public static IEnumerable<ValidationResult> ValidatePathFieldValue(this AutoroutePart autoroute, IStringLocalizer S) { if (autoroute.Path == "/") { yield return new ValidationResult(S["Your permalink can't be set to the homepage, please use the homepage option instead."], new[] { nameof(autoroute.Path) }); } if (HasInvalidCharacters(autoroute.Path)) { var invalidCharactersForMessage = string.Join(", ", AutoroutePart.InvalidCharactersForPath.Select(c => $"\"{c}\"")); yield return new ValidationResult(S["Please do not use any of the following characters in your permalink: {0}. No spaces, or consecutive slashes, are allowed (please use dashes or underscores instead).", invalidCharactersForMessage], new[] { nameof(autoroute.Path) }); } if (autoroute.Path?.Length > AutoroutePart.MaxPathLength) { yield return new ValidationResult(S["Your permalink is too long. The permalink can only be up to {0} characters.", AutoroutePart.MaxPathLength], new[] { nameof(autoroute.Path) }); } } private static bool HasInvalidCharacters(string path) { // IndexOfAny performs culture-insensitive and case-sensitive search. if (path?.IndexOfAny(AutoroutePart.InvalidCharactersForPath) > -1) { return true; } if (path?.IndexOf(' ', StringComparison.Ordinal) > -1) { return true; } if (path?.IndexOf("//", StringComparison.Ordinal) > -1) { return true; } return false; } } }
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using Microsoft.Extensions.Localization; namespace OrchardCore.Autoroute.Models { public static class AutoroutePartExtensions { public static IEnumerable<ValidationResult> ValidatePathFieldValue(this AutoroutePart autoroute, IStringLocalizer S) { if (autoroute.Path == "/") { yield return new ValidationResult(S["Your permalink can't be set to the homepage, please use the homepage option instead."], new[] { nameof(autoroute.Path) }); } if (autoroute.Path?.IndexOfAny(AutoroutePart.InvalidCharactersForPath) > -1 || autoroute.Path?.IndexOf(' ') > -1 || autoroute.Path?.IndexOf("//") > -1) { var invalidCharactersForMessage = string.Join(", ", AutoroutePart.InvalidCharactersForPath.Select(c => $"\"{c}\"")); yield return new ValidationResult(S["Please do not use any of the following characters in your permalink: {0}. No spaces, or consecutive slashes, are allowed (please use dashes or underscores instead).", invalidCharactersForMessage], new[] { nameof(autoroute.Path) }); } if (autoroute.Path?.Length > AutoroutePart.MaxPathLength) { yield return new ValidationResult(S["Your permalink is too long. The permalink can only be up to {0} characters.", AutoroutePart.MaxPathLength], new[] { nameof(autoroute.Path) }); } } } }
bsd-3-clause
C#
033de8339e06b44a353688714b13a9d391385283
add the JsonIgnore attribute for IsInEditMode of the TodoItemDto class #2522 (#2742)
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
src/Templates/TodoTemplate/Bit.TodoTemplate/Shared/Dtos/TodoItem/TodoItemDto.cs
src/Templates/TodoTemplate/Bit.TodoTemplate/Shared/Dtos/TodoItem/TodoItemDto.cs
namespace TodoTemplate.Shared.Dtos.TodoItem; public class TodoItemDto { public int Id { get; set; } public string? Title { get; set; } public DateTimeOffset Date { get; set; } public bool IsDone { get; set; } [JsonIgnore] public bool IsInEditMode { get; set; } }
namespace TodoTemplate.Shared.Dtos.TodoItem; public class TodoItemDto { public int Id { get; set; } public string? Title { get; set; } public DateTimeOffset Date { get; set; } public bool IsDone { get; set; } public bool IsInEditMode { get; set; } }
mit
C#
f705b08d3e22f48fc2a6bb8302643335515850e5
Clean up
JScott/ViveGrip
Assets/ViveGrip/Scripts/Internal/ViveGrip_TouchDetection.cs
Assets/ViveGrip/Scripts/Internal/ViveGrip_TouchDetection.cs
using UnityEngine; using System.Collections.Generic; public class ViveGrip_TouchDetection : MonoBehaviour { private List<ViveGrip_Object> collidingObjects = new List<ViveGrip_Object>(); void Start () { GetComponent<SphereCollider>().isTrigger = true; } void OnTriggerEnter(Collider other) { ViveGrip_Object component = ActiveComponent(other.gameObject); if (component == null) { return; } collidingObjects.Add(component); component.Remember(this); } void OnTriggerExit(Collider other) { ViveGrip_Object component = ActiveComponent(other.gameObject); if (component == null) { return; } collidingObjects.Remove(component); component.Forget(this); } public GameObject NearestObject() { float closestDistance = Mathf.Infinity; GameObject touchedObject = null; foreach (ViveGrip_Object component in collidingObjects) { float distance = Vector3.Distance(transform.position, component.transform.position); if (distance < closestDistance) { touchedObject = component.gameObject; closestDistance = distance; } } return touchedObject; } ViveGrip_Object ActiveComponent(GameObject gameObject) { if (gameObject == null) { return null; } // Happens with Destroy() sometimes ViveGrip_Object component = ValidComponent(gameObject.transform); if (component == null) { component = ValidComponent(gameObject.transform.parent); } if (component != null) { return component; } return null; } ViveGrip_Object ValidComponent(Transform transform) { if (transform == null) { return null; } ViveGrip_Object component = transform.GetComponent<ViveGrip_Grabbable>(); if (component != null && component.enabled) { return component; } component = transform.GetComponent<ViveGrip_Interactable>(); if (component != null && component.enabled) { return component; } return null; } }
using UnityEngine; using System.Collections.Generic; using System.Linq; public class ViveGrip_TouchDetection : MonoBehaviour { private List<ViveGrip_Object> collidingObjects = new List<ViveGrip_Object>(); void Start () { GetComponent<SphereCollider>().isTrigger = true; } void OnTriggerEnter(Collider other) { ViveGrip_Object component = ActiveComponent(other.gameObject); if (component == null) { return; } collidingObjects.Add(component); component.Remember(this); } void OnTriggerExit(Collider other) { ViveGrip_Object component = ActiveComponent(other.gameObject); if (component == null) { return; } collidingObjects.Remove(component); component.Forget(this); } public GameObject NearestObject() { float closestDistance = Mathf.Infinity; GameObject touchedObject = null; foreach (GameObject gameObject in TouchingGameObjects()) { float distance = Vector3.Distance(transform.position, gameObject.transform.position); if (distance < closestDistance) { touchedObject = gameObject; closestDistance = distance; } } return touchedObject; } ViveGrip_Object ActiveComponent(GameObject gameObject) { if (gameObject == null) { return null; } // Happens with Destroy() sometimes ViveGrip_Object component = ValidComponent(gameObject.transform); if (component == null) { component = ValidComponent(gameObject.transform.parent); } if (component != null) { return component; } return null; } ViveGrip_Object ValidComponent(Transform transform) { if (transform == null) { return null; } ViveGrip_Object component = transform.GetComponent<ViveGrip_Grabbable>(); if (component != null && component.enabled) { return component; } component = transform.GetComponent<ViveGrip_Interactable>(); if (component != null && component.enabled) { return component; } return null; } GameObject[] TouchingGameObjects() { return collidingObjects.Select(obj => obj.gameObject).ToArray(); } }
mit
C#
0a6cb444f0ad0c41aa6f40e960d30277d5151f1d
Add caching
babelshift/BetterSteamWebAPIDocumentation,babelshift/BetterSteamWebAPIDocumentation
Controllers/HomeController.cs
Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using BetterSteamWebAPIDocumentation.Models; using SteamWebAPI2.Interfaces; using Microsoft.Extensions.Configuration; namespace BetterSteamWebAPIDocumentation.Controllers { public class HomeController : Controller { public static IConfiguration Configuration { get; set; } public HomeController(IConfiguration configuration) { Configuration = configuration; } [ResponseCache(Duration = 86400, Location = ResponseCacheLocation.Client)] public async Task<IActionResult> Index() { string steamWebApiKey = Configuration.GetValue<string>("SteamWebApiKey"); SteamWebAPIUtil session = new SteamWebAPIUtil(steamWebApiKey); var interfaces = await session.GetSupportedAPIListAsync(); return View(interfaces.Data); } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using BetterSteamWebAPIDocumentation.Models; using SteamWebAPI2.Interfaces; using Microsoft.Extensions.Configuration; namespace BetterSteamWebAPIDocumentation.Controllers { public class HomeController : Controller { public static IConfiguration Configuration { get; set; } public HomeController(IConfiguration configuration) { Configuration = configuration; } public async Task<IActionResult> Index() { string steamWebApiKey = Configuration.GetValue<string>("SteamWebApiKey"); SteamWebAPIUtil session = new SteamWebAPIUtil(steamWebApiKey); var interfaces = await session.GetSupportedAPIListAsync(); return View(interfaces.Data); } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } }
mit
C#
1c7a5f2124b35ffe9a55b121ed2146f301deb76a
Update SimpleBinaryBondSerializer.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/Bond/SimpleBinaryBondSerializer.cs
TIKSN.Core/Serialization/Bond/SimpleBinaryBondSerializer.cs
using Bond.IO.Safe; using Bond.Protocols; namespace TIKSN.Serialization.Bond { public class SimpleBinaryBondSerializer : SerializerBase<byte[]> { protected override byte[] SerializeInternal<T>(T obj) { var output = new OutputBuffer(); var writer = new SimpleBinaryWriter<OutputBuffer>(output); global::Bond.Serialize.To(writer, obj); return output.Data.Array; } } }
using Bond.IO.Safe; using Bond.Protocols; namespace TIKSN.Serialization.Bond { public class SimpleBinaryBondSerializer : SerializerBase<byte[]> { protected override byte[] SerializeInternal<T>(T obj) { var output = new OutputBuffer(); var writer = new SimpleBinaryWriter<OutputBuffer>(output); global::Bond.Serialize.To(writer, obj); return output.Data.Array; } } }
mit
C#
9ed69cd65cd2390fc266534e215266755d05525a
remove comments
ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET
ElectronNET.WebApp/Program.cs
ElectronNET.WebApp/Program.cs
using ElectronNET.API; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace ElectronNET.WebApp { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) { return WebHost.CreateDefaultBuilder(args) .UseElectron(args) .UseStartup<Startup>() .Build(); } } }
using ElectronNET.API; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using System; using System.Diagnostics; namespace ElectronNET.WebApp { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } // WICHTIG! UseContentRoot auf Assembly Ordner Essentiell! // Ggf. kann man via Parameter den Content Root durchreichen? public static IWebHost BuildWebHost(string[] args) { // ToDo: Maybe add a "electronized" args check here? // this is the electron case! //if (args.Length > 0) //{ //Console.WriteLine("Test Switch for Electron detection: " + args[0]); return WebHost.CreateDefaultBuilder(args) .UseElectron(args) .UseStartup<Startup>() .Build(); //} //else //{ // return WebHost.CreateDefaultBuilder(args) // .UseStartup<Startup>() // .Build(); //} // this didn't work... its too late, idk... //var builder = WebHost.CreateDefaultBuilder(args); //if (args.Length > 0) //{ // // ToDo: Maybe add a "electronized" args check here? // Console.WriteLine("Test Switch for Electron detection: " + args[0]); // builder = builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory); //} //builder = builder.UseStartup<Startup>(); //return builder.Build(); } } }
mit
C#
29f52b3004693266db7f07412f526e3a4c121321
Add basic fields in Charge's PMD 3DS field
richardlawley/stripe.net,stripe/stripe-dotnet
src/Stripe.net/Entities/Charges/ChargePaymentMethodDetails/ChargePaymentMethodDetailsCardThreeDSecure.cs
src/Stripe.net/Entities/Charges/ChargePaymentMethodDetails/ChargePaymentMethodDetailsCardThreeDSecure.cs
namespace Stripe { using Newtonsoft.Json; using Stripe.Infrastructure; public class ChargePaymentMethodDetailsCardThreeDSecure : StripeEntity { [JsonProperty("succeeded")] public bool Succeeded { get; set; } [JsonProperty("version")] public string Version { get; set; } } }
namespace Stripe { using Newtonsoft.Json; using Stripe.Infrastructure; public class ChargePaymentMethodDetailsCardThreeDSecure : StripeEntity { } }
apache-2.0
C#
3d4e6bb11391aa8485aea32af330511a32d98290
Add test to check default headers in HttpClientFactory
AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet
core/tests/Test.Microsoft.Identity.Core.Unit/HttpTests/HttpClientFactoryTests.cs
core/tests/Test.Microsoft.Identity.Core.Unit/HttpTests/HttpClientFactoryTests.cs
//---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------ using System; using System.Linq; using System.Text; using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks; using Microsoft.Identity.Core.Http; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Test.Microsoft.Identity.Unit.HttpTests { [TestClass] public class HttpClientFactoryTests { [TestMethod] [TestCategory("HttpClientFactoryTests")] public void GetHttpClient_MaxRespContentBuffSizeSetTo1Mb() { HttpClientFactory.ReturnHttpClientForMocks = false; Assert.AreEqual(1024 * 1024, HttpClientFactory.GetHttpClient().MaxResponseContentBufferSize); } [TestMethod] [TestCategory("HttpClientFactoryTests")] public void GetHttpClient_DefaultHeadersSetToJson() { var client = HttpClientFactory.GetHttpClient(); Assert.IsNotNull(client.DefaultRequestHeaders.Accept); Assert.IsTrue(client.DefaultRequestHeaders.Accept.Any<MediaTypeWithQualityHeaderValue>(x => x.MediaType == "application/json")); } } }
//---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------ using System; using System.Text; using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Identity.Core.Http; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Test.Microsoft.Identity.Unit.HttpTests { [TestClass] public class HttpClientFactoryTests { [TestMethod] [TestCategory("HttpClientFactoryTests")] public void GetHttpClient_MaxRespContentBuffSizeSetTo1Mb() { HttpClientFactory.ReturnHttpClientForMocks = false; Assert.AreEqual(1024 * 1024, HttpClientFactory.GetHttpClient().MaxResponseContentBufferSize); } } }
mit
C#
a3f51736afef6ddf8ddb03bb4bbcceed54929691
add quantyfier "this" and rename methods
ivayloivanof/C-Sharp-Chat-Programm
Client/ChatClient/ChatClient/Client.cs
Client/ChatClient/ChatClient/Client.cs
namespace ChatClient { using System.Collections.Generic; public class Client { public Server connectedServer; public string LoginName; public string LoginPwd; public string SrvPwd; public List<ServerInfo> SrvInfoList; public Client() { this.SrvInfoList = new List<ServerInfo>(); this.LoadServerInfoList(); this.connectedServer = new Server(); this.connectedServer.Disconnected += new Server.ServerDisconnectedHandler(this.ServerDisconnected); } public void SetLoginData(string loginName, string loginPassword, string serverPassword = "") { this.LoginName = loginName; this.LoginPwd = loginPassword; this.SrvPwd = serverPassword; } public void ServerDisconnected(object handle) { } private void LoadServerInfoList() { } } }
namespace ChatClient { using System.Collections.Generic; public class Client { public Server connectedServer; public string LoginName; public string LoginPwd; public string SrvPwd; public List<ServerInfo> SrvInfoList; public Client() { this.SrvInfoList = new List<ServerInfo>(); this.LoadSrvInfoList(); this.connectedServer = new Server(); this.connectedServer.Disconnected += new Server.ServerDisconnectedHandler(server_Disconnected); } private void LoadSrvInfoList() { } public void setLoginData(string _LoginName, string _LoginPwd, string _SrvPwd="") { LoginName = _LoginName; LoginPwd = _LoginPwd; SrvPwd = _SrvPwd; } public void server_Disconnected(object handle) { } } }
unlicense
C#
3a527dbd2d383fe83d46e31924506ee13ae14cc6
Update assembly info.
jcheng31/ForecastPCL,jcheng31/DarkSkyApi
ForecastPCL/Properties/AssemblyInfo.cs
ForecastPCL/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("ForecastPCL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForecastPCL")] [assembly: AssemblyCopyright("Copyright © 2015")] [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("2.1.1.0")] [assembly: AssemblyFileVersion("2.1.1.0")]
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("ForecastPCL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForecastPCL")] [assembly: AssemblyCopyright("Copyright © 2015")] [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("2.1.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")]
mit
C#
bb9f5d53f83fd8725575dbdbde7bbfab086d52a7
rename bad name test
aritters/Ritter,arsouza/Aritter,arsouza/Aritter
src/Aritter.Infra.Crosscutting.Tests/Adapter/TypeAdapterFactory_CreateAdapter.cs
src/Aritter.Infra.Crosscutting.Tests/Adapter/TypeAdapterFactory_CreateAdapter.cs
using Aritter.Infra.Crosscutting.Adapter; using Moq; using Xunit; namespace Aritter.Infra.Crosscutting.Tests.Adapter { public class TypeAdapterFactory_CreateAdapter { [Fact] public void ReturnAnyTypeAdapterGivenAnyTypeAdapterFactory() { Mock<ITypeAdapter> moqTypeAdapter = new Mock<ITypeAdapter>(); Mock<ITypeAdapterFactory> moqTypeAdapterFactory = new Mock<ITypeAdapterFactory>(); moqTypeAdapterFactory.Setup(p => p.Create()).Returns(moqTypeAdapter.Object); TypeAdapterFactory.SetCurrent(moqTypeAdapterFactory.Object); ITypeAdapter typeAdapter = TypeAdapterFactory.CreateAdapter(); Assert.NotNull(typeAdapter); Assert.Equal(typeAdapter, moqTypeAdapter.Object); } [Fact] public void NotThrowExceptionGivenNull() { TypeAdapterFactory.SetCurrent(null); ITypeAdapter typeAdapter = TypeAdapterFactory.CreateAdapter(); Assert.Null(typeAdapter); } } }
using Aritter.Infra.Crosscutting.Adapter; using Moq; using Xunit; namespace Aritter.Infra.Crosscutting.Tests.Adapter { public class TypeAdapterFactory_CreateAdapter { [Fact] public void ReturnAnyTypeAdapterGivenAnyTypeAdapterFactory() { Mock<ITypeAdapter> moqTypeAdapter = new Mock<ITypeAdapter>(); Mock<ITypeAdapterFactory> moqTypeAdapterFactory = new Mock<ITypeAdapterFactory>(); moqTypeAdapterFactory.Setup(p => p.Create()).Returns(moqTypeAdapter.Object); TypeAdapterFactory.SetCurrent(moqTypeAdapterFactory.Object); ITypeAdapter typeAdapter = TypeAdapterFactory.CreateAdapter(); Assert.NotNull(typeAdapter); Assert.Equal(typeAdapter, moqTypeAdapter.Object); } [Fact] public void CallGivenNull() { TypeAdapterFactory.SetCurrent(null); ITypeAdapter typeAdapter = TypeAdapterFactory.CreateAdapter(); Assert.Null(typeAdapter); } } }
mit
C#
51b8da41b40ce9aa38719fcca2b7d7f5b709434d
Fix build
ixfalia/banshee,GNOME/banshee,babycaseny/banshee,babycaseny/banshee,GNOME/banshee,dufoli/banshee,ixfalia/banshee,arfbtwn/banshee,Carbenium/banshee,stsundermann/banshee,Carbenium/banshee,dufoli/banshee,arfbtwn/banshee,dufoli/banshee,ixfalia/banshee,ixfalia/banshee,Carbenium/banshee,babycaseny/banshee,stsundermann/banshee,stsundermann/banshee,GNOME/banshee,babycaseny/banshee,arfbtwn/banshee,arfbtwn/banshee,arfbtwn/banshee,babycaseny/banshee,dufoli/banshee,dufoli/banshee,ixfalia/banshee,ixfalia/banshee,Carbenium/banshee,GNOME/banshee,dufoli/banshee,stsundermann/banshee,babycaseny/banshee,babycaseny/banshee,GNOME/banshee,stsundermann/banshee,stsundermann/banshee,GNOME/banshee,arfbtwn/banshee,GNOME/banshee,arfbtwn/banshee,arfbtwn/banshee,ixfalia/banshee,babycaseny/banshee,Carbenium/banshee,stsundermann/banshee,dufoli/banshee,dufoli/banshee,ixfalia/banshee,stsundermann/banshee,GNOME/banshee,Carbenium/banshee
src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/GioDriveMetadataSource.cs
src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/GioDriveMetadataSource.cs
// // GioDriveMetadetaSource.cs // // Author: // Alex Launi <alex.launi@gmail.com> // // Copyright (c) 2010 Alex Launi // // 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. #if ENABLE_GIO_HARDWARE using System; using GLib; namespace Banshee.Hardware.Gio { public class GioDriveMetadataSource : GioMetadataSource { IDrive Drive { get; set; } public GioDriveMetadataSource (IDrive drive) { Drive = drive; } #region implemented abstract members of Banshee.Hardware.Gio.GioMetadataSource public override string GetPropertyString (string key) { throw new System.NotImplementedException(); } public override double GetPropertyDouble (string key) { throw new System.NotImplementedException(); } public override bool GetPropertyBoolean (string key) { throw new System.NotImplementedException(); } public override int GetPropertyInteger (string key) { throw new System.NotImplementedException(); } public override ulong GetPropertyUInt64 (string key) { throw new System.NotImplementedException(); } public override string[] GetPropertyStringList (string key) { throw new System.NotImplementedException(); } public override bool PropertyExists (string key) { throw new System.NotImplementedException(); } #endregion } } #endif
// // GioDriveMetadetaSource.cs // // Author: // Alex Launi <alex.launi@gmail.com> // // Copyright (c) 2010 Alex Launi // // 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. #if ENABLE_GIO_HARDWARE using System; using GLib; namespace Banshee.Hardware.Gio { public class GioDriveMetadetaSource : GioMetadataSource { IDrive Drive { get; set; } public GioDriveMetadetaSource (IDrive drive) { Drive = drive; } #region implemented abstract members of Banshee.Hardware.Gio.GioMetadataSource public override string GetPropertyString (string key) { throw new System.NotImplementedException(); } public override double GetPropertyDouble (string key) { throw new System.NotImplementedException(); } public override bool GetPropertyBoolean (string key) { throw new System.NotImplementedException(); } public override int GetPropertyInteger (string key) { throw new System.NotImplementedException(); } public override ulong GetPropertyUInt64 (string key) { throw new System.NotImplementedException(); } public override string[] GetPropertyStringList (string key) { throw new System.NotImplementedException(); } public override bool PropertyExists (string key) { throw new System.NotImplementedException(); } #endregion } } #endif
mit
C#
94bacce2f7b418159506cc34675a7ce499f64a25
Add a method to get settings from a url.
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
src/CompetitionPlatform/Data/AzureRepositories/Settings/GeneralSettingsReader.cs
src/CompetitionPlatform/Data/AzureRepositories/Settings/GeneralSettingsReader.cs
using System.Net.Http; using System.Text; using AzureStorage.Blob; using Common; using Newtonsoft.Json; namespace CompetitionPlatform.Data.AzureRepositories.Settings { public static class GeneralSettingsReader { public static T ReadGeneralSettings<T>(string connectionString, string container, string fileName) { var settingsStorage = new AzureBlobStorage(connectionString); var settingsData = settingsStorage.GetAsync(container, fileName).Result.ToBytes(); var str = Encoding.UTF8.GetString(settingsData); return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str); } public static T ReadGeneralSettingsFromUrl<T>(string settingsUrl) { var httpClient = new HttpClient(); var settingsString = httpClient.GetStringAsync(settingsUrl).Result; var serviceBusSettings = JsonConvert.DeserializeObject<T>(settingsString); return serviceBusSettings; } } }
using System.Text; using AzureStorage.Blob; using Common; namespace CompetitionPlatform.Data.AzureRepositories.Settings { public static class GeneralSettingsReader { public static T ReadGeneralSettings<T>(string connectionString, string container, string fileName) { var settingsStorage = new AzureBlobStorage(connectionString); var settingsData = settingsStorage.GetAsync(container, fileName).Result.ToBytes(); var str = Encoding.UTF8.GetString(settingsData); return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str); } } }
mit
C#
8e4153fd31a967eef215d49d2f68a98865e79ac2
Add test covering horrible fail scenario
smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework
osu.Framework.Tests/Visual/Platform/TestSceneExecutionModes.cs
osu.Framework.Tests/Visual/Platform/TestSceneExecutionModes.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.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Platform; using osu.Framework.Threading; namespace osu.Framework.Tests.Visual.Platform { [Ignore("This test does not cover correct GL context acquire/release when run headless.")] public class TestSceneExecutionModes : FrameworkTestScene { private Bindable<ExecutionMode> executionMode; [BackgroundDependencyLoader] private void load(FrameworkConfigManager configManager) { executionMode = configManager.GetBindable<ExecutionMode>(FrameworkSetting.ExecutionMode); } [Test] public void ToggleModeSmokeTest() { AddRepeatStep("toggle execution mode", () => executionMode.Value = executionMode.Value == ExecutionMode.MultiThreaded ? ExecutionMode.SingleThread : ExecutionMode.MultiThreaded, 2); } [Test] public void TestRapidSwitching() { ScheduledDelegate switchStep = null; int switchCount = 0; AddStep("install quick switch step", () => { switchStep = Scheduler.AddDelayed(() => { executionMode.Value = executionMode.Value == ExecutionMode.MultiThreaded ? ExecutionMode.SingleThread : ExecutionMode.MultiThreaded; switchCount++; }, 0, true); }); AddUntilStep("switch count sufficiently high", () => switchCount > 1000); AddStep("remove", () => switchStep.Cancel()); } } }
// 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.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Platform; namespace osu.Framework.Tests.Visual.Platform { [Ignore("This test does not cover correct GL context acquire/release when run headless.")] public class TestSceneExecutionModes : FrameworkTestScene { private Bindable<ExecutionMode> executionMode; [BackgroundDependencyLoader] private void load(FrameworkConfigManager configManager) { executionMode = configManager.GetBindable<ExecutionMode>(FrameworkSetting.ExecutionMode); } [Test] public void ToggleModeSmokeTest() { AddRepeatStep("toggle execution mode", () => executionMode.Value = executionMode.Value == ExecutionMode.MultiThreaded ? ExecutionMode.SingleThread : ExecutionMode.MultiThreaded, 2); } } }
mit
C#
4158146c719f6ef3d7f58991b284cf599426d8e5
Fix spinenr tick samples not positioned at centre
peppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.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; namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { public override bool DisplayResult => false; protected DrawableSpinner DrawableSpinner => (DrawableSpinner)ParentHitObject; public DrawableSpinnerTick() : this(null) { } public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { Anchor = Anchor.Centre; Origin = Anchor.Centre; } protected override double MaximumJudgementOffset => DrawableSpinner.HitObject.Duration; /// <summary> /// Apply a judgement result. /// </summary> /// <param name="hit">Whether this tick was reached.</param> internal void TriggerResult(bool hit) => ApplyResult(r => r.Type = hit ? r.Judgement.MaxResult : r.Judgement.MinResult); } }
// 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. namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { public override bool DisplayResult => false; protected DrawableSpinner DrawableSpinner => (DrawableSpinner)ParentHitObject; public DrawableSpinnerTick() : base(null) { } public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { } protected override double MaximumJudgementOffset => DrawableSpinner.HitObject.Duration; /// <summary> /// Apply a judgement result. /// </summary> /// <param name="hit">Whether this tick was reached.</param> internal void TriggerResult(bool hit) => ApplyResult(r => r.Type = hit ? r.Judgement.MaxResult : r.Judgement.MinResult); } }
mit
C#
c21f11ae450001eff5bfc5db84de8d8bc26c8555
use linq to add multiple claims
0xFireball/KQAnalytics3,0xFireball/KQAnalytics3,0xFireball/KQAnalytics3
KQAnalytics3/src/KQAnalytics3/Services/Authentication/ClientApiAccessValidator.cs
KQAnalytics3/src/KQAnalytics3/Services/Authentication/ClientApiAccessValidator.cs
using KQAnalytics3.Configuration.Access; using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; namespace KQAnalytics3.Services.Authentication { public static class ClientApiAccessValidator { public static string AuthTypeKey => "authType"; public static string AccessScopeKey => "accessScope"; public static IEnumerable<Claim> GetAuthClaims(ApiAccessKey accessKey) { var claimList = new List<Claim> { new Claim(AuthTypeKey, "stateless"), }; var accessScopeClaims = accessKey.AccessScopes.Select(accessScope => new Claim(AccessScopeKey, accessScope.ToString())); claimList.AddRange(accessScopeClaims); return claimList; } public static ApiAccessScope GetAccessScope(Claim accessScopeClaim) { return (ApiAccessScope)Enum.Parse(typeof(ApiAccessScope), accessScopeClaim.Value); } } }
using KQAnalytics3.Configuration.Access; using System; using System.Collections.Generic; using System.Security.Claims; namespace KQAnalytics3.Services.Authentication { public static class ClientApiAccessValidator { public static string AuthTypeKey => "authType"; public static string AccessScopeKey => "accessScope"; public static IEnumerable<Claim> GetAuthClaims(ApiAccessKey accessKey) { return new Claim[] { new Claim(AuthTypeKey, "stateless"), new Claim(AccessScopeKey, accessKey.AccessScopes.ToString()) }; } public static ApiAccessScope GetAccessScope(Claim accessScopeClaim) { return (ApiAccessScope)Enum.Parse(typeof(ApiAccessScope), accessScopeClaim.Value); } } }
agpl-3.0
C#
bc8bcad0bd0f23e225f7d663aa6a6078aba2647f
Update logger again
newchild/LegendaryClient-1,semtize/LegendaryClient
LCLog/WriteToLog.cs
LCLog/WriteToLog.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LCLog { /// <summary> /// Worlds most basic logger for LegendaryClient /// </summary> public class WriteToLog { /// <summary> /// Where to put the log file /// </summary> public static string ExecutingDirectory; /// <summary> /// What is the Log file name /// </summary> public static string LogfileName; /// <summary> /// Do the log /// </summary> /// <param name="lines"></param> /// <param name="type"></param> public static void Log(String lines, String type = "LOG") { System.IO.StreamWriter file = new System.IO.StreamWriter(Path.Combine(ExecutingDirectory, "Logs", LogfileName), true); file.WriteLine(string.Format("({0} {1}) [{2}]: {3}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), type.ToUpper(), lines)); file.Close(); } public static void CreateLogFile() { if (!Directory.Exists(Path.Combine(ExecutingDirectory, "Logs"))) Directory.CreateDirectory(Path.Combine(ExecutingDirectory, "Logs")); LogfileName = string.Format("{0}T{1} {2}", DateTime.Now.ToShortDateString().Replace("/", "_"), DateTime.Now.ToShortTimeString().Replace(" ", "").Replace(":", "-"), "_" + LogfileName); var file = File.Create(Path.Combine(ExecutingDirectory, "Logs", LogfileName)); file.Close(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LCLog { /// <summary> /// Worlds most basic logger for LegendaryClient /// </summary> public class WriteToLog { /// <summary> /// Where to put the log file /// </summary> public static string ExecutingDirectory; /// <summary> /// What is the Log file name /// </summary> public static string LogfileName; /// <summary> /// Do the log /// </summary> /// <param name="lines"></param> /// <param name="type"></param> public static void Log(String lines, String type = "LOG") { System.IO.StreamWriter file = new System.IO.StreamWriter(Path.Combine(ExecutingDirectory, "Logs", LogfileName), true); file.WriteLine(string.Format("({0} {1}) [{2}]: {3}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), type.ToUpper(), lines)); file.Close(); } public static void CreateLogFile() { if (!Directory.Exists(Path.Combine(ExecutingDirectory, "Logs"))) Directory.CreateDirectory(Path.Combine(ExecutingDirectory, "Logs")); if (File.Exists(Path.Combine(ExecutingDirectory, "Logs", LogfileName))) { File.Delete(Path.Combine(ExecutingDirectory, "Logs", LogfileName)); } LogfileName = LogfileName + "(" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + ")"; var file = File.Create(Path.Combine(ExecutingDirectory, "Logs", LogfileName)); file.Close(); } } }
bsd-2-clause
C#
77ec8581a3fff975145fe782bee9e5228bc71359
Fix compile error in .NET Core 3.1 version of ASP.NET Core Web App blueprint
thedevopsmachine/aws-lambda-dotnet,thedevopsmachine/aws-lambda-dotnet,thedevopsmachine/aws-lambda-dotnet,thedevopsmachine/aws-lambda-dotnet
Blueprints/BlueprintDefinitions/netcore3.1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/LocalEntryPoint.cs
Blueprints/BlueprintDefinitions/netcore3.1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/LocalEntryPoint.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace BlueprintBaseName._1 { public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }); } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; namespace BlueprintBaseName._1 { public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }); } }
apache-2.0
C#
65a5511d6b134efa96c0771cb6180a9841022518
add process to interface
nirvana-framework/Nirvana,jasoncavaliere/Nirvana,jasoncavaliere/Nirvana,jasoncavaliere/Nirvana,jasoncavaliere/Nirvana
src/Nirvana/CQRS/Queue/IQueueController.cs
src/Nirvana/CQRS/Queue/IQueueController.cs
using System; using System.Collections.Generic; using Nirvana.Configuration; namespace Nirvana.CQRS.Queue { public interface IQueueController { QueueStatus Status { get; set; } bool InitializeAll(); //bool StopAll(); // bool StartRoot(string rootName); // bool StopRoot(string rootName); // // bool StartQueue(Type messageType); // bool StopQueue(Type messageType); IDictionary<string, QueueReference[]> ByRoot(); QueueReference[] ForRootType(string rootType); QueueReference[] AllQueues(); QueueReference GetQueueReferenceFor(NirvanaTaskInformation typeRouting); bool Process(); } }
using System; using System.Collections.Generic; using Nirvana.Configuration; namespace Nirvana.CQRS.Queue { public interface IQueueController { QueueStatus Status { get; set; } bool InitializeAll(); //bool StopAll(); // bool StartRoot(string rootName); // bool StopRoot(string rootName); // // bool StartQueue(Type messageType); // bool StopQueue(Type messageType); IDictionary<string, QueueReference[]> ByRoot(); QueueReference[] ForRootType(string rootType); QueueReference[] AllQueues(); QueueReference GetQueueReferenceFor(NirvanaTaskInformation typeRouting); } }
apache-2.0
C#
6410d4e761f6bbd68bcfae0fb6b78604db1c8814
Update OidcConfigurationController.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/OidcConfigurationController.cs
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/OidcConfigurationController.cs
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { private readonly ILogger<OidcConfigurationController> logger; public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> _logger) { ClientRequestParametersProvider = clientRequestParametersProvider; logger = _logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } [HttpGet("_configuration/{clientId}")] public IActionResult GetClientRequestParameters([FromRoute]string clientId) { var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters); } } }
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { private readonly ILogger<SampleDataController> logger; public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<SampleDataController> _logger) { ClientRequestParametersProvider = clientRequestParametersProvider; logger = _logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } [HttpGet("_configuration/{clientId}")] public IActionResult GetClientRequestParameters([FromRoute]string clientId) { var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters); } } }
apache-2.0
C#
a4de46193afe274fce206c1956ae155b44e2c1ca
fix baselines
linq2db/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,LinqToDB4iSeries/linq2db
Tests/Linq/UserTests/Issue2564Tests.cs
Tests/Linq/UserTests/Issue2564Tests.cs
using System; using System.Linq; using LinqToDB; using LinqToDB.Data; using LinqToDB.Mapping; using NUnit.Framework; namespace Tests.UserTests { [TestFixture] public class Issue2564Tests : TestBase { class Issue2564Class { public long Id { get; set; } public DateTime TimestampGenerated { get; set; } public DateTime? TimestampGone { get; set; } public string? MessageClassName { get; set; } public string? ExternID1 { get; set; } public string? TranslatedMessageGroup { get; set; } public string? TranslatedMessage1 { get; set; } } [Test] public void TestIssue2564([IncludeDataSources(TestProvName.AllOracle)] string context) { var ms = new MappingSchema(); ms.GetFluentMappingBuilder() .Entity<Issue2564Class>() .HasTableName("Issue2564Table") .Property(e => e.Id).IsPrimaryKey(); using (var db = GetDataContext(context, ms)) { db.DropTable<Issue2564Class>(throwExceptionIfNotExists: false); db.CreateTable<Issue2564Class>(); { var from = TestData.DateTime.AddDays(-1); var to = TestData.DateTime; var qry = (from m in db.GetTable<Issue2564Class>() where m.TimestampGone.HasValue && m.TimestampGenerated >= @from && m.TimestampGenerated <= to && m.MessageClassName == "Error" group m by new { m.ExternID1, m.TranslatedMessageGroup, m.TimestampGenerated.Hour } into tgGroup select new { MessageText = tgGroup.Min(x => x.TranslatedMessage1)!.Trim(), GroupName = tgGroup.Key.TranslatedMessageGroup, Hour = tgGroup.Key.Hour, Count = tgGroup.Count(), DurationInSeconds = (long)tgGroup.Sum(x => (x.TimestampGone!.Value - x.TimestampGenerated).TotalMilliseconds), }); var data = qry.ToList(); } } } } }
using System; using System.Linq; using LinqToDB; using LinqToDB.Data; using LinqToDB.Mapping; using NUnit.Framework; namespace Tests.UserTests { [TestFixture] public class Issue2564Tests : TestBase { class Issue2564Class { public long Id { get; set; } public DateTime TimestampGenerated { get; set; } public DateTime? TimestampGone { get; set; } public string? MessageClassName { get; set; } public string? ExternID1 { get; set; } public string? TranslatedMessageGroup { get; set; } public string? TranslatedMessage1 { get; set; } } [Test] public void TestIssue2564([IncludeDataSources(TestProvName.AllOracle)] string context) { var ms = new MappingSchema(); ms.GetFluentMappingBuilder() .Entity<Issue2564Class>() .HasTableName("Issue2564Table") .Property(e => e.Id).IsPrimaryKey(); using (var db = GetDataContext(context, ms)) { db.DropTable<Issue2564Class>(throwExceptionIfNotExists: false); db.CreateTable<Issue2564Class>(); { var from = DateTime.UtcNow.AddDays(-1); var to = DateTime.UtcNow; var qry = (from m in db.GetTable<Issue2564Class>() where m.TimestampGone.HasValue && m.TimestampGenerated >= @from && m.TimestampGenerated <= to && m.MessageClassName == "Error" group m by new { m.ExternID1, m.TranslatedMessageGroup, m.TimestampGenerated.Hour } into tgGroup select new { MessageText = tgGroup.Min(x => x.TranslatedMessage1)!.Trim(), GroupName = tgGroup.Key.TranslatedMessageGroup, Hour = tgGroup.Key.Hour, Count = tgGroup.Count(), DurationInSeconds = (long)tgGroup.Sum(x => (x.TimestampGone!.Value - x.TimestampGenerated).TotalMilliseconds), }); var data = qry.ToList(); } } } } }
mit
C#
ce9b2631daa47c73f0c4e205e814b7f0ae7bbed7
Fix assembly attributes.
gibwar/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,Azure/azure-webjobs-sdk,Azure/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk
src/Microsoft.Azure.WebJobs.Logging/Properties/AssemblyInfo.cs
src/Microsoft.Azure.WebJobs.Logging/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 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: CLSCompliant(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b5a04006-ab0c-4800-ae4c-080d31867de3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.2.0")] [assembly: AssemblyFileVersion("1.1.2.0")]
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Microsoft.Azure.WebJobs.Logging")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Microsoft.Azure.WebJobs.Logging")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b5a04006-ab0c-4800-ae4c-080d31867de3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.2.0")] [assembly: AssemblyFileVersion("1.1.2.0")]
mit
C#
590aef059f4f2860b32e56a6ca6f831e9daec5e9
Define a state that is modified by the actions
Seddryck/NBi,Seddryck/NBi
NBi.genbiL/GenerationState.cs
NBi.genbiL/GenerationState.cs
using System; using System.Collections.Generic; using System.Linq; using NBi.Service; namespace NBi.GenbiL { public class GenerationState { public TestCasesManager TestCases { get; private set; } public TemplateManager Template { get; private set; } public SettingsManager Settings { get; private set; } public TestListManager List { get; private set; } public TestSuiteManager Suite { get; private set; } public GenerationState() { TestCases = new TestCasesManager(); Template = new TemplateManager(); Settings = new SettingsManager(); List = new TestListManager(); Suite = new TestSuiteManager(); } } }
using System; using System.Collections.Generic; using System.Data; using System.Linq; namespace NBi.GenbiL { class GenerationState { public DataTable TestCases { get; set; } public IEnumerable<string> Variables { get; set; } public string Template { get; set; } } }
apache-2.0
C#
ff33e0d969ab63c64b520e567c827400e4257b19
Fix merge mistake
leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abjerner/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,rasmuseeg/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,rasmuseeg/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,rasmuseeg/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,NikRimington/Umbraco-CMS
src/Umbraco.Web/WebApi/Filters/AdminUsersAuthorizeAttribute.cs
src/Umbraco.Web/WebApi/Filters/AdminUsersAuthorizeAttribute.cs
using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Http.Controllers; using Umbraco.Core; using Umbraco.Web.Composing; using Umbraco.Web.Editors; namespace Umbraco.Web.WebApi.Filters { /// <summary> /// if the users being edited is an admin then we must ensure that the current user is also an admin /// </summary> /// <remarks> /// This will authorize against one or multiple ids /// </remarks> public sealed class AdminUsersAuthorizeAttribute : AuthorizeAttribute { private readonly string _parameterName; public AdminUsersAuthorizeAttribute(string parameterName) { _parameterName = parameterName; } public AdminUsersAuthorizeAttribute() : this("id") { } protected override bool IsAuthorized(HttpActionContext actionContext) { int[] userIds; if (actionContext.ActionArguments.TryGetValue(_parameterName, out var userId)) { var intUserId = userId.TryConvertTo<int>(); if (intUserId) userIds = new[] {intUserId.Result}; else return base.IsAuthorized(actionContext); } else { var queryString = actionContext.Request.GetQueryNameValuePairs(); var ids = queryString.Where(x => x.Key == _parameterName).ToArray(); if (ids.Length == 0) return base.IsAuthorized(actionContext); userIds = ids.Select(x => x.Value.TryConvertTo<int>()).Where(x => x.Success).Select(x => x.Result).ToArray(); } if (userIds.Length == 0) return base.IsAuthorized(actionContext); var users = Current.Services.UserService.GetUsersById(userIds); var authHelper = new UserEditorAuthorizationHelper(Current.Services.ContentService, Current.Services.MediaService, Current.Services.UserService, Current.Services.EntityService); return users.All(user => authHelper.IsAuthorized(Current.UmbracoContext.Security.CurrentUser, user, null, null, null) != false); } } }
using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Http.Controllers; using Umbraco.Core; using Umbraco.Web.Editors; namespace Umbraco.Web.WebApi.Filters { /// <summary> /// if the users being edited is an admin then we must ensure that the current user is also an admin /// </summary> /// <remarks> /// This will authorize against one or multiple ids /// </remarks> public sealed class AdminUsersAuthorizeAttribute : AuthorizeAttribute { private readonly string _parameterName; public AdminUsersAuthorizeAttribute(string parameterName) { _parameterName = parameterName; } public AdminUsersAuthorizeAttribute() : this("id") { } protected override bool IsAuthorized(HttpActionContext actionContext) { int[] userIds; if (actionContext.ActionArguments.TryGetValue(_parameterName, out var userId)) { var intUserId = userId.TryConvertTo<int>(); if (intUserId) userIds = new[] {intUserId.Result}; else return base.IsAuthorized(actionContext); } else { var queryString = actionContext.Request.GetQueryNameValuePairs(); var ids = queryString.Where(x => x.Key == _parameterName).ToArray(); if (ids.Length == 0) return base.IsAuthorized(actionContext); userIds = ids.Select(x => x.Value.TryConvertTo<int>()).Where(x => x.Success).Select(x => x.Result).ToArray(); } if (userIds.Length == 0) return base.IsAuthorized(actionContext); var users = ApplicationContext.Current.Services.UserService.GetUsersById(userIds); var authHelper = new UserEditorAuthorizationHelper(ApplicationContext.Current.Services.ContentService, ApplicationContext.Current.Services.MediaService, ApplicationContext.Current.Services.UserService, ApplicationContext.Current.Services.EntityService); return users.All(user => authHelper.IsAuthorized(UmbracoContext.Current.Security.CurrentUser, user, null, null, null) != false); } } }
mit
C#
3ad01376ccb1c68da1311b84c010af6ff3c2ac23
Build and publish nuget package
QuickenLoans/XSerializer,rlyczynski/XSerializer
XSerializer/Properties/AssemblyInfo.cs
XSerializer/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XSerializer")] [assembly: AssemblyDescription("Advanced, high-performance XML and JSON serializers")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Quicken Loans")] [assembly: AssemblyProduct("XSerializer")] [assembly: AssemblyCopyright("Copyright © Quicken Loans 2013-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("5aeaebd0-35de-424c-baa9-ba6d65fa3409")] [assembly: CLSCompliant(true)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.3.1")] [assembly: AssemblyInformationalVersion("0.3.1")] #if !BUILD [assembly: InternalsVisibleTo("XSerializer.Tests")] [assembly: InternalsVisibleTo("XSerializer.PerformanceTests")] #endif
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XSerializer")] [assembly: AssemblyDescription("Advanced, high-performance XML and JSON serializers")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Quicken Loans")] [assembly: AssemblyProduct("XSerializer")] [assembly: AssemblyCopyright("Copyright © Quicken Loans 2013-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("5aeaebd0-35de-424c-baa9-ba6d65fa3409")] [assembly: CLSCompliant(true)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.3.0")] [assembly: AssemblyInformationalVersion("0.3.0")] #if !BUILD [assembly: InternalsVisibleTo("XSerializer.Tests")] [assembly: InternalsVisibleTo("XSerializer.PerformanceTests")] #endif
mit
C#
a572265545538ec6086c3087668711d58bd30265
Make Grouping class internal.
Dominaezzz/sqlite-helper
SQLite.Net/Query.cs
SQLite.Net/Query.cs
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; using SQLite.Net.Expressions; namespace SQLite.Net { public class Query<T> : IOrderedQueryable<T> { internal Query(SQLiteQueryProvider provider) { Provider = provider; Expression = Expression.Constant(this); } internal Query(SQLiteQueryProvider provider, Expression expression) { if(expression == null) throw new ArgumentNullException(nameof(expression)); if (!typeof(IQueryable<T>).GetTypeInfo().IsAssignableFrom(expression.Type.GetTypeInfo())) { throw new ArgumentOutOfRangeException(nameof(expression)); } Expression = expression; Provider = provider; } public IEnumerator<T> GetEnumerator() { return Provider.Execute<IEnumerable<T>>(Expression).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public Type ElementType => typeof(T); public Expression Expression { get; } public IQueryProvider Provider { get; } } internal class Grouping<TKey, TElement> : IGrouping<TKey, TElement> { private readonly IEnumerable<TElement> _group; public Grouping(TKey key, IEnumerable<TElement> group) { Key = key; _group = group; } public TKey Key { get; } public IEnumerator<TElement> GetEnumerator() { return _group.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _group.GetEnumerator(); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; using SQLite.Net.Expressions; namespace SQLite.Net { public class Query<T> : IOrderedQueryable<T> { internal Query(SQLiteQueryProvider provider) { Provider = provider; Expression = Expression.Constant(this); } internal Query(SQLiteQueryProvider provider, Expression expression) { if(expression == null) throw new ArgumentNullException(nameof(expression)); if (!typeof(IQueryable<T>).GetTypeInfo().IsAssignableFrom(expression.Type.GetTypeInfo())) { throw new ArgumentOutOfRangeException(nameof(expression)); } Expression = expression; Provider = provider; } public IEnumerator<T> GetEnumerator() { return Provider.Execute<IEnumerable<T>>(Expression).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public Type ElementType => typeof(T); public Expression Expression { get; } public IQueryProvider Provider { get; } } public class Grouping<TKey, TElement> : IGrouping<TKey, TElement> { private readonly IEnumerable<TElement> _group; public Grouping(TKey key, IEnumerable<TElement> group) { Key = key; _group = group; } public TKey Key { get; } public IEnumerator<TElement> GetEnumerator() { return _group.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _group.GetEnumerator(); } } }
mit
C#
84962a22753391b5a23105bbbc1479aae9bdcdcd
Fix potentially null reference if drawable was not assigned a `LoadThread` yet
smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
osu.Framework/Logging/LoadingComponentsLogger.cs
osu.Framework/Logging/LoadingComponentsLogger.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.Linq; using osu.Framework.Development; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Lists; namespace osu.Framework.Logging { internal static class LoadingComponentsLogger { private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>(); public static void Add(Drawable component) { if (!DebugUtils.IsDebugBuild) return; lock (loading_components) loading_components.Add(component); } public static void Remove(Drawable component) { if (!DebugUtils.IsDebugBuild) return; lock (loading_components) loading_components.Remove(component); } public static void LogAndFlush() { if (!DebugUtils.IsDebugBuild) return; lock (loading_components) { Logger.Log($"⏳ Currently loading components ({loading_components.Count()})"); foreach (var c in loading_components) { Logger.Log($"- {c.GetType().ReadableName(),-16} LoadState:{c.LoadState,-5} Thread:{c.LoadThread?.Name ?? "none"}"); } loading_components.Clear(); Logger.Log("🧵 Task schedulers"); Logger.Log(CompositeDrawable.SCHEDULER_STANDARD.GetStatusString()); Logger.Log(CompositeDrawable.SCHEDULER_LONG_LOAD.GetStatusString()); } } } }
// 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.Linq; using osu.Framework.Development; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Lists; namespace osu.Framework.Logging { internal static class LoadingComponentsLogger { private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>(); public static void Add(Drawable component) { if (!DebugUtils.IsDebugBuild) return; lock (loading_components) loading_components.Add(component); } public static void Remove(Drawable component) { if (!DebugUtils.IsDebugBuild) return; lock (loading_components) loading_components.Remove(component); } public static void LogAndFlush() { if (!DebugUtils.IsDebugBuild) return; lock (loading_components) { Logger.Log($"⏳ Currently loading components ({loading_components.Count()})"); foreach (var c in loading_components) Logger.Log($"- {c.GetType().ReadableName(),-16} LoadState:{c.LoadState,-5} Thread:{c.LoadThread.Name}"); loading_components.Clear(); Logger.Log("🧵 Task schedulers"); Logger.Log(CompositeDrawable.SCHEDULER_STANDARD.GetStatusString()); Logger.Log(CompositeDrawable.SCHEDULER_LONG_LOAD.GetStatusString()); } } } }
mit
C#
833bd64fd4f7a4f28fe14d469e6834ffe3358f0a
Remove unnecessary inner locking
smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework
osu.Framework/Logging/LoadingComponentsLogger.cs
osu.Framework/Logging/LoadingComponentsLogger.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Lists; namespace osu.Framework.Logging { internal static class LoadingComponentsLogger { private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>(); [Conditional("DEBUG")] public static void Add(Drawable component) { lock (loading_components) loading_components.Add(component); } [Conditional("DEBUG")] public static void Remove(Drawable component) { lock (loading_components) loading_components.Remove(component); } [Conditional("DEBUG")] public static void LogAndFlush() { lock (loading_components) { Logger.Log("⏳ Currently loading components"); foreach (var c in loading_components) Logger.Log($"- {c.GetType().ReadableName(),-16} LoadState:{c.LoadState,-5} Thread:{c.LoadThread.Name}"); loading_components.Clear(); } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Lists; namespace osu.Framework.Logging { internal static class LoadingComponentsLogger { private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>(); [Conditional("DEBUG")] public static void Add(Drawable component) { lock (loading_components) loading_components.Add(component); } [Conditional("DEBUG")] public static void Remove(Drawable component) { lock (loading_components) loading_components.Remove(component); } [Conditional("DEBUG")] public static void LogAndFlush() { lock (loading_components) { Logger.Log("⏳ Currently loading components"); lock (loading_components) { foreach (var c in loading_components) { Logger.Log($"- {c.GetType().ReadableName(),-16} LoadState:{c.LoadState,-5} Thread:{c.LoadThread.Name}"); } } loading_components.Clear(); } } } }
mit
C#
1c98f9eed00b7ea16f74755f729738704493a469
Fix indexed list bug that crashed the app when performing a search
danmiser/MonoTouch.Dialog,benoitjadinon/MonoTouch.Dialog,Milan1992/MonoTouch.Dialog,migueldeicaza/MonoTouch.Dialog,ClusterReplyBUS/MonoTouch.Dialog,hisystems/MonoTouch.Dialog,newky2k/MonoTouch.Dialog,jstedfast/MonoTouch.Dialog
Sample/DemoIndex.cs
Sample/DemoIndex.cs
// // This sample shows how to present an index. // // This requires the user to create two subclasses for the // internal model used in DialogViewController and a new // subclass of DialogViewController that activates it. // // See the source in IndexedViewController // // The reason for Source and SourceSizing derived classes is // that MonoTouch.Dialog will create one or the other based on // whether there are elements with uniform sizes or not. This // imrpoves performance by avoiding expensive computations. // using System; using System.Drawing; using System.Linq; using MonoTouch.UIKit; using MonoTouch.Dialog; using System.Collections.Generic; namespace Sample { class IndexedViewController : DialogViewController { public IndexedViewController (RootElement root, bool pushing) : base (root, pushing) { // Indexed tables require this style. Style = UITableViewStyle.Plain; EnableSearch = true; SearchPlaceholder = "Find item"; AutoHideSearch = true; } string [] GetSectionTitles () { return ( from section in Root where !String.IsNullOrEmpty(section.Caption) select section.Caption.Substring(0,1) ).ToArray (); } class IndexedSource : Source { IndexedViewController parent; public IndexedSource (IndexedViewController parent) : base (parent) { this.parent = parent; } public override string[] SectionIndexTitles (UITableView tableView) { var j = parent.GetSectionTitles (); return j; } } class SizingIndexedSource : Source { IndexedViewController parent; public SizingIndexedSource (IndexedViewController parent) : base (parent) { this.parent = parent; } public override string[] SectionIndexTitles (UITableView tableView) { var j = parent.GetSectionTitles (); return j; } } public override Source CreateSizingSource (bool unevenRows) { if (unevenRows) return new SizingIndexedSource (this); else return new IndexedSource (this); } } public partial class AppDelegate { public void DemoIndex () { var root = new RootElement ("Container Style") { from sh in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" select new Section (sh + " - Section") { from filler in "12345" select (Element) new StringElement (sh + " - " + filler) } }; var dvc = new IndexedViewController (root, true); navigation.PushViewController (dvc, true); } } }
// // This sample shows how to present an index. // // This requires the user to create two subclasses for the // internal model used in DialogViewController and a new // subclass of DialogViewController that activates it. // // See the source in IndexedViewController // // The reason for Source and SourceSizing derived classes is // that MonoTouch.Dialog will create one or the other based on // whether there are elements with uniform sizes or not. This // imrpoves performance by avoiding expensive computations. // using System; using System.Drawing; using System.Linq; using MonoTouch.UIKit; using MonoTouch.Dialog; using System.Collections.Generic; namespace Sample { class IndexedViewController : DialogViewController { public IndexedViewController (RootElement root, bool pushing) : base (root, pushing) { // Indexed tables require this style. Style = UITableViewStyle.Plain; EnableSearch = true; SearchPlaceholder = "Find item"; AutoHideSearch = true; } string [] GetSectionTitles () { return (from section in Root select section.Caption.Substring(0,1)).ToArray (); } class IndexedSource : Source { IndexedViewController parent; public IndexedSource (IndexedViewController parent) : base (parent) { this.parent = parent; } public override string[] SectionIndexTitles (UITableView tableView) { var j = parent.GetSectionTitles (); return j; } } class SizingIndexedSource : Source { IndexedViewController parent; public SizingIndexedSource (IndexedViewController parent) : base (parent) { this.parent = parent; } public override string[] SectionIndexTitles (UITableView tableView) { var j = parent.GetSectionTitles (); return j; } } public override Source CreateSizingSource (bool unevenRows) { if (unevenRows) return new SizingIndexedSource (this); else return new IndexedSource (this); } } public partial class AppDelegate { public void DemoIndex () { var root = new RootElement ("Container Style") { from sh in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" select new Section (sh + " - Section") { from filler in "12345" select (Element) new StringElement (sh + " - " + filler) } }; var dvc = new IndexedViewController (root, true); navigation.PushViewController (dvc, true); } } }
mit
C#
bb9b680aa2d43fe6ef07bbd73cfce0a2b102e0eb
fix merge issue
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Domain/Models/Account/AccountDetail.cs
src/SFA.DAS.EmployerApprenticeshipsService.Domain/Models/Account/AccountDetail.cs
using System; using System.Collections.Generic; using SFA.DAS.Common.Domain.Types; namespace SFA.DAS.EAS.Domain.Models.Account { public class AccountDetail { public long AccountId { get; set; } public string HashedId { get; set; } public string PublicHashedId { get; set; } public string Name { get; set; } public DateTime CreatedDate { get; set; } public string OwnerEmail { get; set; } public List<long> LegalEntities { get; set; } = new List<long>(); public List<string> PayeSchemes { get; set; } = new List<string>(); public List<AgreementType> AccountAgreementTypes { get; set; } public ApprenticeshipEmployerType ApprenticeshipEmployerType { get; set; } } }
using System; using System.Collections.Generic; using SFA.DAS.Common.Domain.Types; namespace SFA.DAS.EAS.Domain.Models.Account { public class AccountDetail { public long AccountId { get; set; } public string HashedId { get; set; } public string PublicHashedId { get; set; } public string Name { get; set; } public DateTime CreatedDate { get; set; } public string OwnerEmail { get; set; } public List<long> LegalEntities { get; set; } = new List<long>(); public List<string> PayeSchemes { get; set; } = new List<string>(); public ApprenticeshipEmployerType ApprenticeshipEmployerType { get; set; } public List<string> AccountAgreementTypes { get; set; } } }
mit
C#
40322e00e9636b30330d3a70d1b08f1298fab1b1
Edit assembly copyright info (#910)
fluentassertions/fluentassertions,dennisdoomen/fluentassertions,dennisdoomen/fluentassertions,jnyrup/fluentassertions,fluentassertions/fluentassertions,jnyrup/fluentassertions
Src/SolutionInfo.cs
Src/SolutionInfo.cs
using System.Reflection; [assembly: AssemblyCompany("www.continuousimprover.com")] [assembly: AssemblyCopyright("Copyright Dennis Doomen 2010-2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
using System.Reflection; [assembly: AssemblyCompany("www.continuousimprover.com")] [assembly: AssemblyCopyright("Copyright Dennis Doomen 2010-2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
apache-2.0
C#
5f0069eb837a8300efc0f90c35cf1415a0fe4ade
Fix incorrect ruleset being sent to API
NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,NeoAdonis/osu,naoey/osu,2yangk23/osu,peppy/osu,smoogipoo/osu,EVAST9919/osu,naoey/osu,ppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,ppy/osu,DrabWeb/osu,smoogipoo/osu,johnneijzen/osu,ZLima12/osu,UselessToucan/osu,peppy/osu-new,EVAST9919/osu,naoey/osu,ZLima12/osu,smoogipoo/osu,DrabWeb/osu,johnneijzen/osu,DrabWeb/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu
osu.Game/Screens/Select/MatchSongSelect.cs
osu.Game/Screens/Select/MatchSongSelect.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 osu.Game.Online.Multiplayer; using osu.Game.Screens.Multi; namespace osu.Game.Screens.Select { public class MatchSongSelect : SongSelect, IMultiplayerScreen { public Action<PlaylistItem> Selected; public string ShortTitle => "song selection"; protected override bool OnStart() { var item = new PlaylistItem { Beatmap = Beatmap.Value.BeatmapInfo, Ruleset = Ruleset.Value, RulesetID = Ruleset.Value.ID ?? 0 }; item.RequiredMods.AddRange(SelectedMods.Value); Selected?.Invoke(item); if (IsCurrentScreen) Exit(); return true; } } }
// 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 osu.Game.Online.Multiplayer; using osu.Game.Screens.Multi; namespace osu.Game.Screens.Select { public class MatchSongSelect : SongSelect, IMultiplayerScreen { public Action<PlaylistItem> Selected; public string ShortTitle => "song selection"; protected override bool OnStart() { var item = new PlaylistItem { Beatmap = Beatmap.Value.BeatmapInfo, Ruleset = Ruleset.Value, }; item.RequiredMods.AddRange(SelectedMods.Value); Selected?.Invoke(item); if (IsCurrentScreen) Exit(); return true; } } }
mit
C#
d0a231a4f47dfc03063c4890a05c5842aa46cb5d
Update GameManager.cs
afroraydude/First_Unity_Game,afroraydude/First_Unity_Game,afroraydude/First_Unity_Game
Real_Game/Assets/Scripts/GameManager.cs
Real_Game/Assets/Scripts/GameManager.cs
using UnityEngine; using System.Collections; /** * Created By Afroraydude * This class is the Framework Of the Game, * very large compred to the other classes * This does: * Level transitions * Score Keeping * Score Saving */ public class GameManager : MonoBehaviour { // Score based stuff public float highScore; // Level based stuff public int currentLevel; public int unlockedLevels; public int LevelGradingID = 6; // Things that deal with GUI // why are there 2 of all of them? IDK public Rect stopwatchRect; public Rect stopwatchBoxRect; public Rect highScoreRect; public Rect highScoreBox; public GUISkin skin; // Stuff that deals with the ingame stopwatch, which is my answer to the score system. public float startTime; private string currentTime; public string highTime; // Once the level loads this happens void Start() { unlockedLevels = PlayerPrefs.GetInt("LevelsCompleted"); // DontDestroyOnLoad(gameObject); // If the levels you unlocked is less than the level you are at if (unlockedLevels < currentLevel) { // make it the same PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); unlockedLevels = PlayerPrefs.GetInt("LevelsCompleted"); } else { // do nothing } } // This is ran every tick void Update() { //This records the time it took to complete the level startTime += Time.deltaTime; //This puts it into a string so that it can be viewed on the GUI currentTime = string.Format ("{0:0.0}", startTime); } // GUI goes here void OnGUI() { GUI.skin = skin; GUI.Box (stopwatchBoxRect, ""); GUI.Label(stopwatchRect, currentTime, skin.GetStyle ("Stopwatch")); GUI.Label (highScoreRect, PlayerPrefs.GetString("Level" + currentLevel.ToString() + "Score")); GUI.Box (highScoreBox, ""); } public void MainMenuToLevelOne() { // To go to Level 1 currentLevel = 1; /** This might not be required anymore: PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); */ } public void BackToMainMenu() { // To go back to Main Menu from the End Game Menu currentLevel = 0; Application.LoadLevel(currentLevel); } // For when the player completes a level // TODO: Fix issue in flash were it does not care if the high score is > or < the startTime, it always overrides it. public void CompleteLevel() { // If the high score is less than the time it took you to complete the level if(highScore > startTime) { // Make it equal the time it took you to complete the level highScore = startTime; highTime = string.Format ("{0:0.0}", highScore); PlayerPrefs.SetString("Level" + currentLevel.ToString() + "Score", highTime); } // if the level you are at is less than the numer of levels in the game if (currentLevel < 5) { // Load the LevelGrading Scene Application.LoadLevel(LevelGradingID); } else { print ("Please increase level amount."); } } // After LevelGrading is done public void AfterGrading() { // Go up a level currentLevel +=1; Application.LoadLevel(currentLevel); } // Pretty straightforward public void StartGame() { currentLevel = 0; } }
using UnityEngine; using System.Collections; /** * Created By Afroraydude * This class is the Framework Of the Game, * very large compred to the other classes * This does: * Level transitions * Score Keeping * Score Saving */ public class GameManager : MonoBehaviour { // Score based stuff public float highScore = 0f; // Level based stuff public int currentLevel = 0; public int unlockedLevels; public int LevelGradingID = 6; // Things that deal with GUI // why are there 2 of all of them? IDK public Rect stopwatchRect; public Rect stopwatchBoxRect; public Rect highScoreRect; public Rect highScoreBox; public GUISkin skin; // Stuff that deals with the ingame stopwatch, which is my answer to the score system. public float startTime; private string currentTime; public string highTime; // Once the level loads this happens void Start() { unlockedLevels = PlayerPrefs.GetInt("LevelsCompleted"); // DontDestroyOnLoad(gameObject); if (unlockedLevels < currentLevel) { PlayerPrefs.SetInt("LevelsCompleted", currentLevel); unlockedLevels = PlayerPrefs.GetInt("LevelsCompleted"); PlayerPrefs.Save(); } else { // do nothing } } // This is ran every tick void Update() { //This records the time it took to complete the level startTime += Time.deltaTime; //This puts it into a string so that it can be viewed on the GUI currentTime = string.Format ("{0:0.0}", startTime); } // GUI goes here void OnGUI() { GUI.skin = skin; GUI.Box (stopwatchBoxRect, ""); GUI.Label(stopwatchRect, currentTime, skin.GetStyle ("Stopwatch")); GUI.Label (highScoreRect, PlayerPrefs.GetString("Level" + currentLevel.ToString() + "Score")); GUI.Box (highScoreBox, ""); } public void MainMenuToLevelOne() { currentLevel = 1; PlayerPrefs.SetInt("LevelsCompleted", currentLevel); PlayerPrefs.Save(); Application.LoadLevel(currentLevel); } public void BackToMainMenu() { currentLevel = 0; Application.LoadLevel(currentLevel); } // For when the player completes a level // TODO: Fix issue in flash were it does not care if the high score is > or < the startTime, it always overrides it. public void CompleteLevel() { if(highScore > startTime || highScore == 0) { highScore = startTime; highTime = string.Format ("{0:0.0}", highScore); PlayerPrefs.SetString("Level" + currentLevel.ToString() + "Score", highTime); } if (currentLevel < 5) { Application.LoadLevel(LevelGradingID); } else { print ("Please increase level amount."); } } public void AtLevelBegin // After LevelGrading is done, this happens public void AfterGrading() { currentLevel +=1; Application.LoadLevel(currentLevel); } public void StartGame() { currentLevel = 0; } }
mit
C#
916b2deda6b555e2a6a83ae68631d1d321094c8f
add virutal method
suantw/Refactor
RefactorModel/RefactorModel/Refactor.cs
RefactorModel/RefactorModel/Refactor.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RefactorModel { public class Refactor<T> { public Refactor() { } public virtual void Parse() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RefactorModel { public class Refactor<T> { public Refactor() { } } }
mit
C#
536436dd2e9b49928a603f92bdcb25dcc755249b
debug mode unlocks all stages and locations.
lizard-entertainment/runityscape,Cinnamon18/runityscape
Assets/Scripts/Game/Defined/Flags.cs
Assets/Scripts/Game/Defined/Flags.cs
using Scripts.Game.Dungeons; using Scripts.Game.Pages; using Scripts.Model.SaveLoad; using Scripts.Model.SaveLoad.SaveObjects; using System; using System.Collections.Generic; using System.ComponentModel; using UnityEngine; namespace Scripts.Game.Serialized { public enum TimeOfDay { [Description("<color=white>Dawn</color>")] DAWN, [Description("<color=yellow>Morning</color>")] MORNING, [Description("<color=orange>Midday</color>")] MIDDAY, [Description("<color=red>Afternoon</color>")] AFTERNOON, [Description("<color=magenta>Dusk</color>")] DUSK, [Description("<color=blue>Night</color>")] NIGHT, } [Serializable] public class Flags : ISaveable<FlagsSave> { public TimeOfDay Time; public int DayCount; public AreaType CurrentArea; public AreaType LastClearedArea; public int LastClearedStage; public bool ShouldAdvanceTimeInCamp; public Flags() { this.LastClearedArea = AreaType.NONE; this.CurrentArea = AreaType.FIELD; } public FlagsSave GetSaveObject() { return new FlagsSave(this); } public bool IsStageCleared(int stageIndex, AreaType type) { return this.LastClearedArea >= type || this.LastClearedStage > stageIndex || Util.IS_DEBUG; } public bool IsAreaUnlocked(AreaType type) { return ((int)this.LastClearedArea + 1) >= (int)type || Util.IS_DEBUG; } public void InitFromSaveObject(FlagsSave saveObject) { } } }
using Scripts.Game.Dungeons; using Scripts.Game.Pages; using Scripts.Model.SaveLoad; using Scripts.Model.SaveLoad.SaveObjects; using System; using System.Collections.Generic; using System.ComponentModel; using UnityEngine; namespace Scripts.Game.Serialized { public enum TimeOfDay { [Description("<color=white>Dawn</color>")] DAWN, [Description("<color=yellow>Morning</color>")] MORNING, [Description("<color=orange>Midday</color>")] MIDDAY, [Description("<color=red>Afternoon</color>")] AFTERNOON, [Description("<color=magenta>Dusk</color>")] DUSK, [Description("<color=blue>Night</color>")] NIGHT, } [Serializable] public class Flags : ISaveable<FlagsSave> { public TimeOfDay Time; public int DayCount; public AreaType CurrentArea; public AreaType LastClearedArea; public int LastClearedStage; public bool ShouldAdvanceTimeInCamp; public Flags() { this.LastClearedArea = AreaType.NONE; this.CurrentArea = AreaType.FIELD; } public FlagsSave GetSaveObject() { return new FlagsSave(this); } public bool IsStageCleared(int stageIndex, AreaType type) { return this.LastClearedArea >= type || this.LastClearedStage > stageIndex; } public bool IsAreaUnlocked(AreaType type) { return ((int)this.LastClearedArea + 1) >= (int) type; } public void InitFromSaveObject(FlagsSave saveObject) { } } }
mit
C#
bee8f36e8cc19b03c8b017bf8c1d19e4473d69f9
Fix bug with ServerContext not migrating changes to Db. Forgot to chain the constructors...
SAEnergy/Infrastructure,SAEnergy/Superstructure,SAEnergy/Infrastructure
Src/Core/Core.Database/ServerContext.cs
Src/Core/Core.Database/ServerContext.cs
using Core.Models.Persistent; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Core.Database { public class ServerContext : DbContext { #region Properties public DbSet<User> Users { get; set; } public DbSet<JobConfiguration> JobConfigurations { get; set; } public DbSet<SystemConfiguration> SystemConfigurations { get; set; } #endregion #region Constructors public ServerContext() : this(DatabaseSettings.Instance.ConnectionString) { } //main constructor public ServerContext(string connectionString) : base(connectionString) { System.Data.Entity.Database.SetInitializer(new MigrateDatabaseToLatestVersion<ServerContext, ServerContextConfig>()); } #endregion public override int SaveChanges() { return base.SaveChanges(); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } } }
using Core.Models.Persistent; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Core.Database { public class ServerContext : DbContext { #region Properties public DbSet<User> Users { get; set; } public DbSet<JobConfiguration> JobConfigurations { get; set; } public DbSet<SystemConfiguration> SystemConfigurations { get; set; } #endregion #region Constructors public ServerContext() : base(DatabaseSettings.Instance.ConnectionString) { } //main constructor public ServerContext(string connectionString) : base(connectionString) { System.Data.Entity.Database.SetInitializer(new MigrateDatabaseToLatestVersion<ServerContext, ServerContextConfig>()); } #endregion public override int SaveChanges() { return base.SaveChanges(); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } } }
mit
C#
d843fece7411e5d43e68cc005ddc1e110843e815
Revert "Cleaned up 0x60 0x21 warp packet model"
HelloKitty/Booma.Proxy
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60StartNewWarpCommand.cs
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60StartNewWarpCommand.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { /// <summary> /// Payload sent when a client is begining a warp to a new area. /// Contains client ID information and information about the warp itself. /// </summary> [WireDataContract] [SubCommand60(SubCommand60OperationCode.GameStartWarpToArea)] public sealed class Sub60StartNewWarpCommand : BaseSubCommand60, IMessageContextIdentifiable { //TODO: Is this client id? [WireMember(1)] public byte Identifier { get; } [WireMember(2)] public byte Unused1 { get; } /// <summary> /// The zone ID that the user is teleporting to. /// </summary> [WireMember(3)] public short ZoneId { get; } //TODO: What is this? [WireMember(4)] public short Unused2 { get; } public Sub60StartNewWarpCommand() { //Calc static 32bit size CommandSize = 8 / 4; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { /// <summary> /// Payload sent when a client is begining a warp to a new area. /// Contains client ID information and information about the warp itself. /// </summary> [WireDataContract] [SubCommand60(SubCommand60OperationCode.GameStartWarpToArea)] public sealed class Sub60StartNewWarpCommand : BaseSubCommand60, IMessageContextIdentifiable { //TODO: Is this client id? [WireMember(1)] public byte Identifier { get; } [WireMember(2)] public byte Unused1 { get; } /// <summary> /// The zone ID that the user is teleporting to. /// </summary> [WireMember(3)] public short ZoneId { get; } //Unused2 was padding, not sent in the payload. public Sub60StartNewWarpCommand() { //Calc static 32bit size CommandSize = 8 / 4; } } }
agpl-3.0
C#
d08ade5c67cdc4a64e81baee2671b9c52b7e9a14
Update builder to 1.12
stevengum97/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,yakumo/BotBuilder,Clairety/ConnectMe,yakumo/BotBuilder,mmatkow/BotBuilder,dr-em/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,msft-shahins/BotBuilder,Clairety/ConnectMe,stevengum97/BotBuilder,mmatkow/BotBuilder,Clairety/ConnectMe,yakumo/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,Clairety/ConnectMe,xiangyan99/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,dr-em/BotBuilder,stevengum97/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,stevengum97/BotBuilder,xiangyan99/BotBuilder
CSharp/Library/Properties/AssemblyInfo.cs
CSharp/Library/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("Microsoft.Bot.Builder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Bot Builder")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")] // 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.12.0.0")] [assembly: AssemblyFileVersion("1.12.0.0")] [assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")] [assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")] [assembly: NeutralResourcesLanguage("en")]
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("Microsoft.Bot.Builder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Bot Builder")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")] // 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.11.0.0")] [assembly: AssemblyFileVersion("1.11.0.0")] [assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")] [assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
b5d399b933fb1c5cc9a59dc90511329c343f42be
Revise formatting style of ConditionalClickWidget
jlewin/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,CodeMangler/MatterControl,tellingmachine/MatterControl,mmoening/MatterControl,MatterHackers/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,ddpruitt/MatterControl,ddpruitt/MatterControl,jlewin/MatterControl,rytz/MatterControl,larsbrubaker/MatterControl,tellingmachine/MatterControl,CodeMangler/MatterControl,rytz/MatterControl,ddpruitt/MatterControl,MatterHackers/MatterControl,MatterHackers/MatterControl,rytz/MatterControl,CodeMangler/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl
ControlElements/ConditionalClickWidget.cs
ControlElements/ConditionalClickWidget.cs
using System; namespace MatterHackers.MatterControl { public class ConditionalClickWidget : ClickWidget { private Func<bool> enabledCallback; public ConditionalClickWidget(Func<bool> enabledCallback) { this.enabledCallback = enabledCallback; } public override bool Enabled { get { return this.enabledCallback(); } set { throw new InvalidOperationException("Cannot set Enabled on ConditionalClickWidget"); } } } }
//----------------------------------------------------------------------- // <copyright file="ConditionalClickWidget.cs" company="MatterHackers Inc."> // Copyright (c) 2014, Lars Brubaker // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // 2. 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. // // 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. // // The views and conclusions contained in the software and documentation are those // of the authors and should not be interpreted as representing official policies, // either expressed or implied, of the FreeBSD Project. // </copyright> //----------------------------------------------------------------------- namespace MatterHackers.MatterControl { using System; /// <summary> /// The ConditionalClickWidget provides a ClickWidget that conditionally appears on the control surface to capture mouse input /// </summary> public class ConditionalClickWidget : ClickWidget { /// <summary> /// The delegate which provides the Enabled state /// </summary> private Func<bool> enabledCallback; /// <summary> /// Initializes a new instance of the ConditionalClickWidget class. /// </summary> /// <param name="enabledCallback">The delegate to </param> public ConditionalClickWidget(Func<bool> enabledCallback) { this.enabledCallback = enabledCallback; } /// <summary> /// Determines if the control is enabled /// </summary> public override bool Enabled { get { return this.enabledCallback(); } set { throw new InvalidOperationException("Cannot set Enabled on ConditionalClickWidget"); } } } }
bsd-2-clause
C#
e274025c6ccadea88856e6c17149de1110850a28
Update Scope.cs (#263)
JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET
SpotifyAPI/Web/Enums/Scope.cs
SpotifyAPI/Web/Enums/Scope.cs
using System; namespace SpotifyAPI.Web.Enums { [Flags] public enum Scope { [String("")] None = 1, [String("playlist-modify-public")] PlaylistModifyPublic = 2, [String("playlist-modify-private")] PlaylistModifyPrivate = 4, [String("playlist-read-private")] PlaylistReadPrivate = 8, [String("streaming")] Streaming = 16, [String("user-read-private")] UserReadPrivate = 32, [String("user-read-email")] UserReadEmail = 64, [String("user-library-read")] UserLibraryRead = 128, [String("user-library-modify")] UserLibraryModify = 256, [String("user-follow-modify")] UserFollowModify = 512, [String("user-follow-read")] UserFollowRead = 1024, [String("user-read-birthdate")] UserReadBirthdate = 2048, [String("user-top-read")] UserTopRead = 4096, [String("playlist-read-collaborative")] PlaylistReadCollaborative = 8192, [String("user-read-recently-played")] UserReadRecentlyPlayed = 16384, [String("user-read-playback-state")] UserReadPlaybackState = 32768, [String("user-modify-playback-state")] UserModifyPlaybackState = 65536, [String("user-read-currently-playing")] UserReadCurrentlyPlaying = 131072 } }
using System; namespace SpotifyAPI.Web.Enums { [Flags] public enum Scope { [String("")] None = 1, [String("playlist-modify-public")] PlaylistModifyPublic = 2, [String("playlist-modify-private")] PlaylistModifyPrivate = 4, [String("playlist-read-private")] PlaylistReadPrivate = 8, [String("streaming")] Streaming = 16, [String("user-read-private")] UserReadPrivate = 32, [String("user-read-email")] UserReadEmail = 64, [String("user-library-read")] UserLibraryRead = 128, [String("user-library-modify")] UserLibraryModify = 256, [String("user-follow-modify")] UserFollowModify = 512, [String("user-follow-read")] UserFollowRead = 1024, [String("user-read-birthdate")] UserReadBirthdate = 2048, [String("user-top-read")] UserTopRead = 4096, [String("playlist-read-collaborative")] PlaylistReadCollaborative = 8192, [String("user-read-recently-played")] UserReadRecentlyPlayed = 16384, [String("user-read-playback-state")] UserReadPlaybackState = 32768, [String("user-modify-playback-state")] UserModifyPlaybackState = 65536 } }
mit
C#
d2a47562c7f3493f5c6f97b7940d8e8ec615c705
Hide ComponentInit from derived objects
Vorlias/Andromeda
Entities/Components/Internal/Component.cs
Entities/Components/Internal/Component.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Andromeda2D.Entities.Components.Internal { public abstract class Component : IComponent { protected Entity entity; public Entity Entity { get { return entity; } } public virtual void OnComponentCopy(Entity source, Entity copy) { } protected virtual void OnComponentInit(Entity entity) { } void IComponent.ComponentInit(Entity entity) { this.ComponentInit(entity); } private void ComponentInit(Entity entity) { if (this.entity == null) this.entity = entity; else throw new SetEntityInvalidException(); OnComponentInit(entity); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Andromeda2D.Entities.Components.Internal { public abstract class Component : IComponent { protected Entity entity; public Entity Entity { get { return entity; } } public virtual void OnComponentCopy(Entity source, Entity copy) { } protected virtual void OnComponentInit(Entity entity) { } public void ComponentInit(Entity entity) { if (this.entity == null) this.entity = entity; else throw new SetEntityInvalidException(); OnComponentInit(entity); } } }
mit
C#
9ba8f816dfc8bdbd1ccbcd4e49ac76a89cf25dbb
Disable vstest tests temporarily to unblock PR build
dasMulli/cli,ravimeda/cli,weshaggard/cli,jonsequitur/cli,svick/cli,dasMulli/cli,Faizan2304/cli,nguerrera/cli,blackdwarf/cli,livarcocc/cli-1,Faizan2304/cli,EdwardBlair/cli,AbhitejJohn/cli,AbhitejJohn/cli,EdwardBlair/cli,johnbeisner/cli,Faizan2304/cli,svick/cli,nguerrera/cli,harshjain2/cli,mlorbetske/cli,mlorbetske/cli,jonsequitur/cli,blackdwarf/cli,EdwardBlair/cli,AbhitejJohn/cli,jonsequitur/cli,nguerrera/cli,livarcocc/cli-1,weshaggard/cli,livarcocc/cli-1,nguerrera/cli,weshaggard/cli,blackdwarf/cli,harshjain2/cli,johnbeisner/cli,dasMulli/cli,ravimeda/cli,weshaggard/cli,mlorbetske/cli,johnbeisner/cli,weshaggard/cli,svick/cli,ravimeda/cli,blackdwarf/cli,mlorbetske/cli,harshjain2/cli,AbhitejJohn/cli,jonsequitur/cli
test/dotnet-vstest.Tests/VSTestTests.cs
test/dotnet-vstest.Tests/VSTestTests.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 Microsoft.DotNet.Tools.Test.Utilities; using Xunit; using System; using System.IO; using FluentAssertions; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Cli.VSTest.Tests { public class VSTestTests : TestBase { //[Fact] public void TestsFromAGivenContainerShouldRunWithExpectedOutput() { // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestDotNetCoreProject"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); string testProjectDirectory = testInstance.TestRoot; // Restore project VSTestDotNetCoreProject new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() .Should() .Pass(); // Build project VSTestDotNetCoreProject new BuildCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() .Should() .Pass(); // Prepare args to send vstest string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0"); string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll"); string argsForVstest = string.Concat("\"", outputDll, "\""); // Call vstest CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest); // Verify result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0."); result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest"); result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest"); } } }
// 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 Microsoft.DotNet.Tools.Test.Utilities; using Xunit; using System; using System.IO; using FluentAssertions; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Cli.VSTest.Tests { public class VSTestTests : TestBase { [Fact] public void TestsFromAGivenContainerShouldRunWithExpectedOutput() { // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestDotNetCoreProject"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); string testProjectDirectory = testInstance.TestRoot; // Restore project VSTestDotNetCoreProject new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() .Should() .Pass(); // Build project VSTestDotNetCoreProject new BuildCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() .Should() .Pass(); // Prepare args to send vstest string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0"); string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll"); string argsForVstest = string.Concat("\"", outputDll, "\""); // Call vstest CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest); // Verify result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0."); result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest"); result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest"); } } }
mit
C#
9b561f734cd95052946deef5d959b912b8b0c9fd
Fix GitRepositoryAttribute to evaluate branch only when retrieving injection value
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Git/GitRepositoryAttribute.cs
source/Nuke.Common/Git/GitRepositoryAttribute.cs
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; using Nuke.Common.BuildServers; using Nuke.Common.Execution; using Nuke.Common.Tools.Git; namespace Nuke.Common.Git { /// <inheritdoc/> /// <summary> /// Injects an instance of <see cref="GitRepository"/> based on the local repository. /// <para/> /// <inheritdoc/> /// </summary> [PublicAPI] [UsedImplicitly(ImplicitUseKindFlags.Default)] public class GitRepositoryAttribute : InjectionAttributeBase { [CanBeNull] public string Branch { get; set; } [CanBeNull] public string Remote { get; set; } public override object GetValue(MemberInfo member, Type buildType) { return ControlFlow.SuppressErrors(() => GitRepository.FromLocalDirectory( NukeBuild.RootDirectory, Branch ?? GetBranch(), Remote ?? "origin")); } private string GetBranch() { return AppVeyor.Instance?.RepositoryBranch ?? Bitrise.Instance?.GitBranch ?? GitLab.Instance?.CommitRefName ?? Jenkins.Instance?.GitBranch ?? TeamCity.Instance?.BranchName ?? TeamServices.Instance?.SourceBranchName ?? Travis.Instance?.Branch ?? GitTasks.GitCurrentBranch(); } } }
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; using Nuke.Common.BuildServers; using Nuke.Common.Execution; using Nuke.Common.Tools.Git; namespace Nuke.Common.Git { /// <inheritdoc/> /// <summary> /// Injects an instance of <see cref="GitRepository"/> based on the local repository. /// <para/> /// <inheritdoc/> /// </summary> [PublicAPI] [UsedImplicitly(ImplicitUseKindFlags.Default)] public class GitRepositoryAttribute : InjectionAttributeBase { private static Lazy<string> s_branch = new Lazy<string>(() => AppVeyor.Instance?.RepositoryBranch ?? Bitrise.Instance?.GitBranch ?? GitLab.Instance?.CommitRefName ?? Jenkins.Instance?.GitBranch ?? TeamCity.Instance?.BranchName ?? TeamServices.Instance?.SourceBranchName ?? Travis.Instance?.Branch ?? GitTasks.GitCurrentBranch()); [CanBeNull] public string Branch { get; set; } = s_branch.Value; public string Remote { get; set; } = "origin"; public override object GetValue(MemberInfo member, Type buildType) { return ControlFlow.SuppressErrors(() => GitRepository.FromLocalDirectory(NukeBuild.RootDirectory, Branch, Remote.NotNull())); } } }
mit
C#
a954cf8cee9174d5fafef24bdbde8158834f182f
Fix for migration issues.
fuzeman/vox,fuzeman/vox,fuzeman/vox
JabbR/Migrations/201304220931168_UpstreamNotificationChanges.cs
JabbR/Migrations/201304220931168_UpstreamNotificationChanges.cs
namespace JabbR.Models.Migrations { using System; using System.Data.Entity.Migrations; public partial class UpstreamNotificationChanges : DbMigration { public override void Up() { AddColumn("dbo.ChatMessages", "MessageType", c => c.Int(nullable: false, defaultValue: 0)); AddColumn("dbo.ChatMessages", "ImageUrl", c => c.String()); AddColumn("dbo.ChatMessages", "Source", c => c.String()); AddColumn("dbo.Notifications", "RoomKey", c => c.Int(nullable: true)); Sql(@"UPDATE n SET n.RoomKey = m.Room_Key FROM dbo.Notifications n INNER JOIN dbo.ChatMessages m on m.[Key] = n.MessageKey"); AlterColumn("dbo.Notifications", "RoomKey", c => c.Int(nullable: false)); AddForeignKey("dbo.Notifications", "RoomKey", "dbo.ChatRooms", "Key", cascadeDelete: true); CreateIndex("dbo.Notifications", "RoomKey"); } public override void Down() { DropIndex("dbo.Notifications", new[] { "RoomKey" }); DropForeignKey("dbo.Notifications", "RoomKey", "dbo.ChatRooms"); DropColumn("dbo.Notifications", "RoomKey"); DropColumn("dbo.ChatMessages", "Source"); DropColumn("dbo.ChatMessages", "ImageUrl"); DropColumn("dbo.ChatMessages", "MessageType"); } } }
namespace JabbR.Models.Migrations { using System; using System.Data.Entity.Migrations; public partial class UpstreamNotificationChanges : DbMigration { public override void Up() { AddColumn("dbo.ChatMessages", "MessageType", c => c.Int(nullable: false)); AddColumn("dbo.ChatMessages", "ImageUrl", c => c.String()); AddColumn("dbo.ChatMessages", "Source", c => c.String()); AddColumn("dbo.Notifications", "RoomKey", c => c.Int(nullable: false)); AddForeignKey("dbo.Notifications", "RoomKey", "dbo.ChatRooms", "Key", cascadeDelete: true); CreateIndex("dbo.Notifications", "RoomKey"); } public override void Down() { DropIndex("dbo.Notifications", new[] { "RoomKey" }); DropForeignKey("dbo.Notifications", "RoomKey", "dbo.ChatRooms"); DropColumn("dbo.Notifications", "RoomKey"); DropColumn("dbo.ChatMessages", "Source"); DropColumn("dbo.ChatMessages", "ImageUrl"); DropColumn("dbo.ChatMessages", "MessageType"); } } }
mit
C#
3291e7d658d347ea944b44d04ff0468386bdc0a1
Increment version to 1.11.
mjvh80/jefferson
Jefferson.Core/Properties/AssemblyInfo.cs
Jefferson.Core/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("Jefferson")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Jefferson")] [assembly: AssemblyCopyright("Copyright Marcus van Houdt © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("75992e07-f7c6-4b16-9d62-b878632ab693")] // 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.11.0")] [assembly: AssemblyFileVersion("0.1.11.0")] [assembly: InternalsVisibleTo("Jefferson.Tests")]
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("Jefferson")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Jefferson")] [assembly: AssemblyCopyright("Copyright Marcus van Houdt © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("75992e07-f7c6-4b16-9d62-b878632ab693")] // 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.10.0")] [assembly: AssemblyFileVersion("0.1.10.0")] [assembly: InternalsVisibleTo("Jefferson.Tests")]
apache-2.0
C#
ed63b571d2185d4b3e86d77a08c0f9ce656f819c
Add "new" override for ScrollToEnd To UserTrackingScrollContainer
UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,smoogipooo/osu
osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs
osu.Game/Graphics/Containers/UserTrackingScrollContainer.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; namespace osu.Game.Graphics.Containers { public class UserTrackingScrollContainer : UserTrackingScrollContainer<Drawable> { public UserTrackingScrollContainer() { } public UserTrackingScrollContainer(Direction direction) : base(direction) { } } public class UserTrackingScrollContainer<T> : OsuScrollContainer<T> where T : Drawable { /// <summary> /// Whether the last scroll event was user triggered, directly on the scroll container. /// </summary> public bool UserScrolling { get; private set; } public UserTrackingScrollContainer() { } public UserTrackingScrollContainer(Direction direction) : base(direction) { } protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default) { UserScrolling = true; base.OnUserScroll(value, animated, distanceDecay); } public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null) { UserScrolling = false; base.ScrollTo(value, animated, distanceDecay); } public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false) { UserScrolling = false; base.ScrollToEnd(animated, allowDuringDrag); } } }
// 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; namespace osu.Game.Graphics.Containers { public class UserTrackingScrollContainer : UserTrackingScrollContainer<Drawable> { public UserTrackingScrollContainer() { } public UserTrackingScrollContainer(Direction direction) : base(direction) { } } public class UserTrackingScrollContainer<T> : OsuScrollContainer<T> where T : Drawable { /// <summary> /// Whether the last scroll event was user triggered, directly on the scroll container. /// </summary> public bool UserScrolling { get; private set; } public UserTrackingScrollContainer() { } public UserTrackingScrollContainer(Direction direction) : base(direction) { } protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default) { UserScrolling = true; base.OnUserScroll(value, animated, distanceDecay); } public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null) { UserScrolling = false; base.ScrollTo(value, animated, distanceDecay); } } }
mit
C#
460d205b69ee3161c640878f8bdbc9e9febdc46b
Remove message on use.
gjulianm/AncoraMVVM
AncoraMVVM.Base/Implementations/Messager.cs
AncoraMVVM.Base/Implementations/Messager.cs
using AncoraMVVM.Base.Interfaces; using System; using System.Collections.Generic; using System.Linq; namespace AncoraMVVM.Base { // TODO: Possible oversizing of the internal message list. public class Messager : IMessager { private List<Tuple<Type, object>> messages = new List<Tuple<Type, object>>(); private object dicLock = new object(); public void SendTo<TViewModel, TMessage>(TMessage msg) where TViewModel : ViewModelBase where TMessage : class { lock (dicLock) messages.Add(Tuple.Create(typeof(TViewModel), (object)msg)); } public TMessage Receive<TViewModel, TMessage>() where TViewModel : ViewModelBase where TMessage : class { var viewModel = typeof(TViewModel); return Receive<TMessage>(viewModel); } public TMessage Receive<TMessage>(Type viewModelType) where TMessage : class { Tuple<Type, object> pair = null; lock (dicLock) { pair = messages.LastOrDefault(x => x.Item1 == viewModelType && x.Item2.GetType() == typeof(TMessage)); if (pair == null) return null; messages.Remove(pair); } return (TMessage)pair.Item2; } } }
using AncoraMVVM.Base.Interfaces; using System; using System.Collections.Generic; using System.Linq; namespace AncoraMVVM.Base { // TODO: Possible oversizing of the internal message list. public class Messager : IMessager { private List<Tuple<Type, object>> messages = new List<Tuple<Type, object>>(); private object dicLock = new object(); public void SendTo<TViewModel, TMessage>(TMessage msg) where TViewModel : ViewModelBase where TMessage : class { lock (dicLock) messages.Add(Tuple.Create(typeof(TViewModel), (object)msg)); } public TMessage Receive<TViewModel, TMessage>() where TViewModel : ViewModelBase where TMessage : class { var viewModel = typeof(TViewModel); return Receive<TMessage>(viewModel); } public TMessage Receive<TMessage>(Type viewModelType) where TMessage : class { Tuple<Type, object> pair = null; lock (dicLock) pair = messages.LastOrDefault(x => x.Item1 == viewModelType && x.Item2.GetType() == typeof(TMessage)); if (pair == null) return null; else return (TMessage)pair.Item2; } } }
mpl-2.0
C#
c42568694ede4abe8a9d43e20d8cc79367f3bb94
fix GLStateList
bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL
CSharpGL4/GLObjects/GLStates/GLStateList.cs
CSharpGL4/GLObjects/GLStates/GLStateList.cs
using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; namespace CSharpGL { /// <summary> /// /// </summary> //[Editor(typeof(IListEditor<GLState>), typeof(UITypeEditor))] public class GLStateList : List<GLState>, IGLState { public void On() { for (int i = 0; i < this.Count; i++) { this[i].On(); } } public void Off() { for (int i = this.Count - 1; i >= 0; i--) { this[i].Off(); } } } }
using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; namespace CSharpGL { /// <summary> /// /// </summary> //[Editor(typeof(IListEditor<GLState>), typeof(UITypeEditor))] public class GLStateList : List<GLState>, IGLState { public void On() { for (int i = 0; i < this.Count; i++) { this[i].On(); } } public void Off() { for (int i = this.Count - 1; i >= 0; i++) { this[i].Off(); } } } }
mit
C#
6e08b1db1d342c584bc2899cb6dc0e175219dcee
Make sure that beginInvoke target exists
Piotrekol/StreamCompanion,Piotrekol/StreamCompanion
osu!StreamCompanion/Code/Modules/ModParser/ModParserSettings.cs
osu!StreamCompanion/Code/Modules/ModParser/ModParserSettings.cs
using System; using System.Windows.Forms; using osu_StreamCompanion.Code.Core; using osu_StreamCompanion.Code.Helpers; namespace osu_StreamCompanion.Code.Modules.ModParser { public partial class ModParserSettings : UserControl { private Settings _settings; private bool init = true; public ModParserSettings(Settings settings) { _settings = settings; _settings.SettingUpdated += SettingUpdated; this.Enabled = _settings.Get("EnableMemoryScanner", true); InitializeComponent(); textBox_Mods.Text = _settings.Get("NoModsDisplayText", "None"); radioButton_longMods.Checked = _settings.Get("UseLongMods", false); radioButton_shortMods.Checked = !radioButton_longMods.Checked; init = false; } private void SettingUpdated(object sender, SettingUpdated settingUpdated) { if (this.IsHandleCreated) this.BeginInvoke((MethodInvoker)(() => { if (settingUpdated.Name == "EnableMemoryScanner") this.Enabled = _settings.Get("EnableMemoryScanner", true); })); } private void textBox_Mods_TextChanged(object sender, EventArgs e) { if (init) return; _settings.Add("NoModsDisplayText", textBox_Mods.Text); } private void radioButton_longMods_CheckedChanged(object sender, EventArgs e) { if (init) return; if (((RadioButton)sender).Checked) { _settings.Add("UseLongMods", radioButton_longMods.Checked); } } } }
using System; using System.Windows.Forms; using osu_StreamCompanion.Code.Core; using osu_StreamCompanion.Code.Helpers; namespace osu_StreamCompanion.Code.Modules.ModParser { public partial class ModParserSettings : UserControl { private Settings _settings; private bool init = true; public ModParserSettings(Settings settings) { _settings = settings; _settings.SettingUpdated+= SettingUpdated; this.Enabled = _settings.Get("EnableMemoryScanner", true); InitializeComponent(); textBox_Mods.Text = _settings.Get("NoModsDisplayText", "None"); radioButton_longMods.Checked = _settings.Get("UseLongMods", false); radioButton_shortMods.Checked = !radioButton_longMods.Checked; init = false; } private void SettingUpdated(object sender, SettingUpdated settingUpdated) { this.BeginInvoke((MethodInvoker) (() => { if (settingUpdated.Name == "EnableMemoryScanner") this.Enabled = _settings.Get("EnableMemoryScanner", true); })); } private void textBox_Mods_TextChanged(object sender, EventArgs e) { if (init) return; _settings.Add("NoModsDisplayText", textBox_Mods.Text); } private void radioButton_longMods_CheckedChanged(object sender, EventArgs e) { if (init) return; if (((RadioButton)sender).Checked) { _settings.Add("UseLongMods", radioButton_longMods.Checked); } } } }
mit
C#
603cecb2ebbf2241f605ed86daf18d1139013140
Make CatchHitObjectPiece abstract class
smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu
osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs
osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.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 JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Skinning.Default { public abstract class CatchHitObjectPiece : CompositeDrawable { public readonly Bindable<Color4> AccentColour = new Bindable<Color4>(); public readonly Bindable<bool> HyperDash = new Bindable<bool>(); [Resolved(canBeNull: true)] [CanBeNull] protected DrawableHitObject DrawableHitObject { get; private set; } [CanBeNull] protected BorderPiece BorderPiece; [CanBeNull] protected HyperBorderPiece HyperBorderPiece; protected override void LoadComplete() { base.LoadComplete(); var hitObject = (DrawablePalpableCatchHitObject)DrawableHitObject; if (hitObject != null) { AccentColour.BindTo(hitObject.AccentColour); HyperDash.BindTo(hitObject.HyperDash); } HyperDash.BindValueChanged(hyper => { if (HyperBorderPiece != null) HyperBorderPiece.Alpha = hyper.NewValue ? 1 : 0; }, true); } protected override void Update() { if (BorderPiece != null && DrawableHitObject?.HitObject != null) BorderPiece.Alpha = (float)Math.Clamp((DrawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1); } } }
// 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 JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Skinning.Default { public class CatchHitObjectPiece : CompositeDrawable { public readonly Bindable<Color4> AccentColour = new Bindable<Color4>(); public readonly Bindable<bool> HyperDash = new Bindable<bool>(); [Resolved(canBeNull: true)] [CanBeNull] protected DrawableHitObject DrawableHitObject { get; private set; } [CanBeNull] protected BorderPiece BorderPiece; [CanBeNull] protected HyperBorderPiece HyperBorderPiece; protected override void LoadComplete() { base.LoadComplete(); var hitObject = (DrawablePalpableCatchHitObject)DrawableHitObject; if (hitObject != null) { AccentColour.BindTo(hitObject.AccentColour); HyperDash.BindTo(hitObject.HyperDash); } HyperDash.BindValueChanged(hyper => { if (HyperBorderPiece != null) HyperBorderPiece.Alpha = hyper.NewValue ? 1 : 0; }, true); } protected override void Update() { if (BorderPiece != null && DrawableHitObject?.HitObject != null) BorderPiece.Alpha = (float)Math.Clamp((DrawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1); } } }
mit
C#