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
a6beba9781e6dc40930d08d918591c55b1f48aef
update samples using new api.
ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP
samples/Sample.Kafka/Startup.cs
samples/Sample.Kafka/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace Sample.Kafka { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext<AppDbContext>(); services.AddCap(x=> { x.UseEntityFramework<AppDbContext>(); x.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Test;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True"); x.UseRabbitMQ("localhost"); }); // Add framework services. services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc(); app.UseCap(); } } }
using DotNetCore.CAP.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace Sample.Kafka { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext<AppDbContext>(); services.AddCap() .AddEntityFrameworkStores<AppDbContext>(x=> { //x.ConnectionString = "Server=192.168.2.206;Initial Catalog=Test;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True"; x.ConnectionString = "Server=DESKTOP-M9R8T31;Initial Catalog=Test;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True"; }) .AddRabbitMQ(x => { x.HostName = "localhost"; // x.UserName = "admin"; // x.Password = "123123"; }); //.AddKafka(x => x.Servers = ""); // Add framework services. services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc(); app.UseCap(); } } }
mit
C#
48159b3c0eb54915185e9027f06d7f5747f8a250
Return null if active IVsHierarchy is null
clariuslabs/clide,clariuslabs/clide,kzu/clide,kzu/clide,tondat/clide,tondat/clide,kzu/clide,clariuslabs/clide,tondat/clide
src/Clide/Interop/VsSolutionSelection.cs
src/Clide/Interop/VsSolutionSelection.cs
using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Runtime.InteropServices; using Merq; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; namespace Clide.Interop { [Export (typeof (IVsSolutionSelection))] internal class VsSolutionSelection : IVsSolutionSelection { IVsUIHierarchyWindow hierarchyWindow; IVsHierarchyItemManager hierarchyManager; IAsyncManager asyncManager; [ImportingConstructor] public VsSolutionSelection ( [Import (ContractNames.Interop.SolutionExplorerWindow)] IVsUIHierarchyWindow hierarchyWindow, IVsHierarchyItemManager hierarchyManager, IAsyncManager asyncManager) { this.hierarchyWindow = hierarchyWindow; this.hierarchyManager = hierarchyManager; this.asyncManager = asyncManager; } public IVsHierarchyItem GetActiveHierarchy () { return asyncManager.Run (async () => { await asyncManager.SwitchToMainThread (); IVsUIHierarchy uiHier; if (ErrorHandler.Failed (hierarchyWindow.FindCommonSelectedHierarchy ((uint)__VSCOMHIEROPTIONS.COMHIEROPT_RootHierarchyOnly, out uiHier))) return null; if (uiHier == null) return null; return hierarchyManager.GetHierarchyItem (uiHier, VSConstants.VSITEMID_ROOT); }); } public IEnumerable<IVsHierarchyItem> GetSelection () { return asyncManager.Run (async () => { await asyncManager.SwitchToMainThread (); var selHier = IntPtr.Zero; uint selId; IVsMultiItemSelect selMulti; try { ErrorHandler.ThrowOnFailure (hierarchyWindow.GetCurrentSelection (out selHier, out selId, out selMulti)); // There may be no selection at all. if (selMulti == null && selHier == IntPtr.Zero) return Enumerable.Empty<IVsHierarchyItem> (); // This is a single item selection. if (selMulti == null) { return new[] { hierarchyManager.GetHierarchyItem ( (IVsHierarchy)Marshal.GetTypedObjectForIUnknown (selHier, typeof (IVsHierarchy)), selId) }; } // This is a multiple item selection. uint selCount; int singleHier; ErrorHandler.ThrowOnFailure (selMulti.GetSelectionInfo (out selCount, out singleHier)); var selection = new VSITEMSELECTION[selCount]; ErrorHandler.ThrowOnFailure (selMulti.GetSelectedItems (0, selCount, selection)); return selection.Where (sel => sel.pHier != null) .Select (sel => hierarchyManager.GetHierarchyItem (sel.pHier, sel.itemid)) .ToArray (); } finally { if (selHier != IntPtr.Zero) Marshal.Release (selHier); } }); } } }
using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Runtime.InteropServices; using Merq; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; namespace Clide.Interop { [Export (typeof (IVsSolutionSelection))] internal class VsSolutionSelection : IVsSolutionSelection { IVsUIHierarchyWindow hierarchyWindow; IVsHierarchyItemManager hierarchyManager; IAsyncManager asyncManager; [ImportingConstructor] public VsSolutionSelection ( [Import (ContractNames.Interop.SolutionExplorerWindow)] IVsUIHierarchyWindow hierarchyWindow, IVsHierarchyItemManager hierarchyManager, IAsyncManager asyncManager) { this.hierarchyWindow = hierarchyWindow; this.hierarchyManager = hierarchyManager; this.asyncManager = asyncManager; } public IVsHierarchyItem GetActiveHierarchy () { return asyncManager.Run (async () => { await asyncManager.SwitchToMainThread (); IVsUIHierarchy uiHier; if (ErrorHandler.Failed (hierarchyWindow.FindCommonSelectedHierarchy ((uint)__VSCOMHIEROPTIONS.COMHIEROPT_RootHierarchyOnly, out uiHier))) return null; return hierarchyManager.GetHierarchyItem (uiHier, VSConstants.VSITEMID_ROOT); }); } public IEnumerable<IVsHierarchyItem> GetSelection () { return asyncManager.Run (async () => { await asyncManager.SwitchToMainThread (); var selHier = IntPtr.Zero; uint selId; IVsMultiItemSelect selMulti; try { ErrorHandler.ThrowOnFailure (hierarchyWindow.GetCurrentSelection (out selHier, out selId, out selMulti)); // There may be no selection at all. if (selMulti == null && selHier == IntPtr.Zero) return Enumerable.Empty<IVsHierarchyItem> (); // This is a single item selection. if (selMulti == null) { return new[] { hierarchyManager.GetHierarchyItem ( (IVsHierarchy)Marshal.GetTypedObjectForIUnknown (selHier, typeof (IVsHierarchy)), selId) }; } // This is a multiple item selection. uint selCount; int singleHier; ErrorHandler.ThrowOnFailure (selMulti.GetSelectionInfo (out selCount, out singleHier)); var selection = new VSITEMSELECTION[selCount]; ErrorHandler.ThrowOnFailure (selMulti.GetSelectedItems (0, selCount, selection)); return selection.Where (sel => sel.pHier != null) .Select (sel => hierarchyManager.GetHierarchyItem (sel.pHier, sel.itemid)) .ToArray (); } finally { if (selHier != IntPtr.Zero) Marshal.Release (selHier); } }); } } }
mit
C#
30ff0b83c199a20ddcd2e86beb643842f1263daf
Fix test failures due to unpopulated room
ppy/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,UselessToucan/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu
osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs
osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Lounge.Components; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual.Multiplayer { public abstract class MultiplayerTestScene : RoomTestScene { [Cached(typeof(StatefulMultiplayerClient))] public TestMultiplayerClient Client { get; } [Cached(typeof(IRoomManager))] public TestMultiplayerRoomManager RoomManager { get; } [Cached] public Bindable<FilterCriteria> Filter { get; } [Cached] public OngoingOperationTracker OngoingOperationTracker { get; } protected override Container<Drawable> Content => content; private readonly TestMultiplayerRoomContainer content; private readonly bool joinRoom; protected MultiplayerTestScene(bool joinRoom = true) { this.joinRoom = joinRoom; base.Content.Add(content = new TestMultiplayerRoomContainer { RelativeSizeAxes = Axes.Both }); Client = content.Client; RoomManager = content.RoomManager; Filter = content.Filter; OngoingOperationTracker = content.OngoingOperationTracker; } [SetUp] public new void Setup() => Schedule(() => { RoomManager.Schedule(() => RoomManager.PartRoom()); if (joinRoom) { Room.Name.Value = "test name"; Room.Playlist.Add(new PlaylistItem { Beatmap = { Value = new TestBeatmap(Ruleset.Value).BeatmapInfo }, Ruleset = { Value = Ruleset.Value } }); RoomManager.Schedule(() => RoomManager.CreateRoom(Room)); } }); public override void SetUpSteps() { base.SetUpSteps(); if (joinRoom) AddUntilStep("wait for room join", () => Client.Room != null); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { public abstract class MultiplayerTestScene : RoomTestScene { [Cached(typeof(StatefulMultiplayerClient))] public TestMultiplayerClient Client { get; } [Cached(typeof(IRoomManager))] public TestMultiplayerRoomManager RoomManager { get; } [Cached] public Bindable<FilterCriteria> Filter { get; } [Cached] public OngoingOperationTracker OngoingOperationTracker { get; } protected override Container<Drawable> Content => content; private readonly TestMultiplayerRoomContainer content; private readonly bool joinRoom; protected MultiplayerTestScene(bool joinRoom = true) { this.joinRoom = joinRoom; base.Content.Add(content = new TestMultiplayerRoomContainer { RelativeSizeAxes = Axes.Both }); Client = content.Client; RoomManager = content.RoomManager; Filter = content.Filter; OngoingOperationTracker = content.OngoingOperationTracker; } [SetUp] public new void Setup() => Schedule(() => { RoomManager.Schedule(() => RoomManager.PartRoom()); if (joinRoom) RoomManager.Schedule(() => RoomManager.CreateRoom(Room)); }); public override void SetUpSteps() { base.SetUpSteps(); if (joinRoom) AddUntilStep("wait for room join", () => Client.Room != null); } } }
mit
C#
6b8e4b5111f6d73c9563800bc1cb0a4462b1d088
Fix erroneous removal of code
googleads/googleads-mobile-unity,googleads/googleads-mobile-unity
source/plugin/Assets/GoogleMobileAds/Editor/GoogleMobileAdsSettingsEditor.cs
source/plugin/Assets/GoogleMobileAds/Editor/GoogleMobileAdsSettingsEditor.cs
using UnityEditor; using UnityEngine; namespace GoogleMobileAds.Editor { [InitializeOnLoad] [CustomEditor(typeof(GoogleMobileAdsSettings))] public class GoogleMobileAdsSettingsEditor : UnityEditor.Editor { [MenuItem("Assets/Google Mobile Ads/Settings...")] public static void OpenInspector() { Selection.activeObject = GoogleMobileAdsSettings.Instance; } public override void OnInspectorGUI() { EditorGUILayout.LabelField("Google Mobile Ads App ID", EditorStyles.boldLabel); EditorGUI.indentLevel++; GoogleMobileAdsSettings.Instance.GoogleMobileAdsAndroidAppId = EditorGUILayout.TextField("Android", GoogleMobileAdsSettings.Instance.GoogleMobileAdsAndroidAppId); GoogleMobileAdsSettings.Instance.GoogleMobileAdsIOSAppId = EditorGUILayout.TextField("iOS", GoogleMobileAdsSettings.Instance.GoogleMobileAdsIOSAppId); EditorGUILayout.HelpBox( "Google Mobile Ads App ID will look similar to this sample ID: ca-app-pub-3940256099942544~3347511713", MessageType.Info); EditorGUI.indentLevel--; EditorGUILayout.Separator(); EditorGUILayout.LabelField("AdMob-specific settings", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit = EditorGUILayout.Toggle(new GUIContent("Delay app measurement"), GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit); if (GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit) { EditorGUILayout.HelpBox( "Delays app measurement until you explicitly initialize the Mobile Ads SDK or load an ad.", MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); if (GUI.changed) { OnSettingsChanged(); } } private void OnSettingsChanged() { EditorUtility.SetDirty((GoogleMobileAdsSettings) target); GoogleMobileAdsSettings.Instance.WriteSettingsToFile(); } } }
using UnityEditor; using UnityEngine; namespace GoogleMobileAds.Editor { [InitializeOnLoad] [CustomEditor(typeof(GoogleMobileAdsSettings))] public class GoogleMobileAdsSettingsEditor : UnityEditor.Editor { [MenuItem("Assets/Google Mobile Ads/Settings...")] public static void OpenInspector() { Selection.activeObject = GoogleMobileAdsSettings.Instance; if (GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit) { EditorGUILayout.HelpBox( "Delays app measurement until you explicitly initialize the Mobile Ads SDK or load an ad.", MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); if (GUI.changed) { OnSettingsChanged(); } } private void OnSettingsChanged() { EditorUtility.SetDirty((GoogleMobileAdsSettings) target); GoogleMobileAdsSettings.Instance.WriteSettingsToFile(); } } }
apache-2.0
C#
9673b33eff62b412e3128534c3afb90d4a8a5ea7
Update ValuesController.cs
cayodonatti/TopGearApi
TopGearApi/Controllers/ValuesController.cs
TopGearApi/Controllers/ValuesController.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Mvc; namespace TopGearApi.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/values/5 public string Get(int id) { return "value"; } // POST api/values public void Post([FromBody]string value) { } // PUT api/values/5 public void Put(int id, [FromBody]string value) { } // DELETE api/values/5 public void Delete(int id) { } [HttpGet] [Route("Test")] public IHttpActionResult Obter() { /*var content = JsonConvert.SerializeObject(new { ab = "teste1", cd = "teste2 " }); return base.Json(content);*/ // Then I return the list return new JsonResult { Data = new { ab = "teste1", cd = "teste2 " } }; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace TopGearApi.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/values/5 public string Get(int id) { return "value"; } // POST api/values public void Post([FromBody]string value) { } // PUT api/values/5 public void Put(int id, [FromBody]string value) { } // DELETE api/values/5 public void Delete(int id) { } [HttpGet] [Route("Test")] public IHttpActionResult Obter() { var content = JsonConvert.SerializeObject(new { ab = "teste1", cd = "teste2 " }); return base.Json(content); } } }
mit
C#
12b2476b4a6e69b0aa7cb94a78dfdcfc78e8dfc1
Remove ControllerStateTracker debug logging I accidently left in
virtuallynaked/virtually-naked,virtuallynaked/virtually-naked
Viewer/src/input/ControllerStateTracker.cs
Viewer/src/input/ControllerStateTracker.cs
using SharpDX; using System; using Valve.VR; public class ControllerStateTracker { private readonly uint deviceIdx; private bool active; private bool menuOpen; private VRControllerState_t secondPreviousState; private VRControllerState_t previousState; private VRControllerState_t currentState; private int staleness; private int previousStaleness; public ControllerStateTracker(uint deviceIdx) { this.deviceIdx = deviceIdx; } public void Update() { if (OpenVR.System.GetTrackedDeviceClass(deviceIdx) != ETrackedDeviceClass.Controller) { active = false; return; } if (!OpenVR.System.GetControllerState(deviceIdx, out var controllerState)) { active = false; return; } if (active) { staleness += 1; if (controllerState.unPacketNum == currentState.unPacketNum) { return; } } if (!active) { //activate active = true; secondPreviousState = default(VRControllerState_t); previousState = default(VRControllerState_t); } else { secondPreviousState = previousState; previousState = currentState; previousStaleness = staleness; } currentState = controllerState; staleness = 0; if (WasClicked(EVRButtonId.k_EButton_ApplicationMenu)) { menuOpen = !menuOpen; } } public bool Active => active; public bool IsFresh => staleness == 0; public bool MenuActive => active && menuOpen; public bool NonMenuActive => active && !menuOpen; public bool WasClicked(EVRButtonId buttonId) { return staleness == 0 && previousState.IsPressed(buttonId) && !currentState.IsPressed(buttonId); } public bool IsTouched(EVRButtonId buttonId) { return currentState.IsTouched(buttonId); } public bool IsPressed(EVRButtonId buttonId) { return currentState.IsPressed(buttonId); } public bool BecameUntouched(EVRButtonId buttonId) { return staleness == 0 && previousState.IsTouched(buttonId) && !currentState.IsTouched(buttonId); } public bool HasTouchDelta(uint axisIdx) { EVRButtonId buttonId = EVRButtonId.k_EButton_Axis0 + (int) axisIdx; if (staleness > 0) { return false; } if (!currentState.IsTouched(buttonId) || !previousState.IsTouched(buttonId)) { return false; } if (!secondPreviousState.IsTouched(buttonId)) { //workaround for SteamVR bug: http://steamcommunity.com/app/250820/discussions/3/2132869574256358055/ return false; } return true; } public Vector2 GetTouchDelta(uint axisIdx) { Vector2 previousPosition = previousState.GetAxis(axisIdx).AsVector(); Vector2 currentPosition = currentState.GetAxis(axisIdx).AsVector(); return currentPosition - previousPosition; } public Vector2 GetAxisPosition(uint axisIdx) { return currentState.GetAxis(axisIdx).AsVector(); } public int GetUpdateRate() { return previousStaleness; } }
using SharpDX; using System; using Valve.VR; public class ControllerStateTracker { private readonly uint deviceIdx; private bool active; private bool menuOpen; private VRControllerState_t secondPreviousState; private VRControllerState_t previousState; private VRControllerState_t currentState; private int staleness; private int previousStaleness; public ControllerStateTracker(uint deviceIdx) { this.deviceIdx = deviceIdx; } public void Update() { if (OpenVR.System.GetTrackedDeviceClass(deviceIdx) != ETrackedDeviceClass.Controller) { active = false; return; } if (!OpenVR.System.GetControllerState(deviceIdx, out var controllerState)) { active = false; return; } if (active) { staleness += 1; if (controllerState.unPacketNum == currentState.unPacketNum) { return; } } if (!active) { //activate Console.WriteLine("activate"); active = true; secondPreviousState = default(VRControllerState_t); previousState = default(VRControllerState_t); } else { secondPreviousState = previousState; previousState = currentState; previousStaleness = staleness; } currentState = controllerState; staleness = 0; if (WasClicked(EVRButtonId.k_EButton_ApplicationMenu)) { menuOpen = !menuOpen; } } public bool Active => active; public bool IsFresh => staleness == 0; public bool MenuActive => active && menuOpen; public bool NonMenuActive => active && !menuOpen; public bool WasClicked(EVRButtonId buttonId) { return staleness == 0 && previousState.IsPressed(buttonId) && !currentState.IsPressed(buttonId); } public bool IsTouched(EVRButtonId buttonId) { return currentState.IsTouched(buttonId); } public bool IsPressed(EVRButtonId buttonId) { return currentState.IsPressed(buttonId); } public bool BecameUntouched(EVRButtonId buttonId) { return staleness == 0 && previousState.IsTouched(buttonId) && !currentState.IsTouched(buttonId); } public bool HasTouchDelta(uint axisIdx) { EVRButtonId buttonId = EVRButtonId.k_EButton_Axis0 + (int) axisIdx; if (staleness > 0) { return false; } if (!currentState.IsTouched(buttonId) || !previousState.IsTouched(buttonId)) { return false; } if (!secondPreviousState.IsTouched(buttonId)) { //workaround for SteamVR bug: http://steamcommunity.com/app/250820/discussions/3/2132869574256358055/ return false; } return true; } public Vector2 GetTouchDelta(uint axisIdx) { Vector2 previousPosition = previousState.GetAxis(axisIdx).AsVector(); Vector2 currentPosition = currentState.GetAxis(axisIdx).AsVector(); return currentPosition - previousPosition; } public Vector2 GetAxisPosition(uint axisIdx) { return currentState.GetAxis(axisIdx).AsVector(); } public int GetUpdateRate() { return previousStaleness; } }
mit
C#
95f2bef119ba54f55a0983fc1ea795704b390c69
Update tests
NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.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.531832890435525d, "diffcalc-test")] [TestCase(1.4644923495008817d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(8.8067616302940852d, "diffcalc-test")] [TestCase(1.7763214959309293d, "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 <[email protected]>. 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(); } }
mit
C#
ade665f43ca3b5fb92aea8af7229c7ec0320d7c1
Update edit-ticket.aspx.cs
c410echo/echo-asp
edit-ticket.aspx.cs
edit-ticket.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class edit_ticket : System.Web.UI.Page { private static ObjectDataSource edb = new ObjectDataSource("TicketDBTableAdapters.ticketsTableAdapter","get_ticket"); public int tkt_id_PK; public string tkt_name; public string tkt_desc; public string tkt_created; protected void Page_Load(object sender, EventArgs e) { } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class edit_ticket : System.Web.UI.Page { private static ObjectDataSource edb = new ObjectDataSource("TicketDBTableAdapters.ticketsTableAdapter","get_ticket"); public int tkt_id_PK = DataListItem public string tkt_name; public string tkt_desc; public string tkt_created; protected void Page_Load(object sender, EventArgs e) { } }
mit
C#
2aa75f1b68f0262c364e2a1db8c3e03531deb435
add Mobile Center keys to Private Keys
colbylwilliams/XWeather,colbylwilliams/XWeather
XWeather/XWeather/Constants/PrivateKeys.cs
XWeather/XWeather/Constants/PrivateKeys.cs
namespace XWeather.Constants { public static class PrivateKeys { public const string WuApiKey = @""; // https://github.com/colbylwilliams/XWeather#weather-underground public const string HockeyApiKey_iOS = @""; // https://github.com/colbylwilliams/XWeather#hockeyapp-optional public const string HockeyApiKey_Droid = @""; // https://github.com/colbylwilliams/XWeather#hockeyapp-optional public const string GoogleMapsApiKey = @""; // https://github.com/colbylwilliams/XWeather#google-maps-api-key-android public const string MobileCenter_iOS = @""; public const string MobileCenter_Droid = @""; } }
namespace XWeather.Constants { public static class PrivateKeys { public const string WuApiKey = @""; // https://github.com/colbylwilliams/XWeather#weather-underground public const string HockeyApiKey_iOS = @""; // https://github.com/colbylwilliams/XWeather#hockeyapp-optional public const string HockeyApiKey_Droid = @""; // https://github.com/colbylwilliams/XWeather#hockeyapp-optional public const string GoogleMapsApiKey = @""; // https://github.com/colbylwilliams/XWeather#google-maps-api-key-android } }
mit
C#
728edb8a5fa5a9227eaebdd7275873cc09207235
Update Bootstrap.cs
CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos
source/Cosmos.Core/Bootstrap.cs
source/Cosmos.Core/Bootstrap.cs
using Cosmos.Debug.Kernel; namespace Cosmos.Core { /// <summary> /// Bootstrap class. Used to invoke pre-boot methods. /// </summary> /// <remarks>Bootstrap is a class designed only to get the essentials done.</remarks> public unsafe static class Bootstrap { // See note in Global - these are a "hack" for now so // we dont force static init of Global, and it "pulls" these later till // we eventually eliminate them /// <summary> /// PIC interrupt. /// </summary> static public PIC PIC; // Has to be static for now, ZeroFill gets called before the Init. /// <summary> /// CPU. /// </summary> //static public readonly CPU CPU = new CPU(); // Bootstrap is a class designed only to get the essentials done. // ie the stuff needed to "pre boot". Do only the very minimal here. // IDT, PIC, and Float // Note: This is changing a bit GDT (already) and IDT are moving to a real preboot area. /// <summary> /// Init the boot strap. Invoke pre-boot methods. /// </summary> public static void Init() { // Drag this stuff in to the compiler manually until we add the always include attrib Multiboot2.Init(); INTs.Dummy(); PIC = new PIC(); CPU.UpdateIDT(true); /* TODO check using CPUID that SSE2 is supported */ CPU.InitSSE(); /* * We liked to use SSE for all floating point operation and end to mix SSE / x87 in Cosmos code * but sadly in x86 this resulte impossible as Intel not implemented some needed instruction (for example conversion * for long to double) so - in some rare cases - x87 continue to be used. I hope passing to the x32 or x64 IA will solve * definively this problem. */ CPU.InitFloat(); } } }
using Cosmos.Debug.Kernel; namespace Cosmos.Core { /// <summary> /// Bootstrap class. Used to invoke pre-boot methods. /// </summary> /// <remarks>Bootstrap is a class designed only to get the essentials done.</remarks> public unsafe static class Bootstrap { // See note in Global - these are a "hack" for now so // we dont force static init of Global, and it "pulls" these later till // we eventually eliminate them /// <summary> /// PIC interrupt. /// </summary> static public PIC PIC; // Has to be static for now, ZeroFill gets called before the Init. /// <summary> /// CPU. /// </summary> //static public readonly CPU CPU = new CPU(); // Bootstrap is a class designed only to get the essentials done. // ie the stuff needed to "pre boot". Do only the very minimal here. // IDT, PIC, and Float // Note: This is changing a bit GDT (already) and IDT are moving to a real preboot area. /// <summary> /// Init the boot strap. Invoke pre-boot methods. /// </summary> public static void Init() { //call for IL2CPU Multiboot2.Init(); // Drag this stuff in to the compiler manually until we add the always include attrib INTs.Dummy(); PIC = new PIC(); CPU.UpdateIDT(true); /* TODO check using CPUID that SSE2 is supported */ CPU.InitSSE(); /* * We liked to use SSE for all floating point operation and end to mix SSE / x87 in Cosmos code * but sadly in x86 this resulte impossible as Intel not implemented some needed instruction (for example conversion * for long to double) so - in some rare cases - x87 continue to be used. I hope passing to the x32 or x64 IA will solve * definively this problem. */ CPU.InitFloat(); } } }
bsd-3-clause
C#
66871a6b8ed8fea38858477bbff2384c8e811406
fix bug add batch
figueiredorui/BankA,figueiredorui/BankA,figueiredorui/BankA
src/Core/BankA.Data/Repositories/TransactionRepository.cs
src/Core/BankA.Data/Repositories/TransactionRepository.cs
using BankA.Data.Contexts; using BankA.Data.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BankA.Data.Repositories { public class TransactionRepository : Repository<BankTransaction> { public void AddBatch(List<BankTransaction> transactionLst) { transactionLst = transactionLst.OrderBy(o => o.TransactionDate).ToList(); using (var ctx = new BankAContext()) { foreach (var trans in transactionLst) { var accountTrans = ctx.BankTransactions.FirstOrDefault(q => q.TransactionDate == trans.TransactionDate //&& q.Description == trans.Description && q.AccountID == trans.AccountID && q.DebitAmount == trans.DebitAmount && q.CreditAmount == trans.CreditAmount); if (accountTrans == null) ctx.BankTransactions.Add(trans); } ctx.SaveChanges(); } } public List<string> GetTags() { using (var ctx = new BankAContext()) { return ctx.BankTransactions.Select(o => o.Tag).Distinct().ToList(); } } } }
using BankA.Data.Contexts; using BankA.Data.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BankA.Data.Repositories { public class TransactionRepository : Repository<BankTransaction> { public void AddBatch(List<BankTransaction> transactionLst) { transactionLst = transactionLst.OrderBy(o => o.TransactionDate).ToList(); using (var ctx = new BankAContext()) { foreach (var trans in transactionLst) { var accountTrans = ctx.BankTransactions.SingleOrDefault(q => q.TransactionDate == trans.TransactionDate //&& q.Description == trans.Description && q.AccountID == trans.AccountID && q.DebitAmount == trans.DebitAmount && q.CreditAmount == trans.CreditAmount); if (accountTrans == null) ctx.BankTransactions.Add(trans); } ctx.SaveChanges(); } } public List<string> GetTags() { using (var ctx = new BankAContext()) { return ctx.BankTransactions.Select(o => o.Tag).Distinct().ToList(); } } } }
mit
C#
945ef339760bee342bdde0f0db156430a28b9966
Add more string extension methods for common operations
dsbenghe/Novell.Directory.Ldap.NETStandard,dsbenghe/Novell.Directory.Ldap.NETStandard
src/Novell.Directory.Ldap.NETStandard/ExtensionMethods.cs
src/Novell.Directory.Ldap.NETStandard/ExtensionMethods.cs
using System; using System.Collections.Generic; using System.Text; namespace Novell.Directory.Ldap { internal static partial class ExtensionMethods { /// <summary> /// Shortcut for <see cref="string.IsNullOrEmpty"/> /// </summary> internal static bool IsEmpty(this string input) => string.IsNullOrEmpty(input); /// <summary> /// Shortcut for negative <see cref="string.IsNullOrEmpty"/> /// </summary> internal static bool IsNotEmpty(this string input) => !IsEmpty(input); /// <summary> /// Is the given collection null, or Empty (0 elements)? /// </summary> internal static bool IsEmpty<T>(this IReadOnlyCollection<T> coll) => coll == null || coll.Count == 0; /// <summary> /// Is the given collection not null, and has at least 1 element? /// </summary> /// <typeparam name="T"></typeparam> /// <param name="coll"></param> /// <returns></returns> internal static bool IsNotEmpty<T>(this IReadOnlyCollection<T> coll) => !IsEmpty(coll); /// <summary> /// Shortcut for <see cref="UTF8Encoding.GetBytes"/> /// </summary> internal static byte[] ToUtf8Bytes(this string input) => Encoding.UTF8.GetBytes(input); /// <summary> /// Shortcut for <see cref="UTF8Encoding.GetString"/> /// Will return an empty string if <paramref name="input"/> is null or empty. /// </summary> internal static string FromUtf8Bytes(this byte[] input) => input.IsNotEmpty() ? Encoding.UTF8.GetString(input) : string.Empty; /// <summary> /// Compare two strings using <see cref="StringComparison.Ordinal"/> /// </summary> internal static bool EqualsOrdinal(this string input, string other) => string.Equals(input, other, StringComparison.Ordinal); /// <summary> /// Compare two strings using <see cref="StringComparison.OrdinalIgnoreCase"/> /// </summary> internal static bool EqualsOrdinalCI(this string input, string other) => string.Equals(input, other, StringComparison.OrdinalIgnoreCase); } }
using System.Collections.Generic; using System.Text; namespace Novell.Directory.Ldap { internal static partial class ExtensionMethods { /// <summary> /// Is the given collection null, or Empty (0 elements)? /// </summary> internal static bool IsEmpty<T>(this IReadOnlyCollection<T> coll) => coll == null || coll.Count == 0; /// <summary> /// Is the given collection not null, and has at least 1 element? /// </summary> /// <typeparam name="T"></typeparam> /// <param name="coll"></param> /// <returns></returns> internal static bool IsNotEmpty<T>(this IReadOnlyCollection<T> coll) => !IsEmpty(coll); /// <summary> /// Shortcut for Encoding.UTF8.GetBytes /// </summary> internal static byte[] ToUtf8Bytes(this string input) => Encoding.UTF8.GetBytes(input); } }
mit
C#
ef3cae569b3a73b0a84790d568da3067efb30db8
Add music in Main
LorinMACE/SnakeDesignPatterns
Snake-DesignPatterns/Snake.cs
Snake-DesignPatterns/Snake.cs
using Snake_DesignPatterns.Controllers; using Snake_DesignPatterns.Controllers.Events; using Snake_DesignPatterns.Views; using System; using System.IO; using System.Text; namespace Snake_DesignPatterns { class Snake { public static CTick TickThread; public static EventManager EventManager; public static VInput InputThread; static void Main(string[] args) { Console.OutputEncoding = Encoding.Unicode; EventManager = new EventManager(); TickThread = new CTick(); InputThread = new VInput(); //Starts the input manager thread InputThread.Start(); //Start the ticks trigger thread TickThread.Start(); //Starts a new game CGame.NewGame(); string[] soundFile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), "*.wav"); System.Media.SoundPlayer sp = new System.Media.SoundPlayer(); //Infinite loop for the game while (true) { foreach (string music in soundFile) { Console.WriteLine(music); sp.SoundLocation = music; sp.PlaySync(); } } } } }
using Snake_DesignPatterns.Controllers; using Snake_DesignPatterns.Controllers.Events; using Snake_DesignPatterns.Views; using System; using System.Text; namespace Snake_DesignPatterns { class Snake { public static CTick TickThread; public static EventManager EventManager; public static VInput InputThread; static void Main(string[] args) { Console.OutputEncoding = Encoding.Unicode; EventManager = new EventManager(); TickThread = new CTick(); InputThread = new VInput(); //Starts the input manager thread InputThread.Start(); //Start the ticks trigger thread TickThread.Start(); //Starts a new game CGame.NewGame(); //Infinite loop for the game while (true){} } } }
mit
C#
0681bb9a2b27f063ae0153ca204b25a895334db1
Fix potential nullref
NeoAdonis/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ZLima12/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu-new,2yangk23/osu,smoogipooo/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,johnneijzen/osu
osu.Game/Screens/Edit/Compose/ComposeScreen.cs
osu.Game/Screens/Edit/Compose/ComposeScreen.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Skinning; namespace osu.Game.Screens.Edit.Compose { public class ComposeScreen : EditorScreenWithTimeline { protected override Drawable CreateMainContent() { var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance(); var composer = ruleset?.CreateHitObjectComposer(); if (composer != null) { var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin); // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation // full access to all skin sources. var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider)); // load the skinning hierarchy first. // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources. return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer())); } return new ScreenWhiteBox.UnderConstructionMessage(ruleset == null ? "This beatmap" : $"{ruleset.Description}'s composer"); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Skinning; namespace osu.Game.Screens.Edit.Compose { public class ComposeScreen : EditorScreenWithTimeline { protected override Drawable CreateMainContent() { var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance(); var composer = ruleset?.CreateHitObjectComposer(); if (composer != null) { var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin); // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation // full access to all skin sources. var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider)); // load the skinning hierarchy first. // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources. return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer())); } return new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer"); } } }
mit
C#
910fa09f925711506604465b029d7758a96156d9
make Doors list private, add getter
virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016
Assets/Scripts/RoomDetails.cs
Assets/Scripts/RoomDetails.cs
using System.Collections.Generic; using UnityEngine; public class RoomDetails : MonoBehaviour { public int HorizontalSize; public int VerticalSize; private List<GameObject> Doors; void Start() { int doorIndex = 0; for(int i = 0; i < transform.childCount; i++) { GameObject child = transform.GetChild(i).gameObject; if (child.tag == "door") { Doors.Add(child); child.GetComponent<DoorDetails>().ID = doorIndex; doorIndex++; } } } public List<GameObject> GetDoors() { return Doors; } }
using System.Collections.Generic; using UnityEngine; public class RoomDetails : MonoBehaviour { public int HorizontalSize; public int VerticalSize; public List<GameObject> Doors; void Start() { int doorIndex = 0; for(int i = 0; i < transform.childCount; i++) { GameObject child = transform.GetChild(i).gameObject; if (child.tag == "door") { Doors.Add(child); child.GetComponent<DoorDetails>().ID = doorIndex; doorIndex++; } } } }
mit
C#
2ceab1dc56cef75983b4c3f8b741d601702531f4
throw exception on null argument of IReadOnlyList<T>.FirstOrDefault()
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Agent/Extensions/ReadOnlyListExtensions.cs
src/FilterLists.Agent/Extensions/ReadOnlyListExtensions.cs
using System; using System.Collections.Generic; namespace FilterLists.Agent.Extensions { public static class ReadOnlyListExtensions { public static T FirstOrDefault<T>(this IReadOnlyList<T> list) { if (list is null) throw new ArgumentNullException(nameof(list)); return list.Count == 0 ? default : list[0]; } } }
using System.Collections.Generic; namespace FilterLists.Agent.Extensions { public static class ReadOnlyListExtensions { public static T FirstOrDefault<T>(this IReadOnlyList<T> list) { if (list is null || list.Count == 0) return default; return list[0]; } } }
mit
C#
e1300a9bf52c579d9da7a4436d7cb70dc8901c68
fix model description in ProjectPreview
fachexot/AMOS-SoftwareForge,fachexot/AMOS-SoftwareForge
SoftwareForge.Mvc/SoftwareForge.Mvc/Views/Shared/ProjectPreviewPartial.cshtml
SoftwareForge.Mvc/SoftwareForge.Mvc/Views/Shared/ProjectPreviewPartial.cshtml
<!-- - Copyright (c) 2013 by Denis Bach, Marvin Kampf, Konstantin Tsysin, Taner Tunc, Florian Wittmann - - This file is part of the Software Forge Overlay rating application. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. --> @using SoftwareForge.Common.Models @model Project @{ string shortDescription; if (Model.Description!=null && Model.Description.Length > 100) { shortDescription = Model.Description.Substring(0, 100) + " [...]"; } else { shortDescription = Model.Description; } } <span class="project"> <b>@Html.ActionLink(@Model.Name,"ProjectDetailsPage","TeamProjects",new {guid=Model.Guid},null)</b><br/> @shortDescription<br/> <i>@Model.ProjectType</i><br/> </span>
<!-- - Copyright (c) 2013 by Denis Bach, Marvin Kampf, Konstantin Tsysin, Taner Tunc, Florian Wittmann - - This file is part of the Software Forge Overlay rating application. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/>. --> @using SoftwareForge.Common.Models @model Project @{ string shortDescription; if (Model.Description.Length > 100) { shortDescription = Model.Description.Substring(0, 100) + " [...]"; } else { shortDescription = Model.Description; } } <span class="project"> <b>@Html.ActionLink(@Model.Name,"ProjectDetailsPage","TeamProjects",new {guid=Model.Guid},null)</b><br/> @shortDescription<br/> <i>@Model.ProjectType</i><br/> </span>
agpl-3.0
C#
b7d33e356743170e5c3cb0d9b576832990a28b7d
Resolve build warnings
jmelosegui/pinvoke,AArnott/pinvoke,vbfox/pinvoke
src/NetApi32.Desktop/NetApi32+NetUserEnumLevel.cs
src/NetApi32.Desktop/NetApi32+NetUserEnumLevel.cs
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. namespace PInvoke { /// <content> /// Contains the <see cref="NetUserEnumLevel"/> nested type. /// </content> public partial class NetApi32 { /// <summary> /// Allowed values for the level parameter of the <see cref="NetUserEnum(string, NetUserEnumLevel, NetUserEnumFilter, byte*, uint, out uint, out uint, ref uint)"/> function. /// </summary> public enum NetUserEnumLevel : uint { /// <summary> /// Return user account names. The bufptr parameter points to an array of <see cref="USER_INFO_0"/> structures. /// </summary> Level_0 = 0, /// <summary> /// Return detailed information about user accounts. The bufptr parameter points to an array of <see cref="USER_INFO_1"/> structures. /// </summary> Level_1 = 1, /// <summary> /// Return detailed information about user accounts, including authorization levels and logon information. The bufptr parameter points to an array of USER_INFO_2 structures. /// </summary> Level_2 = 2, /// <summary> /// Return detailed information about user accounts, including authorization levels, logon information, RIDs for the user and the primary group, and profile information. The bufptr parameter points to an array of USER_INFO_3 structures. /// </summary> Level_3 = 3, /// <summary> /// Return user and account names and comments. The bufptr parameter points to an array of USER_INFO_10 structures. /// </summary> Level_10 = 10, /// <summary> /// Return detailed information about user accounts. The bufptr parameter points to an array of USER_INFO_11 structures. /// </summary> Level_11 = 11, /// <summary> /// Return the user's name and identifier and various account attributes. The bufptr parameter points to an array of USER_INFO_20 structures. Note that on Windows XP and later, it is recommended that you use USER_INFO_23 instead. /// </summary> Level_20 = 20, } } }
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. namespace PInvoke { /// <content> /// Contains the <see cref="NetUserEnumLevel"/> nested type. /// </content> public partial class NetApi32 { /// <summary> /// Allowed values for the level parameter of the <see cref="NetUserEnum(string, NetUserEnumLevel, NetUserEnumFilter, byte*, uint, out uint, out uint, ref uint)"/> function. /// </summary> public enum NetUserEnumLevel : uint { /// <summary> /// Return user account names. The bufptr parameter points to an array of <see cref="USER_INFO_0"/> structures. /// </summary> Level_0 = 0, /// <summary> /// Return detailed information about user accounts. The bufptr parameter points to an array of <see cref="USER_INFO_1"/> structures. /// </summary> Level_1 = 1, /// <summary> /// Return detailed information about user accounts, including authorization levels and logon information. The bufptr parameter points to an array of <see cref="USER_INFO_2"/> structures. /// </summary> Level_2 = 2, /// <summary> /// Return detailed information about user accounts, including authorization levels, logon information, RIDs for the user and the primary group, and profile information. The bufptr parameter points to an array of <see cref="USER_INFO_3"/> structures. /// </summary> Level_3 = 3, /// <summary> /// Return user and account names and comments. The bufptr parameter points to an array of <see cref="USER_INFO_10"/> structures. /// </summary> Level_10 = 10, /// <summary> /// Return detailed information about user accounts. The bufptr parameter points to an array of <see cref="USER_INFO_11"/> structures. /// </summary> Level_11 = 11, /// <summary> /// Return the user's name and identifier and various account attributes. The bufptr parameter points to an array of <see cref="USER_INFO_20"/> structures. Note that on Windows XP and later, it is recommended that you use <see cref="USER_INFO_23"/> instead. /// </summary> Level_20 = 20, } } }
mit
C#
e1160b7a5b2c84448d7dc5400e459469a6437e5d
Update src/OnPremise/WebSite/Views/Shared/SignOut.cshtml
rfavillejr/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,rfavillejr/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,kjnilsson/Thinktecture.IdentityServer.v2,kjnilsson/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,kjnilsson/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2
src/OnPremise/WebSite/Views/Shared/SignOut.cshtml
src/OnPremise/WebSite/Views/Shared/SignOut.cshtml
@model IEnumerable<string> @{ ViewBag.Title = "Sign Out"; ViewBag.HideMenu = true; } <h2>Sign Out</h2> @if (!string.IsNullOrWhiteSpace(ViewBag.ReturnUrl)) { <p> <a href='@ViewBag.ReturnUrl'>Return to application</a> </p> } @foreach (var link in Model) { <iframe style="visibility: hidden; width: 1px; height: 1px" src="@link?wa=wsignoutcleanup1.0"></iframe> }
@model IEnumerable<string> @{ ViewBag.Title = "Sign Out"; ViewBag.HideMenu = true; } <h2>Sign Out</h2> @if (!string.IsNullOrWhiteSpace(ViewBag.ReturnUrl)) { <p> <a href='@ViewBag.ReturnUrl'>Return to application</a> </p> } @foreach (var link in Model) { <iframe style="visibility: hidden; width: 1px; height: 1px" src="@link?wa=wsignoutcleanup1.0" /> }
bsd-3-clause
C#
4214dabcd2220360735b637d5a44d6c348734bc7
Simplify GetTabForItem
jcmoyer/Yeena
Yeena/PathOfExile/PoEStash.cs
Yeena/PathOfExile/PoEStash.cs
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections; using System.Collections.Generic; using System.Linq; namespace Yeena.PathOfExile { class PoEStash : IReadOnlyList<PoEStashTab> { private readonly List<PoEStashTab> _tabs; public PoEStash(IEnumerable<PoEStashTab> tabs) { _tabs = new List<PoEStashTab>(tabs); } public IReadOnlyList<PoEStashTab> Tabs { get { return _tabs; } } public PoEStashTab GetTabForItem(PoEItem item) { return _tabs.FirstOrDefault(t => t.Any(i => i == item)); } public IEnumerator<PoEStashTab> GetEnumerator() { return Tabs.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public int Count { get { return Tabs.Count; } } public PoEStashTab this[int index] { get { return Tabs[index]; } } } }
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections; using System.Collections.Generic; namespace Yeena.PathOfExile { class PoEStash : IReadOnlyList<PoEStashTab> { private readonly List<PoEStashTab> _tabs; public PoEStash(IEnumerable<PoEStashTab> tabs) { _tabs = new List<PoEStashTab>(tabs); } public IReadOnlyList<PoEStashTab> Tabs { get { return _tabs; } } public PoEStashTab GetTabForItem(PoEItem item) { foreach (var tab in _tabs) { foreach (var tabItem in tab) { if (item == tabItem) return tab; } } return null; } public IEnumerator<PoEStashTab> GetEnumerator() { return Tabs.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public int Count { get { return Tabs.Count; } } public PoEStashTab this[int index] { get { return Tabs[index]; } } } }
apache-2.0
C#
8c0ec1a3e0c7915306dcb47925168b017a035668
Update todo sample for latest metadata changes
x335/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,nikhilk/scriptsharp
samples/Todo/Todo/TodoItem.cs
samples/Todo/Todo/TodoItem.cs
// TodoItem.cs // using System; using System.Runtime.CompilerServices; namespace Todo { [ScriptImport] [ScriptIgnoreNamespace] [ScriptName("Object")] internal sealed class TodoItem { public bool Completed; [ScriptName("id")] public string ID; public string Title; } }
// TodoItem.cs // using System; using System.Runtime.CompilerServices; namespace Todo { [Imported] [IgnoreNamespace] [ScriptName("Object")] internal sealed class TodoItem { public bool Completed; [ScriptName("id")] public string ID; public string Title; } }
apache-2.0
C#
cce70432e09524cb8e9500bdc4d72c0f0494c733
Add constant for install page url
mperdeck/jsnlog
jsnlog/Infrastructure/SiteConstants.cs
jsnlog/Infrastructure/SiteConstants.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebSite.App_Code { // Copied from web site project. //TODO: move web site project to jsnlog solution, have only one copy of this file public static class SiteConstants { public static string CurrentVersion = Generated.Version; public static string CurrentFrameworkVersion = Generated.FrameworkVersion; public static string CurrentJSNLogJsVersion = Generated.JSNLogJsVersion; public const string JsnlogJsFileSize = "2kb"; public const string HttpHeaderRequestIdName = "JSNLog-RequestId"; public const string GlobalMethodCalledAfterJsnlogJsLoaded = "__jsnlog_configure"; public const string HandlerExtension = ".logger"; public const string DefaultDefaultAjaxUrl = "/jsnlog" + HandlerExtension; public const string DemoAspNetCoreGithubUrl = "https://github.com/mperdeck/jsnlogSimpleWorkingDemos/tree/master/jsnlogSimpleWorkingDemos/JSNLogDemo_Core_NetCoreApp2"; public const string DemoGithubUrl = "https://github.com/mperdeck/jsnlogSimpleWorkingDemos/tree/master/jsnlogSimpleWorkingDemos"; public const string AngularJsDemoGithubUrl = "https://github.com/mperdeck/JSNLog.AngularJS"; public const string Angular2CoreDemoGithubUrl = "https://github.com/mperdeck/jsnlog.AngularCoreDemo"; public const string LicenceUrl = "https://github.com/mperdeck/jsnlog/blob/master/LICENSE.md"; public const string LicenceName = "MIT"; public const string CdnJsUrl = "https://cdnjs.com/libraries/jsnlog"; public static string CdnJsDownloadUrl = "https://cdnjs.cloudflare.com/ajax/libs/jsnlog/" + CurrentJSNLogJsVersion + "/jsnlog.min.js"; public static string CdnJsScriptTag = @"<script crossorigin=""anonymous"" src=""" + CdnJsDownloadUrl + @"""></script>"; public const string JsnlogHost = "https://jsnlog.com"; public const string InstallPageUrl = JsnlogHost + "/Documentation/DownloadInstall"; // This causes NuGet to search for all packages with "JSNLog" - so the user will see // JSNLog.NLog, etc. as well. public const string NugetDownloadUrl = "https://www.nuget.org/packages?q=jsnlog"; public static string CurrentYear { get { return DateTime.Now.ToString("yyyy"); } } public static string DownloadLinkJsnlogJs { get { return "https://raw.githubusercontent.com/mperdeck/jsnlog.js/master/jsnlog.min.js"; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebSite.App_Code { // Copied from web site project. //TODO: move web site project to jsnlog solution, have only one copy of this file public static class SiteConstants { public static string CurrentVersion = Generated.Version; public static string CurrentFrameworkVersion = Generated.FrameworkVersion; public static string CurrentJSNLogJsVersion = Generated.JSNLogJsVersion; public const string JsnlogJsFileSize = "2kb"; public const string HttpHeaderRequestIdName = "JSNLog-RequestId"; public const string GlobalMethodCalledAfterJsnlogJsLoaded = "__jsnlog_configure"; public const string HandlerExtension = ".logger"; public const string DefaultDefaultAjaxUrl = "/jsnlog" + HandlerExtension; public const string DemoAspNetCoreGithubUrl = "https://github.com/mperdeck/jsnlogSimpleWorkingDemos/tree/master/jsnlogSimpleWorkingDemos/JSNLogDemo_Core_NetCoreApp2"; public const string DemoGithubUrl = "https://github.com/mperdeck/jsnlogSimpleWorkingDemos/tree/master/jsnlogSimpleWorkingDemos"; public const string AngularJsDemoGithubUrl = "https://github.com/mperdeck/JSNLog.AngularJS"; public const string Angular2CoreDemoGithubUrl = "https://github.com/mperdeck/jsnlog.AngularCoreDemo"; public const string LicenceUrl = "https://github.com/mperdeck/jsnlog/blob/master/LICENSE.md"; public const string LicenceName = "MIT"; public const string CdnJsUrl = "https://cdnjs.com/libraries/jsnlog"; public static string CdnJsDownloadUrl = "https://cdnjs.cloudflare.com/ajax/libs/jsnlog/" + CurrentJSNLogJsVersion + "/jsnlog.min.js"; public static string CdnJsScriptTag = @"<script crossorigin=""anonymous"" src=""" + CdnJsDownloadUrl + @"""></script>"; // This causes NuGet to search for all packages with "JSNLog" - so the user will see // JSNLog.NLog, etc. as well. public const string NugetDownloadUrl = "https://www.nuget.org/packages?q=jsnlog"; public static string CurrentYear { get { return DateTime.Now.ToString("yyyy"); } } public static string DownloadLinkJsnlogJs { get { return "https://raw.githubusercontent.com/mperdeck/jsnlog.js/master/jsnlog.min.js"; } } } }
mit
C#
71397d156ff0492858b4a6391d4705bd4dba382b
update Version string to "v0.5"
yasokada/unity-150908-udpTimeGraph
Assets/AppInfo.cs
Assets/AppInfo.cs
using UnityEngine; using System.Collections; /* * v0.5 2015/09/11 * - display ymin and ymax on the left of the panel (graphScale) * v0.4 2015/09/10 * - can handle set,yrange command */ namespace NS_appInfo // NS stands for NameSpace { public static class AppInfo { public const string Version = "v0.5"; public const string Name = "udpTimeGraph"; } }
using UnityEngine; using System.Collections; /* * v0.5 2015/09/11 * - display ymin and ymax on the left of the panel (graphScale) * v0.4 2015/09/10 * - can handle set,yrange command */ namespace NS_appInfo // NS stands for NameSpace { public static class AppInfo { public const string Version = "v0.4"; public const string Name = "udpTimeGraph"; } }
mit
C#
dbed31bc00f43f41bb45f0e41e697c692595e122
fix Projection
carbon/Amazon
src/Amazon.DynamoDb/Models/Projection.cs
src/Amazon.DynamoDb/Models/Projection.cs
#nullable disable using Amazon.DynamoDb.Extensions; using Carbon.Json; using System.Text.Json; namespace Amazon.DynamoDb { public class Projection { public Projection() { } public Projection(string[] nonKeyAttributes, ProjectionType type) { NonKeyAttributes = nonKeyAttributes ?? new string[0]; ProjectionType = type; } public string[] NonKeyAttributes { get; set; } public ProjectionType ProjectionType { get; set; } public JsonObject ToJson() { var json = new JsonObject { { "ProjectionType", ProjectionType.ToQuickString() } }; if (NonKeyAttributes != null && NonKeyAttributes.Length > 0) json.Add("NonKeyAttributes", new XImmutableArray<string>(NonKeyAttributes)); return json; } public static Projection FromJsonElement(JsonElement element) { var projection = new Projection(); foreach (var prop in element.EnumerateObject()) { if (prop.NameEquals("NonKeyAttributes")) projection.NonKeyAttributes = prop.Value.GetStringArray(); else if (prop.NameEquals("ProjectionType")) projection.ProjectionType = prop.Value.GetEnum<ProjectionType>(); } return projection; } } }
#nullable disable using Amazon.DynamoDb.Extensions; using Carbon.Json; using System.Text.Json; namespace Amazon.DynamoDb { public class Projection { public Projection() { } public Projection(string[] nonKeyAttributes, ProjectionType type) { NonKeyAttributes = nonKeyAttributes ?? new string[0]; ProjectionType = type; } public string[] NonKeyAttributes { get; set; } public ProjectionType ProjectionType { get; set; } public JsonObject ToJson() { return new JsonObject { { "NonKeyAttributes", new XImmutableArray<string>(NonKeyAttributes) }, { "ProjectionType", ProjectionType.ToQuickString() } }; } public static Projection FromJsonElement(JsonElement element) { var projection = new Projection(); foreach (var prop in element.EnumerateObject()) { if (prop.NameEquals("NonKeyAttributes")) projection.NonKeyAttributes = prop.Value.GetStringArray(); else if (prop.NameEquals("ProjectionType")) projection.ProjectionType = prop.Value.GetEnum<ProjectionType>(); } return projection; } } }
mit
C#
e93c13496f5e920569404ede102f4608d3cf6db5
Use a more compatible method call
bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity
src/BugsnagUnity/DictionaryExtensions.cs
src/BugsnagUnity/DictionaryExtensions.cs
using System; using System.Collections.Generic; using BugsnagUnity.Payload; using UnityEngine; namespace BugsnagUnity { static class DictionaryExtensions { private static IntPtr Arrays { get; } = AndroidJNI.FindClass("java/util/Arrays"); private static IntPtr ToStringMethod { get; } = AndroidJNIHelper.GetMethodID(Arrays, "toString", "([Ljava/lang/Object;)Ljava/lang/String;", true); internal static void PopulateDictionaryFromAndroidData(this IDictionary<string, object> dictionary, AndroidJavaObject source) { using (var set = source.Call<AndroidJavaObject>("entrySet")) using (var iterator = set.Call<AndroidJavaObject>("iterator")) { while (iterator.Call<bool>("hasNext")) { using (var mapEntry = iterator.Call<AndroidJavaObject>("next")) { var key = mapEntry.Call<string>("getKey"); using (var value = mapEntry.Call<AndroidJavaObject>("getValue")) { if (value != null) { using (var @class = value.Call<AndroidJavaObject>("getClass")) { if (@class.Call<bool>("isArray")) { var args = AndroidJNIHelper.CreateJNIArgArray(new[] {value}); var formattedValue = AndroidJNI.CallStaticStringMethod(Arrays, ToStringMethod, args); dictionary.AddToPayload(key, formattedValue); } else { dictionary.AddToPayload(key, value.Call<string>("toString")); } } } } } } } } } }
using System.Collections.Generic; using BugsnagUnity.Payload; using UnityEngine; namespace BugsnagUnity { static class DictionaryExtensions { internal static void PopulateDictionaryFromAndroidData(this IDictionary<string, object> dictionary, AndroidJavaObject source) { using (var set = source.Call<AndroidJavaObject>("entrySet")) using (var iterator = set.Call<AndroidJavaObject>("iterator")) { while (iterator.Call<bool>("hasNext")) { using (var mapEntry = iterator.Call<AndroidJavaObject>("next")) { var key = mapEntry.Call<string>("getKey"); using (var value = mapEntry.Call<AndroidJavaObject>("getValue")) { if (value != null) { using (var @class = value.Call<AndroidJavaObject>("getClass")) { if (@class.Call<bool>("isArray")) { using (var arrays = new AndroidJavaClass("java.util.Arrays")) { dictionary.AddToPayload(key, arrays.CallStatic<string>("toString", value)); } } else { dictionary.AddToPayload(key, value.Call<string>("toString")); } } } } } } } } } }
mit
C#
bbf260bcfcb183f96c126478b0fb4655b0468808
Add properties to patch creator button
Sitecore/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager
src/SIM.Tool.Windows/MainWindowComponents/CreateSupportPatchButton.cs
src/SIM.Tool.Windows/MainWindowComponents/CreateSupportPatchButton.cs
namespace SIM.Tool.Windows.MainWindowComponents { using System; using System.IO; using System.Windows; using Sitecore.Diagnostics.Base; using JetBrains.Annotations; using SIM.Core; using SIM.Instances; using SIM.Tool.Base; using SIM.Tool.Base.Plugins; [UsedImplicitly] public class CreateSupportPatchButton : IMainWindowButton { #region Public methods private string AppArgsFilePath { get; } private string AppUrl { get; } public CreateSupportPatchButton(string appArgsFilePath, string appUrl) { AppArgsFilePath = appArgsFilePath; AppUrl = appUrl; } public bool IsEnabled(Window mainWindow, Instance instance) { return true; } public void OnClick(Window mainWindow, Instance instance) { if (instance == null) { WindowHelper.ShowMessage("Choose an instance first"); return; } var product = instance.Product; Assert.IsNotNull(product, $"The {instance.ProductFullName} distributive is not available in local repository. You need to get it first."); var version = product.Version + "." + product.Update; var args = new[] { version, instance.Name, instance.WebRootPath }; var dir = Environment.ExpandEnvironmentVariables(AppArgsFilePath); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } File.WriteAllLines(Path.Combine(dir, "args.txt"), args); CoreApp.RunApp("iexplore", AppUrl); } #endregion } }
namespace SIM.Tool.Windows.MainWindowComponents { using System; using System.IO; using System.Windows; using Sitecore.Diagnostics.Base; using JetBrains.Annotations; using SIM.Core; using SIM.Instances; using SIM.Tool.Base; using SIM.Tool.Base.Plugins; [UsedImplicitly] public class CreateSupportPatchButton : IMainWindowButton { #region Public methods public bool IsEnabled(Window mainWindow, Instance instance) { return true; } public void OnClick(Window mainWindow, Instance instance) { if (instance == null) { WindowHelper.ShowMessage("Choose an instance first"); return; } var product = instance.Product; Assert.IsNotNull(product, $"The {instance.ProductFullName} distributive is not available in local repository. You need to get it first."); var version = product.Version + "." + product.Update; var args = new[] { version, instance.Name, instance.WebRootPath }; var dir = Environment.ExpandEnvironmentVariables("%APPDATA%\\Sitecore\\PatchCreator"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } File.WriteAllLines(Path.Combine(dir, "args.txt"), args); CoreApp.RunApp("iexplore", $"http://dl.sitecore.net/updater/pc/PatchCreator.application"); } #endregion } }
mit
C#
2999b51968aa2285b05c043679ea61459a911431
Bump version to 0.9
jamesfoster/DeepEqual
src/DeepEqual/Properties/AssemblyInfo.cs
src/DeepEqual/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("DeepEqual")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeepEqual")] [assembly: AssemblyCopyright("Copyright © 2013")] [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("2db8921a-dc9f-4b4a-b651-cd71eac66b39")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.0.0")] [assembly: AssemblyFileVersion("0.9.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DeepEqual")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeepEqual")] [assembly: AssemblyCopyright("Copyright © 2013")] [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("2db8921a-dc9f-4b4a-b651-cd71eac66b39")] // 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.8.0.0")] [assembly: AssemblyFileVersion("0.8.0.0")]
mit
C#
264b79d1a58b1d23269a3415011c8f0ba0cefbfa
Update ConvertHeader.cs
SimonCropp/NServiceBus.Serilog
src/NServiceBus.Serilog/ConvertHeader.cs
src/NServiceBus.Serilog/ConvertHeader.cs
using Serilog.Events; /// <summary> /// Used to support writing a custom log property for a specific header. /// </summary> public delegate LogEventProperty? ConvertHeader(string key, string value);
using Serilog.Events; public delegate LogEventProperty? ConvertHeader(string key, string value);
mit
C#
b8ef5db9d3734e84e599442c3be63df5b21ba209
Refactor MineCell
HQC-Team-Minesweeper-5/Minesweeper
src/Minesweeper.Logic/MineCell.cs
src/Minesweeper.Logic/MineCell.cs
namespace Minesweeper.Logic { using System; using Minesweeper.Logic.Enumerations; public class MineCell : ICloneable { private int value; private bool isMine; private FieldStatus status; public MineCell() { this.value = 0; this.status = FieldStatus.Closed; } public int Value { get; set; } public FieldStatus Status { get; set; } public bool IsMine { get; set; } public object Clone() { return this.MemberwiseClone() as MineCell; } } }
namespace Minesweeper.Logic { using System; using Minesweeper.Logic.Enumerations; public class MineCell : ICloneable { private int value; private bool isMine; private FieldStatus status; public MineCell() { this.value = 0; this.status = FieldStatus.Closed; } public int Value { get { return this.value; } set { this.value = value; } } public FieldStatus Status { get { return this.status; } set { this.status = value; } } public bool IsMine { get { return this.isMine; } set { this.isMine = value; } } public object Clone() { return this.MemberwiseClone() as MineCell; } } }
mit
C#
98eee9dffff67e0c23f497a70cd6794e833bd39e
Clean up RequestData
arthot/xsp,arthot/xsp,murador/xsp,stormleoxia/xsp,arthot/xsp,stormleoxia/xsp,arthot/xsp,murador/xsp,stormleoxia/xsp,murador/xsp,murador/xsp,stormleoxia/xsp
src/Mono.WebServer/RequestData.cs
src/Mono.WebServer/RequestData.cs
// // Mono.WebServer.RequestData // // Authors: // Gonzalo Paniagua Javier ([email protected]) // // (C) 2003 Ximian, Inc (http://www.ximian.com) // (C) Copyright 2004-2010 Novell, Inc // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Text; namespace Mono.WebServer { public class RequestData { public string Verb; public string Path; public string PathInfo; public string QueryString; public string Protocol; public byte [] InputBuffer; public RequestData (string verb, string path, string queryString, string protocol) { Verb = verb; Path = path; QueryString = queryString; Protocol = protocol; } public override string ToString () { var sb = new StringBuilder (); sb.AppendFormat ("Verb: {0}\n", Verb); sb.AppendFormat ("Path: {0}\n", Path); sb.AppendFormat ("PathInfo: {0}\n", PathInfo); sb.AppendFormat ("QueryString: {0}\n", QueryString); return sb.ToString (); } } }
// // Mono.WebServer.RequestData // // Authors: // Gonzalo Paniagua Javier ([email protected]) // // (C) 2003 Ximian, Inc (http://www.ximian.com) // (C) Copyright 2004-2010 Novell, Inc // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Configuration; using System.IO; using System.Net; using System.Net.Sockets; using System.Text; using System.Web; namespace Mono.WebServer { public class RequestData { public string Verb; public string Path; public string PathInfo; public string QueryString; public string Protocol; public byte [] InputBuffer; public RequestData (string verb, string path, string queryString, string protocol) { this.Verb = verb; this.Path = path; this.QueryString = queryString; this.Protocol = protocol; } public override string ToString () { StringBuilder sb = new StringBuilder (); sb.AppendFormat ("Verb: {0}\n", Verb); sb.AppendFormat ("Path: {0}\n", Path); sb.AppendFormat ("PathInfo: {0}\n", PathInfo); sb.AppendFormat ("QueryString: {0}\n", QueryString); return sb.ToString (); } } }
mit
C#
ba255b7056b4f4d76ec7d32a3375bb44ea700ff9
Set default build target to build.
Faithlife/System.Data.SQLite,Faithlife/Parsing,ejball/ArgsReading,Faithlife/FaithlifeUtility,ejball/XmlDocMarkdown,Faithlife/System.Data.SQLite
tools/Build/Build.cs
tools/Build/Build.cs
using System; using Faithlife.Build; internal static class Build { public static int Main(string[] args) => BuildRunner.Execute(args, build => { build.AddDotNetTargets( new DotNetBuildSettings { DocsSettings = new DotNetDocsSettings { GitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""), GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "[email protected]"), SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src", }, }); build.Target("default") .DependsOn("build"); }); }
using System; using Faithlife.Build; internal static class Build { public static int Main(string[] args) => BuildRunner.Execute(args, build => { build.AddDotNetTargets( new DotNetBuildSettings { DocsSettings = new DotNetDocsSettings { GitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""), GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "[email protected]"), SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src", }, }); }); }
mit
C#
ce7929b3577973f8ab6d926d7c8048bd24d79aa5
Add ApiAccessToken to System object
stoiveyp/alexa-skills-dotnet,timheuer/alexa-skills-dotnet
Alexa.NET/Request/System.cs
Alexa.NET/Request/System.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Alexa.NET.Request { public class AlexaSystem { [JsonProperty("apiAccessToken")] public string ApiAccessToken { get; set; } [JsonProperty("apiEndpoint")] public string ApiEndpoint { get; set; } [JsonProperty("application")] public Application Application { get; set; } [JsonProperty("user")] public User User { get; set; } [JsonProperty("device")] public Device Device { get; set; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Alexa.NET.Request { public class AlexaSystem { [JsonProperty("apiEndpoint")] public string ApiEndpoint { get; set; } [JsonProperty("application")] public Application Application { get; set; } [JsonProperty("user")] public User User { get; set; } [JsonProperty("device")] public Device Device { get; set; } } }
mit
C#
0b0b5fe4164872032c4d38962abe3cf5af02530d
Support implicit conversions for Optional<T>
ethanmoffat/EndlessClient
EOLib/Optional.cs
EOLib/Optional.cs
// Original Work Copyright (c) Ethan Moffat 2014-2016 // This file is subject to the GPL v2 License // For additional details, see the LICENSE file namespace EOLib { public class Optional<T> { public T Value { get; private set; } public bool HasValue { get; private set; } public Optional() { Value = default(T); HasValue = false; } public Optional(T value) { Value = value; HasValue = true; } public static implicit operator Optional<T>(T value) { return new Optional<T>(value); } public static implicit operator T(Optional<T> optional) { return optional.Value; } } }
// Original Work Copyright (c) Ethan Moffat 2014-2016 // This file is subject to the GPL v2 License // For additional details, see the LICENSE file namespace EOLib { public class Optional<T> { public T Value { get; private set; } public bool HasValue { get; private set; } public Optional() { Value = default(T); HasValue = false; } public Optional(T value) { Value = value; HasValue = true; } } }
mit
C#
e56abef5c40695162e410da0ab24d6e39d6fb9c8
Fix result checker if no subscriber errors in response
alwynlombaard/ExactTarget-triggered-email-sender
ExactTarget.TriggeredEmail/Core/ExactTargetResultChecker.cs
ExactTarget.TriggeredEmail/Core/ExactTargetResultChecker.cs
using System; using System.Linq; using ExactTarget.TriggeredEmail.ExactTargetApi; namespace ExactTarget.TriggeredEmail.Core { public class ExactTargetResultChecker { public static void CheckResult(Result result) { if (result == null) { throw new Exception("Received an unexpected null result from ExactTarget"); } if (result.StatusCode.Equals("OK", StringComparison.InvariantCultureIgnoreCase)) { return; } var triggeredResult = result as TriggeredSendCreateResult; var subscriberFailures = triggeredResult == null || triggeredResult.SubscriberFailures == null ? Enumerable.Empty<string>() : triggeredResult.SubscriberFailures.Select(f => " ErrorCode:" + f.ErrorCode + " ErrorDescription:" + f.ErrorDescription); throw new Exception(string.Format("ExactTarget response indicates failure. StatusCode:{0} StatusMessage:{1} SubscriberFailures:{2}", result.StatusCode, result.StatusMessage, string.Join("|", subscriberFailures))); } } }
using System; using System.Linq; using ExactTarget.TriggeredEmail.ExactTargetApi; namespace ExactTarget.TriggeredEmail.Core { public class ExactTargetResultChecker { public static void CheckResult(Result result) { if (result == null) { throw new Exception("Received an unexpected null result from ExactTarget"); } if (result.StatusCode.Equals("OK", StringComparison.InvariantCultureIgnoreCase)) { return; } var triggeredResult = result as TriggeredSendCreateResult; var subscriberFailures = triggeredResult == null ? Enumerable.Empty<string>() : triggeredResult.SubscriberFailures.Select(f => " ErrorCode:" + f.ErrorCode + " ErrorDescription:" + f.ErrorDescription); throw new Exception(string.Format("ExactTarget response indicates failure. StatusCode:{0} StatusMessage:{1} SubscriberFailures:{2}", result.StatusCode, result.StatusMessage, string.Join("|", subscriberFailures))); } } }
mit
C#
580332b0251393b2ee4fe56ec536d37863c627b6
Fix typo in comments.
googleprojectzero/sandbox-attacksurface-analysis-tools
NtApiDotNet/Win32/DirectoryService/DirectoryServiceUtils.cs
NtApiDotNet/Win32/DirectoryService/DirectoryServiceUtils.cs
// Copyright 2020 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace NtApiDotNet.Win32.DirectoryService { /// <summary> /// Class implementing various utilities for directory services. /// </summary> public static class DirectoryServiceUtils { /// <summary> /// Get the generic mapping for directory services. /// </summary> /// <returns>The directory services generic mapping.</returns> public static GenericMapping GenericMapping { get { GenericMapping mapping = new GenericMapping { GenericRead = DirectoryServiceAccessRights.ReadProp | DirectoryServiceAccessRights.List | DirectoryServiceAccessRights.ListObject, GenericWrite = DirectoryServiceAccessRights.Self | DirectoryServiceAccessRights.WriteProp, GenericExecute = DirectoryServiceAccessRights.List, GenericAll = DirectoryServiceAccessRights.All }; return mapping; } } /// <summary> /// Get a fake NtType for Directory Services. /// </summary> /// <returns>The fake Directory Services NtType</returns> public static NtType NtType => new NtType("DirectoryService", GenericMapping, typeof(DirectoryServiceAccessRights), typeof(DirectoryServiceAccessRights), MandatoryLabelPolicy.NoWriteUp); } }
// Copyright 2020 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace NtApiDotNet.Win32.DirectoryService { /// <summary> /// Class implementing various utilities for directory services. /// </summary> public static class DirectoryServiceUtils { /// <summary> /// Get the generic mapping for a service. /// </summary> /// <returns>The service generic mapping.</returns> public static GenericMapping GenericMapping { get { GenericMapping mapping = new GenericMapping { GenericRead = DirectoryServiceAccessRights.ReadProp | DirectoryServiceAccessRights.List | DirectoryServiceAccessRights.ListObject, GenericWrite = DirectoryServiceAccessRights.Self | DirectoryServiceAccessRights.WriteProp, GenericExecute = DirectoryServiceAccessRights.List, GenericAll = DirectoryServiceAccessRights.All }; return mapping; } } /// <summary> /// Get a fake NtType for Directory Services. /// </summary> /// <returns>The fake Directory Services NtType</returns> public static NtType NtType => new NtType("DirectoryService", GenericMapping, typeof(DirectoryServiceAccessRights), typeof(DirectoryServiceAccessRights), MandatoryLabelPolicy.NoWriteUp); } }
apache-2.0
C#
91f3d8deb44b425d632cf0299fd4087f15e5f9c0
Improve class xmldoc
EVAST9919/osu,peppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,Drezi126/osu,peppy/osu-new,smoogipooo/osu,Frontear/osuKyzer,NeoAdonis/osu,NeoAdonis/osu,DrabWeb/osu,DrabWeb/osu,smoogipoo/osu,Damnae/osu,Nabile-Rahmani/osu,EVAST9919/osu,NeoAdonis/osu,ZLima12/osu,DrabWeb/osu,naoey/osu,ZLima12/osu,2yangk23/osu,johnneijzen/osu,naoey/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,naoey/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu
osu.Game/Graphics/Containers/ConstrainedIconContainer.cs
osu.Game/Graphics/Containers/ConstrainedIconContainer.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; namespace osu.Game.Graphics.Containers { /// <summary> /// Display an icon that is forced to scale to the size of this container. /// </summary> public class ConstrainedIconContainer : CompositeDrawable { public Drawable Icon { get { return InternalChild; } set { InternalChild = value; } } /// <summary> /// Determines an edge effect of this <see cref="Container"/>. /// Edge effects are e.g. glow or a shadow. /// Only has an effect when <see cref="CompositeDrawable.Masking"/> is true. /// </summary> public new EdgeEffectParameters EdgeEffect { get { return base.EdgeEffect; } set { base.EdgeEffect = value; } } protected override void Update() { base.Update(); if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0) { // We're modifying scale here for a few reasons // - Guarantees correctness if BorderWidth is being used // - If we were to use RelativeSize/FillMode, we'd need to set the Icon's RelativeSizeAxes directly. // We can't do this because we would need access to AutoSizeAxes to set it to none. // Other issues come up along the way too, so it's not a good solution. var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y); InternalChild.Scale = new Vector2(fitScale); InternalChild.Anchor = Anchor.Centre; InternalChild.Origin = Anchor.Centre; } } public ConstrainedIconContainer() { Masking = true; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; namespace osu.Game.Graphics.Containers { /// <summary> /// Display an icon that is constrained to a physical region on screen. /// </summary> public class ConstrainedIconContainer : CompositeDrawable { public Drawable Icon { get { return InternalChild; } set { InternalChild = value; } } /// <summary> /// Determines an edge effect of this <see cref="Container"/>. /// Edge effects are e.g. glow or a shadow. /// Only has an effect when <see cref="CompositeDrawable.Masking"/> is true. /// </summary> public new EdgeEffectParameters EdgeEffect { get { return base.EdgeEffect; } set { base.EdgeEffect = value; } } protected override void Update() { base.Update(); if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0) { // We're modifying scale here for a few reasons // - Guarantees correctness if BorderWidth is being used // - If we were to use RelativeSize/FillMode, we'd need to set the Icon's RelativeSizeAxes directly. // We can't do this because we would need access to AutoSizeAxes to set it to none. // Other issues come up along the way too, so it's not a good solution. var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y); InternalChild.Scale = new Vector2(fitScale); InternalChild.Anchor = Anchor.Centre; InternalChild.Origin = Anchor.Centre; } } public ConstrainedIconContainer() { Masking = true; } } }
mit
C#
e69bb67afe6e1ab615319844dfdf6ac3dfccd530
Add `IApplicableToDrawableHitObject` that is taking a single DHO
peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu
osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs
osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mods { /// <summary> /// An interface for <see cref="Mod"/>s that can be applied to <see cref="DrawableHitObject"/>s. /// </summary> public interface IApplicableToDrawableHitObject : IApplicableMod { /// <summary> /// Applies this <see cref="IApplicableToDrawableHitObject"/> to a <see cref="DrawableHitObject"/>. /// This will only be invoked with top-level <see cref="DrawableHitObject"/>s. Access <see cref="DrawableHitObject.NestedHitObjects"/> if adjusting nested objects is necessary. /// </summary> void ApplyToDrawableHitObject(DrawableHitObject drawable); } public interface IApplicableToDrawableHitObjects : IApplicableToDrawableHitObject { void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables); void IApplicableToDrawableHitObject.ApplyToDrawableHitObject(DrawableHitObject drawable) => ApplyToDrawableHitObjects(drawable.Yield()); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mods { /// <summary> /// An interface for <see cref="Mod"/>s that can be applied to <see cref="DrawableHitObject"/>s. /// </summary> public interface IApplicableToDrawableHitObjects : IApplicableMod { /// <summary> /// Applies this <see cref="IApplicableToDrawableHitObjects"/> to a list of <see cref="DrawableHitObject"/>s. /// This will only be invoked with top-level <see cref="DrawableHitObject"/>s. Access <see cref="DrawableHitObject.NestedHitObjects"/> if adjusting nested objects is necessary. /// </summary> /// <param name="drawables">The list of <see cref="DrawableHitObject"/>s to apply to.</param> void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables); } }
mit
C#
9677ac7eac54a66351e5cc10979c4c8a679b507a
Add SingleOrError
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Utilities/Collections/Enumerable.SingleOrDefaultOrError.cs
source/Nuke.Common/Utilities/Collections/Enumerable.SingleOrDefaultOrError.cs
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; namespace Nuke.Common.Utilities.Collections { public static partial class EnumerableExtensions { [CanBeNull] public static T SingleOrDefaultOrError<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate, string message) { try { return enumerable.SingleOrDefault(predicate); } catch (InvalidOperationException ex) { throw new InvalidOperationException(message, ex); } } [CanBeNull] public static T SingleOrDefaultOrError<T>(this IEnumerable<T> enumerable, string message) { try { return enumerable.SingleOrDefault(); } catch (InvalidOperationException ex) { throw new InvalidOperationException(message, ex); } } [CanBeNull] public static T SingleOrError<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate, string message) { try { return enumerable.Single(predicate); } catch (InvalidOperationException ex) { throw new InvalidOperationException(message, ex); } } [CanBeNull] public static T SingleOrError<T>(this IEnumerable<T> enumerable, string message) { try { return enumerable.Single(); } catch (InvalidOperationException ex) { throw new InvalidOperationException(message, ex); } } } }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; namespace Nuke.Common.Utilities.Collections { public static partial class EnumerableExtensions { [CanBeNull] public static T SingleOrDefaultOrError<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate, string message) { try { return enumerable.SingleOrDefault(predicate); } catch (InvalidOperationException ex) { throw new InvalidOperationException(message, ex); } } [CanBeNull] public static T SingleOrDefaultOrError<T>(this IEnumerable<T> enumerable, string message) { try { return enumerable.SingleOrDefault(); } catch (InvalidOperationException ex) { throw new InvalidOperationException(message, ex); } } } }
mit
C#
e906434d1acb9acbae6eea9933ecc98c72b5fbdb
Make HandleRef fields private
gregkalapos/corert,gregkalapos/corert,gregkalapos/corert,gregkalapos/corert
src/System.Private.CoreLib/shared/System/Runtime/InteropServices/HandleRef.cs
src/System.Private.CoreLib/shared/System/Runtime/InteropServices/HandleRef.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. namespace System.Runtime.InteropServices { public struct HandleRef { // ! Do not add or rearrange fields as the EE depends on this layout. //------------------------------------------------------------------ private object _wrapper; private IntPtr _handle; //------------------------------------------------------------------ public HandleRef(object wrapper, IntPtr handle) { _wrapper = wrapper; _handle = handle; } public object Wrapper { get { return _wrapper; } } public IntPtr Handle { get { return _handle; } } public static explicit operator IntPtr(HandleRef value) { return value._handle; } public static IntPtr ToIntPtr(HandleRef value) { return value._handle; } } }
// 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. namespace System.Runtime.InteropServices { public struct HandleRef { // ! Do not add or rearrange fields as the EE depends on this layout. //------------------------------------------------------------------ internal object _wrapper; internal IntPtr _handle; //------------------------------------------------------------------ public HandleRef(object wrapper, IntPtr handle) { _wrapper = wrapper; _handle = handle; } public object Wrapper { get { return _wrapper; } } public IntPtr Handle { get { return _handle; } } public static explicit operator IntPtr(HandleRef value) { return value._handle; } public static IntPtr ToIntPtr(HandleRef value) { return value._handle; } } }
mit
C#
e32721d59f84171058b87a61160ff71254fb0449
remove 3 arg client
grokify/ringcentral-sdk-csharp-simple
RingCentralSimple/Client.cs
RingCentralSimple/Client.cs
using System; using System.Collections.Generic; using RingCentral; using RingCentral.SDK.Http; namespace RingCentralSimple { public class Client { public RingCentral.SDK.SDK Sdk; public Client(RingCentral.SDK.SDK ringCentralSdk) { Sdk = ringCentralSdk; } public Response SendMessage(string from, string to, string text) { RingCentralSimple.Model.Request.SMS srequest = new RingCentralSimple.Model.Request.SMS { from = new RingCentralSimple.Model.Request.Caller { phoneNumber = from }, to = new List<RingCentralSimple.Model.Request.Caller>() { new RingCentralSimple.Model.Request.Caller { phoneNumber = to } }, text = text }; Request request = new Request("/restapi/v1.0/account/~/extension/~/sms", srequest.ToJson()); Response response = Sdk.GetPlatform().Post(request); return response; } } }
using System; using System.Collections.Generic; using RingCentral; using RingCentral.SDK.Http; namespace RingCentralSimple { public class Client { public RingCentral.SDK.SDK Sdk; public Client(string appKey, string appSecret, string serverUrl) { Sdk = new RingCentral.SDK.SDK(appKey, appSecret, serverUrl); } public Client(RingCentral.SDK.SDK ringCentralSdk) { Sdk = ringCentralSdk; } public Response SendMessage(string from, string to, string text) { RingCentralSimple.Model.Request.SMS srequest = new RingCentralSimple.Model.Request.SMS { from = new RingCentralSimple.Model.Request.Caller { phoneNumber = from }, to = new List<RingCentralSimple.Model.Request.Caller>() { new RingCentralSimple.Model.Request.Caller { phoneNumber = to } }, text = text }; Request request = new Request("/restapi/v1.0/account/~/extension/~/sms", srequest.ToJson()); Response response = Sdk.GetPlatform().Post(request); return response; } } }
mit
C#
f0b4364a6fed765f1e5f099f1cd9ce91317eeaff
Remove Maps pb Network
webSportENIProject/webSport,webSportENIProject/webSport
WUI/Views/Home/Index.cshtml
WUI/Views/Home/Index.cshtml
@{ ViewBag.Title = "Page d'accueil"; } @section css{ <!-- <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />--> } Bienvenue sur le site du marathon <div id="map"></div> <div id="mapid"></div> @section scripts{ <!-- <script type="text/javascript"> var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: 47.21806, lng: -1.55278}, zoom: 8 }); } </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCmQ54LQucf9hRGkuQ1kGJM9EIFMr5vtT8&callback=initMap"> </script> <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> <script> var map = L.map('mapid').setView([51.505, -0.09], 13); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); L.marker([51.5, -0.09]).addTo(map) .bindPopup('A pretty CSS3 popup.<br> Easily customizable.') .openPopup(); </script> --> }
@{ ViewBag.Title = "Page d'accueil"; } @section css{ <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" /> } Bienvenue sur le site du marathon <div id="map"></div> <div id="mapid"></div> @section scripts{ <script type="text/javascript"> var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: 47.21806, lng: -1.55278}, zoom: 8 }); } </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCmQ54LQucf9hRGkuQ1kGJM9EIFMr5vtT8&callback=initMap"> </script> <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> <script> var map = L.map('mapid').setView([51.505, -0.09], 13); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); L.marker([51.5, -0.09]).addTo(map) .bindPopup('A pretty CSS3 popup.<br> Easily customizable.') .openPopup(); </script> }
apache-2.0
C#
a94f0b1875fbe7938ef073ee4e602fe8cb92486c
Allow mongo client configuration
danielgerlag/workflow-core
src/providers/WorkflowCore.Persistence.MongoDB/ServiceCollectionExtensions.cs
src/providers/WorkflowCore.Persistence.MongoDB/ServiceCollectionExtensions.cs
using MongoDB.Driver; using System; using System.Linq; using WorkflowCore.Interface; using WorkflowCore.Models; using WorkflowCore.Persistence.MongoDB.Services; namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions { public static WorkflowOptions UseMongoDB( this WorkflowOptions options, string mongoUrl, string databaseName, Action<MongoClientSettings> configureClient = default) { options.UsePersistence(sp => { var mongoClientSettings = MongoClientSettings.FromConnectionString(mongoUrl); configureClient?.Invoke(mongoClientSettings); var client = new MongoClient(mongoClientSettings); var db = client.GetDatabase(databaseName); return new MongoPersistenceProvider(db); }); options.Services.AddTransient<IWorkflowPurger>(sp => { var mongoClientSettings = MongoClientSettings.FromConnectionString(mongoUrl); configureClient?.Invoke(mongoClientSettings); var client = new MongoClient(mongoClientSettings); var db = client.GetDatabase(databaseName); return new WorkflowPurger(db); }); return options; } } }
using MongoDB.Driver; using System; using System.Linq; using WorkflowCore.Interface; using WorkflowCore.Models; using WorkflowCore.Persistence.MongoDB.Services; namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions { public static WorkflowOptions UseMongoDB(this WorkflowOptions options, string mongoUrl, string databaseName) { options.UsePersistence(sp => { var client = new MongoClient(mongoUrl); var db = client.GetDatabase(databaseName); return new MongoPersistenceProvider(db); }); options.Services.AddTransient<IWorkflowPurger>(sp => { var client = new MongoClient(mongoUrl); var db = client.GetDatabase(databaseName); return new WorkflowPurger(db); }); return options; } } }
mit
C#
0c07aba5ce0117bf71b474e8e404687aac279113
use modelState instead
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Controllers/ProfileController.cs
Anlab.Mvc/Controllers/ProfileController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Anlab.Core.Domain; using AnlabMvc.Data; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace AnlabMvc.Controllers { [Authorize] public class ProfileController : ApplicationController { private readonly ApplicationDbContext _context; public ProfileController(ApplicationDbContext context) { _context = context; } public async Task<IActionResult> Index() { return View(await _context.Users.SingleOrDefaultAsync(x=>x.Id == CurrentUserId)); } public async Task<IActionResult> Edit() { return View(await _context.Users.SingleOrDefaultAsync(x => x.Id == CurrentUserId)); } [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Edit([Bind("FirstName,LastName,Name")]User user) { var userToUpdate = await _context.Users.SingleOrDefaultAsync(x => x.Id == CurrentUserId); if (ModelState.IsValid) { userToUpdate.FirstName = user.FirstName; userToUpdate.LastName = user.LastName; userToUpdate.Name = user.Name; _context.Update(userToUpdate); await _context.SaveChangesAsync(); return RedirectToAction("Index"); } return View(user); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Anlab.Core.Domain; using AnlabMvc.Data; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace AnlabMvc.Controllers { [Authorize] public class ProfileController : ApplicationController { private readonly ApplicationDbContext _context; public ProfileController(ApplicationDbContext context) { _context = context; } public async Task<IActionResult> Index() { return View(await _context.Users.SingleOrDefaultAsync(x=>x.Id == CurrentUserId)); } public async Task<IActionResult> Edit() { return View(await _context.Users.SingleOrDefaultAsync(x => x.Id == CurrentUserId)); } [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Edit(User data) { var user = await _context.Users.SingleOrDefaultAsync(x => x.Id == CurrentUserId); if (await TryUpdateModelAsync(user)) { _context.Users.Update(user); await _context.SaveChangesAsync(); return RedirectToAction("Index"); } return View(user); } } }
mit
C#
1d5afaee57fbb277158aece1b71f841d3654a7ea
Fix new config manager
Acute-sales-ltd/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,hakim89/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,PGM-NipponSysits/IIS.Git-Connector,crowar/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,YelaSeamless/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,crowar/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,RedX2501/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,darioajr/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,lkho/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,crowar/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,gencer/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,padremortius/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,gencer/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,willdean/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,gencer/Bonobo-Git-Server,crowar/Bonobo-Git-Server,willdean/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,crowar/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,larshg/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,lkho/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,Webmine/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,larshg/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,larshg/Bonobo-Git-Server,lkho/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,larshg/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,crowar/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server
Bonobo.Git.Server/Bonobo.Git.Server/Configs/ConfigEntry.cs
Bonobo.Git.Server/Bonobo.Git.Server/Configs/ConfigEntry.cs
using System.Configuration; using System.IO; using System.Web; using System.Xml.Serialization; namespace Bonobo.Git.Server.Configs { public class ConfigEntry<Entry> where Entry : ConfigEntry<Entry>, new() { protected ConfigEntry() { } private static Entry _current = null; private static readonly object _asyncRoot = new object(); private static readonly string _configPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["UserConfiguration"]); public static Entry Current { get { return _current ?? Load(); } } private static Entry Load() { if (_current == null) lock (_asyncRoot) if (_current == null) { var xs = new XmlSerializer(typeof(Entry)); try { using (var stream = File.Open(_configPath, FileMode.Open)) { _current = xs.Deserialize(stream) as Entry; } } catch { _current = new Entry(); } } return _current; } public void Save() { if (_current != null) lock (_asyncRoot) if (_current != null) { var xs = new XmlSerializer(typeof(Entry)); using (var stream = File.Open(_configPath, FileMode.Create)) xs.Serialize(stream, _current); } } } }
using System.Configuration; using System.IO; using System.Web; using System.Xml.Serialization; namespace Bonobo.Git.Server.Configs { public class ConfigEntry<Entry> where Entry : ConfigEntry<Entry> { protected ConfigEntry() { } private static Entry _current = null; private static readonly object _asyncRoot = new object(); private static readonly string _configPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["UserConfiguration"]); public static Entry Current { get { return _current ?? Load(); } } private static Entry Load() { if (_current == null) lock (_asyncRoot) if (_current == null) { var xs = new XmlSerializer(typeof(Entry)); try { using (var stream = File.Open(_configPath, FileMode.Open)) { _current = xs.Deserialize(stream) as Entry; } } catch { } } return _current; } public void Save() { if (_current != null) lock (_asyncRoot) if (_current != null) { var xs = new XmlSerializer(typeof(Entry)); using (var stream = File.Open(_configPath, FileMode.Create)) xs.Serialize(stream, _current); } } } }
mit
C#
0dfa9a0efb8cbffe4a914ea7d8a9effe854c81f0
Modify the migration so it rebuilds the table.
mareksuscak/ef-migrations-bug
EfMigrationsBug/Migrations/201410021402204_ChangePkType.cs
EfMigrationsBug/Migrations/201410021402204_ChangePkType.cs
namespace EfMigrationsBug.Migrations { using System; using System.Data.Entity.Migrations; public partial class ChangePkType : DbMigration { public override void Up() { DropTable("dbo.Foos"); CreateTable( "dbo.Foos", c => new { ID = c.Int(nullable: false, identity: true), }) .PrimaryKey(t => t.ID); } public override void Down() { DropTable("dbo.Foos"); CreateTable( "dbo.Foos", c => new { ID = c.String(nullable: false, maxLength: 5), }) .PrimaryKey(t => t.ID); } } }
namespace EfMigrationsBug.Migrations { using System; using System.Data.Entity.Migrations; public partial class ChangePkType : DbMigration { public override void Up() { DropPrimaryKey("dbo.Foos"); AlterColumn("dbo.Foos", "ID", c => c.Int(nullable: false, identity: true)); AddPrimaryKey("dbo.Foos", "ID"); } public override void Down() { DropPrimaryKey("dbo.Foos"); AlterColumn("dbo.Foos", "ID", c => c.String(nullable: false, maxLength: 5)); AddPrimaryKey("dbo.Foos", "ID"); } } }
mit
C#
1bf53f46f27c84eeb8225458a9215304a570bada
Add constructor that creates memory stream internally
protyposis/Aurio,protyposis/Aurio
Aurio/Aurio/Streams/MemoryWriterStream.cs
Aurio/Aurio/Streams/MemoryWriterStream.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Aurio.Streams { public class MemoryWriterStream : MemorySourceStream, IAudioWriterStream { public MemoryWriterStream(MemoryStream target, AudioProperties properties) : base(target, properties) { } public MemoryWriterStream(AudioProperties properties) : base(new MemoryStream(), properties) { } public void Write(byte[] buffer, int offset, int count) { // Default stream checks according to MSDN if(buffer == null) { throw new ArgumentNullException("buffer must not be null"); } if(!source.CanWrite) { throw new NotSupportedException("target stream is not writable"); } if(buffer.Length - offset < count) { throw new ArgumentException("not enough remaining bytes or count too large"); } if(offset < 0 || count < 0) { throw new ArgumentOutOfRangeException("offset and count must not be negative"); } // Check block alignment if(count % SampleBlockSize != 0) { throw new ArgumentException("count must be a multiple of the sample block size"); } source.Write(buffer, offset, count); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Aurio.Streams { public class MemoryWriterStream : MemorySourceStream, IAudioWriterStream { public MemoryWriterStream(MemoryStream target, AudioProperties properties) : base(target, properties) { } public void Write(byte[] buffer, int offset, int count) { // Default stream checks according to MSDN if(buffer == null) { throw new ArgumentNullException("buffer must not be null"); } if(!source.CanWrite) { throw new NotSupportedException("target stream is not writable"); } if(buffer.Length - offset < count) { throw new ArgumentException("not enough remaining bytes or count too large"); } if(offset < 0 || count < 0) { throw new ArgumentOutOfRangeException("offset and count must not be negative"); } // Check block alignment if(count % SampleBlockSize != 0) { throw new ArgumentException("count must be a multiple of the sample block size"); } source.Write(buffer, offset, count); } } }
agpl-3.0
C#
16e16f9660411180e921588f3e8e7c496191948e
Fix ghost instantiation
Barleytree/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
Assets/Microgames/EikiJudge/Scripts/EikiJudge_Controller.cs
Assets/Microgames/EikiJudge/Scripts/EikiJudge_Controller.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class EikiJudge_Controller : MonoBehaviour { public static EikiJudge_Controller controller; [SerializeField] private GameObject soulPrefab; [Header("Set the number of souls to appear")] public int soulsNumber; [Header("check this if a soul must be late")] public bool lastSoulIsLate = false; public List<EikiJudge_SoulController> soulsList = new List<EikiJudge_SoulController>(); private Vector3 spawnPosition; private Direction judgementDirection; public bool allSoulsReady = false; public bool wasted = false; public bool gameWon = false; private void Awake() { controller = this; } private void Start() { SpawnSouls(); } private void Update() { // If all souls have been sent AND game isn't lost if (soulsList.Count == 0 && !wasted && !gameWon) { gameWon = true; WinGame(); } } // Souls spawner public void SpawnSouls() { for (int i = 0; i < soulsNumber; i++) { spawnPosition = new Vector3(0f, -6f, i * -1f); GameObject tempSoul = Instantiate(soulPrefab, spawnPosition, Quaternion.identity); soulsList.Add((EikiJudge_SoulController)tempSoul.GetComponent(typeof(EikiJudge_SoulController))); soulsList[i].soulListPosition = i; } allSoulsReady = true; } public bool SendJudgement(Direction judgementDirection) { if (soulsList.Count > 0 && soulsList[0].Ready) { // get next soul and judge soulsList[0].SendTheSoul(judgementDirection); // delete from list soulsList.RemoveAt(0); return true; } return false; } // TODO: Maybe add some win/lose animations ? public void WinGame() { MicrogameController.instance.setVictory(victory: true, final: true); } public void LoseGame() { wasted = true; MicrogameController.instance.setVictory(victory: false, final: true); } public enum Direction { none, left, right } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class EikiJudge_Controller : MonoBehaviour { public static EikiJudge_Controller controller; [SerializeField] private GameObject soulPrefab; [Header("Set the number of souls to appear")] public int soulsNumber; [Header("check this if a soul must be late")] public bool lastSoulIsLate = false; public List<EikiJudge_SoulController> soulsList = new List<EikiJudge_SoulController>(); private Vector3 spawnPosition; private Direction judgementDirection; public bool allSoulsReady = false; public bool wasted = false; public bool gameWon = false; private void Awake() { controller = this; SpawnSouls(); } private void Update() { // If all souls have been sent AND game isn't lost if (soulsList.Count == 0 && !wasted && !gameWon) { gameWon = true; WinGame(); } } // Souls spawner public void SpawnSouls() { for (int i = 0; i < soulsNumber; i++) { spawnPosition = new Vector3(0f, -6f, i * -1f); GameObject tempSoul = Instantiate(soulPrefab, spawnPosition, Quaternion.identity); soulsList.Add((EikiJudge_SoulController)tempSoul.GetComponent(typeof(EikiJudge_SoulController))); soulsList[i].soulListPosition = i; } allSoulsReady = true; } public bool SendJudgement(Direction judgementDirection) { if (soulsList.Count > 0 && soulsList[0].Ready) { // get next soul and judge soulsList[0].SendTheSoul(judgementDirection); // delete from list soulsList.RemoveAt(0); return true; } return false; } // TODO: Maybe add some win/lose animations ? public void WinGame() { MicrogameController.instance.setVictory(victory: true, final: true); } public void LoseGame() { wasted = true; MicrogameController.instance.setVictory(victory: false, final: true); } public enum Direction { none, left, right } }
mit
C#
56ab69f34d5f452c38eb73c7b0e21fee0ce42c1e
Bump version to 0.6.3
sqt/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot
CactbotOverlay/Properties/AssemblyInfo.cs
CactbotOverlay/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.6.3.0")] [assembly: AssemblyFileVersion("0.6.3.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.6.2.0")] [assembly: AssemblyFileVersion("0.6.2.0")]
apache-2.0
C#
ab314f83db5f964d773415b65912c52e543b2d00
Remove JPEG dialog for non-JPEG formats
jakeclawson/Pinta,Fenex/Pinta,PintaProject/Pinta,jakeclawson/Pinta,PintaProject/Pinta,Mailaender/Pinta,Mailaender/Pinta,Fenex/Pinta,PintaProject/Pinta
Pinta.Core/ImageFormats/GdkPixbufFormat.cs
Pinta.Core/ImageFormats/GdkPixbufFormat.cs
// // GdkPixbufFormat.cs // // Author: // Maia Kozheva <[email protected]> // // Copyright (c) 2010 Maia Kozheva <[email protected]> // // 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.IO; using Gdk; namespace Pinta.Core { public class GdkPixbufFormat: IImageImporter, IImageExporter { private string filetype; public GdkPixbufFormat(string filetype) { this.filetype = filetype; } public void Import (LayerManager layers, string fileName) { Pixbuf bg = new Pixbuf (fileName); layers.Clear (); PintaCore.History.Clear (); layers.DestroySelectionLayer (); PintaCore.Workspace.ImageSize = new Size (bg.Width, bg.Height); PintaCore.Workspace.CanvasSize = new Gdk.Size (bg.Width, bg.Height); layers.ResetSelectionPath (); Layer layer = layers.AddNewLayer (Path.GetFileName (fileName)); using (Cairo.Context g = new Cairo.Context (layer.Surface)) { CairoHelper.SetSourcePixbuf (g, bg, 0, 0); g.Paint (); } bg.Dispose (); } protected virtual void DoSave (Pixbuf pb, string fileName, string fileType) { pb.Save (fileName, fileType); } public void Export (LayerManager layers, string fileName) { Cairo.ImageSurface surf = layers.GetFlattenedImage (); Pixbuf pb = surf.ToPixbuf (); DoSave(pb, fileName, filetype); (pb as IDisposable).Dispose (); (surf as IDisposable).Dispose (); } } }
// // GdkPixbufFormat.cs // // Author: // Maia Kozheva <[email protected]> // // Copyright (c) 2010 Maia Kozheva <[email protected]> // // 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.IO; using Gdk; namespace Pinta.Core { public class GdkPixbufFormat: IImageImporter, IImageExporter { private string filetype; public GdkPixbufFormat(string filetype) { this.filetype = filetype; } public void Import (LayerManager layers, string fileName) { Pixbuf bg = new Pixbuf (fileName); layers.Clear (); PintaCore.History.Clear (); layers.DestroySelectionLayer (); PintaCore.Workspace.ImageSize = new Size (bg.Width, bg.Height); PintaCore.Workspace.CanvasSize = new Gdk.Size (bg.Width, bg.Height); layers.ResetSelectionPath (); Layer layer = layers.AddNewLayer (Path.GetFileName (fileName)); using (Cairo.Context g = new Cairo.Context (layer.Surface)) { CairoHelper.SetSourcePixbuf (g, bg, 0, 0); g.Paint (); } bg.Dispose (); } protected virtual void DoSave (Pixbuf pb, string fileName, string fileType) { PintaCore.Actions.File.PromptJpegCompressionLevel (); pb.Save (fileName, fileType); } public void Export (LayerManager layers, string fileName) { Cairo.ImageSurface surf = layers.GetFlattenedImage (); Pixbuf pb = surf.ToPixbuf (); DoSave(pb, fileName, filetype); (pb as IDisposable).Dispose (); (surf as IDisposable).Dispose (); } } }
mit
C#
a563dbf9dd93deaa0fb00511bf476cde40b7a43e
Refactor format
p-org/PSharp
Samples/PSharpFramework/PingPong/Client.cs
Samples/PSharpFramework/PingPong/Client.cs
using System; using Microsoft.PSharp; namespace PingPong { internal class Client : Machine { private MachineId Server; private int Counter; [Start] [OnEventDoAction(typeof(Config), nameof(Configure))] [OnEventGotoState(typeof(Unit), typeof(Active))] class Init : MachineState { } void Configure() { this.Server = (this.ReceivedEvent as Config).Id; this.Counter = 0; this.Raise(new Unit()); } [OnEntry(nameof(ActiveOnEntry))] [OnEventGotoState(typeof(Unit), typeof(Active))] [OnEventDoAction(typeof(Pong), nameof(SendPing))] class Active : MachineState { } void ActiveOnEntry() { if (this.Counter == 5) { this.Raise(new Halt()); } } private void SendPing() { this.Counter++; Console.WriteLine("\nTurns: {0} / 5\n", this.Counter); this.Send(this.Server, new Ping()); this.Raise(new Unit()); } } }
using System; using Microsoft.PSharp; namespace PingPong { internal class Client : Machine { private MachineId Server; private int Counter; [Start] [OnEventDoAction(typeof(Config), nameof(Configure))] [OnEventGotoState(typeof(Unit), typeof(Active))] class Init : MachineState { } void Configure() { this.Server = (this.ReceivedEvent as Config).Id; this.Counter = 0; this.Raise(new Unit()); } [OnEventGotoState(typeof(Unit), typeof(Active))] [OnEventDoAction(typeof(Pong), nameof(SendPing))] class Active : MachineState { protected override void OnEntry() { if ((this.Machine as Client).Counter == 5) { this.Raise(new Halt()); } } } private void SendPing() { this.Counter++; Console.WriteLine("\nTurns: {0} / 5\n", this.Counter); this.Send(this.Server, new Ping()); this.Raise(new Unit()); } } }
mit
C#
a9e4976b7aa9026b04d63c3346cfc83a6bf204e9
Update type extension for net40
oxyplot/oxyplot,ze-pequeno/oxyplot
Source/OxyPlot/Utilities/TypeExtensions.cs
Source/OxyPlot/Utilities/TypeExtensions.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="TypeExtensions.cs" company="OxyPlot"> // Copyright (c) 2014 OxyPlot contributors // </copyright> // <summary> // Provides extension methods for types. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace OxyPlot { using System; using System.Linq; using System.Reflection; /// <summary> /// Provides extension methods for types. /// </summary> public static class TypeExtensions { /// <summary> /// Retrieves an object that represents a specified property. /// </summary> /// <param name="type">The type that contains the property.</param> /// <param name="name">The name of the property.</param> /// <returns>An object that represents the specified property, or null if the property is not found.</returns> public static PropertyInfo GetRuntimeProperty(this Type type, string name) { #if NET40 var source = type.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); #else var typeInfo = type.GetTypeInfo(); var source = typeInfo.AsType().GetRuntimeProperties(); #endif foreach (var x in source) { if (x.Name == name) return x; } return null; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="TypeExtensions.cs" company="OxyPlot"> // Copyright (c) 2014 OxyPlot contributors // </copyright> // <summary> // Provides extension methods for types. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace OxyPlot { using System; using System.Linq; using System.Reflection; /// <summary> /// Provides extension methods for types. /// </summary> public static class TypeExtensions { /// <summary> /// Retrieves an object that represents a specified property. /// </summary> /// <param name="type">The type that contains the property.</param> /// <param name="name">The name of the property.</param> /// <returns>An object that represents the specified property, or null if the property is not found.</returns> public static PropertyInfo GetRuntimeProperty(this Type type, string name) { #if NET40 var source = type.GetProperties(); #else var typeInfo = type.GetTypeInfo(); var source = typeInfo.AsType().GetRuntimeProperties(); #endif foreach (var x in source) { if (x.Name == name) return x; } return null; } } }
mit
C#
ce65646306f0837d89d951eb9dd0446d87fd357c
Update SerializerBase.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/SerializerBase.cs
TIKSN.Core/Serialization/SerializerBase.cs
using System; namespace TIKSN.Serialization { public abstract class SerializerBase<TSerial> : ISerializer<TSerial> where TSerial : class { public TSerial Serialize(object obj) { if (obj == null) return null; try { return SerializeInternal(obj); } catch (Exception ex) { throw new SerializerException("Serialization failed.", ex); } } protected abstract TSerial SerializeInternal(object obj); } }
using System; using TIKSN.Analytics.Telemetry; namespace TIKSN.Serialization { public abstract class SerializerBase<TSerial> : SerializationBase, ISerializer<TSerial> where TSerial : class { protected SerializerBase(IExceptionTelemeter exceptionTelemeter) : base(exceptionTelemeter) { } public TSerial Serialize(object obj) { if (obj == null) return null; try { return SerializeInternal(obj); } catch (Exception ex) { _exceptionTelemeter.TrackException(ex); return null; } } protected abstract TSerial SerializeInternal(object obj); } }
mit
C#
1dcfdc62871fd6cac693198f8262d5c0cded7191
Add files via upload
Liluye/Capstone
Player.cs
Player.cs
using UnityEngine; using System.Collections; public class Player : MonoBehaviour { //travel 2.5 grid squares per second float speed = 2.5f; // Use this for initialization void Start() { } // Update is called once per frame void Update() { Move(); } //Player movement, taken currently from arrow keys //May change to wsad later void Move() { if (Input.GetKey("up")) transform.Translate(0, speed * Time.deltaTime, 0); if (Input.GetKey("down")) transform.Translate(0, -speed * Time.deltaTime, 0); if (Input.GetKey("left")) transform.Translate(-speed * Time.deltaTime, 0, 0); if (Input.GetKey("right")) transform.Translate(speed * Time.deltaTime, 0, 0); } //Moves both player and main camera into adjacent room void ShiftRoom(string dir) { if (dir.Equals("north")) { this.transform.Translate(0, 3, 0); Camera.main.transform.Translate(0, 10, 0); } if (dir.Equals("east")) { transform.Translate(3, 0, 0); Camera.main.transform.Translate(10, 0, 0); } if (dir.Equals("west")) { transform.Translate(-3, 0, 0); Camera.main.transform.Translate(-10, 0, 0); } if (dir.Equals("south")) { this.transform.Translate(0, -3, 0); Camera.main.transform.Translate(0, -10, 0); } } void OnCollisionStay2D(Collision2D coll) { if (coll.gameObject.tag == "northDoor") ShiftRoom("north"); if (coll.gameObject.tag == "eastDoor") ShiftRoom("east"); if (coll.gameObject.tag == "westDoor") ShiftRoom("west"); if (coll.gameObject.tag == "southDoor") ShiftRoom("south"); } }
using UnityEngine; using System.Collections; public class Player : MonoBehaviour { float speed = 2.5f; float test = 2; // Use this for initialization void Start() { } // Update is called once per frame void Update() { Move(); } //Player movement, taken currently from arrow keys //May change to wsad later void Move() { if (Input.GetKey("up")) transform.Translate(0, speed * Time.deltaTime, 0); if (Input.GetKey("down")) transform.Translate(0, -speed * Time.deltaTime, 0); if (Input.GetKey("left")) transform.Translate(-speed * Time.deltaTime, 0, 0); if (Input.GetKey("right")) transform.Translate(speed * Time.deltaTime, 0, 0); } }
mit
C#
97f44155415987649383877f12f65afe047511c8
Update copyright year
danielchalmers/DesktopWidgets
DesktopWidgets/Properties/AssemblyInfo.cs
DesktopWidgets/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DesktopWidgets")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Daniel Chalmers Software")] [assembly: AssemblyProduct("DesktopWidgets")] [assembly: AssemblyCopyright("© Daniel Chalmers 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: Guid("D7E6B136-3765-4938-8ACA-EED3473CE3A0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DesktopWidgets")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Daniel Chalmers Software")] [assembly: AssemblyProduct("DesktopWidgets")] [assembly: AssemblyCopyright("© Daniel Chalmers 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: Guid("D7E6B136-3765-4938-8ACA-EED3473CE3A0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
15cb74e6149e92612162d3cfe1333ef4d9caf357
Add logging to CcReader when there are problems.
Vector241-Eric/ZBuildLights,mhinze/ZBuildLights,Vector241-Eric/ZBuildLights,mhinze/ZBuildLights,Vector241-Eric/ZBuildLights,mhinze/ZBuildLights
src/ZBuildLights.Core/Services/CruiseControl/CcReader.cs
src/ZBuildLights.Core/Services/CruiseControl/CcReader.cs
using System; using System.IO; using System.Net; using System.Xml.Serialization; using NLog; using ZBuildLights.Core.Models.CruiseControl; using ZBuildLights.Core.Models.Requests; namespace ZBuildLights.Core.Services.CruiseControl { public class CcReader : ICcReader { private static readonly Logger Log = LogManager.GetCurrentClassLogger(); public NetworkResponse<Projects> GetStatus(string url) { try { var request = WebRequest.Create(url); Projects projects; using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) using (var reader = new StreamReader(stream)) { var serializer = new XmlSerializer(typeof (Projects)); projects = (Projects) serializer.Deserialize(reader); } return NetworkResponse.Success(projects); } catch (Exception e) { Log.ErrorException("Exception when trying to get status from Cruise server.", e); return NetworkResponse.Fail<Projects>(string.Format("{0}: {1}", e.GetType().Name, e.Message)); } } } }
using System; using System.IO; using System.Net; using System.Xml.Serialization; using ZBuildLights.Core.Models.CruiseControl; using ZBuildLights.Core.Models.Requests; namespace ZBuildLights.Core.Services.CruiseControl { public class CcReader : ICcReader { public NetworkResponse<Projects> GetStatus(string url) { try { var request = WebRequest.Create(url); Projects projects; using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) using (var reader = new StreamReader(stream)) { var serializer = new XmlSerializer(typeof (Projects)); projects = (Projects) serializer.Deserialize(reader); } return NetworkResponse.Success(projects); } catch (Exception e) { return NetworkResponse.Fail<Projects>(string.Format("{0}: {1}", e.GetType().Name, e.Message)); } } } }
mit
C#
3d92d31826d6785d8e32664ebc38a1463a93c72b
update html for book
CNinnovation/ASPNETCoreJun2017,CNinnovation/ASPNETCoreJun2017,CNinnovation/ASPNETCoreJun2017,CNinnovation/ASPNETCoreJun2017
aspnetcoremvc/SimpleMVCApp/SimpleMVCApp/Views/AnotherBooks/Book.cshtml
aspnetcoremvc/SimpleMVCApp/SimpleMVCApp/Views/AnotherBooks/Book.cshtml
@model Book @* For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 *@ @{ } <hr /> <form method="post" action="/AnotherBooks/Book"> <span>Title:</span> <input type="text" id="title" name="title" /> <br /> <span>Publisher:</span> <input type="text" id="publisher" name="publisher" /> <br /> <input type="submit" value="Submit" /> </form> <hr />
@model Book @* For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 *@ @{ } <form method="post" action="/AnotherBooks/Book"> <input type="text" id="title" name="title" /> <input type="text" id="publisher" name="publisher" /> <input type="submit" value="Submit" /> </form>
mit
C#
2905292d20308fd492135d8d7f2b1d2f883fc250
Use SdlClipboard on Linux when using new SDL2 backend
EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
osu.Framework/Platform/Linux/LinuxGameHost.cs
osu.Framework/Platform/Linux/LinuxGameHost.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Platform.Linux.Native; using osu.Framework.Platform.Linux.Sdl; using osuTK; namespace osu.Framework.Platform.Linux { public class LinuxGameHost : DesktopGameHost { internal LinuxGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false, bool useSdl = false) : base(gameName, bindIPC, toolkitOptions, portableInstallation, useSdl) { } protected override void SetupForRun() { base.SetupForRun(); // required for the time being to address libbass_fx.so load failures (see https://github.com/ppy/osu/issues/2852) Library.Load("libbass.so", Library.LoadFlags.RTLD_LAZY | Library.LoadFlags.RTLD_GLOBAL); } protected override IWindow CreateWindow() => !UseSdl ? (IWindow)new LinuxGameWindow() : new Window(); protected override Storage GetStorage(string baseName) => new LinuxStorage(baseName, this); public override Clipboard GetClipboard() => Window is Window || (Window as LinuxGameWindow)?.IsSdl == true ? (Clipboard)new SdlClipboard() : new LinuxClipboard(); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Platform.Linux.Native; using osu.Framework.Platform.Linux.Sdl; using osuTK; namespace osu.Framework.Platform.Linux { public class LinuxGameHost : DesktopGameHost { internal LinuxGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false, bool useSdl = false) : base(gameName, bindIPC, toolkitOptions, portableInstallation, useSdl) { } protected override void SetupForRun() { base.SetupForRun(); // required for the time being to address libbass_fx.so load failures (see https://github.com/ppy/osu/issues/2852) Library.Load("libbass.so", Library.LoadFlags.RTLD_LAZY | Library.LoadFlags.RTLD_GLOBAL); } protected override IWindow CreateWindow() => !UseSdl ? (IWindow)new LinuxGameWindow() : new Window(); protected override Storage GetStorage(string baseName) => new LinuxStorage(baseName, this); public override Clipboard GetClipboard() { if (((LinuxGameWindow)Window).IsSdl) { return new SdlClipboard(); } else { return new LinuxClipboard(); } } } }
mit
C#
9869edb24280099479f2677b47d1f0ea4d7496ab
Make field internal.
budcribar/roslyn,abock/roslyn,lorcanmooney/roslyn,dotnet/roslyn,michalhosala/roslyn,KiloBravoLima/roslyn,DustinCampbell/roslyn,ErikSchierboom/roslyn,bbarry/roslyn,physhi/roslyn,tannergooding/roslyn,AArnott/roslyn,yeaicc/roslyn,khyperia/roslyn,jaredpar/roslyn,ljw1004/roslyn,xasx/roslyn,budcribar/roslyn,jcouv/roslyn,tvand7093/roslyn,mavasani/roslyn,KevinRansom/roslyn,xasx/roslyn,mgoertz-msft/roslyn,drognanar/roslyn,swaroop-sridhar/roslyn,AmadeusW/roslyn,aelij/roslyn,jamesqo/roslyn,aelij/roslyn,jaredpar/roslyn,balajikris/roslyn,bkoelman/roslyn,brettfo/roslyn,heejaechang/roslyn,jhendrixMSFT/roslyn,AmadeusW/roslyn,agocke/roslyn,MichalStrehovsky/roslyn,MattWindsor91/roslyn,DustinCampbell/roslyn,bbarry/roslyn,paulvanbrenk/roslyn,jcouv/roslyn,jmarolf/roslyn,a-ctor/roslyn,brettfo/roslyn,VSadov/roslyn,orthoxerox/roslyn,MattWindsor91/roslyn,cston/roslyn,AlekseyTs/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,robinsedlaczek/roslyn,davkean/roslyn,eriawan/roslyn,leppie/roslyn,davkean/roslyn,AnthonyDGreen/roslyn,brettfo/roslyn,MatthieuMEZIL/roslyn,orthoxerox/roslyn,kelltrick/roslyn,gafter/roslyn,stephentoub/roslyn,dpoeschl/roslyn,drognanar/roslyn,AlekseyTs/roslyn,amcasey/roslyn,AArnott/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,jkotas/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,panopticoncentral/roslyn,AnthonyDGreen/roslyn,a-ctor/roslyn,jeffanders/roslyn,cston/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,TyOverby/roslyn,abock/roslyn,KirillOsenkov/roslyn,dpoeschl/roslyn,michalhosala/roslyn,shyamnamboodiripad/roslyn,mattwar/roslyn,eriawan/roslyn,yeaicc/roslyn,diryboy/roslyn,genlu/roslyn,mattwar/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,CaptainHayashi/roslyn,nguerrera/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,jaredpar/roslyn,jcouv/roslyn,mattscheffer/roslyn,heejaechang/roslyn,Shiney/roslyn,Hosch250/roslyn,abock/roslyn,MatthieuMEZIL/roslyn,Hosch250/roslyn,amcasey/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,dpoeschl/roslyn,Giftednewt/roslyn,mavasani/roslyn,tvand7093/roslyn,Giftednewt/roslyn,wvdd007/roslyn,tmat/roslyn,DustinCampbell/roslyn,agocke/roslyn,bbarry/roslyn,xoofx/roslyn,natidea/roslyn,kelltrick/roslyn,OmarTawfik/roslyn,Pvlerick/roslyn,mmitche/roslyn,srivatsn/roslyn,amcasey/roslyn,KevinH-MS/roslyn,tvand7093/roslyn,bkoelman/roslyn,ljw1004/roslyn,lorcanmooney/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,robinsedlaczek/roslyn,KiloBravoLima/roslyn,aelij/roslyn,VSadov/roslyn,davkean/roslyn,bkoelman/roslyn,akrisiun/roslyn,MichalStrehovsky/roslyn,CaptainHayashi/roslyn,agocke/roslyn,physhi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,a-ctor/roslyn,tmeschter/roslyn,jeffanders/roslyn,bartdesmet/roslyn,paulvanbrenk/roslyn,zooba/roslyn,xoofx/roslyn,akrisiun/roslyn,tmeschter/roslyn,mattscheffer/roslyn,genlu/roslyn,jmarolf/roslyn,Pvlerick/roslyn,OmarTawfik/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,reaction1989/roslyn,budcribar/roslyn,jkotas/roslyn,wvdd007/roslyn,Shiney/roslyn,gafter/roslyn,heejaechang/roslyn,vslsnap/roslyn,KiloBravoLima/roslyn,Pvlerick/roslyn,diryboy/roslyn,paulvanbrenk/roslyn,pdelvo/roslyn,weltkante/roslyn,tmeschter/roslyn,jhendrixMSFT/roslyn,OmarTawfik/roslyn,mavasani/roslyn,MattWindsor91/roslyn,eriawan/roslyn,swaroop-sridhar/roslyn,Giftednewt/roslyn,Shiney/roslyn,pdelvo/roslyn,srivatsn/roslyn,yeaicc/roslyn,jkotas/roslyn,genlu/roslyn,jamesqo/roslyn,mattwar/roslyn,mmitche/roslyn,balajikris/roslyn,AlekseyTs/roslyn,swaroop-sridhar/roslyn,panopticoncentral/roslyn,akrisiun/roslyn,KevinH-MS/roslyn,vslsnap/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,jhendrixMSFT/roslyn,tmat/roslyn,zooba/roslyn,xoofx/roslyn,VSadov/roslyn,weltkante/roslyn,Hosch250/roslyn,AArnott/roslyn,mattscheffer/roslyn,TyOverby/roslyn,CaptainHayashi/roslyn,AnthonyDGreen/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,TyOverby/roslyn,ljw1004/roslyn,MattWindsor91/roslyn,sharwell/roslyn,stephentoub/roslyn,nguerrera/roslyn,khyperia/roslyn,MichalStrehovsky/roslyn,drognanar/roslyn,stephentoub/roslyn,nguerrera/roslyn,michalhosala/roslyn,jmarolf/roslyn,srivatsn/roslyn,tannergooding/roslyn,mmitche/roslyn,KevinH-MS/roslyn,pdelvo/roslyn,balajikris/roslyn,lorcanmooney/roslyn,leppie/roslyn,cston/roslyn,natidea/roslyn,reaction1989/roslyn,kelltrick/roslyn,CyrusNajmabadi/roslyn,jamesqo/roslyn,orthoxerox/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,reaction1989/roslyn,bartdesmet/roslyn,xasx/roslyn,jeffanders/roslyn,sharwell/roslyn,vslsnap/roslyn,khyperia/roslyn,KirillOsenkov/roslyn,robinsedlaczek/roslyn,gafter/roslyn,sharwell/roslyn,leppie/roslyn,natidea/roslyn,MatthieuMEZIL/roslyn,zooba/roslyn
src/Features/Core/Portable/Completion/CompletionTags.cs
src/Features/Core/Portable/Completion/CompletionTags.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.Completion { /// <summary> /// The set of well known tags used for the <see cref="CompletionItem.Tags"/> property. /// These tags influence the presentation of items in the list. /// </summary> public static class CompletionTags { // accessibility public const string Public = nameof(Public); public const string Protected = nameof(Protected); public const string Private = nameof(Private); public const string Internal = nameof(Internal); // project elements public const string File = nameof(File); public const string Project = nameof(Project); public const string Folder = nameof(Folder); public const string Assembly = nameof(Assembly); // language elements public const string Class = nameof(Class); public const string Constant = nameof(Constant); public const string Delegate = nameof(Delegate); public const string Enum = nameof(Enum); public const string EnumMember = nameof(EnumMember); public const string Event = nameof(Event); public const string ExtensionMethod = nameof(ExtensionMethod); public const string Field = nameof(Field); public const string Interface = nameof(Interface); public const string Intrinsic = nameof(Intrinsic); public const string Keyword = nameof(Keyword); public const string Label = nameof(Label); public const string Local = nameof(Local); public const string Namespace = nameof(Namespace); public const string Method = nameof(Method); public const string Module = nameof(Module); public const string Operator = nameof(Operator); public const string Parameter = nameof(Parameter); public const string Property = nameof(Property); public const string RangeVariable = nameof(RangeVariable); public const string Reference = nameof(Reference); public const string Structure = nameof(Structure); public const string TypeParameter = nameof(TypeParameter); // other public const string Snippet = nameof(Snippet); public const string Error = nameof(Error); public const string Warning = nameof(Warning); // Currently needed, but removed from Dev15. Internal so no one accidently takes a // dependency on them. internal const string ArgumentName = nameof(ArgumentName); internal const string ObjectCreation = nameof(ObjectCreation); } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.Completion { /// <summary> /// The set of well known tags used for the <see cref="CompletionItem.Tags"/> property. /// These tags influence the presentation of items in the list. /// </summary> public static class CompletionTags { // accessibility public const string Public = nameof(Public); public const string Protected = nameof(Protected); public const string Private = nameof(Private); public const string Internal = nameof(Internal); // project elements public const string File = nameof(File); public const string Project = nameof(Project); public const string Folder = nameof(Folder); public const string Assembly = nameof(Assembly); // language elements public const string ArgumentName = nameof(ArgumentName); public const string Class = nameof(Class); public const string Constant = nameof(Constant); public const string Delegate = nameof(Delegate); public const string Enum = nameof(Enum); public const string EnumMember = nameof(EnumMember); public const string Event = nameof(Event); public const string ExtensionMethod = nameof(ExtensionMethod); public const string Field = nameof(Field); public const string Interface = nameof(Interface); public const string Intrinsic = nameof(Intrinsic); public const string Keyword = nameof(Keyword); public const string Label = nameof(Label); public const string Local = nameof(Local); public const string Namespace = nameof(Namespace); public const string Method = nameof(Method); public const string Module = nameof(Module); public const string Operator = nameof(Operator); public const string Parameter = nameof(Parameter); public const string Property = nameof(Property); public const string RangeVariable = nameof(RangeVariable); public const string Reference = nameof(Reference); public const string Structure = nameof(Structure); public const string TypeParameter = nameof(TypeParameter); // other public const string Snippet = nameof(Snippet); public const string Error = nameof(Error); public const string Warning = nameof(Warning); public const string ObjectCreation = nameof(ObjectCreation); } }
mit
C#
963c84d8e7250200152382ed48d02851a1cfe083
Change quarter type to enum to allow for "ot" as value.
pudds/cfl-api.net,pudds/cfl-api.net
src/Models/Games/LineScore.cs
src/Models/Games/LineScore.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace mdryden.cflapi.v1.Models.Games { public class LineScore { [JsonProperty(PropertyName = "quarter")] public Quarters Quarter { get; set; } [JsonProperty(PropertyName = "score")] public int Score { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace mdryden.cflapi.v1.Models.Games { public class LineScore { [JsonProperty(PropertyName = "quarter")] public int Quarter { get; set; } [JsonProperty(PropertyName = "score")] public int Score { get; set; } } }
mit
C#
cf294893fbef5ab2ae67b0d5fb8c28afb0d9ab69
Revert "Create method PrintLogo()"
stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity
C#Development/BashSoft/BashSoft/IO/OutputWriter.cs
C#Development/BashSoft/BashSoft/IO/OutputWriter.cs
namespace BashSoft.IO { using System; using System.Collections.Generic; /// <summary> /// Flexible interface for output to the user. /// </summary> public static class OutputWriter { /// <summary> /// Print message on line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessage(string message) => Console.Write(message); /// <summary> /// Print message on new line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessageOnNewLine(string message) => Console.WriteLine(message); /// <summary> /// Print an empty line. /// </summary> public static void WriteEmptyLine() => Console.WriteLine(); /// <summary> /// Color the text in a dark red color. /// </summary> /// <param name="message">Message to be colored.</param> public static void DisplayException(string message) { var currentColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(message); Console.ForegroundColor = currentColor; } /// <summary> /// Displaying a student entry. /// </summary> /// <param name="student">Student to be printed.</param> public static void PrintStudent(KeyValuePair<string, List<int>> student) { OutputWriter.WriteMessageOnNewLine($"{student.Key} - {string.Join(", ", student.Value)}"); } } }
namespace BashSoft.IO { using System; using System.Collections.Generic; /// <summary> /// Flexible interface for output to the user. /// </summary> public static class OutputWriter { /// <summary> /// Print logo in console. /// </summary> public static void PrintLogo() { var newLine = Environment.NewLine; var logo = new[] { @" ____ _ _____ __ _ ", @"| _ \ | | / ____| / _| |", @"| |_) | ____ ___| |__ | (___ ___ | |_| |_", @"| _ < / _` / __| '_ \ \___ \ / _ \| _| __|", @"| |_) | (_| \__ \ | | |____) | (_) | | | |", @"|____/ \__,_|___/_| |_|_____/ \___/|_| \__|" }; Console.WindowWidth = 100; foreach (var line in logo) { Console.WriteLine(line); } Console.WriteLine(newLine, newLine); } /// <summary> /// Print message on line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessage(string message) => Console.Write(message); /// <summary> /// Print message on new line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessageOnNewLine(string message) => Console.WriteLine(message); /// <summary> /// Print an empty line. /// </summary> public static void WriteEmptyLine() => Console.WriteLine(); /// <summary> /// Color the text in a dark red color. /// </summary> /// <param name="message">Message to be colored.</param> public static void DisplayException(string message) { var currentColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(message); Console.ForegroundColor = currentColor; } /// <summary> /// Displaying a student entry. /// </summary> /// <param name="student">Student to be printed.</param> public static void PrintStudent(KeyValuePair<string, List<int>> student) { OutputWriter.WriteMessageOnNewLine($"{student.Key} - {string.Join(", ", student.Value)}"); } } }
mit
C#
70d062ba39e618d5084720324d5996e2609465d7
make code more readable.
Perspex/Perspex,Perspex/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,akrisiun/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia
src/Avalonia.OpenGL/Angle/AngleEglInterface.cs
src/Avalonia.OpenGL/Angle/AngleEglInterface.cs
using System; using System.Runtime.InteropServices; using Avalonia.Platform; using Avalonia.Platform.Interop; namespace Avalonia.OpenGL.Angle { public class AngleEglInterface : EglInterface { [DllImport("libegl.dll", CharSet = CharSet.Ansi)] static extern IntPtr eglGetProcAddress(string proc); public AngleEglInterface() : base(LoadAngle()) { } static Func<string, IntPtr> LoadAngle() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { throw new PlatformNotSupportedException(); } else { var disp = eglGetProcAddress("eglGetPlatformDisplayEXT"); if (disp == IntPtr.Zero) { throw new OpenGlException("libegl.dll doesn't have eglGetPlatformDisplayEXT entry point"); } return eglGetProcAddress; } } } }
using System; using System.Runtime.InteropServices; using Avalonia.Platform; using Avalonia.Platform.Interop; namespace Avalonia.OpenGL.Angle { public class AngleEglInterface : EglInterface { [DllImport("libegl.dll", CharSet = CharSet.Ansi)] static extern IntPtr eglGetProcAddress(string proc); public AngleEglInterface() : base(LoadAngle()) { } static Func<string, IntPtr> LoadAngle() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) throw new PlatformNotSupportedException(); { var disp = eglGetProcAddress("eglGetPlatformDisplayEXT"); if (disp == IntPtr.Zero) throw new OpenGlException("libegl.dll doesn't have eglGetPlatformDisplayEXT entry point"); return eglGetProcAddress; } } } }
mit
C#
d86c6ed9d8d4c3ed5f245a100925aa806f57bcc5
Add missing interface change
mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype
src/Glimpse.Web.Common/Context/IHttpRequest.cs
src/Glimpse.Web.Common/Context/IHttpRequest.cs
using System; using System.Collections.Generic; using System.IO; namespace Glimpse.Web { public interface IHttpRequest { Stream Body { get; } string Accept { get; } string Method { get; } string RemoteIpAddress { get; } int? RemotePort { get; } bool IsLocal { get; } string Scheme { get; } string Host { get; } string PathBase { get; } string Path { get; } string QueryString { get; } string GetQueryString(string key); IList<string> GetQueryStringValues(string key); string GetHeader(string key); IList<string> GetHeaderValues(string key); IEnumerable<string> HeaderKeys { get; } string GetCookie(string key); IList<string> GetCookieValues(string key); IEnumerable<string> CookieKeys { get; } } }
using System; using System.Collections.Generic; using System.IO; namespace Glimpse.Web { public interface IHttpRequest { Stream Body { get; } string Accept { get; } string Method { get; } string RemoteIpAddress { get; } int? RemotePort { get; } string Scheme { get; } string Host { get; } string PathBase { get; } string Path { get; } string QueryString { get; } string GetQueryString(string key); IList<string> GetQueryStringValues(string key); string GetHeader(string key); IList<string> GetHeaderValues(string key); IEnumerable<string> HeaderKeys { get; } string GetCookie(string key); IList<string> GetCookieValues(string key); IEnumerable<string> CookieKeys { get; } } }
mit
C#
6eefd3f967bf29e4c4a99722e9ab94cbffe12114
Fix for wrong time zone
dddotnet/meetup2markdown
src/MeetupToMarkdownConverter/Meetup/Helper.cs
src/MeetupToMarkdownConverter/Meetup/Helper.cs
namespace MeetupToMarkdownConverter.Meetup { using Models; using System; using System.Text; internal class Helper { #pragma warning disable SA1008 // StyleCop does not knor Tuples internal static (string markdown, string filename) ConvertEventToMarkdown(Event meetup) #pragma warning restore SA1008 // StyleCop does not knor Tuples { StringBuilder markdown = new StringBuilder(); var germanTimeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"); var date = TimeZoneInfo.ConvertTimeFromUtc(new DateTime((meetup.Time * 10000) + 621355968000000000),germanTimeZone); var filename = date.ToString("yyyy-MM-dd") + "-" + meetup.Name.ToLower().Trim().Replace(" ", "-") + ".markdown"; var placeQuery = System.Net.WebUtility.UrlEncode($"{meetup.Venue.Address_1}, {meetup.Venue.City}, {meetup.Venue.Country}"); var placelink = $"https://maps.google.com/maps?f=q&hl=en&q={placeQuery}"; var dateString = date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"); markdown.AppendLine("---"); markdown.AppendLine("layout: postnew"); markdown.AppendLine($"title: \"{meetup.Name}\""); markdown.AppendLine("categories: treffen"); markdown.AppendLine($"date: {dateString}"); markdown.AppendLine("speaker: \"siehe Meetup\""); markdown.AppendLine($"place: {meetup.Venue.Name}"); markdown.AppendLine($"placelink: {placelink}"); markdown.AppendLine("---"); markdown.AppendLine(string.Empty); markdown.AppendLine($"## {meetup.Name}"); markdown.AppendLine(meetup.Description); markdown.AppendLine(string.Empty); markdown.AppendLine("## Ort und Zeit"); markdown.AppendLine($"Wir treffen uns am {date.ToString("dd. MMMM yyyy")} um {date.ToString("HH:mm")} Uhr bei [{meetup.Venue.Name}]({placelink}). "); markdown.AppendLine($"Die Gästeliste wird auf [Meetup]({meetup.Link}) verwaltet."); return (markdown: markdown.ToString(), filename: filename); } } }
namespace MeetupToMarkdownConverter.Meetup { using Models; using System; using System.Text; internal class Helper { #pragma warning disable SA1008 // StyleCop does not knor Tuples internal static (string markdown, string filename) ConvertEventToMarkdown(Event meetup) #pragma warning restore SA1008 // StyleCop does not knor Tuples { StringBuilder markdown = new StringBuilder(); var date = new DateTime((meetup.Time * 10000) + 621355968000000000).ToLocalTime(); var filename = date.ToString("yyyy-MM-dd") + "-" + meetup.Name.ToLower().Trim().Replace(" ", "-") + ".markdown"; var placeQuery = System.Net.WebUtility.UrlEncode($"{meetup.Venue.Address_1}, {meetup.Venue.City}, {meetup.Venue.Country}"); var placelink = $"https://maps.google.com/maps?f=q&hl=en&q={placeQuery}"; var dateString = date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"); markdown.AppendLine("---"); markdown.AppendLine("layout: postnew"); markdown.AppendLine($"title: \"{meetup.Name}\""); markdown.AppendLine("categories: treffen"); markdown.AppendLine($"date: {dateString}"); markdown.AppendLine("speaker: \"siehe Meetup\""); markdown.AppendLine($"place: {meetup.Venue.Name}"); markdown.AppendLine($"placelink: {placelink}"); markdown.AppendLine("---"); markdown.AppendLine(string.Empty); markdown.AppendLine($"## {meetup.Name}"); markdown.AppendLine(meetup.Description); markdown.AppendLine(string.Empty); markdown.AppendLine("## Ort und Zeit"); markdown.AppendLine($"Wir treffen uns am {date.ToString("dd. MMMM yyyy")} um {date.ToString("HH:mm")} Uhr bei [{meetup.Venue.Name}]({placelink}). "); markdown.AppendLine($"Die Gästeliste wird auf [Meetup]({meetup.Link}) verwaltet."); return (markdown: markdown.ToString(), filename: filename); } } }
mit
C#
d97cdedfadbb77157cfce80812c4bfbe123f5841
Make GetValue method handle value types
meridiumlabs/episerver.migration
Meridium.EPiServer.Migration/Support/SourcePage.cs
Meridium.EPiServer.Migration/Support/SourcePage.cs
using System.Linq; using EPiServer.Core; namespace Meridium.EPiServer.Migration.Support { public class SourcePage { public string TypeName { get; set; } public PropertyDataCollection Properties { get; set; } public TValue GetValue<TValue>(string propertyName, TValue @default = default(TValue)) { var data = Properties != null ? Properties.Get(propertyName) : null; if (data != null && data.Value is TValue) return (TValue) data.Value; return @default; } public TValue GetValueWithFallback<TValue>(params string[] properties) { var property = properties.SkipWhile(p => !Properties.HasValue(p)).FirstOrDefault(); return (property != null) ? GetValue<TValue>(property) : default(TValue); } } internal static class PropertyDataExtensions { public static bool HasValue(this PropertyDataCollection self, string key) { var property = self.Get(key); if (property == null) return false; return !(property.IsNull || string.IsNullOrWhiteSpace(property.ToString())); } } }
using System.Linq; using EPiServer.Core; namespace Meridium.EPiServer.Migration.Support { public class SourcePage { public string TypeName { get; set; } public PropertyDataCollection Properties { get; set; } public TValue GetValue<TValue>(string propertyName, TValue @default = default(TValue)) where TValue : class { var data = Properties != null ? Properties.Get(propertyName) : null; return (data != null) ? (data.Value as TValue) : @default; } public TValue GetValueWithFallback<TValue>(params string[] properties) where TValue : class { var property = properties.SkipWhile(p => !Properties.HasValue(p)).FirstOrDefault(); return (property != null) ? GetValue<TValue>(property) : null; } } internal static class PropertyDataExtensions { public static bool HasValue(this PropertyDataCollection self, string key) { var property = self.Get(key); if (property == null) return false; return !(property.IsNull || string.IsNullOrWhiteSpace(property.ToString())); } } }
mit
C#
c3fecd66f855fe541c9e9274cef11b91cf35550b
test update
maxtoroq/MvcCodeRouting,Dzmuh/MvcCodeRouting
MvcCodeRouting.Tests/Routing/ActionNameBehavior.cs
MvcCodeRouting.Tests/Routing/ActionNameBehavior.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Mvc; using System.Web.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MvcCodeRouting.Tests.Routing { [TestClass] public class ActionNameBehavior { RouteCollection routes; UrlHelper Url; [TestInitialize] public void Init() { this.routes = TestUtil.GetRouteCollection(); this.Url = TestUtil.CreateUrlHelper(routes); } [TestMethod] public void EmptyUnlessUsingVerbAttributeInWebApi() { var controller = typeof(ActionName.ActionName4Controller); // TODO: throw new NotImplementedException(); } [TestMethod] public void UseActionAliasMvc() { var controller = typeof(ActionName.ActionName1Controller); routes.Clear(); routes.MapCodeRoutes(controller, new CodeRoutingSettings { RootOnly = true }); Assert.IsNotNull(Url.Action("Bar", controller)); controller = typeof(ActionName.ActionName3Controller); routes.Clear(); routes.MapCodeRoutes(controller, new CodeRoutingSettings { RootOnly = true }); Assert.IsNotNull(Url.Action("Bar", controller)); } [TestMethod] public void UseActionAliasWebApi() { var controller = typeof(ActionName.ActionName2Controller); routes.Clear(); routes.MapCodeRoutes(controller, new CodeRoutingSettings { RootOnly = true }); Assert.IsNotNull(Url.HttpRouteUrl(null, controller, new { action = "Bar" })); } } } namespace MvcCodeRouting.Tests.Routing.ActionName { public class ActionName1Controller : Controller { [ActionName("Bar")] public void Foo() { } } public class ActionName2Controller : System.Web.Http.ApiController { [System.Web.Http.HttpGet] [System.Web.Http.ActionName("Bar")] public void Foo() { } } public class ActionName3Controller : AsyncController { [ActionName("Bar")] public void FooAsync() { } public void FooCompleted() { } } public class ActionName4Controller : System.Web.Http.ApiController { public void Get() { } [HttpGet] public void Find() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Mvc; using System.Web.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MvcCodeRouting.Tests.Routing { [TestClass] public class ActionNameBehavior { RouteCollection routes; UrlHelper Url; [TestInitialize] public void Init() { this.routes = new RouteCollection(); this.Url = TestUtil.CreateUrlHelper(routes); } [TestMethod] public void EmptyUnlessUsingVerbAttributeInWebApi() { var controller = typeof(ActionName.ActionName4Controller); // TODO: throw new NotImplementedException(); } [TestMethod] public void UseActionAlias() { var controller = typeof(ActionName.ActionName1Controller); routes.Clear(); routes.MapCodeRoutes(controller, new CodeRoutingSettings { RootOnly = true }); Assert.IsNotNull(Url.Action("Bar", controller)); controller = typeof(ActionName.ActionName2Controller); routes.Clear(); routes.MapCodeRoutes(controller, new CodeRoutingSettings { RootOnly = true }); Assert.IsNotNull(Url.Action("Bar", controller)); controller = typeof(ActionName.ActionName3Controller); routes.Clear(); routes.MapCodeRoutes(controller, new CodeRoutingSettings { RootOnly = true }); Assert.IsNotNull(Url.Action("Bar", controller)); } } } namespace MvcCodeRouting.Tests.Routing.ActionName { public class ActionName1Controller : Controller { [ActionName("Bar")] public void Foo() { } } public class ActionName2Controller : System.Web.Http.ApiController { [System.Web.Http.HttpGet] [System.Web.Http.ActionName("Bar")] public void Foo() { } } public class ActionName3Controller : AsyncController { [ActionName("Bar")] public void FooAsync() { } public void FooCompleted() { } } public class ActionName4Controller : System.Web.Http.ApiController { public void Get() { } [HttpGet] public void Find() { } } }
apache-2.0
C#
9af0f42dafba5b473f28c31814d79661a54146b2
Remove usage of parallelism when compiling templates (causing crash in Jurassic?).
mrydengren/templar,mrydengren/templar
src/Templar/TemplateSource.cs
src/Templar/TemplateSource.cs
using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; namespace Templar { public class TemplateSource : IContentSource { private readonly string global; private readonly Compiler compiler; private readonly TemplateFinder finder; public TemplateSource(string global, Compiler compiler, TemplateFinder finder) { this.global = global; this.compiler = compiler; this.finder = finder; } public string GetContent(HttpContextBase httpContext) { var templates = finder.Find(httpContext); using (var writer = new StringWriter()) { writer.WriteLine("!function() {"); writer.WriteLine(" var templates = {0}.templates = {{}};", global); var results = Compile(templates); foreach (var result in results) { writer.WriteLine(result); } writer.WriteLine("}();"); return writer.ToString(); } } private IEnumerable<string> Compile(IEnumerable<Template> templates) { return templates.Select(template => { string name = template.GetName(); string content = compiler.Compile(template.GetContent()); return string.Format(" templates['{0}'] = {1};", name, content); }); } } }
using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; namespace Templar { public class TemplateSource : IContentSource { private readonly string global; private readonly Compiler compiler; private readonly TemplateFinder finder; public TemplateSource(string global, Compiler compiler, TemplateFinder finder) { this.global = global; this.compiler = compiler; this.finder = finder; } public string GetContent(HttpContextBase httpContext) { var templates = finder.Find(httpContext); using (var writer = new StringWriter()) { writer.WriteLine("!function() {"); writer.WriteLine(" var templates = {0}.templates = {{}};", global); var results = Compile(templates); foreach (var result in results) { writer.WriteLine(result); } writer.WriteLine("}();"); return writer.ToString(); } } private IEnumerable<string> Compile(IEnumerable<Template> templates) { return templates.AsParallel().Select(template => { string name = template.GetName(); string content = compiler.Compile(template.GetContent()); return string.Format(" templates['{0}'] = {1};", name, content); }); } } }
mit
C#
5a0642b7480475a899789bc0becc7cbb00cd2815
Update demo program
tsolarin/readline,tsolarin/readline
src/ReadLine.Demo/Program.cs
src/ReadLine.Demo/Program.cs
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("ReadLine Library Demo"); Console.WriteLine("---------------------"); Console.WriteLine(); string[] history = new string[] { "ls -a", "dotnet run", "git init" }; ReadLine.AddHistory(history); ReadLine.AutoCompletionHandler = (t, s) => { if (t.StartsWith("git ")) return new string[] { "init", "clone", "pull", "push" }; else return null; }; string input = ReadLine.Read("(prompt)> "); Console.Write(input); } } }
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("ReadLine Library Demo"); Console.WriteLine("---------------------"); Console.WriteLine(); string[] history = new string[] { "ls -a", "dotnet run", "git init" }; ReadLine.AddHistory(history); ReadLine.AutoCompletionHandler = (t, s) => { if (t.StartsWith("git")) return new string[] { "init", "clone", "pull", "push" }; else return null; }; string input = ReadLine.Read("(prompt)> "); Console.Write(input); } } }
mit
C#
18c718d0ba41188e1e6b72325d2a67eb20ea97f3
Remove helper methods from Dependency
jamesqo/typed-xaml
src/Typed.Xaml/Dependency.cs
src/Typed.Xaml/Dependency.cs
using System; using System.Collections.Generic; using System.Windows; using System.Windows.Data; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; namespace Typed.Xaml { public static class Dependency { public static DependencyProperty Register<T, TOwner>(string name, PropertyChangedCallback<T, TOwner> callback) where TOwner : DependencyObject { return Register<T, TOwner>(name, CreateMetadata(callback)); } public static DependencyProperty Register<T, TOwner>(string name, PropertyMetadata metadata) where TOwner : DependencyObject { return DependencyProperty.Register(name, typeof(T), typeof(TOwner), metadata); } public static DependencyProperty RegisterAttached<T, TOwner, TDeclaring>(string name, PropertyChangedCallback<T, TOwner> callback) where TOwner : DependencyObject { return RegisterAttached<T, TDeclaring>(name, CreateMetadata(callback)); } public static DependencyProperty RegisterAttached<T, TDeclaring>(string name, PropertyMetadata metadata) { return DependencyProperty.RegisterAttached(name, typeof(T), typeof(TDeclaring), metadata); } } }
using System; using System.Collections.Generic; using System.Windows; using System.Windows.Data; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; namespace Typed.Xaml { public static class Dependency { private static PropertyMetadata CreateMetadata<T, TOwner>(PropertyChangedCallback<T, TOwner> callback) where TOwner : DependencyObject { return new PropertyMetadata(default(T), WrapGenericCallback(callback)); } public static DependencyProperty Register<T, TOwner>(string name, PropertyChangedCallback<T, TOwner> callback) where TOwner : DependencyObject { return Register<T, TOwner>(name, CreateMetadata(callback)); } public static DependencyProperty Register<T, TOwner>(string name, PropertyMetadata metadata) where TOwner : DependencyObject { return DependencyProperty.Register(name, typeof(T), typeof(TOwner), metadata); } public static DependencyProperty RegisterAttached<T, TOwner, TDeclaring>(string name, PropertyChangedCallback<T, TOwner> callback) where TOwner : DependencyObject { return RegisterAttached<T, TDeclaring>(name, CreateMetadata(callback)); } public static DependencyProperty RegisterAttached<T, TDeclaring>(string name, PropertyMetadata metadata) { return DependencyProperty.RegisterAttached(name, typeof(T), typeof(TDeclaring), metadata); } private static PropertyChangedCallback WrapGenericCallback<T, TOwner>(PropertyChangedCallback<T, TOwner> original) where TOwner : DependencyObject { return (o, args) => original((TOwner)o, PropertyChangedArgs<T>.CreateFrom(args)); } } }
mit
C#
510ffce1877f2cb7c7e1900764970a5838e7ff46
Handle optionargumentpairs with only option
Hammerstad/Moya
Moya.Runner.Console/OptionArgumentPair.cs
Moya.Runner.Console/OptionArgumentPair.cs
namespace Moya.Runner.Console { using System.Linq; public struct OptionArgumentPair { public string Option { get; set; } public string Argument { get; set; } public static OptionArgumentPair Create(string stringFromCommandLine) { string[] optionAndArgument = stringFromCommandLine.Split('='); return new OptionArgumentPair { Option = optionAndArgument.Any() ? optionAndArgument[0] : string.Empty, Argument = optionAndArgument.Count() > 1 ? optionAndArgument[1] : string.Empty }; } } }
namespace Moya.Runner.Console { public struct OptionArgumentPair { public string Option { get; set; } public string Argument { get; set; } public static OptionArgumentPair Create(string stringFromCommandLine) { string[] optionAndArgument = stringFromCommandLine.Split('='); return new OptionArgumentPair { Option = optionAndArgument[0], Argument = optionAndArgument[1] }; } } }
mit
C#
c1009290c6af83d39a60c4637e826d72ae8717ea
Add test to monitor HighPrecisionTickGenerator interval #106
melanchall/drywetmidi,melanchall/drymidi,melanchall/drywetmidi
DryWetMidi.Tests/Devices/Clock/TickGenerator/HighPrecisionTickGeneratorTests.cs
DryWetMidi.Tests/Devices/Clock/TickGenerator/HighPrecisionTickGeneratorTests.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Melanchall.DryWetMidi.Devices; using NUnit.Framework; namespace Melanchall.DryWetMidi.Tests.Devices { [TestFixture] public sealed class HighPrecisionTickGeneratorTests { #region Test methods [Retry(5)] [Test] public void CheckInterval([Values(1, 10, 100)] int interval) { using (var tickGenerator = new HighPrecisionTickGenerator()) { var stopwatch = new Stopwatch(); var elapsedTimes = new List<long>(150); tickGenerator.TickGenerated += (_, __) => elapsedTimes.Add(stopwatch.ElapsedMilliseconds); tickGenerator.TryStart(TimeSpan.FromMilliseconds(interval)); stopwatch.Start(); SpinWait.SpinUntil(() => elapsedTimes.Count >= 100); tickGenerator.TryStop(); stopwatch.Stop(); var time = elapsedTimes[0]; var maxDelta = 0L; var tolerance = interval * 0.5; foreach (var t in elapsedTimes) { maxDelta = Math.Max(t - time, maxDelta); time = t; } Assert.Less(maxDelta, interval + tolerance, "Max time delta is too big."); } } #endregion } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Melanchall.DryWetMidi.Devices; using NUnit.Framework; namespace Melanchall.DryWetMidi.Tests.Devices { [TestFixture] public sealed class HighPrecisionTickGeneratorTests { #region Test methods [Retry(5)] [Test] public void CheckInterval([Values(1, 10, 100)] int interval) { using (var tickGenerator = new HighPrecisionTickGenerator()) { var stopwatch = new Stopwatch(); var elapsedTimes = new List<long>(150); tickGenerator.TickGenerated += (_, __) => elapsedTimes.Add(stopwatch.ElapsedMilliseconds); tickGenerator.TryStart(TimeSpan.FromMilliseconds(interval)); stopwatch.Start(); SpinWait.SpinUntil(() => elapsedTimes.Count >= 100); tickGenerator.TryStop(); stopwatch.Stop(); var time = elapsedTimes[0]; var maxDelta = 0L; var tolerance = interval * 0.2; foreach (var t in elapsedTimes) { maxDelta = Math.Max(t - time, maxDelta); time = t; } Assert.Less(maxDelta, interval + tolerance, "Max time delta is too big."); } } #endregion } }
mit
C#
60550b73f77d0ec625c070fcd6eee395e8397149
Add missing states and xmldoc for all states' purposes
peppy/osu-new,smoogipoo/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu
osu.Game/Online/RealtimeMultiplayer/MultiplayerUserState.cs
osu.Game/Online/RealtimeMultiplayer/MultiplayerUserState.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. namespace osu.Game.Online.RealtimeMultiplayer { public enum MultiplayerUserState { /// <summary> /// The user is idle and waiting for something to happen (or watching the match but not participating). /// </summary> Idle, /// <summary> /// The user has marked themselves as ready to participate and should be considered for the next game start. /// </summary> Ready, /// <summary> /// The server is waiting for this user to finish loading. This is a reserved state, and is set by the server. /// </summary> /// <remarks> /// All users in <see cref="Ready"/> state when the game start will be transitioned to this state. /// All users in this state need to transition to <see cref="Loaded"/> before the game can start. /// </remarks> WaitingForLoad, /// <summary> /// The user's client has marked itself as loaded and ready to begin gameplay. /// </summary> Loaded, /// <summary> /// The user is currently playing in a game. This is a reserved state, and is set by the server. /// </summary> /// <remarks> /// Once there are no remaining <see cref="WaitingForLoad"/> users, all users in <see cref="Loaded"/> state will be transitioned to this state. /// At this point the game will start for all users. /// </remarks> Playing, /// <summary> /// The user has finished playing and is ready to view results. /// </summary> /// <remarks> /// Once all users transition from <see cref="Playing"/> to this state, the game will end and results will be distributed. /// All users will be transitioned to the <see cref="Results"/> state. /// </remarks> FinishedPlay, /// <summary> /// The user is currently viewing results. This is a reserved state, and is set by the server. /// </summary> Results, } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. namespace osu.Game.Online.RealtimeMultiplayer { public enum MultiplayerUserState { Idle, Ready, WaitingForLoad, Loaded, Playing, Results, } }
mit
C#
8de639ccbf793f0835d2a1d994bfaa6fb8216cf1
add basic version info
billtowin/mega-epic-super-tankz,billtowin/mega-epic-super-tankz
modules/AppCore/1/main.cs
modules/AppCore/1/main.cs
//----------------------------------------------------------------------------- // Copyright (c) 2013 GarageGames, LLC // // 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. //----------------------------------------------------------------------------- function AppCore::create( %this ) { // Load system scripts exec("./scripts/constants.cs"); exec("./scripts/defaultPreferences.cs"); exec("./scripts/canvas.cs"); exec("./scripts/openal.cs"); // Initialize the canvas initializeCanvas("Mega Epic Super Tankz v0.01 ALPHA"); // Set the canvas color Canvas.BackgroundColor = "CornflowerBlue"; Canvas.UseBackgroundColor = true; // Initialize audio initializeOpenAL(); ModuleDatabase.loadExplicit("MyModule"); } //----------------------------------------------------------------------------- function AppCore::destroy( %this ) { }
//----------------------------------------------------------------------------- // Copyright (c) 2013 GarageGames, LLC // // 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. //----------------------------------------------------------------------------- function AppCore::create( %this ) { // Load system scripts exec("./scripts/constants.cs"); exec("./scripts/defaultPreferences.cs"); exec("./scripts/canvas.cs"); exec("./scripts/openal.cs"); // Initialize the canvas initializeCanvas("Torque 2D"); // Set the canvas color Canvas.BackgroundColor = "CornflowerBlue"; Canvas.UseBackgroundColor = true; // Initialize audio initializeOpenAL(); ModuleDatabase.loadExplicit("MyModule"); } //----------------------------------------------------------------------------- function AppCore::destroy( %this ) { }
mit
C#
7aab33f6f0f55413be7db53ed362321dfc2e73dd
Remove numeric formatting from benchmarks.
zaccharles/nodatime,zaccharles/nodatime,nodatime/nodatime,zaccharles/nodatime,zaccharles/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,malcolmr/nodatime,malcolmr/nodatime,nodatime/nodatime,zaccharles/nodatime,jskeet/nodatime,zaccharles/nodatime,jskeet/nodatime,BenJenkinson/nodatime
src/NodaTime.Benchmarks/NodaTimeTests/InstantBenchmarks.cs
src/NodaTime.Benchmarks/NodaTimeTests/InstantBenchmarks.cs
// Copyright 2011 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using System.Globalization; using NodaTime.Benchmarks.Framework; namespace NodaTime.Benchmarks.NodaTimeTests { internal class InstantBenchmarks { private static readonly Instant Sample = Instant.FromUtc(2011, 8, 24, 12, 29, 30); private static readonly Offset SmallOffset = Offset.FromHours(1); private static readonly Offset LargePositiveOffset = Offset.FromHours(12); private static readonly Offset LargeNegativeOffset = Offset.FromHours(-13); private static readonly DateTimeZone London = DateTimeZoneProviders.Tzdb["Europe/London"]; [Benchmark] public void ToStringIso() { Sample.ToString("g", CultureInfo.InvariantCulture); } [Benchmark] public void PlusDuration() { Sample.Plus(Duration.Epsilon); } [Benchmark] public void PlusOffset() { Sample.Plus(Offset.Zero); } [Benchmark] public void InUtc() { Sample.InUtc(); } [Benchmark] public void InZoneLondon() { Sample.InZone(London); } [Benchmark] public void WithOffset_SameUtcDay() { Sample.WithOffset(SmallOffset); } [Benchmark] public void WithOffset_NextUtcDay() { Sample.WithOffset(LargePositiveOffset); } [Benchmark] public void WithOffset_PreviousUtcDay() { Sample.WithOffset(LargeNegativeOffset); } } }
// Copyright 2011 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using System.Globalization; using NodaTime.Benchmarks.Framework; namespace NodaTime.Benchmarks.NodaTimeTests { internal class InstantBenchmarks { private static readonly Instant Sample = Instant.FromUtc(2011, 8, 24, 12, 29, 30); private static readonly Offset SmallOffset = Offset.FromHours(1); private static readonly Offset LargePositiveOffset = Offset.FromHours(12); private static readonly Offset LargeNegativeOffset = Offset.FromHours(-13); private static readonly DateTimeZone London = DateTimeZoneProviders.Tzdb["Europe/London"]; [Benchmark] public void ToStringIso() { Sample.ToString("g", CultureInfo.InvariantCulture); } [Benchmark] public void ToStringNumericWithThousandsSeparator() { Sample.ToString("n", CultureInfo.InvariantCulture); } [Benchmark] public void ToStringNumericWithoutThousandsSeparator() { Sample.ToString("d", CultureInfo.InvariantCulture); } [Benchmark] public void PlusDuration() { Sample.Plus(Duration.Epsilon); } [Benchmark] public void PlusOffset() { Sample.Plus(Offset.Zero); } [Benchmark] public void InUtc() { Sample.InUtc(); } [Benchmark] public void InZoneLondon() { Sample.InZone(London); } [Benchmark] public void WithOffset_SameUtcDay() { Sample.WithOffset(SmallOffset); } [Benchmark] public void WithOffset_NextUtcDay() { Sample.WithOffset(LargePositiveOffset); } [Benchmark] public void WithOffset_PreviousUtcDay() { Sample.WithOffset(LargeNegativeOffset); } } }
apache-2.0
C#
857559f9223c689405b00e80f2ebdda850e0d42a
Add System.Security namespace to Interop.MessageBox.cs
shahid-pk/corefx,elijah6/corefx,elijah6/corefx,stone-li/corefx,fgreinacher/corefx,josguil/corefx,twsouthwick/corefx,shahid-pk/corefx,zhenlan/corefx,rubo/corefx,YoupHulsebos/corefx,SGuyGe/corefx,stormleoxia/corefx,kkurni/corefx,benpye/corefx,parjong/corefx,billwert/corefx,arronei/corefx,fernando-rodriguez/corefx,pgavlin/corefx,CloudLens/corefx,stephenmichaelf/corefx,lggomez/corefx,richlander/corefx,Petermarcu/corefx,MaggieTsang/corefx,YoupHulsebos/corefx,chaitrakeshav/corefx,JosephTremoulet/corefx,benjamin-bader/corefx,SGuyGe/corefx,axelheer/corefx,fffej/corefx,heXelium/corefx,lggomez/corefx,tijoytom/corefx,rjxby/corefx,CherryCxldn/corefx,Chrisboh/corefx,billwert/corefx,lydonchandra/corefx,mmitche/corefx,jhendrixMSFT/corefx,jeremymeng/corefx,xuweixuwei/corefx,ellismg/corefx,uhaciogullari/corefx,andyhebear/corefx,manu-silicon/corefx,cartermp/corefx,bitcrazed/corefx,ericstj/corefx,DnlHarvey/corefx,arronei/corefx,weltkante/corefx,ellismg/corefx,dotnet-bot/corefx,vrassouli/corefx,the-dwyer/corefx,ravimeda/corefx,iamjasonp/corefx,mellinoe/corefx,comdiv/corefx,khdang/corefx,cnbin/corefx,Ermiar/corefx,nchikanov/corefx,mmitche/corefx,pallavit/corefx,jlin177/corefx,shimingsg/corefx,jhendrixMSFT/corefx,shana/corefx,jhendrixMSFT/corefx,dotnet-bot/corefx,Alcaro/corefx,YoupHulsebos/corefx,matthubin/corefx,kkurni/corefx,fgreinacher/corefx,axelheer/corefx,anjumrizwi/corefx,shahid-pk/corefx,shmao/corefx,tstringer/corefx,ericstj/corefx,chaitrakeshav/corefx,alexperovich/corefx,andyhebear/corefx,n1ghtmare/corefx,JosephTremoulet/corefx,stephenmichaelf/corefx,wtgodbe/corefx,yizhang82/corefx,tijoytom/corefx,marksmeltzer/corefx,uhaciogullari/corefx,ravimeda/corefx,Yanjing123/corefx,690486439/corefx,ericstj/corefx,rajansingh10/corefx,mellinoe/corefx,axelheer/corefx,Frank125/corefx,vidhya-bv/corefx-sorting,cnbin/corefx,axelheer/corefx,marksmeltzer/corefx,pallavit/corefx,twsouthwick/corefx,twsouthwick/corefx,mafiya69/corefx,weltkante/corefx,dtrebbien/corefx,shana/corefx,rahku/corefx,Petermarcu/corefx,fernando-rodriguez/corefx,krk/corefx,tijoytom/corefx,bpschoch/corefx,Ermiar/corefx,EverlessDrop41/corefx,shrutigarg/corefx,benpye/corefx,elijah6/corefx,krk/corefx,Jiayili1/corefx,dhoehna/corefx,dhoehna/corefx,PatrickMcDonald/corefx,anjumrizwi/corefx,n1ghtmare/corefx,stephenmichaelf/corefx,shahid-pk/corefx,zhangwenquan/corefx,zmaruo/corefx,MaggieTsang/corefx,adamralph/corefx,ericstj/corefx,PatrickMcDonald/corefx,vs-team/corefx,rjxby/corefx,yizhang82/corefx,shmao/corefx,stone-li/corefx,tstringer/corefx,misterzik/corefx,chenkennt/corefx,destinyclown/corefx,jcme/corefx,iamjasonp/corefx,kkurni/corefx,bitcrazed/corefx,lggomez/corefx,weltkante/corefx,stone-li/corefx,benjamin-bader/corefx,gkhanna79/corefx,pallavit/corefx,chenxizhang/corefx,YoupHulsebos/corefx,gabrielPeart/corefx,the-dwyer/corefx,erpframework/corefx,oceanho/corefx,benpye/corefx,nbarbettini/corefx,marksmeltzer/corefx,fffej/corefx,Chrisboh/corefx,Winsto/corefx,vidhya-bv/corefx-sorting,xuweixuwei/corefx,mellinoe/corefx,comdiv/corefx,Winsto/corefx,parjong/corefx,dhoehna/corefx,stone-li/corefx,richlander/corefx,nelsonsar/corefx,MaggieTsang/corefx,uhaciogullari/corefx,dkorolev/corefx,shrutigarg/corefx,bpschoch/corefx,mellinoe/corefx,kkurni/corefx,brett25/corefx,690486439/corefx,nelsonsar/corefx,shmao/corefx,alexandrnikitin/corefx,BrennanConroy/corefx,mafiya69/corefx,larsbj1988/corefx,KrisLee/corefx,jeremymeng/corefx,DnlHarvey/corefx,jhendrixMSFT/corefx,ravimeda/corefx,bitcrazed/corefx,shimingsg/corefx,shiftkey-tester/corefx,shimingsg/corefx,rahku/corefx,ravimeda/corefx,tstringer/corefx,kkurni/corefx,ellismg/corefx,akivafr123/corefx,shimingsg/corefx,ViktorHofer/corefx,janhenke/corefx,wtgodbe/corefx,jlin177/corefx,alexperovich/corefx,MaggieTsang/corefx,bpschoch/corefx,tstringer/corefx,Priya91/corefx-1,VPashkov/corefx,KrisLee/corefx,Chrisboh/corefx,vidhya-bv/corefx-sorting,thiagodin/corefx,wtgodbe/corefx,rahku/corefx,anjumrizwi/corefx,alexperovich/corefx,spoiledsport/corefx,Ermiar/corefx,josguil/corefx,CherryCxldn/corefx,ravimeda/corefx,JosephTremoulet/corefx,dotnet-bot/corefx,dkorolev/corefx,claudelee/corefx,ellismg/corefx,stephenmichaelf/corefx,jcme/corefx,zmaruo/corefx,tijoytom/corefx,benjamin-bader/corefx,nbarbettini/corefx,JosephTremoulet/corefx,cartermp/corefx,BrennanConroy/corefx,lggomez/corefx,mokchhya/corefx,Jiayili1/corefx,matthubin/corefx,dhoehna/corefx,arronei/corefx,adamralph/corefx,jhendrixMSFT/corefx,VPashkov/corefx,khdang/corefx,matthubin/corefx,vs-team/corefx,YoupHulsebos/corefx,richlander/corefx,richlander/corefx,axelheer/corefx,zhenlan/corefx,MaggieTsang/corefx,krk/corefx,manu-silicon/corefx,mmitche/corefx,gkhanna79/corefx,weltkante/corefx,gregg-miskelly/corefx,claudelee/corefx,shahid-pk/corefx,rahku/corefx,mazong1123/corefx,kyulee1/corefx,SGuyGe/corefx,nbarbettini/corefx,ptoonen/corefx,misterzik/corefx,mmitche/corefx,rjxby/corefx,Jiayili1/corefx,shmao/corefx,khdang/corefx,pgavlin/corefx,gkhanna79/corefx,cydhaselton/corefx,nbarbettini/corefx,gabrielPeart/corefx,benpye/corefx,kyulee1/corefx,zhenlan/corefx,stephenmichaelf/corefx,SGuyGe/corefx,parjong/corefx,CloudLens/corefx,BrennanConroy/corefx,vijaykota/corefx,nbarbettini/corefx,huanjie/corefx,krytarowski/corefx,erpframework/corefx,erpframework/corefx,khdang/corefx,seanshpark/corefx,Petermarcu/corefx,parjong/corefx,dkorolev/corefx,Petermarcu/corefx,thiagodin/corefx,alphonsekurian/corefx,YoupHulsebos/corefx,benjamin-bader/corefx,dotnet-bot/corefx,gabrielPeart/corefx,rahku/corefx,wtgodbe/corefx,iamjasonp/corefx,nchikanov/corefx,dkorolev/corefx,zhenlan/corefx,alexandrnikitin/corefx,rajansingh10/corefx,dtrebbien/corefx,iamjasonp/corefx,alexperovich/corefx,yizhang82/corefx,rubo/corefx,alexandrnikitin/corefx,manu-silicon/corefx,690486439/corefx,cydhaselton/corefx,YoupHulsebos/corefx,mafiya69/corefx,jmhardison/corefx,the-dwyer/corefx,dsplaisted/corefx,scott156/corefx,chenkennt/corefx,ViktorHofer/corefx,alexperovich/corefx,stormleoxia/corefx,ViktorHofer/corefx,claudelee/corefx,nelsonsar/corefx,scott156/corefx,lydonchandra/corefx,Frank125/corefx,viniciustaveira/corefx,manu-silicon/corefx,alexandrnikitin/corefx,gkhanna79/corefx,ericstj/corefx,mellinoe/corefx,elijah6/corefx,690486439/corefx,iamjasonp/corefx,Yanjing123/corefx,krk/corefx,n1ghtmare/corefx,ericstj/corefx,huanjie/corefx,CherryCxldn/corefx,seanshpark/corefx,chaitrakeshav/corefx,pallavit/corefx,jeremymeng/corefx,cydhaselton/corefx,cnbin/corefx,ellismg/corefx,krytarowski/corefx,nchikanov/corefx,s0ne0me/corefx,mazong1123/corefx,mazong1123/corefx,oceanho/corefx,mafiya69/corefx,shahid-pk/corefx,twsouthwick/corefx,janhenke/corefx,mafiya69/corefx,mokchhya/corefx,scott156/corefx,weltkante/corefx,twsouthwick/corefx,akivafr123/corefx,jeremymeng/corefx,zhangwenquan/corefx,fernando-rodriguez/corefx,MaggieTsang/corefx,vijaykota/corefx,ptoonen/corefx,comdiv/corefx,ravimeda/corefx,lggomez/corefx,mokchhya/corefx,dsplaisted/corefx,dhoehna/corefx,dotnet-bot/corefx,bitcrazed/corefx,the-dwyer/corefx,dhoehna/corefx,Priya91/corefx-1,mazong1123/corefx,vijaykota/corefx,claudelee/corefx,thiagodin/corefx,heXelium/corefx,parjong/corefx,billwert/corefx,tijoytom/corefx,marksmeltzer/corefx,ptoonen/corefx,CherryCxldn/corefx,stone-li/corefx,nbarbettini/corefx,jlin177/corefx,shimingsg/corefx,stone-li/corefx,DnlHarvey/corefx,mokchhya/corefx,zhangwenquan/corefx,jmhardison/corefx,ericstj/corefx,shiftkey-tester/corefx,JosephTremoulet/corefx,shiftkey-tester/corefx,cnbin/corefx,Chrisboh/corefx,shimingsg/corefx,pallavit/corefx,mmitche/corefx,Winsto/corefx,xuweixuwei/corefx,billwert/corefx,Chrisboh/corefx,gregg-miskelly/corefx,shiftkey-tester/corefx,DnlHarvey/corefx,dhoehna/corefx,yizhang82/corefx,Yanjing123/corefx,seanshpark/corefx,jcme/corefx,destinyclown/corefx,Petermarcu/corefx,CloudLens/corefx,popolan1986/corefx,seanshpark/corefx,cartermp/corefx,andyhebear/corefx,lydonchandra/corefx,krytarowski/corefx,spoiledsport/corefx,the-dwyer/corefx,jhendrixMSFT/corefx,Alcaro/corefx,matthubin/corefx,seanshpark/corefx,adamralph/corefx,manu-silicon/corefx,Priya91/corefx-1,SGuyGe/corefx,janhenke/corefx,Jiayili1/corefx,pallavit/corefx,richlander/corefx,marksmeltzer/corefx,alphonsekurian/corefx,khdang/corefx,shmao/corefx,elijah6/corefx,josguil/corefx,cartermp/corefx,SGuyGe/corefx,rjxby/corefx,nchikanov/corefx,pgavlin/corefx,josguil/corefx,chenxizhang/corefx,krk/corefx,jlin177/corefx,vs-team/corefx,popolan1986/corefx,viniciustaveira/corefx,alphonsekurian/corefx,ViktorHofer/corefx,ViktorHofer/corefx,jmhardison/corefx,jmhardison/corefx,VPashkov/corefx,tijoytom/corefx,viniciustaveira/corefx,chenkennt/corefx,yizhang82/corefx,lggomez/corefx,shmao/corefx,axelheer/corefx,jhendrixMSFT/corefx,Jiayili1/corefx,vrassouli/corefx,cydhaselton/corefx,jcme/corefx,seanshpark/corefx,mmitche/corefx,fffej/corefx,weltkante/corefx,heXelium/corefx,pgavlin/corefx,the-dwyer/corefx,rubo/corefx,mellinoe/corefx,cydhaselton/corefx,Chrisboh/corefx,fffej/corefx,KrisLee/corefx,nbarbettini/corefx,destinyclown/corefx,tstringer/corefx,jcme/corefx,rjxby/corefx,krytarowski/corefx,cartermp/corefx,parjong/corefx,rubo/corefx,dotnet-bot/corefx,lydonchandra/corefx,erpframework/corefx,rajansingh10/corefx,brett25/corefx,josguil/corefx,shana/corefx,jeremymeng/corefx,stephenmichaelf/corefx,shimingsg/corefx,benpye/corefx,vidhya-bv/corefx-sorting,gregg-miskelly/corefx,alexperovich/corefx,n1ghtmare/corefx,misterzik/corefx,Petermarcu/corefx,krytarowski/corefx,ptoonen/corefx,mmitche/corefx,gkhanna79/corefx,Priya91/corefx-1,Priya91/corefx-1,mazong1123/corefx,DnlHarvey/corefx,brett25/corefx,billwert/corefx,jcme/corefx,tstringer/corefx,KrisLee/corefx,gkhanna79/corefx,dtrebbien/corefx,vidhya-bv/corefx-sorting,benjamin-bader/corefx,stormleoxia/corefx,spoiledsport/corefx,huanjie/corefx,s0ne0me/corefx,marksmeltzer/corefx,MaggieTsang/corefx,Frank125/corefx,stephenmichaelf/corefx,kkurni/corefx,EverlessDrop41/corefx,PatrickMcDonald/corefx,iamjasonp/corefx,chaitrakeshav/corefx,vrassouli/corefx,gkhanna79/corefx,Yanjing123/corefx,rjxby/corefx,shmao/corefx,nchikanov/corefx,Petermarcu/corefx,n1ghtmare/corefx,ptoonen/corefx,zhenlan/corefx,rahku/corefx,benpye/corefx,nchikanov/corefx,ravimeda/corefx,alphonsekurian/corefx,Alcaro/corefx,richlander/corefx,janhenke/corefx,Yanjing123/corefx,shrutigarg/corefx,twsouthwick/corefx,yizhang82/corefx,billwert/corefx,cydhaselton/corefx,akivafr123/corefx,anjumrizwi/corefx,Ermiar/corefx,vrassouli/corefx,mokchhya/corefx,s0ne0me/corefx,s0ne0me/corefx,larsbj1988/corefx,mazong1123/corefx,vs-team/corefx,dtrebbien/corefx,DnlHarvey/corefx,wtgodbe/corefx,richlander/corefx,stone-li/corefx,wtgodbe/corefx,weltkante/corefx,viniciustaveira/corefx,oceanho/corefx,elijah6/corefx,janhenke/corefx,wtgodbe/corefx,rahku/corefx,zhenlan/corefx,benjamin-bader/corefx,fgreinacher/corefx,oceanho/corefx,akivafr123/corefx,krk/corefx,josguil/corefx,chenxizhang/corefx,andyhebear/corefx,mazong1123/corefx,mokchhya/corefx,heXelium/corefx,alexperovich/corefx,lggomez/corefx,popolan1986/corefx,uhaciogullari/corefx,ViktorHofer/corefx,gabrielPeart/corefx,zhangwenquan/corefx,Jiayili1/corefx,jlin177/corefx,comdiv/corefx,Priya91/corefx-1,khdang/corefx,ViktorHofer/corefx,shana/corefx,dotnet-bot/corefx,zhenlan/corefx,kyulee1/corefx,rjxby/corefx,jlin177/corefx,ptoonen/corefx,janhenke/corefx,cydhaselton/corefx,jlin177/corefx,iamjasonp/corefx,Ermiar/corefx,scott156/corefx,fgreinacher/corefx,elijah6/corefx,zmaruo/corefx,marksmeltzer/corefx,rajansingh10/corefx,EverlessDrop41/corefx,akivafr123/corefx,krk/corefx,billwert/corefx,gregg-miskelly/corefx,ptoonen/corefx,Jiayili1/corefx,VPashkov/corefx,bpschoch/corefx,larsbj1988/corefx,alphonsekurian/corefx,brett25/corefx,alphonsekurian/corefx,manu-silicon/corefx,690486439/corefx,PatrickMcDonald/corefx,stormleoxia/corefx,alexandrnikitin/corefx,JosephTremoulet/corefx,shrutigarg/corefx,alphonsekurian/corefx,krytarowski/corefx,huanjie/corefx,twsouthwick/corefx,ellismg/corefx,DnlHarvey/corefx,yizhang82/corefx,JosephTremoulet/corefx,larsbj1988/corefx,CloudLens/corefx,Alcaro/corefx,nchikanov/corefx,thiagodin/corefx,PatrickMcDonald/corefx,seanshpark/corefx,Ermiar/corefx,bitcrazed/corefx,kyulee1/corefx,the-dwyer/corefx,cartermp/corefx,rubo/corefx,Ermiar/corefx,manu-silicon/corefx,parjong/corefx,nelsonsar/corefx,Frank125/corefx,krytarowski/corefx,zmaruo/corefx,mafiya69/corefx,dsplaisted/corefx,tijoytom/corefx
src/Common/src/Interop/Windows/user32/Interop.MessageBox.cs
src/Common/src/Interop/Windows/user32/Interop.MessageBox.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Runtime.InteropServices; internal partial class Interop { internal partial class User32 { internal const int MB_ICONHAND = 0x00000010; internal const int MB_OKCANCEL = 0x00000001; internal const int MB_RIGHT = 0x00080000; internal const int MB_RTLREADING = 0x00100000; internal const int MB_TOPMOST = 0x00040000; internal const int IDCANCEL = 2; internal const int IDOK = 1; [DllImport(Interop.Libraries.User32, CharSet = CharSet.Unicode, EntryPoint = "MessageBoxW", ExactSpelling = true, SetLastError = true)] private static extern int MessageBoxSystem(IntPtr hWnd, string text, string caption, int type); [System.Security.SecurityCritical] public static int MessageBox(IntPtr hWnd, string text, string caption, int type) { try { return MessageBoxSystem(hWnd, text, caption, type); } catch (DllNotFoundException) { return 0; } catch (TypeLoadException) { return 0; } } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Runtime.InteropServices; using System.Security; internal partial class Interop { internal partial class User32 { internal const int MB_ICONHAND = 0x00000010; internal const int MB_OKCANCEL = 0x00000001; internal const int MB_RIGHT = 0x00080000; internal const int MB_RTLREADING = 0x00100000; internal const int MB_TOPMOST = 0x00040000; internal const int IDCANCEL = 2; internal const int IDOK = 1; [DllImport(Interop.Libraries.User32, CharSet = CharSet.Unicode, EntryPoint = "MessageBoxW", ExactSpelling = true, SetLastError = true)] private static extern int MessageBoxSystem(IntPtr hWnd, string text, string caption, int type); [SecurityCritical] public static int MessageBox(IntPtr hWnd, string text, string caption, int type) { try { return MessageBoxSystem(hWnd, text, caption, type); } catch (DllNotFoundException) { return 0; } catch (TypeLoadException) { return 0; } } } }
mit
C#
8c42b0216c54c55956a14c76a77d87ca4c4d068d
revert range facet changes
yonglehou/PlainElastic.Net,Yegoroff/PlainElastic.Net,mbinot/PlainElastic.Net,VirtoCommerce/PlainElastic.Net
src/PlainElastic.Net/Builders/Queries/Facets/RangeFromTo.cs
src/PlainElastic.Net/Builders/Queries/Facets/RangeFromTo.cs
using PlainElastic.Net.Utils; namespace PlainElastic.Net.Queries { public class RangeFromTo : QueryBase<RangeFromTo> { private bool hasValue; public RangeFromTo FromTo(double? from = null, double? to = null) { if (!to.HasValue && !from.HasValue) return this; hasValue = true; if (from.HasValue) { if (to.HasValue) RegisterJsonPart("{{ 'from': {0}, 'to': {1} }}", from.AsString(), to.AsString()); else RegisterJsonPart("{{ 'from': {0} }}", from.AsString()); } else RegisterJsonPart("{{ 'to': {0} }}", to.AsString()); return this; } protected override bool HasRequiredParts() { return hasValue; } protected override string ApplyJsonTemplate(string body) { return "'ranges': [ {0} ]".AltQuoteF(body); } } }
using PlainElastic.Net.Utils; namespace PlainElastic.Net.Queries { public class RangeFromTo : QueryBase<RangeFromTo> { private bool hasValue; public RangeFromTo FromTo(double? from = null, double? to = null) { if (!to.HasValue && !from.HasValue) { return this; } hasValue = true; if (from.HasValue) { if (to.HasValue) { RegisterJsonPart("{{ 'from': {0} }}, {{ 'to': {1} }}", from.AsString(), to.AsString()); } else { RegisterJsonPart("{{ 'from': {0} }}", from.AsString()); } } else { RegisterJsonPart("{{ 'to': {0} }}", to.AsString()); } return this; } protected override bool HasRequiredParts() { return hasValue; } protected override string ApplyJsonTemplate(string body) { return "'ranges': [ {0} ]".AltQuoteF(body); } } }
mit
C#
b9c4c5732b6d181595fc10537c708b0c3d9b72c6
Bump version to 0.7.2
sqt/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot
CactbotOverlay/Properties/AssemblyInfo.cs
CactbotOverlay/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.7.2.0")] [assembly: AssemblyFileVersion("0.7.2.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.7.1.0")] [assembly: AssemblyFileVersion("0.7.1.0")]
apache-2.0
C#
098e8333c281fc4e80bb9360c673cc08b611ecc8
Update MyCurrencyDotNetTests.cs
tiksn/TIKSN-Framework
TIKSN.Framework.IntegrationTests/Finance/ForeignExchange/MyCurrencyDotNetTests.cs
TIKSN.Framework.IntegrationTests/Finance/ForeignExchange/MyCurrencyDotNetTests.cs
using System; using System.Linq; using System.Threading.Tasks; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using TIKSN.Finance.ForeignExchange.Cumulative; using TIKSN.Framework.IntegrationTests; using TIKSN.Globalization; using TIKSN.Time; using Xunit; namespace TIKSN.Finance.ForeignExchange.Tests { [Collection("ServiceProviderCollection")] public class MyCurrencyDotNetTests { private readonly ITimeProvider timeProvider; private readonly ServiceProviderFixture serviceProviderFixture; public MyCurrencyDotNetTests(ServiceProviderFixture serviceProviderFixture) { this.timeProvider = serviceProviderFixture.Services.GetRequiredService<ITimeProvider>(); this.serviceProviderFixture = serviceProviderFixture ?? throw new ArgumentNullException(nameof(serviceProviderFixture)); } [Fact] public async Task GetCurrencyPairsAsync() { var currencyFactory = this.serviceProviderFixture.Services.GetRequiredService<ICurrencyFactory>(); var myCurrencyDotNet = new MyCurrencyDotNet(currencyFactory, this.timeProvider); var pairs = await myCurrencyDotNet.GetCurrencyPairsAsync(DateTimeOffset.Now, default); pairs.Count().Should().BeGreaterThan(0); } [Fact] public async Task GetExchangeRateAsync001() { var currencyFactory = this.serviceProviderFixture.Services.GetRequiredService<ICurrencyFactory>(); var myCurrencyDotNet = new MyCurrencyDotNet(currencyFactory, this.timeProvider); var amd = currencyFactory.Create("AMD"); var usd = currencyFactory.Create("USD"); var pair = new CurrencyPair(usd, amd); var rate = await myCurrencyDotNet.GetExchangeRateAsync(pair, DateTimeOffset.Now, default); rate.Should().BeGreaterThan(decimal.One); } [Fact] public async Task GetExchangeRateAsync002() { var currencyFactory = this.serviceProviderFixture.Services.GetRequiredService<ICurrencyFactory>(); var myCurrencyDotNet = new MyCurrencyDotNet(currencyFactory, this.timeProvider); var amd = currencyFactory.Create("AMD"); var usd = currencyFactory.Create("USD"); var pair = new CurrencyPair(amd, usd); var rate = await myCurrencyDotNet.GetExchangeRateAsync(pair, DateTimeOffset.Now, default); rate.Should().BeLessThan(decimal.One); } } }
using System; using System.Linq; using System.Threading.Tasks; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using TIKSN.Finance.ForeignExchange.Cumulative; using TIKSN.Framework.IntegrationTests; using TIKSN.Globalization; using TIKSN.Time; using Xunit; using Xunit.Abstractions; namespace TIKSN.Finance.ForeignExchange.Tests { public class MyCurrencyDotNetTests { private readonly ITimeProvider timeProvider; private readonly ServiceProviderFixture serviceProviderFixture; public MyCurrencyDotNetTests(ITestOutputHelper testOutputHelper, ServiceProviderFixture serviceProviderFixture) { this.timeProvider = serviceProviderFixture.Services.GetRequiredService<ITimeProvider>(); this.serviceProviderFixture = serviceProviderFixture ?? throw new ArgumentNullException(nameof(serviceProviderFixture)); } [Fact] public async Task GetCurrencyPairsAsync() { var currencyFactory = this.serviceProviderFixture.Services.GetRequiredService<ICurrencyFactory>(); var myCurrencyDotNet = new MyCurrencyDotNet(currencyFactory, this.timeProvider); var pairs = await myCurrencyDotNet.GetCurrencyPairsAsync(DateTimeOffset.Now, default); pairs.Count().Should().BeGreaterThan(0); } [Fact] public async Task GetExchangeRateAsync001() { var currencyFactory = this.serviceProviderFixture.Services.GetRequiredService<ICurrencyFactory>(); var myCurrencyDotNet = new MyCurrencyDotNet(currencyFactory, this.timeProvider); var amd = currencyFactory.Create("AMD"); var usd = currencyFactory.Create("USD"); var pair = new CurrencyPair(usd, amd); var rate = await myCurrencyDotNet.GetExchangeRateAsync(pair, DateTimeOffset.Now, default); rate.Should().BeGreaterThan(decimal.One); } [Fact] public async Task GetExchangeRateAsync002() { var currencyFactory = this.serviceProviderFixture.Services.GetRequiredService<ICurrencyFactory>(); var myCurrencyDotNet = new MyCurrencyDotNet(currencyFactory, this.timeProvider); var amd = currencyFactory.Create("AMD"); var usd = currencyFactory.Create("USD"); var pair = new CurrencyPair(amd, usd); var rate = await myCurrencyDotNet.GetExchangeRateAsync(pair, DateTimeOffset.Now, default); rate.Should().BeLessThan(decimal.One); } } }
mit
C#
b0fab18f7c9b6fa1777f7053ba45b159799d363e
fix small ui issue in console progress
yaronthurm/Backy
BackyUI/ConsoleProgress.cs
BackyUI/ConsoleProgress.cs
using System; using BackyLogic; namespace Backy { internal class ConsoleProgress : IMultiStepProgress { private string _lastText; private int _currentValue; private int _maxValue; public void Increment() { Console.Write($"\r{_lastText}".PadRight(Console.BufferWidth, ' ')); Console.Write($"\r{_lastText}: {++_currentValue}/{_maxValue}"); } public void StartBoundedStep(string text, int maxValue) { _currentValue = 0; _maxValue = maxValue; _lastText = text; Console.Write("\n" + _lastText); } public void StartStepWithoutProgress(string text) { Console.Write($"\n{text}"); } public void StartUnboundedStep(string text, Func<int, string> projection = null) { _lastText = text; Console.Write($"\n{text}"); } public void UpdateProgress(int currentValue) { Console.Write($"\r{_lastText}".PadRight(Console.BufferWidth, ' ')); Console.Write($"\r{_lastText} {currentValue}"); } } }
using System; using BackyLogic; namespace Backy { internal class ConsoleProgress : IMultiStepProgress { private string _lastText; private int _currentValue; private int _maxValue; public void Increment() { Console.Write($"\r{_lastText}".PadRight(Console.BufferWidth, ' ')); Console.Write($"\r{_lastText}: {++_currentValue}/{_maxValue}"); } public void StartBoundedStep(string text, int maxValue) { _currentValue = 0; _maxValue = maxValue; _lastText = text; Console.Write("\n" + _lastText); } public void StartStepWithoutProgress(string text) { Console.Write($"\n{text}"); } public void StartUnboundedStep(string text, Func<int, string> projection = null) { _lastText = text; Console.Write($"\n{text}"); } public void UpdateProgress(int currentValue) { Console.Write($"\r{_lastText}".PadRight(Console.BufferWidth, ' ')); Console.Write($"\r{_lastText}: {currentValue}"); } } }
mit
C#
be568ec4ed1a318fd5afbe6bee6718edcaca30b7
Verify mock
tpaananen/SeeSharpHttpLiveStreaming
SeeSharpLiveStreaming.Tests/Playlist/Tags/BaseTagTests.cs
SeeSharpLiveStreaming.Tests/Playlist/Tags/BaseTagTests.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; using Moq; using NUnit.Framework; using SeeSharpHttpLiveStreaming.Playlist; using SeeSharpHttpLiveStreaming.Playlist.Tags; using SeeSharpHttpLiveStreaming.Utils.Writers; using Version = SeeSharpHttpLiveStreaming.Playlist.Tags.BasicTags.Version; namespace SeeSharpHttpLiveStreaming.Tests.Playlist.Tags { [TestFixture] public class BaseTagTests { [Datapoints] public IEnumerable<string> Tags = TagFactory.TypeMapping.Keys.ToList(); [Test] public void TestBaseTagCreateThrowsIfStartTagIsTriedToCreate() { var line = new PlaylistLine(Tag.StartLine, Tag.StartLine); Assert.Throws<InvalidOperationException>(() => BaseTag.Create(line, 0)); } [Theory] public void TestTagsReportsHasAttributesCorrectly(string tagName) { var tag = TagFactory.Create(tagName); Assert.AreEqual(Tag.HasAttributes(tagName), tag.HasAttributes); } [Theory] public void TestSerializeThrowsIfTagCreatedWithDefaultCtor(string tagName) { var tag = TagFactory.Create(tagName); if (tag.HasAttributes) { Assert.Throws<InvalidOperationException>(() => tag.Serialize(new PlaylistWriter(new StringWriter()))); } else { Assert.DoesNotThrow(() => tag.Serialize(new PlaylistWriter(new StringWriter()))); } } [Test] public void TestSerializeThrowsSerializationExceptionIfAnErrorOccurs() { var mockWriter = new Mock<IPlaylistWriter>(); mockWriter.Setup(x => x.Write(It.IsAny<string>())).Throws<IOException>().Verifiable(); var tag = new Version(12); Assert.Throws<SerializationException>(() => tag.Serialize(mockWriter.Object)); mockWriter.VerifyAll(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; using Moq; using NUnit.Framework; using SeeSharpHttpLiveStreaming.Playlist; using SeeSharpHttpLiveStreaming.Playlist.Tags; using SeeSharpHttpLiveStreaming.Utils.Writers; using Version = SeeSharpHttpLiveStreaming.Playlist.Tags.BasicTags.Version; namespace SeeSharpHttpLiveStreaming.Tests.Playlist.Tags { [TestFixture] public class BaseTagTests { [Datapoints] public IEnumerable<string> Tags = TagFactory.TypeMapping.Keys.ToList(); [Test] public void TestBaseTagCreateThrowsIfStartTagIsTriedToCreate() { var line = new PlaylistLine(Tag.StartLine, Tag.StartLine); Assert.Throws<InvalidOperationException>(() => BaseTag.Create(line, 0)); } [Theory] public void TestTagsReportsHasAttributesCorrectly(string tagName) { var tag = TagFactory.Create(tagName); Assert.AreEqual(Tag.HasAttributes(tagName), tag.HasAttributes); } [Theory] public void TestSerializeThrowsIfTagCreatedWithDefaultCtor(string tagName) { var tag = TagFactory.Create(tagName); if (tag.HasAttributes) { Assert.Throws<InvalidOperationException>(() => tag.Serialize(new PlaylistWriter(new StringWriter()))); } else { Assert.DoesNotThrow(() => tag.Serialize(new PlaylistWriter(new StringWriter()))); } } [Test] public void TestSerializeThrowsSerializationExceptionIfAnErrorOccurs() { var mockWriter = new Mock<IPlaylistWriter>(); mockWriter.Setup(x => x.Write(It.IsAny<string>())).Throws<IOException>().Verifiable(); var tag = new Version(12); Assert.Throws<SerializationException>(() => tag.Serialize(mockWriter.Object)); } } }
mit
C#
188be8f05d1993a3b2d5756462395caa58342c9d
Add docs
wvdd007/roslyn,weltkante/roslyn,diryboy/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,wvdd007/roslyn,bartdesmet/roslyn,weltkante/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,mavasani/roslyn,sharwell/roslyn,diryboy/roslyn,eriawan/roslyn,eriawan/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,mavasani/roslyn,mavasani/roslyn,dotnet/roslyn,sharwell/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,jasonmalinowski/roslyn
src/Workspaces/Core/Portable/CodeActions/CodeActionProviderPriority.cs
src/Workspaces/Core/Portable/CodeActions/CodeActionProviderPriority.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 Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Diagnostics; namespace Microsoft.CodeAnalysis.CodeActions { internal enum CodeActionProviderPriority { /// <summary> /// No priority specified, all refactoring, code fixes, and analyzers should be run. This is equivalent /// to <see cref="Normal"/> and <see cref="High"/> combined. /// </summary> None = 0, /// <summary> /// Only normal priority refactoring, code fix providers should be run. Specifically, /// providers will be run when <see cref="CodeRefactoringProvider.IsHighPriority"/> and /// <see cref="CodeFixProvider.IsHighPriority"/> are <see langword="false"/>. <see cref="DiagnosticAnalyzer"/>s /// will be run except for <see cref="DiagnosticAnalyzerExtensions.IsCompilerAnalyzer"/>. /// </summary> Normal = 1, /// <summary> /// Only high priority refactoring, code fix providers should be run. Specifically, /// providers will be run when <see cref="CodeRefactoringProvider.IsHighPriority"/> or /// <see cref="CodeFixProvider.IsHighPriority"/> is <see langword="true"/>. /// The <see cref="DiagnosticAnalyzerExtensions.IsCompilerAnalyzer"/> <see cref="DiagnosticAnalyzer"/> /// will be run. /// </summary> High = 2, } }
// 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 Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Diagnostics; namespace Microsoft.CodeAnalysis.CodeActions { internal enum CodeActionProviderPriority { /// <summary> /// No priority specified, all refactoring, code fixes, and analyzers should be run. /// </summary> None = 0, /// <summary> /// Only normal priority refactoring, code fix providers should be run. Specifically, /// providers will be run when <see cref="CodeRefactoringProvider.IsHighPriority"/> and /// <see cref="CodeFixProvider.IsHighPriority"/> are <see langword="false"/>. <see cref="DiagnosticAnalyzer"/>s /// will be run except for <see cref="DiagnosticAnalyzerExtensions.IsCompilerAnalyzer"/>. /// </summary> Normal = 1, /// <summary> /// Only high priority refactoring, code fix providers should be run. Specifically, /// providers will be run when <see cref="CodeRefactoringProvider.IsHighPriority"/> or /// <see cref="CodeFixProvider.IsHighPriority"/> is <see langword="true"/>. /// The <see cref="DiagnosticAnalyzerExtensions.IsCompilerAnalyzer"/> <see cref="DiagnosticAnalyzer"/> /// will be run. /// </summary> High = 2, } }
mit
C#
3176f7f85d458fd6dc11324250a7d850d3b30a20
Add required validation for rich text components on server side
CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction
CollAction/ValidationAttributes/RichTextRequiredAttribute.cs
CollAction/ValidationAttributes/RichTextRequiredAttribute.cs
using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace CollAction.ValidationAttributes { public class RichTextRequiredAttribute : RequiredAttribute, IClientModelValidator { public void AddValidation(ClientModelValidationContext context) { var requiredMessage = ErrorMessage ?? $"{context.ModelMetadata.DisplayName} is required"; context.Attributes["data-val"] = "true"; context.Attributes["data-val-required"] = requiredMessage; context.Attributes["data-val-richtextrequired"] = requiredMessage; } } }
using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace CollAction.ValidationAttributes { public class RichTextRequiredAttribute : ValidationAttribute, IClientModelValidator { public void AddValidation(ClientModelValidationContext context) { context.Attributes["data-val"] = "true"; context.Attributes["data-val-richtextrequired"] = ErrorMessage ?? $"{context.ModelMetadata.DisplayName} is required"; } } }
agpl-3.0
C#
5b2cda6449c1053d9690280e4ceded1b0e608eb2
Make ErrorCode public
dotnetprojects/DotNetSiemensPLCToolBoxLibrary,Nick135/DotNetSiemensPLCToolBoxLibrary,jogibear9988/DotNetSiemensPLCToolBoxLibrary,jogibear9988/DotNetSiemensPLCToolBoxLibrary,Nick135/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,Nick135/DotNetSiemensPLCToolBoxLibrary,dotnetprojects/DotNetSiemensPLCToolBoxLibrary,jogibear9988/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,dotnetprojects/DotNetSiemensPLCToolBoxLibrary
LibNoDaveConnectionLibrary/Communication/PLCException.cs
LibNoDaveConnectionLibrary/Communication/PLCException.cs
using DotNetSiemensPLCToolBoxLibrary.Communication.LibNoDave; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DotNetSiemensPLCToolBoxLibrary.Communication { public class PLCException:Exception { int _ErrorCode; public int ErrorCode { get { return _ErrorCode; } } public PLCException (int errorCode): base(String.Format("Operation failed due to error from PLC {0}: {1}",errorCode, libnodave.daveStrerror(errorCode))) { _ErrorCode = errorCode; } public PLCException(string msg, int errorCode) : base(msg) { _ErrorCode = errorCode; } } }
using DotNetSiemensPLCToolBoxLibrary.Communication.LibNoDave; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DotNetSiemensPLCToolBoxLibrary.Communication { public class PLCException:Exception { int _ErrorCode; int ErrorCode { get { return _ErrorCode; } } public PLCException (int errorCode): base(String.Format("Operation failed due to error from PLC {0}: {1}",errorCode, libnodave.daveStrerror(errorCode))) { _ErrorCode = errorCode; } public PLCException(string msg, int errorCode) : base(msg) { _ErrorCode = errorCode; } } }
lgpl-2.1
C#
0929e613ca7e030d05c071557c4d097c34d7a34d
Order change
xonaki/NetCoreCMS,xonaki/NetCoreCMS,OnnoRokomSoftware/NetCoreCMS,xonaki/NetCoreCMS,xonaki/NetCoreCMS,OnnoRokomSoftware/NetCoreCMS,OnnoRokomSoftware/NetCoreCMS,OnnoRokomSoftware/NetCoreCMS,OnnoRokomSoftware/NetCoreCMS,xonaki/NetCoreCMS,xonaki/NetCoreCMS
NetCoreCMS.Web/Themes/Default/Shared/_ViewImports.cshtml
NetCoreCMS.Web/Themes/Default/Shared/_ViewImports.cshtml
@inherits NccRazorPage<TModel> @using NetCoreCMS.Framework.Core @using NetCoreCMS.Framework.Core.Models @using NetCoreCMS.Framework.Core.Mvc.Views @using NetCoreCMS.Framework.Core.Mvc.Views.Extensions @using NetCoreCMS.Framework.Utility @using NetCoreCMS.Framework.Modules @using NetCoreCMS.Framework.Modules.Widgets @using NetCoreCMS.Framework.Themes @using NetCoreCMS.Themes.Default.Lib @using NetCoreCMS.Framework.i18n @using Microsoft.AspNetCore.Identity @using Microsoft.Extensions.Localization @addTagHelper *, NetCoreCMS.Framework @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet @inject SignInManager<NccUser> SignInManager @inject UserManager<NccUser> UserManager @inject NccLanguageDetector LanguageDetector @inject IStringLocalizer _T
@inherits NccRazorPage<TModel> @using NetCoreCMS.Framework.Core @using NetCoreCMS.Framework.Core.Models @using NetCoreCMS.Framework.Core.Mvc.Views @using NetCoreCMS.Framework.Core.Mvc.Views.Extensions @using NetCoreCMS.Framework.Utility @using NetCoreCMS.Framework.Modules @using NetCoreCMS.Framework.Modules.Widgets @using NetCoreCMS.Framework.Themes @using NetCoreCMS.Themes.Default.Lib @using Microsoft.AspNetCore.Identity @using Microsoft.Extensions.Localization @using NetCoreCMS.Framework.i18n @addTagHelper *, NetCoreCMS.Framework @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet @inject SignInManager<NccUser> SignInManager @inject UserManager<NccUser> UserManager @inject NccLanguageDetector LanguageDetector @inject IStringLocalizer _T
bsd-3-clause
C#
00940d3297bd526cde61887cc49bf13ef8d360cf
Revert "disable automatic migration data loss"
dpesheva/QuizFactory,dpesheva/QuizFactory
QuizFactory/QuizFactory.Data/Migrations/Configuration.cs
QuizFactory/QuizFactory.Data/Migrations/Configuration.cs
namespace QuizFactory.Data.Migrations { using System; using System.Data.Entity.Migrations; using System.Linq; using QuizFactory.Data; internal sealed class Configuration : DbMigrationsConfiguration<QuizFactoryDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = true; } protected override void Seed(QuizFactoryDbContext context) { if (!context.Roles.Any()) { var seedUsers = new SeedUsers(); seedUsers.Generate(context); } var seedData = new SeedData(context); if (!context.QuizDefinitions.Any()) { foreach (var item in seedData.Quizzes) { context.QuizDefinitions.Add(item); } } if (!context.Categories.Any()) { foreach (var item in seedData.Categories) { context.Categories.Add(item); } } context.SaveChanges(); } } }
namespace QuizFactory.Data.Migrations { using System; using System.Data.Entity.Migrations; using System.Linq; using QuizFactory.Data; internal sealed class Configuration : DbMigrationsConfiguration<QuizFactoryDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = false; } protected override void Seed(QuizFactoryDbContext context) { if (!context.Roles.Any()) { var seedUsers = new SeedUsers(); seedUsers.Generate(context); } var seedData = new SeedData(context); if (!context.QuizDefinitions.Any()) { foreach (var item in seedData.Quizzes) { context.QuizDefinitions.Add(item); } } if (!context.Categories.Any()) { foreach (var item in seedData.Categories) { context.Categories.Add(item); } } context.SaveChanges(); } } }
mit
C#
dc46e276c37f61e50f1a7674ae51a0d586146c26
Fix namespace
maximegelinas-cegepsth/GEC-strawberry-sass,maximegelinas-cegepsth/GEC-strawberry-sass
StrawberrySass/src/StrawberrySass/UI/_ViewImports.cshtml
StrawberrySass/src/StrawberrySass/UI/_ViewImports.cshtml
@using StrawberrySass @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
@using AspNetCoreAngular2WebpackApp @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
mit
C#
83d83a132aba8bdae6f1c71b9ea8999eb86ebf3c
Replace map with manual initialization
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
SupportManager.Web/Features/User/CreateCommandHandler.cs
SupportManager.Web/Features/User/CreateCommandHandler.cs
using SupportManager.DAL; using SupportManager.Web.Infrastructure.CommandProcessing; namespace SupportManager.Web.Features.User { public class CreateCommandHandler : RequestHandler<CreateCommand> { private readonly SupportManagerContext db; public CreateCommandHandler(SupportManagerContext db) { this.db = db; } protected override void HandleCore(CreateCommand message) { var user = new DAL.User {DisplayName = message.Name, Login = message.Name}; db.Users.Add(user); } } }
using AutoMapper; using MediatR; using SupportManager.DAL; using SupportManager.Web.Infrastructure.CommandProcessing; namespace SupportManager.Web.Features.User { public class CreateCommandHandler : RequestHandler<CreateCommand> { private readonly SupportManagerContext db; public CreateCommandHandler(SupportManagerContext db) { this.db = db; } protected override void HandleCore(CreateCommand message) { var user = Mapper.Map<DAL.User>(message); db.Users.Add(user); } } }
mit
C#
ae59ef7e850adfa01addbd0f7df11854796c022f
Bump version #
Deadpikle/NetSparkle,Deadpikle/NetSparkle
AssemblyInfo.cs
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("NetSparkle")] [assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NetSparkle")] [assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("279448fc-5103-475e-b209-68f3268df7b5")] // 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.18.2")] [assembly: AssemblyFileVersion("0.18.2")]
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("NetSparkle")] [assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NetSparkle")] [assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("279448fc-5103-475e-b209-68f3268df7b5")] // 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.18.0")] [assembly: AssemblyFileVersion("0.18.0")]
mit
C#
30c3f0ad33d1ac94485f57c9ac4bfec8f6869fce
Add [Serializable] attribute
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
Source/NSubstitute/Exceptions/AmbiguousArgumentsException.cs
Source/NSubstitute/Exceptions/AmbiguousArgumentsException.cs
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class AmbiguousArgumentsException : SubstituteException { public static string SpecifyAllArguments = "Cannot determine argument specifications to use." + Environment.NewLine + "Please use specifications for all arguments of the same type."; public AmbiguousArgumentsException() : this(SpecifyAllArguments) { } public AmbiguousArgumentsException(string message) : base(message) { } protected AmbiguousArgumentsException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { public class AmbiguousArgumentsException : SubstituteException { public static string SpecifyAllArguments = "Cannot determine argument specifications to use." + Environment.NewLine + "Please use specifications for all arguments of the same type."; public AmbiguousArgumentsException() : this(SpecifyAllArguments) { } public AmbiguousArgumentsException(string message) : base(message) { } protected AmbiguousArgumentsException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
bsd-3-clause
C#
0ba419778db4305c9a411eb87a40102573b43fce
Update for SkipAttribute removal
rileywhite/Cilador.Fody-Examples
src/MyMixins/HelloMixin.cs
src/MyMixins/HelloMixin.cs
/*********************************************************************/ // This is free and unencumbered software released into the public domain. // // Anyone is free to copy, modify, publish, use, compile, sell, or // distribute this software, either in source code form or as a compiled // binary, for any purpose, commercial or non-commercial, and by any // means. // // In jurisdictions that recognize copyright laws, the author or authors // of this software dedicate any and all copyright interest in the // software to the public domain. We make this dedication for the benefit // of the public at large and to the detriment of our heirs and // successors. We intend this dedication to be an overt act of // relinquishment in perpetuity of all present and future rights to this // software under copyright law. // // 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 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. // // For more information, please refer to <http://unlicense.org/> /*********************************************************************/ using MyMixinDefinitions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyMixins { public class HelloMixin : IHelloWorld { public string Hello() { return "Hello World"; } } }
/*********************************************************************/ // This is free and unencumbered software released into the public domain. // // Anyone is free to copy, modify, publish, use, compile, sell, or // distribute this software, either in source code form or as a compiled // binary, for any purpose, commercial or non-commercial, and by any // means. // // In jurisdictions that recognize copyright laws, the author or authors // of this software dedicate any and all copyright interest in the // software to the public domain. We make this dedication for the benefit // of the public at large and to the detriment of our heirs and // successors. We intend this dedication to be an overt act of // relinquishment in perpetuity of all present and future rights to this // software under copyright law. // // 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 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. // // For more information, please refer to <http://unlicense.org/> /*********************************************************************/ using Bix.Mixers.Fody.ILCloning; using MyMixinDefinitions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyMixins { public class HelloMixin : IHelloWorld { [Skip] public HelloMixin() { } public string Hello() { return "Hello World"; } } }
unlicense
C#
f21358e85b50b6ba642c7354e35af923c7c6d811
Move from powershell.getchell.org to ngetchell.com
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/NicholasMGetchell.cs
src/Firehose.Web/Authors/NicholasMGetchell.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 NicholasMGetchell : IAmACommunityMember { public string FirstName => "Nicholas"; public string LastName => "Getchell"; public string ShortBioOrTagLine => "Systems Administrator"; public string StateOrRegion => "Boston, MA"; public string EmailAddress => "[email protected]"; public string TwitterHandle => "getch3028"; public string GravatarHash => "1ebff516aa68c1b3bc786bd291b8fca1"; public string GitHubHandle => "ngetchell"; public GeoPosition Position => new GeoPosition(53.073635, 8.806422); public Uri WebSite => new Uri("https://ngetchell.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://ngetchell.com/tag/powershell/rss/"); } } public string FeedLanguageCode => "en"; } }
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 NicholasMGetchell : IAmACommunityMember { public string FirstName => "Nicholas"; public string LastName => "Getchell"; public string ShortBioOrTagLine => "Analyst"; public string StateOrRegion => "Boston, MA"; public string EmailAddress => "[email protected]"; public string TwitterHandle => "getch3028"; public string GravatarHash => "1ebff516aa68c1b3bc786bd291b8fca1"; public string GitHubHandle => "ngetchell"; public GeoPosition Position => new GeoPosition(53.073635, 8.806422); public Uri WebSite => new Uri("https://powershell.getchell.org"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://powershell.getchell.org/feed/"); } } public string FeedLanguageCode => "en"; } }
mit
C#
ef8958e59e0d5777019029bfdb54b637596df9f8
add shipto to invoice
tbstudee/IntacctClient
Entities/IntacctInvoice.cs
Entities/IntacctInvoice.cs
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace Intacct.Entities { public class IntacctInvoice : IntacctObject { public string CustomerId { get; } public IntacctDate DateCreated { get; } public IntacctDate DateDue { get; } public string InvoiceNo { get; set; } public string ShipTo { get; set; } public ICollection<IntacctLineItem> Items { get; set; } public IntacctInvoice(string customerId, IntacctDate dateCreated) : this(customerId, dateCreated, null) { } public IntacctInvoice(string customerId, IntacctDate dateCreated, IntacctDate dateDue) { CustomerId = customerId; DateCreated = dateCreated; DateDue = dateDue; Items = new List<IntacctLineItem>(); } public void AddItem(IntacctLineItem item) { Items.Add(item); } internal override XObject[] ToXmlElements() { return new XObject[] { new XElement("customerid", CustomerId), new XElement("datecreated", DateCreated.ToXmlElements().Cast<object>()), new XElement("datedue", DateDue.ToXmlElements().Cast<object>()), new XElement("invoiceno", InvoiceNo), new XElement("shipto", new object[] { new XElement("contactname", ShipTo) }), new XElement("invoiceitems", Items.Select(item => new XElement("lineitem", item.ToXmlElements().Cast<object>()))), }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace Intacct.Entities { public class IntacctInvoice : IntacctObject { public string CustomerId { get; } public IntacctDate DateCreated { get; } public IntacctDate DateDue { get; } public string InvoiceNo { get; set; } public string ShipTo { get; set; } public ICollection<IntacctLineItem> Items { get; set; } public IntacctInvoice(string customerId, IntacctDate dateCreated) : this(customerId, dateCreated, null) { } public IntacctInvoice(string customerId, IntacctDate dateCreated, IntacctDate dateDue) { CustomerId = customerId; DateCreated = dateCreated; DateDue = dateDue; Items = new List<IntacctLineItem>(); } public void AddItem(IntacctLineItem item) { Items.Add(item); } internal override XObject[] ToXmlElements() { return new XObject[] { new XElement("customerid", CustomerId), new XElement("datecreated", DateCreated.ToXmlElements().Cast<object>()), new XElement("datedue", DateDue.ToXmlElements().Cast<object>()), new XElement("invoiceno", InvoiceNo), new XElement("shipto", ShipTo), new XElement("invoiceitems", Items.Select(item => new XElement("lineitem", item.ToXmlElements().Cast<object>()))), }; } } }
mit
C#
abdf9cd82eaa4cb6604dbcd2d176c300a97a0c6e
Improve Bob exercise
FetzenRndy/Creative,FetzenRndy/Creative,FetzenRndy/Creative,FetzenRndy/Creative,FetzenRndy/Creative
Exercism/csharp/bob/Bob.cs
Exercism/csharp/bob/Bob.cs
using System; using System.Linq; using System.Globalization; public static class Bob { public static string Response(string text) { var cases = new StatementCase[] { new StatementCase( "Sure.", statement => statement.IsQuestion() && !statement.IsYelled() && !statement.IsSilence() ), new StatementCase( "Whoa, chill out!", statement => statement.IsYelled() && !statement.IsQuestion() && !statement.IsSilence() ), new StatementCase( "Fine. Be that way!", statement => statement.IsSilence() && !statement.IsYelled() && !statement.IsQuestion() ), new StatementCase( "Calm down, I know wham I'm doing", statement => statement.IsYelled() && statement.IsQuestion() && !statement.IsSilence() ), new StatementCase( "Whatever.", statement => !statement.IsSilence() && !statement.IsQuestion() && !statement.IsYelled() ), }; var acutalStatement = new Statement(text); return cases .Where(currentCase => currentCase.Appiles(acutalStatement)) .First() .GetResponse(); } } public class Statement { protected string Text; public Statement(string text) { Text = text; } public bool IsYelled() { var upperCaseCharacters = Text .Where(character => char.IsUpper(character)) .Count(); return upperCaseCharacters == Text.Count(); } public bool IsQuestion() { return TextEndsWith("?"); } public bool IsSilence() { return string.IsNullOrWhiteSpace(Text); } protected bool TextEndsWith(string end) { return Text.Trim().EndsWith(end); } } public class StatementCase { protected string Response; protected Func<Statement, bool> Predicate; public StatementCase(string response, Func<Statement, bool> predicate) { Response = response; Predicate = predicate; } public bool Appiles(Statement analyzer) { return Predicate(analyzer); } public string GetResponse() { return Response; } }
using System; using System.Linq; public static class Bob { public static string Response(string text) { var cases = new StatementCase[] { new StatementCase( "Sure.", statement => statement.IsQuestion() && !statement.IsYelled() && !statement.IsSilence() ), new StatementCase( "Whoa, chill out!", statement => statement.IsYelled() && !statement.IsQuestion() && !statement.IsSilence() ), new StatementCase( "Fine. Be that way!", statement => statement.IsSilence() && !statement.IsYelled() && !statement.IsQuestion() ), new StatementCase( "Calm down, I know what I'm doing!", statement => statement.IsYelled() && statement.IsQuestion() && !statement.IsSilence() ), new StatementCase( "Whatever.", statement => !statement.IsSilence() && !statement.IsQuestion() && !statement.IsYelled() ), }; var actualStatement = new Statement(text); return cases .Where(currentCase => currentCase.Appiles(actualStatement)) .First() .GetResponse(); } } public class Statement { protected string Text; public Statement(string text) { Text = text; } public bool IsYelled() { if (Text.All(IsSpecialChar)) { return false; } var upperCaseCharacters = Text .Where(character => char.IsUpper(character) || IsSpecialChar(character)) .Count(); return upperCaseCharacters == Text.Count(); } public bool IsQuestion() { return TextEndsWith("?"); } public bool IsSilence() { return string.IsNullOrWhiteSpace(Text); } protected bool TextEndsWith(string end) { return Text.Trim().EndsWith(end); } protected static bool IsSpecialChar(char character) { return char.IsPunctuation(character) || char.IsDigit(character) || char.IsSymbol(character) || char.IsNumber(character) || char.IsSeparator(character) || char.IsWhiteSpace(character); } } public class StatementCase { protected string Response; protected Func<Statement, bool> Predicate; public StatementCase(string response, Func<Statement, bool> predicate) { Response = response; Predicate = predicate; } public bool Appiles(Statement analyzer) { return Predicate(analyzer); } public string GetResponse() { return Response; } }
mit
C#
46a245fd50137425901f1681c5ee98a6beddf211
Fix to test Hello.cs.
mono/CppSharp,nalkaro/CppSharp,mono/CppSharp,u255436/CppSharp,mohtamohit/CppSharp,imazen/CppSharp,ktopouzi/CppSharp,KonajuGames/CppSharp,mono/CppSharp,txdv/CppSharp,ddobrev/CppSharp,ktopouzi/CppSharp,nalkaro/CppSharp,imazen/CppSharp,SonyaSa/CppSharp,xistoso/CppSharp,u255436/CppSharp,u255436/CppSharp,inordertotest/CppSharp,KonajuGames/CppSharp,xistoso/CppSharp,mono/CppSharp,mono/CppSharp,inordertotest/CppSharp,xistoso/CppSharp,Samana/CppSharp,mohtamohit/CppSharp,ddobrev/CppSharp,txdv/CppSharp,zillemarco/CppSharp,imazen/CppSharp,SonyaSa/CppSharp,nalkaro/CppSharp,Samana/CppSharp,genuinelucifer/CppSharp,u255436/CppSharp,xistoso/CppSharp,zillemarco/CppSharp,zillemarco/CppSharp,SonyaSa/CppSharp,inordertotest/CppSharp,ddobrev/CppSharp,xistoso/CppSharp,zillemarco/CppSharp,nalkaro/CppSharp,u255436/CppSharp,KonajuGames/CppSharp,txdv/CppSharp,ddobrev/CppSharp,txdv/CppSharp,inordertotest/CppSharp,mydogisbox/CppSharp,ktopouzi/CppSharp,genuinelucifer/CppSharp,SonyaSa/CppSharp,genuinelucifer/CppSharp,mono/CppSharp,ktopouzi/CppSharp,imazen/CppSharp,imazen/CppSharp,genuinelucifer/CppSharp,ktopouzi/CppSharp,nalkaro/CppSharp,genuinelucifer/CppSharp,mohtamohit/CppSharp,ddobrev/CppSharp,mohtamohit/CppSharp,mohtamohit/CppSharp,SonyaSa/CppSharp,KonajuGames/CppSharp,zillemarco/CppSharp,mydogisbox/CppSharp,inordertotest/CppSharp,mydogisbox/CppSharp,mydogisbox/CppSharp,mydogisbox/CppSharp,Samana/CppSharp,txdv/CppSharp,Samana/CppSharp,Samana/CppSharp,KonajuGames/CppSharp
tests/Hello/Hello.cs
tests/Hello/Hello.cs
using CppSharp.Generators; using CppSharp.Utils; namespace CppSharp.Tests { public class Hello : LibraryTest { public Hello(LanguageGeneratorKind kind) : base("Hello", kind) { } public override void Preprocess(Driver driver, Library lib) { lib.SetClassAsValueType("Bar"); lib.SetClassAsValueType("Bar2"); } static class Program { public static void Main(string[] args) { ConsoleDriver.Run(new Hello(LanguageGeneratorKind.CPlusPlusCLI)); ConsoleDriver.Run(new Hello(LanguageGeneratorKind.CSharp)); } } } }
using CppSharp.Generators; using CppSharp.Utils; namespace CppSharp.Tests { public class Hello : LibraryTest { public Hello(LanguageGeneratorKind kind) : base("Hello", kind) { } public override void Preprocess(Driver driver, Library lib) { lib.SetClassAsValueType("Bar"); lib.SetClassAsValueType("Bar2"); } static class Program { public static void Main(string[] args) { Driver.Run(new Hello(LanguageGeneratorKind.CPlusPlusCLI)); Driver.Run(new Hello(LanguageGeneratorKind.CSharp)); } } } }
mit
C#
5289b2d62b10ac524f1569dc433db84f60101110
add code to force the client to respect the batch-size or timeout
ve-interactive/Ve.Messaging
Ve.Messaging.Azure.ServiceBus/Consumer/MessageConsumer.cs
Ve.Messaging.Azure.ServiceBus/Consumer/MessageConsumer.cs
using Microsoft.ServiceBus.Messaging; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using Ve.Messaging.Consumer; using Ve.Messaging.Model; namespace Ve.Messaging.Azure.ServiceBus.Consumer { public class MessageConsumer : IMessageConsumer { private readonly SubscriptionClient _client; public MessageConsumer(SubscriptionClient client) { _client = client; } public IEnumerable<Message> RetrieveMessages(int messageAmount, int timeout) { var stopwatch = Stopwatch.StartNew(); var messages = new List<Message>(); var tm = TimeSpan.FromSeconds(timeout); while (messages.Count < messageAmount && stopwatch.Elapsed < tm) { var brokeredMessages = _client.ReceiveBatch(messageAmount, tm); messages.AddRange( from brokeredMessage in brokeredMessages let stream = brokeredMessage.GetBody<Stream>() select new Message( stream, brokeredMessage.SessionId, brokeredMessage.Label, brokeredMessage.Properties) ); } return messages; } public void Dispose() { _client.Close(); } public Message Peek() { var message = _client.Peek(); return message == null ? null : new Message( message.GetBody<Stream>(), message.SessionId, message.Label, message.Properties); } } }
using Microsoft.ServiceBus.Messaging; using System; using System.Collections.Generic; using System.IO; using Ve.Messaging.Consumer; using Ve.Messaging.Model; namespace Ve.Messaging.Azure.ServiceBus.Consumer { public class MessageConsumer : IMessageConsumer { private readonly SubscriptionClient _client; public MessageConsumer(SubscriptionClient client) { _client = client; } public IEnumerable<Message> RetrieveMessages(int messageAmount, int timeout) { var brokeredMessages = _client.ReceiveBatch(messageAmount, TimeSpan.FromSeconds(timeout)); var messages = new List<Message>(); foreach (var brokeredMessage in brokeredMessages) { var stream = brokeredMessage.GetBody<Stream>(); Message message = new Message(stream, brokeredMessage.SessionId, brokeredMessage.Label, brokeredMessage.Properties); messages.Add(message); } return messages; } public void Dispose() { _client.Close(); } public Message Peek() { var message = _client.Peek(); return message == null ? null : new Message( message.GetBody<Stream>(), message.SessionId, message.Label, message.Properties); } } }
apache-2.0
C#
36771ed5cd72669125ad61aab4cba37056baf281
change product label to region on conbobox
ndrmc/cats,ndrmc/cats,ndrmc/cats
Web/Areas/Logistics/Views/DispatchAllocation/Index.cshtml
Web/Areas/Logistics/Views/DispatchAllocation/Index.cshtml
@using Kendo.Mvc.UI @using LanguageHelpers.Localization @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_MainLayout.cshtml"; } <fieldset> <legend> @Translator.Translate("Dispatch allocation") </legend> </fieldset> @section LeftBar{ @Html.Partial("_AllocationLeftBar") } @{ var ddl = Html.Kendo().DropDownList() .Name("category") .OptionLabel("Select a Region...") .DataTextField("Name") .DataValueField("AdminUnitID") .HtmlAttributes(new {style = "width:200px"}) .Events(e => e.Change("regionsChange")) .DataSource(source => source.Read("GetRegions", "DispatchAllocation")); ddl.Render(); //displays the dropdown list var selected = ddl.ToComponent().Value;//gets the selected value } <div style="float: right; margin-right: 100px"> <div class="btn-group"> <button class="btn">Action</button> <button class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li> <a href="@Url.Action("Hub", "DispatchAllocation",new {regionid = ViewBag.regionId})">hub allocation</a></li> <li><a href="@Url.Action("Index", "SIAllocation", new { Area = "Logistics", regionid = ViewBag.regionId })">PC/SI code allocation</a></li> <li><a href="#">Generate TR</a></li> <li><a href="#"></a></li> </ul> </div> </div> <fieldset> <legend> @Translator.Translate("Allocated amount by Region and Hub") </legend> </fieldset> <div id ="HubAllocationPartial"> @Html.Partial("HubAllocation",(int)ViewBag.regionId) </div> <br/> <br/> <fieldset> <legend> @Translator.Translate("Hub allocated requisitions") </legend> </fieldset> <fieldset> <legend> <span style="font-size: small"> @Translator.Translate(" Requisition to be allocated PC/SI code")</span> </legend> </fieldset> <div id="ProjectCodeAllocationPartial"> @Html.Partial("AllocateProjectCode",(int)ViewBag.regionId) </div> <script> function regionsChange(e) { e.preventDefault(); var value = this.value(); window.location = null; window.location = "@Url.Action("RegionId", "DispatchAllocation")" + "?id=" + value; } </script>
@using Kendo.Mvc.UI @using LanguageHelpers.Localization @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_MainLayout.cshtml"; } <fieldset> <legend> @Translator.Translate("Dispatch allocation") </legend> </fieldset> @section LeftBar{ @Html.Partial("_AllocationLeftBar") } @{ var ddl = Html.Kendo().DropDownList() .Name("category") .OptionLabel("Select a product...") .DataTextField("Name") .DataValueField("AdminUnitID") .HtmlAttributes(new {style = "width:200px"}) .Events(e => e.Change("regionsChange")) .DataSource(source => source.Read("GetRegions", "DispatchAllocation")); ddl.Render(); //displays the dropdown list var selected = ddl.ToComponent().Value;//gets the selected value } <div style="float: right; margin-right: 100px"> <div class="btn-group"> <button class="btn">Action</button> <button class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li> <a href="@Url.Action("Hub", "DispatchAllocation",new {regionid = ViewBag.regionId})">hub allocation</a></li> <li><a href="@Url.Action("getIndexList", "SIAllocation", new { Area = "Logistics", regionid = ViewBag.regionId })">PC/SI code allocation</a></li> <li><a href="#">Generate TR</a></li> <li><a href="#"></a></li> </ul> </div> </div> <fieldset> <legend> @Translator.Translate("Allocated amount by Region and Hub") </legend> </fieldset> <div id ="HubAllocationPartial"> @Html.Partial("HubAllocation",(int)ViewBag.regionId) </div> <br/> <br/> <fieldset> <legend> @Translator.Translate("Hub allocated requisitions") </legend> </fieldset> <fieldset> <legend> <span style="font-size: small"> @Translator.Translate(" Requisition to be allocated PC/SI code")</span> </legend> </fieldset> <div id="ProjectCodeAllocationPartial"> @Html.Partial("AllocateProjectCode",(int)ViewBag.regionId) </div> <script> function regionsChange(e) { e.preventDefault(); var value = this.value(); window.location = null; window.location = "@Url.Action("RegionId", "DispatchAllocation")" + "?id=" + value; } </script>
apache-2.0
C#
5a1b8ceda27fc29cead801dd19b828d6cd080af7
Add NotNull here
asarium/FSOLauncher
UI/WPF/UI.WPF.Launcher.Common/Classes/ReactiveObjectBase.cs
UI/WPF/UI.WPF.Launcher.Common/Classes/ReactiveObjectBase.cs
#region Usings using System.Runtime.CompilerServices; using FSOManagement.Annotations; using ReactiveUI; #endregion namespace UI.WPF.Launcher.Common.Classes { public abstract class ReactiveObjectBase : ReactiveObject { [NotifyPropertyChangedInvocator] protected void RaiseAndSetIfPropertyChanged<T>(ref T obj, T value, [NotNull,CallerMemberName] string propertyName = null) { this.RaiseAndSetIfChanged(ref obj, value, propertyName); } } }
#region Usings using System.Runtime.CompilerServices; using FSOManagement.Annotations; using ReactiveUI; #endregion namespace UI.WPF.Launcher.Common.Classes { public abstract class ReactiveObjectBase : ReactiveObject { [NotifyPropertyChangedInvocator] protected void RaiseAndSetIfPropertyChanged<T>(ref T obj, T value, [CallerMemberName] string propertyName = null) { this.RaiseAndSetIfChanged(ref obj, value, propertyName); } } }
mit
C#
e1913127c05c3e6ddc9457550b1949d6efa5bb11
Remove empty test
SteamDatabase/ValveKeyValue
ValveKeyValue/ValveKeyValue.Test/KVValueToStringTestCase.cs
ValveKeyValue/ValveKeyValue.Test/KVValueToStringTestCase.cs
using System.Collections; using System.Linq; using NUnit.Framework; namespace ValveKeyValue.Test { class KVValueToStringTestCase { [TestCaseSource(nameof(ToStringTestCases))] public string KVValueToStringIsSane(KVValue value) => value.ToString(); public static IEnumerable ToStringTestCases { get { yield return new TestCaseData(new KVObject("a", "blah").Value).Returns("blah"); yield return new TestCaseData(new KVObject("a", "yay").Value).Returns("yay"); yield return new TestCaseData(new KVObject("a", Enumerable.Empty<KVObject>()).Value).Returns("[Collection]").SetName("{m} - Empty Collection"); yield return new TestCaseData(new KVObject("a", new[] { new KVObject("boo", "aah") }).Value).Returns("[Collection]").SetName("{m} - Collection With Value"); } } } }
using System.Collections; using System.Linq; using NUnit.Framework; namespace ValveKeyValue.Test { class KVValueToStringTestCase { [Test] public void Foo() { } [TestCaseSource(nameof(ToStringTestCases))] public string KVValueToStringIsSane(KVValue value) => value.ToString(); public static IEnumerable ToStringTestCases { get { yield return new TestCaseData(new KVObject("a", "blah").Value).Returns("blah"); yield return new TestCaseData(new KVObject("a", "yay").Value).Returns("yay"); yield return new TestCaseData(new KVObject("a", Enumerable.Empty<KVObject>()).Value).Returns("[Collection]").SetName("{m} - Empty Collection"); yield return new TestCaseData(new KVObject("a", new[] { new KVObject("boo", "aah") }).Value).Returns("[Collection]").SetName("{m} - Collection With Value"); } } } }
mit
C#
12fa90a27c0f6401dd4660d393e0d958fe4a9c3a
Update WebNoteSinglePage/WebNoteSinglePage/Views/Home/Index.cshtml
JohannesHoppe/WebNoteSinglePage,JohannesHoppe/WebNoteSinglePage
WebNoteSinglePage/WebNoteSinglePage/Views/Home/Index.cshtml
WebNoteSinglePage/WebNoteSinglePage/Views/Home/Index.cshtml
@Html.Partial("~/Views/AppViews/index.cshtml") @Html.Partial("~/Views/AppViews/create.cshtml") @Html.Partial("~/Views/AppViews/details.cshtml") @section scripts { require(['singlePage/appState', 'knockout.bindings'], function(appState) { appState.init(); }); }
@Html.Partial("~/Views/AppViews/index.cshtml") @Html.Partial("~/Views/AppViews/create.cshtml") @Html.Partial("~/Views/AppViews/details.cshtml") @section scripts { require(['SinglePage/appState', 'knockout.bindings'], function(appState) { appState.init(); }); }
mit
C#
4cc94efb06258cc7cf5c445e6318f3ac5cf6d852
Fix failing mania test
NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,ppy/osu,peppy/osu,smoogipoo/osu
osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Tests.Visual; using osuTK.Input; namespace osu.Game.Rulesets.Mania.Tests.Editor { public class TestSceneNotePlacementBlueprint : ManiaPlacementBlueprintTestScene { [SetUp] public void Setup() => Schedule(() => { this.ChildrenOfType<HitObjectContainer>().ForEach(c => c.Clear()); ResetPlacement(); ((ScrollingTestContainer)HitObjectContainer).Direction = ScrollingDirection.Down; }); [Test] public void TestPlaceBeforeCurrentTimeDownwards() { AddStep("move mouse before current time", () => { var column = this.ChildrenOfType<Column>().Single(); InputManager.MoveMouseTo(column.ScreenSpacePositionAtTime(-100)); }); AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("note start time < 0", () => getNote().StartTime < 0); } [Test] public void TestPlaceAfterCurrentTimeDownwards() { AddStep("move mouse after current time", () => { var column = this.ChildrenOfType<Column>().Single(); InputManager.MoveMouseTo(column.ScreenSpacePositionAtTime(100)); }); AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("note start time > 0", () => getNote().StartTime > 0); } private Note getNote() => this.ChildrenOfType<DrawableNote>().FirstOrDefault()?.HitObject; protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableNote((Note)hitObject); protected override PlacementBlueprint CreateBlueprint() => new NotePlacementBlueprint(); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Tests.Visual; using osuTK; using osuTK.Input; namespace osu.Game.Rulesets.Mania.Tests.Editor { public class TestSceneNotePlacementBlueprint : ManiaPlacementBlueprintTestScene { [SetUp] public void Setup() => Schedule(() => { this.ChildrenOfType<HitObjectContainer>().ForEach(c => c.Clear()); ResetPlacement(); ((ScrollingTestContainer)HitObjectContainer).Direction = ScrollingDirection.Down; }); [Test] public void TestPlaceBeforeCurrentTimeDownwards() { AddStep("move mouse before current time", () => InputManager.MoveMouseTo(this.ChildrenOfType<Column>().Single().ScreenSpaceDrawQuad.BottomLeft - new Vector2(0, 10))); AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("note start time < 0", () => getNote().StartTime < 0); } [Test] public void TestPlaceAfterCurrentTimeDownwards() { AddStep("move mouse after current time", () => InputManager.MoveMouseTo(this.ChildrenOfType<Column>().Single())); AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("note start time > 0", () => getNote().StartTime > 0); } private Note getNote() => this.ChildrenOfType<DrawableNote>().FirstOrDefault()?.HitObject; protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableNote((Note)hitObject); protected override PlacementBlueprint CreateBlueprint() => new NotePlacementBlueprint(); } }
mit
C#
345e429d20ef621e8849bdb55354a1e6259f7a5f
Remove unused import
AntiTcb/Discord.Net,RogueException/Discord.Net,LassieME/Discord.Net,Confruggy/Discord.Net
src/Discord.Net/WebSocket/Entities/Users/SocketGuildUser.cs
src/Discord.Net/WebSocket/Entities/Users/SocketGuildUser.cs
using Discord.Rest; using Model = Discord.API.GuildMember; using PresenceModel = Discord.API.Presence; namespace Discord.WebSocket { internal class SocketGuildUser : GuildUser, ISocketUser, IVoiceState { internal override bool IsAttached => true; public new DiscordSocketClient Discord => base.Discord as DiscordSocketClient; public new SocketGuild Guild => base.Guild as SocketGuild; public new SocketGlobalUser User => base.User as SocketGlobalUser; public Presence Presence => User.Presence; //{ get; private set; } public override Game Game => Presence.Game; public override UserStatus Status => Presence.Status; public VoiceState? VoiceState => Guild.GetVoiceState(Id); public bool IsSelfDeafened => VoiceState?.IsSelfDeafened ?? false; public bool IsSelfMuted => VoiceState?.IsSelfMuted ?? false; public bool IsSuppressed => VoiceState?.IsSuppressed ?? false; public VoiceChannel VoiceChannel => VoiceState?.VoiceChannel; public bool IsDeafened => VoiceState?.IsDeafened ?? false; public bool IsMuted => VoiceState?.IsMuted ?? false; public string VoiceSessionId => VoiceState?.VoiceSessionId ?? ""; IVoiceChannel IVoiceState.VoiceChannel => VoiceState?.VoiceChannel; public SocketGuildUser(SocketGuild guild, SocketGlobalUser user, Model model) : base(guild, user, model) { //Presence = new Presence(null, UserStatus.Offline); } public SocketGuildUser(SocketGuild guild, SocketGlobalUser user, PresenceModel model) : base(guild, user, model) { } public override void Update(PresenceModel model, UpdateSource source) { base.Update(model, source); var game = model.Game != null ? new Game(model.Game) : null; //Presence = new Presence(game, model.Status); User.Update(model, source); } public SocketGuildUser Clone() => MemberwiseClone() as SocketGuildUser; ISocketUser ISocketUser.Clone() => Clone(); } }
using System; using Discord.Rest; using Model = Discord.API.GuildMember; using PresenceModel = Discord.API.Presence; namespace Discord.WebSocket { internal class SocketGuildUser : GuildUser, ISocketUser, IVoiceState { internal override bool IsAttached => true; public new DiscordSocketClient Discord => base.Discord as DiscordSocketClient; public new SocketGuild Guild => base.Guild as SocketGuild; public new SocketGlobalUser User => base.User as SocketGlobalUser; public Presence Presence => User.Presence; //{ get; private set; } public override Game Game => Presence.Game; public override UserStatus Status => Presence.Status; public VoiceState? VoiceState => Guild.GetVoiceState(Id); public bool IsSelfDeafened => VoiceState?.IsSelfDeafened ?? false; public bool IsSelfMuted => VoiceState?.IsSelfMuted ?? false; public bool IsSuppressed => VoiceState?.IsSuppressed ?? false; public VoiceChannel VoiceChannel => VoiceState?.VoiceChannel; public bool IsDeafened => VoiceState?.IsDeafened ?? false; public bool IsMuted => VoiceState?.IsMuted ?? false; public string VoiceSessionId => VoiceState?.VoiceSessionId ?? ""; IVoiceChannel IVoiceState.VoiceChannel => VoiceState?.VoiceChannel; public SocketGuildUser(SocketGuild guild, SocketGlobalUser user, Model model) : base(guild, user, model) { //Presence = new Presence(null, UserStatus.Offline); } public SocketGuildUser(SocketGuild guild, SocketGlobalUser user, PresenceModel model) : base(guild, user, model) { } public override void Update(PresenceModel model, UpdateSource source) { base.Update(model, source); var game = model.Game != null ? new Game(model.Game) : null; //Presence = new Presence(game, model.Status); User.Update(model, source); } public SocketGuildUser Clone() => MemberwiseClone() as SocketGuildUser; ISocketUser ISocketUser.Clone() => Clone(); } }
mit
C#