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
69114c45fbb6471710a106967ceeeb2cfefc5c76
Remove empty line
henrikfroehling/TraktApiSharp
Source/Lib/TraktApiSharp/Objects/Post/Comments/ITraktCommentReplyPost.cs
Source/Lib/TraktApiSharp/Objects/Post/Comments/ITraktCommentReplyPost.cs
namespace TraktApiSharp.Objects.Post.Comments { public interface ITraktCommentReplyPost : ITraktCommentUpdatePost { } }
namespace TraktApiSharp.Objects.Post.Comments { public interface ITraktCommentReplyPost : ITraktCommentUpdatePost { } }
mit
C#
108701c8d51088795a537e007a3e8dab1b2965eb
Update ExchangeRateRepository.cs
tiksn/TIKSN-Framework
TIKSN.Core/Finance/ForeignExchange/Data/LiteDB/ExchangeRateRepository.cs
TIKSN.Core/Finance/ForeignExchange/Data/LiteDB/ExchangeRateRepository.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using LiteDB; using TIKSN.Data.LiteDB; namespace TIKSN.Finance.ForeignExchange.Data.LiteDB { public class ExchangeRateRepository : LiteDbRepository<ExchangeRateEntity, Guid>, IExchangeRateRepository { public ExchangeRateRepository(ILiteDbDatabaseProvider databaseProvider) : base(databaseProvider, "ExchangeRates", x => new BsonValue(x)) { } public Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync( Guid foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTime dateFrom, DateTime dateTo, CancellationToken cancellationToken) { var results = this.collection.Find(x => x.ForeignExchangeID == foreignExchangeID && x.BaseCurrencyCode == baseCurrencyCode && x.CounterCurrencyCode == counterCurrencyCode && x.AsOn >= dateFrom && x.AsOn <= dateTo); return Task.FromResult<IReadOnlyCollection<ExchangeRateEntity>>(results.ToArray()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using LiteDB; using TIKSN.Data.LiteDB; namespace TIKSN.Finance.ForeignExchange.Data.LiteDB { public class ExchangeRateRepository : LiteDbRepository<ExchangeRateEntity, Guid>, IExchangeRateRepository { public ExchangeRateRepository(ILiteDbDatabaseProvider databaseProvider) : base(databaseProvider, "ExchangeRates", x => new BsonValue(x)) { } public Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync( Guid foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset dateFrom, DateTimeOffset dateTo, CancellationToken cancellationToken) { var results = this.collection.Find(x => x.ForeignExchangeID == foreignExchangeID && x.BaseCurrencyCode == baseCurrencyCode && x.CounterCurrencyCode == counterCurrencyCode && x.AsOn >= dateFrom && x.AsOn <= dateTo); return Task.FromResult<IReadOnlyCollection<ExchangeRateEntity>>(results.ToArray()); } } }
mit
C#
91e43c172225427bb56cddfc8ea23d5e3d8e0406
Update ExchangeRateRepository.cs
tiksn/TIKSN-Framework
TIKSN.Core/Finance/ForeignExchange/Data/LiteDB/ExchangeRateRepository.cs
TIKSN.Core/Finance/ForeignExchange/Data/LiteDB/ExchangeRateRepository.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using LiteDB; using TIKSN.Data.LiteDB; namespace TIKSN.Finance.ForeignExchange.Data.LiteDB { public class ExchangeRateRepository : LiteDbRepository<ExchangeRateEntity, int>, IExchangeRateRepository { public ExchangeRateRepository(ILiteDbDatabaseProvider databaseProvider) : base(databaseProvider, "ExchangeRates", x => new BsonValue(x)) { } public Task<int> GetMaximalIdAsync(CancellationToken cancellationToken) { if (this.collection.Count() == 0) { return Task.FromResult(0); } var maxValue = this.collection.Max(x => x.ID); return Task.FromResult(maxValue); } public Task<ExchangeRateEntity> GetOrDefaultAsync(int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset asOn, CancellationToken cancellationToken) { var result = this.collection.FindOne(x => x.ForeignExchangeID == foreignExchangeID && x.BaseCurrencyCode == baseCurrencyCode && x.CounterCurrencyCode == counterCurrencyCode && x.AsOn == asOn); return Task.FromResult(result); } public Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync(int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset dateFrom, DateTimeOffset dateTo, CancellationToken cancellationToken) { var results = this.collection.Find(x => x.ForeignExchangeID == foreignExchangeID && x.BaseCurrencyCode == baseCurrencyCode && x.CounterCurrencyCode == counterCurrencyCode && x.AsOn >= dateFrom && x.AsOn <= dateTo); return Task.FromResult<IReadOnlyCollection<ExchangeRateEntity>>(results.ToArray()); } } }
using LiteDB; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using TIKSN.Data.LiteDB; namespace TIKSN.Finance.ForeignExchange.Data.LiteDB { public class ExchangeRateRepository : LiteDbRepository<ExchangeRateEntity, int>, IExchangeRateRepository { public ExchangeRateRepository(ILiteDbDatabaseProvider databaseProvider) : base(databaseProvider, "ExchangeRates", x => new BsonValue(x)) { } public Task<int> GetMaximalIdAsync(CancellationToken cancellationToken) { if (collection.Count() == 0) { return Task.FromResult(0); } var maxValue = collection.Max(x => x.ID); return Task.FromResult(maxValue); } public Task<ExchangeRateEntity> GetOrDefaultAsync(int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset asOn, CancellationToken cancellationToken) { var result = collection.FindOne(x => x.ForeignExchangeID == foreignExchangeID && x.BaseCurrencyCode == baseCurrencyCode && x.CounterCurrencyCode == counterCurrencyCode && x.AsOn == asOn); return Task.FromResult(result); } public Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync(int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset dateFrom, DateTimeOffset dateTo, CancellationToken cancellationToken) { var results = collection.Find(x => x.ForeignExchangeID == foreignExchangeID && x.BaseCurrencyCode == baseCurrencyCode && x.CounterCurrencyCode == counterCurrencyCode && x.AsOn >= dateFrom && x.AsOn <= dateTo); return Task.FromResult<IReadOnlyCollection<ExchangeRateEntity>>(results.ToArray()); } } }
mit
C#
9937a26694132bac63fc49735a97749df8e59bed
Add force solve handler to Simon Says
CaitSith2/KtaneTwitchPlays,samfun123/KtaneTwitchPlays
TwitchPlaysAssembly/Src/ComponentSolvers/Vanilla/SimonComponentSolver.cs
TwitchPlaysAssembly/Src/ComponentSolvers/Vanilla/SimonComponentSolver.cs
using System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; public class SimonComponentSolver : ComponentSolver { public SimonComponentSolver(BombCommander bombCommander, SimonComponent bombComponent) : base(bombCommander, bombComponent) { _buttons = bombComponent.buttons; modInfo = ComponentSolverFactory.GetModuleInfo("SimonComponentSolver", "!{0} press red green blue yellow, !{0} press rgby [press a sequence of colours] | You must include the input from any previous stages"); } protected override IEnumerator RespondToCommandInternal(string inputCommand) { if (!inputCommand.StartsWith("press ", StringComparison.InvariantCultureIgnoreCase)) { yield break; } inputCommand = inputCommand.Substring(6); string sequence = "pressing "; foreach (Match move in Regex.Matches(inputCommand, @"(\b(red|blue|green|yellow)\b|[rbgy])", RegexOptions.IgnoreCase)) { SimonButton button = _buttons[buttonIndex[move.Value.Substring(0, 1).ToLowerInvariant()]]; if (button != null) { yield return move.Value; sequence += move.Value + " "; if (CoroutineCanceller.ShouldCancel) { CoroutineCanceller.ResetCancel(); yield break; } yield return DoInteractionClick(button, sequence); } } } protected override IEnumerator ForcedSolveIEnumerator() { yield return null; while (!BombComponent.IsActive) yield return true; while (!BombComponent.IsSolved) { int index = ((SimonComponent) BombComponent).GetNextIndexToPress(); yield return DoInteractionClick(_buttons[index]); } } private static readonly Dictionary<string, int> buttonIndex = new Dictionary<string, int> { {"r", 0}, {"b", 1}, {"g", 2}, {"y", 3} }; private SimonButton[] _buttons = null; }
using System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; public class SimonComponentSolver : ComponentSolver { public SimonComponentSolver(BombCommander bombCommander, SimonComponent bombComponent) : base(bombCommander, bombComponent) { _buttons = bombComponent.buttons; modInfo = ComponentSolverFactory.GetModuleInfo("SimonComponentSolver", "!{0} press red green blue yellow, !{0} press rgby [press a sequence of colours] | You must include the input from any previous stages"); } protected override IEnumerator RespondToCommandInternal(string inputCommand) { if (!inputCommand.StartsWith("press ", StringComparison.InvariantCultureIgnoreCase)) { yield break; } inputCommand = inputCommand.Substring(6); string sequence = "pressing "; foreach (Match move in Regex.Matches(inputCommand, @"(\b(red|blue|green|yellow)\b|[rbgy])", RegexOptions.IgnoreCase)) { SimonButton button = _buttons[buttonIndex[move.Value.Substring(0, 1).ToLowerInvariant()]]; if (button != null) { yield return move.Value; sequence += move.Value + " "; if (CoroutineCanceller.ShouldCancel) { CoroutineCanceller.ResetCancel(); yield break; } yield return DoInteractionClick(button, sequence); } } } private static readonly Dictionary<string, int> buttonIndex = new Dictionary<string, int> { {"r", 0}, {"b", 1}, {"g", 2}, {"y", 3} }; private SimonButton[] _buttons = null; }
mit
C#
1b9ab2494053921faeb9d71d6a4eb0165fccbfc5
remove redundant using
config-r/config-r
tests/ConfigR.Tests.Acceptance.Roslyn.CSharp/DefaultValuesFeature.cs
tests/ConfigR.Tests.Acceptance.Roslyn.CSharp/DefaultValuesFeature.cs
// <copyright file="DefaultValuesFeature.cs" company="ConfigR contributors"> // Copyright (c) ConfigR contributors. (configr.net@gmail.com) // </copyright> namespace ConfigR.Tests.Acceptance { using ConfigR.Tests.Acceptance.Roslyn.CSharp.Support; using FluentAssertions; using Xbehave; public static class DefaultValuesFeature { [Scenario] public static void GettingAnExistingItem(int result) { dynamic config = null; "Given a config file with a Foo of 123" .f(c => ConfigFile.Create("Config.Foo = 123;").Using(c)); "When I load the file" .f(async () => config = await new Config().UseRoslynCSharpLoader().Load()); "And I get Foo with a default of 456" .f(() => result = config.Foo<int>(456)); "Then the result is 123" .f(() => result.Should().Be(123)); } [Scenario] public static void GettingANonexistentItem(int result) { dynamic config = null; "Given a config file with a Foo of 123" .f(c => ConfigFile.Create("Config.Foo = 123;").Using(c)); "When I load the file" .f(async () => config = await new Config().UseRoslynCSharpLoader().Load()); "And I get Bar with a default of 456" .f(() => result = config.Bar<int>(456)); "Then the result is 456" .f(() => result.Should().Be(456)); } } }
// <copyright file="DefaultValuesFeature.cs" company="ConfigR contributors"> // Copyright (c) ConfigR contributors. (configr.net@gmail.com) // </copyright> namespace ConfigR.Tests.Acceptance { using System.IO; using ConfigR.Tests.Acceptance.Roslyn.CSharp.Support; using FluentAssertions; using Xbehave; public static class DefaultValuesFeature { [Scenario] public static void GettingAnExistingItem(int result) { dynamic config = null; "Given a config file with a Foo of 123" .f(c => ConfigFile.Create("Config.Foo = 123;").Using(c)); "When I load the file" .f(async () => config = await new Config().UseRoslynCSharpLoader().Load()); "And I get Foo with a default of 456" .f(() => result = config.Foo<int>(456)); "Then the result is 123" .f(() => result.Should().Be(123)); } [Scenario] public static void GettingANonexistentItem(int result) { dynamic config = null; "Given a config file with a Foo of 123" .f(c => ConfigFile.Create("Config.Foo = 123;").Using(c)); "When I load the file" .f(async () => config = await new Config().UseRoslynCSharpLoader().Load()); "And I get Bar with a default of 456" .f(() => result = config.Bar<int>(456)); "Then the result is 456" .f(() => result.Should().Be(456)); } } }
mit
C#
9c387495af2acf41e8f72b53a8e7d16f413635df
add option for client generated ids
Research-Institute/json-api-dotnet-core,Research-Institute/json-api-dotnet-core,json-api-dotnet/JsonApiDotNetCore
src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs
src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs
namespace JsonApiDotNetCore.Configuration { public class JsonApiOptions { public string Namespace { get; set; } public int DefaultPageSize { get; set; } public bool IncludeTotalRecordCount { get; set; } public bool AllowClientGeneratedIds { get; set; } } }
namespace JsonApiDotNetCore.Configuration { public class JsonApiOptions { public string Namespace { get; set; } public int DefaultPageSize { get; set; } public bool IncludeTotalRecordCount { get; set; } } }
mit
C#
98b7bc426cd34a6a2b90d65ca8d2ce7118e1fa2e
update version
Fody/Equals
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Foody.Equals")] [assembly: AssemblyProduct("Foody.Equals")] [assembly: AssemblyVersion("1.2.1.0")] [assembly: AssemblyFileVersion("1.2.1.0")]
using System.Reflection; [assembly: AssemblyTitle("Foody.Equals")] [assembly: AssemblyProduct("Foody.Equals")] [assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
mit
C#
2d29f3d80c105ea8e21af38961a87f87bff82063
Update ValidationAttribute.cs
WebApiContrib/WebAPIContrib.Core,WebApiContrib/WebAPIContrib.Core
src/WebApiContrib.Core/Filters/ValidationAttribute.cs
src/WebApiContrib.Core/Filters/ValidationAttribute.cs
using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using System.Collections.Generic; namespace WebApiContrib.Core.Filters { public class ValidationAttribute : ActionFilterAttribute { public bool AllowNull { get; set; } public override void OnActionExecuting(ActionExecutingContext actionContext) { if (!AllowNull) { var nullArguments = actionContext.ActionArguments .Where(arg => arg.Value == null) .Select(arg => new Error { Name = arg.Key, Message = "Value cannot be null." }).ToArray(); if (nullArguments.Any()) { actionContext.Result = new BadRequestObjectResult(nullArguments); return; } } if (!actionContext.ModelState.IsValid) { var errors = actionContext.ModelState .Where(e => e.Value.Errors.Count > 0) .Select(e => new Error { Name = e.Key, Message = e.Value.Errors.First().ErrorMessage }).ToArray(); actionContext.Result = new BadRequestObjectResult(errors); } } private class Error { public string Name { get; set; } public string Message { get; set; } } } }
using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using System.Collections.Generic; namespace WebApiContrib.Core.Filters { public class ValidationAttribute : ActionFilterAttribute { public bool AllowNull { get; } public override void OnActionExecuting(ActionExecutingContext actionContext) { if (!AllowNull) { var nullArguments = actionContext.ActionArguments .Where(arg => arg.Value == null) .Select(arg => new Error { Name = arg.Key, Message = "Value cannot be null." }).ToArray(); if (nullArguments.Any()) { actionContext.Result = new BadRequestObjectResult(nullArguments); return; } } if (!actionContext.ModelState.IsValid) { var errors = actionContext.ModelState .Where(e => e.Value.Errors.Count > 0) .Select(e => new Error { Name = e.Key, Message = e.Value.Errors.First().ErrorMessage }).ToArray(); actionContext.Result = new BadRequestObjectResult(errors); } } private class Error { public string Name { get; set; } public string Message { get; set; } } } }
mit
C#
c0d252eec6c41adbc36aa134afff5c2c8d8068c9
Add network behaviour to invoke click over network.
purple-movies/expanse_bundle_lib
OnClickInvoker.cs
OnClickInvoker.cs
using UnityEngine; using UnityEngine.EventSystems; using System.Collections.Generic; using System; using UnityEngine.Events; using UnityEngine.Networking; public class OnClickInvoker : NetworkBehaviour { [Serializable] public class TriggerEvent : UnityEvent<BaseEventData> { } [Serializable] public class Entry { public EventTriggerType eventID = EventTriggerType.PointerClick; public TriggerEvent callback = new TriggerEvent(); } [SerializeField] private List<Entry> m_Delegates; protected OnClickInvoker() { } #region SERVER [Command] void CmdInvokeClickHandler() { RpcInvokeClickHandler(); } #endregion #region CLIENT [ClientRpc] void RpcInvokeClickHandler() { OnPointerDown(null); } #endregion public List<Entry> triggers { get { if (m_Delegates == null) m_Delegates = new List<Entry>(); return m_Delegates; } set { m_Delegates = value; } } public virtual void OnPointerEnter(PointerEventData eventData) { Execute(EventTriggerType.PointerEnter, eventData); } public virtual void OnPointerExit(PointerEventData eventData) { Execute(EventTriggerType.PointerExit, eventData); } public virtual void OnPointerDown(PointerEventData eventData) { Execute(EventTriggerType.PointerDown, eventData); } public virtual void OnPointerUp(PointerEventData eventData) { Execute(EventTriggerType.PointerUp, eventData); } public virtual void OnPointerClick(PointerEventData eventData) { Execute(EventTriggerType.PointerClick, eventData); } void OnMouseDown() { //OnPointerDown(null); CmdInvokeClickHandler(); } private void Execute(EventTriggerType id, BaseEventData eventData) { for (int i = 0, imax = triggers.Count; i < imax; ++i) { var ent = triggers[i]; if (ent.eventID == id && ent.callback != null) ent.callback.Invoke(eventData); } } }
using UnityEngine; using UnityEngine.EventSystems; using System.Collections.Generic; using System; using UnityEngine.Events; public class OnClickInvoker : MonoBehaviour { [Serializable] public class TriggerEvent : UnityEvent<BaseEventData> { } [Serializable] public class Entry { public EventTriggerType eventID = EventTriggerType.PointerClick; public TriggerEvent callback = new TriggerEvent(); } [SerializeField] private List<Entry> m_Delegates; protected OnClickInvoker() { } public List<Entry> triggers { get { if (m_Delegates == null) m_Delegates = new List<Entry>(); return m_Delegates; } set { m_Delegates = value; } } public virtual void OnPointerEnter(PointerEventData eventData) { Execute(EventTriggerType.PointerEnter, eventData); } public virtual void OnPointerExit(PointerEventData eventData) { Execute(EventTriggerType.PointerExit, eventData); } public virtual void OnPointerDown(PointerEventData eventData) { Execute(EventTriggerType.PointerDown, eventData); } public virtual void OnPointerUp(PointerEventData eventData) { Execute(EventTriggerType.PointerUp, eventData); } public virtual void OnPointerClick(PointerEventData eventData) { Execute(EventTriggerType.PointerClick, eventData); } void OnMouseDown() { OnPointerDown(null); } private void Execute(EventTriggerType id, BaseEventData eventData) { for (int i = 0, imax = triggers.Count; i < imax; ++i) { var ent = triggers[i]; if (ent.eventID == id && ent.callback != null) ent.callback.Invoke(eventData); } } }
apache-2.0
C#
344de78256586085f7cda40101e3dc21f6a2ed03
Update CreatePivotChart.cs
aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Articles/CreatePivotTablesPivotCharts/CreatePivotChart.cs
Examples/CSharp/Articles/CreatePivotTablesPivotCharts/CreatePivotChart.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.CreatePivotTablesPivotCharts { public class CreatePivotChart { public static void Main() { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Instantiating an Workbook object //Opening the excel file Workbook workbook = new Workbook(dataDir+ "pivotTable_test.xlsx"); //Adding a new sheet Worksheet sheet3 = workbook.Worksheets[workbook.Worksheets.Add(SheetType.Chart)]; //Naming the sheet sheet3.Name = "PivotChart"; //Adding a column chart int index = sheet3.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 0, 5, 28, 16); //Setting the pivot chart data source sheet3.Charts[index].PivotSource = "PivotTable!PivotTable1"; sheet3.Charts[index].HidePivotFieldButtons = false; //Saving the Excel file workbook.Save(dataDir+ "pivotChart_test.out.xlsx"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.CreatePivotTablesPivotCharts { public class CreatePivotChart { public static void Main() { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Instantiating an Workbook object //Opening the excel file Workbook workbook = new Workbook(dataDir+ "pivotTable_test.xlsx"); //Adding a new sheet Worksheet sheet3 = workbook.Worksheets[workbook.Worksheets.Add(SheetType.Chart)]; //Naming the sheet sheet3.Name = "PivotChart"; //Adding a column chart int index = sheet3.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 0, 5, 28, 16); //Setting the pivot chart data source sheet3.Charts[index].PivotSource = "PivotTable!PivotTable1"; sheet3.Charts[index].HidePivotFieldButtons = false; //Saving the Excel file workbook.Save(dataDir+ "pivotChart_test.out.xlsx"); } } }
mit
C#
cb9a7776068645f55c97045345ccb7bf3aca7013
Add LocationCompleter to SiteRecovery cmdlets
ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell
src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Vault/NewAzureSiteRecoveryVault.cs
src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Vault/NewAzureSiteRecoveryVault.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.SiteRecoveryVault.Models; using System.Management.Automation; namespace Microsoft.Azure.Commands.SiteRecovery { /// <summary> /// Used to initiate a vault create operation. /// </summary> [Cmdlet(VerbsCommon.New, "AzureRmSiteRecoveryVault")] public class CreateAzureSiteRecoveryVault : SiteRecoveryCmdletBase { #region Parameters /// <summary> /// Gets or sets the vault name /// </summary> [Parameter(Mandatory = true)] [ValidateNotNullOrEmpty] public string Name { get; set; } /// <summary> /// Gets or sets the resource group name /// </summary> [Parameter(Mandatory = true)] [ResourceGroupCompleter] [ValidateNotNullOrEmpty] public string ResourceGroupName { get; set; } /// <summary> /// Gets or sets the location of the vault /// </summary> [Parameter(Mandatory = true)] [LocationCompleter("Microsoft.SiteRecovery/SiteRecoveryVault")] [ValidateNotNullOrEmpty] public string Location { get; set; } #endregion /// <summary> /// ProcessRecord of the command. /// </summary> public override void ExecuteSiteRecoveryCmdlet() { base.ExecuteSiteRecoveryCmdlet(); this.WriteWarningWithTimestamp( string.Format( Properties.Resources.SiteRecoveryVaultTypeWillBeDeprecatedSoon)); VaultCreateArgs vaultCreateArgs = new VaultCreateArgs(); vaultCreateArgs.Location = this.Location; vaultCreateArgs.Properties = new VaultProperties(); vaultCreateArgs.Properties.Sku = new VaultSku(); vaultCreateArgs.Properties.Sku.Name = "standard"; VaultCreateResponse response = RecoveryServicesClient.CreateVault(this.ResourceGroupName, this.Name, vaultCreateArgs); this.WriteObject(new ASRVault(response)); } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.SiteRecoveryVault.Models; using System.Management.Automation; namespace Microsoft.Azure.Commands.SiteRecovery { /// <summary> /// Used to initiate a vault create operation. /// </summary> [Cmdlet(VerbsCommon.New, "AzureRmSiteRecoveryVault")] public class CreateAzureSiteRecoveryVault : SiteRecoveryCmdletBase { #region Parameters /// <summary> /// Gets or sets the vault name /// </summary> [Parameter(Mandatory = true)] [ValidateNotNullOrEmpty] public string Name { get; set; } /// <summary> /// Gets or sets the resource group name /// </summary> [Parameter(Mandatory = true)] [ResourceGroupCompleter] [ValidateNotNullOrEmpty] public string ResourceGroupName { get; set; } /// <summary> /// Gets or sets the location of the vault /// </summary> [Parameter(Mandatory = true)] [ValidateNotNullOrEmpty] public string Location { get; set; } #endregion /// <summary> /// ProcessRecord of the command. /// </summary> public override void ExecuteSiteRecoveryCmdlet() { base.ExecuteSiteRecoveryCmdlet(); this.WriteWarningWithTimestamp( string.Format( Properties.Resources.SiteRecoveryVaultTypeWillBeDeprecatedSoon)); VaultCreateArgs vaultCreateArgs = new VaultCreateArgs(); vaultCreateArgs.Location = this.Location; vaultCreateArgs.Properties = new VaultProperties(); vaultCreateArgs.Properties.Sku = new VaultSku(); vaultCreateArgs.Properties.Sku.Name = "standard"; VaultCreateResponse response = RecoveryServicesClient.CreateVault(this.ResourceGroupName, this.Name, vaultCreateArgs); this.WriteObject(new ASRVault(response)); } } }
apache-2.0
C#
344b37fc27c39117eed9a8764393090695604788
Update error message for net standard/UAP. (#3409)
AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet
src/client/Microsoft.Identity.Client/Platforms/netstandard13/NetStandard13WebUIFactory.cs
src/client/Microsoft.Identity.Client/Platforms/netstandard13/NetStandard13WebUIFactory.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using Microsoft.Identity.Client.ApiConfig.Parameters; using Microsoft.Identity.Client.Internal; using Microsoft.Identity.Client.PlatformsCommon.Shared; using Microsoft.Identity.Client.UI; namespace Microsoft.Identity.Client.Platforms.netstandard13 { internal class NetStandard13WebUiFactory : IWebUIFactory { public bool IsSystemWebViewAvailable => false; public bool IsUserInteractive => DesktopOsHelper.IsUserInteractive(); public bool IsEmbeddedWebViewAvailable => false; public IWebUI CreateAuthenticationDialog(CoreUIParent coreUIParent, WebViewPreference webViewPreference, RequestContext requestContext) { throw new PlatformNotSupportedException( "Possible cause: If you are using an XForms app, or generally a .NET Standard assembly, " + "make sure you add a reference to Microsoft.Identity.Client.dll from each platform assembly " + "(e.g. UWP, Android, iOS), not just from the common .NET Standard assembly. " + "A browser is not available in the box on .NET Standard 2.0." + "If you are on UWP, you may need to update to version 1809 (Build 17763) in order to use a browser."); } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using Microsoft.Identity.Client.ApiConfig.Parameters; using Microsoft.Identity.Client.Internal; using Microsoft.Identity.Client.PlatformsCommon.Shared; using Microsoft.Identity.Client.UI; namespace Microsoft.Identity.Client.Platforms.netstandard13 { internal class NetStandard13WebUiFactory : IWebUIFactory { public bool IsSystemWebViewAvailable => false; public bool IsUserInteractive => DesktopOsHelper.IsUserInteractive(); public bool IsEmbeddedWebViewAvailable => false; public IWebUI CreateAuthenticationDialog(CoreUIParent coreUIParent, WebViewPreference webViewPreference, RequestContext requestContext) { throw new PlatformNotSupportedException( "Possible cause: If you are using an XForms app, or generally a .NET Standard assembly, " + "make sure you add a reference to Microsoft.Identity.Client.dll from each platform assembly " + "(e.g. UWP, Android, iOS), not just from the common .NET Standard assembly. " + "A browser is not available in the box on .NET Standard 1.3."); } } }
mit
C#
1528bad16d973dbb8010db6d9dbd35f21dca3d3c
Add test for ReadTableOfContentsRequestProcessor.
Milyli/DocMAH,Milyli/DocMAH,Milyli/DocMAH
DocMAH.UnitTests/Web/Requests/Processors/ReadTableOfContentsRequestProcessorTestFixture.cs
DocMAH.UnitTests/Web/Requests/Processors/ReadTableOfContentsRequestProcessorTestFixture.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using DocMAH.Data; using DocMAH.Models; using DocMAH.Web.Authorization; using DocMAH.Web.Requests; using DocMAH.Web.Requests.Processors; using NUnit.Framework; namespace DocMAH.UnitTests.Web.Requests.Processors { [TestFixture] public class ReadTableOfContentsRequestProcessorTestFixture : BaseTestFixture { #region Tests [Test] [Description("Returns the table of contents for all help pages.")] public void Process_Success() { // Arrange var isAuthorized = true; var editAuthorizer = Mocks.Create<IEditAuthorizer>(); editAuthorizer.Setup(a => a.Authorize()).Returns(isAuthorized); var pageRepository = Mocks.Create<IPageRepository>(); pageRepository.Setup(r => r.ReadTableOfContents(isAuthorized)).Returns(new List<Page>()); var processor = new ReadTableOfContentsRequestProcessor(editAuthorizer.Object, pageRepository.Object); // Act var result = processor.Process(null); // Assert Assert.That(result, Is.Not.Null, "A valid ResponseState should be returned."); Assert.That(result.ContentType, Is.EqualTo(ContentTypes.Json), "The response should contain JSON"); Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK), "The request should succeed."); } #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; namespace DocMAH.UnitTests.Web.Requests.Processors { [TestFixture] public class ReadTableOfContentsRequestProcessorTestFixture { #region Tests [Test] [Description("Returns the table of contents for all help pages.")] public void Process_Success() { // Arrange throw new NotImplementedException(); // Act // Assert } #endregion } }
mit
C#
b460bc7726b7ad630b3c1400e39888f2ebc925d9
allow running [MenuItem] method with return value (#1943)
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/resharper-unity/src/CSharp/Rider/Host/Features/RunMarkers/UnityRunMarkerUtil.cs
resharper/resharper-unity/src/CSharp/Rider/Host/Features/RunMarkers/UnityRunMarkerUtil.cs
using System.Linq; using JetBrains.Annotations; using JetBrains.ReSharper.Psi; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Rider.Host.Features.RunMarkers { public static class UnityRunMarkerUtil { [Pure] public static bool IsSuitableStaticMethod([NotNull] IMethod method) { if (!method.IsStatic || method.TypeParameters.Count != 0) return false; if (!method.Parameters.IsEmpty()) return false; if (method.GetAttributeInstances(false).All(a => a.GetClrName().FullName != "UnityEditor.MenuItem")) return false; var parentClass = method.GetContainingType(); if (parentClass == null) return false; var parentClassOwner = parentClass.GetContainingType(); return parentClassOwner == null || !parentClassOwner.IsClassLike(); } } }
using System.Linq; using JetBrains.Annotations; using JetBrains.ReSharper.Psi; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Rider.Host.Features.RunMarkers { public static class UnityRunMarkerUtil { [Pure] public static bool IsSuitableStaticMethod([NotNull] IMethod method) { if (!method.IsStatic || method.TypeParameters.Count != 0) return false; if (!method.Parameters.IsEmpty()) return false; if (method.GetAttributeInstances(false).All(a => a.GetClrName().FullName != "UnityEditor.MenuItem")) return false; if (!method.ReturnType.IsVoid()) return false; var parentClass = method.GetContainingType(); if (parentClass == null) return false; var parentClassOwner = parentClass.GetContainingType(); return parentClassOwner == null || !parentClassOwner.IsClassLike(); } } }
apache-2.0
C#
dee593b39fbda588880cbc19510bce1e21d45b7d
Remove useless symbols
PKI-InVivo/reactive-domain
src/ReactiveDomain.Foundation.Tests/PrefixedCamelCaseStreamNameBuilderTests.cs
src/ReactiveDomain.Foundation.Tests/PrefixedCamelCaseStreamNameBuilderTests.cs
using ReactiveDomain.Foundation.Testing; using System; using Xunit; namespace ReactiveDomain.Foundation.Tests { [Collection(nameof(EventStoreCollection))] public class PrefixedCamelCaseStreamNameBuilderTests { [Fact] public void ThrowsOnNonExplicitNullOrEmptyPrefix() { Assert.Throws<ArgumentException>(() => new PrefixedCamelCaseStreamNameBuilder(string.Empty)); Assert.Throws<ArgumentException>(() => new PrefixedCamelCaseStreamNameBuilder(" ")); Assert.Throws<ArgumentException>(() => new PrefixedCamelCaseStreamNameBuilder(null)); } [Fact] public void CanGeneratePrefixedCamelCaseStreamNameForAggregate() { var aggregareId = Guid.Parse("96370d8277ae4ccab626091775ed01bb"); var prefix = "UnitTest"; var streamNamebuilder = new PrefixedCamelCaseStreamNameBuilder(prefix); var streamName = streamNamebuilder.GenerateForAggregate(typeof(TestAggregate), aggregareId); Assert.Equal("unittest.testAggregate-96370d8277ae4ccab626091775ed01bb", streamName); } [Fact] public void CanGenerateStreamNameForCategory() { var streamNamebuilder = new PrefixedCamelCaseStreamNameBuilder(); var streamName = streamNamebuilder.GenerateForCategory(typeof(TestAggregate)); Assert.Equal("$ce-testAggregate", streamName); } [Fact] public void CanGenerateStreamNameForEventType() { var streamNamebuilder = new PrefixedCamelCaseStreamNameBuilder(); var streamName = streamNamebuilder.GenerateForEventType("TestEventType"); Assert.Equal("$et-testEventType", streamName); } } }
using ReactiveDomain.Foundation.Testing; using System; using Xunit; namespace ReactiveDomain.Foundation.Tests { [Collection(nameof(EventStoreCollection))] public class PrefixedCamelCaseStreamNameBuilderTests { [Fact] public void ThrowsOnNonExplicitNullOrEmptyPrefix() { Assert.Throws<ArgumentException>(() => new PrefixedCamelCaseStreamNameBuilder(string.Empty)); Assert.Throws<ArgumentException>(() => new PrefixedCamelCaseStreamNameBuilder(" ")); Assert.Throws<ArgumentException>(() => new PrefixedCamelCaseStreamNameBuilder(null)); } [Fact] public void CanGeneratePrefixedCamelCaseStreamNameForAggregate() { var aggregareId = Guid.Parse("96370d8277ae4ccab626091775ed01bb"); var prefix = "UnitTest"; var streamNamebuilder = new PrefixedCamelCaseStreamNameBuilder(prefix); var streamName = streamNamebuilder.GenerateForAggregate(typeof(TestAggregate), aggregareId); Assert.Equal($"unittest.testAggregate-96370d8277ae4ccab626091775ed01bb", streamName); } [Fact] public void CanGenerateStreamNameForCategory() { var streamNamebuilder = new PrefixedCamelCaseStreamNameBuilder(); var streamName = streamNamebuilder.GenerateForCategory(typeof(TestAggregate)); Assert.Equal($"$ce-testAggregate", streamName); } [Fact] public void CanGenerateStreamNameForEventType() { var streamNamebuilder = new PrefixedCamelCaseStreamNameBuilder(); var streamName = streamNamebuilder.GenerateForEventType("TestEventType"); Assert.Equal($"$et-testEventType", streamName); } } }
mit
C#
129fa8d73a9a130364538513ba6825d634bf6b3c
Enable MonsterFixUp test
ErikEJ/EntityFramework7.SqlServerCompact,ErikEJ/EntityFramework.SqlServerCompact
test/EntityFramework.SqlServerCompact.FunctionalTests/MonsterFixUpSqlCeTest.cs
test/EntityFramework.SqlServerCompact.FunctionalTests/MonsterFixUpSqlCeTest.cs
using System; using System.Data.SqlServerCe; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Specification.Tests.TestModels; using Microsoft.Extensions.DependencyInjection; using Microsoft.EntityFrameworkCore.TestModels; namespace Microsoft.EntityFrameworkCore.Specification.Tests { public class MonsterFixupSqlCeTest : MonsterFixupTestBase { protected override IServiceProvider CreateServiceProvider(bool throwingStateManager = false) { var serviceCollection = new ServiceCollection() .AddEntityFrameworkSqlCe(); if (throwingStateManager) { serviceCollection.AddScoped<IStateManager, ThrowingMonsterStateManager>(); } return serviceCollection.BuildServiceProvider(); } protected override DbContextOptions CreateOptions(string databaseName) { var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder .UseSqlCe(CreateConnectionString(databaseName)); return optionsBuilder.Options; } private static string CreateConnectionString(string name) { return new SqlCeConnectionStringBuilder { DataSource = name + ".sdf" }.ConnectionString; } private SqlCeTestStore _testStore; protected override void CreateAndSeedDatabase(string databaseName, Func<MonsterContext> createContext, Action<MonsterContext> seed) { _testStore = SqlCeTestStore.GetOrCreateShared(databaseName, () => { using (var context = createContext()) { context.Database.EnsureCreated(); seed(context); } }); } public virtual void Dispose() => _testStore?.Dispose(); protected override void OnModelCreating<TMessage, TProductPhoto, TProductReview>(ModelBuilder builder) { base.OnModelCreating<TMessage, TProductPhoto, TProductReview>(builder); builder.Entity<TMessage>().HasKey(e => e.MessageId); builder.Entity<TProductPhoto>().HasKey(e => e.PhotoId); builder.Entity<TProductReview>().HasKey(e => e.ReviewId); } } }
using System; using System.Data.SqlServerCe; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Specification.Tests.TestModels; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.EntityFrameworkCore.Specification.Tests { //public class MonsterFixupSqlCeTest : MonsterFixupTestBase //{ // protected override IServiceProvider CreateServiceProvider(bool throwingStateManager = false) // { // var serviceCollection = new ServiceCollection() // .AddEntityFrameworkSqlCe(); // if (throwingStateManager) // { // serviceCollection.AddScoped<IStateManager, ThrowingMonsterStateManager>(); // } // return serviceCollection.BuildServiceProvider(); // } // protected override DbContextOptions CreateOptions(string databaseName) // { // var optionsBuilder = new DbContextOptionsBuilder(); // optionsBuilder // .UseSqlCe(CreateConnectionString(databaseName)); // return optionsBuilder.Options; // } // private static string CreateConnectionString(string name) // { // return new SqlCeConnectionStringBuilder // { // DataSource = name + ".sdf" // }.ConnectionString; // } // private SqlCeTestStore _testStore; // protected override void CreateAndSeedDatabase(string databaseName, Func<MonsterContext> createContext, Action<MonsterContext> seed) // { // _testStore = SqlCeTestStore.GetOrCreateShared(databaseName, () => // { // using (var context = createContext()) // { // context.Database.EnsureCreated(); // seed(context); // } // }); // } // public virtual void Dispose() => _testStore?.Dispose(); // public override void OnModelCreating<TMessage, TProductPhoto, TProductReview>(ModelBuilder builder) // { // base.OnModelCreating<TMessage, TProductPhoto, TProductReview>(builder); // builder.Entity<TMessage>().HasKey(e => e.MessageId); // builder.Entity<TProductPhoto>().HasKey(e => e.PhotoId); // builder.Entity<TProductReview>().HasKey(e => e.ReviewId); // } //} }
apache-2.0
C#
2dd2ea31a1c346a7442ddef29e86e8d6599d8cc2
Fix port
cmusatyalab/gabriel,cmusatyalab/gabriel,cmusatyalab/gabriel
client/legacy-hololens-client/gabriel-holo-client/Assets/Scripts/Const.cs
client/legacy-hololens-client/gabriel-holo-client/Assets/Scripts/Const.cs
#if !UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace gabriel_client { class Const { // whether to do a demo or a set of experiments public static bool IS_EXPERIMENT = false; // whether to use real-time captured images or load images from files for testing public static bool LOAD_IMAGES = false; /************************ In both demo and experiment mode *******************/ // directory for all application related files (input + output) public static Windows.Storage.StorageFolder ROOT_DIR = Windows.Storage.ApplicationData.Current.LocalFolder; // image size and frame rate public static int MIN_FPS = 15; // options: 320x180, 640x360, 1280x720, 1920x1080 public static int IMAGE_WIDTH = 640; public static int IMAGE_HEIGHT = 360; // port protocol to the server public static int VIDEO_STREAM_PORT = 9098; public static int ACC_STREAM_PORT = 9099; public static int RESULT_RECEIVING_PORT = 9111; public static int CONTROL_PORT = 22222; // load images (JPEG) from files and pretend they are just captured by the camera public static string APP_NAME = "lego"; public static string TEST_IMAGE_DIR_NAME = "images-" + APP_NAME; /************************ Demo mode only *************************************/ // server IP public static string SERVER_IP = "128.2.213.106"; // Cloudlet // token size public static int TOKEN_SIZE = 1; // whether to capture holograms for display (only capture for half of the time) public static bool HOLO_CAPTURE = true; /************************ Experiment mode only *******************************/ // server IP list public static string[] SERVER_IP_LIST = { "128.2.213.106", }; // token size list public static int[] TOKEN_SIZE_LIST = { 1 }; // maximum times to ping (for time synchronization public static int MAX_PING_TIMES = 20; // a small number of images used for compression (bmp files), usually a subset of test images // these files are loaded into memory first so cannot have too many of them! public static string COMPRESS_IMAGE_DIR_NAME = "images-" + APP_NAME + "-compress"; // the maximum allowed compress images to load public static int MAX_COMPRESS_IMAGE = 3; // result file public static string EXP_DIR_NAME = "exp"; } } #endif
#if !UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace gabriel_client { class Const { // whether to do a demo or a set of experiments public static bool IS_EXPERIMENT = false; // whether to use real-time captured images or load images from files for testing public static bool LOAD_IMAGES = false; /************************ In both demo and experiment mode *******************/ // directory for all application related files (input + output) public static Windows.Storage.StorageFolder ROOT_DIR = Windows.Storage.ApplicationData.Current.LocalFolder; // image size and frame rate public static int MIN_FPS = 15; // options: 320x180, 640x360, 1280x720, 1920x1080 public static int IMAGE_WIDTH = 640; public static int IMAGE_HEIGHT = 360; // port protocol to the server public static int VIDEO_STREAM_PORT = 9098; public static int ACC_STREAM_PORT = 9099; public static int RESULT_RECEIVING_PORT = 9101; public static int CONTROL_PORT = 22222; // load images (JPEG) from files and pretend they are just captured by the camera public static string APP_NAME = "lego"; public static string TEST_IMAGE_DIR_NAME = "images-" + APP_NAME; /************************ Demo mode only *************************************/ // server IP public static string SERVER_IP = "128.2.213.106"; // Cloudlet // token size public static int TOKEN_SIZE = 1; // whether to capture holograms for display (only capture for half of the time) public static bool HOLO_CAPTURE = true; /************************ Experiment mode only *******************************/ // server IP list public static string[] SERVER_IP_LIST = { "128.2.213.106", }; // token size list public static int[] TOKEN_SIZE_LIST = { 1 }; // maximum times to ping (for time synchronization public static int MAX_PING_TIMES = 20; // a small number of images used for compression (bmp files), usually a subset of test images // these files are loaded into memory first so cannot have too many of them! public static string COMPRESS_IMAGE_DIR_NAME = "images-" + APP_NAME + "-compress"; // the maximum allowed compress images to load public static int MAX_COMPRESS_IMAGE = 3; // result file public static string EXP_DIR_NAME = "exp"; } } #endif
apache-2.0
C#
8c2daa1dbce9b79a6a500bb38e9c43362e7a9d94
comment on code behind
Esri/visibility-addin-dotnet
source/ArcMapAddinVisibility/ArcMapAddinVisibility/Views/LLOSView.xaml.cs
source/ArcMapAddinVisibility/ArcMapAddinVisibility/Views/LLOSView.xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ArcMapAddinVisibility.Views { /// <summary> /// Interaction logic for LLOSView.xaml /// </summary> public partial class VisibilityLLOSView : UserControl { public VisibilityLLOSView() { InitializeComponent(); } private void ListBox_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { // right mouse click selects item in list box // avoid this by setting e.Handled to true e.Handled = true; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ArcMapAddinVisibility.Views { /// <summary> /// Interaction logic for LLOSView.xaml /// </summary> public partial class VisibilityLLOSView : UserControl { public VisibilityLLOSView() { InitializeComponent(); } private void ListBox_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; } } }
apache-2.0
C#
26e7a3f157ced6e6fb0ab01f05b9ec2abe2ab862
add license header
johnneijzen/osu,peppy/osu,NeoAdonis/osu,ppy/osu,naoey/osu,naoey/osu,Nabile-Rahmani/osu,UselessToucan/osu,Drezi126/osu,ZLima12/osu,NeoAdonis/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,smoogipooo/osu,DrabWeb/osu,DrabWeb/osu,EVAST9919/osu,ppy/osu,EVAST9919/osu,ZLima12/osu,DrabWeb/osu,peppy/osu,Frontear/osuKyzer,ppy/osu,naoey/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,2yangk23/osu
osu.Game/Audio/AudioLoadWrapper.cs
osu.Game/Audio/AudioLoadWrapper.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Game.Beatmaps; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace osu.Game.Audio { public class AudioLoadWrapper : Drawable { private readonly string preview; public Track Preview; public AudioLoadWrapper(string preview) { this.preview = preview; } [BackgroundDependencyLoader] private void load(AudioManager audio) { if (!string.IsNullOrEmpty(preview)) { Preview = audio.Track.Get(preview); Preview.Volume.Value = 0.5; } } } }
using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Game.Beatmaps; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace osu.Game.Audio { public class AudioLoadWrapper : Drawable { private readonly string preview; public Track Preview; public AudioLoadWrapper(string preview) { this.preview = preview; } [BackgroundDependencyLoader] private void load(AudioManager audio) { if (!string.IsNullOrEmpty(preview)) { Preview = audio.Track.Get(preview); Preview.Volume.Value = 0.5; } } } }
mit
C#
f64d01e42f4576d0965f904a79238cce141cd855
Apply rendering code, now need to test
austinmao/reduxity,austinmao/reduxity
Assets/Scripts/ReduxMovementLookExample/Renderers/MoveCamera.cs
Assets/Scripts/ReduxMovementLookExample/Renderers/MoveCamera.cs
using UnityEngine; using UniRx; namespace Reduxity.Example.PlayerMovementLook { [RequireComponent(typeof(Camera))] public class MoveCamera : MonoBehaviour { private Camera camera_; private void Awake() { camera_ = GetComponent<Camera>(); } void Start() { RenderLook(); } void RenderLook() { // Debug.Log($"App.Store: {App.Store}"); App.Store .Subscribe(state => { Debug.Log($"looking by rotation: {state.Camera.transform.localRotation}"); camera_.transform.localRotation = state.Camera.transform.localRotation; }) .AddTo(this); } } }
using UnityEngine; using UniRx; namespace Reduxity.Example.PlayerMovementLook { [RequireComponent(typeof(Camera))] public class MoveCamera : MonoBehaviour { private Camera camera_; private void Awake() { camera_ = GetComponent<Camera>(); } void Start() { RenderLook(); } void RenderLook() { // Debug.Log($"App.Store: {App.Store}"); App.Store .Subscribe(state => { // Debug.Log($"going to move character by: {distance}"); // camera_.transform.localRotation = state.Look.lookRotation; }) .AddTo(this); } // Ripped straight out of the Standard Assets MouseLook script. (This should really be a standard function...) private Quaternion ClampRotationAroundXAxis(Quaternion q, float minAngle, float maxAngle) { q.x /= q.w; q.y /= q.w; q.z /= q.w; q.w = 1.0f; float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan(q.x); angleX = Mathf.Clamp(angleX, minAngle, maxAngle); q.x = Mathf.Tan(0.5f * Mathf.Deg2Rad * angleX); return q; } } }
mit
C#
93c2aced808ecb9b8697934b0beec04df71e4563
Update CitiesByContinentAndCounry.cs
IPetrov007/Softuni-Programing-Fundamentals
AdvancedCollections/AdvancedCollections/02_Cities/CitiesByContinentAndCounry.cs
AdvancedCollections/AdvancedCollections/02_Cities/CitiesByContinentAndCounry.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _02_CitiesByCountryAndContinent { class Program { static void Main(string[] args) { var citiesData = new Dictionary<string, Dictionary<string, List<string>>>(); var n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { var input = Console.ReadLine().Split(new[] { ' ' }); var continent = input[0]; var country = input[1]; var city = input[2]; if (!citiesData.ContainsKey(continent)) { citiesData[continent] = new Dictionary<string, List<string>>(); } if (!citiesData[continent].ContainsKey(country)) { citiesData[continent][country] = new List<string>(); } citiesData[continent][country].Add(city); } foreach (var nameContinent in citiesData.Keys) { Console.WriteLine($"{nameContinent}:"); foreach (var kvp in citiesData[nameContinent].Keys) { Console.WriteLine($" {kvp} -> {string.Join(", ", citiesData[nameContinent][kvp])}"); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _02_CitiesByCountryAndContinent { class Program { static void Main(string[] args) { var citiesData = new Dictionary<string, Dictionary<string, List<string>>>(); var n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { var input = Console.ReadLine().Split(new[] { ' ' }); var continent = input[0]; var country = input[1]; var city = input[2]; if (!citiesData.ContainsKey(continent)) { citiesData[continent] = new Dictionary<string, List<string>>(); } if (!citiesData[continent].ContainsKey(country)) { citiesData[continent][country] = new List<string>(); } citiesData[continent][country].Add(city); } foreach (var nameContinent in citiesData.Keys) { Console.WriteLine($"{nameContinent}:"); foreach (var kvp in citiesData[nameContinent].Keys) { Console.WriteLine($" {kvp} -> {string.Join(", ", citiesData[nameContinent][kvp])}"); } } } } }
mit
C#
fd0c6fb026c8d6e664b6bf8f4e85decbb814c8a5
make editor have multiline for debug
greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d
Assets/HappyFunTimes/HappyFunTimesCore/Editor/HFTHappyFunTimesSettingsEditor.cs
Assets/HappyFunTimes/HappyFunTimesCore/Editor/HFTHappyFunTimesSettingsEditor.cs
/* * Copyright 2014, Gregg Tavares. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Gregg Tavares. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEditor; using UnityEngine; using HappyFunTimes; namespace HappyFunTimesEditor { [CustomEditor(typeof(HappyFunTimes.HFTHappyFunTimesSettings))] public class HFTHappyFunTimesSettingsEditor : Editor { // UnityEditor.EditorPrefs, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null public override void OnInspectorGUI() { GUIStyle labelStyle = new GUIStyle(GUI.skin.GetStyle("Label")); labelStyle.wordWrap = true; GUIStyle textAreaStyle = new GUIStyle(GUI.skin.GetStyle("TextArea")); textAreaStyle.wordWrap = true; GUILayout.Label("These settings are used in editor only and only take effect when a game starts.", labelStyle); GUILayout.Space(5); bool showMessages = HFTHappyFunTimesSettings.showMessages; string debug = HFTHappyFunTimesSettings.debug; bool newShowMessages = GUILayout.Toggle(showMessages, "show messages [game <-> controller]"); GUILayout.Label(@"debug [log stuff] eg. name1 name2 prefix1* prefix2* '*' = all", labelStyle); string newDebug = EditorGUILayout.TextArea(debug, textAreaStyle, GUILayout.Height(100)); HFTHappyFunTimesSettings.showMessages = newShowMessages; HFTHappyFunTimesSettings.debug = newDebug; } } } // namespace HappyFunTimesEditor
/* * Copyright 2014, Gregg Tavares. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Gregg Tavares. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEditor; using UnityEngine; using HappyFunTimes; namespace HappyFunTimesEditor { [CustomEditor(typeof(HappyFunTimes.HFTHappyFunTimesSettings))] public class HFTHappyFunTimesSettingsEditor : Editor { // UnityEditor.EditorPrefs, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null public override void OnInspectorGUI() { GUIStyle style = new GUIStyle(GUI.skin.GetStyle("Label")); style.wordWrap = true; GUILayout.Label("These settings are used in editor only and only take effect when a game starts.", style); GUILayout.Space(5); bool showMessages = HFTHappyFunTimesSettings.showMessages; string debug = HFTHappyFunTimesSettings.debug; bool newShowMessages = GUILayout.Toggle(showMessages, "show messages [game <-> controller]"); GUILayout.Label("name,name,prefix*,name. '*' = all"); string newDebug = GUILayout.TextField(debug, "debug [log all the things!]"); HFTHappyFunTimesSettings.showMessages = newShowMessages; HFTHappyFunTimesSettings.debug = newDebug; } } } // namespace HappyFunTimesEditor
bsd-3-clause
C#
d968f5a21e49ee127126d578add6f21e8dc2dddc
Bump version up.
mr-bt/Eos,mr-bt/Eos
Eos.Atomic/Properties/AssemblyInfo.cs
Eos.Atomic/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Eos.Atomic")] [assembly: AssemblyDescription("Eos Atomic is a c# library that provides atomic Read/Write primitive types using the memory barrier semantics.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Eos.Atomic")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("3d5683ec-7520-4121-bf8a-fe56faab4eab")] // 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: AssemblyInformationalVersion("0.0.4-beta")] [assembly: AssemblyVersion("0.0.4.0")] [assembly: AssemblyFileVersion("0.0.4.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Eos.Atomic")] [assembly: AssemblyDescription("Eos Atomic is a c# library that provides atomic Read/Write primitive types using the memory barrier semantics.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Eos.Atomic")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("3d5683ec-7520-4121-bf8a-fe56faab4eab")] // 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: AssemblyInformationalVersion("0.0.3-beta")] [assembly: AssemblyVersion("0.0.3.0")] [assembly: AssemblyFileVersion("0.0.3.0")]
mit
C#
b642d2dba85bfa6231069f8ee43b02f972c88ed3
Add implementation for simple cache using Dictionary
iperoyg/faqtemplatebot
FaqTemplate.Infrastructure/Services/SimpleMemoryCacheService.cs
FaqTemplate.Infrastructure/Services/SimpleMemoryCacheService.cs
using FaqTemplate.Core.Services; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FaqTemplate.Infrastructure.Services { public class SimpleMemoryCacheService<T> : ICacheService<T> { private IDictionary<string, T> _cache; public SimpleMemoryCacheService() { _cache = new Dictionary<string, T>(); } public Task AddOrUpdate(string key, T value) { _cache.Remove(key); _cache.Add(key, value); return Task.CompletedTask; } public Task Clear() { _cache.Clear(); return Task.CompletedTask; } public Task<T> Get(string key) { var data = _cache.ContainsKey(key) ? _cache[key] : default(T); return Task.FromResult(data); } public Task<T> Remove(string key) { var data = _cache.ContainsKey(key) ? _cache[key] : default(T); _cache.Remove(key); return Task.FromResult(data); } } }
using FaqTemplate.Core.Services; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FaqTemplate.Infrastructure.Services { public class SimpleMemoryCacheService<T> : ICacheService<T> { public Task AddOrUpdate(string key, T value) { return Task.CompletedTask; } public Task Clear() { return Task.CompletedTask; } public Task<T> Get(string key) { return Task.FromResult(default(T)); } public Task<T> Remove(string key) { return Task.FromResult(default(T)); } } }
mit
C#
e18bdd156de64961237b2b84f1b79ce876d380c8
Revert "Added ability to have more than one dynamic placeholder in the same rendering"
Fortis-Collection/dynamic-placeholders-mvc
Source/DynamicPlaceholders.Mvc/Extensions/SitecoreHelperExtensions.cs
Source/DynamicPlaceholders.Mvc/Extensions/SitecoreHelperExtensions.cs
using Sitecore.Mvc.Helpers; using Sitecore.Mvc.Presentation; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; namespace DynamicPlaceholders.Mvc.Extensions { public static class SitecoreHelperExtensions { public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName) { var currentRenderingId = RenderingContext.Current.Rendering.UniqueId; return helper.Placeholder(string.Format("{0}_{1}", placeholderName, currentRenderingId)); } } }
using System.Linq; using Sitecore.Mvc.Helpers; using Sitecore.Mvc.Presentation; using System.Collections.Generic; using System.Web; namespace DynamicPlaceholders.Mvc.Extensions { public static class SitecoreHelperExtensions { public static List<string> DynamicPlaceholders = new List<string>(); public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName) { var placeholder = string.Format("{0}_{1}", placeholderName, RenderingContext.Current.Rendering.UniqueId); var count = 0; if ((count = DynamicPlaceholders.Count(dp => dp.StartsWith(placeholder))) > 0) { placeholder = string.Format("{0}_{1}", placeholder, count); DynamicPlaceholders.Add(placeholder); } return helper.Placeholder(placeholder); } } }
mit
C#
e47566ca4ea36922b50ea1071f6cc46c5f5a90a0
Fix build
umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,arknu/Umbraco-CMS,rasmuseeg/Umbraco-CMS,rasmuseeg/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,NikRimington/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,lars-erik/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,madsoulswe/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,lars-erik/Umbraco-CMS,lars-erik/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,NikRimington/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,lars-erik/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS
src/Umbraco.Core/Persistence/Repositories/IDocumentBlueprintRepository.cs
src/Umbraco.Core/Persistence/Repositories/IDocumentBlueprintRepository.cs
namespace Umbraco.Core.Persistence.Repositories { public interface IDocumentBlueprintRepository : IDocumentRepository { } }
namespace Umbraco.Core.Persistence.Repositories { interface IDocumentBlueprintRepository : IDocumentRepository { } }
mit
C#
cdb3d20fc62465946a98730452baf6a381da14e1
Remove unnecessary warning suppression
NeoAdonis/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu
osu.Game/Database/RealmWrapper.cs
osu.Game/Database/RealmWrapper.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using Realms; namespace osu.Game.Database { public class RealmWrapper<T> : IEquatable<RealmWrapper<T>> where T : RealmObject, IHasGuidPrimaryKey { public Guid ID { get; } private readonly ThreadLocal<T> threadValues; public readonly IRealmFactory ContextFactory; public RealmWrapper(T original, IRealmFactory contextFactory) { ContextFactory = contextFactory; ID = original.Guid; var originalContext = original.Realm; threadValues = new ThreadLocal<T>(() => { var context = ContextFactory?.Get(); if (context == null || originalContext?.IsSameInstance(context) != false) return original; return context.Find<T>(ID); }); } public T Get() => threadValues.Value; public RealmWrapper<TChild> WrapChild<TChild>(Func<T, TChild> lookup) where TChild : RealmObject, IHasGuidPrimaryKey => new RealmWrapper<TChild>(lookup(Get()), ContextFactory); public void PerformUpdate(Action<T> perform) { using (ContextFactory.GetForWrite()) perform(this); } // ReSharper disable once CA2225 public static implicit operator T(RealmWrapper<T> wrapper) => wrapper?.Get().Detach(); // ReSharper disable once CA2225 public static implicit operator RealmWrapper<T>(T obj) => obj.WrapAsUnmanaged(); public bool Equals(RealmWrapper<T> other) => other != null && other.ID == ID; public override string ToString() => Get().ToString(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Diagnostics.CodeAnalysis; using System.Threading; using Realms; namespace osu.Game.Database { [SuppressMessage("ReSharper", "CA2225")] public class RealmWrapper<T> : IEquatable<RealmWrapper<T>> where T : RealmObject, IHasGuidPrimaryKey { public Guid ID { get; } private readonly ThreadLocal<T> threadValues; public readonly IRealmFactory ContextFactory; public RealmWrapper(T original, IRealmFactory contextFactory) { ContextFactory = contextFactory; ID = original.Guid; var originalContext = original.Realm; threadValues = new ThreadLocal<T>(() => { var context = ContextFactory?.Get(); if (context == null || originalContext?.IsSameInstance(context) != false) return original; return context.Find<T>(ID); }); } public T Get() => threadValues.Value; public RealmWrapper<TChild> WrapChild<TChild>(Func<T, TChild> lookup) where TChild : RealmObject, IHasGuidPrimaryKey => new RealmWrapper<TChild>(lookup(Get()), ContextFactory); public void PerformUpdate(Action<T> perform) { using (ContextFactory.GetForWrite()) perform(this); } // ReSharper disable once CA2225 public static implicit operator T(RealmWrapper<T> wrapper) => wrapper?.Get().Detach(); // ReSharper disable once CA2225 public static implicit operator RealmWrapper<T>(T obj) => obj.WrapAsUnmanaged(); public bool Equals(RealmWrapper<T> other) => other != null && other.ID == ID; public override string ToString() => Get().ToString(); } }
mit
C#
cee7957ba5fe3dd9cbbdc9179fe4cccb42282550
Reduce test loop count
IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner
MultiMiner.Xgminer.Discovery.Tests/MinerFinderTests.cs
MultiMiner.Xgminer.Discovery.Tests/MinerFinderTests.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Net; namespace MultiMiner.Xgminer.Discovery.Tests { [TestClass] public class MinerFinderTests { [TestMethod] public void MinerFinder_FindsMiners() { const int times = 3; for (int i = 0; i < times; i++) { List<IPEndPoint> miners = MinerFinder.Find("192.168.0.29-100", 4028, 4029); Assert.IsTrue(miners.Count >= 4); } } [TestMethod] public void MinerFinder_ChecksMiners() { List<IPEndPoint> miners = MinerFinder.Find("192.168.0.29-100", 4028, 4029); int goodCount = miners.Count; miners.Add(new IPEndPoint(IPAddress.Parse("10.0.0.1"), 1000)); int checkCount = MinerFinder.Check(miners).Count; Assert.IsTrue(checkCount == goodCount); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Net; namespace MultiMiner.Xgminer.Discovery.Tests { [TestClass] public class MinerFinderTests { [TestMethod] public void MinerFinder_FindsMiners() { const int times = 10; for (int i = 0; i < times; i++) { List<IPEndPoint> miners = MinerFinder.Find("192.168.0.29-100", 4028, 4029); Assert.IsTrue(miners.Count >= 4); } } [TestMethod] public void MinerFinder_ChecksMiners() { List<IPEndPoint> miners = MinerFinder.Find("192.168.0.29-100", 4028, 4029); int goodCount = miners.Count; miners.Add(new IPEndPoint(IPAddress.Parse("10.0.0.1"), 1000)); int checkCount = MinerFinder.Check(miners).Count; Assert.IsTrue(checkCount == goodCount); } } }
mit
C#
a1b6e3534319c1ea48b38c05170d34eb9515490a
Convert StripeSubscriptionUpdateOptions.CancelAtPeriodEnd to property
stripe/stripe-dotnet,richardlawley/stripe.net
src/Stripe.net/Services/Subscriptions/StripeSubscriptionUpdateOptions.cs
src/Stripe.net/Services/Subscriptions/StripeSubscriptionUpdateOptions.cs
using System; using System.Collections.Generic; using Newtonsoft.Json; using Stripe.Infrastructure; namespace Stripe { public class StripeSubscriptionUpdateOptions : SubscriptionSharedOptions { #region BillingCycleAnchor public bool BillingCycleAnchorNow { get; set; } public bool BillingCycleAnchorUnchanged { get; set; } [JsonProperty("billing_cycle_anchor")] internal string BillingCycleAnchorInternal { get { if (BillingCycleAnchorNow) return "now"; if (BillingCycleAnchorUnchanged) return "unchanged"; return null; } } #endregion /// <summary> /// If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with <see href="https://stripe.com/docs/api#upcoming_invoice">upcoming invoice</see> endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. /// </summary> [JsonProperty("cancel_at_period_end")] public bool? CancelAtPeriodEnd { get; set; } /// <summary> /// List of subscription items, each with an attached plan. /// </summary> // this will actually send `items`. this is to flag it for the middleware // to process it as a plugin [JsonProperty("subscription_items_array_updated")] public List<StripeSubscriptionItemUpdateOption> Items { get; set; } #region ProrationDate /// <summary> /// Boolean indicating whether this subscription should cancel at the end of the current period. /// </summary> public DateTime? ProrationDate { get; set; } [JsonProperty("proration_date")] internal string ProrationDateInternal => ProrationDate?.ConvertDateTimeToEpoch().ToString(); #endregion } }
using System; using System.Collections.Generic; using Newtonsoft.Json; using Stripe.Infrastructure; namespace Stripe { public class StripeSubscriptionUpdateOptions : SubscriptionSharedOptions { #region BillingCycleAnchor public bool BillingCycleAnchorNow { get; set; } public bool BillingCycleAnchorUnchanged { get; set; } [JsonProperty("billing_cycle_anchor")] internal string BillingCycleAnchorInternal { get { if (BillingCycleAnchorNow) return "now"; if (BillingCycleAnchorUnchanged) return "unchanged"; return null; } } #endregion /// <summary> /// If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with <see href="https://stripe.com/docs/api#upcoming_invoice">upcoming invoice</see> endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. /// </summary> [JsonProperty("cancel_at_period_end")] public bool? CancelAtPeriodEnd; /// <summary> /// List of subscription items, each with an attached plan. /// </summary> // this will actually send `items`. this is to flag it for the middleware // to process it as a plugin [JsonProperty("subscription_items_array_updated")] public List<StripeSubscriptionItemUpdateOption> Items { get; set; } #region ProrationDate /// <summary> /// Boolean indicating whether this subscription should cancel at the end of the current period. /// </summary> public DateTime? ProrationDate { get; set; } [JsonProperty("proration_date")] internal string ProrationDateInternal => ProrationDate?.ConvertDateTimeToEpoch().ToString(); #endregion } }
apache-2.0
C#
ab8528195323af2b40a034cafebf0e0e089300f9
Handle missing account aggregation document
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/LevyAggregationRepository.cs
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/LevyAggregationRepository.cs
using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Azure; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; using SFA.DAS.EmployerApprenticeshipsService.Domain; using SFA.DAS.EmployerApprenticeshipsService.Domain.Data; using SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Entities; namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Data { public class LevyAggregationRepository : IAggregationRepository { private readonly CloudStorageAccount _storageAccount; public LevyAggregationRepository(string storageConnectionString) { _storageAccount = CloudStorageAccount.Parse(storageConnectionString); } public async Task Update(int accountId, int pageNumber, string json) { var tableClient = _storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LevyAggregation"); var entity = new LevyAggregationEntity(accountId, pageNumber) { Data = json }; var insertOperation = TableOperation.InsertOrReplace(entity); await table.ExecuteAsync(insertOperation); } public async Task<AggregationData> GetByAccountId(int accountId) { var tableClient = _storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LevyAggregation"); var fetchOperation = TableOperation.Retrieve<LevyAggregationEntity>(accountId.ToString(),1.ToString()); var result = await table.ExecuteAsync(fetchOperation); var row = (LevyAggregationEntity) result.Result; if (row == null) return new AggregationData { AccountId = accountId, Data = new List<AggregationLine>() }; return JsonConvert.DeserializeObject<AggregationData>(row.Data); } } }
using System.Threading.Tasks; using Microsoft.Azure; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; using SFA.DAS.EmployerApprenticeshipsService.Domain; using SFA.DAS.EmployerApprenticeshipsService.Domain.Data; using SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Entities; namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Data { public class LevyAggregationRepository : IAggregationRepository { private readonly CloudStorageAccount _storageAccount; public LevyAggregationRepository(string storageConnectionString) { _storageAccount = CloudStorageAccount.Parse(storageConnectionString); } public async Task Update(int accountId, int pageNumber, string json) { var tableClient = _storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LevyAggregation"); var entity = new LevyAggregationEntity(accountId, pageNumber) { Data = json }; var insertOperation = TableOperation.InsertOrReplace(entity); await table.ExecuteAsync(insertOperation); } public async Task<AggregationData> GetByAccountId(int accountId) { var tableClient = _storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LevyAggregation"); var fetchOperation = TableOperation.Retrieve<LevyAggregationEntity>(accountId.ToString(),1.ToString()); var result = await table.ExecuteAsync(fetchOperation); var row = (LevyAggregationEntity) result.Result; var obj = JsonConvert.DeserializeObject<AggregationData>(row.Data); return obj; } } }
mit
C#
df93ac5ad3679608ceb44547a9ba6ee0662ce6e0
Fix platform check
Microsoft/ApplicationInsights-Xamarin
ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/Utils.cs
ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/Utils.cs
using System; using Xamarin.Forms; namespace AI.XamarinSDK.Abstractions { public class Utils { public Utils () { } public static Boolean IsSupportedPlatform(){ return (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android); } } }
using System; using Xamarin.Forms; namespace AI.XamarinSDK.Abstractions { public class Utils { public Utils () { } public static Boolean IsSupportedPlatform(){ return !(Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android); } } }
mit
C#
49eb09d2e8403021a23899ef44ba5b6e73911c9b
remove OutputCache from SidebarController
csyntax/BlogSystem
Source/BlogSystem.Web/Controllers/SidebarController.cs
Source/BlogSystem.Web/Controllers/SidebarController.cs
namespace BlogSystem.Web.Controllers { using System.Linq; using System.Web.Mvc; using Data.Models; using Data.Repositories; using ViewModels.Sidebar; using ViewModels.Post; using ViewModels.Page; using Infrastructure.Extensions; public class SidebarController : BaseController { private readonly IDbRepository<Post> postsRepository; private readonly IDbRepository<Page> pagesRepository; public SidebarController(IDbRepository<Post> postsRepository, IDbRepository<Page> pagesRepository) { this.postsRepository = postsRepository; this.pagesRepository = pagesRepository; } [ChildActionOnly] //[OutputCache(Duration = 10 * 60)] public PartialViewResult Index() { var model = new SidebarViewModel { RecentPosts = this.Cache.Get("RecentBlogPosts", () => this.postsRepository .All() .Where(p => !p.IsDeleted) .OrderByDescending(p => p.CreatedOn) .To<PostViewModel>() .Take(5) .ToList(), 600), Pages = this.pagesRepository.All().To<PageViewModel>().ToList() }; return this.PartialView(model); } } }
namespace BlogSystem.Web.Controllers { using System.Linq; using System.Web.Mvc; using Data.Models; using Data.Repositories; using ViewModels.Sidebar; using ViewModels.Post; using ViewModels.Page; using Infrastructure.Extensions; public class SidebarController : BaseController { private readonly IDbRepository<Post> postsRepository; private readonly IDbRepository<Page> pagesRepository; public SidebarController(IDbRepository<Post> postsRepository, IDbRepository<Page> pagesRepository) { this.postsRepository = postsRepository; this.pagesRepository = pagesRepository; } [ChildActionOnly] [OutputCache(Duration = 10 * 60)] public PartialViewResult Index() { var model = new SidebarViewModel { RecentPosts = this.Cache.Get("RecentBlogPosts", () => this.postsRepository .All() .Where(p => !p.IsDeleted) .OrderByDescending(p => p.CreatedOn) .To<PostViewModel>() .Take(5) .ToList(), 600), Pages = this.pagesRepository.All().To<PageViewModel>().ToList() }; return this.PartialView(model); } } }
mit
C#
b68551994d274b5fa03041c9949c09f7beb6da66
revert unrelated changes
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/Behaviors/SplitViewAutoBehavior.cs
WalletWasabi.Fluent/Behaviors/SplitViewAutoBehavior.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Xaml.Interactivity; using System; using System.Reactive.Disposables; using System.Reactive.Linq; using ReactiveUI; namespace WalletWasabi.Fluent.Behaviors { public class SplitViewAutoBehavior : Behavior<SplitView> { private bool _sidebarWasForceClosed; private CompositeDisposable Disposables { get; set; } public static readonly StyledProperty<double> CollapseThresholdProperty = AvaloniaProperty.Register<SplitViewAutoBehavior, double>(nameof(CollapseThreshold)); public static readonly StyledProperty<Action> ToggleActionProperty = AvaloniaProperty.Register<SplitViewAutoBehavior, Action>(nameof(ToggleAction)); public static readonly StyledProperty<Action> CollapseOnClickActionProperty = AvaloniaProperty.Register<SplitViewAutoBehavior, Action>(nameof(CollapseOnClickAction)); public double CollapseThreshold { get => GetValue(CollapseThresholdProperty); set => SetValue(CollapseThresholdProperty, value); } public Action ToggleAction { get => GetValue(ToggleActionProperty); set => SetValue(ToggleActionProperty, value); } public Action CollapseOnClickAction { get => GetValue(CollapseOnClickActionProperty); set => SetValue(CollapseOnClickActionProperty, value); } protected override void OnAttached() { Disposables = new CompositeDisposable { AssociatedObject.WhenAnyValue(x => x.Bounds) .DistinctUntilChanged() .Subscribe(SplitViewBoundsChanged) }; ToggleAction = OnToggleAction; CollapseOnClickAction = OnCollapseOnClickAction; base.OnAttached(); } private void OnCollapseOnClickAction() { if (AssociatedObject.Bounds.Width <= CollapseThreshold && AssociatedObject.IsPaneOpen) { AssociatedObject.IsPaneOpen = false; } } private void OnToggleAction() { if (AssociatedObject.Bounds.Width > CollapseThreshold) { _sidebarWasForceClosed = AssociatedObject.IsPaneOpen; } AssociatedObject.IsPaneOpen = !AssociatedObject.IsPaneOpen; } private void SplitViewBoundsChanged(Rect x) { if (AssociatedObject is null) { return; } if (x.Width <= CollapseThreshold) { AssociatedObject.DisplayMode = SplitViewDisplayMode.CompactOverlay; if (!_sidebarWasForceClosed && AssociatedObject.IsPaneOpen) { AssociatedObject.IsPaneOpen = false; } } else { AssociatedObject.DisplayMode = SplitViewDisplayMode.CompactInline; if (!_sidebarWasForceClosed && !AssociatedObject.IsPaneOpen) { AssociatedObject.IsPaneOpen = true; } } } protected override void OnDetaching() { base.OnDetaching(); Disposables?.Dispose(); } } }
using Avalonia; using Avalonia.Controls; using Avalonia.Xaml.Interactivity; using System; using System.Reactive.Disposables; using System.Reactive.Linq; using ReactiveUI; namespace WalletWasabi.Fluent.Behaviors { public class SplitViewAutoBehavior : Behavior<SplitView> { private bool _sidebarWasForceClosed; private CompositeDisposable? Disposables { get; set; } public static readonly StyledProperty<double> CollapseThresholdProperty = AvaloniaProperty.Register<SplitViewAutoBehavior, double>(nameof(CollapseThreshold)); public static readonly StyledProperty<Action> ToggleActionProperty = AvaloniaProperty.Register<SplitViewAutoBehavior, Action>(nameof(ToggleAction)); public static readonly StyledProperty<Action> CollapseOnClickActionProperty = AvaloniaProperty.Register<SplitViewAutoBehavior, Action>(nameof(CollapseOnClickAction)); public double CollapseThreshold { get => GetValue(CollapseThresholdProperty); set => SetValue(CollapseThresholdProperty, value); } public Action ToggleAction { get => GetValue(ToggleActionProperty); set => SetValue(ToggleActionProperty, value); } public Action CollapseOnClickAction { get => GetValue(CollapseOnClickActionProperty); set => SetValue(CollapseOnClickActionProperty, value); } protected override void OnAttached() { Disposables = new CompositeDisposable { AssociatedObject.WhenAnyValue(x => x.Bounds) .DistinctUntilChanged() .Subscribe(SplitViewBoundsChanged) }; ToggleAction = OnToggleAction; CollapseOnClickAction = OnCollapseOnClickAction; base.OnAttached(); } private void OnCollapseOnClickAction() { if (AssociatedObject is null) { return; } if (AssociatedObject.Bounds.Width <= CollapseThreshold && AssociatedObject.IsPaneOpen) { AssociatedObject.IsPaneOpen = false; } } private void OnToggleAction() { if (AssociatedObject is null) { return; } if (AssociatedObject.Bounds.Width > CollapseThreshold) { _sidebarWasForceClosed = AssociatedObject.IsPaneOpen; } AssociatedObject.IsPaneOpen = !AssociatedObject.IsPaneOpen; } private void SplitViewBoundsChanged(Rect x) { if (AssociatedObject is null) { return; } if (x.Width <= CollapseThreshold) { AssociatedObject.DisplayMode = SplitViewDisplayMode.CompactOverlay; if (!_sidebarWasForceClosed && AssociatedObject.IsPaneOpen) { AssociatedObject.IsPaneOpen = false; } } else { AssociatedObject.DisplayMode = SplitViewDisplayMode.CompactInline; if (!_sidebarWasForceClosed && !AssociatedObject.IsPaneOpen) { AssociatedObject.IsPaneOpen = true; } } } protected override void OnDetaching() { base.OnDetaching(); Disposables?.Dispose(); } } }
mit
C#
3a876ea10cdb110bca55bdb69666eb0060b35486
Correct HelpCenter.Categories namespace
dcrowe/ZendeskApi_v2,mattnis/ZendeskApi_v2,CKCobra/ZendeskApi_v2,mwarger/ZendeskApi_v2
ZendeskApi_v2/Models/HelpCenter/Categories/Category.cs
ZendeskApi_v2/Models/HelpCenter/Categories/Category.cs
// Generated by Xamasoft JSON Class Generator // http://www.xamasoft.com/json-class-generator using System; using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace ZendeskApi_v2.Models.HelpCenter.Categories { public class Category { [JsonProperty("id")] public long? Id { get; set; } [JsonProperty("url")] public string Url { get; set; } [JsonProperty("html_url")] public string HtmlUrl { get; set; } [JsonProperty("position")] public int? Position { get; set; } [JsonProperty("created_at")] public string CreatedAt { get; set; } [JsonProperty("updated_at")] public string UpdatedAt { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("description")] public string Description { get; set; } [JsonProperty("locale")] public string Locale { get; set; } [JsonProperty("source_locale")] public string SourceLocale { get; set; } [JsonProperty("outdated")] public bool Outdated { get; set; } } }
// Generated by Xamasoft JSON Class Generator // http://www.xamasoft.com/json-class-generator using System; using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace ZendeskApi_v2.Models.HelpCenter { public class Category { [JsonProperty("id")] public long? Id { get; set; } [JsonProperty("url")] public string Url { get; set; } [JsonProperty("html_url")] public string HtmlUrl { get; set; } [JsonProperty("position")] public int? Position { get; set; } [JsonProperty("created_at")] public string CreatedAt { get; set; } [JsonProperty("updated_at")] public string UpdatedAt { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("description")] public string Description { get; set; } [JsonProperty("locale")] public string Locale { get; set; } [JsonProperty("source_locale")] public string SourceLocale { get; set; } [JsonProperty("outdated")] public bool Outdated { get; set; } } }
apache-2.0
C#
65dced7bac9fd04f826b3e3f51d47e9ce43103fa
add define guard
NDark/ndinfrastructure,NDark/ndinfrastructure
Unity/PlayerSettingTools/PlayerSettingTools.cs
Unity/PlayerSettingTools/PlayerSettingTools.cs
/** MIT License Copyright (c) 2017 NDark 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. */ /** @file PlayerSettingTools.cs @author NDark @date 20170509 . file started. */ using System.Collections; using UnityEngine; public static partial class PlayerSettingTools { public static string GetBundleVersion() { #if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX ) && !UNITY_EDITOR0_WIN && !UNITY_EDITOR_OSX string m_WindowsRunTimeAssetPath = "version" ; #endif // UNITY_STANDALONE_WIN string ret = string.Empty ; if( Application.platform == RuntimePlatform.IPhonePlayer ) { #if UNITY_IOS ret = PlayerSettingTools_iOS.GetBundleVersion() ; #endif // UNITY_IOS } else if( Application.platform == RuntimePlatform.Android ) { #if UNITY_ANDROID #endif // UNITY_ANDROID } else if( Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer ) { #if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX ret = UnityEditor.PlayerSettings.bundleVersion ; #else #if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX ) TextAsset ta = Resources.Load( m_AssetPath )as TextAsset; if( ta ) { ret = ta.text ; } #endif // ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX ) #endif // UNITY_EDITOR_WIN || UNITY_EDITOR_OSX } else { Debug.LogError("PlayerSettingTools::GetBundleVersion() Haven't supported this platform.") ; } int index = ret.IndexOf( "\r\n" ) ; if( -1 != index && ret.Length >= 2 && ret.Length - 2 == index ) { ret = ret.Substring( 0 , ret.Length - 2 ) ; } return ret ; } }
/** MIT License Copyright (c) 2017 NDark 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. */ /** @file PlayerSettingTools.cs @author NDark @date 20170509 . file started. */ using System.Collections; using System.Collections.Generic; using UnityEngine; public static partial class PlayerSettingTools { public static string GetBundleVersion() { #if UNITY_STANDALONE_WIN && !UNITY_EDITOR_WIN string m_WindowsRunTimeAssetPath = "version" ; #endif // UNITY_STANDALONE_WIN string ret = string.Empty ; if( Application.platform == RuntimePlatform.IPhonePlayer ) { #if UNITY_IOS ret = PlayerSettingTools_iOS.GetBundleVersion() ; #endif // UNITY_IOS } else if( Application.platform == RuntimePlatform.Android ) { #if UNITY_ANDROID #endif // UNITY_ANDROID } else if( Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer ) { #if UNITY_EDITOR_WIN ret = UnityEditor.PlayerSettings.bundleVersion ; #else TextAsset ta = Resources.Load( m_AssetPath )as TextAsset; if( ta ) { ret = ta.text ; } #endif } else { Debug.LogError("PlayerSettingTools::GetBundleVersion() Haven't supported this platform.") ; } int index = ret.IndexOf( "\r\n" ) ; if( -1 != index && ret.Length >= 2 && ret.Length - 2 == index ) { ret = ret.Substring( 0 , ret.Length - 2 ) ; } return ret ; } }
mit
C#
053532387ea8697dfb4f520f8bf78a94d65c77a9
Fix whitespace
mono/xwt,antmicro/xwt
Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs
Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs
// // NSApplicationInitializer.cs // // Author: // Lluis Sanchez Gual <lluis@xamarin.com> // // Copyright (c) 2016 Xamarin, Inc (http://www.xamarin.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; using AppKit; using Foundation; using ObjCRuntime; namespace Xwt.Mac { static class NSApplicationInitializer { public static void Initialize () { var ds = System.Threading.Thread.GetNamedDataSlot ("NSApplication.Initialized"); if (System.Threading.Thread.GetData (ds) == null) { System.Threading.Thread.SetData (ds, true); NSApplication.IgnoreMissingAssembliesDuringRegistration = true; // Setup a registration handler that does not let Xamarin.Mac register assemblies by default. Runtime.AssemblyRegistration += Runtime_AssemblyRegistration; NSApplication.Init (); // Register a callback when an assembly is loaded so it's registered in the xammac registrar. AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad; // Manually register all the currently loaded assemblies. foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { Runtime.RegisterAssembly(assembly); } } } private static void Runtime_AssemblyRegistration(object sender, AssemblyRegistrationEventArgs args) { // If we don't do this, Xamarin.Mac will forcefully load all the assemblies referenced from the app startup assembly. args.Register = false; } private static void CurrentDomain_AssemblyLoad (object sender, AssemblyLoadEventArgs args) { Runtime.RegisterAssembly(args.LoadedAssembly); } } }
// // NSApplicationInitializer.cs // // Author: // Lluis Sanchez Gual <lluis@xamarin.com> // // Copyright (c) 2016 Xamarin, Inc (http://www.xamarin.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; using AppKit; using Foundation; using ObjCRuntime; namespace Xwt.Mac { static class NSApplicationInitializer { public static void Initialize () { var ds = System.Threading.Thread.GetNamedDataSlot ("NSApplication.Initialized"); if (System.Threading.Thread.GetData (ds) == null) { System.Threading.Thread.SetData (ds, true); NSApplication.IgnoreMissingAssembliesDuringRegistration = true; // Setup a registration handler that does not let Xamarin.Mac register assemblies by default. Runtime.AssemblyRegistration += Runtime_AssemblyRegistration; NSApplication.Init (); // Register a callback when an assembly is loaded so it's registered in the xammac registrar. AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad; // Manually register all the currently loaded assemblies. foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { Runtime.RegisterAssembly(assembly); } } } private static void Runtime_AssemblyRegistration(object sender, AssemblyRegistrationEventArgs args) { // If we don't do this, Xamarin.Mac will forcefully load all the assemblies referenced from the app startup assembly. args.Register = false; } private static void CurrentDomain_AssemblyLoad (object sender, AssemblyLoadEventArgs args) { Runtime.RegisterAssembly(args.LoadedAssembly); } } }
mit
C#
119fa558b69e3c7fb75364d522ea4793575d1fa4
Bump version
Heufneutje/AudioSharp,Heufneutje/HeufyAudioRecorder
SharedAssemblyInfo.cs
SharedAssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AudioSharp")] [assembly: AssemblyCopyright("Copyright (c) 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AudioSharp")] [assembly: AssemblyCopyright("Copyright � 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
4b817e72d5aa8bc27f19ac4b6bf2fd93e637b439
Remove unused test code
SteamDatabase/ValveResourceFormat
Tests/TextureTests.cs
Tests/TextureTests.cs
using System.IO; using NUnit.Framework; using ValveResourceFormat; using ValveResourceFormat.ResourceTypes; namespace Tests { public class TextureTests { [Test] public void ExportTextures() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Textures"); var files = Directory.GetFiles(path, "*.vtex_c"); foreach (var file in files) { var resource = new Resource(); resource.Read(file); using var _ = ((Texture)resource.DataBlock).GenerateBitmap(); } } } }
using System.IO; using NUnit.Framework; using SkiaSharp; using ValveResourceFormat; using ValveResourceFormat.ResourceTypes; namespace Tests { public class TextureTests { [Test] public void ExportTextures() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Textures"); var files = Directory.GetFiles(path, "*.vtex_c"); foreach (var file in files) { var resource = new Resource(); resource.Read(file); using var bitmap = ((Texture)resource.DataBlock).GenerateBitmap(); using var ms = new MemoryStream(); using var pixels = bitmap.PeekPixels(); pixels.Encode(ms, SKEncodedImageFormat.Png, 100); // TODO: Comparing images as bytes doesn't work #if false using (var expected = new FileStream(Path.ChangeExtension(file, "png"), FileMode.Open, FileAccess.Read)) { FileAssert.AreEqual(expected, ms); } #endif } } } }
mit
C#
14ee65432b6668c0ad5dc23bf2a1a159c3e417dc
Update version
bartlomiejwolk/Annotation
TodoComponent/Todo.cs
TodoComponent/Todo.cs
// Copyright (c) 2015 Bartlomiej Wolk (bartlomiejwolk@gmail.com) // // This file is part of the Annotation extension for Unity. // Licensed under the MIT license. See LICENSE file in the project root folder. using UnityEngine; namespace AnnotationEx.TodoComponent { public sealed class Todo : MonoBehaviour { #region CONSTANTS public const string Version = "v0.2.0"; public const string Extension = "Annotation"; #endregion #region DELEGATES #endregion #region EVENTS #endregion #region FIELDS #pragma warning disable 0414 /// <summary> /// Allows identify component in the scene file when reading it with /// text editor. /// </summary> [SerializeField] private string componentName = "Todo"; #pragma warning restore0414 #endregion #region INSPECTOR FIELDS /// <summary> /// Description of the task. /// </summary> [SerializeField] private string description = "Description"; #endregion #region PROPERTIES /// <summary> /// Optional text to describe purpose of this instance of the component. /// </summary> public string Description { get { return description; } set { description = value; } } #endregion #region UNITY MESSAGES private void Awake() { } private void FixedUpdate() { } private void LateUpdate() { } private void OnEnable() { } private void Reset() { } private void Start() { } private void Update() { } private void OnValidate() { } private void OnCollisionEnter(Collision collision) { } private void OnCollisionStay(Collision collision) { } private void OnCollisionExit(Collision collision) { } #endregion #region EVENT INVOCATORS #endregion #region EVENT HANDLERS #endregion #region METHODS #endregion } }
// Copyright (c) 2015 Bartlomiej Wolk (bartlomiejwolk@gmail.com) // // This file is part of the Annotation extension for Unity. // Licensed under the MIT license. See LICENSE file in the project root folder. using UnityEngine; namespace AnnotationEx.TodoComponent { public sealed class Todo : MonoBehaviour { #region CONSTANTS public const string Version = "v0.1.0"; public const string Extension = "Annotation"; #endregion #region DELEGATES #endregion #region EVENTS #endregion #region FIELDS #pragma warning disable 0414 /// <summary> /// Allows identify component in the scene file when reading it with /// text editor. /// </summary> [SerializeField] private string componentName = "Todo"; #pragma warning restore0414 #endregion #region INSPECTOR FIELDS /// <summary> /// Description of the task. /// </summary> [SerializeField] private string description = "Description"; #endregion #region PROPERTIES /// <summary> /// Optional text to describe purpose of this instance of the component. /// </summary> public string Description { get { return description; } set { description = value; } } #endregion #region UNITY MESSAGES private void Awake() { } private void FixedUpdate() { } private void LateUpdate() { } private void OnEnable() { } private void Reset() { } private void Start() { } private void Update() { } private void OnValidate() { } private void OnCollisionEnter(Collision collision) { } private void OnCollisionStay(Collision collision) { } private void OnCollisionExit(Collision collision) { } #endregion #region EVENT INVOCATORS #endregion #region EVENT HANDLERS #endregion #region METHODS #endregion } }
mit
C#
3f5351ee02e8d91629b5a9357b0d7be54f2be1c8
Add test owner to FqdnTag test
ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell
src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/AzureFirewallFqdnTagTests.cs
src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/AzureFirewallFqdnTagTests.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Xunit.Abstractions; namespace Commands.Network.Test.ScenarioTests { public class AzureFirewallFqdnTagTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase { public XunitTracingInterceptor _logger; public AzureFirewallFqdnTagTests(ITestOutputHelper output) { _logger = new XunitTracingInterceptor(output); XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output)); } [Fact(Skip = "Need to re-record test after changes are deployed in Gateway Manager.")] [Trait(Category.AcceptanceType, Category.CheckIn)] [Trait(Category.Owner, "azurefirewall")] public void TestAzureFirewallFqdnTagList() { NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallFqdnTagList"); } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Xunit.Abstractions; namespace Commands.Network.Test.ScenarioTests { public class AzureFirewallFqdnTagTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase { public XunitTracingInterceptor _logger; public AzureFirewallFqdnTagTests(ITestOutputHelper output) { _logger = new XunitTracingInterceptor(output); XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output)); } [Fact(Skip = "Need to re-record test after changes are deployed in Gateway Manager.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestAzureFirewallFqdnTagList() { NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallFqdnTagList"); } } }
apache-2.0
C#
30f2ffd88cd65e61d6cd36f315684bc8dff0a5e2
Make Panel class publicly visible.
dneelyep/MonoGameUtils
MonoGameUtils/GameComponents/Panel.cs
MonoGameUtils/GameComponents/Panel.cs
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace MonoGameUtils.GameComponents { /// <summary> /// A solid-color rectangle that can be drawn on-screen. /// </summary> public class Panel : DrawableGameComponent { #region "Properties" public Rectangle Bounds { get; set; } #endregion private readonly Color BACKGROUND_COLOR; private Texture2D Texture { get; set; } private SpriteBatch mSpriteBatch; public Panel(Rectangle bounds, Color backgroundColor, SpriteBatch spriteBatch, Game game) : base(game) { Bounds = bounds; BACKGROUND_COLOR = backgroundColor; mSpriteBatch = spriteBatch; } public override void Initialize() { Texture = new Texture2D(Game.GraphicsDevice, 1, 1); Texture.SetData<Color>(new Color[] { BACKGROUND_COLOR } ); base.Initialize(); } public override void Draw(GameTime gameTime) { mSpriteBatch.Draw(Texture, Bounds, BACKGROUND_COLOR); base.Draw(gameTime); } } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace MonoGameUtils.GameComponents { /// <summary> /// A solid-color rectangle that can be drawn on-screen. /// </summary> internal class Panel : DrawableGameComponent { #region "Properties" public Rectangle Bounds { get; set; } #endregion private readonly Color BACKGROUND_COLOR; private Texture2D Texture { get; set; } private SpriteBatch mSpriteBatch; public Panel(Rectangle bounds, Color backgroundColor, SpriteBatch spriteBatch, Game game) : base(game) { Bounds = bounds; BACKGROUND_COLOR = backgroundColor; mSpriteBatch = spriteBatch; } public override void Initialize() { Texture = new Texture2D(Game.GraphicsDevice, 1, 1); Texture.SetData<Color>(new Color[] { BACKGROUND_COLOR } ); base.Initialize(); } public override void Draw(GameTime gameTime) { mSpriteBatch.Draw(Texture, Bounds, BACKGROUND_COLOR); base.Draw(gameTime); } } }
mit
C#
10341a8d62e5f6094620ddee999886f80da98222
Fix ordering of views so the ordering is the same as v8
robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS
src/Umbraco.Web.Website/ViewEngines/RenderRazorViewEngineOptionsSetup.cs
src/Umbraco.Web.Website/ViewEngines/RenderRazorViewEngineOptionsSetup.cs
using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.Extensions.Options; namespace Umbraco.Cms.Web.Website.ViewEngines { /// <summary> /// Configure view engine locations for front-end rendering /// </summary> public class RenderRazorViewEngineOptionsSetup : IConfigureOptions<RazorViewEngineOptions> { /// <inheritdoc/> public void Configure(RazorViewEngineOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } options.ViewLocationExpanders.Add(new ViewLocationExpander()); } /// <summary> /// Expands the default view locations /// </summary> private class ViewLocationExpander : IViewLocationExpander { public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) { string[] umbViewLocations = new string[] { "/Views/{0}.cshtml", "/Views/Shared/{0}.cshtml", "/Views/Partials/{0}.cshtml", "/Views/MacroPartials/{0}.cshtml", }; viewLocations = umbViewLocations.Concat(viewLocations); return viewLocations; } // not a dynamic expander public void PopulateValues(ViewLocationExpanderContext context) { } } } }
using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.Extensions.Options; namespace Umbraco.Cms.Web.Website.ViewEngines { /// <summary> /// Configure view engine locations for front-end rendering /// </summary> public class RenderRazorViewEngineOptionsSetup : IConfigureOptions<RazorViewEngineOptions> { /// <inheritdoc/> public void Configure(RazorViewEngineOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } options.ViewLocationExpanders.Add(new ViewLocationExpander()); } /// <summary> /// Expands the default view locations /// </summary> private class ViewLocationExpander : IViewLocationExpander { public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) { string[] umbViewLocations = new string[] { "/Views/Partials/{0}.cshtml", "/Views/MacroPartials/{0}.cshtml", "/Views/{0}.cshtml" }; viewLocations = umbViewLocations.Concat(viewLocations); return viewLocations; } // not a dynamic expander public void PopulateValues(ViewLocationExpanderContext context) { } } } }
mit
C#
8d071e7f4b2154ea19cb5145396c8691335e13e4
Fix a typo
mono/gio-sharp,mono/gio-sharp
gio/FileFactory.cs
gio/FileFactory.cs
// // FileFactory.cs // // Author(s): // Stephane Delcroix <stephane@delcroix.org> // // Copyright (c) 2008 Stephane Delcroix // // This program is free software; you can redistribute it and/or // modify it under the terms of version 2 of the Lesser GNU General // Public License as published by the Free Software Foundation. // // 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this program; if not, write to the // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. using System; using System.Runtime.InteropServices; namespace GLib { public class FileFactory { [DllImport ("libgio-2.0-0.dll")] private static extern IntPtr g_file_new_for_uri (string uri); public static File NewForUri (string uri) { return GLib.FileAdapter.GetObject (g_file_new_for_uri (uri), false) as File; } public static File NewForUri (Uri uri) { return GLib.FileAdapter.GetObject (g_file_new_for_uri (uri.ToString ()), false) as File; } [DllImport ("libgio-2.0-0.dll")] private static extern IntPtr g_file_new_for_path (string path); public static File NewForPath (string path) { return GLib.FileAdapter.GetObject (g_file_new_for_path (path), false) as File; } [DllImport ("libgio-2.0-0.dll")] private static extern IntPtr g_file_new_for_commandline_arg (string arg); public static File NewFromCommandlineArg (string arg) { return GLib.FileAdapter.GetObject (g_file_new_for_commandline_arg (arg), false) as File; } } }
// // FileFactory.cs // // Author(s): // Stephane Delcroix <stephane@delcroix.org> // // Copyright (c) 2008 Stephane Delcroix // // This program is free software; you can redistribute it and/or // modify it under the terms of version 2 of the Lesser GNU General // Public License as published by the Free Software Foundation. // // 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this program; if not, write to the // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. using System; using System.Runtime.InteropServices; namespace GLib { public class FileFactory { [DllImport ("libgio-2.0-0.dll")] private static extern IntPtr g_file_new_for_uri (string uri); public static File NewForUri (string uri) { return GLib.FileAdapter.GetObject (g_file_new_for_uri (uri), false) as File; } public static File NewForUri (Uri uri) { return GLib.FileAdapter.GetObject (g_file_new_for_uri (uri.ToString ()), false) as File; } [DllImport ("libgio-2.0-0.dll")] private static extern IntPtr g_file_new_for_path (string path); public static File NewForPath (string path) { return GLib.FileAdapter.GetObject (g_file_new_for_path (path), false) as File; } [DllImport ("libgio-2.0-0.dll")] private static extern IntPtr g_file_new_for_commandline_args (string args); public static File NewForCommandlineArgs (string args) { return GLib.FileAdapter.GetObject (g_file_new_for_commandline_args (args), false) as File; } } }
mit
C#
78b52b207d0147659c742478fd327bd323909dd4
Remove null check in quick fix
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/src/resharper-unity/Feature/Services/QuickFixes/ConvertCoalesingToConditionalQuickFix.cs
resharper/src/resharper-unity/Feature/Services/QuickFixes/ConvertCoalesingToConditionalQuickFix.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Intentions.Util; using JetBrains.ReSharper.Plugins.Unity.Daemon.Stages.Highlightings; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; using JetBrains.ReSharper.Resources.Shell; using JetBrains.TextControl; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.Feature.Services.QuickFixes { [QuickFix] public class ConvertCoalesingToConditionalQuickFix : QuickFixBase { private readonly INullCoalescingExpression myExpression; public ConvertCoalesingToConditionalQuickFix(UnityNullCoalescingWarning warning) { myExpression = warning.Expression; } protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) { using (WriteLockCookie.Create()) { var leftOperand = myExpression.LeftOperand; var rightOperand = myExpression.RightOperand; var factory = CSharpElementFactory.GetInstance(myExpression); var newExpression = factory.CreateExpression("$0?$0:$1", leftOperand, rightOperand); ModificationUtil.ReplaceChild(myExpression, newExpression); } return null; } public override string Text => "Convert to conditional expression."; public override bool IsAvailable(IUserDataHolder cache) { return ValidUtils.Valid(myExpression); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Intentions.Util; using JetBrains.ReSharper.Plugins.Unity.Daemon.Stages.Highlightings; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; using JetBrains.ReSharper.Resources.Shell; using JetBrains.TextControl; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.Feature.Services.QuickFixes { [QuickFix] public class ConvertCoalesingToConditionalQuickFix : QuickFixBase { private readonly INullCoalescingExpression myExpression; public ConvertCoalesingToConditionalQuickFix(UnityNullCoalescingWarning warning) { myExpression = warning.Expression; } protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) { using (WriteLockCookie.Create()) { var leftOperand = myExpression.LeftOperand; var rightOperand = myExpression.RightOperand; if (leftOperand == null || rightOperand == null) return null; var factory = CSharpElementFactory.GetInstance(myExpression); var newExpression = factory.CreateExpression("$0?$0:$1", leftOperand, rightOperand); ModificationUtil.ReplaceChild(myExpression, newExpression); } return null; } public override string Text => "Convert to conditional expression."; public override bool IsAvailable(IUserDataHolder cache) { return ValidUtils.Valid(myExpression); } } }
apache-2.0
C#
f56d5ac498ad0ebfd29c6a26e3919f0e02f3660f
Fix for issue #221 NullReferenceException
inthehand/32feet,inthehand/32feet,inthehand/32feet,inthehand/32feet
InTheHand.Net.Bluetooth/Platforms/Android/BluetoothDevicePickerReceiver.cs
InTheHand.Net.Bluetooth/Platforms/Android/BluetoothDevicePickerReceiver.cs
// 32feet.NET - Personal Area Networking for .NET // // InTheHand.Net.Bluetooth.Droid.BluetoothDevicePickerReceiver (Android) // // Copyright (c) 2018-2022 In The Hand Ltd, All rights reserved. // This source code is licensed under the MIT License using Android.Content; namespace InTheHand.Net.Bluetooth.Droid { [BroadcastReceiver(Enabled = true)] internal class BluetoothDevicePickerReceiver : BroadcastReceiver { // receive broadcast if a device is selected and store the device. public override void OnReceive(Context context, Intent intent) { var dev = (Android.Bluetooth.BluetoothDevice)intent.Extras?.Get("android.bluetooth.device.extra.DEVICE"); BluetoothDevicePicker.s_current._device = dev; BluetoothDevicePicker.s_handle.Set(); } } }
// 32feet.NET - Personal Area Networking for .NET // // InTheHand.Net.Bluetooth.Droid.BluetoothDevicePickerReceiver (Android) // // Copyright (c) 2018-2020 In The Hand Ltd, All rights reserved. // This source code is licensed under the MIT License using Android.Content; namespace InTheHand.Net.Bluetooth.Droid { [BroadcastReceiver(Enabled = true)] internal class BluetoothDevicePickerReceiver : BroadcastReceiver { // receive broadcast if a device is selected and store the device. public override void OnReceive(Context context, Intent intent) { var dev = (Android.Bluetooth.BluetoothDevice)intent.Extras.Get("android.bluetooth.device.extra.DEVICE"); BluetoothDevicePicker.s_current._device = dev; BluetoothDevicePicker.s_handle.Set(); } } }
mit
C#
a5d76bb44ad672ced228a5576ca1c42ca5143b1d
Add css class
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Shared/DisplayTemplates/SSDStatusModel.cshtml
Battery-Commander.Web/Views/Shared/DisplayTemplates/SSDStatusModel.cshtml
@model Soldier.SSDStatusModel @if (Model != null) { <div> @switch (Model.Rank) { case Rank.E1: case Rank.E2: case Rank.E3: case Rank.E4: <span class="@Model.CssClass">SSD 1 (@Html.DisplayFor(m => m.SSD_1))</span> return; case Rank.E5: <span class="@Model.CssClass">SSD 2 (@Html.DisplayFor(m => m.SSD_2))</span> return; case Rank.E6: <span class="@Model.CssClass">SSD 3 (@Html.DisplayFor(m => m.SSD_3))</span> return; case Rank.E7: <span class="@Model.CssClass">SSD 4 (@Html.DisplayFor(m => m.SSD_4))</span> return; case Rank.E8: <span class="@Model.CssClass">SSD 5 (@Html.DisplayFor(m => m.SSD_5))</span> return; default: return; } </div> }
@model Soldier.SSDStatusModel @if (Model != null) { <div> @switch (Model.Rank) { case Rank.E1: case Rank.E2: case Rank.E3: case Rank.E4: <span class="label label-default">SSD 1 (@Html.DisplayFor(m => m.SSD_1))</span> return; case Rank.E5: <span class="label label-default">SSD 2 (@Html.DisplayFor(m => m.SSD_2))</span> return; case Rank.E6: <span class="label label-default">SSD 3 (@Html.DisplayFor(m => m.SSD_3))</span> return; case Rank.E7: <span class="label label-default">SSD 4 (@Html.DisplayFor(m => m.SSD_4))</span> return; case Rank.E8: <span class="label label-default">SSD 5 (@Html.DisplayFor(m => m.SSD_5))</span> return; default: return; } </div> }
mit
C#
5b3ba6a9ed3a5ae0849645ae6a87e6b907b06e41
Fix on CreateObjectAction
UnityTechnologies/PlaygroundProject,UnityTechnologies/PlaygroundProject
PlaygroundProject/Assets/Scripts/Conditions/Actions/CreateObjectAction.cs
PlaygroundProject/Assets/Scripts/Conditions/Actions/CreateObjectAction.cs
using UnityEngine; using System.Collections; [AddComponentMenu("Playground/Actions/Create Object")] public class CreateObjectAction : Action { public GameObject prefabToCreate; public Vector2 newPosition; public bool relativeToThisObject; // Moves the gameObject instantly to a custom position public override bool ExecuteAction(GameObject dataObject) { if(prefabToCreate != null) { //create the new object by copying the prefab GameObject newObject = Instantiate<GameObject>(prefabToCreate); //is the position relative or absolute? Vector2 finalPosition = newPosition; if (relativeToThisObject) { finalPosition = (Vector2)transform.position + newPosition; } //let's place it in the desired position! newObject.transform.position = finalPosition; return true; } else { return false; } } }
using UnityEngine; using System.Collections; [AddComponentMenu("Playground/Actions/Create Object")] public class CreateObjectAction : Action { public GameObject prefabToCreate; public Vector2 newPosition; public bool relativeToThisObject; void Update () { if (relativeToThisObject) { newPosition = (Vector2)transform.localPosition + newPosition; } } // Moves the gameObject instantly to a custom position public override bool ExecuteAction(GameObject dataObject) { if(prefabToCreate != null) { //create the new object by copying the prefab GameObject newObject = Instantiate<GameObject>(prefabToCreate); //let's place it in the desired position! newObject.transform.position = newPosition; return true; } else { return false; } } }
mit
C#
57a956d28a59a4813d5ff2908c292499ba48a73e
add an example of fileType value
iQuarc/Code-Design-Training,iQuarc/Code-Design-Training
LessonsSamples/LessonsSamples/Lesson7/CohesionCoupling/IPageFileWriter.cs
LessonsSamples/LessonsSamples/Lesson7/CohesionCoupling/IPageFileWriter.cs
namespace LessonsSamples.Lesson7.CohesionCoupling { public interface IPageFileWriter { bool WriteFile(PageXml page, string fileType); // fileType=="CustomerPage" } public static class PageFileWriterExtensions { public static bool WriteFile(this IPageFileWriter writer, PageXml page) { return writer.WriteFile(page, string.Empty); } } }
namespace LessonsSamples.Lesson7.CohesionCoupling { public interface IPageFileWriter { bool WriteFile(PageXml page, string fileType); } public static class PageFileWriterExtensions { public static bool WriteFile(this IPageFileWriter writer, PageXml page) { return writer.WriteFile(page, string.Empty); } } }
mit
C#
9770fe3641a090703f5eadefcd3979a6260f5fb4
add test, logic is fine
Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate
Magistrate.Tests/Acceptance/When_a_user_has_one_role_with_a_permission.cs
Magistrate.Tests/Acceptance/When_a_user_has_one_role_with_a_permission.cs
using System.Linq; using Shouldly; using Xunit; namespace Magistrate.Tests.Acceptance { public class When_a_user_has_one_role_with_a_permission : UserAcceptanceBase { public When_a_user_has_one_role_with_a_permission() { TestRole.AddPermission(new MagistrateUser(), FirstPermission); User.AddRole(new MagistrateUser(), TestRole); } [Fact] public void AddInclude_a_different_permission_adds_to_the_includes_collection() { User.AddInclude(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.Single().ID.ShouldBe(SecondPermissionOnly); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void AddInclude_the_same_permission_adds_it() { User.AddInclude(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.Single().ID.ShouldBe(FirstPermissionOnly); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void RemoveInclude_a_different_permission_does_nothing() { User.RemoveInclude(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void RemoveInclude_the_same_permission_does_nothing() { User.RemoveInclude(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void AddRevoke_a_different_permission_adds_to_the_revokes_collection() { User.AddRevoke(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.Single().ID.ShouldBe(SecondPermissionOnly); } [Fact] public void AddRevoke_the_same_permission_adds_to_the_revokes_collection() { User.AddRevoke(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.Single().ID.ShouldBe(FirstPermissionOnly); } [Fact] public void RemoveRevoke_a_different_permission_does_nothing() { User.RemoveRevoke(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void RemoveRevoke_the_same_permission_does_nothing() { User.RemoveRevoke(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } } }
using System.Linq; using Shouldly; using Xunit; namespace Magistrate.Tests.Acceptance { public class When_a_user_has_one_role_with_a_permission : UserAcceptanceBase { public When_a_user_has_one_role_with_a_permission() { TestRole.AddPermission(new MagistrateUser(), FirstPermission); User.AddRole(new MagistrateUser(), TestRole); } [Fact] public void AddInclude_a_different_permission_adds_to_the_includes_collection() { User.AddInclude(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.Single().ID.ShouldBe(SecondPermissionOnly); ReadUser.Revokes.ShouldBeEmpty(); } [Fact(Skip = "Not sure on whether this is the right behaviour yet")] public void AddInclude_the_same_permission_does_nothing() { User.AddInclude(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void RemoveInclude_a_different_permission_does_nothing() { User.RemoveInclude(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void RemoveInclude_the_same_permission_does_nothing() { User.RemoveInclude(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void AddRevoke_a_different_permission_adds_to_the_revokes_collection() { User.AddRevoke(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.Single().ID.ShouldBe(SecondPermissionOnly); } [Fact] public void AddRevoke_the_same_permission_adds_to_the_revokes_collection() { User.AddRevoke(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.Single().ID.ShouldBe(FirstPermissionOnly); } [Fact] public void RemoveRevoke_a_different_permission_does_nothing() { User.RemoveRevoke(new MagistrateUser(), SecondPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } [Fact] public void RemoveRevoke_the_same_permission_does_nothing() { User.RemoveRevoke(new MagistrateUser(), FirstPermission); Project(User); ReadUser.Includes.ShouldBeEmpty(); ReadUser.Revokes.ShouldBeEmpty(); } } }
lgpl-2.1
C#
2cfd18b6a2781e24cb54839f57386146190d7ca5
Fix some C#3.0-isms that broke build in Mono 1.2.6 and MSVC# 2005. Fixes Mantis #2989.
EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/arribasim-dev-tests,OpenSimian/opensimulator,Michelle-Argus/ArribasimExtract,Michelle-Argus/ArribasimExtract,allquixotic/opensim-autobackup,QuillLittlefeather/opensim-1,AlexRa/opensim-mods-Alex,BogusCurry/arribasim-dev,cdbean/CySim,justinccdev/opensim,bravelittlescientist/opensim-performance,QuillLittlefeather/opensim-1,N3X15/VoxelSim,cdbean/CySim,bravelittlescientist/opensim-performance,ft-/opensim-optimizations-wip-tests,AlphaStaxLLC/taiga,N3X15/VoxelSim,TechplexEngineer/Aurora-Sim,TomDataworks/opensim,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/arribasim-dev-tests,zekizeki/agentservice,Michelle-Argus/ArribasimExtract,bravelittlescientist/opensim-performance,zekizeki/agentservice,BogusCurry/arribasim-dev,AlphaStaxLLC/taiga,QuillLittlefeather/opensim-1,rryk/omp-server,ft-/arribasim-dev-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-tests,justinccdev/opensim,OpenSimian/opensimulator,allquixotic/opensim-autobackup,TomDataworks/opensim,AlexRa/opensim-mods-Alex,ft-/opensim-optimizations-wip-tests,ft-/arribasim-dev-extras,OpenSimian/opensimulator,TomDataworks/opensim,QuillLittlefeather/opensim-1,justinccdev/opensim,OpenSimian/opensimulator,AlexRa/opensim-mods-Alex,Michelle-Argus/ArribasimExtract,TomDataworks/opensim,AlphaStaxLLC/taiga,bravelittlescientist/opensim-performance,justinccdev/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TechplexEngineer/Aurora-Sim,N3X15/VoxelSim,cdbean/CySim,justinccdev/opensim,ft-/opensim-optimizations-wip-tests,intari/OpenSimMirror,intari/OpenSimMirror,RavenB/opensim,AlphaStaxLLC/taiga,justinccdev/opensim,ft-/arribasim-dev-tests,cdbean/CySim,RavenB/opensim,rryk/omp-server,RavenB/opensim,allquixotic/opensim-autobackup,N3X15/VoxelSim,AlphaStaxLLC/taiga,ft-/arribasim-dev-extras,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip,bravelittlescientist/opensim-performance,intari/OpenSimMirror,QuillLittlefeather/opensim-1,N3X15/VoxelSim,RavenB/opensim,ft-/opensim-optimizations-wip-extras,rryk/omp-server,RavenB/opensim,cdbean/CySim,zekizeki/agentservice,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,AlphaStaxLLC/taiga,allquixotic/opensim-autobackup,zekizeki/agentservice,M-O-S-E-S/opensim,AlexRa/opensim-mods-Alex,M-O-S-E-S/opensim,ft-/arribasim-dev-tests,allquixotic/opensim-autobackup,N3X15/VoxelSim,N3X15/VoxelSim,BogusCurry/arribasim-dev,intari/OpenSimMirror,M-O-S-E-S/opensim,AlphaStaxLLC/taiga,BogusCurry/arribasim-dev,RavenB/opensim,TechplexEngineer/Aurora-Sim,TomDataworks/opensim,ft-/arribasim-dev-extras,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip-extras,rryk/omp-server,zekizeki/agentservice,TomDataworks/opensim,ft-/arribasim-dev-tests,TechplexEngineer/Aurora-Sim,OpenSimian/opensimulator,cdbean/CySim,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip,zekizeki/agentservice,AlexRa/opensim-mods-Alex,rryk/omp-server,BogusCurry/arribasim-dev,intari/OpenSimMirror,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,OpenSimian/opensimulator,allquixotic/opensim-autobackup,intari/OpenSimMirror,QuillLittlefeather/opensim-1,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,rryk/omp-server,AlexRa/opensim-mods-Alex,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,AlphaStaxLLC/taiga,ft-/arribasim-dev-extras,M-O-S-E-S/opensim,OpenSimian/opensimulator,bravelittlescientist/opensim-performance,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-tests,RavenB/opensim,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip-extras,N3X15/VoxelSim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim
OpenSim/Data/NHibernate/UserFriend.cs
OpenSim/Data/NHibernate/UserFriend.cs
using System; using System.Collections.Generic; using System.Text; using OpenMetaverse; namespace OpenSim.Data.NHibernate { public class UserFriend { public UserFriend() { } public UserFriend(UUID userFriendID, UUID ownerID, UUID friendID, uint friendPermissions) { this.UserFriendID = userFriendID; this.OwnerID = ownerID; this.FriendID = friendID; this.FriendPermissions = friendPermissions; } public UUID UserFriendID; public UUID OwnerID; public UUID FriendID; public uint FriendPermissions; } }
using System; using System.Collections.Generic; using System.Text; using OpenMetaverse; namespace OpenSim.Data.NHibernate { public class UserFriend { public UserFriend() { } public UserFriend(UUID userFriendID, UUID ownerID, UUID friendID, uint friendPermissions) { this.UserFriendID = userFriendID; this.OwnerID = ownerID; this.FriendID = friendID; this.FriendPermissions = friendPermissions; } public UUID UserFriendID { get; set; } public UUID OwnerID { get; set; } public UUID FriendID { get; set; } public uint FriendPermissions { get; set; } } }
bsd-3-clause
C#
e9699caf4e1119492a6d72ebe086abf154bee594
remove actionresults from response due to inconsistent behaviour
ceee/PocketSharp
PocketSharp/Models/Response/Modify.cs
PocketSharp/Models/Response/Modify.cs
using Newtonsoft.Json; using System.Runtime.Serialization; namespace PocketSharp.Models { /// <summary> /// Modify Response /// </summary> [JsonObject] internal class Modify : ResponseBase { /// <summary> /// Gets or sets the action results. /// </summary> /// <value> /// The action results. /// </value> //[JsonProperty("action_results")] //public bool[] ActionResults { get; set; } } }
using Newtonsoft.Json; using System.Runtime.Serialization; namespace PocketSharp.Models { /// <summary> /// Modify Response /// </summary> [JsonObject] internal class Modify : ResponseBase { /// <summary> /// Gets or sets the action results. /// </summary> /// <value> /// The action results. /// </value> [JsonProperty("action_results")] public bool[] ActionResults { get; set; } } }
mit
C#
1f684003d8631176f639954f39f93d5bd9e88e4b
Fix comment.
nguerrera/roslyn,sharwell/roslyn,dpoeschl/roslyn,jcouv/roslyn,jasonmalinowski/roslyn,Shiney/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,dotnet/roslyn,KevinH-MS/roslyn,KirillOsenkov/roslyn,yeaicc/roslyn,weltkante/roslyn,jeffanders/roslyn,AmadeusW/roslyn,jamesqo/roslyn,xoofx/roslyn,sharwell/roslyn,srivatsn/roslyn,balajikris/roslyn,bkoelman/roslyn,khyperia/roslyn,CaptainHayashi/roslyn,amcasey/roslyn,a-ctor/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,bbarry/roslyn,eriawan/roslyn,KiloBravoLima/roslyn,MattWindsor91/roslyn,ljw1004/roslyn,stephentoub/roslyn,physhi/roslyn,reaction1989/roslyn,mavasani/roslyn,tannergooding/roslyn,AnthonyDGreen/roslyn,bbarry/roslyn,nguerrera/roslyn,KevinH-MS/roslyn,srivatsn/roslyn,yeaicc/roslyn,xasx/roslyn,diryboy/roslyn,brettfo/roslyn,VSadov/roslyn,ErikSchierboom/roslyn,reaction1989/roslyn,paulvanbrenk/roslyn,AnthonyDGreen/roslyn,KirillOsenkov/roslyn,mmitche/roslyn,mgoertz-msft/roslyn,genlu/roslyn,tmat/roslyn,aelij/roslyn,VSadov/roslyn,Hosch250/roslyn,OmarTawfik/roslyn,natidea/roslyn,orthoxerox/roslyn,pdelvo/roslyn,gafter/roslyn,jcouv/roslyn,Giftednewt/roslyn,MatthieuMEZIL/roslyn,KevinRansom/roslyn,Hosch250/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tannergooding/roslyn,paulvanbrenk/roslyn,mmitche/roslyn,aelij/roslyn,xoofx/roslyn,KiloBravoLima/roslyn,cston/roslyn,jamesqo/roslyn,eriawan/roslyn,balajikris/roslyn,panopticoncentral/roslyn,tmeschter/roslyn,dotnet/roslyn,zooba/roslyn,Shiney/roslyn,tvand7093/roslyn,heejaechang/roslyn,dpoeschl/roslyn,MichalStrehovsky/roslyn,AmadeusW/roslyn,wvdd007/roslyn,tannergooding/roslyn,yeaicc/roslyn,mattscheffer/roslyn,budcribar/roslyn,drognanar/roslyn,zooba/roslyn,bartdesmet/roslyn,agocke/roslyn,stephentoub/roslyn,brettfo/roslyn,natidea/roslyn,KiloBravoLima/roslyn,pdelvo/roslyn,wvdd007/roslyn,dotnet/roslyn,paulvanbrenk/roslyn,robinsedlaczek/roslyn,CaptainHayashi/roslyn,jamesqo/roslyn,AmadeusW/roslyn,jhendrixMSFT/roslyn,vslsnap/roslyn,ErikSchierboom/roslyn,DustinCampbell/roslyn,davkean/roslyn,diryboy/roslyn,davkean/roslyn,genlu/roslyn,wvdd007/roslyn,eriawan/roslyn,bkoelman/roslyn,abock/roslyn,VSadov/roslyn,panopticoncentral/roslyn,swaroop-sridhar/roslyn,orthoxerox/roslyn,weltkante/roslyn,gafter/roslyn,Giftednewt/roslyn,budcribar/roslyn,TyOverby/roslyn,DustinCampbell/roslyn,mmitche/roslyn,AArnott/roslyn,KevinRansom/roslyn,cston/roslyn,mattscheffer/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,jkotas/roslyn,agocke/roslyn,Giftednewt/roslyn,mattwar/roslyn,AArnott/roslyn,AArnott/roslyn,KevinH-MS/roslyn,a-ctor/roslyn,ErikSchierboom/roslyn,balajikris/roslyn,vslsnap/roslyn,Hosch250/roslyn,OmarTawfik/roslyn,dpoeschl/roslyn,bartdesmet/roslyn,tmat/roslyn,MattWindsor91/roslyn,jmarolf/roslyn,CaptainHayashi/roslyn,Pvlerick/roslyn,jkotas/roslyn,MichalStrehovsky/roslyn,jeffanders/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,robinsedlaczek/roslyn,diryboy/roslyn,lorcanmooney/roslyn,amcasey/roslyn,amcasey/roslyn,mattscheffer/roslyn,vslsnap/roslyn,genlu/roslyn,DustinCampbell/roslyn,tmeschter/roslyn,stephentoub/roslyn,srivatsn/roslyn,jhendrixMSFT/roslyn,mattwar/roslyn,khyperia/roslyn,tmeschter/roslyn,nguerrera/roslyn,gafter/roslyn,a-ctor/roslyn,bartdesmet/roslyn,Pvlerick/roslyn,AnthonyDGreen/roslyn,kelltrick/roslyn,MatthieuMEZIL/roslyn,agocke/roslyn,akrisiun/roslyn,abock/roslyn,orthoxerox/roslyn,AlekseyTs/roslyn,Pvlerick/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,xasx/roslyn,CyrusNajmabadi/roslyn,cston/roslyn,ljw1004/roslyn,jasonmalinowski/roslyn,jeffanders/roslyn,sharwell/roslyn,tmat/roslyn,MatthieuMEZIL/roslyn,OmarTawfik/roslyn,xoofx/roslyn,MattWindsor91/roslyn,lorcanmooney/roslyn,budcribar/roslyn,TyOverby/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,drognanar/roslyn,physhi/roslyn,AlekseyTs/roslyn,swaroop-sridhar/roslyn,ljw1004/roslyn,jcouv/roslyn,swaroop-sridhar/roslyn,jhendrixMSFT/roslyn,jkotas/roslyn,mavasani/roslyn,akrisiun/roslyn,shyamnamboodiripad/roslyn,MattWindsor91/roslyn,xasx/roslyn,physhi/roslyn,bkoelman/roslyn,jmarolf/roslyn,tvand7093/roslyn,lorcanmooney/roslyn,abock/roslyn,aelij/roslyn,TyOverby/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,akrisiun/roslyn,natidea/roslyn,brettfo/roslyn,robinsedlaczek/roslyn,kelltrick/roslyn,zooba/roslyn,Shiney/roslyn,mattwar/roslyn,kelltrick/roslyn,tvand7093/roslyn,khyperia/roslyn,drognanar/roslyn,bbarry/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,pdelvo/roslyn,CyrusNajmabadi/roslyn,MichalStrehovsky/roslyn
src/Features/Core/Portable/FindReferences/DefinitionLocation.DocumentDefinitionLocation.cs
src/Features/Core/Portable/FindReferences/DefinitionLocation.DocumentDefinitionLocation.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.FindReferences { internal partial class DefinitionLocation { /// <summary> /// Implementation of a <see cref="DefinitionLocation"/> that sits on top of a /// <see cref="DocumentLocation"/>. /// </summary> private sealed class DocumentDefinitionLocation : DefinitionLocation { private readonly DocumentLocation _location; public DocumentDefinitionLocation(DocumentLocation location) { _location = location; } /// <summary> /// Show the project that this <see cref="DocumentLocation"/> is contained in as the /// Origination of this <see cref="DefinitionLocation"/>. /// </summary> public override ImmutableArray<TaggedText> OriginationParts => ImmutableArray.Create(new TaggedText(TextTags.Text, _location.Document.Project.Name)); public override bool CanNavigateTo() => _location.CanNavigateTo(); public override bool TryNavigateTo() => _location.TryNavigateTo(); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.FindReferences { internal partial class DefinitionLocation { /// <summary> /// Implementation of a <see cref="DefinitionLocation"/> that sits on top of a /// <see cref="DocumentLocation"/>. /// </summary> private sealed class DocumentDefinitionLocation : DefinitionLocation { private readonly DocumentLocation _location; public DocumentDefinitionLocation(DocumentLocation location) { _location = location; } /// <summary> /// Show the project that this <see cref="DocumentLocation"/> is contained in as the /// Origination of this <see cref="DefinitionItem"/>. /// </summary> public override ImmutableArray<TaggedText> OriginationParts => ImmutableArray.Create(new TaggedText(TextTags.Text, _location.Document.Project.Name)); public override bool CanNavigateTo() => _location.CanNavigateTo(); public override bool TryNavigateTo() => _location.TryNavigateTo(); } } }
mit
C#
340925d88239a1786994fa7f330dc260f82f2286
Update build.cake
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
XPlat/ExposureNotification/build.cake
XPlat/ExposureNotification/build.cake
var TARGET = Argument("t", Argument("target", "ci")); var SRC_COMMIT = "85caa2ed4a84d0193eb1bcce85eb22818a679398"; var SRC_URL = $"https://github.com/xamarin/xamarin.exposurenotification/archive/{SRC_COMMIT}.zip"; var OUTPUT_PATH = (DirectoryPath)"./output/"; var NUGET_VERSION = "0.1.0-preview02"; Task("externals") .Does(() => { DownloadFile(SRC_URL, "./src.zip"); Unzip("./src.zip", "./"); MoveDirectory($"./xamarin.exposurenotification-{SRC_COMMIT}", "./src"); }); Task("libs") .IsDependentOn("externals") .Does(() => { EnsureDirectoryExists(OUTPUT_PATH); MSBuild($"./src/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj", c => c .SetConfiguration("Release") .WithRestore() .WithTarget("Build") .WithTarget("Pack") .WithProperty("PackageVersion", NUGET_VERSION) .WithProperty("PackageOutputPath", MakeAbsolute(OUTPUT_PATH).FullPath)); }); Task("nuget") .IsDependentOn("libs"); Task("samples") .IsDependentOn("nuget"); Task("clean") .Does(() => { CleanDirectories("./externals/"); }); Task("ci") .IsDependentOn("nuget"); RunTarget(TARGET);
var TARGET = Argument("t", Argument("target", "ci")); var SRC_COMMIT = "1b129fc87970fde12e0f739b52e7ee01c23ab401"; var SRC_URL = $"https://github.com/xamarin/xamarin.exposurenotification/archive/{SRC_COMMIT}.zip"; var OUTPUT_PATH = (DirectoryPath)"./output/"; var NUGET_VERSION = "0.1.0-preview01"; Task("externals") .Does(() => { DownloadFile(SRC_URL, "./src.zip"); Unzip("./src.zip", "./"); MoveDirectory($"./xamarin.exposurenotification-{SRC_COMMIT}", "./src"); }); Task("libs") .IsDependentOn("externals") .Does(() => { EnsureDirectoryExists(OUTPUT_PATH); MSBuild($"./src/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj", c => c .SetConfiguration("Release") .WithRestore() .WithTarget("Build") .WithTarget("Pack") .WithProperty("PackageVersion", NUGET_VERSION) .WithProperty("PackageOutputPath", MakeAbsolute(OUTPUT_PATH).FullPath)); }); Task("nuget") .IsDependentOn("libs"); Task("samples") .IsDependentOn("nuget"); Task("clean") .Does(() => { CleanDirectories("./externals/"); }); Task("ci") .IsDependentOn("nuget"); RunTarget(TARGET);
mit
C#
e3fc1f2737d713fe2e0b25b8e19c2a554156c284
Update LayerMetadataWelder.cs (#1180)
stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2
src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerMetadataWelder.cs
src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerMetadataWelder.cs
using System; using System.Threading.Tasks; using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Views; using OrchardCore.Layers.Models; using OrchardCore.Layers.Services; using OrchardCore.Layers.ViewModels; namespace OrchardCore.Layers.Drivers { public class LayerMetadataWelder : ContentDisplayDriver { private readonly ILayerService _layerService; private readonly IStringLocalizer<LayerMetadataWelder> S; public LayerMetadataWelder(ILayerService layerService, IStringLocalizer<LayerMetadataWelder> stringLocalizer) { _layerService = layerService; S = stringLocalizer; } protected override void BuildPrefix(ContentItem model, string htmlFieldPrefix) { Prefix = "LayerMetadata"; } public override async Task<IDisplayResult> EditAsync(ContentItem model, BuildEditorContext context) { var layerMetadata = model.As<LayerMetadata>(); if (layerMetadata == null) { layerMetadata = new LayerMetadata(); // Are we loading an editor that requires layer metadata? if (await context.Updater.TryUpdateModelAsync(layerMetadata, Prefix, m => m.Zone, m => m.Position) && !String.IsNullOrEmpty(layerMetadata.Zone)) { model.Weld(layerMetadata); } else { return null; } } return Shape<LayerMetadataEditViewModel>("LayerMetadata_Edit", async shape => { shape.LayerMetadata = layerMetadata; shape.Layers = (await _layerService.GetLayersAsync()).Layers; }) .Location("Content:before"); } public override async Task<IDisplayResult> UpdateAsync(ContentItem model, UpdateEditorContext context) { var viewModel = new LayerMetadataEditViewModel(); await context.Updater.TryUpdateModelAsync(viewModel, Prefix); if (viewModel.LayerMetadata == null) { return null; } if (String.IsNullOrEmpty(viewModel.LayerMetadata.Zone)) { context.Updater.ModelState.AddModelError("LayerMetadata.Zone", S["Zone is missing"]); } if (context.Updater.ModelState.IsValid) { model.Apply(viewModel.LayerMetadata); } return await EditAsync(model, context); } } }
using System; using System.Threading.Tasks; using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Views; using OrchardCore.Layers.Models; using OrchardCore.Layers.Services; using OrchardCore.Layers.ViewModels; namespace OrchardCore.Layers.Drivers { public class LayerMetadataWelder : ContentDisplayDriver { private readonly ILayerService _layerService; private readonly IStringLocalizer<LayerMetadataWelder> S; public LayerMetadataWelder(ILayerService layerService, IStringLocalizer<LayerMetadataWelder> stringLocalizer) { _layerService = layerService; S = stringLocalizer; } protected override void BuildPrefix(ContentItem model, string htmlFieldPrefix) { Prefix = "LayerMetadata"; } public override async Task<IDisplayResult> EditAsync(ContentItem model, BuildEditorContext context) { var layerMetadata = model.As<LayerMetadata>(); if (layerMetadata == null) { layerMetadata = new LayerMetadata(); // Are we loading an editor that requires layer metadata? if (await context.Updater.TryUpdateModelAsync(layerMetadata, Prefix, m => m.Zone, m => m.Position) && !String.IsNullOrEmpty(layerMetadata.Zone)) { model.Weld(layerMetadata); } else { return null; } } return Shape<LayerMetadataEditViewModel>("LayerMetadata_Edit", async shape => { shape.LayerMetadata = layerMetadata; shape.Layers = (await _layerService.GetLayersAsync()).Layers; }) .Location("Content:before"); } public override async Task<IDisplayResult> UpdateAsync(ContentItem model, UpdateEditorContext context) { var viewModel = new LayerMetadataEditViewModel(); await context.Updater.TryUpdateModelAsync(viewModel, Prefix); if (String.IsNullOrEmpty(viewModel.LayerMetadata.Zone)) { context.Updater.ModelState.AddModelError("LayerMetadata.Zone", S["Zone is missing"]); } if (context.Updater.ModelState.IsValid) { model.Apply(viewModel.LayerMetadata); } return await EditAsync(model, context); } } }
bsd-3-clause
C#
9d1b63a5bbb55eb48fe2ea52f7879a1c8520e56a
Add assert
bugsnag/bugsnag-dotnet,bugsnag/bugsnag-dotnet
tests/Bugsnag.Tests/ClientTests.cs
tests/Bugsnag.Tests/ClientTests.cs
using System; using System.Collections.Generic; using System.Linq; using Xunit; namespace Bugsnag.Tests { public class ClientTests { [Fact] public async void TestThrownException() { var server = new TestServer(1); server.Start(); var metadata = new Dictionary<string, object>() { { "password", "secret" } }; var subMetadata = new Dictionary<string, object>() { { "circular", metadata }, { "password", "not again!" }, { "uri", new Uri("http://google.com?password=1111&wow=cool") } }; metadata["test"] = subMetadata; var filters = new string[] { "password" }; var client = new Client(new Configuration("123456") { Endpoint = server.Endpoint, MetadataFilters = filters }); client.BeforeNotify(r => { r.Event.Metadata["bugsnag"] = metadata; }); try { throw new ArgumentNullException(); } catch (Exception e) { client.Notify(e); } var requests = await server.Requests(); Assert.Single(requests); } [Fact] public async void TestNonThrownException() { var server = new TestServer(1); server.Start(); var metadata = new Dictionary<string, object>() { { "password", "secret" } }; var subMetadata = new Dictionary<string, object>() { { "circular", metadata }, { "password", "not again!" }, { "uri", new Uri("http://google.com?password=1111&wow=cool") } }; metadata["test"] = subMetadata; var filters = new string[] { "password" }; var client = new Client(new Configuration("123456") { Endpoint = server.Endpoint, MetadataFilters = filters }); client.BeforeNotify(r => { r.Event.Metadata["bugsnag"] = metadata; }); client.Notify(new ArgumentNullException()); var requests = await server.Requests(); var request = requests.Single(); Assert.DoesNotContain("Bugsnag.Client.Notify", request); } } }
using System; using System.Collections.Generic; using System.Linq; using Xunit; namespace Bugsnag.Tests { public class ClientTests { [Fact] public async void TestThrownException() { var server = new TestServer(1); server.Start(); var metadata = new Dictionary<string, object>() { { "password", "secret" } }; var subMetadata = new Dictionary<string, object>() { { "circular", metadata }, { "password", "not again!" }, { "uri", new Uri("http://google.com?password=1111&wow=cool") } }; metadata["test"] = subMetadata; var filters = new string[] { "password" }; var client = new Client(new Configuration("123456") { Endpoint = server.Endpoint, MetadataFilters = filters }); client.BeforeNotify(r => { r.Event.Metadata["bugsnag"] = metadata; }); try { throw new ArgumentNullException(); } catch (Exception e) { client.Notify(e); } var requests = await server.Requests(); Assert.Single(requests); } [Fact] public async void TestNonThrownException() { var server = new TestServer(1); server.Start(); var metadata = new Dictionary<string, object>() { { "password", "secret" } }; var subMetadata = new Dictionary<string, object>() { { "circular", metadata }, { "password", "not again!" }, { "uri", new Uri("http://google.com?password=1111&wow=cool") } }; metadata["test"] = subMetadata; var filters = new string[] { "password" }; var client = new Client(new Configuration("123456") { Endpoint = server.Endpoint, MetadataFilters = filters }); client.BeforeNotify(r => { r.Event.Metadata["bugsnag"] = metadata; }); client.Notify(new ArgumentNullException()); var requests = await server.Requests(); Assert.Single(requests); } } }
mit
C#
b8b096f626a41e32f5f66110c9e3235125147a53
Add material mappings to eth1.
fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game
ethernet/maps/eth1/mission.cs
ethernet/maps/eth1/mission.cs
// This script is executed on the server $MAP_ROOT = "ethernet/maps/eth1/"; $sgLightEditor::lightDBPath = $MAP_ROOT @ "lights/"; $sgLightEditor::filterDBPath = $MAP_ROOT @ "filters/"; sgLoadDataBlocks($sgLightEditor::lightDBPath); sgLoadDataBlocks($sgLightEditor::filterDBPath); //------------------------------------------------------------------------------ // Material mappings //------------------------------------------------------------------------------ %mapping = createMaterialMapping("gray3"); %mapping.sound = $MaterialMapping::Sound::Hard; %mapping.color = "0.3 0.3 0.3 0.4 0.0"; %mapping = createMaterialMapping("grass2"); %mapping.sound = $MaterialMapping::Sound::Soft; %mapping.color = "0.3 0.3 0.3 0.4 0.0"; %mapping = createMaterialMapping("rock"); %mapping.sound = $MaterialMapping::Sound::Hard; %mapping.color = "0.3 0.3 0.3 0.4 0.0"; %mapping = createMaterialMapping("stone"); %mapping.sound = $MaterialMapping::Sound::Hard; %mapping.color = "0.3 0.3 0.3 0.4 0.0";
// This script is executed on the server $MAP_ROOT = "ethernet/maps/eth1/"; $sgLightEditor::lightDBPath = $MAP_ROOT @ "lights/"; $sgLightEditor::filterDBPath = $MAP_ROOT @ "filters/"; sgLoadDataBlocks($sgLightEditor::lightDBPath); sgLoadDataBlocks($sgLightEditor::filterDBPath); //exec("./difs/propertymap.cs"); //exec("./scripts/env.cs");
lgpl-2.1
C#
72dde11979aba1a6a763c7a16b05537fcaa3e22e
Update CopyingPicture.cs
asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/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,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Articles/CopyShapesBetweenWorksheets/CopyingPicture.cs
Examples/CSharp/Articles/CopyShapesBetweenWorksheets/CopyingPicture.cs
using System.IO; using System.Drawing; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.CopyShapesBetweenWorksheets { public class CopyingPicture { public static void Main() { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a workbook object //Open the template file Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx"); //Get the Picture from the "Picture" worksheet. Aspose.Cells.Drawing.Picture source = workbook.Worksheets["Sheet1"].Pictures[0]; //Save Picture to Memory Stream MemoryStream ms = new MemoryStream(source.Data); //Copy the picture to the Result Worksheet workbook.Worksheets["Sheet2"].Pictures.Add(source.UpperLeftRow, source.UpperLeftColumn, ms, source.WidthScale, source.HeightScale); //Save the Worksheet workbook.Save(dataDir+ "Shapes.out.xlsx"); //ExEnd:1 } } }
using System.IO; using System.Drawing; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.CopyShapesBetweenWorksheets { public class CopyingPicture { public static void Main() { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a workbook object //Open the template file Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx"); //Get the Picture from the "Picture" worksheet. Aspose.Cells.Drawing.Picture source = workbook.Worksheets["Sheet1"].Pictures[0]; //Save Picture to Memory Stream MemoryStream ms = new MemoryStream(source.Data); //Copy the picture to the Result Worksheet workbook.Worksheets["Sheet2"].Pictures.Add(source.UpperLeftRow, source.UpperLeftColumn, ms, source.WidthScale, source.HeightScale); //Save the Worksheet workbook.Save(dataDir+ "Shapes.out.xlsx"); } } }
mit
C#
bb74ee4f530199349776f12317d7841aa17611eb
Fix JobHandlerTypeSerializerTest again
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
InfinniPlatform.Scheduler.Tests/Common/JobHandlerTypeSerializerTest.cs
InfinniPlatform.Scheduler.Tests/Common/JobHandlerTypeSerializerTest.cs
using System; using System.Threading.Tasks; using InfinniPlatform.IoC; using InfinniPlatform.Tests; using Moq; using NUnit.Framework; namespace InfinniPlatform.Scheduler.Common { [TestFixture(Category = TestCategories.UnitTest)] public class JobHandlerTypeSerializerTest { private const string HandlerType = "InfinniPlatform.Scheduler.Common.JobHandlerTypeSerializerTest+MyJobHandler,InfinniPlatform.Scheduler.Tests"; [Test] public void ShouldCheckIfCanSerialize() { // Given var resolver = new Mock<IContainerResolver>(); resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) }); var target = new JobHandlerTypeSerializer(resolver.Object); // When var result1 = target.CanSerialize(typeof(MyJobHandler)); var result2 = target.CanSerialize(typeof(JobHandlerTypeSerializerTest)); // Then Assert.IsTrue(result1); Assert.IsFalse(result2); } [Test] public void ShouldSerialize() { // Given var resolver = new Mock<IContainerResolver>(); var target = new JobHandlerTypeSerializer(resolver.Object); // When var result = target.Serialize(typeof(MyJobHandler)); // Then Assert.AreEqual(HandlerType, result); } [Test] public void ShouldDeserialize() { // Given var resolver = new Mock<IContainerResolver>(); resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) }); resolver.Setup(i => i.Resolve(typeof(MyJobHandler))).Returns(new MyJobHandler()); var target = new JobHandlerTypeSerializer(resolver.Object); // When var result = target.Deserialize(HandlerType); // Then Assert.IsInstanceOf<MyJobHandler>(result); } private class MyJobHandler : IJobHandler { public Task Handle(IJobInfo jobInfo, IJobHandlerContext context) { throw new NotImplementedException(); } } } }
using System; using System.Threading.Tasks; using InfinniPlatform.IoC; using InfinniPlatform.Tests; using Moq; using NUnit.Framework; namespace InfinniPlatform.Scheduler.Common { [TestFixture(Category = TestCategories.UnitTest)] public class JobHandlerTypeSerializerTest { private const string HandlerType = "InfinniPlatform.SchedulerCommon.JobHandlerTypeSerializerTest+MyJobHandler,InfinniPlatform.Scheduler.Tests"; [Test] public void ShouldCheckIfCanSerialize() { // Given var resolver = new Mock<IContainerResolver>(); resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) }); var target = new JobHandlerTypeSerializer(resolver.Object); // When var result1 = target.CanSerialize(typeof(MyJobHandler)); var result2 = target.CanSerialize(typeof(JobHandlerTypeSerializerTest)); // Then Assert.IsTrue(result1); Assert.IsFalse(result2); } [Test] public void ShouldSerialize() { // Given var resolver = new Mock<IContainerResolver>(); var target = new JobHandlerTypeSerializer(resolver.Object); // When var result = target.Serialize(typeof(MyJobHandler)); // Then Assert.AreEqual(HandlerType, result); } [Test] public void ShouldDeserialize() { // Given var resolver = new Mock<IContainerResolver>(); resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) }); resolver.Setup(i => i.Resolve(typeof(MyJobHandler))).Returns(new MyJobHandler()); var target = new JobHandlerTypeSerializer(resolver.Object); // When var result = target.Deserialize(HandlerType); // Then Assert.IsInstanceOf<MyJobHandler>(result); } private class MyJobHandler : IJobHandler { public Task Handle(IJobInfo jobInfo, IJobHandlerContext context) { throw new NotImplementedException(); } } } }
agpl-3.0
C#
b280f8faa36f127f910145da8a9ccb05ea64d2c8
Update device creation to just return the raw token
RightpointLabs/conference-room,jorupp/conference-room,RightpointLabs/conference-room,jorupp/conference-room,RightpointLabs/conference-room,jorupp/conference-room,jorupp/conference-room,RightpointLabs/conference-room
RightpointLabs.ConferenceRoom.Services/Controllers/DeviceController.cs
RightpointLabs.ConferenceRoom.Services/Controllers/DeviceController.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 RightpointLabs.ConferenceRoom.Domain.Models; using RightpointLabs.ConferenceRoom.Domain.Models.Entities; using RightpointLabs.ConferenceRoom.Domain.Repositories; using RightpointLabs.ConferenceRoom.Infrastructure.Services; namespace RightpointLabs.ConferenceRoom.Services.Controllers { [RoutePrefix("api/devices")] public class DeviceController : ApiController { private readonly IOrganizationRepository _organizationRepository; private readonly IDeviceRepository _deviceRepository; private readonly ITokenService _tokenService; public DeviceController(IOrganizationRepository organizationRepository, IDeviceRepository deviceRepository, ITokenService tokenService) { _organizationRepository = organizationRepository; _deviceRepository = deviceRepository; _tokenService = tokenService; } [Route("create")] public HttpResponseMessage PostCreate(string organizationId, string joinKey) { var org = _organizationRepository.Get(organizationId); if (null == org || org.JoinKey != joinKey) { return new HttpResponseMessage(HttpStatusCode.Forbidden); } var device = _deviceRepository.Create(new DeviceEntity() { OrganizationId = org.Id }); var token = _tokenService.CreateDeviceToken(device.Id); return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(token, Encoding.UTF8) }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using RightpointLabs.ConferenceRoom.Domain.Models; using RightpointLabs.ConferenceRoom.Domain.Models.Entities; using RightpointLabs.ConferenceRoom.Domain.Repositories; using RightpointLabs.ConferenceRoom.Infrastructure.Services; namespace RightpointLabs.ConferenceRoom.Services.Controllers { [RoutePrefix("api/devices")] public class DeviceController : ApiController { private readonly IOrganizationRepository _organizationRepository; private readonly IDeviceRepository _deviceRepository; private readonly ITokenService _tokenService; public DeviceController(IOrganizationRepository organizationRepository, IDeviceRepository deviceRepository, ITokenService tokenService) { _organizationRepository = organizationRepository; _deviceRepository = deviceRepository; _tokenService = tokenService; } [Route("create")] public object PostCreate(string organizationId, string joinKey) { var org = _organizationRepository.Get(organizationId); if (null == org || org.JoinKey != joinKey) { return new HttpResponseMessage(HttpStatusCode.Forbidden); } var device = _deviceRepository.Create(new DeviceEntity() { OrganizationId = org.Id }); var token = CreateToken(device); return token; } private string CreateToken(DeviceEntity device) { return _tokenService.CreateDeviceToken(device.Id); } } }
mit
C#
5340dd39c1df2051801ee14fb827ecaeeb9c78a3
fix startup bug with IOC container when requesting generic type for the first time
devdaves/TasksExample
TasksExample.Api/Infrastructure/Windsor/Installers/MediatrInstaller.cs
TasksExample.Api/Infrastructure/Windsor/Installers/MediatrInstaller.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Castle.MicroKernel; using Castle.MicroKernel.Registration; using Castle.MicroKernel.SubSystems.Configuration; using Castle.Windsor; using MediatR; namespace TasksExample.Api.Infrastructure.Windsor.Installers { public class MediatrInstaller : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { container.Kernel.AddHandlersFilter(new ContravariantFilter()); container.Register(Classes.FromThisAssembly().Pick().WithServiceAllInterfaces()); container.Register(Component.For<IMediator>().ImplementedBy<Mediator>()); container.Register(Component.For<SingleInstanceFactory>().UsingFactoryMethod<SingleInstanceFactory>(k => t => Resolve(k, t))); container.Register(Component.For<MultiInstanceFactory>().UsingFactoryMethod<MultiInstanceFactory>(k => t => (IEnumerable<object>)k.ResolveAll(t))); } private static object Resolve(IKernel k, Type t) { try { return k.Resolve(t); } catch (Exception) { return null; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Castle.MicroKernel.Registration; using Castle.MicroKernel.SubSystems.Configuration; using Castle.Windsor; using MediatR; namespace TasksExample.Api.Infrastructure.Windsor.Installers { public class MediatrInstaller : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { container.Kernel.AddHandlersFilter(new ContravariantFilter()); container.Register(Classes.FromThisAssembly().Pick().WithServiceAllInterfaces()); container.Register(Component.For<IMediator>().ImplementedBy<Mediator>()); container.Register(Component.For<SingleInstanceFactory>().UsingFactoryMethod<SingleInstanceFactory>(k => t => k.Resolve(t))); container.Register(Component.For<MultiInstanceFactory>().UsingFactoryMethod<MultiInstanceFactory>(k => t => (IEnumerable<object>)k.ResolveAll(t))); } } }
mit
C#
51623d3ff636a06d72f9b2a21bf8aaf4a2cf42a0
Add Required attribute
Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,tpkelly/voting-application,tpkelly/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application
VotingApplication/VotingApplication.Web/Api/Models/DBViewModels/ManageOptionUpdateRequest.cs
VotingApplication/VotingApplication.Web/Api/Models/DBViewModels/ManageOptionUpdateRequest.cs
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace VotingApplication.Web.Api.Models.DBViewModels { public class ManageOptionUpdateRequest { public ManageOptionUpdateRequest() { Options = new List<OptionUpdate>(); } public List<OptionUpdate> Options { get; set; } } public class OptionUpdate { [Required] public string Name { get; set; } public string Description { get; set; } public int? OptionNumber { get; set; } } }
using System.Collections.Generic; namespace VotingApplication.Web.Api.Models.DBViewModels { public class ManageOptionUpdateRequest { public ManageOptionUpdateRequest() { Options = new List<OptionUpdate>(); } public List<OptionUpdate> Options { get; set; } } public class OptionUpdate { public string Name { get; set; } public string Description { get; set; } public int? OptionNumber { get; set; } } }
apache-2.0
C#
0356717a861597a982d7b4c7ab0a0d66ccc83305
Return NotFound if contentItemId is null instead of ArgumentNullException (#5402)
OrchardCMS/Brochard,stevetayloruk/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard
src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ItemController.cs
src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ItemController.cs
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display; using OrchardCore.DisplayManagement.ModelBinding; using System.Threading.Tasks; namespace OrchardCore.Contents.Controllers { public class ItemController : Controller, IUpdateModel { private readonly IContentManager _contentManager; private readonly IContentItemDisplayManager _contentItemDisplayManager; private readonly IAuthorizationService _authorizationService; public ItemController( IContentManager contentManager, IContentItemDisplayManager contentItemDisplayManager, IAuthorizationService authorizationService ) { _authorizationService = authorizationService; _contentItemDisplayManager = contentItemDisplayManager; _contentManager = contentManager; } public async Task<IActionResult> Display(string contentItemId) { if (contentItemId == null) { return NotFound(); } var contentItem = await _contentManager.GetAsync(contentItemId); if (contentItem == null) { return NotFound(); } if (!await _authorizationService.AuthorizeAsync(User, Permissions.ViewContent, contentItem)) { return User.Identity.IsAuthenticated ? (IActionResult)Forbid() : Challenge(); } var model = await _contentItemDisplayManager.BuildDisplayAsync(contentItem, this); return View(model); } public async Task<IActionResult> Preview(string contentItemId) { if (contentItemId == null) { return NotFound(); } var versionOptions = VersionOptions.Latest; var contentItem = await _contentManager.GetAsync(contentItemId, versionOptions); if (contentItem == null) { return NotFound(); } if (!await _authorizationService.AuthorizeAsync(User, Permissions.PreviewContent, contentItem)) { return User.Identity.IsAuthenticated ? (IActionResult)Forbid() : Challenge(); } var model = await _contentItemDisplayManager.BuildDisplayAsync(contentItem, this); return View(model); } } }
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display; using OrchardCore.DisplayManagement.ModelBinding; using System.Threading.Tasks; namespace OrchardCore.Contents.Controllers { public class ItemController : Controller, IUpdateModel { private readonly IContentManager _contentManager; private readonly IContentItemDisplayManager _contentItemDisplayManager; private readonly IAuthorizationService _authorizationService; public ItemController( IContentManager contentManager, IContentItemDisplayManager contentItemDisplayManager, IAuthorizationService authorizationService ) { _authorizationService = authorizationService; _contentItemDisplayManager = contentItemDisplayManager; _contentManager = contentManager; } public async Task<IActionResult> Display(string contentItemId) { var contentItem = await _contentManager.GetAsync(contentItemId); if (contentItem == null) { return NotFound(); } if (!await _authorizationService.AuthorizeAsync(User, Permissions.ViewContent, contentItem)) { return User.Identity.IsAuthenticated ? (IActionResult)Forbid() : Challenge(); } var model = await _contentItemDisplayManager.BuildDisplayAsync(contentItem, this); return View(model); } public async Task<IActionResult> Preview(string contentItemId) { if (contentItemId == null) { return NotFound(); } var versionOptions = VersionOptions.Latest; var contentItem = await _contentManager.GetAsync(contentItemId, versionOptions); if (contentItem == null) { return NotFound(); } if (!await _authorizationService.AuthorizeAsync(User, Permissions.PreviewContent, contentItem)) { return User.Identity.IsAuthenticated ? (IActionResult)Forbid() : Challenge(); } var model = await _contentItemDisplayManager.BuildDisplayAsync(contentItem, this); return View(model); } } }
bsd-3-clause
C#
32650734cc907b16750c5b38e8fda8e74902c5d5
Fix format
mconnew/wcf,imcarolwang/wcf,imcarolwang/wcf,mconnew/wcf,dotnet/wcf,StephenBonikowsky/wcf,imcarolwang/wcf,StephenBonikowsky/wcf,dotnet/wcf,dotnet/wcf,mconnew/wcf
src/System.ServiceModel.Security/tests/ServiceModel/SecurityKeyTypeTest.cs
src/System.ServiceModel.Security/tests/ServiceModel/SecurityKeyTypeTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.IdentityModel.Tokens; using Infrastructure.Common; using Xunit; public static class SecurityKeyTypeTest { [WcfTheory] public static void Get_EnumMembers_Test() { SecurityKeyType sk = SecurityKeyType.SymmetricKey; Assert.Equal(SecurityKeyType.SymmetricKey, sk); SecurityKeyType ak = SecurityKeyType.AsymmetricKey; Assert.Equal(SecurityKeyType.AsymmetricKey, ak); SecurityKeyType bk = SecurityKeyType.BearerKey; Assert.Equal(SecurityKeyType.BearerKey, bk); } [WcfTheory] [InlineData(SecurityKeyType.SymmetricKey, 0)] [InlineData(SecurityKeyType.AsymmetricKey, 1)] [InlineData(SecurityKeyType.BearerKey, 2)] public static void TypeConvert_EnumToInt_Test(SecurityKeyType key, int value) { Assert.Equal((int)key, value); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.IdentityModel.Tokens; using Infrastructure.Common; using Xunit; public static class SecurityKeyTypeTest { [WcfFact] public static void Get_EnumMembers_Test() { SecurityKeyType sk = SecurityKeyType.SymmetricKey; Assert.Equal(SecurityKeyType.SymmetricKey, sk); SecurityKeyType ak = SecurityKeyType.AsymmetricKey; Assert.Equal(SecurityKeyType.AsymmetricKey, ak); SecurityKeyType bk = SecurityKeyType.BearerKey; Assert.Equal(SecurityKeyType.BearerKey, bk); } [Theory] [InlineData(SecurityKeyType.SymmetricKey, 0)] [InlineData(SecurityKeyType.AsymmetricKey, 1)] [InlineData(SecurityKeyType.BearerKey, 2)] public static void TypeConvert_EnumToInt_Test(SecurityKeyType key, int value) { Assert.Equal((int)key, value); } }
mit
C#
72dddb2ddb9a1e327acd53a819fd24764c4d8160
fix OCD #5
filipw/omnisharp-roslyn,hitesh97/omnisharp-roslyn,khellang/omnisharp-roslyn,fishg/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,haled/omnisharp-roslyn,sriramgd/omnisharp-roslyn,sreal/omnisharp-roslyn,khellang/omnisharp-roslyn,filipw/omnisharp-roslyn,sriramgd/omnisharp-roslyn,ChrisHel/omnisharp-roslyn,nabychan/omnisharp-roslyn,hach-que/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,fishg/omnisharp-roslyn,jtbm37/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,hach-que/omnisharp-roslyn,nabychan/omnisharp-roslyn,hal-ler/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,sreal/omnisharp-roslyn,hal-ler/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,haled/omnisharp-roslyn,jtbm37/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,hitesh97/omnisharp-roslyn,ChrisHel/omnisharp-roslyn
src/OmniSharp/Api/Navigation/OmnisharpController.FindImplementations.cs
src/OmniSharp/Api/Navigation/OmnisharpController.FindImplementations.cs
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.Text; using OmniSharp.Models; namespace OmniSharp { public partial class OmnisharpController { [HttpPost("findimplementations")] public async Task<IActionResult> FindImplementations([FromBody]Request request) { _workspace.EnsureBufferUpdated(request); var document = _workspace.GetDocument(request.FileName); var response = new QuickFixResponse(); if (document != null) { var semanticModel = await document.GetSemanticModelAsync(); var sourceText = await document.GetTextAsync(); var position = sourceText.Lines.GetPosition(new LinePosition(request.Line - 1, request.Column - 1)); var symbol = SymbolFinder.FindSymbolAtPosition(semanticModel, position, _workspace); var implementations = await SymbolFinder.FindImplementationsAsync(symbol, _workspace.CurrentSolution); var quickFixes = new List<QuickFix>(); foreach (var implementation in implementations) { foreach (var location in implementation.Locations) { AddQuickFix(quickFixes, location); } } response = new QuickFixResponse(quickFixes.OrderBy(q => q.FileName) .ThenBy(q => q.Line) .ThenBy(q => q.Column)); } return new ObjectResult(response); } } }
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.Text; using OmniSharp.Models; namespace OmniSharp { public partial class OmnisharpController { [HttpPost("findimplementations")] public async Task<IActionResult> FindImplementations([FromBody]Request request) { _workspace.EnsureBufferUpdated(request); var document = _workspace.GetDocument(request.FileName); var response = new QuickFixResponse(); if (document != null) { var semanticModel = await document.GetSemanticModelAsync(); var sourceText = await document.GetTextAsync(); var position = sourceText.Lines.GetPosition(new LinePosition(request.Line - 1, request.Column - 1)); var symbol = SymbolFinder.FindSymbolAtPosition(semanticModel, position, _workspace); var implementations = await SymbolFinder.FindImplementationsAsync(symbol, _workspace.CurrentSolution); var quickFixes = new List<QuickFix>(); foreach (var implementation in implementations) { foreach (var location in implementation.Locations) { AddQuickFix(quickFixes, location); } } response = new QuickFixResponse(quickFixes.OrderBy(q => q.FileName) .ThenBy(q => q.Line) .ThenBy(q => q.Column)); } return new ObjectResult(response); } } }
mit
C#
5ed7a1104a941295f1619e7120ed6028eb7d0422
Create mapping from NotificationOption to EditorConfig severity string.
shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,agocke/roslyn,AlekseyTs/roslyn,dotnet/roslyn,dotnet/roslyn,nguerrera/roslyn,KirillOsenkov/roslyn,abock/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,bartdesmet/roslyn,davkean/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,wvdd007/roslyn,mavasani/roslyn,panopticoncentral/roslyn,tannergooding/roslyn,nguerrera/roslyn,genlu/roslyn,AmadeusW/roslyn,stephentoub/roslyn,physhi/roslyn,abock/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,jmarolf/roslyn,eriawan/roslyn,diryboy/roslyn,tmat/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,reaction1989/roslyn,mavasani/roslyn,gafter/roslyn,bartdesmet/roslyn,heejaechang/roslyn,panopticoncentral/roslyn,gafter/roslyn,tmat/roslyn,davkean/roslyn,reaction1989/roslyn,AmadeusW/roslyn,agocke/roslyn,stephentoub/roslyn,jmarolf/roslyn,wvdd007/roslyn,weltkante/roslyn,panopticoncentral/roslyn,aelij/roslyn,aelij/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,abock/roslyn,weltkante/roslyn,brettfo/roslyn,AlekseyTs/roslyn,dotnet/roslyn,brettfo/roslyn,tannergooding/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,brettfo/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,diryboy/roslyn,AmadeusW/roslyn,weltkante/roslyn,physhi/roslyn,heejaechang/roslyn,eriawan/roslyn,agocke/roslyn,physhi/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,eriawan/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,tmat/roslyn,stephentoub/roslyn,KevinRansom/roslyn,diryboy/roslyn,davkean/roslyn
src/Workspaces/Core/Portable/Extensions/NotificationOptionExtensions.cs
src/Workspaces/Core/Portable/Extensions/NotificationOptionExtensions.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeStyle { internal static class NotificationOptionExtensions { public static string ToEditorConfigString(this NotificationOption notificationOption) { return notificationOption.Severity switch { ReportDiagnostic.Suppress => EditorConfigSeverityStrings.None, ReportDiagnostic.Hidden => EditorConfigSeverityStrings.Silent, ReportDiagnostic.Info => EditorConfigSeverityStrings.Suggestion, ReportDiagnostic.Warn => EditorConfigSeverityStrings.Warning, ReportDiagnostic.Error => EditorConfigSeverityStrings.Error, _ => throw ExceptionUtilities.Unreachable }; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.CodeStyle { internal static class NotificationOptionExtensions { public static string ToEditorConfigString(this NotificationOption notificationOption) { if (notificationOption == NotificationOption.Silent) { return nameof(NotificationOption.Silent).ToLowerInvariant(); } else { return notificationOption.ToString().ToLowerInvariant(); } } } }
mit
C#
d2264a428e7150adde0847524c26c725df5ca684
Support visual debugging of enum masks.
sschmid/Entitas-CSharp,sschmid/Entitas-CSharp
Entitas.Unity/Assets/Entitas/Unity/VisualDebugging/Entity/Editor/TypeDrawer/EnumTypeDrawer.cs
Entitas.Unity/Assets/Entitas/Unity/VisualDebugging/Entity/Editor/TypeDrawer/EnumTypeDrawer.cs
using System; using Entitas; using UnityEditor; namespace Entitas.Unity.VisualDebugging { public class EnumTypeDrawer : ITypeDrawer { public bool HandlesType(Type type) { return type.IsEnum; } public object DrawAndGetNewValue(Type memberType, string memberName, object value, Entity entity, int index, IComponent component) { if (memberType.IsDefined(typeof(FlagsAttribute), false)) { return EditorGUILayout.EnumMaskField(memberName, (Enum)value); } return EditorGUILayout.EnumPopup(memberName, (Enum)value); } } }
using System; using Entitas; using UnityEditor; namespace Entitas.Unity.VisualDebugging { public class EnumTypeDrawer : ITypeDrawer { public bool HandlesType(Type type) { return type.IsEnum; } public object DrawAndGetNewValue(Type memberType, string memberName, object value, Entity entity, int index, IComponent component) { return EditorGUILayout.EnumPopup(memberName, (Enum)value); } } }
mit
C#
a87828105034013bb549ded4cc9b96b47b33780a
Update Index.cshtml
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: June 29, 2021<br /><br /> <strong>Please Note Holiday Closure Information:</strong><br /><br /> The Lab will be closed on July 5, 2021<br /> </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p> <p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and waste water, and feed in support of agricultural and environmental research.</p> <p>For new clients, please note the drop-down menu under “Lab Information” which contains an “Order Completion Help” section to help guide you in creating a work order. Also helpful under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides brief descriptions of our current methods.</p> <p>Please feel free to contact the lab with any questions.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> <p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br> Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p> </address> <p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p> <p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and waste water, and feed in support of agricultural and environmental research.</p> <p>For new clients, please note the drop-down menu under “Lab Information” which contains an “Order Completion Help” section to help guide you in creating a work order. Also helpful under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides brief descriptions of our current methods.</p> <p>Please feel free to contact the lab with any questions.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> <p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br> Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p> </address> <p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p> </div>
mit
C#
2e9bcc9aca2083e7203729f968d812038daf1666
Update Index.cshtml
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Posted: April 6, 2020<br /><br /> We are scaling back to a bare minimum staff at this time. We will only be working on samples where immediate testing is essential. Assisting you with your research is very important to us and we are eager to return to full staffing as soon as it is safe.<br /> <br /> For the week of April 6-10, receiving will be open from 9am to noon.<br /><br /> Starting April 13th for sample drop-off please email us at <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a> to arrange a time to meet at receiving. If you need to ship samples to us, please email us with the expected delivery date.<br /><br /> Please use this option for samples requiring immediate testing for essential research. We can also arrange for receipt of more routine samples if proper storage of samples cannot be arranged in your own facility as we await a return to normal business operations.<br /><br /> Please monitor our homepage for updates and thank you for your patience!<br /><br /> Please be safe. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <h2 style="color: blue">Posted: April 6, 2020<br /><br /> We are scaling back to a bare minimum staff at this time. We will only be working on samples where immediate testing is essential. Assisting you with your research is very important to us and we are eager to return to full staffing as soon as it is safe.<br /> <br /> For the week of April 6-10, receiving will be open from 9am to noon.<br /><br /> Starting April 13th for sample drop-off please email us at <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a> to arrange a time to meet at receiving. If you need to ship samples to us, please email us with the expected delivery date.<br /><br /> Please use this option for samples requiring immediate testing for essential research. We can also arrange for receipt of more routine samples if proper storage of samples cannot be arranged in your own facility as we await a return to normal business operations.<br /><br /> Please monitor our homepage for updates and thank you for your patience!<br /><br /> Please be safe.</h2> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
mit
C#
02f784e20a95a6519502fe24d89243ba74965cfa
add getresponse
Terradue/DotNetOpenSearch
Terradue.OpenSearch/Terradue/OpenSearch/Response/HttpOpenSearchResponse.cs
Terradue.OpenSearch/Terradue/OpenSearch/Response/HttpOpenSearchResponse.cs
// // HttpOpenSearchResponse.cs // // Author: // Emmanuel Mathot <emmanuel.mathot@terradue.com> // // Copyright (c) 2014 Terradue using System; using Mono.Addins; using System.Collections.Generic; using System.Net; using System.Xml; using System.Diagnostics; using Terradue.OpenSearch.Result; using System.IO; namespace Terradue.OpenSearch.Response { /// <summary> /// OpenSearchResponse from a HTTP request /// </summary> public class HttpOpenSearchResponse : OpenSearchResponse<byte[]> { HttpWebResponse webResponse; TimeSpan requestTime; /// <summary> /// Initializes a new instance of the <see cref="Terradue.OpenSearch.HttpOpenSearchResponse"/> class. /// </summary> /// <param name="resp">Resp.</param> /// <param name="time">Time.</param> internal HttpOpenSearchResponse(HttpWebResponse resp, TimeSpan time){ webResponse = resp; requestTime = time; } #region implemented abstract members of OpenSearchResponse public override string ContentType { get { if (webResponse == null) return null; return webResponse.ContentType.Split(';')[0]; } } public override TimeSpan RequestTime { get { return requestTime; } } public override object GetResponseObject() { if (payload == null) { using (var ms = new MemoryStream()) { webResponse.GetResponseStream().CopyTo(ms); payload = ms.ToArray(); } } return payload; } public override IOpenSearchResponse CloneForCache() { GetResponseObject(); return new MemoryOpenSearchResponse((byte[])payload.Clone(), ContentType); } #endregion } }
// // HttpOpenSearchResponse.cs // // Author: // Emmanuel Mathot <emmanuel.mathot@terradue.com> // // Copyright (c) 2014 Terradue using System; using Mono.Addins; using System.Collections.Generic; using System.Net; using System.Xml; using System.Diagnostics; using Terradue.OpenSearch.Result; using System.IO; namespace Terradue.OpenSearch.Response { /// <summary> /// OpenSearchResponse from a HTTP request /// </summary> public class HttpOpenSearchResponse : OpenSearchResponse<byte[]> { HttpWebResponse webResponse; TimeSpan requestTime; /// <summary> /// Initializes a new instance of the <see cref="Terradue.OpenSearch.HttpOpenSearchResponse"/> class. /// </summary> /// <param name="resp">Resp.</param> /// <param name="time">Time.</param> internal HttpOpenSearchResponse(HttpWebResponse resp, TimeSpan time){ webResponse = resp; requestTime = time; } #region implemented abstract members of OpenSearchResponse public override string ContentType { get { if (webResponse == null) return null; return webResponse.ContentType.Split(';')[0]; } } public override TimeSpan RequestTime { get { return requestTime; } } public override object GetResponseObject() { if (payload == null) { using (var ms = new MemoryStream()) { webResponse.GetResponseStream().CopyTo(ms); payload = ms.ToArray(); } } return payload; } public override IOpenSearchResponse CloneForCache() { return new MemoryOpenSearchResponse(payload.Clone(), ContentType); } #endregion } }
agpl-3.0
C#
e3b2907bc3e813f3f6187f2e7481cbc8de601cc8
Fix build
allquixotic/banshee-gst-sharp-work,dufoli/banshee,lamalex/Banshee,ixfalia/banshee,babycaseny/banshee,GNOME/banshee,Dynalon/banshee-osx,Carbenium/banshee,lamalex/Banshee,arfbtwn/banshee,directhex/banshee-hacks,arfbtwn/banshee,babycaseny/banshee,Carbenium/banshee,mono-soc-2011/banshee,stsundermann/banshee,Carbenium/banshee,stsundermann/banshee,babycaseny/banshee,allquixotic/banshee-gst-sharp-work,eeejay/banshee,arfbtwn/banshee,lamalex/Banshee,arfbtwn/banshee,Dynalon/banshee-osx,eeejay/banshee,GNOME/banshee,petejohanson/banshee,GNOME/banshee,GNOME/banshee,directhex/banshee-hacks,Carbenium/banshee,babycaseny/banshee,dufoli/banshee,Dynalon/banshee-osx,Dynalon/banshee-osx,mono-soc-2011/banshee,babycaseny/banshee,babycaseny/banshee,GNOME/banshee,arfbtwn/banshee,dufoli/banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,ixfalia/banshee,petejohanson/banshee,lamalex/Banshee,allquixotic/banshee-gst-sharp-work,ixfalia/banshee,Dynalon/banshee-osx,babycaseny/banshee,lamalex/Banshee,eeejay/banshee,directhex/banshee-hacks,stsundermann/banshee,GNOME/banshee,lamalex/Banshee,stsundermann/banshee,Dynalon/banshee-osx,directhex/banshee-hacks,ixfalia/banshee,Dynalon/banshee-osx,ixfalia/banshee,mono-soc-2011/banshee,stsundermann/banshee,petejohanson/banshee,arfbtwn/banshee,ixfalia/banshee,babycaseny/banshee,eeejay/banshee,allquixotic/banshee-gst-sharp-work,Carbenium/banshee,mono-soc-2011/banshee,dufoli/banshee,dufoli/banshee,eeejay/banshee,mono-soc-2011/banshee,stsundermann/banshee,petejohanson/banshee,directhex/banshee-hacks,Dynalon/banshee-osx,directhex/banshee-hacks,GNOME/banshee,dufoli/banshee,arfbtwn/banshee,stsundermann/banshee,ixfalia/banshee,dufoli/banshee,ixfalia/banshee,petejohanson/banshee,GNOME/banshee,mono-soc-2011/banshee,petejohanson/banshee,arfbtwn/banshee,Carbenium/banshee,mono-soc-2011/banshee,allquixotic/banshee-gst-sharp-work,dufoli/banshee
src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerDatabaseStack.cs
src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerDatabaseStack.cs
// // PlaybackControllerDatabaseStack.cs // // Author: // Aaron Bockover <abockover@novell.com> // // Copyright (C) 2007 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Hyena; namespace Banshee.MediaEngine { internal class PlaybackControllerDatabaseStack<T> : IStackProvider<T> { public T Peek () { return default (T); } public T Pop () { return default (T); } public void Push (T t) { } public void Clear () { } public int Count { get { return 0; } } } }
// // PlaybackControllerDatabaseStack.cs // // Author: // Aaron Bockover <abockover@novell.com> // // Copyright (C) 2007 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Hyena; namespace Banshee.MediaEngine { internal class PlaybackControllerDatabaseStack : IStackProvider<PlaybackControllerAction> { public PlaybackControllerAction Peek () { return null; } public PlaybackControllerAction Pop () { return null; } public void Push (PlaybackControllerAction action) { } public void Clear () { } public int Count { get { return 0; } } } }
mit
C#
8a0fa732b0836eca9e979da2ce836fd3c582f8da
Make RequiredAttributeAdapter public
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RequiredAttributeAdapter.cs
src/Mvc/src/Microsoft.AspNetCore.Mvc.DataAnnotations/RequiredAttributeAdapter.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 System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.Extensions.Localization; namespace Microsoft.AspNetCore.Mvc.DataAnnotations { /// <summary> /// <see cref="AttributeAdapterBase{TAttribute}"/> for <see cref="RequiredAttribute"/>. /// </summary> public sealed class RequiredAttributeAdapter : AttributeAdapterBase<RequiredAttribute> { /// <summary> /// Initializes a new instance of <see cref="RequiredAttributeAdapter"/>. /// </summary> /// <param name="attribute">The <see cref="RequiredAttribute"/>.</param> /// <param name="stringLocalizer">The <see cref="IStringLocalizer"/>.</param> public RequiredAttributeAdapter(RequiredAttribute attribute, IStringLocalizer stringLocalizer) : base(attribute, stringLocalizer) { } /// <inheritdoc /> public override void AddValidation(ClientModelValidationContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } MergeAttribute(context.Attributes, "data-val", "true"); MergeAttribute(context.Attributes, "data-val-required", GetErrorMessage(context)); } /// <inheritdoc /> public override string GetErrorMessage(ModelValidationContextBase validationContext) { if (validationContext == null) { throw new ArgumentNullException(nameof(validationContext)); } return GetErrorMessage(validationContext.ModelMetadata, validationContext.ModelMetadata.GetDisplayName()); } } }
// 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 System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.Extensions.Localization; namespace Microsoft.AspNetCore.Mvc.DataAnnotations { internal class RequiredAttributeAdapter : AttributeAdapterBase<RequiredAttribute> { public RequiredAttributeAdapter(RequiredAttribute attribute, IStringLocalizer stringLocalizer) : base(attribute, stringLocalizer) { } public override void AddValidation(ClientModelValidationContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } MergeAttribute(context.Attributes, "data-val", "true"); MergeAttribute(context.Attributes, "data-val-required", GetErrorMessage(context)); } /// <inheritdoc /> public override string GetErrorMessage(ModelValidationContextBase validationContext) { if (validationContext == null) { throw new ArgumentNullException(nameof(validationContext)); } return GetErrorMessage(validationContext.ModelMetadata, validationContext.ModelMetadata.GetDisplayName()); } } }
apache-2.0
C#
1002934cda52c6e6922220c6fa4ada06e374faf1
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.7.*")]
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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.6.*")]
mit
C#
7759a685c2bb6c2161f569db7e94e57b6304cf17
fix constructor
CoditEU/lunchorder,CoditEU/lunchorder,CoditEU/lunchorder,CoditEU/lunchorder
backend/WebApi/Lunchorder.Api/App_Start/Configuration/Mapper/AddressMap.cs
backend/WebApi/Lunchorder.Api/App_Start/Configuration/Mapper/AddressMap.cs
using AutoMapper; namespace Lunchorder.Api.Configuration.Mapper { public class AddressMap : Profile { public AddressMap() { CreateMap<Domain.Entities.DocumentDb.Address, Domain.Dtos.Address>(); } } }
using AutoMapper; namespace Lunchorder.Api.Configuration.Mapper { public class AddressMap : Profile { protected AddressMap() { CreateMap<Domain.Entities.DocumentDb.Address, Domain.Dtos.Address>(); } } }
mit
C#
594c9ff8d9fc27ca2a7c6ef01487e5c524df875f
fix send-notification-detailed snippet
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
notifications/rest/notifications/send-notification-detailed/send-notification-detailed.5.x.cs
notifications/rest/notifications/send-notification-detailed/send-notification-detailed.5.x.cs
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp using System; using System.Collections.Generic; using Twilio; using Twilio.Rest.Notify.V1.Service; public class Example { public static void Main(string[] args) { // Find your Account SID and Auth Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; const string serviceSid = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; TwilioClient.Init(accountSid, authToken); var notification = NotificationResource.Create( serviceSid, identity: new List<string> { "00000001" }, title: "Generic loooooooong title for all Bindings", body: "This is the body for all Bindings", data: "{\"custom_key1\":\"custom value 1\"," + "\"custom_key2\":\"custom value 2\"}", fcm: "{\"notification\":{\"title\":\"New alert\"," + "\"body\" : \"Hello Bob!\"}}", apn: "{\"aps\" : " + "{ \"alert\": " + "{\"title\":\"New alert\"," + "\"body\" : \"Hello Bob!\"}}}"); Console.WriteLine(notification.Sid); } }
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp using System; using System.Collections.Generic; using Twilio; using Twilio.Rest.Notify.V1.Service; public class Example { public static void Main(string[] args) { // Find your Account SID and Auth Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; const string serviceSid = "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; TwilioClient.Init(accountSid, authToken); var notification = NotificationResource.Create( serviceSid, identity: new List<string> { "00000001" }, title: "Generic loooooooong title for all Bindings", body: "This is the body for all Bindings", data: "{\"custom_key1\":\"custom value 1\"," + "\"custom_key2\":\"custom value 2\"}", fcm: "{\"notification\":{\"title\":\"New alert\"," + "\"body\" : \"Hello Bob!\"}}", apn: "{\"aps\" : " + "{ \"alert\": " + "{\"title\":\"New alert\"," + "\"body\" : \"Hello Bob!\"}"); Console.WriteLine(notification.Sid); } }
mit
C#
f0b338ec70ce2ab90ed19651311d7e83119fd4b4
Remove IService interface
ahanusa/Peasy.NET,peasy/Peasy.NET,ahanusa/facile.net
Peasy/IService.cs
Peasy/IService.cs
using System.Collections.Generic; namespace Peasy { public interface IService<T, TKey> : ISupportGetAllCommand<T>, ISupportGetByIDCommand<T, TKey>, ISupportInsertCommand<T>, ISupportUpdateCommand<T>, ISupportDeleteCommand<TKey> { } public interface ISupportGetAllCommand<T> { ICommand<IEnumerable<T>> GetAllCommand(); } public interface ISupportGetByIDCommand<T, TKey> { ICommand<T> GetByIDCommand(TKey id); } public interface ISupportInsertCommand<T> { ICommand<T> InsertCommand(T entity); } public interface ISupportUpdateCommand<T> { ICommand<T> UpdateCommand(T entity); } public interface ISupportDeleteCommand<TKey> { ICommand DeleteCommand(TKey id); } }
using System.Collections.Generic; namespace Peasy { public interface IService { } public interface IService<T, TKey> : ISupportGetAllCommand<T>, ISupportGetByIDCommand<T, TKey>, ISupportInsertCommand<T>, ISupportUpdateCommand<T>, ISupportDeleteCommand<TKey> { } public interface ISupportGetAllCommand<T> : IService { ICommand<IEnumerable<T>> GetAllCommand(); } public interface ISupportGetByIDCommand<T, TKey> : IService { ICommand<T> GetByIDCommand(TKey id); } public interface ISupportInsertCommand<T> : IService { ICommand<T> InsertCommand(T entity); } public interface ISupportUpdateCommand<T> : IService { ICommand<T> UpdateCommand(T entity); } public interface ISupportDeleteCommand<TKey> : IService { ICommand DeleteCommand(TKey id); } }
mit
C#
5d072c8c727e72a9c280835be28f0d428165946e
fix vari csv
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
src/backend/SO115App.Persistence.File/CSVManagement/CSVTemplateManager.cs
src/backend/SO115App.Persistence.File/CSVManagement/CSVTemplateManager.cs
using CsvHelper; using CsvHelper.Configuration; using SO115App.Persistence.File.PDFManagement.TemplateModelForms; using System; using System.Collections.Generic; using System.Globalization; using System.IO; namespace SO115App.Persistence.File.CSVManagement { internal sealed class CSVTemplateManager<TemplateModelForm> : ICSVTemplateManager<TemplateModelForm> where TemplateModelForm : class { private MemoryStream memoryStream; private StreamWriter streamWriter; private CsvWriter csvWriter; public CSVTemplateManager() { memoryStream = new MemoryStream(); streamWriter = new StreamWriter(memoryStream); csvWriter = new CsvWriter(streamWriter, new CsvConfiguration(CultureInfo.InvariantCulture)); } public MemoryStream GenerateAndDownload(TemplateModelForm template, string fileName, string requestFolder) { switch (template) { case DettaglioChiamataModelForm model: generaDettaglioChiamataCSV(model); break; case DettaglioInterventoModelForm model: generaDettaglioInterventoCSV(model); break; case RiepilogoInterventiModelForm model: generaRiepilogoInterventoCSV(model); break; default: throw new NotImplementedException("Template non gestito"); } csvWriter.Flush(); return memoryStream; } private void generaDettaglioChiamataCSV(DettaglioChiamataModelForm model) { csvWriter.WriteRecords(new List<DettaglioChiamataModelForm>() { model }); } private void generaDettaglioInterventoCSV(DettaglioInterventoModelForm model) { csvWriter.WriteRecords(new List<DettaglioInterventoModelForm>() { model }); } private void generaRiepilogoInterventoCSV(RiepilogoInterventiModelForm model) { csvWriter.WriteRecords(model.lstRiepiloghi); } } }
using CsvHelper; using SO115App.Persistence.File.PDFManagement.TemplateModelForms; using System; using System.Globalization; using System.IO; namespace SO115App.Persistence.File.CSVManagement { internal sealed class CSVTemplateManager<TemplateModelForm> : ICSVTemplateManager<TemplateModelForm> where TemplateModelForm : class { private MemoryStream memoryStream; private StreamWriter streamWriter; private CsvWriter csvWriter; public CSVTemplateManager() { memoryStream = new MemoryStream(); streamWriter = new StreamWriter(memoryStream); csvWriter = new CsvWriter(streamWriter, CultureInfo.InvariantCulture); } public MemoryStream GenerateAndDownload(TemplateModelForm template, string fileName, string requestFolder) { switch (template) { case DettaglioChiamataModelForm model: generaDettaglioChiamataCSV(model); break; case DettaglioInterventoModelForm model: generaDettaglioInterventoCSV(model); break; case RiepilogoInterventiModelForm model: generaRiepilogoInterventoCSV(model); break; default: throw new NotImplementedException("Template non gestito"); } csvWriter.Flush(); return memoryStream; } private void generaDettaglioChiamataCSV(DettaglioChiamataModelForm model) { csvWriter.WriteRecord(model); } private void generaDettaglioInterventoCSV(DettaglioInterventoModelForm model) { csvWriter.WriteRecord(model); } private void generaRiepilogoInterventoCSV(RiepilogoInterventiModelForm model) { csvWriter.WriteRecord(model); } } }
agpl-3.0
C#
56494d3f4e08575fef0780f14de478fe742aeb27
Fix tests
MistyKuu/bitbucket-for-visual-studio,MistyKuu/bitbucket-for-visual-studio
Source/Tests/Integration/Bitbucket.REST.API.Integration.Tests/Clients/RepositoryClientTests.cs
Source/Tests/Integration/Bitbucket.REST.API.Integration.Tests/Clients/RepositoryClientTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Bitbucket.REST.API.Integration.Tests.Helpers; using BitBucket.REST.API; using BitBucket.REST.API.Models; using NUnit.Framework; namespace Bitbucket.REST.API.Integration.Tests.Clients { public class RepositoryClientTests { private BitbucketClient bitbucketClient; [SetUp] public void GlobalSetup() { var credentials = new Credentials(CredentialsHelper.TestsCredentials.Username, CredentialsHelper.TestsCredentials.Password); var connection = new Connection(credentials); bitbucketClient = new BitBucket.REST.API.BitbucketClient(connection, connection); } [Test] public void GetAllRepositories() { var repositories = bitbucketClient.RepositoriesClient.GetRepositories(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Bitbucket.REST.API.Integration.Tests.Helpers; using BitBucket.REST.API; using BitBucket.REST.API.Models; using NUnit.Framework; namespace Bitbucket.REST.API.Integration.Tests.Clients { public class RepositoryClientTests { private BitbucketClient bitbucketClient; [SetUp] public void GlobalSetup() { var credentials = new Credentials(CredentialsHelper.TestsCredentials.Username, CredentialsHelper.TestsCredentials.Password); var connection = new Connection(credentials); bitbucketClient = new BitBucket.REST.API.BitbucketClient(connection); } [Test] public void GetAllRepositories() { var repositories = bitbucketClient.RepositoriesClient.GetRepositories(); } } }
mit
C#
158c2c94c9f1783bb4d553c2b9c7720be3cb5aa7
remove unused / commented code
killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity
Assets/MixedRealityToolkit/EventDatum/SpatialAwareness/MixedRealitySpatialAwarenessEventData.cs
Assets/MixedRealityToolkit/EventDatum/SpatialAwareness/MixedRealitySpatialAwarenessEventData.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Core.Definitions.SpatialAwarenessSystem; using Microsoft.MixedReality.Toolkit.Core.Interfaces.SpatialAwarenessSystem.Observers; using UnityEngine; using UnityEngine.EventSystems; namespace Microsoft.MixedReality.Toolkit.Core.EventDatum.SpatialAwarenessSystem { /// <summary> /// Data for spatial awareness events. /// </summary> public class MixedRealitySpatialAwarenessEventData : GenericBaseEventData { /// <summary> /// Identifier of the object associated with this event. /// </summary> public int Id { get; private set; } /// <summary> /// Constructor. /// </summary> /// <param name="eventSystem"></param> public MixedRealitySpatialAwarenessEventData(EventSystem eventSystem) : base(eventSystem) { } /// <summary> /// Initialize the event data. /// </summary> /// <param name="observer">The <see cref="IMixedRealitySpatialAwarenessObserver"/> that raised the event.</param> /// <param name="id">The identifier of the observed spatial object.</param> public void Initialize(IMixedRealitySpatialAwarenessObserver observer, int id) { BaseInitialize(observer); Id = id; } } /// <summary> /// Data for spatial awareness events. /// </summary> /// <typeparam name="T">The spatial object data type.</typeparam> public class MixedRealitySpatialAwarenessEventData<T> : MixedRealitySpatialAwarenessEventData { /// <summary> /// The spatial object to which this event pertains. /// </summary> public T SpatialObject { get; private set; } /// <inheritdoc /> public MixedRealitySpatialAwarenessEventData(EventSystem eventSystem) : base(eventSystem) { } /// <summary> /// Initialize the event data. /// </summary> /// <param name="observer">The <see cref="IMixedRealitySpatialAwarenessObserver"/> that raised the event.</param> /// <param name="id">The identifier of the observed spatial object.</param> /// <param name="spatialObject">The observed spatial object.</param> public void Initialize(IMixedRealitySpatialAwarenessObserver observer, int id, T spatialObject) { Initialize(observer, id); SpatialObject = spatialObject; } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Core.Definitions.SpatialAwarenessSystem; using Microsoft.MixedReality.Toolkit.Core.Interfaces.SpatialAwarenessSystem.Observers; using UnityEngine; using UnityEngine.EventSystems; namespace Microsoft.MixedReality.Toolkit.Core.EventDatum.SpatialAwarenessSystem { /// <summary> /// Data for spatial awareness events. /// </summary> public class MixedRealitySpatialAwarenessEventData : GenericBaseEventData { /// <summary> /// Identifier of the object associated with this event. /// </summary> public int Id { get; private set; } ///// <summary> ///// <see cref="SpatialAwarenessMeshObject"/>, managed by the spatial awareness system, representing the data in this event. ///// </summary> //public SpatialAwarenessMeshObject MeshObject{ get; private set; } /// <summary> /// Constructor. /// </summary> /// <param name="eventSystem"></param> public MixedRealitySpatialAwarenessEventData(EventSystem eventSystem) : base(eventSystem) { } /// <summary> /// Initialize the event data. /// </summary> /// <param name="observer">The <see cref="IMixedRealitySpatialAwarenessObserver"/> that raised the event.</param> /// <param name="id">The identifier of the observed spatial object.</param> public void Initialize(IMixedRealitySpatialAwarenessObserver observer, int id) { BaseInitialize(observer); Id = id; } } /// <summary> /// Data for spatial awareness events. /// </summary> /// <typeparam name="T">The spatial object data type.</typeparam> public class MixedRealitySpatialAwarenessEventData<T> : MixedRealitySpatialAwarenessEventData { /// <summary> /// The spatial object to which this event pertains. /// </summary> public T SpatialObject { get; private set; } /// <inheritdoc /> public MixedRealitySpatialAwarenessEventData(EventSystem eventSystem) : base(eventSystem) { } /// <summary> /// Initialize the event data. /// </summary> /// <param name="observer">The <see cref="IMixedRealitySpatialAwarenessObserver"/> that raised the event.</param> /// <param name="id">The identifier of the observed spatial object.</param> /// <param name="spatialObject">The observed spatial object.</param> public void Initialize(IMixedRealitySpatialAwarenessObserver observer, int id, T spatialObject) { Initialize(observer, id); SpatialObject = spatialObject; } } }
mit
C#
90ae3ebbcd7103a94a9a0fdf122df3717d37edbf
fix C# code
google/or-tools,google/or-tools,or-tools/or-tools,google/or-tools,google/or-tools,or-tools/or-tools,or-tools/or-tools,google/or-tools,or-tools/or-tools,google/or-tools,or-tools/or-tools,or-tools/or-tools
examples/dotnet/csknapsack.cs
examples/dotnet/csknapsack.cs
// Copyright 2010-2018 Google LLC // 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 Google.OrTools.Algorithms; public class CsKnapsack { static void Main() { KnapsackSolver solver = new KnapsackSolver( KnapsackSolver.SolverType.KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER, "test"); long[] profits = { 360, 83, 59, 130, 431, 67, 230, 52, 93, 125, 670, 892, 600, 38, 48, 147, 78, 256, 63, 17, 120, 164, 432, 35, 92, 110, 22, 42, 50, 323, 514, 28, 87, 73, 78, 15, 26, 78, 210, 36, 85, 189, 274, 43, 33, 10, 19, 389, 276, 312 }; long[,] weights = { { 7, 0, 30, 22, 80, 94, 11, 81, 70, 64, 59, 18, 0, 36, 3, 8, 15, 42, 9, 0, 42, 47, 52, 32, 26, 48, 55, 6, 29, 84, 2, 4, 18, 56, 7, 29, 93, 44, 71, 3, 86, 66, 31, 65, 0, 79, 20, 65, 52, 13 } }; long[] capacities = { 850 }; long optimalProfit = 7534; Console.WriteLine("Solving knapsack with " + profits.Length + " items, and " + weights.GetLength(0) + " dimension"); solver.Init(profits, weights, capacities); long computedProfit = solver.Solve(); Console.WriteLine("Optimal Profit = " + computedProfit + ", expected = " + optimalProfit); } }
// Copyright 2010-2018 Google LLC // 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 Google.OrTools.Algorithms; public class CsKnapsack { static void Main() { KnapsackSolver solver = new KnapsackSolver( KnapsackSolver.KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER, "test"); long[] profits = { 360, 83, 59, 130, 431, 67, 230, 52, 93, 125, 670, 892, 600, 38, 48, 147, 78, 256, 63, 17, 120, 164, 432, 35, 92, 110, 22, 42, 50, 323, 514, 28, 87, 73, 78, 15, 26, 78, 210, 36, 85, 189, 274, 43, 33, 10, 19, 389, 276, 312 }; long[,] weights = { { 7, 0, 30, 22, 80, 94, 11, 81, 70, 64, 59, 18, 0, 36, 3, 8, 15, 42, 9, 0, 42, 47, 52, 32, 26, 48, 55, 6, 29, 84, 2, 4, 18, 56, 7, 29, 93, 44, 71, 3, 86, 66, 31, 65, 0, 79, 20, 65, 52, 13 } }; long[] capacities = { 850 }; long optimalProfit = 7534; Console.WriteLine("Solving knapsack with " + profits.Length + " items, and " + weights.GetLength(0) + " dimension"); solver.Init(profits, weights, capacities); long computedProfit = solver.Solve(); Console.WriteLine("Optimal Profit = " + computedProfit + ", expected = " + optimalProfit); } }
apache-2.0
C#
5a994adb225e7ed2eb14a3873937cbd90239ff3c
Enable NRT
jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,dotnet/roslyn,KevinRansom/roslyn,mavasani/roslyn,sharwell/roslyn,weltkante/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,weltkante/roslyn,KevinRansom/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,diryboy/roslyn,sharwell/roslyn,diryboy/roslyn
src/Analyzers/Core/CodeFixes/RemoveUnnecessaryImports/AbstractRemoveUnnecessaryImportsCodeFixProvider.cs
src/Analyzers/Core/CodeFixes/RemoveUnnecessaryImports/AbstractRemoveUnnecessaryImportsCodeFixProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.RemoveUnnecessaryImports { internal abstract class AbstractRemoveUnnecessaryImportsCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.DiagnosticFixableId); public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer; public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( new MyCodeAction( GetTitle(), c => RemoveUnnecessaryImportsAsync(context.Document, c)), context.Diagnostics); return Task.CompletedTask; } protected abstract string GetTitle(); private static Task<Document> RemoveUnnecessaryImportsAsync( Document document, CancellationToken cancellationToken) { var service = document.GetRequiredLanguageService<IRemoveUnnecessaryImportsService>(); return service.RemoveUnnecessaryImportsAsync(document, cancellationToken); } private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument) : base(title, createChangedDocument, title) { } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.RemoveUnnecessaryImports { internal abstract class AbstractRemoveUnnecessaryImportsCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.DiagnosticFixableId); public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer; public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( new MyCodeAction( GetTitle(), c => RemoveUnnecessaryImportsAsync(context.Document, c)), context.Diagnostics); return Task.CompletedTask; } protected abstract string GetTitle(); private static Task<Document> RemoveUnnecessaryImportsAsync( Document document, CancellationToken cancellationToken) { var service = document.GetLanguageService<IRemoveUnnecessaryImportsService>(); return service.RemoveUnnecessaryImportsAsync(document, cancellationToken); } private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument) : base(title, createChangedDocument, title) { } } } }
mit
C#
fdd5c50df33e63f0ee1b5c47815bbe391a77525d
Fix a region name
DotNetKit/DotNetKit.Wpf.Printing
DotNetKit.Wpf.Printing.Demo/Samples/MultipageReportSample/OrderFormPage.cs
DotNetKit.Wpf.Printing.Demo/Samples/MultipageReportSample/OrderFormPage.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DotNetKit.Windows.Controls; using DotNetKit.Windows.Documents; namespace DotNetKit.Wpf.Printing.Demo.Samples.MultipageReportSample { public sealed class OrderFormPage : IDataGridPrintable { public OrderFormHeader Header { get; } public IReadOnlyList<Order> Items { get; } #region IDataGridPrintable IEnumerable IDataGridPrintable.Items => Items; public object CreatePage(IEnumerable items, int pageIndex, int pageCount) { var header = Header.UpdatePageIndexCount(pageIndex, pageCount); return new OrderFormPage(header, items.OfType<Order>().ToArray()); } #endregion public OrderFormPage(OrderFormHeader header, IReadOnlyList<Order> items) { Header = header; Items = items; } /// <summary> /// Constructs with random data. /// </summary> public OrderFormPage() { Items = Enumerable.Range(1, 50) .Select(i => new Order($"Item {i}", i * 100)) .ToArray(); Header = new OrderFormHeader( "Foo Bar Inc.", new DateTime(2017, 01, 15), Items.Sum(item => item.TotalPrice), pageIndex: 0, pageCount: 1 ); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DotNetKit.Windows.Controls; using DotNetKit.Windows.Documents; namespace DotNetKit.Wpf.Printing.Demo.Samples.MultipageReportSample { public sealed class OrderFormPage : IDataGridPrintable { public OrderFormHeader Header { get; } public IReadOnlyList<Order> Items { get; } #region IDataGridReport IEnumerable IDataGridPrintable.Items => Items; public object CreatePage(IEnumerable items, int pageIndex, int pageCount) { var header = Header.UpdatePageIndexCount(pageIndex, pageCount); return new OrderFormPage(header, items.OfType<Order>().ToArray()); } #endregion public OrderFormPage(OrderFormHeader header, IReadOnlyList<Order> items) { Header = header; Items = items; } /// <summary> /// Constructs with random data. /// </summary> public OrderFormPage() { Items = Enumerable.Range(1, 50) .Select(i => new Order($"Item {i}", i * 100)) .ToArray(); Header = new OrderFormHeader( "Foo Bar Inc.", new DateTime(2017, 01, 15), Items.Sum(item => item.TotalPrice), pageIndex: 0, pageCount: 1 ); } } }
mit
C#
05d0fcbfffd21d7d6fc9f25da6bdde1f9fb6c489
Fix rotation on android.
jamesmontemagno/Hanselman.Forms,jamesmontemagno/Hanselman.Forms,bbqchickenrobot/Hanselman.Forms,Xerosigma/Hanselman.Forms,elkjaerit/Hanselman.Forms,jamesmontemagno/Hanselman.Forms,ahmedalejo/Hanselman.Forms,slombardo/Hanselman.Forms,paulpatarinski/Hanselman.Forms
Hanselman.Android/MainActivity.cs
Hanselman.Android/MainActivity.cs
using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Xamarin.Forms.Platform.Android; using Xamarin.Forms; using Android.Content.PM; namespace HanselmanAndroid { [Activity (Label = "Hanselman", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : AndroidActivity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Forms.Init(this, bundle); SetPage (Hanselman.Shared.HanselmanApp.RootPage); } } }
using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Xamarin.Forms.Platform.Android; using Xamarin.Forms; namespace HanselmanAndroid { [Activity (Label = "Hanselman", MainLauncher = true)] public class MainActivity : AndroidActivity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Forms.Init(this, bundle); SetPage (Hanselman.Shared.HanselmanApp.RootPage); } } }
mit
C#
feeefd8ba70c8f584b8f32d4afcc2ead1201c5c3
copy comments from base
gdziadkiewicz/octokit.net,SLdragon1989/octokit.net,yonglehou/octokit.net,forki/octokit.net,mminns/octokit.net,naveensrinivasan/octokit.net,alfhenrik/octokit.net,shiftkey-tester/octokit.net,fffej/octokit.net,eriawan/octokit.net,dampir/octokit.net,devkhan/octokit.net,hitesh97/octokit.net,shiftkey/octokit.net,octokit-net-test-org/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,hahmed/octokit.net,chunkychode/octokit.net,alfhenrik/octokit.net,SamTheDev/octokit.net,mminns/octokit.net,khellang/octokit.net,magoswiat/octokit.net,kdolan/octokit.net,michaKFromParis/octokit.net,ivandrofly/octokit.net,eriawan/octokit.net,thedillonb/octokit.net,cH40z-Lord/octokit.net,shiftkey/octokit.net,kolbasov/octokit.net,editor-tools/octokit.net,ChrisMissal/octokit.net,octokit/octokit.net,SmithAndr/octokit.net,Red-Folder/octokit.net,SmithAndr/octokit.net,fake-organization/octokit.net,M-Zuber/octokit.net,daukantas/octokit.net,darrelmiller/octokit.net,octokit-net-test/octokit.net,octokit/octokit.net,chunkychode/octokit.net,thedillonb/octokit.net,SamTheDev/octokit.net,gabrielweyer/octokit.net,TattsGroup/octokit.net,ivandrofly/octokit.net,hahmed/octokit.net,editor-tools/octokit.net,dampir/octokit.net,adamralph/octokit.net,yonglehou/octokit.net,devkhan/octokit.net,gabrielweyer/octokit.net,geek0r/octokit.net,gdziadkiewicz/octokit.net,M-Zuber/octokit.net,Sarmad93/octokit.net,shana/octokit.net,octokit-net-test-org/octokit.net,takumikub/octokit.net,rlugojr/octokit.net,shiftkey-tester/octokit.net,nsrnnnnn/octokit.net,shana/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,nsnnnnrn/octokit.net,dlsteuer/octokit.net,brramos/octokit.net,khellang/octokit.net,bslliw/octokit.net,TattsGroup/octokit.net,Sarmad93/octokit.net,rlugojr/octokit.net
Octokit/Clients/TagsClient.cs
Octokit/Clients/TagsClient.cs
using System.Threading.Tasks; namespace Octokit { public class TagsClient : ApiClient, ITagsClient { public TagsClient(IApiConnection apiConnection) : base(apiConnection) { } /// <summary> /// Gets a tag for a given repository by sha reference /// </summary> /// <remarks> /// http://developer.github.com/v3/git/tags/#get-a-tag /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">Tha sha reference of the tag</param> /// <returns></returns> public Task<GitTag> Get(string owner, string name, string reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); return ApiConnection.Get<GitTag>(ApiUrls.Tag(owner, name, reference)); } /// <summary> /// Create a tag for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/tags/#create-a-tag-object /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="tag">The tag to create</param> /// <returns></returns> public Task<GitTag> Create(string owner, string name, NewTag tag) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(tag, "tag"); return ApiConnection.Post<GitTag>(ApiUrls.CreateTag(owner, name), tag); } } }
using System.Threading.Tasks; namespace Octokit { public class TagsClient : ApiClient, ITagsClient { public TagsClient(IApiConnection apiConnection) : base(apiConnection) { } public Task<GitTag> Get(string owner, string name, string reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); return ApiConnection.Get<GitTag>(ApiUrls.Tag(owner, name, reference)); } public Task<GitTag> Create(string owner, string name, NewTag tag) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(tag, "tag"); return ApiConnection.Post<GitTag>(ApiUrls.CreateTag(owner, name), tag); } } }
mit
C#
166805c83390af1657b4dc82848880045d158db9
remove ports
NebcoOrganization/Yuffie,NebcoOrganization/Yuffie
WebApp/Program.cs
WebApp/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; namespace WebApp { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; namespace WebApp { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseUrls("http://0.0.0.0:5000") .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } } }
mit
C#
5caa637d432d84acb5fa67ae38ebfc6307fb54e6
バージョン番号を更新。
YKSoftware/YKToolkit.Controls
YKToolkit.Controls/Properties/AssemblyInfo.cs
YKToolkit.Controls/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("YKToolkit.Controls")] #if NET4 [assembly: AssemblyDescription(".NET Framework 4.0 用 の WPF カスタムコントロールライブラリです。")] #else [assembly: AssemblyDescription("WPF カスタムコントロールライブラリです。")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("YKSoftware")] [assembly: AssemblyProduct("YKToolkit.Controls")] [assembly: AssemblyCopyright("Copyright © 2015 YKSoftware")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly:ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("2.4.4.5")]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("YKToolkit.Controls")] #if NET4 [assembly: AssemblyDescription(".NET Framework 4.0 用 の WPF カスタムコントロールライブラリです。")] #else [assembly: AssemblyDescription("WPF カスタムコントロールライブラリです。")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("YKSoftware")] [assembly: AssemblyProduct("YKToolkit.Controls")] [assembly: AssemblyCopyright("Copyright © 2015 YKSoftware")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly:ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("2.4.4.4")]
mit
C#
6670082fee525385695d7e739c7d5303068550cf
change constructor paoramter to IProxyServiceProvider
AspectCore/AspectCore-Framework,AspectCore/AspectCore-Framework,AspectCore/Lite,AspectCore/Abstractions
src/AspectCore.Lite.DependencyInjection/Internal/ServiceProxyActivator.cs
src/AspectCore.Lite.DependencyInjection/Internal/ServiceProxyActivator.cs
using AspectCore.Lite.Abstractions; using AspectCore.Lite.Abstractions.Activators; using System; namespace AspectCore.Lite.DependencyInjection.Internal { internal class ServiceProxyActivator : IProxyActivator { private readonly IProxyServiceProvider serviceProvider; private readonly IProxyActivator proxyActivator; public ServiceProxyActivator(IProxyServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; this.proxyActivator = new ProxyActivator(serviceProvider); } public object CreateClassProxy(Type serviceType , object instance , params Type[] interfaceTypes) { return proxyActivator.CreateClassProxy(serviceType , instance , interfaceTypes); } public object CreateInterfaceProxy(Type serviceType , object instance , params Type[] interfaceTypes) { return proxyActivator.CreateInterfaceProxy(serviceType , instance , interfaceTypes); } } }
using AspectCore.Lite.Abstractions; using AspectCore.Lite.Abstractions.Activators; using System; namespace AspectCore.Lite.DependencyInjection.Internal { internal class ServiceProxyActivator : IProxyActivator { private readonly ISupportOriginalService serviceProvider; private readonly IProxyActivator proxyActivator; public ServiceProxyActivator(ISupportOriginalService serviceProvider) { this.serviceProvider = serviceProvider; this.proxyActivator = new ProxyActivator(serviceProvider); } public object CreateClassProxy(Type serviceType , object instance , params Type[] interfaceTypes) { return proxyActivator.CreateClassProxy(serviceType , instance , interfaceTypes); } public object CreateInterfaceProxy(Type serviceType , object instance , params Type[] interfaceTypes) { return proxyActivator.CreateInterfaceProxy(serviceType , instance , interfaceTypes); } } }
mit
C#
1891019910497f288b24f9fd6920900541aef84a
rename server tests
rjw57/streamkinect2.net
StreamKinect2Tests/ServerTests.cs
StreamKinect2Tests/ServerTests.cs
using System.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; using StreamKinect2; using System.Threading; using System.Collections.Generic; using System; using StreamKinect2Tests.Mocks; namespace StreamKinect2Tests { [TestClass] public class StoppedServerTests { // Re-initialised for each test private Server m_server; // Should be passed to Server.Start() private IZeroconfServiceBrowser m_mockZcBrowser; [TestInitialize] public void Initialize() { m_server = new Server(); m_mockZcBrowser = new MockZeroconfServiceBrowser(); } [TestCleanup] public void Cleanup() { // Dispose server m_server.Dispose(); m_server = null; } [TestMethod] public void ServerInitialized() { Assert.IsNotNull(m_server); } [TestMethod] public void ServerDoesNotStartImmediately() { Assert.IsFalse(m_server.IsRunning); } [TestMethod, Timeout(3000)] public void ServerDoesStartEventually() { Assert.IsFalse(m_server.IsRunning); m_server.Start(m_mockZcBrowser); while (!m_server.IsRunning) { Thread.Sleep(100); } m_server.Stop(); } } }
using System.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; using StreamKinect2; using System.Threading; using System.Collections.Generic; using System; using StreamKinect2Tests.Mocks; namespace StreamKinect2Tests { [TestClass] public class ServerTests { // Re-initialised for each test private Server m_server; // Should be passed to Server.Start() private IZeroconfServiceBrowser m_mockZcBrowser; [TestInitialize] public void Initialize() { m_server = new Server(); m_mockZcBrowser = new MockZeroconfServiceBrowser(); } [TestCleanup] public void Cleanup() { // Dispose server m_server.Dispose(); m_server = null; } [TestMethod] public void ServerInitialized() { Assert.IsNotNull(m_server); } [TestMethod] public void ServerDoesNotStartImmediately() { Assert.IsFalse(m_server.IsRunning); } [TestMethod, Timeout(3000)] public void ServerDoesStartEventually() { Assert.IsFalse(m_server.IsRunning); m_server.Start(m_mockZcBrowser); while (!m_server.IsRunning) { Debug.WriteLine("is server running: " + m_server.IsRunning); Thread.Sleep(100); } m_server.Stop(); } } }
bsd-2-clause
C#
e55c55b03025033d8500e89d31c354d948b9b854
remove todo only
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Portal/Application/Services/Commitments/Http/CommitmentsApiHttpClientFactory.cs
src/SFA.DAS.EAS.Portal/Application/Services/Commitments/Http/CommitmentsApiHttpClientFactory.cs
using System; using System.Net.Http; using SFA.DAS.EAS.Portal.Configuration; using SFA.DAS.Http; using SFA.DAS.Http.TokenGenerators; namespace SFA.DAS.EAS.Portal.Application.Services.Commitments.Http { public class CommitmentsApiHttpClientFactory : ICommitmentsApiHttpClientFactory { private readonly CommitmentsApiClientConfiguration _commitmentsApiClientConfiguration; public CommitmentsApiHttpClientFactory(CommitmentsApiClientConfiguration commitmentsApiClientConfiguration) { _commitmentsApiClientConfiguration = commitmentsApiClientConfiguration; } public HttpClient CreateHttpClient() { var httpClient = new HttpClientBuilder() .WithDefaultHeaders() .WithBearerAuthorisationHeader(new JwtBearerTokenGenerator(_commitmentsApiClientConfiguration)) .Build(); httpClient.BaseAddress = new Uri(_commitmentsApiClientConfiguration.BaseUrl); return httpClient; } } }
using System; using System.Net.Http; using SFA.DAS.EAS.Portal.Configuration; using SFA.DAS.Http; using SFA.DAS.Http.TokenGenerators; namespace SFA.DAS.EAS.Portal.Application.Services.Commitments.Http { public class CommitmentsApiHttpClientFactory : ICommitmentsApiHttpClientFactory { private readonly CommitmentsApiClientConfiguration _commitmentsApiClientConfiguration; public CommitmentsApiHttpClientFactory(CommitmentsApiClientConfiguration commitmentsApiClientConfiguration) { _commitmentsApiClientConfiguration = commitmentsApiClientConfiguration; } public HttpClient CreateHttpClient() { var httpClient = new HttpClientBuilder() .WithDefaultHeaders() .WithBearerAuthorisationHeader(new JwtBearerTokenGenerator(_commitmentsApiClientConfiguration)) .Build(); httpClient.BaseAddress = new Uri(_commitmentsApiClientConfiguration.BaseUrl); //todo: set timeout //httpClient.Timeout = TimeSpan.Parse(_recruitApiClientConfig.TimeoutTimeSpan); return httpClient; } } }
mit
C#
02f07532866ab6065ac58b22eee20cbd8767336e
Make sure the departure airport gets filled correctly.
lehmamic/columbus,lehmamic/columbus
Diskordia.Columbus.Bots.Host/Services/SingaporeAirlines/PageObjects/FareDealsSectionComponent.cs
Diskordia.Columbus.Bots.Host/Services/SingaporeAirlines/PageObjects/FareDealsSectionComponent.cs
using System; using System.Collections.Generic; using System.Linq; using OpenQA.Selenium; namespace Diskordia.Columbus.Bots.Host.Services.SingaporeAirlines.PageObjects { public class FareDealsSectionComponent { private readonly IWebDriver driver; private readonly IWebElement element; public FareDealsSectionComponent(IWebDriver driver, IWebElement element) { if (driver == null) { throw new ArgumentNullException(nameof(driver)); } if (element == null) { throw new ArgumentNullException(nameof(element)); } this.driver = driver; this.element = element; } public string DepartureAirport { get { return this.element.FindElement(By.ClassName("select__text")).Text; } } public IEnumerable<FareDealsListItemComponent> FareDeals { get { return this.element.FindElements(By.CssSelector(".fare-deals-list li")) .Where(e => !string.IsNullOrWhiteSpace(e.FindElement(By.ClassName("link")).Text)) .Select(e => new FareDealsListItemComponent(this.driver, e)); } } } }
using System; using System.Collections.Generic; using System.Linq; using OpenQA.Selenium; namespace Diskordia.Columbus.Bots.Host.Services.SingaporeAirlines.PageObjects { public class FareDealsSectionComponent { private readonly IWebDriver driver; private readonly IWebElement element; public FareDealsSectionComponent(IWebDriver driver, IWebElement element) { if (driver == null) { throw new ArgumentNullException(nameof(driver)); } if (element == null) { throw new ArgumentNullException(nameof(element)); } this.driver = driver; this.element = element; } public string DepartureAirport { get { return this.driver.FindElement(By.ClassName("select__text")).Text; } } public IEnumerable<FareDealsListItemComponent> FareDeals { get { return this.driver.FindElements(By.CssSelector(".fare-deals-list li")) .Where(e => !string.IsNullOrWhiteSpace(e.FindElement(By.ClassName("link")).Text)) .Select(e => new FareDealsListItemComponent(this.driver, e)); } } } }
mit
C#
190390f63324ad00eff97ddf33d5834c7f763e37
Implement UnitTest for ReceiptPageViewModel#TakePhotoAsyncCommand.
ProjectBlueMonkey/BlueMonkey,ProjectBlueMonkey/BlueMonkey
client/BlueMonkey/BlueMonkey.ViewModel.Tests/ReceiptPageViewModelTest.cs
client/BlueMonkey/BlueMonkey.ViewModel.Tests/ReceiptPageViewModelTest.cs
using System.ComponentModel; using System.IO; using System.Windows.Media; using BlueMonkey.MediaServices; using BlueMonkey.Model; using BlueMonkey.ViewModels; using Moq; using Xunit; namespace BlueMonkey.ViewModel.Tests { public class ReceiptPageViewModelTest { [Fact] public void ReceiptProperty() { var editExpense = new Mock<IEditExpense>(); var actual = new ReceiptPageViewModel(editExpense.Object); Assert.NotNull(actual.Receipt); Assert.Null(actual.Receipt.Value); var image = File.ReadAllBytes("lena.jpg"); editExpense.Setup(m => m.Receipt).Returns(new MediaFile(".jpg", image)); editExpense.Raise(m => m.PropertyChanged += null, new PropertyChangedEventArgs("Receipt")); Assert.NotNull(actual.Receipt.Value); // ImageSource doesn't expose any mechanism to retrieve the original byte array. // For this reason, the test will give up by ImageSource. } [Fact] public void PickPhotoAsyncCommand() { var editExpense = new Mock<IEditExpense>(); var actual = new ReceiptPageViewModel(editExpense.Object); Assert.NotNull(actual.PickPhotoAsyncCommand); Assert.True(actual.PickPhotoAsyncCommand.CanExecute()); actual.PickPhotoAsyncCommand.Execute(); editExpense.Verify(m => m.PickPhotoAsync(), Times.Once); } [Fact] public void TakePhotoAsyncCommand() { var editExpense = new Mock<IEditExpense>(); var actual = new ReceiptPageViewModel(editExpense.Object); Assert.NotNull(actual.TakePhotoAsyncCommand); Assert.True(actual.TakePhotoAsyncCommand.CanExecute()); actual.TakePhotoAsyncCommand.Execute(); editExpense.Verify(m => m.TakePhotoAsync(), Times.Once); } } }
using System.ComponentModel; using System.IO; using System.Windows.Media; using BlueMonkey.MediaServices; using BlueMonkey.Model; using BlueMonkey.ViewModels; using Moq; using Xunit; namespace BlueMonkey.ViewModel.Tests { public class ReceiptPageViewModelTest { [Fact] public void ReceiptProperty() { var editExpense = new Mock<IEditExpense>(); var actual = new ReceiptPageViewModel(editExpense.Object); Assert.NotNull(actual.Receipt); Assert.Null(actual.Receipt.Value); var image = File.ReadAllBytes("lena.jpg"); editExpense.Setup(m => m.Receipt).Returns(new MediaFile(".jpg", image)); editExpense.Raise(m => m.PropertyChanged += null, new PropertyChangedEventArgs("Receipt")); Assert.NotNull(actual.Receipt.Value); // ImageSource doesn't expose any mechanism to retrieve the original byte array. // For this reason, the test will give up by ImageSource. } [Fact] public void PickPhotoAsyncCommand() { var editExpense = new Mock<IEditExpense>(); var actual = new ReceiptPageViewModel(editExpense.Object); Assert.NotNull(actual.PickPhotoAsyncCommand); Assert.True(actual.PickPhotoAsyncCommand.CanExecute()); actual.PickPhotoAsyncCommand.Execute(); editExpense.Verify(m => m.PickPhotoAsync(), Times.Once); } } }
mit
C#
14d2eb02440f14ea94af9169fca24f19cbed6fd7
Throw on null syntax or errors.
PenguinF/sandra-three
Eutherion/Shared/Text/Json/RootJsonSyntax.cs
Eutherion/Shared/Text/Json/RootJsonSyntax.cs
#region License /********************************************************************************* * RootJsonSyntax.cs * * Copyright (c) 2004-2019 Henk Nicolai * * 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 System.Collections.Generic; namespace Eutherion.Text.Json { /// <summary> /// Contains the syntax tree and list of parse errors which are the result of parsing json. /// </summary> public sealed class RootJsonSyntax { public JsonMultiValueSyntax Syntax { get; } public List<JsonErrorInfo> Errors { get; } public RootJsonSyntax(JsonMultiValueSyntax syntax, List<JsonErrorInfo> errors) { Syntax = syntax ?? throw new ArgumentNullException(nameof(syntax)); Errors = errors ?? throw new ArgumentNullException(nameof(errors)); } } }
#region License /********************************************************************************* * RootJsonSyntax.cs * * Copyright (c) 2004-2019 Henk Nicolai * * 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; namespace Eutherion.Text.Json { /// <summary> /// Contains the syntax tree and list of parse errors which are the result of parsing json. /// </summary> public sealed class RootJsonSyntax { public JsonMultiValueSyntax Syntax { get; } public List<JsonErrorInfo> Errors { get; } public RootJsonSyntax(JsonMultiValueSyntax syntax, List<JsonErrorInfo> errors) { Syntax = syntax; Errors = errors; } } }
apache-2.0
C#
b97b46ed7b7e6a7562c8327a51d7ba2adde6720a
Add a new pinkie event
pingzing/k-christmas-2016
KChristmas.AzureFunctions/GetPinkieEvents.cs
KChristmas.AzureFunctions/GetPinkieEvents.cs
using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System.Collections.Generic; using KChristmas.Models; namespace KChristmas.AzureFunctions { public static class GetPinkieEvents { private static readonly List<PinkieEvent> _storedPinkieEvents = new List<PinkieEvent> { new PinkieEvent(Guid.Parse("c7d8c4d5-3d75-4ee9-ac80-51a68b5ea1c9")) { { "pinkie_confused.png", "Soooooo...", 2000 }, { null, "I don't get it.", 3000 }, { null, "Shouldn't all this shaking break the present?", 3000 }, { "pinkie_bounce_up_3.png", "Unless...", 3000 }, { null, "It's a SHAKE-POWERED-PRESENT! AHHHH!", 4000 } }, new PinkieEvent(Guid.Parse("d09f236d-cc83-477c-b159-7d6c0a32cf9a")) { { null, "My head is all spinny...", 4000 }, { null, "SHAKE HARDER! Wheeeee!", 3000 } } }; [FunctionName("GetPinkieEvents")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation($"Returning PinkieEvents at {DateTime.UtcNow}"); string pinkieEventsJson = JsonConvert.SerializeObject(_storedPinkieEvents); return new OkObjectResult(pinkieEventsJson); } } }
using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System.Collections.Generic; using KChristmas.Models; namespace KChristmas.AzureFunctions { public static class GetPinkieEvents { private static readonly List<PinkieEvent> _storedPinkieEvents = new List<PinkieEvent> { new PinkieEvent(Guid.Parse("c7d8c4d5-3d75-4ee9-ac80-51a68b5ea1c9")) { { "pinkie_confused.png", "Soooooo...", 2000 }, { null, "I don't get it.", 3000 }, { null, "Shouldn't all this shaking break the present?", 3000 }, { "pinkie_bounce_up_3.png", "Unless...", 3000 }, { null, "It's a SHAKE-POWERED-PRESENT! AHHHH!", 4000 } }, }; [FunctionName("GetPinkieEvents")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation($"Returning PinkieEvents at {DateTime.UtcNow}"); string pinkieEventsJson = JsonConvert.SerializeObject(_storedPinkieEvents); return new OkObjectResult(pinkieEventsJson); } } }
mit
C#
8fcd713fb5675cc5fd19ded751605dc435d3b7a6
remove interface stub (#1653)
exercism/xcsharp,exercism/xcsharp
exercises/concept/remote-control-competition/RemoteControlCompetition.cs
exercises/concept/remote-control-competition/RemoteControlCompetition.cs
using System; using System.Collections.Generic; // TODO implement the IRemoteControlCar interface public class ProductionRemoteControlCar { public int DistanceTravelled { get; private set; } public int NumberOfVictories { get; set; } public void Drive() { DistanceTravelled += 10; } } public class ExperimentalRemoteControlCar { public int DistanceTravelled { get; private set; } public void Drive() { DistanceTravelled += 20; } } public static class TestTrack { public static void Race(IRemoteControlCar car) { throw new NotImplementedException($"Please implement the (static) TestTrack.Race() method"); } public static List<ProductionRemoteControlCar> GetRankedCars(ProductionRemoteControlCar prc1, ProductionRemoteControlCar prc2) { throw new NotImplementedException($"Please implement the (static) TestTrack.GetRankedCars() method"); } }
using System; using System.Collections.Generic; public interface IRemoteControlCar { // TODO implement the IRemoteControlCar interface } public class ProductionRemoteControlCar { public int DistanceTravelled { get; private set; } public int NumberOfVictories { get; set; } public void Drive() { DistanceTravelled += 10; } } public class ExperimentalRemoteControlCar { public int DistanceTravelled { get; private set; } public void Drive() { DistanceTravelled += 20; } } public static class TestTrack { public static void Race(IRemoteControlCar car) { throw new NotImplementedException($"Please implement the (static) TestTrack.Race() method"); } public static List<ProductionRemoteControlCar> GetRankedCars(ProductionRemoteControlCar prc1, ProductionRemoteControlCar prc2) { throw new NotImplementedException($"Please implement the (static) TestTrack.GetRankedCars() method"); } }
mit
C#
e69a7c92841c457a1f01f237c2474d99fb70100c
Update generate-twiml-dynamic-sms.5.x.cs
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
rest/messages/generate-twiml-dynamic-sms/generate-twiml-dynamic-sms.5.x.cs
rest/messages/generate-twiml-dynamic-sms/generate-twiml-dynamic-sms.5.x.cs
// In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.TwiML; public class HelloWorldController : TwilioController { [HttpPost] public ActionResult Index() { var requestBody = Request.Form["Body"]; var response = new MessagingResponse(); if(requestBody == "hello") { response.Message("Hi!"); } else if(requestBody == "bye") { response.Message("Goodbye"); } return TwiML(response); } }
// In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.TwiML; public class HelloWorldController : TwilioController { [HttpPost] public ActionResult Index() { const string requestBody = Request.Form["Body"]; var response = new MessagingResponse(); if(requestBody == "hello") { response.Message("Hi!"); } else if(requestBody == "bye") { response.Message("Goodbye"); } return TwiML(response); } }
mit
C#
d7eb5e8d1a3cdc1c10639c94b308b80ee7ed8c3e
change resource name variable to private
takenet/blip-sdk-csharp
src/Take.Blip.Builder/Variables/BaseResourceVariableProvider.cs
src/Take.Blip.Builder/Variables/BaseResourceVariableProvider.cs
using Lime.Protocol; using Lime.Protocol.Network; using Lime.Protocol.Serialization; using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Take.Blip.Client; namespace Take.Blip.Builder.Variables { public class BaseResourceVariableProvider : IVariableProvider { private readonly ISender _sender; private readonly IDocumentSerializer _documentSerializer; private readonly string _resourceName; public VariableSource Source => throw new NotImplementedException(); public BaseResourceVariableProvider(ISender sender, IDocumentSerializer documentSerializer, string resourceName) { _sender = sender; _documentSerializer = documentSerializer; _resourceName = resourceName ?? throw new ArgumentNullException(nameof(resourceName)); } public async Task<string> GetVariableAsync(string name, IContext context, CancellationToken cancellationToken) { try { var resourceCommandResult = await ExecuteGetResourceCommandAsync(name, cancellationToken); if (resourceCommandResult.Status != CommandStatus.Success) { return null; } if (!resourceCommandResult.Resource.GetMediaType().IsJson) { return resourceCommandResult.Resource.ToString(); } return _documentSerializer.Serialize(resourceCommandResult.Resource); } catch (LimeException ex) when (ex.Reason.Code == ReasonCodes.COMMAND_RESOURCE_NOT_FOUND) { return null; } } private async Task<Command> ExecuteGetResourceCommandAsync(string name, CancellationToken cancellationToken) { // We are sending the command directly here because the Extension requires us to know the type. var getResourceCommand = new Command() { Uri = new LimeUri($"/{_resourceName}/{Uri.EscapeDataString(name)}"), Method = CommandMethod.Get, }; var resourceCommandResult = await _sender.ProcessCommandAsync( getResourceCommand, cancellationToken); return resourceCommandResult; } } }
using Lime.Protocol; using Lime.Protocol.Network; using Lime.Protocol.Serialization; using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Take.Blip.Client; namespace Take.Blip.Builder.Variables { public class BaseResourceVariableProvider : IVariableProvider { private readonly ISender _sender; private readonly IDocumentSerializer _documentSerializer; protected readonly string _resourceName; public VariableSource Source => throw new NotImplementedException(); public BaseResourceVariableProvider(ISender sender, IDocumentSerializer documentSerializer, string resourceName) { _sender = sender; _documentSerializer = documentSerializer; _resourceName = resourceName ?? throw new ArgumentNullException(nameof(resourceName)); } public async Task<string> GetVariableAsync(string name, IContext context, CancellationToken cancellationToken) { try { var resourceCommandResult = await ExecuteGetResourceCommandAsync(name, cancellationToken); if (resourceCommandResult.Status != CommandStatus.Success) { return null; } if (!resourceCommandResult.Resource.GetMediaType().IsJson) { return resourceCommandResult.Resource.ToString(); } return _documentSerializer.Serialize(resourceCommandResult.Resource); } catch (LimeException ex) when (ex.Reason.Code == ReasonCodes.COMMAND_RESOURCE_NOT_FOUND) { return null; } } private async Task<Command> ExecuteGetResourceCommandAsync(string name, CancellationToken cancellationToken) { // We are sending the command directly here because the Extension requires us to know the type. var getResourceCommand = new Command() { Uri = new LimeUri($"/{_resourceName}/{Uri.EscapeDataString(name)}"), Method = CommandMethod.Get, }; var resourceCommandResult = await _sender.ProcessCommandAsync( getResourceCommand, cancellationToken); return resourceCommandResult; } } }
apache-2.0
C#
3c6af8a5f7b341fd559de5dded999197c42bf472
Update InjectInvokeHandlerContextBehavior.cs
SimonCropp/NServiceBus.Serilog
src/NServiceBus.Serilog/LogInjection/InjectInvokeHandlerContextBehavior.cs
src/NServiceBus.Serilog/LogInjection/InjectInvokeHandlerContextBehavior.cs
using System; using System.Threading.Tasks; using NServiceBus; using NServiceBus.Pipeline; using NServiceBus.Serilog; class InjectInvokeHandlerContextBehavior : Behavior<IInvokeHandlerContext> { public class Registration : RegisterStep { public Registration() : base( stepId: $"Serilog{nameof(InjectInvokeHandlerContextBehavior)}", behavior: typeof(InjectInvokeHandlerContextBehavior), description: "Injects handler type into the logger") { } } public override async Task Invoke(IInvokeHandlerContext context, Func<Task> next) { var handler = context.HandlerType(); var bag = context.Extensions; var exceptionLogState = bag.Get<ExceptionLogState>(); exceptionLogState.HandlerType = handler; exceptionLogState.IncomingMessage = context.MessageBeingHandled; var forContext = context.Logger().ForContext("Handler", handler); try { bag.Set("SerilogHandlerLogger", forContext); await next(); } finally { bag.Remove("SerilogHandlerLogger"); } } }
using System; using System.Threading.Tasks; using NServiceBus; using NServiceBus.Pipeline; using NServiceBus.Serilog; class InjectInvokeHandlerContextBehavior : Behavior<IInvokeHandlerContext> { public class Registration : RegisterStep { public Registration() : base( stepId: $"Serilog{nameof(InjectInvokeHandlerContextBehavior)}", behavior: typeof(InjectInvokeHandlerContextBehavior), description: "Injects handler type into the logger") { } } public override async Task Invoke(IInvokeHandlerContext context, Func<Task> next) { var handler = context.HandlerType(); var exceptionLogState = context.Extensions.Get<ExceptionLogState>(); exceptionLogState.HandlerType = handler; exceptionLogState.IncomingMessage = context.MessageBeingHandled; var forContext = context.Logger().ForContext("Handler", handler); try { context.Extensions.Set("SerilogHandlerLogger", forContext); await next(); } finally { context.Extensions.Remove("SerilogHandlerLogger"); } } }
mit
C#
5d2f150faf670d00784a1f8749e098089d496a77
Fix typos
wwwwwwzx/3DSRNGTool
3DSRNGTool/Pokemon/Lead.cs
3DSRNGTool/Pokemon/Lead.cs
namespace Pk3DSRNGTool { public enum Lead { None, // Nature Synchronize, // Gender CuteCharmM, CuteCharmF, // Encounter slots Static, MagnetPull, // Held item CompoundEyes, // Fishing SuctionCups, // Level PressureHustleSpirit, IntimidateKeenEye, } }
namespace Pk3DSRNGTool { public enum Lead { None, // Ability Synchronize, // Gender CuteCharmM, CuteCharmF, // Encounter slots Static, MagnetPull, // Held item CompoundEyes, // Fishing SuctionCups, // Levels PressureHustleSpirit, IntimidateKeenEye, } }
mit
C#
57bc54d5d144908a33fa7bf1707b9fd1dfef6f02
Test for #3277
DotNetAnalyzers/StyleCopAnalyzers
StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/ReadabilityRules/SA1129CSharp9UnitTests.cs
StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/ReadabilityRules/SA1129CSharp9UnitTests.cs
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. namespace StyleCop.Analyzers.Test.CSharp9.ReadabilityRules { using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Testing; using StyleCop.Analyzers.Test.CSharp8.ReadabilityRules; using Xunit; using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier< StyleCop.Analyzers.ReadabilityRules.SA1129DoNotUseDefaultValueTypeConstructor, StyleCop.Analyzers.ReadabilityRules.SA1129CodeFixProvider>; public class SA1129CSharp9UnitTests : SA1129CSharp8UnitTests { /// <summary> /// Verifies that target type new expressions for value types will generate diagnostics. /// </summary> /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns> [Fact] public async Task VerifyValueTypeWithTargetTypeNewAsync() { var testCode = @"struct S { internal static S F() { S s = {|#0:new()|}; return s; } } "; var fixedTestCode = @"struct S { internal static S F() { S s = default; return s; } } "; DiagnosticResult[] expected = { Diagnostic().WithLocation(0), }; await VerifyCSharpFixAsync(testCode, expected, fixedTestCode, CancellationToken.None).ConfigureAwait(false); } } }
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. namespace StyleCop.Analyzers.Test.CSharp9.ReadabilityRules { using StyleCop.Analyzers.Test.CSharp8.ReadabilityRules; public class SA1129CSharp9UnitTests : SA1129CSharp8UnitTests { } }
mit
C#
7fbd5198b28f16624b1f935957ca0891e2169495
Tweak to use typed GetCustomAttributes from field
mattgwagner/CertiPay.Common
CertiPay.Common/ExtensionMethods.cs
CertiPay.Common/ExtensionMethods.cs
using System; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; namespace CertiPay.Common { public static class ExtensionMethods { /// <summary> /// Trims the string of any whitestace and leaves null if there is no content. /// </summary> public static String TrimToNull(this String s) { return String.IsNullOrWhiteSpace(s) ? null : s.Trim(); } /// <summary> /// Returns the display name from the display attribute on the enumeration, if available. /// Otherwise returns the ToString() value. /// </summary> public static string DisplayName(this Enum val) { return val.Display(e => e.GetName()); } /// <summary> /// Returns the short name from the display attribute on the enumeration, if available. /// Otherwise returns the ToString() value. /// </summary> public static string ShortName(this Enum val) { return val.Display(e => e.GetShortName()); } /// <summary> /// Returns the description from the display attribute on the enumeration, if available. /// Otherwise returns the ToString() value. /// </summary> public static string Description(this Enum val) { return val.Display(e => e.GetDescription()); } private static String Display(this Enum val, Func<DisplayAttribute, String> selector) { FieldInfo fi = val.GetType().GetField(val.ToString()); var attributes = fi.GetCustomAttributes<DisplayAttribute>(); if (attributes != null && attributes.Any()) { return selector.Invoke(attributes.First()); } return val.ToString(); } } }
using System; using System.ComponentModel.DataAnnotations; using System.Reflection; namespace CertiPay.Common { public static class ExtensionMethods { /// <summary> /// Trims the string of any whitestace and leaves null if there is no content. /// </summary> public static String TrimToNull(this String s) { return String.IsNullOrWhiteSpace(s) ? null : s.Trim(); } /// <summary> /// Returns the display name from the display attribute on the enumeration, if available. /// Otherwise returns the ToString() value. /// </summary> public static string DisplayName(this Enum val) { return val.Display(e => e.GetName()); } /// <summary> /// Returns the short name from the display attribute on the enumeration, if available. /// Otherwise returns the ToString() value. /// </summary> public static string ShortName(this Enum val) { return val.Display(e => e.GetShortName()); } /// <summary> /// Returns the description from the display attribute on the enumeration, if available. /// Otherwise returns the ToString() value. /// </summary> public static string Description(this Enum val) { return val.Display(e => e.GetDescription()); } private static String Display(this Enum val, Func<DisplayAttribute, String> selector) { FieldInfo fi = val.GetType().GetField(val.ToString()); DisplayAttribute[] attributes = (DisplayAttribute[])fi.GetCustomAttributes(typeof(DisplayAttribute), false); if (attributes != null && attributes.Length > 0) { return selector.Invoke(attributes[0]); } return val.ToString(); } } }
mit
C#
f966e5e1c65edb6d0555e19edccbbf41c28da04c
Update InjectInvokeHandlerContextBehavior.cs
SimonCropp/NServiceBus.Serilog
src/NServiceBus.Serilog/LogInjection/InjectInvokeHandlerContextBehavior.cs
src/NServiceBus.Serilog/LogInjection/InjectInvokeHandlerContextBehavior.cs
using System; using System.Threading.Tasks; using NServiceBus; using NServiceBus.Pipeline; class InjectInvokeHandlerContextBehavior : Behavior<IInvokeHandlerContext> { public class Registration : RegisterStep { public Registration() : base( stepId: $"Serilog{nameof(InjectInvokeHandlerContextBehavior)}", behavior: typeof(InjectInvokeHandlerContextBehavior), description: "Injects logger into the handler context") { } } public override async Task Invoke(IInvokeHandlerContext context, Func<Task> next) { var handler = context.HandlerType(); var bag = context.Extensions; var exceptionLogState = bag.Get<ExceptionLogState>(); exceptionLogState.IncomingMessage = context.MessageBeingHandled; var forContext = context.Logger().ForContext("Handler", handler); try { bag.Set("SerilogHandlerLogger", forContext); await next(); } finally { bag.Remove("SerilogHandlerLogger"); } } }
using System; using System.Threading.Tasks; using NServiceBus; using NServiceBus.Pipeline; class InjectInvokeHandlerContextBehavior : Behavior<IInvokeHandlerContext> { public class Registration : RegisterStep { public Registration() : base( stepId: $"Serilog{nameof(InjectInvokeHandlerContextBehavior)}", behavior: typeof(InjectInvokeHandlerContextBehavior), description: "Injects handler type into the logger") { } } public override async Task Invoke(IInvokeHandlerContext context, Func<Task> next) { var handler = context.HandlerType(); var bag = context.Extensions; var exceptionLogState = bag.Get<ExceptionLogState>(); exceptionLogState.IncomingMessage = context.MessageBeingHandled; var forContext = context.Logger().ForContext("Handler", handler); try { bag.Set("SerilogHandlerLogger", forContext); await next(); } finally { bag.Remove("SerilogHandlerLogger"); } } }
mit
C#