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
e762aa1f0973ddb5efffdfa7f5c7757098dfbcfc
Change AssemblyVersion to 1.0.0.0
bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents
Android/FirebaseJobDispatcher/source/Firebase.JobDispatcher/Properties/AssemblyInfo.cs
Android/FirebaseJobDispatcher/source/Firebase.JobDispatcher/Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Firebase.JobDispatcher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
using System.Reflection; [assembly: AssemblyTitle("Firebase.JobDispatcher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
mit
C#
ea3cee19f89dece0c39f4940ef7e3bf7d07f5f14
Fix "The parameter conversion from type 'Newtonsoft.Json.Linq.JArray' to type 'System.Boolean' failed because no type converter can convert between these types" (#7256)
stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2
src/OrchardCore.Modules/OrchardCore.Forms/Helpers/ModelStateHelpers.cs
src/OrchardCore.Modules/OrchardCore.Forms/Helpers/ModelStateHelpers.cs
using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace OrchardCore.Forms.Helpers { public static class ModelStateHelpers { public static string SerializeModelState(ModelStateDictionary modelState) { var errorList = modelState.Select(x => new ModelStateTransferValue { Key = x.Key, AttemptedValue = x.Value.AttemptedValue, RawValue = x.Value.RawValue, ErrorMessages = x.Value.Errors.Select(err => err.ErrorMessage).ToList(), }); return JsonConvert.SerializeObject(errorList); } public static ModelStateDictionary DeserializeModelState(string serialisedErrorList) { var errorList = JsonConvert.DeserializeObject<List<ModelStateTransferValue>>(serialisedErrorList); var modelState = new ModelStateDictionary(); foreach (var item in errorList) { item.RawValue = item.RawValue is JArray jarray ? jarray.ToObject<object[]>() : item.RawValue; modelState.SetModelValue(item.Key, item.RawValue, item.AttemptedValue); foreach (var error in item.ErrorMessages) { modelState.AddModelError(item.Key, error); } } return modelState; } private class ModelStateTransferValue { public string Key { get; set; } public string AttemptedValue { get; set; } public object RawValue { get; set; } public ICollection<string> ErrorMessages { get; set; } = new List<string>(); } } }
using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; namespace OrchardCore.Forms.Helpers { public static class ModelStateHelpers { public static string SerializeModelState(ModelStateDictionary modelState) { var errorList = modelState.Select(x => new ModelStateTransferValue { Key = x.Key, AttemptedValue = x.Value.AttemptedValue, RawValue = x.Value.RawValue, ErrorMessages = x.Value.Errors.Select(err => err.ErrorMessage).ToList(), }); return JsonConvert.SerializeObject(errorList); } public static ModelStateDictionary DeserializeModelState(string serialisedErrorList) { var errorList = JsonConvert.DeserializeObject<List<ModelStateTransferValue>>(serialisedErrorList); var modelState = new ModelStateDictionary(); foreach (var item in errorList) { modelState.SetModelValue(item.Key, item.RawValue, item.AttemptedValue); foreach (var error in item.ErrorMessages) { modelState.AddModelError(item.Key, error); } } return modelState; } private class ModelStateTransferValue { public string Key { get; set; } public string AttemptedValue { get; set; } public object RawValue { get; set; } public ICollection<string> ErrorMessages { get; set; } = new List<string>(); } } }
bsd-3-clause
C#
1ab630e6ec0f1bb008ac87c8c2bad43e6007a409
Test commit
wa1gon/RigGate
RigClients/WpfClient/ConfData.cs
RigClients/WpfClient/ConfData.cs
#region -- Copyright /* Copyright 2014 Darryl Wagoner DE WA1GON 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. */ #endregion using Wa1gon.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Wa1gon.RigClientLib; namespace Wa1gon.WpfClient { public class ConfigData { public ObservableCollection<Server> Servers { get; set; } public ObservableCollection<RigConfig> RigConfs { get; set; } public ConfigData() { Servers = new ObservableCollection<Server>(); RigConfs = new ObservableCollection<RigConfig>(); } } }
#region -- Copyright /* Copyright {2014} {Darryl Wagoner DE WA1GON} 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. */ #endregion using Wa1gon.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Wa1gon.RigClientLib; namespace Wa1gon.WpfClient { public class ConfigData { public ObservableCollection<Server> Servers { get; set; } public ObservableCollection<RigConfig> RigConfs { get; set; } public ConfigData() { Servers = new ObservableCollection<Server>(); RigConfs = new ObservableCollection<RigConfig>(); } } }
apache-2.0
C#
01ce2f9d2804ae3ee54b483c659f25bfbfccd953
update MobileGlobal
comsmobiler/SmoONE
Source/SmoONE.UI/MobileGlobal.cs
Source/SmoONE.UI/MobileGlobal.cs
using Smobiler.Core; using Smobiler.Core.Controls; using SmoONE.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; /// <summary> /// 全局类 /// </summary> public class MobileGlobal { /// <summary> /// 在服务启动时触发 /// </summary> /// <param name="server"></param> public static void OnServerStart(MobileServer server) {//若是使用Smobiler Service部署,请去除下面注释 // AutomapperConfig.Init(); } /// <summary> /// 在服务停止时触发 /// </summary> /// <param name="server"></param> public static void OnServerStop(MobileServer server) { } /// <summary> /// 在客户端会话第一次开始时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnSessionStart(object sender, SmobilerSessionEventArgs e) { } /// <summary> /// 在客户端会话结束时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnSessionStop(object sender, SmobilerSessionEventArgs e) { } /// <summary> /// 在客户端会话重新连接时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnSessionConnect(object sender, SmobilerSessionEventArgs e) { } /// <summary> /// 在回调推送被客户端点击时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnPushCallBack(object sender, ClientPushOpenedEventArgs e) { } }
using Smobiler.Core; using Smobiler.Core.Controls; using SmoONE.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; /// <summary> /// 全局类 /// </summary> public class MobileGlobal { /// <summary> /// 在服务启动时触发 /// </summary> /// <param name="server"></param> public static void OnServerStart(MobileServer server) { AutomapperConfig.Init(); } /// <summary> /// 在服务停止时触发 /// </summary> /// <param name="server"></param> public static void OnServerStop(MobileServer server) { } /// <summary> /// 在客户端会话第一次开始时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnSessionStart(object sender, SmobilerSessionEventArgs e) { } /// <summary> /// 在客户端会话结束时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnSessionStop(object sender, SmobilerSessionEventArgs e) { } /// <summary> /// 在客户端会话重新连接时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnSessionConnect(object sender, SmobilerSessionEventArgs e) { } /// <summary> /// 在回调推送被客户端点击时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnPushCallBack(object sender, ClientPushOpenedEventArgs e) { } }
mit
C#
5b9ca7fc03bc1fe6463f1ff4f31edc99fe44f068
Write - read test.
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Tests/StoreTests.cs
WalletWasabi.Tests/StoreTests.cs
using NBitcoin; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using WalletWasabi.Stores; using Xunit; namespace WalletWasabi.Tests { public class StoreTests { [Fact] public async Task IndexStoreTestsAsync() { var indexStore = new IndexStore(); var dir = Path.Combine(Global.DataDir, nameof(IndexStoreTestsAsync)); var network = Network.Main; await indexStore.InitializeAsync(dir, network); } [Fact] public async Task IoManagerTestsAsync() { var file1 = Path.Combine(Global.DataDir, nameof(IoManagerTestsAsync), $"file1.dat"); var file2 = Path.Combine(Global.DataDir, nameof(IoManagerTestsAsync), $"file2.dat"); Random random = new Random(); List<string> lines = new List<string>(); for (int i = 0; i < 1000; i++) { const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; string line = new string(Enumerable.Repeat(chars, 100) .Select(s => s[random.Next(s.Length)]).ToArray()); lines.Add(line); } // Single thread file operations. IoManager ioman1 = new IoManager(file1); // Delete the file if Exist. ioman1.DeleteMe(); Assert.False(ioman1.Exists()); // Write the data to the file. await ioman1.WriteAllLinesAsync(lines); Assert.True(ioman1.Exists()); // Read back the content and check. var readLines = await ioman1.ReadAllLinesAsync(); Assert.Equal(readLines.Length, lines.Count); for (int i = 0; i < lines.Count; i++) { string line = lines[i]; var readline = readLines[i]; Assert.Equal(readline, line); } } } }
using NBitcoin; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using WalletWasabi.Stores; using Xunit; namespace WalletWasabi.Tests { public class StoreTests { [Fact] public async Task IndexStoreTestsAsync() { var indexStore = new IndexStore(); var dir = Path.Combine(Global.DataDir, nameof(IndexStoreTestsAsync)); var network = Network.Main; await indexStore.InitializeAsync(dir, network); } [Fact] public async Task IoManagerTestsAsync() { var file1 = Path.Combine(Global.DataDir, nameof(IoManagerTestsAsync), $"file1.dat"); var file2 = Path.Combine(Global.DataDir, nameof(IoManagerTestsAsync), $"file2.dat"); Random random = new Random(); List<string> lines = new List<string>(); for (int i = 0; i < 1000; i++) { const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; string line = new string(Enumerable.Repeat(chars, 100) .Select(s => s[random.Next(s.Length)]).ToArray()); lines.Add(line); } // Single thread file operations IoManager ioman1 = new IoManager(file1); ioman1.DeleteMe(); Assert.False(ioman1.Exists()); await ioman1.WriteAllLinesAsync(lines); } } }
mit
C#
fdcb340328a387b96ab277b3463b4bd2e72166ec
use normalized point to display correct lat/lon
Tyshark9/arcgis-runtime-samples-dotnet,Arc3D/arcgis-runtime-samples-dotnet,AkshayHarshe/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,sharifulgeo/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet
src/Store/ArcGISRuntimeSDKDotNet_StoreSamples/Samples/Geometry/ProjectCoordinate.xaml.cs
src/Store/ArcGISRuntimeSDKDotNet_StoreSamples/Samples/Geometry/ProjectCoordinate.xaml.cs
using Esri.ArcGISRuntime.Controls; using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Layers; using System; using System.Threading.Tasks; using Windows.UI.Popups; using Windows.UI.Xaml; namespace ArcGISRuntimeSDKDotNet_StoreSamples.Samples { /// <summary> /// Sample shows how to project a coordinate from the current map projection (in this case Web Mercator) to a different projection. /// </summary> /// <title>Project</title> /// <category>Geometry</category> public partial class ProjectCoordinate : Windows.UI.Xaml.Controls.Page { private GraphicsOverlay _graphicsOverlay; /// <summary>Construct Project sample control</summary> public ProjectCoordinate() { InitializeComponent(); _graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"]; MyMapView.ExtentChanged += MyMapView_ExtentChanged; } // Start map interaction private async void MyMapView_ExtentChanged(object sender, EventArgs e) { try { MyMapView.ExtentChanged -= MyMapView_ExtentChanged; await AcceptPointsAsync(); } catch (Exception ex) { var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); } } // Accept user map clicks and add points to the graphics layer with the selected symbol // - collected point is in the coordinate system of the current map private async Task AcceptPointsAsync() { while (MyMapView.Extent != null) { var point = await MyMapView.Editor.RequestPointAsync(); _graphicsOverlay.Graphics.Clear(); _graphicsOverlay.Graphics.Add(new Graphic(point)); // Take account of WrapAround var normalizedPt = GeometryEngine.NormalizeCentralMeridian(point) as MapPoint; // Convert from web mercator to WGS84 var projectedPoint = GeometryEngine.Project(normalizedPt, SpatialReferences.Wgs84); gridXY.Visibility = gridLatLon.Visibility = Visibility.Visible; gridXY.DataContext = point; gridLatLon.DataContext = projectedPoint; } } } }
using Esri.ArcGISRuntime.Controls; using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Layers; using System; using System.Threading.Tasks; using Windows.UI.Popups; using Windows.UI.Xaml; namespace ArcGISRuntimeSDKDotNet_StoreSamples.Samples { /// <summary> /// Sample shows how to project a coordinate from the current map projection (in this case Web Mercator) to a different projection. /// </summary> /// <title>Project</title> /// <category>Geometry</category> public partial class ProjectCoordinate : Windows.UI.Xaml.Controls.Page { private GraphicsOverlay _graphicsOverlay; /// <summary>Construct Project sample control</summary> public ProjectCoordinate() { InitializeComponent(); _graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"]; MyMapView.ExtentChanged += MyMapView_ExtentChanged; } // Start map interaction private async void MyMapView_ExtentChanged(object sender, EventArgs e) { try { MyMapView.ExtentChanged -= MyMapView_ExtentChanged; await AcceptPointsAsync(); } catch (Exception ex) { var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); } } // Accept user map clicks and add points to the graphics layer with the selected symbol // - collected point is in the coordinate system of the current map private async Task AcceptPointsAsync() { while (MyMapView.Extent != null) { var point = await MyMapView.Editor.RequestPointAsync(); _graphicsOverlay.Graphics.Clear(); _graphicsOverlay.Graphics.Add(new Graphic(point)); // Take account of WrapAround var normalizedPt = GeometryEngine.NormalizeCentralMeridian(point) as MapPoint; // Convert from web mercator to WGS84 var projectedPoint = GeometryEngine.Project(point, SpatialReferences.Wgs84); gridXY.Visibility = gridLatLon.Visibility = Visibility.Visible; gridXY.DataContext = point; gridLatLon.DataContext = projectedPoint; } } } }
apache-2.0
C#
fcd3c86df9c8d375361b55b61fe9f85d65a00ab6
Allow Detailed errors to use 1 or "true" (#26089)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Components/Server/src/Circuits/CircuitOptionsJSInteropDetailedErrorsConfiguration.cs
src/Components/Server/src/Circuits/CircuitOptionsJSInteropDetailedErrorsConfiguration.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Components.Server { internal class CircuitOptionsJSInteropDetailedErrorsConfiguration : IConfigureOptions<CircuitOptions> { public CircuitOptionsJSInteropDetailedErrorsConfiguration(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void Configure(CircuitOptions options) { var value = Configuration[WebHostDefaults.DetailedErrorsKey]; options.DetailedErrors = string.Equals(value, "true", StringComparison.OrdinalIgnoreCase) || string.Equals(value, "1", StringComparison.OrdinalIgnoreCase); } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Components.Server { internal class CircuitOptionsJSInteropDetailedErrorsConfiguration : IConfigureOptions<CircuitOptions> { public CircuitOptionsJSInteropDetailedErrorsConfiguration(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void Configure(CircuitOptions options) { options.DetailedErrors = Configuration.GetValue<bool>(WebHostDefaults.DetailedErrorsKey); } } }
apache-2.0
C#
76548a1b5cab5d060467dc25f0edf801078cf7bf
add ApplicationConstants.ProductCode
robertwahler/jammer,robertwahler/jammer
Assets/Scripts/Application/ApplicationConstants.cs
Assets/Scripts/Application/ApplicationConstants.cs
using UnityEngine; namespace Jammer { public static class ApplicationConstants { /// <summary> /// Application product name. Used as namespace. Application exe name. Save /// folder name. etc. /// </summary> public const string ProductCode = "Jammer"; /// <summary> /// Scene to load after splash shown /// </summary> public const string StartScene = "Start"; /// <summary> /// Main game play scene /// </summary> public const string MainScene = "Level1"; /// <summary> /// Scene that contains the menus /// </summary> public const string UIScene = "UI"; } }
using UnityEngine; namespace Jammer { public static class ApplicationConstants { /// <summary> /// Scene to load after splash shown /// </summary> public const string StartScene = "Start"; /// <summary> /// Main game play scene /// </summary> public const string MainScene = "Level1"; /// <summary> /// Scene that contains the menus /// </summary> public const string UIScene = "UI"; } }
mit
C#
93564375219ea785de9062bde9586e5a0c6d03bf
Remove some unused using statements
RandomOutput/ThreeSpace
Assets/StageManager/Scripts/BasicStageManagable.cs
Assets/StageManager/Scripts/BasicStageManagable.cs
// Copyright 2017 Daniel Plemmons // 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. public class BasicStageManagable : StageManagable{ private bool hasInitialized = false; protected virtual void Awake() { Initialize(); } protected virtual void Initialize() { if(hasInitialized) { return; } hasInitialized = true; gameObject.SetActive(false); } public override void Enter() { Initialize(); StartEnter(); gameObject.SetActive(true); CompleteEnter(); } public override void Exit() { Initialize(); StartExit(); gameObject.SetActive(false); CompleteExit(); } }
// Copyright 2017 Daniel Plemmons // 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 UnityEngine; public class BasicStageManagable : StageManagable{ private bool hasInitialized = false; protected virtual void Awake() { Initialize(); } protected virtual void Initialize() { if(hasInitialized) { return; } hasInitialized = true; gameObject.SetActive(false); } public override void Enter() { Initialize(); StartEnter(); gameObject.SetActive(true); CompleteEnter(); } public override void Exit() { Initialize(); StartExit(); gameObject.SetActive(false); CompleteExit(); } }
apache-2.0
C#
c9b64baa9a4cc3cf745bafab9ee4bb4796ba19b5
Fix math
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Models/UnitStatsViewModel.cs
Battery-Commander.Web/Models/UnitStatsViewModel.cs
using System; namespace BatteryCommander.Web.Models { public class UnitStatsViewModel { public Unit Unit { get; set; } // Assigned Passed Failed Not Tested % Pass/Assigned public Stat ABCP { get; set; } = new Stat { }; public Stat APFT { get; set; } = new Stat { }; public class Stat { public int Assigned { get; set; } public int Passed { get; set; } public int Failed { get; set; } public int NotTested { get; set; } public Decimal PercentPass => (Decimal)Passed / Assigned; } } }
using System; namespace BatteryCommander.Web.Models { public class UnitStatsViewModel { public Unit Unit { get; set; } // Assigned Passed Failed Not Tested % Pass/Assigned public Stat ABCP { get; set; } = new Stat { }; public Stat APFT { get; set; } = new Stat { }; public class Stat { public int Assigned { get; set; } public int Passed { get; set; } public int Failed { get; set; } public int NotTested { get; set; } public Decimal PercentPass => Passed / Assigned; } } }
mit
C#
2d7485fc9e1eabf689aae4ee2cfa76a32b537e15
Add logout handler
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
BatteryCommander.Web/Controllers/AuthController.cs
BatteryCommander.Web/Controllers/AuthController.cs
using BatteryCommander.Common.Models; using BatteryCommander.Web.Models; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.Owin; using System; using System.Threading.Tasks; using System.Web.Mvc; namespace BatteryCommander.Web.Controllers { public class AuthController : BaseController { private readonly SignInManager<AppUser, int> SignInManager; public AuthController(SignInManager<AppUser, int> signInMgr, UserManager<AppUser, int> userManager) : base(userManager) { SignInManager = signInMgr; } [HttpGet, AllowAnonymous] public ActionResult Login(String returnUrl) { return View(new LoginModel { ReturnUrl = returnUrl }); } [HttpPost, AllowAnonymous, ValidateAntiForgeryToken] public async Task<ActionResult> Login(LoginModel model) { if (!ModelState.IsValid) return View(model); switch (await SignInManager.PasswordSignInAsync(model.Username, model.Password, isPersistent: model.RememberMe, shouldLockout: true)) { case SignInStatus.Success: return RedirectToLocal(model.ReturnUrl); case SignInStatus.LockedOut: ModelState.AddModelError(String.Empty, "Account locked."); return View(); case SignInStatus.RequiresVerification: return RedirectToAction("SendCode", new { ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe }); case SignInStatus.Failure: default: ModelState.AddModelError(String.Empty, "Invalid password."); return View(model); } } [HttpPost, ValidateAntiForgeryToken] public ActionResult Logout() { SignInManager.AuthenticationManager.SignOut(); return RedirectToAction("Index", "Home"); } // TODO - SendCode private ActionResult RedirectToLocal(string returnUrl) { if (!String.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } return RedirectToAction("Index", "Home"); } } }
using BatteryCommander.Common.Models; using BatteryCommander.Web.Models; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.Owin; using System; using System.Threading.Tasks; using System.Web.Mvc; namespace BatteryCommander.Web.Controllers { public class AuthController : BaseController { private readonly SignInManager<AppUser, int> SignInManager; public AuthController(SignInManager<AppUser, int> signInMgr, UserManager<AppUser, int> userManager) : base(userManager) { SignInManager = signInMgr; } [HttpGet, AllowAnonymous] public ActionResult Login(String returnUrl) { return View(new LoginModel { ReturnUrl = returnUrl }); } [HttpPost, AllowAnonymous, ValidateAntiForgeryToken] public async Task<ActionResult> Login(LoginModel model) { if (!ModelState.IsValid) return View(model); switch (await SignInManager.PasswordSignInAsync(model.Username, model.Password, isPersistent: model.RememberMe, shouldLockout: true)) { case SignInStatus.Success: return RedirectToLocal(model.ReturnUrl); case SignInStatus.LockedOut: ModelState.AddModelError(String.Empty, "Account locked."); return View(); case SignInStatus.RequiresVerification: return RedirectToAction("SendCode", new { ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe }); case SignInStatus.Failure: default: ModelState.AddModelError(String.Empty, "Invalid password."); return View(model); } } // TODO - SendCode private ActionResult RedirectToLocal(string returnUrl) { if (!String.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } return RedirectToAction("Index", "Home"); } } }
mit
C#
8988f2552e8e3822daa6866dde3c53d9d2cd95a8
Add test for scalar queries with 1 row
ericsink/sqlite-net,praeclarum/sqlite-net
tests/ScalarTest.cs
tests/ScalarTest.cs
using System; using System.Linq; #if NETFX_CORE using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute; using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute; using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute; #else using NUnit.Framework; #endif namespace SQLite.Tests { [TestFixture] public class ScalarTest { class TestTable { [PrimaryKey, AutoIncrement] public int Id { get; set; } public int Two { get; set; } } const int Count = 100; SQLiteConnection CreateDb () { var db = new TestDb (); db.CreateTable<TestTable> (); var items = from i in Enumerable.Range (0, Count) select new TestTable { Two = 2 }; db.InsertAll (items); Assert.AreEqual (Count, db.Table<TestTable> ().Count ()); return db; } [Test] public void Int32 () { var db = CreateDb (); var r = db.ExecuteScalar<int> ("SELECT SUM(Two) FROM TestTable"); Assert.AreEqual (Count * 2, r); } [Test] public void SelectSingleRowValue () { var db = CreateDb (); var r = db.ExecuteScalar<int> ("SELECT Two FROM TestTable WHERE Id = 1 LIMIT 1"); Assert.AreEqual (2, r); } } }
using System; using System.Linq; #if NETFX_CORE using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute; using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute; using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute; #else using NUnit.Framework; #endif namespace SQLite.Tests { [TestFixture] public class ScalarTest { class TestTable { [PrimaryKey, AutoIncrement] public int Id { get; set; } public int Two { get; set; } } const int Count = 100; SQLiteConnection CreateDb () { var db = new TestDb (); db.CreateTable<TestTable> (); var items = from i in Enumerable.Range (0, Count) select new TestTable { Two = 2 }; db.InsertAll (items); Assert.AreEqual (Count, db.Table<TestTable> ().Count ()); return db; } [Test] public void Int32 () { var db = CreateDb (); var r = db.ExecuteScalar<int> ("SELECT SUM(Two) FROM TestTable"); Assert.AreEqual (Count * 2, r); } } }
mit
C#
c6af21e2c5acdd02b62df4a96b607340cdceb99e
Deal with interfaces
EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils
ValueUtils/ReflectionHelper.cs
ValueUtils/ReflectionHelper.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace ValueUtils { static class ReflectionHelper { public static IEnumerable<Type> WalkMeaningfulInheritanceChain(Type type) { if (type.IsClass) { while (type != typeof (object)) { yield return type; type = type.BaseType; } } else if (type.IsValueType) { yield return type; } } const BindingFlags OnlyDeclaredInstanceMembers = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly; public static IEnumerable<FieldInfo> GetAllFields(Type type) => WalkMeaningfulInheritanceChain(type).Reverse() .SelectMany(t => t.GetFields(OnlyDeclaredInstanceMembers)); } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace ValueUtils { static class ReflectionHelper { public static IEnumerable<Type> WalkMeaningfulInheritanceChain(Type type) { if (type.IsValueType) { yield return type; yield break; } while (type != typeof(object)) { yield return type; type = type.BaseType; } } const BindingFlags OnlyDeclaredInstanceMembers = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly; public static IEnumerable<FieldInfo> GetAllFields(Type type) => WalkMeaningfulInheritanceChain(type).Reverse() .SelectMany(t => t.GetFields(OnlyDeclaredInstanceMembers)); } }
apache-2.0
C#
22a35b55d29ecacc06d7992022e079bc294e7e3b
Fix swagger UI buildout
jorupp/conference-room,jorupp/conference-room,jorupp/conference-room,RightpointLabs/conference-room,RightpointLabs/conference-room,RightpointLabs/conference-room,RightpointLabs/conference-room,jorupp/conference-room
Web/App_Start/SwaggerConfig.cs
Web/App_Start/SwaggerConfig.cs
using System.Collections.Generic; using System.Web.Http; using WebActivatorEx; using RightpointLabs.ConferenceRoom.Web; using Swashbuckle.Application; using Swashbuckle.Swagger; using System.Web.Http.Description; [assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] namespace RightpointLabs.ConferenceRoom.Web { public class SwaggerConfig { public static void Register() { var thisAssembly = typeof(SwaggerConfig).Assembly; GlobalConfiguration.Configuration .EnableSwagger(c => { c.SingleApiVersion("v2", "RightpointLabs.ConferenceRoom.Web"); c.ApiKey("api_key") .Description("Bearer token here") .Name("Authorization") .In("header"); c.OperationFilter<AssignSecurityRequirements>(); }) .EnableSwaggerUi(c => { c.DocumentTitle("Room Ninja API"); c.EnableApiKeySupport("Authorization", "header"); }); } public class AssignSecurityRequirements : IOperationFilter { public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) { operation.security = new List<IDictionary<string, IEnumerable<string>>>() { new Dictionary<string, IEnumerable<string>>() { { "api_key", new string[0] } } }; } } } }
using System.Web.Http; using WebActivatorEx; using RightpointLabs.ConferenceRoom.Web; using Swashbuckle.Application; [assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] namespace RightpointLabs.ConferenceRoom.Web { public class SwaggerConfig { public static void Register() { var thisAssembly = typeof(SwaggerConfig).Assembly; GlobalConfiguration.Configuration .EnableSwagger(c => { c.SingleApiVersion("v2", "RightpointLabs.ConferenceRoom.Web"); c.ApiKey("token") .Description("Bearer token here") .Name("Authorization") .In("header"); }) .EnableSwaggerUi(c => { c.EnableApiKeySupport("Authorization", "header"); }); } } }
mit
C#
86f90295bc5c8da55534b705268ace90b74cb155
Change print naming for SM
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Models/Soldier.cs
Battery-Commander.Web/Models/Soldier.cs
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace BatteryCommander.Web.Models { public class Soldier { private const double DaysPerYear = 365.2425; [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [Required, StringLength(50)] [Display(Name = "Last Name")] public String LastName { get; set; } [Required, StringLength(50)] [Display(Name = "First Name")] public String FirstName { get; set; } [StringLength(50), Display(Name = "Middle Name")] public String MiddleName { get; set; } [Required] public Rank Rank { get; set; } = Rank.E1; [StringLength(12)] public String DoDId { get; set; } [DataType(DataType.EmailAddress), StringLength(50)] public String MilitaryEmail { get; set; } [DataType(DataType.EmailAddress), StringLength(50)] public String CivilianEmail { get; set; } [DataType(DataType.Date), Column(TypeName = "date"), Display(Name = "DOB")] public DateTime DateOfBirth { get; set; } public int Age => AgeAsOf(DateTime.Today); public int AgeAsOf(DateTime date) { // They may not have reached their birthday for this year return (int)((date - DateOfBirth).TotalDays / DaysPerYear); } [Required] public Gender Gender { get; set; } = Gender.Male; // public MilitaryEducationLevel EducationLevel { get; set; } = MilitaryEducationLevel.None; // Status - Active, Inactive [Required] public int UnitId { get; set; } public virtual Unit Unit { get; set; } // Position // Security Clearance // MOS - Duty MOSQ'd? // ETS Date & Time till ETS // PEBD // Date of Rank public virtual ICollection<APFT> APFTs { get; set; } public virtual ICollection<ABCP> ABCPs { get; set; } public override string ToString() => $"{LastName} {FirstName} {MiddleName}".ToUpper(); } }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace BatteryCommander.Web.Models { public class Soldier { private const double DaysPerYear = 365.2425; [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [Required, StringLength(50)] [Display(Name = "Last Name")] public String LastName { get; set; } [Required, StringLength(50)] [Display(Name = "First Name")] public String FirstName { get; set; } [StringLength(50), Display(Name = "Middle Name")] public String MiddleName { get; set; } [Required] public Rank Rank { get; set; } = Rank.E1; [StringLength(12)] public String DoDId { get; set; } [DataType(DataType.EmailAddress), StringLength(50)] public String MilitaryEmail { get; set; } [DataType(DataType.EmailAddress), StringLength(50)] public String CivilianEmail { get; set; } [DataType(DataType.Date), Column(TypeName = "date"), Display(Name = "DOB")] public DateTime DateOfBirth { get; set; } public int Age => AgeAsOf(DateTime.Today); public int AgeAsOf(DateTime date) { // They may not have reached their birthday for this year return (int)((date - DateOfBirth).TotalDays / DaysPerYear); } [Required] public Gender Gender { get; set; } = Gender.Male; // public MilitaryEducationLevel EducationLevel { get; set; } = MilitaryEducationLevel.None; // Status - Active, Inactive [Required] public int UnitId { get; set; } public virtual Unit Unit { get; set; } // Position // Security Clearance // MOS - Duty MOSQ'd? // ETS Date & Time till ETS // PEBD // Date of Rank public virtual ICollection<APFT> APFTs { get; set; } public virtual ICollection<ABCP> ABCPs { get; set; } public override string ToString() => $"{Rank} {LastName}, {FirstName} {MiddleName}"; } }
mit
C#
f66e2126c92f1b1316d1b3c3278832d1d786fb0a
Increment version number to sync up with NuGet
XeroAPI/XeroAPI.Net,TDaphneB/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,jcvandan/XeroAPI.Net
source/XeroApi/Properties/AssemblyInfo.cs
source/XeroApi/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.5")] [assembly: AssemblyFileVersion("1.0.0.6")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.5")] [assembly: AssemblyFileVersion("1.0.0.5")]
mit
C#
a605c9b5b19946781ba90e4eb0a5a0f5b7617c9d
add code comments to discovery policy
IdentityModel/IdentityModel,IdentityModel/IdentityModel2,IdentityModel/IdentityModelv2,IdentityModel/IdentityModel2,IdentityModel/IdentityModel,IdentityModel/IdentityModelv2
src/IdentityModel/Client/DiscoveryPolicy.cs
src/IdentityModel/Client/DiscoveryPolicy.cs
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Collections.Generic; namespace IdentityModel.Client { public class DiscoveryPolicy { internal string Authority; /// <summary> /// Specifies if HTTPS is enforced on all endpoints. Defaults to true. /// </summary> public bool RequireHttps { get; set; } = true; /// <summary> /// Specifies if HTTP is allowed on loopback addresses. Defaults to true. /// </summary> public bool AllowHttpOnLoopback { get; set; } = true; /// <summary> /// Specifies valid loopback addresses, defaults to localhost and 127.0.0.1 /// </summary> public ICollection<string> LoopbackAddresses = new HashSet<string> { "localhost", "127.0.0.1" }; /// <summary> /// Specifies if the issuer name is checked to be identical to the authority. Defaults to true. /// </summary> public bool ValidateIssuerName { get; set; } = true; /// <summary> /// Specifies if all endpoints are checked to belong to the authority. Defaults to true. /// </summary> public bool ValidateEndpoints { get; set; } = true; /// <summary> /// Specifies if a key set is required. Defaults to true. /// </summary> public bool RequireKeySet { get; set; } = true; } }
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Collections.Generic; namespace IdentityModel.Client { public class DiscoveryPolicy { internal string Authority; public bool ValidateIssuerName { get; set; } = true; public bool ValidateEndpoints { get; set; } = true; public bool RequireKeySet { get; set; } = true; public bool RequireHttps { get; set; } = true; public bool AllowHttpOnLoopback { get; set; } = true; public ICollection<string> LoopbackAddresses = new HashSet<string> { "localhost", "127.0.0.1" }; } }
apache-2.0
C#
ac303827b1e76690972d2c6c0261d2b07abf7a4b
Fix failing test by ensuring an initialization value for the attributes list.
AlexisArce/MvcRouteTester,AnthonySteele/MvcRouteTester
src/MvcRouteTester/Common/PropertyReader.cs
src/MvcRouteTester/Common/PropertyReader.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace MvcRouteTester.Common { public class PropertyReader { private static readonly List<Type> SpecialSimpleTypes = new List<Type> { typeof(string), typeof(decimal), typeof(DateTime), typeof(Guid) }; public bool IsSimpleType(Type type) { if (type.Name == "Nullable`1") { return true; } return type.IsPrimitive || SpecialSimpleTypes.Contains(type); } public RouteValues RouteValues(object dataObject) { var propertiesList = PropertiesList(dataObject); var expectedProps = new RouteValues(); expectedProps.AddRangeWithParse(propertiesList); return expectedProps; } public IList<RouteValue> PropertiesList(object dataObject, RouteValueOrigin origin = RouteValueOrigin.Unknown) { var result = new List<RouteValue>(); if (dataObject == null) { return result; } var type = dataObject.GetType(); var objectProperties = GetPublicObjectProperties(type); foreach (PropertyInfo objectProperty in objectProperties) { if (IsSimpleType(objectProperty.PropertyType)) { var value = GetPropertyValue(dataObject, objectProperty); result.Add(new RouteValue(objectProperty.Name, value, origin)); } } return result; } private object GetPropertyValue(object dataObject, PropertyInfo objectProperty) { var getMethod = objectProperty.GetGetMethod(); return getMethod.Invoke(dataObject, null); } public IEnumerable<string> SimplePropertyNames(Type type) { if (type == null) { throw new ArgumentNullException("type"); } var objectProperties = GetPublicObjectProperties(type); var result = new List<string>(); foreach (PropertyInfo objectProperty in objectProperties) { if (IsSimpleType(objectProperty.PropertyType)) { result.Add(objectProperty.Name); } } return result; } private static IEnumerable<PropertyInfo> GetPublicObjectProperties(Type type) { var props= type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList(); props.RemoveAll(p => ignoreAttributes.Any(a => p.GetCustomAttributes(a, true).Length > 0)); return props; } private static Type[] ignoreAttributes = new Type[0]; public static void IgnoreAttributes(Type[] types) { ignoreAttributes = types; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace MvcRouteTester.Common { public class PropertyReader { private static readonly List<Type> SpecialSimpleTypes = new List<Type> { typeof(string), typeof(decimal), typeof(DateTime), typeof(Guid) }; public bool IsSimpleType(Type type) { if (type.Name == "Nullable`1") { return true; } return type.IsPrimitive || SpecialSimpleTypes.Contains(type); } public RouteValues RouteValues(object dataObject) { var propertiesList = PropertiesList(dataObject); var expectedProps = new RouteValues(); expectedProps.AddRangeWithParse(propertiesList); return expectedProps; } public IList<RouteValue> PropertiesList(object dataObject, RouteValueOrigin origin = RouteValueOrigin.Unknown) { var result = new List<RouteValue>(); if (dataObject == null) { return result; } var type = dataObject.GetType(); var objectProperties = GetPublicObjectProperties(type); foreach (PropertyInfo objectProperty in objectProperties) { if (IsSimpleType(objectProperty.PropertyType)) { var value = GetPropertyValue(dataObject, objectProperty); result.Add(new RouteValue(objectProperty.Name, value, origin)); } } return result; } private object GetPropertyValue(object dataObject, PropertyInfo objectProperty) { var getMethod = objectProperty.GetGetMethod(); return getMethod.Invoke(dataObject, null); } public IEnumerable<string> SimplePropertyNames(Type type) { if (type == null) { throw new ArgumentNullException("type"); } var objectProperties = GetPublicObjectProperties(type); var result = new List<string>(); foreach (PropertyInfo objectProperty in objectProperties) { if (IsSimpleType(objectProperty.PropertyType)) { result.Add(objectProperty.Name); } } return result; } private static IEnumerable<PropertyInfo> GetPublicObjectProperties(Type type) { var props= type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList(); props.RemoveAll(p => ignoreAttributes.Any(a => p.GetCustomAttributes(a, true).Length > 0)); return props; } private static Type[] ignoreAttributes; public static void IgnoreAttributes(Type[] types) { ignoreAttributes = types; } } }
apache-2.0
C#
328a23a7aadf998c60df3908fb60672128c969eb
Improve description
pnmcosta/KInspector,JosefDvorak/KInspector,ChristopherJennings/KInspector,TheEskhaton/KInspector,martbrow/KInspector,ChristopherJennings/KInspector,KenticoBSoltis/KInspector,anibalvelarde/KInspector,Kentico/KInspector,petrsvihlik/KInspector,Kentico/KInspector,JosefDvorak/KInspector,ChristopherJennings/KInspector,martbrow/KInspector,petrsvihlik/KInspector,TheEskhaton/KInspector,pnmcosta/KInspector,petrsvihlik/KInspector,JosefDvorak/KInspector,ChristopherJennings/KInspector,martbrow/KInspector,pnmcosta/KInspector,Kentico/KInspector,KenticoBSoltis/KInspector,KenticoBSoltis/KInspector,anibalvelarde/KInspector,TheEskhaton/KInspector,Kentico/KInspector,anibalvelarde/KInspector
KInspector.Modules/Modules/Content/WebPartsInTemplatesAndTransformationsModule.cs
KInspector.Modules/Modules/Content/WebPartsInTemplatesAndTransformationsModule.cs
using System; using Kentico.KInspector.Core; namespace Kentico.KInspector.Modules { public class WebPartsInTemplatesAndTransformationsModule : IModule { public ModuleMetadata GetModuleMetadata() { return new ModuleMetadata { Name = "Web parts in page templates and transformations", Comment = @"Displays a page templates and transformations containing any of the following web parts: - CMSRepeater - CMSBreadCrumbs - CMSListMenu - CMSDataList Having those web parts in transformation or page template has a significant performance hit as they load all the data from the database every time the transformation item is processed. (e.g.: If you have 50 items processed in a transformation, you will end up with 50 database calls instead of 1) You should use hierarchical transformation instead (see https://docs.kentico.com/display/K82/Using+hierarchical+transformations).", SupportedVersions = new[] { new Version("6.0"), new Version("7.0"), new Version("8.0"), new Version("8.1"), new Version("8.2"), new Version("9.0") }, Category = "Content", }; } public ModuleResults GetResults(InstanceInfo instanceInfo) { var dbService = instanceInfo.DBService; var results = dbService.ExecuteAndGetDataSetFromFile("WebPartsInTemplatesAndTransformationsModule.sql"); return new ModuleResults { Result = results }; } } }
using System; using Kentico.KInspector.Core; namespace Kentico.KInspector.Modules { public class WebPartsInTemplatesAndTransformationsModule : IModule { public ModuleMetadata GetModuleMetadata() { return new ModuleMetadata { Name = "Web parts in page templates and transformations", Comment = "Looks up page templates and transformations containing certain web parts.", SupportedVersions = new[] { new Version("6.0"), new Version("7.0"), new Version("8.0"), new Version("8.1"), new Version("8.2"), new Version("9.0") }, Category = "Content", }; } public ModuleResults GetResults(InstanceInfo instanceInfo) { var dbService = instanceInfo.DBService; var results = dbService.ExecuteAndGetDataSetFromFile("WebPartsInTemplatesAndTransformationsModule.sql"); return new ModuleResults { Result = results }; } } }
mit
C#
87d5cf21eaf3a4caa8cfbb477a194f125cb1dd15
Disable Debug Sound Logging
ludimation/Winter,ludimation/Winter,ludimation/Winter
Winter/Assets/PlayFootsteps.cs
Winter/Assets/PlayFootsteps.cs
using UnityEngine; using System.Collections; public class PlayFootsteps : MonoBehaviour { private float AudioTimer = 0.0f; public AudioClip[] footstep; // Use this for initialization void Start () { } // Update is called once per frame void Update () { // Create an Audio Timer, so that we aren't calling too many footsteps to the scene. if (AudioTimer > 0) { AudioTimer -= Time.deltaTime; } if (AudioTimer < 0) { AudioTimer = 0; } } void OnTriggerEnter (Collider col) { if (AudioTimer == 0) { int clip_num = Random.Range(0, footstep.Length); // Choose a random footstep sound. audio.clip = footstep[Random.Range(0, clip_num)]; // Load audio audio.Play(); // Play audio //Debug.Log("Footstep " + clip_num + " Played"); // Log for debug AudioSource.PlayClipAtPoint(footstep[clip_num], transform.position); AudioTimer = 0.1f; // Reset Audio timer } } }
using UnityEngine; using System.Collections; public class PlayFootsteps : MonoBehaviour { private float AudioTimer = 0.0f; public AudioClip[] footstep; // Use this for initialization void Start () { } // Update is called once per frame void Update () { // Create an Audio Timer, so that we aren't calling too many footsteps to the scene. if (AudioTimer > 0) { AudioTimer -= Time.deltaTime; } if (AudioTimer < 0) { AudioTimer = 0; } } void OnTriggerEnter (Collider col) { if (AudioTimer == 0) { int clip_num = Random.Range(0, footstep.Length); // Choose a random footstep sound. audio.clip = footstep[Random.Range(0, clip_num)]; // Load audio audio.Play(); // Play audio Debug.Log("Footstep " + clip_num + " Played"); // Log for debug AudioSource.PlayClipAtPoint(footstep[clip_num], transform.position); AudioTimer = 0.1f; // Reset Audio timer } } }
mit
C#
3250e3185a4bc6e0ca08d7d645fa14662dc5a6ad
Fix a typo.
darrencauthon/AutoMoq,darrencauthon/AutoMoq,darrencauthon/AutoMoq
src/AutoMoq/Helpers/AutoMoqTestFixture.cs
src/AutoMoq/Helpers/AutoMoqTestFixture.cs
using Moq; namespace AutoMoq.Helpers { public class AutoMoqTestFixture<T> where T : class { private T subject; /// <summary> /// The current AutoMoqer /// </summary> public AutoMoqer Mocker { get; private set; } = new AutoMoqer(); /// <summary> /// The Class being tested in this Test Fixture. /// </summary> public T Subject { get { return subject ?? (subject = Mocker.Resolve<T>()); } } /// <summary> /// A Mock dependency that was auto-injected into Subject /// </summary> /// <typeparam name="TMock"></typeparam> /// <returns></returns> public Mock<TMock> Mocked<TMock>() where TMock : class { return Mocker.GetMock<TMock>(); } /// <summary> /// A dependency that was auto-injected into Subject. Implementation is a Moq object. /// </summary> /// <typeparam name="TDepend"></typeparam> /// <returns></returns> public TDepend Dependency<TDepend>() where TDepend : class { return Mocked<TDepend>().Object; } /// <summary> /// Resets Subject instance. A new instance will be created, with new depenencies auto-injected. /// Call this from NUnit's [SetUp] method, if you want each of your tests in the fixture to have a fresh instance of /// <typeparamref name="T" /> /// </summary> public void ResetSubject() { Mocker = new AutoMoqer(); subject = null; } } }
using Moq; namespace AutoMoq.Helpers { public class AutoMoqTestFixture<T> where T : class { private T subject; /// <summary> /// The current AutoMoqer /// </summary> public AutoMoqer Mocker { get; private set; } = new AutoMoqer(); /// <summary> /// The Class being tested in this Test Fixture. /// </summary> public T Subject { get { return subject ?? (subject = Mocker.Resolve<T>()); } } /// <summary> /// A Mock dependency that was auto-injected into Subject /// </summary> /// <typeparam name="TMock"></typeparam> /// <returns></returns> public Mock<TMock> Mocked<TMock>() where TMock : class { return Mocker.GetMock<TMock>(); } /// <summary> /// A depenency that was auto-injected into Subject. Implementation is a Moq object. /// </summary> /// <typeparam name="TDepend"></typeparam> /// <returns></returns> public TDepend Dependency<TDepend>() where TDepend : class { return Mocked<TDepend>().Object; } /// <summary> /// Resets Subject instance. A new instance will be created, with new depenencies auto-injected. /// Call this from NUnit's [SetUp] method, if you want each of your tests in the fixture to have a fresh instance of /// <typeparamref name="T" /> /// </summary> public void ResetSubject() { Mocker = new AutoMoqer(); subject = null; } } }
mit
C#
100dad16cfd2e22c76ff67582ed44ea5b1f42b4d
Adjust the values for the Punchline Place fishing spot.
TTExtensions/MouseClickSimulator
TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/FishingSpotFlavor.cs
TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/FishingSpotFlavor.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TTMouseclickSimulator.Core.Environment; namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing { public class FishingSpotFlavor { public Coordinates Scan1 { get; } public Coordinates Scan2 { get; } public ScreenshotColor BubbleColor { get; } public int Tolerance { get; } public FishingSpotFlavor(Coordinates scan1, Coordinates scan2, ScreenshotColor bubbleColor, int tolerance) { this.Scan1 = scan1; this.Scan2 = scan2; this.BubbleColor = bubbleColor; this.Tolerance = tolerance; } // TODO: The Color value needs some adjustment! public static readonly FishingSpotFlavor PunchlinePlace = new FishingSpotFlavor(new Coordinates(260, 196), new Coordinates(1349, 626), new ScreenshotColor(22, 140, 116), 13); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TTMouseclickSimulator.Core.Environment; namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing { public class FishingSpotFlavor { public Coordinates Scan1 { get; } public Coordinates Scan2 { get; } public ScreenshotColor BubbleColor { get; } public int Tolerance { get; } public FishingSpotFlavor(Coordinates scan1, Coordinates scan2, ScreenshotColor bubbleColor, int tolerance) { this.Scan1 = scan1; this.Scan2 = scan2; this.BubbleColor = bubbleColor; this.Tolerance = tolerance; } // TODO: The Color value needs some adjustment! public static readonly FishingSpotFlavor PunchlinePlace = new FishingSpotFlavor(new Coordinates(260, 196), new Coordinates(1349, 626), new ScreenshotColor(24, 142, 118), 16); } }
mit
C#
a94f2959cf3e47bf4fa6d1c23a02d55b1c297c1b
define AssemblyDescription.
jwChung/Experimentalism,jwChung/Experimentalism
src/Experiment/Properties/AssemblyInfo.cs
src/Experiment/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Experiment")] [assembly: AssemblyDescription("Experiment is to support parameterized tests with auto data.")] [assembly: CLSCompliant(true)] [assembly: Guid("e27d6f4e-54f1-4b67-95e5-92c353423b03")]
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Experiment")] [assembly: AssemblyDescription("")] [assembly: CLSCompliant(true)] [assembly: Guid("e27d6f4e-54f1-4b67-95e5-92c353423b03")]
mit
C#
7242b7782e0094b00cc6cfb2b85dca70afabd0c6
Remove unnecessary interpolated string.
DimensionDataCBUSydney/jab
jab/jab.example/MyTestClass.cs
jab/jab.example/MyTestClass.cs
using jab.Interfaces; using NUnit.Framework; using System.Linq; using jab.tests; namespace jab.example { public class MyTestClass : ApiBestPracticeTestBase { /// <summary> /// DELETE operations should always contain a ID parameter. /// </summary> /// <param name="apiOperation"></param> [TestCaseSource(nameof(DeleteOperations))] public void DeleteMethodsMustContainIdAsKeyParameter(IJabApiOperation apiOperation) { Assume.That( apiOperation.Method, Is.EqualTo(NSwag.SwaggerOperationMethod.Delete)); Assert.That( apiOperation, Has.Property("Parameters").Property("Parameters").None.Property("Name").EqualTo("id"), "Must not pass ID parameter"); } } }
using jab.Interfaces; using NUnit.Framework; using System.Linq; using jab.tests; namespace jab.example { public class MyTestClass : ApiBestPracticeTestBase { /// <summary> /// DELETE operations should always contain a ID parameter. /// </summary> /// <param name="apiOperation"></param> [TestCaseSource(nameof(DeleteOperations))] public void DeleteMethodsMustContainIdAsKeyParameter(IJabApiOperation apiOperation) { Assume.That( apiOperation.Method, Is.EqualTo(NSwag.SwaggerOperationMethod.Delete)); Assert.That( apiOperation, Has.Property("Parameters").Property("Parameters").None.Property("Name").EqualTo("id"), $"Must not pass ID parameter"); } } }
apache-2.0
C#
4b4a3d1a6fc6880f5dad619d64ef06977e587da0
Clean up MapPathEventHandler
stormleoxia/xsp,stormleoxia/xsp,arthot/xsp,murador/xsp,murador/xsp,arthot/xsp,stormleoxia/xsp,stormleoxia/xsp,murador/xsp,arthot/xsp,arthot/xsp,murador/xsp
src/Mono.WebServer/MapPathEventHandler.cs
src/Mono.WebServer/MapPathEventHandler.cs
// // Mono.WebServer.MapPathEventHandler // // Authors: // Daniel Lopez Ridruejo // Gonzalo Paniagua Javier // // Documentation: // Brian Nickel // // Copyright (c) 2002 Daniel Lopez Ridruejo. // (c) 2002,2003 Ximian, Inc. // All rights reserved. // (C) Copyright 2004-2010 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.WebServer { public delegate void MapPathEventHandler (object sender, MapPathEventArgs args); }
// // Mono.WebServer.MapPathEventHandler // // Authors: // Daniel Lopez Ridruejo // Gonzalo Paniagua Javier // // Documentation: // Brian Nickel // // Copyright (c) 2002 Daniel Lopez Ridruejo. // (c) 2002,2003 Ximian, Inc. // All rights reserved. // (C) Copyright 2004-2010 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.WebServer { public delegate void MapPathEventHandler (object sender, MapPathEventArgs args); }
mit
C#
36bfc11cc2c5e5e1c131a079d8012930ab6bd7b2
fix Fortis.Search.ComputedFields.InhritedTemplates computed field to not duplicate template ids.
Fortis-Collection/fortis
Fortis/Search/ComputedFields/InheritedTemplates.cs
Fortis/Search/ComputedFields/InheritedTemplates.cs
using Sitecore; using Sitecore.ContentSearch; using Sitecore.ContentSearch.ComputedFields; using Sitecore.ContentSearch.Utilities; using Sitecore.Data.Items; using Sitecore.Diagnostics; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Fortis.Search.ComputedFields { /// <summary> /// A computed field that correctly recurses all templates, unlike the default. /// /// Code is courtesy of http://mikael.com/2013/05/sitecore-7-query-items-that-inherits-a-template/ /// </summary> public class InheritedTemplates : IComputedIndexField { public string FieldName { get; set; } public string ReturnType { get; set; } public object ComputeFieldValue(IIndexable indexable) { return GetAllTemplates(indexable as SitecoreIndexableItem); } private static List<string> GetAllTemplates(Item item) { Assert.ArgumentNotNull(item, "item"); Assert.IsNotNull(item.Template, "Item template not found."); var templateId = IdHelper.NormalizeGuid(item.TemplateID); var templates = new Dictionary<string, string> { {templateId, templateId } }; RecurseTemplates(templates, item.Template); return templates.Values.ToList(); } private static void RecurseTemplates(IDictionary<string, string> templates, TemplateItem template) { foreach (var baseTemplateItem in template.BaseTemplates) { var templateId = IdHelper.NormalizeGuid(baseTemplateItem.ID); if (!templates.ContainsKey(templateId)) { templates.Add(templateId, templateId); } if (baseTemplateItem.ID != TemplateIDs.StandardTemplate) { RecurseTemplates(templates, baseTemplateItem); } } } } }
using Sitecore; using Sitecore.ContentSearch; using Sitecore.ContentSearch.ComputedFields; using Sitecore.ContentSearch.Utilities; using Sitecore.Data.Items; using Sitecore.Diagnostics; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Fortis.Search.ComputedFields { /// <summary> /// A computed field that correctly recurses all templates, unlike the default. /// /// Code is courtesy of http://mikael.com/2013/05/sitecore-7-query-items-that-inherits-a-template/ /// </summary> public class InheritedTemplates : IComputedIndexField { public string FieldName { get; set; } public string ReturnType { get; set; } public object ComputeFieldValue(IIndexable indexable) { return GetAllTemplates(indexable as SitecoreIndexableItem); } private static List<string> GetAllTemplates(Item item) { Assert.ArgumentNotNull(item, "item"); Assert.IsNotNull(item.Template, "Item template not found."); var templates = new List<string> { IdHelper.NormalizeGuid(item.TemplateID) }; RecurseTemplates(templates, item.Template); return templates; } private static void RecurseTemplates(List<string> list, TemplateItem template) { foreach (var baseTemplateItem in template.BaseTemplates) { list.Add(IdHelper.NormalizeGuid(baseTemplateItem.ID)); if (baseTemplateItem.ID != TemplateIDs.StandardTemplate) { RecurseTemplates(list, baseTemplateItem); } } } } }
mit
C#
e1f728bb3ac0425f2a7c1daf8234a2bf8bd921e1
Initialize new home controller instance for test class
appharbor/foo,appharbor/foo
src/Foo.Tests/Web/Controllers/HomeControllerTest.cs
src/Foo.Tests/Web/Controllers/HomeControllerTest.cs
using Foo.Web.Controllers; namespace Foo.Tests.Web.Controllers { public class HomeControllerTest { private readonly HomeController _controller; public HomeControllerTest() { _controller = new HomeController(); } } }
namespace Foo.Tests.Web.Controllers { public class HomeControllerTest { } }
mit
C#
f0437df264da521a4d5f97e3fe022decf6504e66
Update find resource code post internal change
mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
src/Glimpse.Agent.Browser/Resources/BrowserAgent.cs
src/Glimpse.Agent.Browser/Resources/BrowserAgent.cs
using Glimpse.Web; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using System.IO; using System.Reflection; using System.Text; using Glimpse.Server.Web; namespace Glimpse.Agent.Browser.Resources { public class BrowserAgent : IMiddlewareResourceComposer { public void Register(IApplicationBuilder appBuilder) { appBuilder.Map("/browser/agent", chuldApp => chuldApp.Run(async context => { var response = context.Response; response.Headers.Set("Content-Type", "application/javascript"); var assembly = typeof(BrowserAgent).GetTypeInfo().Assembly; var jqueryStream = assembly.GetManifestResourceStream("Glimpse.Agent.Browser.Resources.Embed.scripts.jquery.jquery-2.1.1.js"); var signalrStream = assembly.GetManifestResourceStream("Glimpse.Agent.Browser.Resources.Embed.scripts.signalr.jquery.signalR-2.2.0.js"); var agentStream = assembly.GetManifestResourceStream("Glimpse.Agent.Browser.Resources.Embed.scripts.BrowserAgent.js"); using (var jqueryReader = new StreamReader(jqueryStream, Encoding.UTF8)) using (var signalrReader = new StreamReader(signalrStream, Encoding.UTF8)) using (var agentReader = new StreamReader(agentStream, Encoding.UTF8)) { // TODO: The worlds worst hack!!! Nik did this... await response.WriteAsync(jqueryReader.ReadToEnd() + signalrReader.ReadToEnd() + agentReader.ReadToEnd()); } })); } } }
using Glimpse.Web; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using System.IO; using System.Reflection; using System.Text; using Glimpse.Server.Web; namespace Glimpse.Agent.Browser.Resources { public class BrowserAgent : IMiddlewareResourceComposer { public void Register(IApplicationBuilder appBuilder) { appBuilder.Map("/browser/agent", chuldApp => chuldApp.Run(async context => { var response = context.Response; response.Headers.Set("Content-Type", "application/javascript"); var assembly = typeof(BrowserAgent).GetTypeInfo().Assembly; var jqueryStream = assembly.GetManifestResourceStream("Resources/Embed/scripts/jquery.jquery-2.1.1.js"); var signalrStream = assembly.GetManifestResourceStream("Resources/Embed/scripts/signalr/jquery.signalR-2.2.0.js"); var agentStream = assembly.GetManifestResourceStream("Resources/Embed/scripts/BrowserAgent.js"); using (var jqueryReader = new StreamReader(jqueryStream, Encoding.UTF8)) using (var signalrReader = new StreamReader(signalrStream, Encoding.UTF8)) using (var agentReader = new StreamReader(agentStream, Encoding.UTF8)) { // TODO: The worlds worst hack!!! Nik did this... await response.WriteAsync(jqueryReader.ReadToEnd() + signalrReader.ReadToEnd() + agentReader.ReadToEnd()); } })); } } }
mit
C#
df5da9d402efe2384a4317ca70fefc10c17ed4ec
add caesar tests
aphawkins/Useful,aphawkins/Useful,aphawkins/Useful
test/Useful.Security.Cryptography.Tests/Security/Cryptography/CaesarCrackTests.cs
test/Useful.Security.Cryptography.Tests/Security/Cryptography/CaesarCrackTests.cs
// <copyright file="CaesarCrackTests.cs" company="APH Software"> // Copyright (c) Andrew Hawkins. All rights reserved. // </copyright> namespace Useful.Security.Cryptography.Tests { using System.Collections.Generic; using Useful.Security.Cryptography; using Xunit; public class CaesarCrackTests { [Theory] [InlineData("AAAAAAAABBCCCDDDDEEEEEEEEEEEEEFFGGHHHHHHIIIIIIIKLLLLMMNNNNNNNOOOOOOOOPPRRRRRRSSSSSSSSSTTTTTTTTTUUUVWWYY", 0)] [InlineData("YMJHFJXFWHNUMJWNXTSJTKYMJJFWQNJXYPSTBSFSIXNRUQJXYHNUMJWX", 5)] // http://practicalcryptography.com/cryptanalysis/stochastic-searching/cryptanalysis-caesar-cipher/ [InlineData("MHILY LZA ZBHL XBPZXBL MVYABUHL HWWPBZ JSHBKPBZ JHLJBZ KPJABT HYJHUBT LZA ULBAYVU", 7)] // Singh Code Book [InlineData("QFM", 12)] public void Crack(string ciphertext, int shift) { (int bestShift, IDictionary<int, string> _) = CaesarCrack.Crack(ciphertext); Assert.Equal(shift, bestShift); } } }
// <copyright file="CaesarCrackTests.cs" company="APH Software"> // Copyright (c) Andrew Hawkins. All rights reserved. // </copyright> namespace Useful.Security.Cryptography.Tests { using System.Collections.Generic; using Useful.Security.Cryptography; using Xunit; public class CaesarCrackTests { [Theory] [InlineData("AAAAAAAABBCCCDDDDEEEEEEEEEEEEEFFGGHHHHHHIIIIIIIKLLLLMMNNNNNNNOOOOOOOOPPRRRRRRSSSSSSSSSTTTTTTTTTUUUVWWYY", 0)] [InlineData("QFM", 12)] public void Crack(string ciphertext, int shift) { (int bestShift, IDictionary<int, string> _) = CaesarCrack.Crack(ciphertext); Assert.Equal(shift, bestShift); } [Fact] public void SinghCodeBook() { string ciphertext = "MHILY LZA ZBHL XBPZXBL MVYABUHL HWWPBZ JSHBKPBZ JHLJBZ KPJABT HYJHUBT LZA ULBAYVU"; (int bestShift, IDictionary<int, string> _) = CaesarCrack.Crack(ciphertext); Assert.Equal(7, bestShift); } } }
mit
C#
9288cda81008e8f21877c9fc15a00f2cf1c294e2
Add AudioBufferList ctor to specify the number of buffers to create.
mono/maccore,jorik041/maccore,cwensley/maccore
src/AudioToolbox/AudioBufferList.cs
src/AudioToolbox/AudioBufferList.cs
// // AudioBufferList.cs: AudioBufferList wrapper class // // Author: // AKIHIRO Uehara (u-akihiro@reinforce-lab.com) // // Copyright 2010 Reinforce Lab. // // 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.Runtime.InteropServices; using MonoMac.ObjCRuntime; namespace MonoMac.AudioToolbox { [StructLayout(LayoutKind.Sequential)] public class AudioBufferList { internal int bufferCount; // mBuffers array size is variable. But here we uses fixed size of 2, because iPhone phone terminal two (L/R) channels. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] internal AudioBuffer [] buffers; public int BufferCount { get { return bufferCount; }} public AudioBuffer [] Buffers { get { return buffers; }} public AudioBufferList() { } public AudioBufferList (int count) { bufferCount = count; buffers = new AudioBuffer [count]; } public override string ToString () { if (buffers != null && buffers.Length > 0) return string.Format ("[buffers={0},bufferSize={1}]", buffers [0].DataByteSize); else return string.Format ("[empty]"); } } public class MutableAudioBufferList : AudioBufferList, IDisposable { public MutableAudioBufferList (int nubuffers, int bufferSize) : base (nubuffers) { for (int i = 0; i < bufferCount; i++) { buffers[i].NumberChannels = 1; buffers[i].DataByteSize = bufferSize; buffers[i].Data = Marshal.AllocHGlobal((int)bufferSize); } } public void Dispose() { Dispose (true); GC.SuppressFinalize (this); } public virtual void Dispose (bool disposing) { if (buffers != null){ foreach (var mbuf in buffers) Marshal.FreeHGlobal(mbuf.Data); buffers = null; } } ~MutableAudioBufferList () { Dispose (false); } } }
// // AudioBufferList.cs: AudioBufferList wrapper class // // Author: // AKIHIRO Uehara (u-akihiro@reinforce-lab.com) // // Copyright 2010 Reinforce Lab. // // 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.Runtime.InteropServices; using MonoMac.ObjCRuntime; namespace MonoMac.AudioToolbox { [StructLayout(LayoutKind.Sequential)] public class AudioBufferList { internal int bufferCount; // mBuffers array size is variable. But here we uses fixed size of 2, because iPhone phone terminal two (L/R) channels. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] internal AudioBuffer [] buffers; public int BufferCount { get { return bufferCount; }} public AudioBuffer [] Buffers { get { return buffers; }} public AudioBufferList() { } public override string ToString () { if (buffers != null && buffers.Length > 0) return string.Format ("[buffers={0},bufferSize={1}]", buffers [0].DataByteSize); else return string.Format ("[empty]"); } } public class MutableAudioBufferList : AudioBufferList, IDisposable { public MutableAudioBufferList (int nubuffers, int bufferSize) { bufferCount = nubuffers; buffers = new AudioBuffer[bufferCount]; for (int i = 0; i < bufferCount; i++) { buffers[i].NumberChannels = 1; buffers[i].DataByteSize = bufferSize; buffers[i].Data = Marshal.AllocHGlobal((int)bufferSize); } } public void Dispose() { Dispose (true); GC.SuppressFinalize (this); } public virtual void Dispose (bool disposing) { if (buffers != null){ foreach (var mbuf in buffers) Marshal.FreeHGlobal(mbuf.Data); buffers = null; } } ~MutableAudioBufferList () { Dispose (false); } } }
apache-2.0
C#
a692541bf29fd0473287bbd76e71b9ff18f0fbd7
Fix target in installer form
pekkah/tanka,pekkah/tanka,pekkah/tanka
src/Web/views/installer/home.cshtml
src/Web/views/installer/home.cshtml
@{ Layout = "master.cshtml"; } <div class="admin-container"> <div class="admin-form-view"> <form role="form" method="POST"> <div class="form-group well"> <label for="key">Key</label> <input type="password" class="form-control" id="key" name="key" placeholder="key"> </div> <div class="well"> <div class="form-group"> <label for="username">Username</label> <input class="form-control" id="username" name="username" placeholder="username"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" id="password" name="password" placeholder="password"> </div> </div> <button class="btn btn-danger btn-lg pull-right" type="submit">Install</button> </form> </div> </div>
@{ Layout = "master.cshtml"; } <div class="admin-container"> <div class="admin-form-view"> <form role="form" method="POST" target="/"> <div class="form-group well"> <label for="key">Key</label> <input type="password" class="form-control" id="key" name="key" placeholder="key"> </div> <div class="well"> <div class="form-group"> <label for="username">Username</label> <input class="form-control" id="username" name="username" placeholder="username"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" id="password" name="password" placeholder="password"> </div> </div> <button class="btn btn-danger btn-lg pull-right" type="submit">Install</button> </form> </div> </div>
mit
C#
21b47b78a6757a7bac6e0d009cd9aab87cb9efc1
Bump version to 0.10.4
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/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.10.4.0")] [assembly: AssemblyFileVersion("0.10.4.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.10.3.0")] [assembly: AssemblyFileVersion("0.10.3.0")]
apache-2.0
C#
59e6bad0b9cf128c4f208a67fface6ad82ff48bd
Remove unnecessary interpolated string specification
peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu
osu.Game.Tests/Resources/TestResources.cs
osu.Game.Tests/Resources/TestResources.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using NUnit.Framework; using osu.Framework.IO.Stores; namespace osu.Game.Tests.Resources { public static class TestResources { public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly); public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}"); public static Stream GetTestBeatmapStream(bool virtualTrack = false) => OpenResource($"Archives/241526 Soleily - Renatus{(virtualTrack ? "_virtual" : "")}.osz"); /// <summary> /// Retrieve a path to a copy of a shortened (~10 second) beatmap archive with a virtual track. /// </summary> /// <remarks> /// This is intended for use in tests which need to run to completion as soon as possible and don't need to test a full length beatmap.</remarks> /// <returns>A path to a copy of a beatmap archive (osz). Should be deleted after use.</returns> public static string GetQuickTestBeatmapForImport() { var tempPath = Path.GetTempFileName() + ".osz"; using (var stream = OpenResource("Archives/241526 Soleily - Renatus_virtual_quick.osz")) using (var newFile = File.Create(tempPath)) stream.CopyTo(newFile); Assert.IsTrue(File.Exists(tempPath)); return tempPath; } /// <summary> /// Retrieve a path to a copy of a full-fledged beatmap archive. /// </summary> /// <param name="virtualTrack">Whether the audio track should be virtual.</param> /// <returns>A path to a copy of a beatmap archive (osz). Should be deleted after use.</returns> public static string GetTestBeatmapForImport(bool virtualTrack = false) { var tempPath = Path.GetTempFileName() + ".osz"; using (var stream = GetTestBeatmapStream(virtualTrack)) using (var newFile = File.Create(tempPath)) stream.CopyTo(newFile); Assert.IsTrue(File.Exists(tempPath)); return tempPath; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using NUnit.Framework; using osu.Framework.IO.Stores; namespace osu.Game.Tests.Resources { public static class TestResources { public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly); public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}"); public static Stream GetTestBeatmapStream(bool virtualTrack = false) => OpenResource($"Archives/241526 Soleily - Renatus{(virtualTrack ? "_virtual" : "")}.osz"); /// <summary> /// Retrieve a path to a copy of a shortened (~10 second) beatmap archive with a virtual track. /// </summary> /// <remarks> /// This is intended for use in tests which need to run to completion as soon as possible and don't need to test a full length beatmap.</remarks> /// <returns>A path to a copy of a beatmap archive (osz). Should be deleted after use.</returns> public static string GetQuickTestBeatmapForImport() { var tempPath = Path.GetTempFileName() + ".osz"; using (var stream = OpenResource($"Archives/241526 Soleily - Renatus_virtual_quick.osz")) using (var newFile = File.Create(tempPath)) stream.CopyTo(newFile); Assert.IsTrue(File.Exists(tempPath)); return tempPath; } /// <summary> /// Retrieve a path to a copy of a full-fledged beatmap archive. /// </summary> /// <param name="virtualTrack">Whether the audio track should be virtual.</param> /// <returns>A path to a copy of a beatmap archive (osz). Should be deleted after use.</returns> public static string GetTestBeatmapForImport(bool virtualTrack = false) { var tempPath = Path.GetTempFileName() + ".osz"; using (var stream = GetTestBeatmapStream(virtualTrack)) using (var newFile = File.Create(tempPath)) stream.CopyTo(newFile); Assert.IsTrue(File.Exists(tempPath)); return tempPath; } } }
mit
C#
159d3b032c2243ce6581dc9f3322925e919dfbbc
Rename locals for legibility
ppy/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu
osu.Game/Overlays/Mods/AddPresetButton.cs
osu.Game/Overlays/Mods/AddPresetButton.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mods; using osuTK; namespace osu.Game.Overlays.Mods { public class AddPresetButton : ShearedToggleButton, IHasPopover { [Resolved] private OsuColour colours { get; set; } = null!; [Resolved] private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; } = null!; public AddPresetButton() : base(1) { RelativeSizeAxes = Axes.X; Height = ModSelectPanel.HEIGHT; // shear will be applied at a higher level in `ModPresetColumn`. Content.Shear = Vector2.Zero; Padding = new MarginPadding(); Text = "+"; TextSize = 30; } protected override void LoadComplete() { base.LoadComplete(); selectedMods.BindValueChanged(mods => Enabled.Value = mods.NewValue.Any(), true); Enabled.BindValueChanged(enabled => { if (!enabled.NewValue) Active.Value = false; }); } protected override void UpdateActiveState() { DarkerColour = Active.Value ? colours.Orange1 : ColourProvider.Background3; LighterColour = Active.Value ? colours.Orange0 : ColourProvider.Background1; TextColour = Active.Value ? ColourProvider.Background6 : ColourProvider.Content1; if (Active.Value) this.ShowPopover(); else this.HidePopover(); } public Popover GetPopover() => new AddPresetPopover(this); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mods; using osuTK; namespace osu.Game.Overlays.Mods { public class AddPresetButton : ShearedToggleButton, IHasPopover { [Resolved] private OsuColour colours { get; set; } = null!; [Resolved] private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; } = null!; public AddPresetButton() : base(1) { RelativeSizeAxes = Axes.X; Height = ModSelectPanel.HEIGHT; // shear will be applied at a higher level in `ModPresetColumn`. Content.Shear = Vector2.Zero; Padding = new MarginPadding(); Text = "+"; TextSize = 30; } protected override void LoadComplete() { base.LoadComplete(); selectedMods.BindValueChanged(val => Enabled.Value = val.NewValue.Any(), true); Enabled.BindValueChanged(val => { if (!val.NewValue) Active.Value = false; }); } protected override void UpdateActiveState() { DarkerColour = Active.Value ? colours.Orange1 : ColourProvider.Background3; LighterColour = Active.Value ? colours.Orange0 : ColourProvider.Background1; TextColour = Active.Value ? ColourProvider.Background6 : ColourProvider.Content1; if (Active.Value) this.ShowPopover(); else this.HidePopover(); } public Popover GetPopover() => new AddPresetPopover(this); } }
mit
C#
1eca4b6846fb8c90dd1be3c57e5253442dba5ca8
Fix constructors of ClickBehavior class.
cube-soft/Cube.Core,cube-soft/Cube.Core,cube-soft/Cube.Forms,cube-soft/Cube.Forms
Libraries/Sources/Behaviors/ClickBehavior.cs
Libraries/Sources/Behaviors/ClickBehavior.cs
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /* ------------------------------------------------------------------------- */ using System; using System.Windows.Forms; namespace Cube.Forms.Behaviors { /* --------------------------------------------------------------------- */ /// /// ClickBehavior /// /// <summary> /// Represents the behavior that a Control object is clicked. /// </summary> /// /* --------------------------------------------------------------------- */ public class ClickBehavior : DisposableProxy { /* ----------------------------------------------------------------- */ /// /// ClickBehavior /// /// <summary> /// Initializes a new instance of the ClickBehavior class /// with the specified arguments. /// </summary> /// /// <param name="src">Source view.</param> /// <param name="action">Action to click.</param> /// /* ----------------------------------------------------------------- */ public ClickBehavior(Control src, Action action) : base(() => { void invoke(object s, EventArgs e) => action(); src.Click += invoke; return Disposable.Create(() => src.Click -= invoke); }) { } /* ----------------------------------------------------------------- */ /// /// ClickBehavior /// /// <summary> /// Initializes a new instance of the ClickBehavior class /// with the specified arguments. /// </summary> /// /// <param name="src">Source view.</param> /// <param name="action">Action to click.</param> /// /* ----------------------------------------------------------------- */ public ClickBehavior(ToolStripItem src, Action action) : base(() => { void invoke(object s, EventArgs e) => action(); src.Click += invoke; return Disposable.Create(() => src.Click -= invoke); }) { } } }
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /* ------------------------------------------------------------------------- */ using System; using System.Windows.Forms; namespace Cube.Forms.Behaviors { /* --------------------------------------------------------------------- */ /// /// ClickBehavior /// /// <summary> /// Represents the behavior that a Control object is clicked. /// </summary> /// /* --------------------------------------------------------------------- */ public class ClickBehavior : DisposableProxy { /* ----------------------------------------------------------------- */ /// /// ClickBehavior /// /// <summary> /// Initializes a new instance of the ClickBehavior class /// with the specified arguments. /// </summary> /// /// <param name="src">Source view.</param> /// <param name="action">Action to click.</param> /// /* ----------------------------------------------------------------- */ public ClickBehavior(Control src, Action action) : base(() => { void invoke(object s, EventArgs e) => action(); src.Click += invoke; return Disposable.Create(() => src.Click -= invoke); }) { } } }
apache-2.0
C#
fa40c039f496f437cfb9769af648bc313bea9774
Add english phrase.
lvazquez81/MinakoNoTango,lvazquez81/MinakoNoTango,lvazquez81/MinakoNoTango
MinakoNoTangoLib/Library/MinakoNoTangoLib.cs
MinakoNoTangoLib/Library/MinakoNoTangoLib.cs
using MinakoNoTangoLib.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MinakoNoTangoLib.Library { public interface IMinakoNoTangoLibrary { IList<PhraseEntity> GetAllPhrases(SecurityToken token); PhraseEntity GetPhraseDetail(SecurityToken token, int phraseId); bool AddEnglishCorrection(SecurityToken token, int phraseId, string correction, string comment); bool AddJapaneseCorrection(SecurityToken token, int phraseId, string correction, string comment); PhraseEntity AddEnglishPhrase(SecurityToken _testSecurityToken, string phrase, string comment); } public class MinakoNoTangoLibrary : IMinakoNoTangoLibrary { private readonly IDataAccess _dataAcces; public MinakoNoTangoLibrary(IDataAccess dataAccess) { if (dataAccess != null) { _dataAcces = dataAccess; } else { throw new ArgumentException(); } } public IList<PhraseEntity> GetAllPhrases(SecurityToken token) { return _dataAcces.GetAll(); } public PhraseEntity GetPhraseDetail(SecurityToken token, int phraseId) { return _dataAcces.GetSingle(phraseId); } public bool AddEnglishCorrection(SecurityToken token, int phraseId, string correction, string comment) { return true; } public bool AddJapaneseCorrection(SecurityToken token, int phraseId, string correction, string comment) { PhraseEntity storedPhrase = _dataAcces.GetSingle(phraseId); storedPhrase.JapansePhrase = correction; return true; } public PhraseEntity AddEnglishPhrase(SecurityToken token, string phrase, string comment) { PhraseEntity newPhrase = new PhraseEntity() { EnglishPhrase = phrase, Comments = new List<CommentEntity>() { new CommentEntity(){ AuthorName = token.Username, Comment = comment } } }; _dataAcces.Add(newPhrase); return newPhrase; } } }
using MinakoNoTangoLib.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MinakoNoTangoLib.Library { public interface IMinakoNoTangoLibrary { IList<PhraseEntity> GetAllPhrases(SecurityToken token); PhraseEntity GetPhraseDetail(SecurityToken token, int phraseId); bool AddEnglishCorrection(SecurityToken token, int phraseId, string correction, string comment); bool AddJapaneseCorrection(SecurityToken token, int phraseId, string correction, string comment); } public class MinakoNoTangoLibrary : IMinakoNoTangoLibrary { private readonly IDataAccess _dataAcces; public MinakoNoTangoLibrary(IDataAccess dataAccess) { if (dataAccess != null) { _dataAcces = dataAccess; } else { throw new ArgumentException(); } } public IList<PhraseEntity> GetAllPhrases(SecurityToken token) { return _dataAcces.GetAll(); } public PhraseEntity GetPhraseDetail(SecurityToken token, int phraseId) { return _dataAcces.GetSingle(phraseId); } public bool AddEnglishCorrection(SecurityToken token, int phraseId, string correction, string comment) { return true; } public bool AddJapaneseCorrection(SecurityToken token, int phraseId, string correction, string comment) { PhraseEntity storedPhrase = _dataAcces.GetSingle(phraseId); storedPhrase.JapansePhrase = correction; return true; } } }
mit
C#
693277ea6d363914dca7765ae34d1e342f9d0da7
Update TiledObject.cs
prime31/Nez,prime31/Nez,Blucky87/Nez,prime31/Nez,ericmbernier/Nez,eumario/Nez
Nez-PCL/PipelineRuntime/Tiled/TiledObject.cs
Nez-PCL/PipelineRuntime/Tiled/TiledObject.cs
using System; using Microsoft.Xna.Framework; using System.Collections.Generic; namespace Nez.Tiled { public class TiledObject { public enum TiledObjectType { None, Ellipse, Image, Polygon, Polyline } public int gid; public string name; public string type; public int x; public int y; public int width; public int height; public int rotation; public bool visible; public TiledObjectType tiledObjectType; public string objectType; public Vector2[] polyPoints; public Dictionary<string,string> properties = new Dictionary<string,string>(); public Vector2 position { get { return new Vector2(x, y); } set { x = (int)value.X; y = (int)value.Y; } } public TiledObject() {} } }
using System; using Microsoft.Xna.Framework; using System.Collections.Generic; namespace Nez.Tiled { public class TiledObject { public enum TiledObjectType { None, Ellipse, Image, Polygon, Polyline } public int gid; public string name; public string type; public int x; public int y; public int width; public int height; public int rotation; public bool visible; public TiledObjectType tiledObjectType; public string objectType; public Vector2[] polyPoints; public Dictionary<string,string> properties = new Dictionary<string,string>(); public Vector2 position { get { return new Vector2(x, y); } set { x = (int)value.X; y = (int)value.Y; } } public TiledObject() {} } }
mit
C#
03a2aa92350c96759ffc8899ff81578012e1aabb
Update privacy
GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu
src/Dangl.WebDocumentation/Views/Home/Privacy.cshtml
src/Dangl.WebDocumentation/Views/Home/Privacy.cshtml
@using Microsoft.Extensions.Options @inject IOptions<AppSettings> AppSettings <h1>Legal Notice &amp; Privacy</h1> <p>@AppSettings.Value.SiteTitlePrefix<strong>@AppSettings.Value.SiteTitlePostfix</strong> hosts all documentation and help pages for products and services offered by Dangl<strong>IT</strong> as well as for multiple open source projects.</p> <p> This website is operated and hosted by <a href="https://www.dangl-it.com/legal-notice/">Dangl<strong>IT</strong> GmbH</a>. Please <a href="mailto:info@dangl-it.com">contact us</a> for any further questions. </p> <p> <strong> The source code for this website is completely open and available at <a href="https://github.com/GeorgDangl/WebDocu">GitHub</a>. </strong> </p> <h2>Privacy Information</h2> <p>If you have no user account, no information about you is stored.</p> <p> For user accounts, your <a href="@AppSettings.Value.DanglIdentityBaseUrl">Dangl<strong>.Identity</strong> user account</a> will be used to access this site. You will not receive automated newsletters, we will not give your information to anyone and we will not use your information for anything else than providing this documentation website. </p> <p> If you have enabled Notifications for projects, you will receive emails when a new release is available. These emails do not contain personally identifiable information about you and have no tracking components embedded. You can manage your notifications in the <i>Notifications</i> section when you are logged in. </p> <p> You only need your own user account if you are a customer of Dangl<strong>IT</strong> and want to get access to internal, non-public information. </p> <hr /> <p>Dangl<strong>Docu</strong> @Dangl.WebDocumentation.Services.VersionsService.Version, built @Dangl.WebDocumentation.Services.VersionsService.BuildDateUtc.ToString("dd.MM.yyyy HH:mm") (UTC)</p>
@using Microsoft.Extensions.Options @inject IOptions<AppSettings> AppSettings <h1>Legal Notice &amp; Privacy</h1> <p>@AppSettings.Value.SiteTitlePrefix<strong>@AppSettings.Value.SiteTitlePostfix</strong> hosts all documentation and help pages for products and services offered by Dangl<strong>IT</strong> as well as for multiple open source projects.</p> <p> This website is operated and hosted by <a href="https://www.dangl-it.com/legal-notice/">Dangl<strong>IT</strong> GmbH</a>. Please <a href="mailto:info@dangl-it.com">contact us</a> for any further questions. </p> <p> <strong> The source code for this website is completely open and available at <a href="https://github.com/GeorgDangl/WebDocu">GitHub</a>. </strong> </p> <h2>Privacy Information</h2> <p>If you have no user account, no information about you is stored.</p> <p> For user accounts, the only personal identifiable information stored about you is your email address. You will not receive automated newsletters, we will not give your information to anyone and we will not use your information for anything else than providing this documentation website. </p> <p> If you have enabled Notifications for projects, you will receive emails when a new release is available. These emails do not contain personally identifiable information about you and have no tracking components embedded. You can manage your notifications in the <i>Notifications</i> section when you are logged in. </p> <p> You only need your own user account if you are a customer of Dangl<strong>IT</strong> and want to get access to internal, non-public information. </p> <hr /> <p>Dangl<strong>Docu</strong> @Dangl.WebDocumentation.Services.VersionsService.Version, built @Dangl.WebDocumentation.Services.VersionsService.BuildDateUtc.ToString("dd.MM.yyyy HH:mm") (UTC)</p>
mit
C#
6fb4cf632ee1b7612e1cf36db2a556fc0944ae2b
remove copyright
sergsalo/EFCache.RedisCache
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("EFCache.RedisCache")] [assembly: AssemblyProduct("EFCache.RedisCache")] [assembly: ComVisible(false)] [assembly: Guid("de79fc43-1a35-46fe-b254-19c280deb6cd")] [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.*")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("EFCache.RedisCache")] [assembly: AssemblyProduct("EFCache.RedisCache")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: ComVisible(false)] [assembly: Guid("de79fc43-1a35-46fe-b254-19c280deb6cd")] [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.*")]
mit
C#
2c78bb789db862c7c70b011fc5f5a80ecf2b30ac
write flags to model if present
Pondidum/OctopusStore,Pondidum/OctopusStore
OctopusStore/Consul/KeyValueController.cs
OctopusStore/Consul/KeyValueController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Text; using System.Web.Http; using OctopusStore.Infrastructure; namespace OctopusStore.Consul { public class KeyValueController : ApiController { private readonly VariableStore _store; public KeyValueController(VariableStore store) { _store = store; } public IEnumerable<ValueModel> GetKv(string keyGreedy) { var key = keyGreedy ?? string.Empty; var pairs = Request.GetQueryNameValuePairs(); var recurse = pairs.Any(pair => pair.Key.EqualsIgnore("recurse")); return recurse ? _store.GetValuesPrefixed(key) : _store.GetValue(key); } public HttpResponseMessage PutKv([FromBody]string content, string keyGreedy) { var pairs = Request.GetQueryNameValuePairs(); _store.WriteValue(keyGreedy, model => { model.Value = Convert.ToBase64String(Encoding.UTF8.GetBytes(content)); pairs .Where(p => p.Key.EqualsIgnore("flags")) .Select(p => Convert.ToInt32(p.Value)) .DoFirst(value => model.Flags = value); }); return new HttpResponseMessage(HttpStatusCode.OK); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Text; using System.Web.Http; namespace OctopusStore.Consul { public class KeyValueController : ApiController { private readonly VariableStore _store; public KeyValueController(VariableStore store) { _store = store; } public IEnumerable<ValueModel> GetKv(string keyGreedy) { var key = keyGreedy ?? string.Empty; var pairs = Request.GetQueryNameValuePairs(); var recurse = pairs.Any(pair => pair.Key.Equals("recurse", StringComparison.OrdinalIgnoreCase)); return recurse ? _store.GetValuesPrefixed(key) : _store.GetValue(key); } public HttpResponseMessage PutKv([FromBody]string content, string keyGreedy) { _store.WriteValue(keyGreedy, model => { model.Value = Convert.ToBase64String(Encoding.UTF8.GetBytes(content)); //if request has "?flags" then write them }); return new HttpResponseMessage(HttpStatusCode.OK); } } }
lgpl-2.1
C#
acb240fa26274e59db65df67bdf2a7623ddbcba4
Add null check to RefSpecCollection
gep13/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,gep13/GitVersion,GitTools/GitVersion,asbjornu/GitVersion
src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs
src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs
using GitVersion.Extensions; namespace GitVersion; internal sealed class RefSpecCollection : IRefSpecCollection { private readonly LibGit2Sharp.RefSpecCollection innerCollection; internal RefSpecCollection(LibGit2Sharp.RefSpecCollection collection) => this.innerCollection = collection.NotNull(); public IEnumerator<IRefSpec> GetEnumerator() => this.innerCollection.Select(tag => new RefSpec(tag)).GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); }
namespace GitVersion; internal sealed class RefSpecCollection : IRefSpecCollection { private readonly LibGit2Sharp.RefSpecCollection innerCollection; internal RefSpecCollection(LibGit2Sharp.RefSpecCollection collection) => this.innerCollection = collection; public IEnumerator<IRefSpec> GetEnumerator() => this.innerCollection.Select(tag => new RefSpec(tag)).GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); }
mit
C#
e316db08df60982bfc654440e2db966fa3e18321
add EOF in client side msg creater
ravjotsingh9/DBLike
DBLike/Client/Message/CreateMsg.Poll.cs
DBLike/Client/Message/CreateMsg.Poll.cs
using System; using Client.MessageClasses; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Client.Message { public partial class CreateMsg { /// <summary> /// poll protocol /// +--------------------------+ /// |POLL:<userName>:<password>| /// +--------------------------+ /// </summary> /// <param name="msgpoll"></param> /// <returns></returns> public string pollMsg(MsgPoll msgpoll) { string msg = "<POLL>:<" + msgpoll.userName + ">:<" + msgpoll.password + ": <" + msgpoll.nodeInfo + ">" + ":<EOF>"; return msg; } } }
using System; using Client.MessageClasses; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Client.Message { public partial class CreateMsg { /// <summary> /// poll protocol /// +--------------------------+ /// |POLL:<userName>:<password>| /// +--------------------------+ /// </summary> /// <param name="msgpoll"></param> /// <returns></returns> public string pollMsg(MsgPoll msgpoll) { string msg = "<POLL>:<" + msgpoll.userName + ">:<" + msgpoll.password +": <"+msgpoll.nodeInfo+ ">"; return msg; } } }
apache-2.0
C#
f8ab83856abd33d06a4956a7264eeaf709ec951f
clean up code
hemincong/PostageStampTransactionHelper
PostageStampTransactionHelper/App.xaml.cs
PostageStampTransactionHelper/App.xaml.cs
using System.Windows; namespace PostageStampTransactionHelper { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App { } }
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace PostageStampTransactionHelper { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { } }
apache-2.0
C#
8e8231b14f5ba9eda456a2b63915c54ffa2a86b4
Fix dependency injection error
ethanmoffat/EndlessClient
EOLib/Net/NetworkDependencyContainer.cs
EOLib/Net/NetworkDependencyContainer.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 using EOLib.Net.Communication; using EOLib.Net.Connection; using EOLib.Net.PacketProcessing; using Microsoft.Practices.Unity; namespace EOLib.Net { public class NetworkDependencyContainer : IInitializableContainer { public void RegisterDependencies(IUnityContainer container) { container.RegisterType<IPacketEncoderService, PacketEncoderService>(); container.RegisterType<IPacketSequenceService, PacketSequenceService>(); container.RegisterType<IInitDataGeneratorService, InitDataGeneratorService>(); container.RegisterType<IHashService, HashService>(); container.RegisterType<INetworkClientFactory, NetworkClientFactory>(); container.RegisterType<INetworkClientRepository, NetworkClientRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<INetworkClientProvider, NetworkClientRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketQueueRepository, PacketQueueRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketQueueProvider, PacketQueueRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketEncoderRepository, PacketEncoderRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<ISequenceRepository, SequenceRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketProcessorActions, PacketProcessActions>(); container.RegisterType<INetworkConnectionActions, NetworkConnectionActions>(); //must be a singleton: tracks a thread and has internal state. container.RegisterType<IBackgroundReceiveActions, BackgroundReceiveActions>(new ContainerControlledLifetimeManager()); } public void InitializeDependencies(IUnityContainer container) { //create the packet queue object (can be recreated later) var packetQueueRepository = container.Resolve<IPacketQueueRepository>(); packetQueueRepository.PacketQueue = new PacketQueue(); //create the client object (can be recreated later) var clientRepo = container.Resolve<INetworkClientRepository>(); var clientFactory = container.Resolve<INetworkClientFactory>(); clientRepo.NetworkClient = clientFactory.CreateNetworkClient(); } } }
// Original Work Copyright (c) Ethan Moffat 2014-2016 // This file is subject to the GPL v2 License // For additional details, see the LICENSE file using EOLib.Net.Communication; using EOLib.Net.Connection; using EOLib.Net.PacketProcessing; using Microsoft.Practices.Unity; namespace EOLib.Net { public class NetworkDependencyContainer : IInitializableContainer { public void RegisterDependencies(IUnityContainer container) { container.RegisterType<IPacketEncoderService, PacketEncoderService>(); container.RegisterType<IPacketSequenceService, PacketSequenceService>(); container.RegisterType<IInitDataGeneratorService, InitDataGeneratorService>(); container.RegisterType<IHashService, HashService>(); container.RegisterType<INetworkClientFactory, NetworkClientFactory>(); container.RegisterType<INetworkClientRepository, NetworkClientRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<INetworkClientProvider, NetworkClientRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketQueueRepository, PacketQueueRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketQueueProvider, IPacketQueueProvider>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketEncoderRepository, PacketEncoderRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<ISequenceRepository, SequenceRepository>(new ContainerControlledLifetimeManager()); container.RegisterType<IPacketProcessorActions, PacketProcessActions>(); container.RegisterType<INetworkConnectionActions, NetworkConnectionActions>(); //must be a singleton: tracks a thread and has internal state. container.RegisterType<IBackgroundReceiveActions, BackgroundReceiveActions>(new ContainerControlledLifetimeManager()); } public void InitializeDependencies(IUnityContainer container) { //create the packet queue object (can be recreated later) var packetQueueRepository = container.Resolve<IPacketQueueRepository>(); packetQueueRepository.PacketQueue = new PacketQueue(); //create the client object (can be recreated later) var clientRepo = container.Resolve<INetworkClientRepository>(); var clientFactory = container.Resolve<INetworkClientFactory>(); clientRepo.NetworkClient = clientFactory.CreateNetworkClient(); } } }
mit
C#
07424f37c4854ca045d59783bc8d8b66057fa2f3
Update RefitSettings.cs
PKRoma/refit,mteper/refit,ammachado/refit,paulcbetts/refit,paulcbetts/refit,mteper/refit,PureWeen/refit,martijn00/refit,martijn00/refit,onovotny/refit,ammachado/refit,jlucansky/refit,jlucansky/refit,onovotny/refit,PureWeen/refit
Refit/RefitSettings.cs
Refit/RefitSettings.cs
using System.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace Refit { public class RefitSettings { public RefitSettings() { UrlParameterFormatter = new DefaultUrlParameterFormatter(); } public JsonSerializerSettings JsonSerializerSettings { get; set; } public IUrlParameterFormatter UrlParameterFormatter { get; set; } } public interface IUrlParameterFormatter { string Format(object value, ParameterInfo parameterInfo); } public class DefaultUrlParameterFormatter : IUrlParameterFormatter { public virtual string Format(object parameterValue, ParameterInfo parameterInfo) { return parameterValue != null ? parameterValue.ToString() : null; } } }
using System.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace Refit { public class RefitSettings { public RefitSettings() { UrlParameterFormatter = new DefaultUrlParameterFormatter(); JsonSerializerSettings = JsonConvert.DefaultSettings == null ? new JsonSerializerSettings() : JsonConvert.DefaultSettings(); } public JsonSerializerSettings JsonSerializerSettings { get; set; } public IUrlParameterFormatter UrlParameterFormatter { get; set; } } public interface IUrlParameterFormatter { string Format(object value, ParameterInfo parameterInfo); } public class DefaultUrlParameterFormatter : IUrlParameterFormatter { public virtual string Format(object parameterValue, ParameterInfo parameterInfo) { return parameterValue != null ? parameterValue.ToString() : null; } } }
mit
C#
c393c30ede1e4e72a057e792eea321e17bc7ee18
Update Tabela Categorias
Arionildo/Quiz-CWI,Arionildo/Quiz-CWI,Arionildo/Quiz-CWI
Quiz/Quiz.Web/Migrations/Configuration.cs
Quiz/Quiz.Web/Migrations/Configuration.cs
namespace Quiz.Web.Migrations { using Quiz.Dominio; using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration<Quiz.Web.Models.ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(Quiz.Web.Models.ApplicationDbContext context) { // This method will be called after migrating to the latest version. context.Categorias.AddOrUpdate( p => p.Nome, new Categoria { Nome = "Cincia", Descricao = "Mistura de todos os assuntos das mais diversas reas." }, new Categoria { Nome = "Comidas E Bebidas", Descricao = "Questes relacionadas bandas, cantores e todos os estilos musicais." }, new Categoria { Nome = "Conhecimentos Gerais", Descricao = "Tudo sobre filmes, atores e, quem sabe, at diretores!" }, new Categoria { Nome = "Esportes", Descricao = "Dos elementos que nos compe at a fsica que nos segura na terra." }, new Categoria { Nome = "Filme", Descricao = "Desde os ingredientes diversos pratos e bebidas existentes ao redor do mundo." }, new Categoria { Nome = "Geografia", Descricao = "Lugares, climas, vegetaes e tudo mais que a natureza tem a oferecer." }, new Categoria { Nome = "Jogos", Descricao = "Para aqueles quem no perdem uma novela, uma srie ou at mesmo um programa de celebridades." }, new Categoria { Nome = "Msica", Descricao = "'Piece of cake' para os mais aficionados em jogos, seus personagens e suas histrias." }, new Categoria { Nome = "TV", Descricao = "Todas as modalidades, do mais leve ao mais radical." } ); } } }
namespace Quiz.Web.Migrations { using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration<Quiz.Web.Models.ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(Quiz.Web.Models.ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } } }
mit
C#
bd7fb0825b0488a1f7a853be5b2377a9a11290bc
FIX logger variable in PS scripts
tfsaggregator/tfsaggregator-core
Script/PsScriptEngine.cs
Script/PsScriptEngine.cs
using System.Collections.Generic; using System.Management.Automation.Runspaces; using Aggregator.Core.Interfaces; using Aggregator.Core.Monitoring; namespace Aggregator.Core { /// <summary> /// Invokes Powershell scripting engine /// </summary> public class PsScriptEngine : ScriptEngine { private readonly Dictionary<string, string> scripts = new Dictionary<string, string>(); public PsScriptEngine(IWorkItemRepository store, ILogEvents logger, bool debug) : base(store, logger, debug) { } public override bool Load(string scriptName, string script) { this.scripts.Add(scriptName, script); return true; } public override bool LoadCompleted() { return true; } public override void Run(string scriptName, IWorkItem workItem) { string script = this.scripts[scriptName]; var config = RunspaceConfiguration.Create(); using (var runspace = RunspaceFactory.CreateRunspace(config)) { runspace.Open(); runspace.SessionStateProxy.SetVariable("self", workItem); runspace.SessionStateProxy.SetVariable("store", this.Store); runspace.SessionStateProxy.SetVariable("logger", this.Logger); Pipeline pipeline = runspace.CreatePipeline(); pipeline.Commands.AddScript(script); // execute var results = pipeline.Invoke(); this.Logger.ResultsFromScriptRun(scriptName, results); } } } }
using System.Collections.Generic; using System.Management.Automation.Runspaces; using Aggregator.Core.Interfaces; using Aggregator.Core.Monitoring; namespace Aggregator.Core { /// <summary> /// Invokes Powershell scripting engine /// </summary> public class PsScriptEngine : ScriptEngine { private readonly Dictionary<string, string> scripts = new Dictionary<string, string>(); public PsScriptEngine(IWorkItemRepository store, ILogEvents logger, bool debug) : base(store, logger, debug) { } public override bool Load(string scriptName, string script) { this.scripts.Add(scriptName, script); return true; } public override bool LoadCompleted() { return true; } public override void Run(string scriptName, IWorkItem workItem) { string script = this.scripts[scriptName]; var config = RunspaceConfiguration.Create(); using (var runspace = RunspaceFactory.CreateRunspace(config)) { runspace.Open(); runspace.SessionStateProxy.SetVariable("self", workItem); runspace.SessionStateProxy.SetVariable("store", this.Store); Pipeline pipeline = runspace.CreatePipeline(); pipeline.Commands.AddScript(script); // execute var results = pipeline.Invoke(); this.Logger.ResultsFromScriptRun(scriptName, results); } } } }
apache-2.0
C#
fb56c041f11f542ea81afc0617fa26885cea75d7
Load Context from Save File (first step)
GGProductions/LetterStorm,GGProductions/LetterStorm,GGProductions/LetterStorm
Assets/Scripts/Context.cs
Assets/Scripts/Context.cs
using UnityEngine; using System.Collections; using GGProductions.LetterStorm.Data.Collections; using GGProductions.LetterStorm.Data; using GGProductions.LetterStorm.Utilities; public class Context : MonoBehaviour { #region Private Variables --------------------------------------------- // Create the private variables that the this class's // properties will use to store their data private static LessonBook _curriculum; private static int _playerLives; private static Inventory _playerInventory; private static char[] _alphabet; #endregion Private Variables ------------------------------------------ #region Properties ---------------------------------------------------- /// <summary>Stores the alphabet for efficient coding</summary> public static char[] Alphabet { get { return _alphabet; } set { _alphabet = value; } } /// <summary>Represents all the Lessons for a specific user</summary> public static LessonBook Curriculum { get { return _curriculum; } set { _curriculum = value; } } /// <summary>Player inventory</summary> public static Inventory PlayerInventory { get { return _playerInventory; } set { _playerInventory = value; } } /// <summary>Tracks player lives</summary> public static int PlayerLives { get { return _playerLives; } set { _playerLives = value; } } #endregion Properties ------------------------------------------------- #region Event Handlers ---------------------------------------------------- /// <summary> /// Method that runs only once in the beginning /// </summary> void Start() { PlayerLives = 3; PlayerInventory = new Inventory(); Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); // Populate the Context from the save file LoadDataFromSaveFile(false); } #endregion Event Handlers ------------------------------------------------- #region Helper Methods ---------------------------------------------------- /// <summary> /// Populate the Context from the save file /// </summary> /// <param name="loadGameState"> /// True=Load both the stateless data and the game state from the save file (ie the user is loading a saved game); /// False=Load only the stateless data from the save file (ie the user is starting a new game) /// </param> private void LoadDataFromSaveFile(bool loadGameState) { // Retrieve all data from the save file PlayerData tmpPlayerData = GameStateUtilities.Load(); // Copy the lessons to the Context _curriculum = tmpPlayerData.Curriculum; // If the user has not created any lessons, create a sample lesson to work with if (_curriculum.Lessons.Count == 0) { _curriculum.CreateSampleLesson(); } // If the game state should be loaded (ie the user is loading a saved game)... if (loadGameState) { // PLACEHOLDER: This code has not yet been implimented } } #endregion Helper Methods ------------------------------------------------- }
using UnityEngine; using System.Collections; public class Context : MonoBehaviour { // Static variables to track in-game information // Tracks player lives public static int PlayerLives; // Player inventory public static Inventory PlayerInventory; // Stores the alphabet for efficient coding public static char[] Alphabet; /// <summary> /// Method that runs only once in the beginning /// </summary> void Start() { PlayerLives = 3; PlayerInventory = new Inventory(); Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); } }
mit
C#
07effbb2e86f8c16648d0d1a9c2f1582ec468c7f
Remove invalid test. This test tested a feature that was not part of the Constant Score query.
SolrNet/SolrNet,SolrNet/SolrNet,mausch/SolrNet,mausch/SolrNet,mausch/SolrNet
SolrNet.Tests/SolrConstantScoreQueryTests.cs
SolrNet.Tests/SolrConstantScoreQueryTests.cs
#region license // Copyright (c) 2007-2010 Mauricio Scheffer // // 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. #endregion using System; using Xunit; using SolrNet.Impl.FieldSerializers; using SolrNet.Impl.QuerySerializers; namespace SolrNet.Tests { public class SolrConstantScoreQueryTests { [Fact] public void ConstantScore() { var q = new SolrConstantScoreQuery(new SolrQuery("solr"), 34.2); var serializer = new DefaultQuerySerializer(new DefaultFieldSerializer()); var query = serializer.Serialize(q); Assert.Equal("(solr)^=34.2", query); } [Fact] public void ConstantScore_with_high_value() { var q = new SolrConstantScoreQuery(new SolrQuery("solr"), 34.2E10); var serializer = new DefaultQuerySerializer(new DefaultFieldSerializer()); var query = serializer.Serialize(q); Assert.Equal("(solr)^=342000000000", query); } } }
#region license // Copyright (c) 2007-2010 Mauricio Scheffer // // 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. #endregion using System; using Xunit; using SolrNet.Impl.FieldSerializers; using SolrNet.Impl.QuerySerializers; namespace SolrNet.Tests { public class SolrConstantScoreQueryTests { [Fact] public void ConstantScore() { var q = new SolrConstantScoreQuery(new SolrQuery("solr"), 34.2); var serializer = new DefaultQuerySerializer(new DefaultFieldSerializer()); var query = serializer.Serialize(q); Assert.Equal("(solr)^=34.2", query); } [Fact] public void ConstantScore_with_high_value() { var q = new SolrConstantScoreQuery(new SolrQuery("solr"), 34.2E10); var serializer = new DefaultQuerySerializer(new DefaultFieldSerializer()); var query = serializer.Serialize(q); Assert.Equal("(solr)^=342000000000", query); } [Fact] public void SolrQuery_ConstantScore() { var q = new SolrQuery("solr").Boost(12.2); var serializer = new DefaultQuerySerializer(new DefaultFieldSerializer()); var query = serializer.Serialize(q); Assert.Equal("(solr)^=12.2", query); } } }
apache-2.0
C#
af1035b9fb947dce6da86724b3eeb9411b79f91d
Fix some code
obsoleted/fnapp,obsoleted/fnapp
CSharpHttpTrigger/run.csx
CSharpHttpTrigger/run.csx
using System; using System.Net; using System.Net.Http; using System.Threading; public static async Task<HttpResponseMessage> Run(HttpRequestMessage httpTrigger, string id, bool? activearg, TraceWriter log, CancellationToken cancellationToken) { log.Info($"CSharpHttpTrigger invoked. RequestUri={httpTrigger.RequestUri}"); bool active = activearg ?? false; return httpTrigger.CreateResponse(HttpStatusCode.OK, $"Id: {id} Active: {active}"); }
using System; using System.Net; using System.Net.Http; public static async Task<HttpResponseMessage> Run(HttpRequestMessage httpTrigger, string id, bool? activearg, TraceWriter log, CancellationToken cancellationToken) { log.Info($"CSharpHttpTrigger invoked. RequestUri={httpTrigger.RequestUri}"); bool active = active?.Value ?? false; return httpTrigger.CreateResponse(HttpStatusCode.OK, $"Id: {id} Active: {active}"); }
mit
C#
e6a30c4b463088b706bb1d0cb4629ebf7f199200
Update CSTest.cs
KhanAcademyAmateurs/Blaze,KhanAcademyAmateurs/Blaze,KhanAcademyAmateurs/Blaze
Cities-Skylines/CSTest.cs
Cities-Skylines/CSTest.cs
using System; //using git; //using Forms; partial class Test{ public static void doDatTest(string str){ MessageBox.show("Hai! This is a TEST BAYBEH!!"); } public static string bahHumbug(){ return "bah humbug"; } private string disBePrivate(){ return "This is private. How did you get here again?"; } }
class Test{ }
mit
C#
239aebac15de399f0d465da69cd27d7ac1f367e4
Add uncommited changes
hishamco/WebForms,hishamco/WebForms
samples/WebFormsSample/Startup.cs
samples/WebFormsSample/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace WebFormsSample { public class Startup { public void ConfigureServices(IServiceCollection services) { //services.AddWebForms(options => options.PagesLocation = "WebForms"); services.AddWebForms() .WithRazorTemplate(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(LogLevel.Debug); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseWebForms(); } } }
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace WebFormsSample { public class Startup { public void ConfigureServices(IServiceCollection services) { //services.AddWebForms(options => options.PagesLocation = "WebForms"); services.AddWebForms() .WithRazorTemplate(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(LogLevel.Debug); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseWebForms(); } } }
mit
C#
4217926d546862f74eb682a2411a1b0c45d709e1
Update compiler to return only the nodes
exodrifter/unity-rumor
Compiler/RumorCompiler.cs
Compiler/RumorCompiler.cs
using System; using System.Collections.Generic; using Exodrifter.Rumor.Engine; using Exodrifter.Rumor.Parser; namespace Exodrifter.Rumor.Compiler { public class RumorCompiler { private RumorParserState userState; public RumorCompiler() { userState = new RumorParserState(); } public Dictionary<string, List<Node>> Compile (string script, RumorScope scope = null) { var state = new ParserState(script, tabSize, userState); return Compiler.Script(state); } #region Settings private int tabSize = 4; public RumorCompiler SetTabSize(int tabSize) { this.tabSize = tabSize; return this; } #endregion #region Bindings public RumorCompiler LinkAction(string name) { userState.LinkAction(name); return this; } public RumorCompiler LinkAction(string name, Engine.ValueType p1) { userState.LinkAction(name, p1); return this; } public RumorCompiler LinkAction (string name, Engine.ValueType p1, Engine.ValueType p2) { userState.LinkAction(name, p1, p2); return this; } public RumorCompiler LinkAction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3) { userState.LinkAction(name, p1, p2, p3); return this; } public RumorCompiler LinkAction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3, Engine.ValueType p4) { userState.LinkAction(name, p1, p2, p3, p4); return this; } public RumorCompiler LinkFunction(string name, Engine.ValueType result) { userState.LinkFunction(name, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType result) { userState.LinkFunction(name, p1, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType result) { userState.LinkFunction(name, p1, p2, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3, Engine.ValueType result) { userState.LinkFunction(name, p1, p2, p3, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3, Engine.ValueType p4, Engine.ValueType result) { userState.LinkFunction(name, p1, p2, p3, p4, result); return this; } #endregion } }
using System; using System.Collections.Generic; using Exodrifter.Rumor.Engine; using Exodrifter.Rumor.Parser; namespace Exodrifter.Rumor.Compiler { public class RumorCompiler { private RumorParserState userState; public RumorCompiler() { userState = new RumorParserState(); } public Engine.Rumor Compile(string script, RumorScope scope = null) { var state = new ParserState(script, tabSize, userState); var nodes = Compiler.Script(state); return new Engine.Rumor(nodes, scope); } #region Settings private int tabSize = 4; public RumorCompiler SetTabSize(int tabSize) { this.tabSize = tabSize; return this; } #endregion #region Bindings public RumorCompiler LinkAction(string name) { userState.LinkAction(name); return this; } public RumorCompiler LinkAction(string name, Engine.ValueType p1) { userState.LinkAction(name, p1); return this; } public RumorCompiler LinkAction (string name, Engine.ValueType p1, Engine.ValueType p2) { userState.LinkAction(name, p1, p2); return this; } public RumorCompiler LinkAction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3) { userState.LinkAction(name, p1, p2, p3); return this; } public RumorCompiler LinkAction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3, Engine.ValueType p4) { userState.LinkAction(name, p1, p2, p3, p4); return this; } public RumorCompiler LinkFunction(string name, Engine.ValueType result) { userState.LinkFunction(name, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType result) { userState.LinkFunction(name, p1, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType result) { userState.LinkFunction(name, p1, p2, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3, Engine.ValueType result) { userState.LinkFunction(name, p1, p2, p3, result); return this; } public RumorCompiler LinkFunction (string name, Engine.ValueType p1, Engine.ValueType p2, Engine.ValueType p3, Engine.ValueType p4, Engine.ValueType result) { userState.LinkFunction(name, p1, p2, p3, p4, result); return this; } #endregion } }
mit
C#
c7da986288f60765972a6a4afdcd787e80ea92d1
Fix "Keep Window Centered" option
danielchalmers/SteamAccountSwitcher
SteamAccountSwitcher/SwitchWindow.xaml.cs
SteamAccountSwitcher/SwitchWindow.xaml.cs
#region using System; using System.ComponentModel; using System.Windows; using System.Windows.Interop; using SteamAccountSwitcher.Properties; #endregion namespace SteamAccountSwitcher { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class SwitchWindow : Window { public SwitchWindow() { InitializeComponent(); WindowStartupLocation = Settings.Default.SwitchWindowKeepCentered ? WindowStartupLocation.CenterScreen : WindowStartupLocation.Manual; ReloadAccountListBinding(); } public void ReloadAccountListBinding() { AccountView.DataContext = null; AccountView.DataContext = App.Accounts; } private void Window_Closing(object sender, CancelEventArgs e) { if (App.IsShuttingDown) return; if (Settings.Default.AlwaysOn) { e.Cancel = true; HideWindow(); return; } AppHelper.ShutdownApplication(); } public void HideWindow() { var visible = Visibility == Visibility.Visible; Hide(); if (visible && Settings.Default.AlwaysOn) TrayIconHelper.ShowRunningInTrayBalloon(); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); var mainWindowPtr = new WindowInteropHelper(this).Handle; var mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr); mainWindowSrc?.AddHook(SingleInstanceHelper.WndProc); } } }
#region using System; using System.ComponentModel; using System.Windows; using System.Windows.Interop; using SteamAccountSwitcher.Properties; #endregion namespace SteamAccountSwitcher { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class SwitchWindow : Window { public SwitchWindow() { InitializeComponent(); ReloadAccountListBinding(); } public void ReloadAccountListBinding() { AccountView.DataContext = null; AccountView.DataContext = App.Accounts; } private void Window_Closing(object sender, CancelEventArgs e) { if (App.IsShuttingDown) return; if (Settings.Default.AlwaysOn) { e.Cancel = true; HideWindow(); return; } AppHelper.ShutdownApplication(); } public void HideWindow() { var visible = Visibility == Visibility.Visible; Hide(); if (visible && Settings.Default.AlwaysOn) TrayIconHelper.ShowRunningInTrayBalloon(); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); var mainWindowPtr = new WindowInteropHelper(this).Handle; var mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr); mainWindowSrc?.AddHook(SingleInstanceHelper.WndProc); } } }
mit
C#
8c013161b4e9b66350f45088d5090120ff8578a1
Bump version number for dialog changes
NickLargen/Junctionizer
Junctionizer/Properties/AssemblyInfo.cs
Junctionizer/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Junctionizer")] [assembly: AssemblyProduct("Junctionizer")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US English //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.0")] [assembly: AssemblyFileVersion("0.4.0")] [assembly: AssemblyInformationalVersion("Alpha")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Junctionizer")] [assembly: AssemblyProduct("Junctionizer")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US English //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.0")] [assembly: AssemblyFileVersion("0.3.0")] [assembly: AssemblyInformationalVersion("Alpha")]
mit
C#
bf65af2fb4606efe0f19815eea8911c26d7128fe
Change Level of ScrollToComponentLogSection to Trace
YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata
src/Atata/Logging/Sections/ScrollToComponentLogSection.cs
src/Atata/Logging/Sections/ScrollToComponentLogSection.cs
namespace Atata { public class ScrollToComponentLogSection : UIComponentLogSection { public ScrollToComponentLogSection(UIComponent component) : base(component) { Level = LogLevel.Trace; Message = $"Scroll to {component.ComponentFullName}"; } } }
namespace Atata { public class ScrollToComponentLogSection : UIComponentLogSection { public ScrollToComponentLogSection(UIComponent component) : base(component) { Message = $"Scroll to {component.ComponentFullName}"; } } }
apache-2.0
C#
3e5d1e75b2e103a6bec2bb27862b54cc0a976dcd
Change to trigger the CI pipeline again.
GitTools/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,asbjornu/GitVersion
src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs
src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs
using GitVersion.Model.Configuration; namespace GitVersion.Common; public interface IRepositoryStore { /// <summary> /// Find the merge base of the two branches, i.e. the best common ancestor of the two branches' tips. /// </summary> ICommit? FindMergeBase(IBranch? branch, IBranch? otherBranch); ICommit? FindMergeBase(ICommit commit, ICommit mainlineTip); ICommit? GetCurrentCommit(IBranch currentBranch, string? commitId); ICommit GetBaseVersionSource(ICommit currentBranchTip); IEnumerable<ICommit> GetMainlineCommitLog(ICommit? baseVersionSource, ICommit? mainlineTip); IEnumerable<ICommit> GetMergeBaseCommits(ICommit? mergeCommit, ICommit? mergedHead, ICommit? findMergeBase); IEnumerable<ICommit> GetCommitLog(ICommit? baseVersionSource, ICommit? currentCommit); IBranch GetTargetBranch(string? targetBranchName); IBranch? FindBranch(string? branchName); IBranch? FindMainBranch(Config configuration); IBranch? GetChosenBranch(Config configuration); IEnumerable<IBranch> GetBranchesForCommit(ICommit commit); IEnumerable<IBranch> GetExcludedInheritBranches(Config configuration); IEnumerable<IBranch> GetReleaseBranches(IEnumerable<KeyValuePair<string, BranchConfig>> releaseBranchConfig); IEnumerable<IBranch> ExcludingBranches(IEnumerable<IBranch> branchesToExclude); IEnumerable<IBranch> GetBranchesContainingCommit(ICommit? commit, IEnumerable<IBranch>? branches = null, bool onlyTrackedBranches = false); IDictionary<string, List<IBranch>> GetMainlineBranches(ICommit commit, Config configuration, IEnumerable<KeyValuePair<string, BranchConfig>>? mainlineBranchConfigs); /// <summary> /// Find the commit where the given branch was branched from another branch. /// If there are multiple such commits and branches, tries to guess based on commit histories. /// </summary> BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, Config configuration, params IBranch[] excludedBranches); SemanticVersion GetCurrentCommitTaggedVersion(ICommit? commit, string? tagPrefix); IEnumerable<SemanticVersion> GetVersionTagsOnBranch(IBranch branch, string? tagPrefixRegex); IEnumerable<(ITag Tag, SemanticVersion Semver, ICommit Commit)> GetValidVersionTags(string? tagPrefixRegex, DateTimeOffset? olderThan = null); bool IsCommitOnBranch(ICommit? baseVersionSource, IBranch branch, ICommit firstMatchingCommit); int GetNumberOfUncommittedChanges(); }
using GitVersion.Model.Configuration; namespace GitVersion.Common; public interface IRepositoryStore { /// <summary> /// Find the merge base of the two branches, i.e. the best common ancestor of the two branches' tips. /// </summary> ICommit? FindMergeBase(IBranch? branch, IBranch? otherBranch); ICommit? FindMergeBase(ICommit commit, ICommit mainlineTip); ICommit? GetCurrentCommit(IBranch currentBranch, string? commitId); ICommit GetBaseVersionSource(ICommit currentBranchTip); IEnumerable<ICommit> GetMainlineCommitLog(ICommit? baseVersionSource, ICommit? mainlineTip); IEnumerable<ICommit> GetMergeBaseCommits(ICommit? mergeCommit, ICommit? mergedHead, ICommit? findMergeBase); IEnumerable<ICommit> GetCommitLog(ICommit? baseVersionSource, ICommit? currentCommit); IBranch GetTargetBranch(string? targetBranchName); IBranch? FindBranch(string? branchName); IBranch? FindMainBranch(Config configuration); IBranch? GetChosenBranch(Config configuration); IEnumerable<IBranch> GetBranchesForCommit(ICommit commit); IEnumerable<IBranch> GetExcludedInheritBranches(Config configuration); IEnumerable<IBranch> GetReleaseBranches(IEnumerable<KeyValuePair<string, BranchConfig>> releaseBranchConfig); IEnumerable<IBranch> ExcludingBranches(IEnumerable<IBranch> branchesToExclude); IEnumerable<IBranch> GetBranchesContainingCommit(ICommit? commit, IEnumerable<IBranch>? branches = null, bool onlyTrackedBranches = false); IDictionary<string, List<IBranch>> GetMainlineBranches(ICommit commit, Config configuration, IEnumerable<KeyValuePair<string, BranchConfig>>? mainlineBranchConfigs); /// <summary> /// Find the commit where the given branch was branched from another branch. /// If there are multiple such commits and branches, tries to guess based on commit histories. /// </summary> BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, Config configuration, params IBranch[] excludedBranches); SemanticVersion GetCurrentCommitTaggedVersion(ICommit? commit, string? tagPrefix); IEnumerable<SemanticVersion> GetVersionTagsOnBranch(IBranch branch, string? tagPrefixRegex); IEnumerable<(ITag Tag, SemanticVersion Semver, ICommit Commit)> GetValidVersionTags(string? tagPrefixRegex, DateTimeOffset? olderThan = null); bool IsCommitOnBranch(ICommit? baseVersionSource, IBranch branch, ICommit firstMatchingCommit); int GetNumberOfUncommittedChanges(); }
mit
C#
fc4d4ffc8463d0cf7f5bd16a631baf6347ae6b60
Increment version
Blue0500/JoshuaKearney.Measurements
src/JoshuaKearney.Measurements/Properties/AssemblyInfo.cs
src/JoshuaKearney.Measurements/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("JoshuaKearney.Measurements")] [assembly: AssemblyDescription("A simple liblrary for representing units in a type safe way")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Josh Kearney")] [assembly: AssemblyProduct("JoshuaKearney.Measurements")] [assembly: AssemblyCopyright("Copyright © 2016 Josh Kearney")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.6.0")] [assembly: AssemblyFileVersion("2.0.6.0")]
using System.Reflection; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("JoshuaKearney.Measurements")] [assembly: AssemblyDescription("A simple liblrary for representing units in a type safe way")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Josh Kearney")] [assembly: AssemblyProduct("JoshuaKearney.Measurements")] [assembly: AssemblyCopyright("Copyright © 2016 Josh Kearney")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.5.0")] [assembly: AssemblyFileVersion("2.0.5.0")]
mit
C#
1389ca244a7d722f70f8cb9522b49f96600111e1
Fix null reference exception in ContainerProductParser
Sitecore/Sitecore-Instance-Manager
src/SIM.Products/ProductParsers/ContainerProductParser.cs
src/SIM.Products/ProductParsers/ContainerProductParser.cs
using System.Text.RegularExpressions; using Sitecore.Diagnostics.Base; namespace SIM.Products.ProductParsers { public class ContainerProductParser : IProductParser { private const string ProductNamePattern = @"([a-zA-Z]{4,})"; private const string ProductVersionPattern = @"(\d{1,2}\.\d{1,2}\.\d{1,2})"; private const string ProductRevisionPattern = @"(\d{6}\.\d{1,6})"; public static string ProductFileNamePattern { get; } = $@"{ProductNamePattern}\.{ProductVersionPattern}\.{ProductRevisionPattern}.zip$"; public static Regex ProductRegex { get; } = new Regex(ProductFileNamePattern, RegexOptions.IgnoreCase); public bool TryParseName(string path, out string originalName) { string packagePath; string twoVersion; string triVersion; string revision; if (DoParse(path, out originalName, out packagePath, out twoVersion, out triVersion, out revision)) { return true; } return false; } public bool TryParseProduct(string path, out Product product) { product = null; if (string.IsNullOrEmpty(path)) { return false; } string originalName; string packagePath; string twoVersion; string triVersion; string revision; if (DoParse(path, out originalName, out packagePath, out twoVersion, out triVersion, out revision)) { product = GetOrCreateProduct(originalName, packagePath, twoVersion, triVersion, revision); return true; } return false; } protected internal virtual Product GetOrCreateProduct(string originalName, string packagePath, string twoVersion, string triVersion, string revision) { return ProductManager.GetOrCreateProduct(originalName, packagePath, twoVersion, triVersion, revision); } protected virtual bool DoParse(string path, out string originalName, out string packagePath, out string twoVersion, out string triVersion, out string revision) { var match = ProductRegex.Match(path); if (!match.Success || match.Groups.Count < 4) { originalName = packagePath = twoVersion = triVersion = revision = default(string); return false; } originalName = match.Groups[1].Value; packagePath = path; string[] versions = match.Groups[2].Value.Split('.'); twoVersion = $"{versions[0]}.{versions[1]}"; triVersion = match.Groups[2].Value; revision = match.Groups[3].Value; return true; } } }
using System.Text.RegularExpressions; using Sitecore.Diagnostics.Base; namespace SIM.Products.ProductParsers { public class ContainerProductParser : IProductParser { private const string ProductNamePattern = @"([a-zA-Z]{4,})"; private const string ProductVersionPattern = @"(\d{1,2}\.\d{1,2}\.\d{1,2})"; private const string ProductRevisionPattern = @"(\d{6}\.\d{1,6})"; public static string ProductFileNamePattern { get; } = $@"{ProductNamePattern}\.{ProductVersionPattern}\.{ProductRevisionPattern}.zip$"; public static Regex ProductRegex { get; } = new Regex(ProductFileNamePattern, RegexOptions.IgnoreCase); public bool TryParseName(string path, out string originalName) { string packagePath; string twoVersion; string triVersion; string revision; if (DoParse(path, out originalName, out packagePath, out twoVersion, out triVersion, out revision)) { return true; } return false; } public bool TryParseProduct(string path, out Product product) { Assert.ArgumentNotNullOrEmpty(path, nameof(path)); string originalName; string packagePath; string twoVersion; string triVersion; string revision; if (DoParse(path, out originalName, out packagePath, out twoVersion, out triVersion, out revision)) { product = GetOrCreateProduct(originalName, packagePath, twoVersion, triVersion, revision); return true; } product = null; return false; } protected internal virtual Product GetOrCreateProduct(string originalName, string packagePath, string twoVersion, string triVersion, string revision) { return ProductManager.GetOrCreateProduct(originalName, packagePath, twoVersion, triVersion, revision); } protected virtual bool DoParse(string path, out string originalName, out string packagePath, out string twoVersion, out string triVersion, out string revision) { var match = ProductRegex.Match(path); if (!match.Success || match.Groups.Count < 4) { originalName = packagePath = twoVersion = triVersion = revision = default(string); return false; } originalName = match.Groups[1].Value; packagePath = path; string[] versions = match.Groups[2].Value.Split('.'); twoVersion = $"{versions[0]}.{versions[1]}"; triVersion = match.Groups[2].Value; revision = match.Groups[3].Value; return true; } } }
mit
C#
c531191930f2cbbd837916a9cae4e4a0c9bf41ad
Allow selecting vpks in content search paths
SteamDatabase/ValveResourceFormat
GUI/Forms/SettingsForm.cs
GUI/Forms/SettingsForm.cs
using System; using System.Windows.Forms; using GUI.Utils; namespace GUI.Forms { public partial class SettingsForm : Form { public SettingsForm() { InitializeComponent(); } private void SettingsForm_Load(object sender, EventArgs e) { foreach (var path in Settings.GameSearchPaths) { gamePaths.Items.Add(path); } } private void GamePathRemoveClick(object sender, EventArgs e) { if (gamePaths.SelectedIndex < 0) { return; } Settings.GameSearchPaths.Remove((string)gamePaths.SelectedItem); Settings.Save(); gamePaths.Items.RemoveAt(gamePaths.SelectedIndex); } private void GamePathAdd(object sender, EventArgs e) { using (var dlg = new OpenFileDialog()) { dlg.Filter = "Valve Pak (*.vpk)|*.vpk|All files (*.*)|*.*"; if (dlg.ShowDialog() != DialogResult.OK) { return; } if (Settings.GameSearchPaths.Contains(dlg.FileName)) { return; } Settings.GameSearchPaths.Add(dlg.FileName); Settings.Save(); gamePaths.Items.Add(dlg.FileName); } } private void button1_Click(object sender, EventArgs e) { var colorPicker = new ColorDialog(); colorPicker.Color = Settings.BackgroundColor; // Update the text box color if the user clicks OK if (colorPicker.ShowDialog() == DialogResult.OK) { Settings.BackgroundColor = colorPicker.Color; } } } }
using System; using System.Windows.Forms; using GUI.Utils; namespace GUI.Forms { public partial class SettingsForm : Form { public SettingsForm() { InitializeComponent(); } private void SettingsForm_Load(object sender, EventArgs e) { foreach (var path in Settings.GameSearchPaths) { gamePaths.Items.Add(path); } } private void GamePathRemoveClick(object sender, EventArgs e) { if (gamePaths.SelectedIndex < 0) { return; } Settings.GameSearchPaths.Remove((string)gamePaths.SelectedItem); Settings.Save(); gamePaths.Items.RemoveAt(gamePaths.SelectedIndex); } private void GamePathAdd(object sender, EventArgs e) { using (var dlg = new FolderBrowserDialog()) { dlg.Description = "Select a folder"; if (dlg.ShowDialog() != DialogResult.OK) { return; } if (Settings.GameSearchPaths.Contains(dlg.SelectedPath)) { return; } Settings.GameSearchPaths.Add(dlg.SelectedPath); Settings.Save(); gamePaths.Items.Add(dlg.SelectedPath); } } private void button1_Click(object sender, EventArgs e) { var colorPicker = new ColorDialog(); colorPicker.Color = Settings.BackgroundColor; // Update the text box color if the user clicks OK if (colorPicker.ShowDialog() == DialogResult.OK) { Settings.BackgroundColor = colorPicker.Color; } } } }
mit
C#
0dfe8c08b90c7505302aecaacfde9ec1c5edc5eb
Add App_Code, App_Data and App_Plugins folders to be created during app startup
lingxyd/Umbraco-CMS,yannisgu/Umbraco-CMS,iahdevelop/Umbraco-CMS,m0wo/Umbraco-CMS,arknu/Umbraco-CMS,rustyswayne/Umbraco-CMS,sargin48/Umbraco-CMS,marcemarc/Umbraco-CMS,ordepdev/Umbraco-CMS,qizhiyu/Umbraco-CMS,rustyswayne/Umbraco-CMS,nvisage-gf/Umbraco-CMS,dawoe/Umbraco-CMS,Tronhus/Umbraco-CMS,iahdevelop/Umbraco-CMS,corsjune/Umbraco-CMS,bjarnef/Umbraco-CMS,AndyButland/Umbraco-CMS,NikRimington/Umbraco-CMS,countrywide/Umbraco-CMS,DaveGreasley/Umbraco-CMS,gkonings/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Pyuuma/Umbraco-CMS,AzarinSergey/Umbraco-CMS,AzarinSergey/Umbraco-CMS,engern/Umbraco-CMS,wtct/Umbraco-CMS,gkonings/Umbraco-CMS,rajendra1809/Umbraco-CMS,sargin48/Umbraco-CMS,dampee/Umbraco-CMS,Tronhus/Umbraco-CMS,lars-erik/Umbraco-CMS,qizhiyu/Umbraco-CMS,lars-erik/Umbraco-CMS,gavinfaux/Umbraco-CMS,engern/Umbraco-CMS,arknu/Umbraco-CMS,markoliver288/Umbraco-CMS,tcmorris/Umbraco-CMS,TimoPerplex/Umbraco-CMS,TimoPerplex/Umbraco-CMS,bjarnef/Umbraco-CMS,gavinfaux/Umbraco-CMS,dawoe/Umbraco-CMS,Myster/Umbraco-CMS,christopherbauer/Umbraco-CMS,christopherbauer/Umbraco-CMS,abryukhov/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mittonp/Umbraco-CMS,bjarnef/Umbraco-CMS,christopherbauer/Umbraco-CMS,qizhiyu/Umbraco-CMS,AzarinSergey/Umbraco-CMS,hfloyd/Umbraco-CMS,lingxyd/Umbraco-CMS,rasmusfjord/Umbraco-CMS,timothyleerussell/Umbraco-CMS,countrywide/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,AndyButland/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,lingxyd/Umbraco-CMS,VDBBjorn/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,rustyswayne/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Pyuuma/Umbraco-CMS,sargin48/Umbraco-CMS,markoliver288/Umbraco-CMS,arvaris/HRI-Umbraco,hfloyd/Umbraco-CMS,gavinfaux/Umbraco-CMS,markoliver288/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,corsjune/Umbraco-CMS,mstodd/Umbraco-CMS,aadfPT/Umbraco-CMS,abryukhov/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,hfloyd/Umbraco-CMS,Phosworks/Umbraco-CMS,gkonings/Umbraco-CMS,KevinJump/Umbraco-CMS,mstodd/Umbraco-CMS,abjerner/Umbraco-CMS,zidad/Umbraco-CMS,lingxyd/Umbraco-CMS,zidad/Umbraco-CMS,iahdevelop/Umbraco-CMS,aaronpowell/Umbraco-CMS,kgiszewski/Umbraco-CMS,kasperhhk/Umbraco-CMS,mittonp/Umbraco-CMS,rajendra1809/Umbraco-CMS,lars-erik/Umbraco-CMS,KevinJump/Umbraco-CMS,wtct/Umbraco-CMS,countrywide/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,yannisgu/Umbraco-CMS,neilgaietto/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,m0wo/Umbraco-CMS,tompipe/Umbraco-CMS,madsoulswe/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,ehornbostel/Umbraco-CMS,neilgaietto/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,umbraco/Umbraco-CMS,NikRimington/Umbraco-CMS,dampee/Umbraco-CMS,ordepdev/Umbraco-CMS,DaveGreasley/Umbraco-CMS,lars-erik/Umbraco-CMS,aadfPT/Umbraco-CMS,neilgaietto/Umbraco-CMS,engern/Umbraco-CMS,madsoulswe/Umbraco-CMS,m0wo/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,rasmuseeg/Umbraco-CMS,Door3Dev/HRI-Umbraco,Door3Dev/HRI-Umbraco,NikRimington/Umbraco-CMS,madsoulswe/Umbraco-CMS,DaveGreasley/Umbraco-CMS,ehornbostel/Umbraco-CMS,romanlytvyn/Umbraco-CMS,WebCentrum/Umbraco-CMS,Phosworks/Umbraco-CMS,yannisgu/Umbraco-CMS,timothyleerussell/Umbraco-CMS,engern/Umbraco-CMS,mstodd/Umbraco-CMS,Myster/Umbraco-CMS,base33/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,dawoe/Umbraco-CMS,gkonings/Umbraco-CMS,mstodd/Umbraco-CMS,tcmorris/Umbraco-CMS,mstodd/Umbraco-CMS,ehornbostel/Umbraco-CMS,aaronpowell/Umbraco-CMS,Door3Dev/HRI-Umbraco,nul800sebastiaan/Umbraco-CMS,mattbrailsford/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,sargin48/Umbraco-CMS,gkonings/Umbraco-CMS,zidad/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,kgiszewski/Umbraco-CMS,Khamull/Umbraco-CMS,lars-erik/Umbraco-CMS,Myster/Umbraco-CMS,Khamull/Umbraco-CMS,countrywide/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,leekelleher/Umbraco-CMS,VDBBjorn/Umbraco-CMS,corsjune/Umbraco-CMS,rasmuseeg/Umbraco-CMS,jchurchley/Umbraco-CMS,dawoe/Umbraco-CMS,Spijkerboer/Umbraco-CMS,leekelleher/Umbraco-CMS,mittonp/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Phosworks/Umbraco-CMS,tcmorris/Umbraco-CMS,kasperhhk/Umbraco-CMS,dampee/Umbraco-CMS,rasmuseeg/Umbraco-CMS,jchurchley/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,ordepdev/Umbraco-CMS,ehornbostel/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,kasperhhk/Umbraco-CMS,Khamull/Umbraco-CMS,WebCentrum/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,aadfPT/Umbraco-CMS,romanlytvyn/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,markoliver288/Umbraco-CMS,ordepdev/Umbraco-CMS,leekelleher/Umbraco-CMS,timothyleerussell/Umbraco-CMS,DaveGreasley/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,DaveGreasley/Umbraco-CMS,kasperhhk/Umbraco-CMS,base33/Umbraco-CMS,qizhiyu/Umbraco-CMS,aaronpowell/Umbraco-CMS,AzarinSergey/Umbraco-CMS,rasmusfjord/Umbraco-CMS,christopherbauer/Umbraco-CMS,Phosworks/Umbraco-CMS,Khamull/Umbraco-CMS,markoliver288/Umbraco-CMS,corsjune/Umbraco-CMS,romanlytvyn/Umbraco-CMS,abjerner/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,arvaris/HRI-Umbraco,JeffreyPerplex/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,jchurchley/Umbraco-CMS,mittonp/Umbraco-CMS,nvisage-gf/Umbraco-CMS,zidad/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,Door3Dev/HRI-Umbraco,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,neilgaietto/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,ehornbostel/Umbraco-CMS,gavinfaux/Umbraco-CMS,rasmusfjord/Umbraco-CMS,tompipe/Umbraco-CMS,VDBBjorn/Umbraco-CMS,TimoPerplex/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,arknu/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Spijkerboer/Umbraco-CMS,corsjune/Umbraco-CMS,robertjf/Umbraco-CMS,Pyuuma/Umbraco-CMS,umbraco/Umbraco-CMS,wtct/Umbraco-CMS,gavinfaux/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Tronhus/Umbraco-CMS,gregoriusxu/Umbraco-CMS,marcemarc/Umbraco-CMS,timothyleerussell/Umbraco-CMS,romanlytvyn/Umbraco-CMS,m0wo/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,abjerner/Umbraco-CMS,lingxyd/Umbraco-CMS,kasperhhk/Umbraco-CMS,nvisage-gf/Umbraco-CMS,rustyswayne/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,zidad/Umbraco-CMS,ordepdev/Umbraco-CMS,robertjf/Umbraco-CMS,arvaris/HRI-Umbraco,tcmorris/Umbraco-CMS,tompipe/Umbraco-CMS,bjarnef/Umbraco-CMS,gregoriusxu/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,engern/Umbraco-CMS,umbraco/Umbraco-CMS,iahdevelop/Umbraco-CMS,gregoriusxu/Umbraco-CMS,yannisgu/Umbraco-CMS,gregoriusxu/Umbraco-CMS,mittonp/Umbraco-CMS,sargin48/Umbraco-CMS,Myster/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dampee/Umbraco-CMS,wtct/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,hfloyd/Umbraco-CMS,rajendra1809/Umbraco-CMS,yannisgu/Umbraco-CMS,countrywide/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,marcemarc/Umbraco-CMS,AndyButland/Umbraco-CMS,WebCentrum/Umbraco-CMS,Pyuuma/Umbraco-CMS,TimoPerplex/Umbraco-CMS,arvaris/HRI-Umbraco,AndyButland/Umbraco-CMS,markoliver288/Umbraco-CMS,rajendra1809/Umbraco-CMS,Pyuuma/Umbraco-CMS,Khamull/Umbraco-CMS,rustyswayne/Umbraco-CMS,christopherbauer/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Myster/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,MicrosoftEdge/Umbraco-CMS,romanlytvyn/Umbraco-CMS,KevinJump/Umbraco-CMS,base33/Umbraco-CMS,Phosworks/Umbraco-CMS,neilgaietto/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,kgiszewski/Umbraco-CMS,umbraco/Umbraco-CMS,AndyButland/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,iahdevelop/Umbraco-CMS,abryukhov/Umbraco-CMS,Door3Dev/HRI-Umbraco,qizhiyu/Umbraco-CMS,m0wo/Umbraco-CMS,marcemarc/Umbraco-CMS,gregoriusxu/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,wtct/Umbraco-CMS,abryukhov/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,timothyleerussell/Umbraco-CMS,dampee/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Tronhus/Umbraco-CMS,rajendra1809/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Tronhus/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,AzarinSergey/Umbraco-CMS,rasmusfjord/Umbraco-CMS
src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs
src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using Umbraco.Core.IO; using umbraco.businesslogic; using umbraco.interfaces; namespace umbraco.presentation { public class EnsureSystemPathsApplicationStartupHandler : IApplicationStartupHandler { public EnsureSystemPathsApplicationStartupHandler() { EnsurePathExists("~/App_Code"); EnsurePathExists("~/App_Data"); EnsurePathExists(SystemDirectories.AppPlugins); EnsurePathExists(SystemDirectories.Css); EnsurePathExists(SystemDirectories.MacroScripts); EnsurePathExists(SystemDirectories.Masterpages); EnsurePathExists(SystemDirectories.Media); EnsurePathExists(SystemDirectories.Scripts); EnsurePathExists(SystemDirectories.UserControls); EnsurePathExists(SystemDirectories.Xslt); EnsurePathExists(SystemDirectories.MvcViews); EnsurePathExists(SystemDirectories.MvcViews + "/Partials"); EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials"); } public void EnsurePathExists(string path) { var absolutePath = IOHelper.MapPath(path); if (!Directory.Exists(absolutePath)) Directory.CreateDirectory(absolutePath); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using Umbraco.Core.IO; using umbraco.businesslogic; using umbraco.interfaces; namespace umbraco.presentation { public class EnsureSystemPathsApplicationStartupHandler : IApplicationStartupHandler { public EnsureSystemPathsApplicationStartupHandler() { EnsurePathExists(SystemDirectories.Css); EnsurePathExists(SystemDirectories.Data); EnsurePathExists(SystemDirectories.MacroScripts); EnsurePathExists(SystemDirectories.Masterpages); EnsurePathExists(SystemDirectories.Media); EnsurePathExists(SystemDirectories.Scripts); EnsurePathExists(SystemDirectories.UserControls); EnsurePathExists(SystemDirectories.Xslt); EnsurePathExists(SystemDirectories.MvcViews); EnsurePathExists(SystemDirectories.MvcViews + "/Partials"); EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials"); } public void EnsurePathExists(string path) { var absolutePath = IOHelper.MapPath(path); if (!Directory.Exists(absolutePath)) Directory.CreateDirectory(absolutePath); } } }
mit
C#
b8c22cd03aee5495fc8cdbf8ecff1fdd70d0c92f
update version to v4.1.2
shabtaisharon/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk
VersionInfo.cs
VersionInfo.cs
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file 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.Reflection; // 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("4.1.2.0")] [assembly: AssemblyFileVersion("4.1.2.0")]
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file 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.Reflection; // 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("4.1.1.0")] [assembly: AssemblyFileVersion("4.1.1.0")]
apache-2.0
C#
661e968df2ca577047af21e48c12146460fddde1
Create Event - Form changes (Part 4) #2236
mgmccarthy/allReady,MisterJames/allReady,mgmccarthy/allReady,BillWagner/allReady,mgmccarthy/allReady,dpaquette/allReady,dpaquette/allReady,gitChuckD/allReady,HamidMosalla/allReady,HamidMosalla/allReady,stevejgordon/allReady,gitChuckD/allReady,HTBox/allReady,MisterJames/allReady,binaryjanitor/allReady,gitChuckD/allReady,MisterJames/allReady,c0g1t8/allReady,dpaquette/allReady,stevejgordon/allReady,stevejgordon/allReady,c0g1t8/allReady,BillWagner/allReady,HTBox/allReady,stevejgordon/allReady,binaryjanitor/allReady,HamidMosalla/allReady,HTBox/allReady,HTBox/allReady,c0g1t8/allReady,mgmccarthy/allReady,HamidMosalla/allReady,c0g1t8/allReady,gitChuckD/allReady,dpaquette/allReady,MisterJames/allReady,BillWagner/allReady,binaryjanitor/allReady,binaryjanitor/allReady,BillWagner/allReady
AllReadyApp/Web-App/AllReady/Areas/Admin/ViewModels/Shared/EventSummaryViewModel.cs
AllReadyApp/Web-App/AllReady/Areas/Admin/ViewModels/Shared/EventSummaryViewModel.cs
using System; using System.ComponentModel.DataAnnotations; using AllReady.Models; using AllReady.ModelBinding; namespace AllReady.Areas.Admin.ViewModels.Shared { public class EventSummaryViewModel { public int Id { get; set; } [Required] [Display(Name = "Event Title")] public string Name { get; set; } [Required] [Range(1, 99, ErrorMessage = "A valid 'event type' is required")] [Display(Name = "Event Type")] public EventType EventType { get; set; } public string Description { get; set; } [Display(Name = "Campaign")] public int CampaignId { get; set; } [Display(Name = "Campaign")] public string CampaignName { get; set; } [Display(Name = "Organization")] public int OrganizationId { get; set; } [Display(Name = "Organization")] public string OrganizationName { get; set; } [Display(Name = "Existing Image")] public string ImageUrl { get; set; } [Display(Name = "Upload event image")] public string FileUpload { get; set; } [MaxLength(150)] public string Headline { get; set; } [Display(Name = "Time Zone")] [Required] public string TimeZoneId { get; set; } [Display(Name = "Start Date")] [AdjustToTimezone(TimeZoneIdPropertyName = nameof(TimeZoneId))] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-ddTHH:mm:ss.fff}")] //What do I nee to go here to format this as a local date time when viewing it? I don't want the offset to be sent to the client because //that just confuses things public DateTimeOffset StartDateTime { get; set; } [Display(Name = "End Date")] [AdjustToTimezone(TimeZoneIdPropertyName = nameof(TimeZoneId))] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-ddTHH:mm:ss.fff}")] public DateTimeOffset EndDateTime { get; set; } [Display(Name = "Enforce volunteer limit on tasks")] public bool IsLimitVolunteers { get; set; } = true; // NOTE: stevejgordon - 31-08-16 - Defaulting to false at part of work on #919 since the code to ensure this is working doesn't seem to be fully in place. [Display(Name = "Allow waiting list for tasks")] public bool IsAllowWaitList { get; set; } } }
using System; using System.ComponentModel.DataAnnotations; using AllReady.Models; using AllReady.ModelBinding; namespace AllReady.Areas.Admin.ViewModels.Shared { public class EventSummaryViewModel { public int Id { get; set; } [Required] [Display(Name = "Event Title")] public string Name { get; set; } [Required] [Range(1, 99, ErrorMessage = "A valid 'event type' is required")] [Display(Name = "Event Type")] public EventType EventType { get; set; } public string Description { get; set; } [Display(Name = "Campaign")] public int CampaignId { get; set; } [Display(Name = "Campaign")] public string CampaignName { get; set; } [Display(Name = "Organization")] public int OrganizationId { get; set; } [Display(Name = "Organization")] public string OrganizationName { get; set; } [Display(Name = "Existing Image")] public string ImageUrl { get; set; } [Display(Name = "Browse for image")] public string FileUpload { get; set; } [MaxLength(150)] public string Headline { get; set; } [Display(Name = "Time Zone")] [Required] public string TimeZoneId { get; set; } [Display(Name = "Start Date")] [AdjustToTimezone(TimeZoneIdPropertyName = nameof(TimeZoneId))] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-ddTHH:mm:ss.fff}")] //What do I nee to go here to format this as a local date time when viewing it? I don't want the offset to be sent to the client because //that just confuses things public DateTimeOffset StartDateTime { get; set; } [Display(Name = "End Date")] [AdjustToTimezone(TimeZoneIdPropertyName = nameof(TimeZoneId))] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-ddTHH:mm:ss.fff}")] public DateTimeOffset EndDateTime { get; set; } [Display(Name = "Enforce volunteer limit on tasks")] public bool IsLimitVolunteers { get; set; } = true; // NOTE: stevejgordon - 31-08-16 - Defaulting to false at part of work on #919 since the code to ensure this is working doesn't seem to be fully in place. [Display(Name = "Allow waiting list for tasks")] public bool IsAllowWaitList { get; set; } } }
mit
C#
933fc6e7cf1c5c2e154ee3a98f17b0daa1b0214a
Refactor RNG
stanriders/den0bot,stanriders/den0bot
den0bot/Util/RNG.cs
den0bot/Util/RNG.cs
// den0bot (c) StanR 2022 - MIT License using System; using System.Numerics; namespace den0bot.Util { public static class RNG { private static readonly Random rng = new(); private static int previousNum = 0; private static BigInteger previousBigNum = 0; private const int max_reroll_iterations = 10; public static int Next(int min = 0, int max = int.MaxValue) { var result = min; var iteration = 0; while (iteration < max_reroll_iterations) { result = rng.Next(min, max); if (result == previousNum && max > 2) { iteration++; continue; } previousNum = result; return result; } return result; } public static int NextNoMemory(int min = 0, int max = int.MaxValue) { return rng.Next(min, max); } public static BigInteger NextBigInteger(BigInteger max) { BigInteger result = 1; var iteration = 0; while (iteration < max_reroll_iterations) { result = NextBigIntegerNoMemory(max); if (result == previousBigNum && max > 2) { iteration++; continue; } previousBigNum = result; return result; } return result; } public static BigInteger NextBigIntegerNoMemory(BigInteger max) { byte[] buffer = max.ToByteArray(); BigInteger result; do { rng.NextBytes(buffer); buffer[^1] &= 0x7F; // force sign bit to positive result = new BigInteger(buffer); } while (result >= max || result == 0); return result; } } }
// den0bot (c) StanR 2020 - MIT License using System; using System.Numerics; namespace den0bot.Util { public static class RNG { private static Random rng = new(); private static int previousNum = 0; private static BigInteger previousBigNum = 0; public static int Next(int min = 0, int max = int.MaxValue) { int result = rng.Next(min, max); if (result == previousNum && max > 2) return Next(min, max); previousNum = result; return result; } public static int NextNoMemory(int min = 0, int max = int.MaxValue) { return rng.Next(min, max); } public static BigInteger NextBigInteger(BigInteger max) { var result = NextBigIntegerNoMemory(max); if (result == previousBigNum && max > 2) return NextBigInteger(max); previousBigNum = result; return result; } public static BigInteger NextBigIntegerNoMemory(BigInteger max) { byte[] buffer = max.ToByteArray(); BigInteger result; do { rng.NextBytes(buffer); buffer[^1] &= 0x7F; // force sign bit to positive result = new BigInteger(buffer); } while (result >= max || result == 0); return result; } } }
mit
C#
5e7a8e91502a0542001a8a0ae882862ed42567f3
remove comment
KSemenenko/MVVMBase
MVVMBase/BaseViewModel.cs
MVVMBase/BaseViewModel.cs
using System; using System.ComponentModel; using System.Linq.Expressions; using System.Runtime.CompilerServices; using System.Threading; namespace MVVMBase { /// <summary> /// Base View Model /// </summary> public class BaseViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; /// <summary> /// Changes the property and call the PropertyChanged event. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="action">Action With Propery Name like ()=>MyPropertyName</param> protected void OnPropertyChanged<T>(Expression<Func<T>> action) { var propertyName = GetPropertyName(action); OnPropertyChanged(propertyName); } private static string GetPropertyName<T>(Expression<Func<T>> action) { var expression = (MemberExpression)action.Body; var propertyName = expression.Member.Name; return propertyName; } /// <summary> /// Changes the property and call the PropertyChanged event. /// </summary> /// <param name="propertyName">Property name</param> protected void OnPropertyChanged(string propertyName) { Volatile.Read(ref PropertyChanged)?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } /// <summary> /// Changes the property and call the PropertyChanged event. /// </summary> /// <typeparam name="T">The 1st type parameter.</typeparam> /// <param name="storage">Reference to current value.</param> /// <param name="value">New value to be set.</param> /// <param name="propertyName">The name of the property to raise the PropertyChanged event for.</param> protected void SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null) { storage = value; OnPropertyChanged(propertyName); } } }
using System; using System.ComponentModel; using System.Linq.Expressions; using System.Runtime.CompilerServices; using System.Threading; namespace MVVMBase { /// <summary> /// Base View Model /// </summary> public class BaseViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; /// <summary> /// Changes the property and call the PropertyChanged event. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="action">Action With Propery Name like ()=>MyPropertyName</param> protected void OnPropertyChanged<T>(Expression<Func<T>> action) { var propertyName = GetPropertyName(action); OnPropertyChanged(propertyName); } private static string GetPropertyName<T>(Expression<Func<T>> action) { var expression = (MemberExpression)action.Body; var propertyName = expression.Member.Name; return propertyName; } /// <summary> /// Changes the property and call the PropertyChanged event. /// </summary> /// <param name="propertyName">Property name</param> protected void OnPropertyChanged(string propertyName) { Volatile.Read(ref PropertyChanged)?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //var handler = PropertyChanged; //if(handler != null) //{ // var e = new PropertyChangedEventArgs(propertyName); // handler(this, e); //} } /// <summary> /// Changes the property and call the PropertyChanged event. /// </summary> /// <typeparam name="T">The 1st type parameter.</typeparam> /// <param name="storage">Reference to current value.</param> /// <param name="value">New value to be set.</param> /// <param name="propertyName">The name of the property to raise the PropertyChanged event for.</param> protected void SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null) { storage = value; OnPropertyChanged(propertyName); } } }
mit
C#
c9d42873c1f07b0b4e8ba54316d6f3e3d580edf2
Fix Canvas negative Height test
praeclarum/Ooui,praeclarum/Ooui,praeclarum/Ooui
Tests/CanvasTests.cs
Tests/CanvasTests.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Ooui; namespace Tests { [TestClass] public class CanvasTests { [TestMethod] public void Context2dState () { var c = new Canvas (); Assert.AreEqual (1, c.StateMessages.Count); var c2d = c.GetContext2d (); Assert.AreEqual (2, c.StateMessages.Count); var c2d2 = c.GetContext2d (); Assert.AreEqual (2, c.StateMessages.Count); Assert.AreEqual (c2d, c2d2); } [TestMethod] public void DefaultWidthAndHeight () { var c = new Canvas (); Assert.AreEqual (150, c.Width); Assert.AreEqual (150, c.Height); } [TestMethod] public void WidthAndHeight () { var c = new Canvas { Width = 640, Height = 480, }; Assert.AreEqual (640, c.Width); Assert.AreEqual (480, c.Height); } [TestMethod] public void CantBeNegativeOrZero () { var c = new Canvas { Width = 640, Height = 480, }; Assert.AreEqual (640, c.Width); Assert.AreEqual (480, c.Height); c.Width = 0; c.Height = -100; Assert.AreEqual (150, c.Width); Assert.AreEqual (150, c.Height); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Ooui; namespace Tests { [TestClass] public class CanvasTests { [TestMethod] public void Context2dState () { var c = new Canvas (); Assert.AreEqual (1, c.StateMessages.Count); var c2d = c.GetContext2d (); Assert.AreEqual (2, c.StateMessages.Count); var c2d2 = c.GetContext2d (); Assert.AreEqual (2, c.StateMessages.Count); Assert.AreEqual (c2d, c2d2); } [TestMethod] public void DefaultWidthAndHeight () { var c = new Canvas (); Assert.AreEqual (150, c.Width); Assert.AreEqual (150, c.Height); } [TestMethod] public void WidthAndHeight () { var c = new Canvas { Width = 640, Height = 480, }; Assert.AreEqual (640, c.Width); Assert.AreEqual (480, c.Height); } [TestMethod] public void CantBeNegativeOrZero () { var c = new Canvas { Width = 640, Height = 480, }; Assert.AreEqual (640, c.Width); Assert.AreEqual (480, c.Height); c.Width = 0; c.Height = 0; Assert.AreEqual (150, c.Width); Assert.AreEqual (150, c.Height); } } }
mit
C#
03b7c8b88969ae337ac52bcddd56c0c5d034f111
Remove unneeded access modifier.
peppy/osu-new,UselessToucan/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu
osu.Game/Screens/IOsuScreen.cs
osu.Game/Screens/IOsuScreen.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets; namespace osu.Game.Screens { public interface IOsuScreen : IScreen { /// <summary> /// Whether the beatmap or ruleset should be allowed to be changed by the user or game. /// Used to mark exclusive areas where this is strongly prohibited, like gameplay. /// </summary> bool DisallowExternalBeatmapRulesetChanges { get; } /// <summary> /// Whether the user can exit this this <see cref="IOsuScreen"/> by pressing the back button. /// </summary> bool AllowBackButton { get; } /// <summary> /// Whether a top-level component should be allowed to exit the current screen to, for example, /// complete an import. Note that this can be overridden by a user if they specifically request. /// </summary> bool AllowExternalScreenChange { get; } /// <summary> /// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed. /// </summary> bool CursorVisible { get; } /// <summary> /// Whether all overlays should be hidden when this screen is entered or resumed. /// </summary> bool HideOverlaysOnEnter { get; } /// <summary> /// Whether overlays should be able to be opened when this screen is current. /// </summary> Bindable<OverlayActivation> OverlayActivationMode { get; } /// <summary> /// The amount of parallax to be applied while this screen is displayed. /// </summary> float BackgroundParallaxAmount { get; } Bindable<WorkingBeatmap> Beatmap { get; } Bindable<RulesetInfo> Ruleset { get; } /// <summary> /// Whether mod rate adjustments are allowed to be applied. /// </summary> bool AllowRateAdjustments { get; } /// <summary> /// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>. /// </summary> /// <remarks> /// Return <c>true</c> to block this <see cref="IOsuScreen"/> from being exited after closing an overlay. /// Return <c>false</c> if this <see cref="IOsuScreen"/> should continue exiting. /// </remarks> bool OnBackButton(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets; namespace osu.Game.Screens { public interface IOsuScreen : IScreen { /// <summary> /// Whether the beatmap or ruleset should be allowed to be changed by the user or game. /// Used to mark exclusive areas where this is strongly prohibited, like gameplay. /// </summary> bool DisallowExternalBeatmapRulesetChanges { get; } /// <summary> /// Whether the user can exit this this <see cref="IOsuScreen"/> by pressing the back button. /// </summary> bool AllowBackButton { get; } /// <summary> /// Whether a top-level component should be allowed to exit the current screen to, for example, /// complete an import. Note that this can be overridden by a user if they specifically request. /// </summary> bool AllowExternalScreenChange { get; } /// <summary> /// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed. /// </summary> bool CursorVisible { get; } /// <summary> /// Whether all overlays should be hidden when this screen is entered or resumed. /// </summary> bool HideOverlaysOnEnter { get; } /// <summary> /// Whether overlays should be able to be opened when this screen is current. /// </summary> public Bindable<OverlayActivation> OverlayActivationMode { get; } /// <summary> /// The amount of parallax to be applied while this screen is displayed. /// </summary> float BackgroundParallaxAmount { get; } Bindable<WorkingBeatmap> Beatmap { get; } Bindable<RulesetInfo> Ruleset { get; } /// <summary> /// Whether mod rate adjustments are allowed to be applied. /// </summary> bool AllowRateAdjustments { get; } /// <summary> /// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>. /// </summary> /// <remarks> /// Return <c>true</c> to block this <see cref="IOsuScreen"/> from being exited after closing an overlay. /// Return <c>false</c> if this <see cref="IOsuScreen"/> should continue exiting. /// </remarks> bool OnBackButton(); } }
mit
C#
f73da8e4b6db83727d958ac8d45fe361a9275069
Add some documentation.
erandr/SolrNet,doss78/SolrNet,erandr/SolrNet,tombeany/SolrNet,MetSystem/SolrNet,18098924759/SolrNet,chang892886597/SolrNet,MetSystem/SolrNet,vyzvam/SolrNet,mausch/SolrNet,tombeany/SolrNet,drakeh/SolrNet,yonglehou/SolrNet,chang892886597/SolrNet,vyzvam/SolrNet,Laoujin/SolrNet,18098924759/SolrNet,vladen/SolrNet,yonglehou/SolrNet,yonglehou/SolrNet,18098924759/SolrNet,SolrNet/SolrNet,doss78/SolrNet,doss78/SolrNet,MetSystem/SolrNet,vmanral/SolrNet,Laoujin/SolrNet,vladen/SolrNet,drakeh/SolrNet,chang892886597/SolrNet,mausch/SolrNet,Laoujin/SolrNet,tombeany/SolrNet,vyzvam/SolrNet,erandr/SolrNet,drakeh/SolrNet,vladen/SolrNet,erandr/SolrNet,vmanral/SolrNet,mausch/SolrNet,vmanral/SolrNet,SolrNet/SolrNet,vladen/SolrNet
SolrNet/ISolrBasicReadOnlyOperations.cs
SolrNet/ISolrBasicReadOnlyOperations.cs
#region license // Copyright (c) 2007-2010 Mauricio Scheffer // // 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. #endregion using System.Collections.Generic; using SolrNet.Commands.Parameters; using SolrNet.Schema; namespace SolrNet { /// <summary> /// Read-only operations without convenience overloads /// </summary> /// <typeparam name="T"></typeparam> public interface ISolrBasicReadOnlyOperations<T> { /// <summary> /// Executes a query /// </summary> /// <param name="query"></param> /// <param name="options"></param> /// <returns></returns> ISolrQueryResults<T> Query(ISolrQuery query, QueryOptions options); /// <summary> /// Executes a MoreLikeThisHandler query /// </summary> /// <param name="query"></param> /// <param name="options"></param> /// <returns></returns> ISolrQueryResults<T> MoreLikeThisHandlerQuery(ISolrMoreLikeThisHandlerQuery query, MoreLikeThisHandlerQueryOptions options); /// <summary> /// Pings the Solr server. /// It can be used by a load balancer in front of a set of Solr servers to check response time of all the Solr servers in order to do response time based load balancing. /// See http://wiki.apache.org/solr/SolrConfigXml for more information. /// </summary> ResponseHeader Ping(); /// <summary> /// Gets the schema. /// </summary> /// <returns>Solr schema</returns> SolrSchema GetSchema(); /// <summary> /// Gets the current status of the DataImportHandler. /// </summary> /// <returns>DIH status</returns> SolrDIHStatus GetDIHStatus(KeyValuePair<string, string> options); } }
#region license // Copyright (c) 2007-2010 Mauricio Scheffer // // 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. #endregion using System.Collections.Generic; using SolrNet.Commands.Parameters; using SolrNet.Schema; namespace SolrNet { /// <summary> /// Read-only operations without convenience overloads /// </summary> /// <typeparam name="T"></typeparam> public interface ISolrBasicReadOnlyOperations<T> { /// <summary> /// Executes a query /// </summary> /// <param name="query"></param> /// <param name="options"></param> /// <returns></returns> ISolrQueryResults<T> Query(ISolrQuery query, QueryOptions options); ISolrQueryResults<T> MoreLikeThisHandlerQuery(ISolrMoreLikeThisHandlerQuery query, MoreLikeThisHandlerQueryOptions options); /// <summary> /// Pings the Solr server. /// It can be used by a load balancer in front of a set of Solr servers to check response time of all the Solr servers in order to do response time based load balancing. /// See http://wiki.apache.org/solr/SolrConfigXml for more information. /// </summary> ResponseHeader Ping(); /// <summary> /// Gets the schema. /// </summary> /// <returns>Solr schema</returns> SolrSchema GetSchema(); /// <summary> /// Gets the current status of the DataImportHandler. /// </summary> /// <returns>DIH status</returns> SolrDIHStatus GetDIHStatus(KeyValuePair<string, string> options); } }
apache-2.0
C#
d0c0729aaa0bd3e765d0c0e26c51341af78123cd
Update demo
sunkaixuan/SqlSugar
Src/Asp.Net/OracleTest/Bugs/BugTest1.cs
Src/Asp.Net/OracleTest/Bugs/BugTest1.cs
using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrmTest.Test { public class BugTest1 { public static void Init() { SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.Oracle, IsAutoCloseConnection = true, InitKeyType = InitKeyType.Attribute, }); //调式代码 用来打印SQL Db.Aop.OnLogExecuting = (sql, pars) => { Console.WriteLine(sql); }; var id=Enumerable.Range(0, 100).ToList(); // id = null; Db.Queryable<Order>().Where(it => id.Contains(it.Id)).ToList(); Db.Insertable(new Order() { Name = "A", Price = 1, CustomId = 1, CreateTime = DateTime.Now.AddDays(-2) }).ExecuteCommand(); var list= Db.Queryable<Order>().Where(it =>Convert.ToDecimal( 1.01) ==Convert.ToDecimal( 1.01)).ToList(); ; var list2 = Db.Queryable<Order>().Where(it =>it.CreateTime> SqlFunc.DateAdd(SqlFunc.GetDate(),-3)).ToList(); ; } } public class testmmxxxmm121 { [SugarColumn(IsPrimaryKey =true,IsIdentity =true)] public int id { get; set; } [SugarColumn(ColumnDataType ="float4",IsNullable =true)] public float? name { get; set; } [SugarColumn(ColumnDataType = "float4", IsNullable = false)] public float? name2 { get; set; } } }
using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrmTest.Test { public class BugTest1 { public static void Init() { SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.Oracle, IsAutoCloseConnection = true, InitKeyType = InitKeyType.Attribute, }); //调式代码 用来打印SQL Db.Aop.OnLogExecuting = (sql, pars) => { Console.WriteLine(sql); }; var id=Enumerable.Range(0, 100).ToList(); // id = null; Db.Queryable<Order>().Where(it => id.Contains(it.Id)).ToList(); Db.Insertable(new Order() { Name = "A", Price = 1, CustomId = 1, CreateTime = DateTime.Now }).ExecuteCommand(); var list= Db.Queryable<Order>().Where(it =>Convert.ToDecimal( 1.01) ==Convert.ToDecimal( 1.01)).ToList(); ; } } public class testmmxxxmm121 { [SugarColumn(IsPrimaryKey =true,IsIdentity =true)] public int id { get; set; } [SugarColumn(ColumnDataType ="float4",IsNullable =true)] public float? name { get; set; } [SugarColumn(ColumnDataType = "float4", IsNullable = false)] public float? name2 { get; set; } } }
apache-2.0
C#
c4c69a5d145b34bcbebc2d48363de7a01f1da9c8
remove unused code.
dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP,ouraspnet/cap
src/DotNetCore.CAP/CAP.Builder.cs
src/DotNetCore.CAP/CAP.Builder.cs
using System; using Microsoft.Extensions.DependencyInjection; namespace DotNetCore.CAP { /// <summary> /// Used to verify cap service was called on a ServiceCollection /// </summary> public class CapMarkerService { } /// <summary> /// Allows fine grained configuration of CAP services. /// </summary> public class CapBuilder { public CapBuilder(IServiceCollection services) { Services = services; } /// <summary> /// Gets the <see cref="IServiceCollection"/> where MVC services are configured. /// </summary> public IServiceCollection Services { get; private set; } /// <summary> /// Adds a scoped service of the type specified in serviceType with an implementation /// </summary> private CapBuilder AddScoped(Type serviceType, Type concreteType) { Services.AddScoped(serviceType, concreteType); return this; } /// <summary> /// Add an <see cref="ICapPublisher"/>. /// </summary> /// <typeparam name="T">The type of the service.</typeparam> public virtual CapBuilder AddProducerService<T>() where T : class, ICapPublisher { return AddScoped(typeof(ICapPublisher), typeof(T)); } } }
using System; using Microsoft.Extensions.DependencyInjection; namespace DotNetCore.CAP { /// <summary> /// Used to verify cap service was called on a ServiceCollection /// </summary> public class CapMarkerService { } /// <summary> /// Allows fine grained configuration of CAP services. /// </summary> public class CapBuilder { public CapBuilder(IServiceCollection services) { Services = services; } /// <summary> /// Gets the <see cref="IServiceCollection"/> where MVC services are configured. /// </summary> public IServiceCollection Services { get; private set; } /// <summary> /// Adds a scoped service of the type specified in serviceType with an implementation /// </summary> private CapBuilder AddScoped(Type serviceType, Type concreteType) { Services.AddScoped(serviceType, concreteType); return this; } /// <summary> /// Adds a singleton service of the type specified in serviceType with an implementation /// </summary> private CapBuilder AddSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService { Services.AddSingleton<TService, TImplementation>(); return this; } /// <summary> /// Add an <see cref="ICapPublisher"/>. /// </summary> /// <typeparam name="T">The type of the service.</typeparam> public virtual CapBuilder AddProducerService<T>() where T : class, ICapPublisher { return AddScoped(typeof(ICapPublisher), typeof(T)); } } }
mit
C#
87cee39d5dd8acace594129318f7fbcef5240bbe
Add validation feature to AppHost
nover/ng-validation-errors,nover/ng-validation-errors,nover/ng-validation-errors
src/NgValidationErrors/AppHost.cs
src/NgValidationErrors/AppHost.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Web; using Funq; using NgValidationErrors.ServiceInterface; using NgValidationErrors.ServiceInterface.Validation; using ServiceStack; using ServiceStack.Configuration; using ServiceStack.Razor; using ServiceStack.Validation; namespace NgValidationErrors { public class AppHost : AppHostBase { /// <summary> /// Default constructor. /// Base constructor requires a name and assembly to locate web service classes. /// </summary> public AppHost() : base("NgValidationErrors", typeof(SignUpService).Assembly) { var customSettings = new FileInfo(@"~/appsettings.txt".MapHostAbsolutePath()); AppSettings = customSettings.Exists ? (IAppSettings)new TextFileSettings(customSettings.FullName) : new AppSettings(); } /// <summary> /// Application specific configuration /// This method should initialize any IoC resources utilized by your web service classes. /// </summary> /// <param name="container"></param> public override void Configure(Container container) { //Config examples //this.Plugins.Add(new PostmanFeature()); //this.Plugins.Add(new CorsFeature()); SetConfig(new HostConfig { DebugMode = AppSettings.Get("DebugMode", false), AddRedirectParamsToQueryString = true }); this.Plugins.Add(new RazorFormat()); Plugins.Add(new ValidationFeature()); container.RegisterValidators(typeof(SignUpValidator).Assembly); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Web; using Funq; using NgValidationErrors.ServiceInterface; using ServiceStack; using ServiceStack.Configuration; using ServiceStack.Razor; namespace NgValidationErrors { public class AppHost : AppHostBase { /// <summary> /// Default constructor. /// Base constructor requires a name and assembly to locate web service classes. /// </summary> public AppHost() : base("NgValidationErrors", typeof(SignUpService).Assembly) { var customSettings = new FileInfo(@"~/appsettings.txt".MapHostAbsolutePath()); AppSettings = customSettings.Exists ? (IAppSettings)new TextFileSettings(customSettings.FullName) : new AppSettings(); } /// <summary> /// Application specific configuration /// This method should initialize any IoC resources utilized by your web service classes. /// </summary> /// <param name="container"></param> public override void Configure(Container container) { //Config examples //this.Plugins.Add(new PostmanFeature()); //this.Plugins.Add(new CorsFeature()); SetConfig(new HostConfig { DebugMode = AppSettings.Get("DebugMode", false), AddRedirectParamsToQueryString = true }); this.Plugins.Add(new RazorFormat()); } } }
mit
C#
39e6d4b09300f81e88ef875857663401e5316182
Add T Compiled<T> to complement int Compiled
DnDGen/RollGen,Lirusaito/RollGen,DnDGen/RollGen,Lirusaito/RollGen
RollGen/Dice.cs
RollGen/Dice.cs
namespace RollGen { public abstract class Dice { public abstract PartialRoll Roll(int quantity = 1); public abstract string RolledString(string roll); public abstract object CompiledObj(string rolled); public int Compiled(string rolled) => System.Convert.ToInt32(CompiledObj(rolled)); public T Compiled<T>(string rolled) => (T)System.Convert.ChangeType(CompiledObj(rolled), typeof(T)); public int Roll(string roll) => Compiled(RolledString(roll)); } }
namespace RollGen { public abstract class Dice { public abstract PartialRoll Roll(int quantity = 1); public abstract string RolledString(string roll); public abstract object CompiledObj(string rolled); public int Compiled(string rolled) => System.Convert.ToInt32(CompiledObj(rolled)); public int Roll(string roll) => Compiled(RolledString(roll)); } }
mit
C#
df5bb7ee4758a90636d85bbec0e2a446c0479d6c
Update AddingBorderstoRange.cs
aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Formatting/Borders/AddingBorderstoRange.cs
Examples/CSharp/Formatting/Borders/AddingBorderstoRange.cs
using System.IO; using Aspose.Cells; using System.Drawing; namespace Aspose.Cells.Examples.Formatting.Borders { public class AddingBorderstoRange { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first (default) worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[0]; //Accessing the "A1" cell from the worksheet Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Hello World From Aspose"); //Creating a range of cells starting from "A1" cell to 3rd column in a row Range range = worksheet.Cells.CreateRange(0, 0, 1, 3); //Adding a thick top border with blue line range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thick, Color.Blue); //Adding a thick bottom border with blue line range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thick, Color.Blue); //Adding a thick left border with blue line range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thick, Color.Blue); //Adding a thick right border with blue line range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thick, Color.Blue); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; using System.Drawing; namespace Aspose.Cells.Examples.Formatting.Borders { public class AddingBorderstoRange { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first (default) worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[0]; //Accessing the "A1" cell from the worksheet Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Hello World From Aspose"); //Creating a range of cells starting from "A1" cell to 3rd column in a row Range range = worksheet.Cells.CreateRange(0, 0, 1, 3); //Adding a thick top border with blue line range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thick, Color.Blue); //Adding a thick bottom border with blue line range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thick, Color.Blue); //Adding a thick left border with blue line range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thick, Color.Blue); //Adding a thick right border with blue line range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thick, Color.Blue); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls"); } } }
mit
C#
5ca4b127482d196c5789ac4be723128e3d3c6679
Add "DeserializeEntity<T>" to RequestSerializer
skarpdev/dotnetcore-hubspot-client
src/Requests/RequestSerializer.cs
src/Requests/RequestSerializer.cs
using System; using System.Dynamic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Skarp.HubSpotClient.Interfaces; namespace Skarp.HubSpotClient.Requests { public class RequestSerializer { private readonly RequestDataConverter _requestDataConverter; private readonly JsonSerializerSettings _jsonSerializerSettings; /// <summary> /// Initializes a new instance of the <see cref="RequestSerializer"/> class. /// </summary> protected RequestSerializer() { _jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), NullValueHandling = NullValueHandling.Ignore }; } /// <summary> /// Initializes a new instance of the <see cref="RequestSerializer"/> class. /// </summary> /// <remarks>Use this constructor if you wish to override dependencies</remarks> /// <param name="requestDataConverter">The request data converter.</param> public RequestSerializer( RequestDataConverter requestDataConverter) : this() { _requestDataConverter = requestDataConverter; } /// <summary> /// Serializes the entity to JSON. /// </summary> /// <param name="entity">The entity.</param> /// <returns>The serialized entity</returns> public virtual string SerializeEntity(IHubSpotEntity entity) { var converted = _requestDataConverter.ToHubspotDataEntity(entity); return JsonConvert.SerializeObject( converted, _jsonSerializerSettings); } /// <summary> /// Deserialize the given JSON into a <see cref="IHubSpotEntity"/> /// </summary> /// <param name="json">The json data returned by HubSpot that should be converted</param> /// <returns>The deserialized entity</returns> public virtual IHubSpotEntity DeserializeEntity<T>(string json) where T : IHubSpotEntity, new() { var jobj = JsonConvert.DeserializeObject<ExpandoObject>(json); var converted = _requestDataConverter.FromHubSpotResponse<T>(jobj); return converted; } } }
using System; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Skarp.HubSpotClient.Interfaces; namespace Skarp.HubSpotClient.Requests { public class RequestSerializer { private readonly RequestDataConverter _requestDataConverter; private readonly JsonSerializerSettings _jsonSerializerSettings; /// <summary> /// Initializes a new instance of the <see cref="RequestSerializer"/> class. /// </summary> protected RequestSerializer() { _jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), NullValueHandling = NullValueHandling.Ignore }; } /// <summary> /// Initializes a new instance of the <see cref="RequestSerializer"/> class. /// </summary> /// <remarks>Use this constructor if you wish to override dependencies</remarks> /// <param name="requestDataConverter">The request data converter.</param> public RequestSerializer( RequestDataConverter requestDataConverter) : this() { _requestDataConverter = requestDataConverter; } /// <summary> /// Serializes the entity to JSON. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public virtual string SerializeEntity(IHubSpotEntity entity) { var converted = _requestDataConverter.ToHubspotDataEntity(entity); return JsonConvert.SerializeObject( converted, _jsonSerializerSettings); } } }
mit
C#
e294ed5ccfad5b2a626b022864afc472b1ab962b
Bump version to 1.0.1.
Faithlife/Parsing
SolutionInfo.cs
SolutionInfo.cs
using System.Reflection; [assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyCompany("Faithlife Corporation")] [assembly: AssemblyCopyright("Copyright 2016 Faithlife Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
using System.Reflection; [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyCompany("Faithlife Corporation")] [assembly: AssemblyCopyright("Copyright 2016 Faithlife Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
mit
C#
d5777c035aff86ff5b48184052b54e452e86d6f7
Update Copyright in SolutionInfo.cs.
pratikv/SLSharp,pratikv/SLSharp,IgniteInteractiveStudio/SLSharp,hach-que/SLSharp,hach-que/SLSharp,IgniteInteractiveStudio/SLSharp
SolutionInfo.cs
SolutionInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Ignite Interactive Studio")] [assembly: AssemblyProduct("SL#")] [assembly: AssemblyCopyright("Copyright 2011 Ignite Interactive Studio")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: CLSCompliant(false)] [assembly: ComVisible(false)]
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Ignite Interactive Studio")] [assembly: AssemblyProduct("SL#")] [assembly: AssemblyCopyright("Copyright Ignite Interactive Studio")] [assembly: AssemblyTrademark("MIT (Expat) License")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: CLSCompliant(false)] [assembly: ComVisible(false)]
mit
C#
a285b16277d468fb8e9db24f2bf93c57415b90c9
update CleanTextBoxFor tests
naile/cacti.mvc.web
test/CleanTextBoxFor.cs
test/CleanTextBoxFor.cs
using System.Web.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Cacti.Mvc.Web.Test { [TestClass] public class CleanTextBoxFor { private HtmlHelper<MyModel> _htmlHelper; public class MyModel { public string InputField { get; set; } } [TestInitialize] public void Setup() { _htmlHelper = MvcHelper.GetHtmlHelper<MyModel>(new ViewDataDictionary<MyModel>()); } [TestMethod] public void InputField_Is_Rendered_With_Correct_Attributes_With_No_Overloads() { var actualHtmlString = _htmlHelper.CleanTextBoxFor(x => x.InputField).ToHtmlString(); Assert.IsTrue(actualHtmlString.Contains("spellcheck=\"false\"")); Assert.IsTrue(actualHtmlString.Contains("autocomplete=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocorrect=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocapitalize=\"none\"")); } [TestMethod] public void InputField_Is_Rendered_With_Correct_Attributes_With_Custom_HtmlAttributes() { var actualHtmlString = _htmlHelper.CleanTextBoxFor( x => x.InputField, null, new { @class = "myCustomclass" }).ToHtmlString(); Assert.IsTrue(actualHtmlString.Contains("spellcheck=\"false\"")); Assert.IsTrue(actualHtmlString.Contains("autocomplete=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocorrect=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocapitalize=\"none\"")); } [TestMethod] public void InputField_Is_Rendered_With_Correct_Attributes_With_Custom_Format() { var actualHtmlString = _htmlHelper.CleanTextBoxFor( x => x.InputField, format: "test").ToHtmlString(); Assert.IsTrue(actualHtmlString.Contains("spellcheck=\"false\"")); Assert.IsTrue(actualHtmlString.Contains("autocomplete=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocorrect=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocapitalize=\"none\"")); } } }
using System.Web.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Cacti.Mvc.Web.Test { [TestClass] public class CleanTextBoxFor { private HtmlHelper<MyModel> _htmlHelper; public class MyModel { public string InputField { get; set; } } [TestInitialize] public void Setup() { _htmlHelper = MvcHelper.GetHtmlHelper<MyModel>(new ViewDataDictionary<MyModel>()); } [TestMethod] public void InputField_Is_Rendered_With_Correct_Attributes_With_No_Overloads() { var actualHtmlString = _htmlHelper.CleanTextBoxFor(x => x.InputField).ToHtmlString(); Assert.IsTrue(actualHtmlString.Contains("spellcheck=\"false\"")); Assert.IsTrue(actualHtmlString.Contains("autocomplete=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocapitalize=\"off\"")); } [TestMethod] public void InputField_Is_Rendered_With_Correct_Attributes_With_Custom_HtmlAttributes() { var actualHtmlString = _htmlHelper.CleanTextBoxFor( x => x.InputField, null, new { @class = "myCustomclass" }).ToHtmlString(); Assert.IsTrue(actualHtmlString.Contains("spellcheck=\"false\"")); Assert.IsTrue(actualHtmlString.Contains("autocomplete=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocapitalize=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("class=\"myCustomclass\"")); } [TestMethod] public void InputField_Is_Rendered_With_Correct_Attributes_With_Custom_Format() { var actualHtmlString = _htmlHelper.CleanTextBoxFor( x => x.InputField, format: "test").ToHtmlString(); Assert.IsTrue(actualHtmlString.Contains("spellcheck=\"false\"")); Assert.IsTrue(actualHtmlString.Contains("autocomplete=\"off\"")); Assert.IsTrue(actualHtmlString.Contains("autocapitalize=\"off\"")); } } }
mit
C#
ffb164d622b7d5843b111f262198d7e5d149aa8a
Add TypeEntry.ToString for debuggingg
drewnoakes/servant
Servant/TypeEntry.cs
Servant/TypeEntry.cs
#region License // // Servant // // Copyright 2016-2017 Drew Noakes // // 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. // // More information about this project is available at: // // https://github.com/drewnoakes/servant // #endregion using System; using JetBrains.Annotations; namespace Servant { internal sealed class TypeEntry { public Type DeclaredType { get; } [CanBeNull] public TypeProvider Provider { get; set; } public TypeEntry(Type declaredType) => DeclaredType = declaredType; public override string ToString() => $"{DeclaredType}{(Provider == null ? "(no provider)" : $"{Provider.Dependencies.Count} dependencies")}"; } }
#region License // // Servant // // Copyright 2016-2017 Drew Noakes // // 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. // // More information about this project is available at: // // https://github.com/drewnoakes/servant // #endregion using System; using JetBrains.Annotations; namespace Servant { internal sealed class TypeEntry { public Type DeclaredType { get; } [CanBeNull] public TypeProvider Provider { get; set; } public TypeEntry(Type declaredType) => DeclaredType = declaredType; } }
apache-2.0
C#
a2f80a758977001e166a96f46e5d83520bd250c4
Update Export-CurrentContainer-Multi.csx
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
scripts/Export-CurrentContainer-Multi.csx
scripts/Export-CurrentContainer-Multi.csx
#r "System.Linq" #r "Core2D" using System; using System.IO; using System.Linq; using Core2D.FileWriter.Dxf; using Core2D.FileWriter.PdfSharp; using Core2D.FileWriter.SkiaSharpPng; using Core2D.FileWriter.SkiaSharpSvg; var dir = "D:\\"; var page = Editor.Project.CurrentContainer; var dxf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(DxfWriter)); using var dxfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + dxf.Extension)); dxf.Save(dxfStream, page, Editor.Project); var pdf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PdfSharpWriter)); using var pdfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + pdf.Extension)); pdf.Save(pdfStream, page, Editor.Project); var png = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PngSkiaSharpWriter)); using var pngStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + png.Extension)); png.Save(pngStream, page, Editor.Project); var svg = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(SvgSkiaSharpWriter)); using var svgStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + svg.Extension)); svg.Save(svgStream, page, Editor.Project);
#r "System.Linq" #r "Core2D" using System; using System.IO; using System.Linq; using Core2D.FileWriter.Dxf; using Core2D.FileWriter.PdfSharp; using Core2D.FileWriter.SkiaSharpPng; using Core2D.FileWriter.SkiaSharpSvg; var dir = "D:\\"; var page = Editor.Project.CurrentContainer; var dxf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(DxfWriter)); using var dxfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + dxf.Extension)); dxf.SavedxfStream(, page, Editor.Project); var pdf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PdfSharpWriter)); using var pdfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + pdf.Extension)); pdf.Save(pdfStream, page, Editor.Project); var png = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PngSkiaSharpWriter)); using var pngStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + png.Extension)); png.Save(pngStream, page, Editor.Project); var svg = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(SvgSkiaSharpWriter)); using var svgStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + svg.Extension)); svg.Save(svgStream, page, Editor.Project);
mit
C#
d1a36e644f4c119a7e276b9ccfa6beb453737fd0
Update Program.cs
nanoframework/nf-Visual-Studio-extension
source/CSharp.BlankApplication/Program.cs
source/CSharp.BlankApplication/Program.cs
using System; using System.Threading; using System.Diagnostics; namespace $safeprojectname$ { public class Program { public static void Main() { Thread.Sleep(1000); // Give some time to debugger to attach try { // User code goes here } catch (Exception ex) { // Do whatever please you with the exception caught } finally // Enter the infinite loop in all cases { Thread.Sleep(Timeout.Infinite); } } } }
using System; using System.Threading; using System.Diagnostics; namespace $safeprojectname$ { public class Program { public static void Main() { while (!Debugger.IsAttached) { Thread.Sleep(100); } // Wait for debugger (only needed for debugging session) Console.WriteLine("Program started"); // You can remove this line once it outputs correctly on the console try { // User code goes here } catch (Exception ex) { // Do whatever please you with the exception caught } finally // Enter the infinite loop in all cases { while (true) { Thread.Sleep(200); } } } } }
mit
C#
7b1711ab20ef6de997dbb68aeb8a596c5f90309d
Increment version to 1.1.0.16
TDaphneB/XeroAPI.Net,XeroAPI/XeroAPI.Net,jcvandan/XeroAPI.Net,MatthewSteeples/XeroAPI.Net
source/XeroApi/Properties/AssemblyInfo.cs
source/XeroApi/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.16")] [assembly: AssemblyFileVersion("1.1.0.16")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.15")] [assembly: AssemblyFileVersion("1.1.0.15")]
mit
C#
b4f8cda3030c11667d5a1d8017bbb575a9a20191
fix error controller so it will get css theme from settings
momcms/MoM,momcms/MoM
MoM.Web/Controllers/ErrorController.cs
MoM.Web/Controllers/ErrorController.cs
using Microsoft.AspNet.Mvc; using Microsoft.Extensions.OptionsModel; using MoM.Web.Config; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace MoM.Web.Controllers { public class ErrorController : Controller { IOptions<Site> SiteSettings; public ErrorController(IOptions<Site> siteSettings) { SiteSettings = siteSettings; } // GET: /<controller>/ public IActionResult Index() { var theme = SiteSettings.Value.Theme; ViewData["CssPath"] = "css/" + theme.Module + "/" + theme.Selected + "/"; return View(); } } }
using Microsoft.AspNet.Mvc; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace MoM.Web.Controllers { public class ErrorController : Controller { // GET: /<controller>/ public IActionResult Index() { return View(); } } }
mit
C#
d14869dd29460df5960a823e7656b5dd739af413
Simplify EventCollector CloseWindow
brian-dot-net/writeasync,brian-dot-net/writeasync,brian-dot-net/writeasync
projects/TraceAnalysisSample/source/TraceAnalysisSample.Core/EventCollector.cs
projects/TraceAnalysisSample/source/TraceAnalysisSample.Core/EventCollector.cs
//----------------------------------------------------------------------- // <copyright file="EventCollector.cs" company="Brian Rogers"> // Copyright (c) Brian Rogers. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace TraceAnalysisSample { using System; using System.Collections.Generic; using System.Linq; public class EventCollector { private EventWindow window; public EventCollector() { } public event EventHandler<WindowEventArgs> WindowClosed; public void OnStart(int eventId, Guid instanceId, DateTime timestamp) { if (this.window == null) { this.window = new EventWindow(timestamp); } this.window.Add(eventId, instanceId); } public void OnEnd(int eventId, Guid instanceId, DateTime timestamp) { this.window.Complete(eventId, instanceId); } public void CloseWindow() { this.WindowClosed(this, new WindowEventArgs(this.window)); } } }
//----------------------------------------------------------------------- // <copyright file="EventCollector.cs" company="Brian Rogers"> // Copyright (c) Brian Rogers. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace TraceAnalysisSample { using System; using System.Collections.Generic; using System.Linq; public class EventCollector { private EventWindow window; public EventCollector() { } public event EventHandler<WindowEventArgs> WindowClosed; public void OnStart(int eventId, Guid instanceId, DateTime timestamp) { if (this.window == null) { this.window = new EventWindow(timestamp); } this.window.Add(eventId, instanceId); } public void OnEnd(int eventId, Guid instanceId, DateTime timestamp) { this.window.Complete(eventId, instanceId); } public void CloseWindow() { this.WindowClosed(this, new WindowEventArgs(this.window)); this.window = null; } } }
unlicense
C#
b15ef9ac4dc9e7834b6c7441e108d5158abe5abe
Add to the HUD
paytonrules/UnityInAction
Assets/Shooter.cs
Assets/Shooter.cs
using UnityEngine; using System.Collections; public class Shooter : MonoBehaviour { private Camera _camera; // Use this for initialization void Start () { _camera = GetComponent<Camera> (); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown(0)) { var point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0); var ray = _camera.ScreenPointToRay(point); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { StartCoroutine(SphereIndicator(hit.point)); } } } void OnGUI() { int size = 12; float posX = _camera.pixelWidth / 2 - size / 4; float posY = _camera.pixelHeight / 2 - size / 2; GUI.Label (new Rect (posX, posY, size, size), "*"); } private IEnumerator SphereIndicator(Vector3 pos) { var sphere = GameObject.CreatePrimitive (PrimitiveType.Sphere); sphere.transform.position = pos; yield return new WaitForSeconds (1); Destroy (sphere); } }
using UnityEngine; using System.Collections; public class Shooter : MonoBehaviour { private Camera _camera; // Use this for initialization void Start () { _camera = GetComponent<Camera> (); } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown(0)) { var point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0); var ray = _camera.ScreenPointToRay(point); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { StartCoroutine(SphereIndicator(hit.point)); } } } private IEnumerator SphereIndicator(Vector3 pos) { var sphere = GameObject.CreatePrimitive (PrimitiveType.Sphere); sphere.transform.position = pos; yield return new WaitForSeconds (1); Destroy (sphere); } }
mit
C#
7e5ea30f3e524609e967b302dd64a261351df56e
Allow access to calender for unauthorized users.
strayfatty/ShowFeed,strayfatty/ShowFeed
src/ShowFeed/Api/CalendarApiController.cs
src/ShowFeed/Api/CalendarApiController.cs
namespace ShowFeed.Api { using System; using System.Linq; using System.Web.Http; using ShowFeed.Api.Model; using ShowFeed.Models; using WebMatrix.WebData; /// <summary> /// The calendar API controller. /// </summary> public class CalendarApiController : ApiController { /// <summary> /// The database. /// </summary> private readonly IDatabase database; /// <summary> /// Initializes a new instance of the <see cref="CalendarApiController"/> class. /// </summary> /// <param name="database">The database.</param> public CalendarApiController(IDatabase database) { this.database = database; } /// <summary> /// Gets the calendar events for the specified time frame. /// </summary> /// <param name="query">The query.</param> /// <returns>The <see cref="CalendarQueryResult"/>.</returns> [HttpGet] [AllowAnonymous] public CalendarQueryResult Get([FromUri]CalendarQuery query) { var username = WebSecurity.CurrentUserName; var databaseQuery = this.database.Query<Episode>() .Where(x => x.FirstAired.HasValue && x.FirstAired.Value >= query.FromDate && x.FirstAired.Value <= query.ToDate); if (this.User.Identity.IsAuthenticated) { databaseQuery = databaseQuery.Where(x => x.Series.Followers.Any(y => y.Username == username)); } var result = new CalendarQueryResult(); result.Success = 1; result.Result = databaseQuery.Select(x => new CalendarEntry { Id = x.Id, Title = x.Series.Name + " - " + x.Name, Class = x.FirstAired.Value >= DateTime.Today ? "event-info" : x.Viewers.Any(y => y.Username == WebSecurity.CurrentUserName) ? "event-success" : "event-important", EventDay = x.FirstAired.Value }) .ToList(); return result; } } }
namespace ShowFeed.Api { using System; using System.Linq; using System.Web.Http; using ShowFeed.Api.Model; using ShowFeed.Models; using WebMatrix.WebData; /// <summary> /// The calendar API controller. /// </summary> public class CalendarApiController : ApiController { /// <summary> /// The database. /// </summary> private readonly IDatabase database; /// <summary> /// Initializes a new instance of the <see cref="CalendarApiController"/> class. /// </summary> /// <param name="database">The database.</param> public CalendarApiController(IDatabase database) { this.database = database; } /// <summary> /// Gets the calendar events for the specified time frame. /// </summary> /// <param name="query">The query.</param> /// <returns>The <see cref="CalendarQueryResult"/>.</returns> [HttpGet] public CalendarQueryResult Get([FromUri]CalendarQuery query) { var result = new CalendarQueryResult(); result.Success = 1; result.Result = this.database.Query<Episode>() .Where(x => x.FirstAired.HasValue && x.FirstAired.Value >= query.FromDate && x.FirstAired.Value <= query.ToDate) .Select(x => new CalendarEntry { Id = x.Id, Title = x.Series.Name + " - " + x.Name, Class = x.FirstAired.Value >= DateTime.Today ? "event-info" : x.Viewers.Any(y => y.Username == WebSecurity.CurrentUserName) ? "event-success" : "event-important", EventDay = x.FirstAired.Value }) .ToList(); return result; } } }
mit
C#
56ab837c4d8f03b1d661fc96dd23952fc702daa7
remove register MapMessage
signumsoftware/framework,MehdyKarimpour/extensions,signumsoftware/framework,signumsoftware/extensions,AlejandroCano/extensions,MehdyKarimpour/extensions,AlejandroCano/extensions,signumsoftware/extensions
Signum.React.Extensions/Isolation/IsolationServer.cs
Signum.React.Extensions/Isolation/IsolationServer.cs
using Signum.Utilities; using System.Reflection; using Signum.Engine.Basics; using Signum.React.Maps; using Signum.Entities.Map; using Signum.React.Facades; using Signum.Engine.Isolation; using Microsoft.AspNetCore.Builder; using Signum.Engine.Authorization; using Signum.React.Filters; using Signum.React.Extensions.Isolation; using Microsoft.AspNetCore.Mvc; using System.Linq; using System; namespace Signum.React.Isolation { public static class IsolationServer { public static void Start(IApplicationBuilder app) { SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); SchemaMap.GetColorProviders += GetMapColors; } public static MvcOptions AddIsolationFilter(this MvcOptions options) { if (!options.Filters.OfType<SignumAuthenticationFilter>().Any()) throw new InvalidOperationException("SignumAuthenticationFilter not found"); options.Filters.Add(new IsolationFilter()); return options; } static MapColorProvider[] GetMapColors() { var strategies = IsolationLogic.GetIsolationStrategies().SelectDictionary(t => TypeLogic.GetCleanName(t), p => p); return new[] { new MapColorProvider { Name = "isolation", NiceName = "Isolation", AddExtra = t => { var s = strategies.TryGetS(t.typeName); if (s == null) return; t.extra["isolation"] = s.ToString(); }, Order = 3, }, }; } } }
using Signum.Utilities; using System.Reflection; using Signum.Engine.Basics; using Signum.React.Maps; using Signum.Entities.Map; using Signum.React.Facades; using Signum.Engine.Isolation; using Microsoft.AspNetCore.Builder; using Signum.Engine.Authorization; using Signum.React.Filters; using Signum.React.Extensions.Isolation; using Microsoft.AspNetCore.Mvc; using System.Linq; using System; namespace Signum.React.Isolation { public static class IsolationServer { public static void Start(IApplicationBuilder app) { ReflectionServer.RegisterLike(typeof(MapMessage), () => MapPermission.ViewMap.IsAuthorized()); SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); SchemaMap.GetColorProviders += GetMapColors; } public static MvcOptions AddIsolationFilter(this MvcOptions options) { if (!options.Filters.OfType<SignumAuthenticationFilter>().Any()) throw new InvalidOperationException("SignumAuthenticationFilter not found"); options.Filters.Add(new IsolationFilter()); return options; } static MapColorProvider[] GetMapColors() { var strategies = IsolationLogic.GetIsolationStrategies().SelectDictionary(t => TypeLogic.GetCleanName(t), p => p); return new[] { new MapColorProvider { Name = "isolation", NiceName = "Isolation", AddExtra = t => { var s = strategies.TryGetS(t.typeName); if (s == null) return; t.extra["isolation"] = s.ToString(); }, Order = 3, }, }; } } }
mit
C#
4eeb9a4005fe40dcfe76832876baf3c1472bf385
add version info
toosean/MapperByAttribute
src/Properties/AssemblyInfo.cs
src/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("MapperByAttribute")] [assembly: AssemblyDescription("using AutoMapper by attribute")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("sean")] [assembly: AssemblyProduct("MapperByAttribute")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("4244f102-8de2-48c0-b4d9-d9e2d4a2253d")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("MapperByAttribute")] [assembly: AssemblyDescription("using AutoMapper by attribute")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("sean")] [assembly: AssemblyProduct("MapperByAttribute")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("4244f102-8de2-48c0-b4d9-d9e2d4a2253d")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
unlicense
C#
b63b5aaef335ffb34ca2930e105dc9955fe50ba7
configure port on Web
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Web/Program.cs
src/FilterLists.Web/Program.cs
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace FilterLists.Web { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) { return WebHost.CreateDefaultBuilder(args) .UseUrls("http://localhost:5001;") .UseStartup<Startup>() .Build(); } } }
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace FilterLists.Web { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) { return WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .Build(); } } }
mit
C#
da0cd66b6af42a3df1f35014617f1e0882ae9e63
debug combo: ';' instead of ','
jpbruyere/Crow,jpbruyere/Crow
src/GraphicObjects/ComboBox.cs
src/GraphicObjects/ComboBox.cs
// // ComboBox.cs // // Author: // Jean-Philippe Bruyère <jp_bruyere@hotmail.com> // // Copyright (c) 2016 jp // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Xml.Serialization; namespace Crow { [DefaultTemplate("#Crow.Templates.ComboBox.goml")] public class ComboBox : ListBox { #region CTOR public ComboBox() : base(){ } #endregion Size minimumPopupSize = "10,10"; [XmlIgnore]public Size MinimumPopupSize{ get { return minimumPopupSize; } set { minimumPopupSize = value; NotifyValueChanged ("MinimumPopupSize", minimumPopupSize); } } public override void OnLayoutChanges (LayoutingType layoutType) { base.OnLayoutChanges (layoutType); if (layoutType == LayoutingType.Width) MinimumPopupSize = new Size (this.Slot.Width, minimumPopupSize.Height); } } }
// // ComboBox.cs // // Author: // Jean-Philippe Bruyère <jp_bruyere@hotmail.com> // // Copyright (c) 2016 jp // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Xml.Serialization; namespace Crow { [DefaultTemplate("#Crow.Templates.ComboBox.goml")] public class ComboBox : ListBox { #region CTOR public ComboBox() : base(){ } #endregion Size minimumPopupSize = "10;10"; [XmlIgnore]public Size MinimumPopupSize{ get { return minimumPopupSize; } set { minimumPopupSize = value; NotifyValueChanged ("MinimumPopupSize", minimumPopupSize); } } public override void OnLayoutChanges (LayoutingType layoutType) { base.OnLayoutChanges (layoutType); if (layoutType == LayoutingType.Width) MinimumPopupSize = new Size (this.Slot.Width, minimumPopupSize.Height); } } }
mit
C#
efe4303e873bf4cfad600cb33f3c54bdf684dd48
Bump version.
JohanLarsson/Gu.Roslyn.Asserts
Gu.Roslyn.Asserts/Properties/AssemblyInfo.cs
Gu.Roslyn.Asserts/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Gu.Roslyn.Asserts.Properties")] [assembly: AssemblyDescription("Asserts for testing Roslyn analyzers and code fixes.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Johan Larsson")] [assembly: AssemblyProduct("Gu.Roslyn.Asserts.Properties")] [assembly: AssemblyCopyright("Copyright © Johan Larsson 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("f407a423-47a0-4b6e-8287-6d045cf4d8fb")] [assembly: AssemblyVersion("0.1.2.0")] [assembly: AssemblyFileVersion("0.1.2.0")] [assembly: AssemblyInformationalVersion("0.1.2.0-dev")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Gu.Roslyn.Asserts.Properties")] [assembly: AssemblyDescription("Asserts for testing Roslyn analyzers and code fixes.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Johan Larsson")] [assembly: AssemblyProduct("Gu.Roslyn.Asserts.Properties")] [assembly: AssemblyCopyright("Copyright © Johan Larsson 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("f407a423-47a0-4b6e-8287-6d045cf4d8fb")] [assembly: AssemblyVersion("0.1.1.0")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1.0-dev")]
mit
C#
e803fa121b391e82b34e505fec12ace02f17a707
fix exception message
solomobro/Instagram,solomobro/Instagram,solomobro/Instagram
src/Solomobro.Instagram/Ioc.cs
src/Solomobro.Instagram/Ioc.cs
using System; using System.Collections.Generic; namespace Solomobro.Instagram { /// <summary> /// Internal-only homegrown IOC container. /// It's not really meant to make our code more flexible /// Just makes it possible to substitute some types for unit testing /// </summary> internal static class Ioc { private static Dictionary<string, object> _substitutes = new Dictionary<string, object>(); /// <summary> /// Meant to be called within a unit test only /// DO NOT CALL THIS INSIDE THE LIBRARY /// </summary> /// <typeparam name="T"></typeparam> /// <param name="mockInstance">the mock instance</param> public static void Substitute<T>(T mockInstance) where T: class { if (mockInstance == null) { throw new InvalidOperationException("Not allowed to substitute with a null instance"); } _substitutes[Key<T>()] = mockInstance; } public static T Resolve<T>() where T: class { object instance; if (_substitutes.TryGetValue(Key<T>(), out instance)) { return (T) instance; } return null; } private static string Key<T>() { return typeof (T).FullName; } } }
using System; using System.Collections.Generic; namespace Solomobro.Instagram { /// <summary> /// Internal-only homegrown IOC container. /// It's not really meant to make our code more flexible /// Just makes it possible to substitute some types for unit testing /// </summary> internal static class Ioc { private static Dictionary<string, object> _substitutes = new Dictionary<string, object>(); /// <summary> /// Meant to be called within a unit test only /// DO NOT CALL THIS INSIDE THE LIBRARY /// </summary> /// <typeparam name="T"></typeparam> /// <param name="mockInstance">the mock instance</param> public static void Substitute<T>(T mockInstance) where T: class { if (mockInstance == null) { throw new InvalidOperationException("Not allowed to substitude with a null instance"); } _substitutes[Key<T>()] = mockInstance; } public static T Resolve<T>() where T: class { object instance; if (_substitutes.TryGetValue(Key<T>(), out instance)) { return (T) instance; } return null; } private static string Key<T>() { return typeof (T).FullName; } } }
apache-2.0
C#
5cca0d60f8c1dc5fca436fd250ee22f381bb5f85
Change the color
setchi/NotesEditor,setchi/NoteEditor
Assets/Scripts/FileItem.cs
Assets/Scripts/FileItem.cs
using UnityEngine; using UnityEngine.UI; using UniRx; using UniRx.Triggers; public class FileItem : MonoBehaviour { string fileName; MusicSelectorModel model; void Start() { GetComponent<RectTransform>().localScale = Vector3.one; model = MusicSelectorModel.Instance; var text = GetComponentInChildren<Text>(); var image = GetComponent<Image>(); this.UpdateAsObservable() .Select(_ => fileName == model.SelectedFileName.Value) .Do(selected => image.color = selected ? new Color(17 / 255f, 19 / 255f, 16 / 255f) : new Color(48 / 255f, 49 / 255f, 47 / 255f)) .Subscribe(selected => text.color = selected ? new Color(253 / 255f, 255 / 255f, 251 / 255f) : new Color(146 / 255f, 148 / 255f, 143 / 255f)); } public void SetName(string name) { this.fileName = name; GetComponentInChildren<Text>().text = name; } public void OnMouseDown() { model.SelectedFileName.Value = fileName; } }
using UnityEngine; using UnityEngine.UI; using UniRx; using UniRx.Triggers; public class FileItem : MonoBehaviour { string fileName; MusicSelectorModel model; void Start() { GetComponent<RectTransform>().localScale = Vector3.one; model = MusicSelectorModel.Instance; var text = GetComponentInChildren<Text>(); var image = GetComponent<Image>(); this.UpdateAsObservable() .Select(_ => fileName == model.SelectedFileName.Value) .Do(selected => image.color = selected ? new Color(17 / 255f, 19 / 255f, 16 / 255f) : new Color(48 / 255f, 49 / 255f, 47 / 255f)) .Subscribe(selected => text.color = selected ? new Color(175 / 255f, 1, 78 / 255f) : new Color(146 / 255f, 148 / 255f, 143 / 255f)); } public void SetName(string name) { this.fileName = name; GetComponentInChildren<Text>().text = name; } public void OnMouseDown() { model.SelectedFileName.Value = fileName; } }
mit
C#
12615a13cc22e2270537db54d53b9e56416f0257
test to ensure casing is correct for verification signature
hsteinhilber/SQRL
SQRL.Test/SqrlUriTests.cs
SQRL.Test/SqrlUriTests.cs
using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; namespace SQRL.Test { [TestFixture] public class SqrlUriTests { [TestCase("sqrl://example.com/sqrl/login.php?NONCE", "example.com")] [TestCase("sqrl://example.com:8080/sqrl/login.php?NONCE", "example.com")] [TestCase("sqrl://example.com/hsteinhilber|sqrl/login.php?NONCE", "example.com/hsteinhilber")] [TestCase("sqrl://example.com:8080/hsteinhilber|sqrl/login.php?NONCE", "example.com/hsteinhilber")] public void SiteKeyString_should_be_correct(string uriString, string siteKeyString) { var uri = new SqrlUri(uriString); Assert.That(uri.SiteKeyString, Is.EqualTo(siteKeyString)); } [TestCase("sqrl://example.com", 443)] [TestCase("qrl://example.com", 80)] [TestCase("sqrl://example.com:8080", 8080)] [TestCase("qrl://example.com:1024", 1024)] public void Port_should_be_correct(string uriString, int expectedPort) { var uri = new SqrlUri(uriString); Assert.That(uri.Port, Is.EqualTo(expectedPort)); } [TestCase("http://www.example.com")] [TestCase("https://www.example.com")] [TestCase("mailto:test@example.com")] [TestCase("ftp://www.example.com")] public void Unsupported_schemes_should_throw_an_exception(string uriString) { Assert.That(() => new SqrlUri(uriString), Throws.InstanceOf<NotSupportedException>()); } [TestCase("sqrl://example.com/")] [TestCase("qrl://example.com/")] public void Supported_schemes_should_include_sqrl_and_qrl(string uriString) { Assert.That(() => new SqrlUri(uriString), Throws.Nothing); } [TestCase("SQRL://example.com/", "sqrl://example.com/")] [TestCase("sqrl://Example.Com/", "sqrl://example.com/")] public void Scheme_and_host_should_always_be_lowercase(string uriString, string expected) { var uri = new SqrlUri(uriString); Assert.That(uri.ToString(), Is.EqualTo(expected)); } [Test] public void Path_should_retain_casing() { var expected = "sqrl://example.com/PathWithCasing?Id=SomeNonce"; var uri = new SqrlUri(expected); Assert.That(uri.ToString(), Is.EqualTo(expected)); } } }
using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; namespace SQRL.Test { [TestFixture] public class SqrlUriTests { [TestCase("sqrl://example.com/sqrl/login.php?NONCE", "example.com")] [TestCase("sqrl://example.com:8080/sqrl/login.php?NONCE", "example.com")] [TestCase("sqrl://example.com/hsteinhilber|sqrl/login.php?NONCE", "example.com/hsteinhilber")] [TestCase("sqrl://example.com:8080/hsteinhilber|sqrl/login.php?NONCE", "example.com/hsteinhilber")] public void SiteKeyString_should_be_correct(string uriString, string siteKeyString) { SqrlUri uri = new SqrlUri(uriString); Assert.That(uri.SiteKeyString, Is.EqualTo(siteKeyString)); } [TestCase("sqrl://example.com", 443)] [TestCase("qrl://example.com", 80)] [TestCase("sqrl://example.com:8080", 8080)] [TestCase("qrl://example.com:1024", 1024)] public void Port_should_be_correct(string uriString, int expectedPort) { SqrlUri uri = new SqrlUri(uriString); Assert.That(uri.Port, Is.EqualTo(expectedPort)); } [TestCase("http://www.example.com")] [TestCase("https://www.example.com")] [TestCase("mailto:test@example.com")] [TestCase("ftp://www.example.com")] public void Unsupported_schemes_should_throw_an_exception(string uriString) { Assert.That(() => new SqrlUri(uriString), Throws.InstanceOf<NotSupportedException>()); } [TestCase("sqrl://example.com")] [TestCase("qrl://example.com")] public void Supported_schemes_should_include_sqrl_and_qrl(string uriString) { Assert.That(() => new SqrlUri(uriString), Throws.Nothing); } } }
mit
C#
dbd9a89c4893b980110566c61a8654e58c326ace
Allow targeting FX of newest MD
mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker
MonoDevelop.AddinMaker/AddinProjectFlavor.cs
MonoDevelop.AddinMaker/AddinProjectFlavor.cs
using System.Collections.Generic; using System.Linq; using System.Reflection; using Mono.Addins; using MonoDevelop.Core; using MonoDevelop.Core.Assemblies; using MonoDevelop.Core.Execution; using MonoDevelop.Projects; namespace MonoDevelop.AddinMaker { class AddinProjectFlavor : DotNetProjectExtension { AddinReferenceCollection addinReferences; protected override void Initialize () { base.Initialize (); addinReferences = new AddinReferenceCollection (this); Project.Items.Bind (addinReferences); //TODO: load the actual addin registry referenced from the project file AddinRegistry = AddinManager.Registry; } public AddinReferenceCollection AddinReferences { get { return addinReferences; } } protected override DotNetProjectFlags OnGetDotNetProjectFlags () { return base.OnGetDotNetProjectFlags () | DotNetProjectFlags.IsLibrary; } protected override bool OnGetSupportsFramework (TargetFramework framework) { return framework.Id.Identifier == TargetFrameworkMoniker.NET_4_5.Identifier; } protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind) { var cfg = new AddinProjectConfiguration (name); cfg.CopyFrom (base.OnCreateConfiguration (name, kind)); return cfg; } public IEnumerable<Addin> GetReferencedAddins () { yield return AddinRegistry.GetAddin ("MonoDevelop.Core"); yield return AddinRegistry.GetAddin ("MonoDevelop.Ide"); foreach (var ar in Project.Items.OfType<AddinReference> ()) { yield return AddinRegistry.GetAddin (ar.Include); } } public AddinRegistry AddinRegistry { get; private set; } protected override ExecutionCommand OnCreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration) { var cmd = (DotNetExecutionCommand) base.OnCreateExecutionCommand (configSel, configuration); cmd.Command = Assembly.GetEntryAssembly ().Location; cmd.Arguments = "--no-redirect"; cmd.EnvironmentVariables["MONODEVELOP_DEV_ADDINS"] = Project.GetOutputFileName (configSel).ParentDirectory; cmd.EnvironmentVariables ["MONODEVELOP_CONSOLE_LOG_LEVEL"] = "All"; return cmd; } protected override bool OnGetCanExecute (ExecutionContext context, ConfigurationSelector configuration) { return true; } protected override ProjectFeatures OnGetSupportedFeatures () { return base.OnGetSupportedFeatures () | ProjectFeatures.Execute; } protected override IList<string> OnGetCommonBuildActions () { var list = new List<string> (base.OnGetCommonBuildActions ()); list.Add ("AddinFile"); return list; } } class AddinReferenceEventArgs : EventArgsChain<AddinReferenceEventInfo> { public void AddInfo (AddinProjectFlavor project, AddinReference reference) { Add (new AddinReferenceEventInfo (project, reference)); } } class AddinReferenceEventInfo { public AddinReference Reference { get; private set; } public AddinProjectFlavor Project { get; private set; } public AddinReferenceEventInfo (AddinProjectFlavor project, AddinReference reference) { Reference = reference; Project = project; } } }
using System.Collections.Generic; using System.Linq; using System.Reflection; using Mono.Addins; using MonoDevelop.Core; using MonoDevelop.Core.Assemblies; using MonoDevelop.Core.Execution; using MonoDevelop.Projects; namespace MonoDevelop.AddinMaker { class AddinProjectFlavor : DotNetProjectExtension { AddinReferenceCollection addinReferences; protected override void Initialize () { base.Initialize (); addinReferences = new AddinReferenceCollection (this); Project.Items.Bind (addinReferences); //TODO: load the actual addin registry referenced from the project file AddinRegistry = AddinManager.Registry; } public AddinReferenceCollection AddinReferences { get { return addinReferences; } } protected override DotNetProjectFlags OnGetDotNetProjectFlags () { return base.OnGetDotNetProjectFlags () | DotNetProjectFlags.IsLibrary; } protected override bool OnGetSupportsFramework (TargetFramework framework) { return framework.Id == TargetFrameworkMoniker.NET_4_5; } protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind) { var cfg = new AddinProjectConfiguration (name); cfg.CopyFrom (base.OnCreateConfiguration (name, kind)); return cfg; } public IEnumerable<Addin> GetReferencedAddins () { yield return AddinRegistry.GetAddin ("MonoDevelop.Core"); yield return AddinRegistry.GetAddin ("MonoDevelop.Ide"); foreach (var ar in Project.Items.OfType<AddinReference> ()) { yield return AddinRegistry.GetAddin (ar.Include); } } public AddinRegistry AddinRegistry { get; private set; } protected override ExecutionCommand OnCreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration) { var cmd = (DotNetExecutionCommand) base.OnCreateExecutionCommand (configSel, configuration); cmd.Command = Assembly.GetEntryAssembly ().Location; cmd.Arguments = "--no-redirect"; cmd.EnvironmentVariables["MONODEVELOP_DEV_ADDINS"] = Project.GetOutputFileName (configSel).ParentDirectory; cmd.EnvironmentVariables ["MONODEVELOP_CONSOLE_LOG_LEVEL"] = "All"; return cmd; } protected override bool OnGetCanExecute (ExecutionContext context, ConfigurationSelector configuration) { return true; } protected override ProjectFeatures OnGetSupportedFeatures () { return base.OnGetSupportedFeatures () | ProjectFeatures.Execute; } protected override IList<string> OnGetCommonBuildActions () { var list = new List<string> (base.OnGetCommonBuildActions ()); list.Add ("AddinFile"); return list; } } class AddinReferenceEventArgs : EventArgsChain<AddinReferenceEventInfo> { public void AddInfo (AddinProjectFlavor project, AddinReference reference) { Add (new AddinReferenceEventInfo (project, reference)); } } class AddinReferenceEventInfo { public AddinReference Reference { get; private set; } public AddinProjectFlavor Project { get; private set; } public AddinReferenceEventInfo (AddinProjectFlavor project, AddinReference reference) { Reference = reference; Project = project; } } }
mit
C#
1fd34d5183916817e917a66978e293ce453623fa
Add exception handling in middleware
criteo/zipkin4net,criteo/zipkin4net
zipkin4net-aspnetcore/Criteo.Profiling.Tracing.Middleware/TracingMiddleware.cs
zipkin4net-aspnetcore/Criteo.Profiling.Tracing.Middleware/TracingMiddleware.cs
using System; using Microsoft.AspNetCore.Builder; using Criteo.Profiling.Tracing; namespace Criteo.Profiling.Tracing.Middleware { public static class TracingMiddleware { public static void UseTracing(this IApplicationBuilder app, string serviceName) { var extractor = new Middleware.ZipkinHttpTraceExtractor(); app.Use(async (context, next) => { Trace trace; if (!extractor.TryExtract(context.Request.Headers, out trace)) { trace = Trace.Create(); } Trace.Current = trace; trace.Record(Annotations.ServerRecv()); trace.Record(Annotations.ServiceName(serviceName)); trace.Record(Annotations.Rpc(context.Request.Method)); try { await next.Invoke(); } catch (System.Exception e) { trace.Record(Annotations.Tag("error", e.Message)); throw; } finally { trace.Record(Annotations.ServerSend()); } }); } } }
using System; using Microsoft.AspNetCore.Builder; using Criteo.Profiling.Tracing; namespace Criteo.Profiling.Tracing.Middleware { public static class TracingMiddleware { public static void UseTracing(this IApplicationBuilder app, string serviceName) { var extractor = new Middleware.ZipkinHttpTraceExtractor(); app.Use(async (context, next) => { Trace trace; if (!extractor.TryExtract(context.Request.Headers, out trace)) { trace = Trace.Create(); } Trace.Current = trace; trace.Record(Annotations.ServerRecv()); trace.Record(Annotations.ServiceName(serviceName)); trace.Record(Annotations.Rpc(context.Request.Method)); await next.Invoke(); trace.Record(Annotations.ServerSend()); }); } } }
apache-2.0
C#
6203c22abd7b96dd7d1b8f4b12733e6e85df93ef
Support for environment appsettings.
jyarbro/forum,jyarbro/forum,jyarbro/forum
Forum3/Program.cs
Forum3/Program.cs
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; namespace Forum3 { public class Program { public static void Main(string[] args) => BuildWebHost(args).Run(); public static IWebHost BuildWebHost(string[] args) { return WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .ConfigureAppConfiguration((builderContext, config) => { config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{builderContext.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true); }) .Build(); } } }
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace Forum3 { public class Program { public static void Main(string[] args) => BuildWebHost(args).Run(); public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .Build(); } }
unlicense
C#
c969730b055ac09e622981aa6f3faaf4d7ceca7e
Optimize WaitForExitAsync
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Extensions/ProcessExtensions.cs
WalletWasabi/Extensions/ProcessExtensions.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Threading; using System.Threading.Tasks; namespace System.Diagnostics { public static class ProcessExtensions { public static async Task WaitForExitAsync(this Process process, CancellationToken cancellationToken) { while (!process.HasExited) { await Task.Delay(100, cancellationToken); } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Threading; using System.Threading.Tasks; namespace System.Diagnostics { public static class ProcessExtensions { public static async Task WaitForExitAsync(this Process process, CancellationToken cancellationToken) { while (!cancellationToken.IsCancellationRequested) { await Task.Delay(500, cancellationToken); if (process.HasExited) break; } } } }
mit
C#
1b90b65283140a6f071add8b4ce23b988d940313
revert designer back to HtmlGenericControl
Pathfinder-Fr/YAFNET,YAFNET/YAFNET,YAFNET/YAFNET,YAFNET/YAFNET,Pathfinder-Fr/YAFNET,YAFNET/YAFNET,moorehojer/YAFNET,moorehojer/YAFNET,mexxanit/YAFNET,Pathfinder-Fr/YAFNET,mexxanit/YAFNET,mexxanit/YAFNET,moorehojer/YAFNET
yafsrc/pages/forum.ascx.designer.cs
yafsrc/pages/forum.ascx.designer.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.91 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace YAF.Pages { public partial class forum { protected YAF.Controls.PageLinks PageLinks; protected System.Web.UI.HtmlControls.HtmlGenericControl Welcome; protected System.Web.UI.WebControls.Label TimeNow; protected System.Web.UI.WebControls.Label TimeLastVisit; protected System.Web.UI.WebControls.HyperLink UnreadMsgs; protected System.Web.UI.WebControls.Repeater CategoryList; protected System.Web.UI.WebControls.ImageButton expandInformation; protected System.Web.UI.HtmlControls.HtmlGenericControl InformationTBody; protected System.Web.UI.WebControls.Label activeinfo; protected System.Web.UI.WebControls.Repeater ActiveList; protected System.Web.UI.WebControls.Label Stats; protected System.Web.UI.WebControls.ImageButton expandActiveDiscussions; protected System.Web.UI.HtmlControls.HtmlGenericControl ActiveDiscussionTBody; protected System.Web.UI.WebControls.Repeater LatestPosts; protected System.Web.UI.WebControls.LinkButton MarkAll; protected YAF.Classes.UI.SmartScroller SmartScroller1; } }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.91 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace YAF.Pages { public partial class forum { protected YAF.Controls.PageLinks PageLinks; protected System.Web.UI.HtmlControls.HtmlGenericControl Welcome; protected System.Web.UI.WebControls.Label TimeNow; protected System.Web.UI.WebControls.Label TimeLastVisit; protected System.Web.UI.WebControls.HyperLink UnreadMsgs; protected System.Web.UI.WebControls.Repeater CategoryList; protected System.Web.UI.WebControls.ImageButton expandInformation; protected System.Web.UI.HtmlControls.HtmlTableBodySection InformationTBody; protected System.Web.UI.WebControls.Label activeinfo; protected System.Web.UI.WebControls.Repeater ActiveList; protected System.Web.UI.WebControls.Label Stats; protected System.Web.UI.WebControls.ImageButton expandActiveDiscussions; protected System.Web.UI.HtmlControls.HtmlTableBodySection ActiveDiscussionTBody; protected System.Web.UI.WebControls.Repeater LatestPosts; protected System.Web.UI.WebControls.LinkButton MarkAll; protected YAF.Classes.UI.SmartScroller SmartScroller1; } }
apache-2.0
C#
08f411aa6c32e95b66be4183b5a8e7a61bd11fa8
Fix to generating zero-length sections
Jjagg/NewWave,andrewsarnold/NewWave
NewWave.Test/GeneratorTests/ParameterizedGeneratorTests.cs
NewWave.Test/GeneratorTests/ParameterizedGeneratorTests.cs
using System; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using NewWave.Core; using NewWave.Generator; using NewWave.Generator.Parameters; using NewWave.Generator.Sections; namespace NewWave.Test.GeneratorTests { [TestClass] public class ParameterizedGenerators { [TestMethod] public void Default() { RenderAndPlay(new ParameterListBase()); } [TestMethod] public void MinorFastSong() { var parameters = new ParameterListBase() .Apply(new MinorKeyParameterList()) .Apply(new TempoParameter(200, 10)) .Apply(new SongLengthParameter(180, 30)) .Apply(new SectionLengthParameter(LongSections, FewRepeats)); RenderAndPlay(parameters); } private static Func<SectionType, int> LongSections { get { return type => type == SectionType.Verse || type == SectionType.Chorus ? 16 : 8; } } private static Func<SectionType, int> ShortSections { get { return type => type == SectionType.Verse ? 1 : 2; } } private static Func<SectionType, int, int> FewRepeats { get { return (type, length) => GetRepeats(length, type, 1); } } private static Func<SectionType, int, int> ManyRepeats { get { return (type, length) => GetRepeats(length, type, 4); } } private static int GetRepeats(int length, SectionType type, int baseLength) { var multiplier = length < 2 ? 2 : 1; var returnVal = baseLength; switch (type) { case SectionType.Verse: case SectionType.Chorus: returnVal = Randomizer.ProbabilityOfTrue(0.5) ? baseLength * 2 : baseLength; break; case SectionType.Intro: case SectionType.Outro: case SectionType.Prechorus: returnVal = baseLength / 2; break; case SectionType.Bridge: returnVal = Randomizer.ProbabilityOfTrue(0.5) ? baseLength : baseLength / 2; break; } return Math.Max(1, multiplier * returnVal); } [TestMethod] public void SlowSong() { RenderAndPlay(new ParameterListBase() .Apply(new TempoParameter(100, 5))); } private static void RenderAndPlay(IParameterList parameterList) { var song = new GeneratedSong(); Common.RenderAndPlay(parameterList, song, "output.mid"); foreach (var section in song.Sections) { Console.WriteLine("{0}: {1} meas, {2}", section.Type, section.Measures, string.Join(" - ", section.Chords.Select(c => c.Item2))); } } } }
using System; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using NewWave.Core; using NewWave.Generator; using NewWave.Generator.Parameters; using NewWave.Generator.Sections; namespace NewWave.Test.GeneratorTests { [TestClass] public class ParameterizedGenerators { [TestMethod] public void Default() { RenderAndPlay(new ParameterListBase()); } [TestMethod] public void MinorFastSong() { var parameters = new ParameterListBase() .Apply(new MinorKeyParameterList()) .Apply(new TempoParameter(200, 10)) .Apply(new SongLengthParameter(180, 30)) .Apply(new SectionLengthParameter(LongSections, FewRepeats)); RenderAndPlay(parameters); } private static Func<SectionType, int> LongSections { get { return type => type == SectionType.Verse || type == SectionType.Chorus ? 16 : 8; } } private static Func<SectionType, int> ShortSections { get { return type => type == SectionType.Verse ? 1 : 2; } } private static Func<SectionType, int, int> FewRepeats { get { return (type, length) => GetRepeats(length, type, 1); } } private static Func<SectionType, int, int> ManyRepeats { get { return (type, length) => GetRepeats(length, type, 4); } } private static int GetRepeats(int length, SectionType type, int baseLength) { var multiplier = length < 2 ? 2 : 1; var returnVal = baseLength; switch (type) { case SectionType.Verse: case SectionType.Chorus: returnVal = Randomizer.ProbabilityOfTrue(0.5) ? baseLength * 2 : baseLength; break; case SectionType.Intro: case SectionType.Outro: case SectionType.Prechorus: returnVal = baseLength / 2; break; case SectionType.Bridge: returnVal = Randomizer.ProbabilityOfTrue(0.5) ? baseLength : baseLength / 2; break; } return multiplier * returnVal; } [TestMethod] public void SlowSong() { RenderAndPlay(new ParameterListBase() .Apply(new TempoParameter(100, 5))); } private static void RenderAndPlay(IParameterList parameterList) { var song = new GeneratedSong(); Common.RenderAndPlay(parameterList, song, "output.mid"); foreach (var section in song.Sections) { Console.WriteLine("{0}: {1} meas, {2}", section.Type, section.Measures, string.Join(" - ", section.Chords.Select(c => c.Item2))); } } } }
mit
C#
a9ea9f8f5ea006efc07bf976171e8e66d605cfb7
Fix saving facility level to the scenario file. Closes #150
gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer
Server/System/Scenario/ScenarioFacilityLevelDataUpdater.cs
Server/System/Scenario/ScenarioFacilityLevelDataUpdater.cs
using LunaCommon.Xml; using Server.Utilities; using System.Globalization; using System.Threading.Tasks; using System.Xml; namespace Server.System.Scenario { public partial class ScenarioDataUpdater { /// <summary> /// We received a facility upgrade message so update the scenario file accordingly /// </summary> public static void WriteFacilityLevelDataToFile(string facilityId, int level) { Task.Run(() => { lock (Semaphore.GetOrAdd("ScenarioUpgradeableFacilities", new object())) { if (!ScenarioStoreSystem.CurrentScenariosInXmlFormat.TryGetValue("ScenarioUpgradeableFacilities", out var xmlData)) return; var updatedText = UpdateScenarioWithLevelData(xmlData, facilityId, level); ScenarioStoreSystem.CurrentScenariosInXmlFormat.TryUpdate("ScenarioUpgradeableFacilities", updatedText, xmlData); } }); } /// <summary> /// Patches the scenario file with facility level data /// </summary> private static string UpdateScenarioWithLevelData(string scenarioData, string facilityId, int level) { var document = new XmlDocument(); document.LoadXml(scenarioData); var node = document.SelectSingleNode($"/{ConfigNodeXmlParser.StartElement}/" + $"{ConfigNodeXmlParser.ParentNode}[@name='{facilityId}']/" + $"{ConfigNodeXmlParser.ValueNode}[@name='lvl']"); //Valid levels in the scenario file are 0, 0.5 and 1. So for this we divide the arrived level by 2 if (node != null) node.InnerText = (level/2f).ToString(CultureInfo.InvariantCulture); return document.ToIndentedString(); } } }
using LunaCommon.Xml; using Server.Utilities; using System.Globalization; using System.Threading.Tasks; using System.Xml; namespace Server.System.Scenario { public partial class ScenarioDataUpdater { /// <summary> /// We received a facility upgrade message so update the scenario file accordingly /// </summary> public static void WriteFacilityLevelDataToFile(string facilityId, int level) { Task.Run(() => { lock (Semaphore.GetOrAdd("ScenarioUpgradeableFacilities", new object())) { if (!ScenarioStoreSystem.CurrentScenariosInXmlFormat.TryGetValue("ScenarioUpgradeableFacilities", out var xmlData)) return; var updatedText = UpdateScenarioWithLevelData(xmlData, facilityId, level); ScenarioStoreSystem.CurrentScenariosInXmlFormat.TryUpdate("ScenarioUpgradeableFacilities", updatedText, xmlData); } }); } /// <summary> /// Patches the scenario file with facility level data /// </summary> private static string UpdateScenarioWithLevelData(string scenarioData, string facilityId, int level) { var document = new XmlDocument(); document.LoadXml(scenarioData); var node = document.SelectSingleNode($"/{ConfigNodeXmlParser.StartElement}/" + $"{ConfigNodeXmlParser.ParentNode}[@name='{facilityId}']/" + $"{ConfigNodeXmlParser.ValueNode}[@name='lvl']"); if (node != null) node.InnerText = level.ToString(CultureInfo.InvariantCulture); return document.ToIndentedString(); } } }
mit
C#