content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using System; using System.Runtime.Serialization; /// <summary> /// Class identifying a session. /// </summary> [DataContract] public sealed class SessionId { public SessionId() { Id = Guid.NewGuid(); } public SessionId(Guid id) { Id = id; } [DataMember] public static SessionId Empty { get; } = new SessionId(Guid.Empty); [DataMember] public Guid Id { get; } public override bool Equals(object obj) { return obj is SessionId sessionId && Id.Equals(sessionId.Id); } public override int GetHashCode() { return Id.GetHashCode(); } public override string ToString() { return Id.ToString("B"); } }
21.222222
101
0.653403
[ "MIT" ]
lbussell/vstest
src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/Session.cs
955
C#
using System.Collections; using System.Collections.Generic; using Assets.AdminMap.Scripts.MapConfiguration; using UnityEngine; public class SolarHouse : UnityObject { private static Vector3 sizeSpan = new Vector3(17, 10, 17); public override Vector3 SizeInTiles() { return sizeSpan; } private static GameObjectType type = GameObjectType.SolarHouse; public override GameObjectType Type() { return type; } public override List<TileType> CanBePlacedOn() { return new List<TileType>() { TileType.Grass }; } }
20.233333
67
0.660626
[ "MIT" ]
CityFever/CityFever
Assets/AdminMap/Scripts/GameObjects/Buildings/SolarHouse.cs
609
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Description : MonoBehaviour { [SerializeField] private string _objectTitle; [TextArea] [SerializeField] private string _description; public string ObjectTitle { get { return _objectTitle; } set { _objectTitle = value; } } public string ObjectDescription { get { return _description; } set { _description = value; } } }
16.730769
40
0.74023
[ "Apache-2.0" ]
JavaFrame/GPPCC12-Game
GPPCC12-Game/Assets/script/item/Description.cs
437
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; using System; /// <summary>Registers a tool with the migrate project.</summary> /// <remarks> /// [OpenAPI] RegisterTool=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/registerTool" /// </remarks> [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Register, @"AzMigrateProjectTool_RegisterExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Registers a tool with the migrate project.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] public partial class RegisterAzMigrateProjectTool_RegisterExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { /// <summary>A unique id generatd for the this cmdlet when it is instantiated.</summary> private string __correlationId = System.Guid.NewGuid().ToString(); /// <summary>A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet)</summary> private global::System.Management.Automation.InvocationInfo __invocationInfo; /// <summary>A unique id generatd for the this cmdlet when ProcessRecord() is called.</summary> private string __processRecordId; /// <summary> /// The <see cref="global::System.Threading.CancellationTokenSource" /> for this operation. /// </summary> private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); /// <summary>Backing field for <see cref="AcceptLanguage" /> property.</summary> private string _acceptLanguage; /// <summary> /// Standard request header. Used by service to respond to client in appropriate language. /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Standard request header. Used by service to respond to client in appropriate language.")] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, ReadOnly = false, Description = @"Standard request header. Used by service to respond to client in appropriate language.", SerializedName = @"Accept-Language", PossibleTypes = new [] { typeof(string) })] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Header)] public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } /// <summary>Wait for .NET debugger to attach</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } /// <summary>The reference to the client API class.</summary> public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; /// <summary> /// The credentials, account, tenant, and subscription used for communication with Azure /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } /// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } /// <summary>SendAsync Pipeline Steps to be prepended to the front of the pipeline</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } /// <summary>Backing field for <see cref="InputBody" /> property.</summary> private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput _inputBody= new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.RegisterToolInput(); /// <summary>Class representing the register tool input.</summary> private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput InputBody { get => this._inputBody; set => this._inputBody = value; } /// <summary>Accessor for our copy of the InvocationInfo.</summary> public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// <summary> /// <see cref="IEventListener" /> cancellation delegate. Stops the cmdlet when called. /// </summary> global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; /// <summary><see cref="IEventListener" /> cancellation token.</summary> global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// <summary>Backing field for <see cref="MigrateProjectName" /> property.</summary> private string _migrateProjectName; /// <summary>Name of the Azure Migrate project.</summary> [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Azure Migrate project.")] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = true, ReadOnly = false, Description = @"Name of the Azure Migrate project.", SerializedName = @"migrateProjectName", PossibleTypes = new [] { typeof(string) })] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] public string MigrateProjectName { get => this._migrateProjectName; set => this._migrateProjectName = value; } /// <summary> /// The instance of the <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.HttpPipeline" /> that the remote call will use. /// </summary> private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.HttpPipeline Pipeline { get; set; } /// <summary>The URI for the proxy server to use</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] public global::System.Uri Proxy { get; set; } /// <summary>Credentials for a proxy server to use for the remote call</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] [global::System.Management.Automation.ValidateNotNull] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } /// <summary>Use the default credentials for the proxy</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } /// <summary>Backing field for <see cref="ResourceGroupName" /> property.</summary> private string _resourceGroupName; /// <summary>Name of the Azure Resource Group that migrate project is part of.</summary> [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Azure Resource Group that migrate project is part of.")] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = true, ReadOnly = false, Description = @"Name of the Azure Resource Group that migrate project is part of.", SerializedName = @"resourceGroupName", PossibleTypes = new [] { typeof(string) })] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } /// <summary>Backing field for <see cref="SubscriptionId" /> property.</summary> private string _subscriptionId; /// <summary>Azure Subscription Id in which migrate project was created.</summary> [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = true, ReadOnly = false, Description = @"Azure Subscription Id in which migrate project was created.", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( Name = @"", Description =@"", Script = @"(Get-AzContext).Subscription.Id")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } /// <summary>Gets or sets the tool to be registered.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the tool to be registered.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, ReadOnly = false, Description = @"Gets or sets the tool to be registered.", SerializedName = @"tool", PossibleTypes = new [] { typeof(string) })] public string Tool { get => InputBody.Tool ?? null; set => InputBody.Tool = value; } /// <summary> /// <c>overrideOnOk</c> will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegistrationResult" /// /> from the remote call</param> /// <param name="returnNow">/// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing )</param> partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegistrationResult> response, ref global::System.Threading.Tasks.Task<bool> returnNow); /// <summary> /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// </summary> protected override void BeginProcessing() { Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); } ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } /// <summary>Performs clean-up after the command execution</summary> protected override void EndProcessing() { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } /// <summary>Handles/Dispatches events during the call to the REST service.</summary> /// <param name="id">The message id</param> /// <param name="token">The message cancellation token. When this call is cancelled, this should be <c>true</c></param> /// <param name="messageData">Detailed message data for the message event.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the message is completed. /// </returns> async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func<Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventData> messageData) { using( NoSynchronizationContext ) { if (token.IsCancellationRequested) { return ; } switch ( id ) { case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: { WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); return ; } case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: { WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); return ; } case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: { var data = messageData(); WriteInformation(data.Message, new string[]{}); return ; } case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: { WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); return ; } case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Error: { WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } } await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; } WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); } } /// <summary>Performs execution of the command.</summary> protected override void ProcessRecord() { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } __processRecordId = System.Guid.NewGuid().ToString(); try { // work if (ShouldProcess($"Call remote 'MigrateProjectsRegisterTool' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) { asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); } } } catch (global::System.AggregateException aggregateException) { // unroll the inner exceptions to get the root cause foreach( var innerException in aggregateException.Flatten().InnerExceptions ) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } // Write exception out to error channel. WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); } } catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } // Write exception out to error channel. WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); } finally { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); } } /// <summary>Performs execution of the command, working asynchronously if required.</summary> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed. /// </returns> protected async global::System.Threading.Tasks.Task ProcessRecordAsync() { using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); } if (null != HttpPipelineAppend) { Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); } // get the client instance try { await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await this.Client.MigrateProjectsRegisterTool(SubscriptionId, ResourceGroupName, MigrateProjectName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, InputBody, onOk, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) { WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MigrateProjectName=MigrateProjectName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null,body=InputBody}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); } finally { await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); } } } /// <summary> /// Intializes a new instance of the <see cref="RegisterAzMigrateProjectTool_RegisterExpanded" /> cmdlet class. /// </summary> public RegisterAzMigrateProjectTool_RegisterExpanded() { } /// <summary>Interrupts currently running code within the command.</summary> protected override void StopProcessing() { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); base.StopProcessing(); } /// <summary>a delegate that is called when the remote service returns 200 (OK).</summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegistrationResult" /// /> from the remote call</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed. /// </returns> private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegistrationResult> response) { using( NoSynchronizationContext ) { var _returnNow = global::System.Threading.Tasks.Task<bool>.FromResult(false); overrideOnOk(responseMessage, response, ref _returnNow); // if overrideOnOk has returned true, then return right away. if ((null != _returnNow && await _returnNow)) { return ; } // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegistrationResult WriteObject((await response).IsRegistered); } } } }
73.23545
459
0.679587
[ "MIT" ]
Agazoth/azure-powershell
src/Migrate/generated/cmdlets/RegisterAzMigrateProjectTool_RegisterExpanded.cs
27,306
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNextGen.Network.V20190901.Inputs { /// <summary> /// Properties of the FirewallPolicyFilterRuleAction. /// </summary> public sealed class FirewallPolicyFilterRuleActionArgs : Pulumi.ResourceArgs { /// <summary> /// The type of action. /// </summary> [Input("type")] public InputUnion<string, Pulumi.AzureNextGen.Network.V20190901.FirewallPolicyFilterRuleActionType>? Type { get; set; } public FirewallPolicyFilterRuleActionArgs() { } } }
29.275862
127
0.683157
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/dotnet/Network/V20190901/Inputs/FirewallPolicyFilterRuleActionArgs.cs
849
C#
// Copyright (c) 2019 Alachisoft // // 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 Alachisoft.NCache.Caching.Util; using Alachisoft.NCache.Common; using Alachisoft.NCache.Common.Protobuf; using Alachisoft.NCache.Common.Protobuf.Util; using Alachisoft.NCache.Runtime; using Alachisoft.NCache.Runtime.Events; using System; using System.Collections; using System.IO; using Alachisoft.NCache.Common.Caching; using Alachisoft.NCache.Common.ErrorHandling; using Alachisoft.NCache.Runtime.Exceptions; namespace Alachisoft.NCache.Client { internal sealed class AddCommand : CommandBase { private Alachisoft.NCache.Common.Protobuf.AddCommand _addCommand; private short _itemAdded; private int _methodOverload; internal AddCommand(string key, byte[] value, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short removeCallback, short updateCallback, short dsItemAddedCallback, bool isResyncExpiredItems, short itemAdded, bool isAsync, Hashtable queryInfo, BitSet flagMap, string providerName, string resyncProviderName, bool encryption, string cacheId, EventDataFilter updateDataFilter, EventDataFilter removeDataFilter, int methodOverload, string clientId, string typeName) { base.name = "AddCommand"; base.asyncCallbackSpecified = isAsync && itemAdded != -1 ? true : false; base.isAsync = isAsync; base.key = key; _itemAdded = itemAdded; _addCommand = new Alachisoft.NCache.Common.Protobuf.AddCommand(); if (absoluteExpiration.Equals(Cache.DefaultAbsolute.ToUniversalTime())) _addCommand.absExpiration = 1; else if (absoluteExpiration.Equals(Cache.DefaultAbsoluteLonger.ToUniversalTime())) _addCommand.absExpiration = 2; else if (absoluteExpiration != Cache.NoAbsoluteExpiration) _addCommand.absExpiration = absoluteExpiration.Ticks; if (slidingExpiration.Equals(Cache.DefaultSliding)) _addCommand.sldExpiration = 1; else if (slidingExpiration.Equals(Cache.DefaultSlidingLonger)) _addCommand.sldExpiration = 2; else if (slidingExpiration != Cache.NoSlidingExpiration) _addCommand.sldExpiration = slidingExpiration.Ticks; UserBinaryObject ubObject = UserBinaryObject.CreateUserBinaryObject(value); _addCommand.key = key; _addCommand.data.AddRange(ubObject.DataList); _addCommand.requestId = base.RequestId; _addCommand.updateCallbackId = updateCallback; _addCommand.removeCallbackId = removeCallback; _addCommand.datasourceItemAddedCallbackId = dsItemAddedCallback; _addCommand.isAsync = isAsync; _addCommand.priority = (int)priority; _addCommand.isResync = isResyncExpiredItems; _addCommand.flag = flagMap.Data; _addCommand.providerName = providerName; _addCommand.resyncProviderName = resyncProviderName; _addCommand.updateDataFilter = (short)updateDataFilter; _addCommand.removeDataFilter = (short)removeDataFilter; // Client ID: Must not have value except ClientCache. _addCommand.clientID = clientId; _methodOverload = methodOverload; } internal short AsycItemAddedOpComplete { get { return _itemAdded; } } internal override CommandType CommandType { get { return CommandType.ADD; } } internal override RequestType CommandRequestType { get { return RequestType.AtomicWrite; } } internal override bool IsSafe { get { return false; } } protected override void SerializeCommandInternal(Stream stream) { ProtoBuf.Serializer.Serialize(stream, _addCommand); } protected override short GetCommandHandle() { return (short)Common.Protobuf.Command.Type.ADD; } protected override void CreateCommand() { if (_addCommand.sldExpiration != 0) { if (!(_addCommand.absExpiration == 1 || _addCommand.absExpiration == 0)) throw new ArgumentException("You cannot set both sliding and absolute expirations on the same cache item"); } _addCommand.commandID = this._commandID; _addCommand.requestId = base.RequestId; _addCommand.version = "4200"; _addCommand.MethodOverload = _methodOverload; } } }
41.444444
507
0.674263
[ "Apache-2.0" ]
delsoft/NCache
Src/NCClient/Web/RemoteClient/Command/AddCommand.cs
5,222
C#
/* MIT License Copyright (c) 2011-2019 Markus Wendt (http://www.dodoni-project.net) All rights reserved. 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. Please see http://www.dodoni-project.net/ for more information concerning the Dodoni.net project. */ using System; using System.Text; using System.Numerics; using System.Collections.Generic; using Dodoni.MathLibrary.Basics; using Dodoni.MathLibrary.Basics.LowLevel; namespace Dodoni.MathLibrary.Basics.LowLevel.BuildIn { /// <summary>Serves as managed code implementation of BLAS level 2 operations. /// </summary> /// <remarks>Some of the methods are straightforward ports of the Fortran implementation (http://www.netlib.org/blas). It is recommended to use wrapper of a native code implementation. /// </remarks> internal partial class BuildInLevel2BLAS : ILevel2BLAS { /// <summary>Performs a rank-1 update (conjuaged) of a general matrix, i.e. A := \alpha * x * conj(y^t) + A. /// </summary> /// <param name="m">The number of rows of matrix A.</param> /// <param name="n">The number of columns of matrix A.</param> /// <param name="alpha">The scalar \alpha.</param> /// <param name="x">The vector x with at least 1 + (<paramref name="m" />-1) * |<paramref name="incX" />| elements.</param> /// <param name="y">The vector y with at least 1 + (<paramref name="n" />-1) * |<paramref name="incY" />| elements.</param> /// <param name="a">The matrix A of dimension (<paramref name="lda" />, <paramref name="n" />) supplied column-by-column.</param> /// <param name="lda">The leading dimension of <paramref name="a" />, must be at least max(1,<paramref name="m" />).</param> /// <param name="incX">The increment for the elements of <paramref name="x" />.</param> /// <param name="incY">The increment for the elements of <paramref name="y" />.</param> public void zgerc(int m, int n, Complex alpha, Complex[] x, Complex[] y, Complex[] a, int lda, int incX = 1, int incY = 1) { if (m == 0 || n == 0 || alpha == 0.0) { return; } int jy = 0; int kx = 0; for (int j = 0; j < n; j++) { Complex temp = alpha * Complex.Conjugate(y[jy]); int ix = kx; for (int i = 0; i < m; i++) { a[i + j * lda] += x[ix] * temp; ix += incX; } jy += incY; } } } }
48.202703
188
0.634707
[ "MIT" ]
dodoni/dodoni.net
BasicMathLibrary/Basics/LowLevel/BLAS/BuildIn/BuildInLevel2BLAS.zgerc.cs
3,569
C#
// © 2021 by Benjamin Skeen // Licensed to be used under the MIT license. // See the LICENSE file in the project root for more information. namespace Dapper.Wrappers { /// <summary> /// Contains metadata for a merge operation (either an insert or update). /// </summary> public class MergeOperationMetadata : QueryOperationMetadata { /// <summary> /// The column referenced by the insert or update operation. /// </summary> public string ReferencedColumn { get; set; } public bool IsRequired { get; set; } } }
29.8
78
0.625839
[ "MIT" ]
bskeen/Dapper.Wrappers
src/Dapper.Wrappers/MergeOperationMetadata.cs
599
C#
using Alachisoft.NCache.Web.SessionState.Serialization; namespace Alachisoft.NCache.Web.SessionState { internal class NCacheCoreSessionStore: SessionStoreBase { protected override object DeserializeSession(byte[] buffer, int timeout) { return SessionSerializer.Deserialize(buffer); } protected override byte[] SerializeSession(object sessionData) { NCacheSessionData session = sessionData as NCacheSessionData; return SessionSerializer.Serialize(session); } public override object CreateNewStoreData(IAspEnvironmentContext context, int timeOut) { return new NCacheSessionData(); } protected override object CreateEmptySession(IAspEnvironmentContext context, int sessionTimeout) { var session = new NCacheSessionData(); session.Items.Add(NCacheStatics.EmptySessionFlag, null); return session; } } }
32.096774
104
0.672362
[ "Apache-2.0" ]
Alachisoft/NCache
SessionState/ASP.NET Core/NCacheSessionServices/NCacheSessionServices/NCacheCoreSessionStore.cs
997
C#
using System.Collections.Generic; using System.Net; using ExitGames.Client.Photon; using GameFramework.Event; using IPhotonChannel = GameFramework.Photon.IPhotonChannel; using UnityEngine; using UnityGameFramework.Runtime; namespace SG1 { public class TestPageModel : UGuiFormModel<TestPage, TestPageModel> { public void OnTapConnect() { Page.Connect(); } public void OnTapSendMessage() { Page.SendMessage(); } } // public class TestPage : UGuiFormPage<TestPage, TestPageModel>, IPhotonPeerListener // { // PhotonPeer peer; // // // Start is called before the first frame update // protected override void OnOpen(object userData) // { // base.OnOpen(userData); // } // // public void Connect() // { // peer = new PhotonPeer(this, ConnectionProtocol.Udp); // peer.Connect("192.168.1.249:5055", "SGServer"); // peer.Service(); // } // // // Update is called once per frame // protected override void OnUpdate(float elapseSeconds, float realElapseSeconds) // { // base.OnUpdate(elapseSeconds, realElapseSeconds); // if (peer != null) // { // peer.Service(); // } // } // // public void SendMessage() // { // if (peer.PeerState == PeerStateValue.Connected) // { // Dictionary<byte, object> data = new Dictionary<byte, object>(); // data.Add(0, 1); // data.Add(1, "abc"); // peer.OpCustom(4, data, true); //1:请求 2:事件 // } // } // // //当游戏关闭的时候(停止运行)调用OnDestroy // protected override void OnClose(object userData) // { // //如果peer不等于空并且状态为正在连接 // if (peer != null && peer.PeerState == PeerStateValue.Connected) // { // peer.Disconnect(); //断开连接 // } // // base.OnClose(userData); // } // // public void DebugReturn(DebugLevel level, string message) // { // } // // //如果客户端没有发起请求,但是服务器端向客户端通知一些事情的时候就会通过OnEvent来进行响应 // public void OnEvent(EventData eventData) // { // Debug.Log(eventData.Code); // switch (eventData.Code) // { // case 0: // Log.Info("收到服务器发过来的事件 :" + eventData.Code); // Dictionary<byte, object> data3 = eventData.Parameters; // object intvalue; // data3.TryGetValue(1, out intvalue); // object stringValue; // data3.TryGetValue(2, out stringValue); // Log.Info(intvalue.ToString() + " " + stringValue.ToString()); // break; // default: // Log.Info("收到服务器发过来的事件 :" + eventData.Code); // Dictionary<byte, object> data4 = eventData.Parameters; // Log.Info(data4.Count); // object intvalue4; // data4.TryGetValue(1, out intvalue4); // Log.Info(intvalue4.ToString() + " "); // break; // } // } // // //当我们在客户端向服务器端发起请求后,服务器端接受处理这个请求给客户端一个响应就会在这个方法里进行处理 // public void OnOperationResponse(OperationResponse operationResponse) // { // Debug.Log(operationResponse.ToStringFull()); // switch (operationResponse.OperationCode) // { // case 1: // Log.Info("收到了服务器端的响应"); // //接受服务器的数据 // Dictionary<byte, object> data = operationResponse.Parameters; // object intValue; // object StringValue; // data.TryGetValue(1, out intValue); // data.TryGetValue(2, out StringValue); // // Log.Info("数据信息:" + intValue.ToString() + StringValue.ToString()); // break; // default: // break; // } // } // // //如果连接状态发生改变的时候就会触发这个方法。 // //连接状态有五种,正在连接中(PeerStateValue.Connecting),已经连接上(PeerStateValue.Connected),正在断开连接中( PeerStateValue.Disconnecting),已经断开连接(PeerStateValue.Disconnected),正在进行初始化(PeerStateValue.InitializingApplication) // public void OnStatusChanged(StatusCode statusCode) // { // Log.Info(statusCode + "^^^^"); // } // } //} public class TestPage : UGuiFormPage<TestPage, TestPageModel> { private IPhotonChannel m_PhotonChannel; [SerializeField] private string m_IP = "127.0.0.1"; [SerializeField] private int m_Port = 5055; public void Connect() { m_PhotonChannel.Connect(IPAddress.Parse(m_IP), m_Port, ConnectionProtocol.Udp); } public void SendMessage() { Dictionary<byte, object> data = new Dictionary<byte, object>(); data.Add(0, 1); data.Add(1, "abc"); m_PhotonChannel.SendRequset(4, data, true); //1:请求 2:事件 } protected override void OnOpen(object userData) { base.OnOpen(userData); m_PhotonChannel = GameEntry.Photon.HasPhotonChannel("SGServer") ? GameEntry.Photon.GetPhotonChannel("SGServer") : GameEntry.Photon.CreatePhotonChannel("SGServer"); GameEntry.Event.Subscribe(PhotonEventEventArgs.EventId, OnPhotonEventEvent); GameEntry.Event.Subscribe(PhotonOperationResponseEventArgs.EventId, OnPhotonOperationResponse); GameEntry.Event.Subscribe(PhotonStatusChangedEventArgs.EventId, OnPhotonStatusChanged); } private void OnPhotonEventEvent(object sender, GameEventArgs e) { PhotonEventEventArgs ne = e as PhotonEventEventArgs; if (ne.PhotonChannel != m_PhotonChannel) { return; } var eventData = ne.EventData; switch (eventData.Code) { case 0: Log.Info("收到服务器发过来的事件 :" + eventData.Code); Dictionary<byte, object> data3 = eventData.Parameters; object intvalue; data3.TryGetValue(1, out intvalue); object stringValue; data3.TryGetValue(2, out stringValue); Debug.Log(intvalue.ToString() + " " + stringValue.ToString()); break; default: Log.Info("收到服务器发过来的事件 :" + eventData.Code); Dictionary<byte, object> data4 = eventData.Parameters; Debug.Log(data4.Count); object intvalue4; data4.TryGetValue(1, out intvalue4); Debug.Log(intvalue4.ToString() + " "); break; } } private void OnPhotonOperationResponse(object sender, GameEventArgs e) { PhotonOperationResponseEventArgs ne = e as PhotonOperationResponseEventArgs; if (ne.PhotonChannel != m_PhotonChannel) { return; } var operationResponse = ne.OperationResponse; Debug.Log(operationResponse.ToStringFull()); switch (operationResponse.OperationCode) { case 1: Log.Info("收到了服务器端的响应"); //接受服务器的数据 Dictionary<byte, object> data = operationResponse.Parameters; object intValue; object StringValue; data.TryGetValue(1, out intValue); data.TryGetValue(2, out StringValue); // Debug.Log("数据信息:" + intValue.ToString() + StringValue.ToString()); break; default: break; } } private void OnPhotonStatusChanged(object sender, GameEventArgs e) { PhotonStatusChangedEventArgs ne = e as PhotonStatusChangedEventArgs; if (ne.PhotonChannel != m_PhotonChannel) { return; } Log.Info(ne.StatusCode); } protected override void OnClose(object userData) { GameEntry.Event.Unsubscribe(PhotonEventEventArgs.EventId, OnPhotonEventEvent); GameEntry.Event.Unsubscribe(PhotonOperationResponseEventArgs.EventId, OnPhotonOperationResponse); GameEntry.Event.Unsubscribe(PhotonStatusChangedEventArgs.EventId, OnPhotonStatusChanged); base.OnClose(userData); } } }
35.745968
207
0.529385
[ "BSD-3-Clause" ]
JohnConstine/untiy
Assets/GameMain/Scripts/UI/UILogic/TestPage.cs
9,445
C#
//------------------------------------------------------------------------------ // <auto-generated /> // // This file was automatically generated by SWIG (http://www.swig.org). // Version 4.0.2 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ namespace NWN.Native.API { public unsafe class CNWSCombatRound : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; internal CNWSCombatRound(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CNWSCombatRound obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } ~CNWSCombatRound() { Dispose(false); } public void Dispose() { Dispose(true); global::System.GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { lock(this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; NWNXLibPINVOKE.delete_CNWSCombatRound(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } } } /*@SWIG:/__w/NWN.Native/NWN.Native/nwnx/Plugins/SWIG/SWIG_DotNET/DotNETExtensions.i,1,SWIG_DOTNET_EXTENSIONS@*/ public global::System.IntPtr Pointer { get { return swigCPtr.Handle; } } public static unsafe implicit operator void*(CNWSCombatRound self) { return (void*)self.swigCPtr.Handle; } public static unsafe CNWSCombatRound FromPointer(void* pointer, bool memoryOwn = false) { return pointer != null ? new CNWSCombatRound((global::System.IntPtr)pointer, memoryOwn) : null; } public static CNWSCombatRound FromPointer(global::System.IntPtr pointer, bool memoryOwn = false) { return pointer != global::System.IntPtr.Zero ? new CNWSCombatRound(pointer, memoryOwn) : null; } public bool Equals(CNWSCombatRound other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return Pointer.Equals(other.Pointer); } public override bool Equals(object obj) { return ReferenceEquals(this, obj) || obj is CNWSCombatRound other && Equals(other); } public override int GetHashCode() { return swigCPtr.Handle.GetHashCode(); } public static bool operator ==(CNWSCombatRound left, CNWSCombatRound right) { return Equals(left, right); } public static bool operator !=(CNWSCombatRound left, CNWSCombatRound right) { return !Equals(left, right); } /*@SWIG@*/ public CNWSCombatAttackDataArray m_pcLastAttack { set { NWNXLibPINVOKE.CNWSCombatRound_m_pcLastAttack_set(swigCPtr, CNWSCombatAttackDataArray.getCPtr(value)); } get { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_m_pcLastAttack_get(swigCPtr);; CNWSCombatAttackDataArray ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWSCombatAttackDataArray(cPtr, false); return ret; } } public CExoArrayListUInt16 m_nSpecialAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nSpecialAttacks_set(swigCPtr, CExoArrayListUInt16.getCPtr(value)); } get { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_m_nSpecialAttacks_get(swigCPtr); CExoArrayListUInt16 ret = (cPtr == global::System.IntPtr.Zero) ? null : new CExoArrayListUInt16(cPtr, false); return ret; } } public CExoArrayListUInt16 m_nSpecialAttackIDs { set { NWNXLibPINVOKE.CNWSCombatRound_m_nSpecialAttackIDs_set(swigCPtr, CExoArrayListUInt16.getCPtr(value)); } get { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_m_nSpecialAttackIDs_get(swigCPtr); CExoArrayListUInt16 ret = (cPtr == global::System.IntPtr.Zero) ? null : new CExoArrayListUInt16(cPtr, false); return ret; } } public ushort m_nAttackID { set { NWNXLibPINVOKE.CNWSCombatRound_m_nAttackID_set(swigCPtr, value); } get { ushort retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nAttackID_get(swigCPtr); return retVal; } } public int m_bRoundStarted { set { NWNXLibPINVOKE.CNWSCombatRound_m_bRoundStarted_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bRoundStarted_get(swigCPtr); return retVal; } } public int m_bSpellCastRound { set { NWNXLibPINVOKE.CNWSCombatRound_m_bSpellCastRound_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bSpellCastRound_get(swigCPtr); return retVal; } } public int m_nTimer { set { NWNXLibPINVOKE.CNWSCombatRound_m_nTimer_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nTimer_get(swigCPtr); return retVal; } } public int m_nRoundLength { set { NWNXLibPINVOKE.CNWSCombatRound_m_nRoundLength_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nRoundLength_get(swigCPtr); return retVal; } } public int m_nOverlapAmount { set { NWNXLibPINVOKE.CNWSCombatRound_m_nOverlapAmount_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nOverlapAmount_get(swigCPtr); return retVal; } } public int m_nBleedAmount { set { NWNXLibPINVOKE.CNWSCombatRound_m_nBleedAmount_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nBleedAmount_get(swigCPtr); return retVal; } } public int m_bRoundPaused { set { NWNXLibPINVOKE.CNWSCombatRound_m_bRoundPaused_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bRoundPaused_get(swigCPtr); return retVal; } } public uint m_oidRoundPausedBy { set { NWNXLibPINVOKE.CNWSCombatRound_m_oidRoundPausedBy_set(swigCPtr, value); } get { uint retVal = NWNXLibPINVOKE.CNWSCombatRound_m_oidRoundPausedBy_get(swigCPtr); return retVal; } } public int m_nPauseTimer { set { NWNXLibPINVOKE.CNWSCombatRound_m_nPauseTimer_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nPauseTimer_get(swigCPtr); return retVal; } } public int m_bInfinitePause { set { NWNXLibPINVOKE.CNWSCombatRound_m_bInfinitePause_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bInfinitePause_get(swigCPtr); return retVal; } } public byte m_nCurrentAttack { set { NWNXLibPINVOKE.CNWSCombatRound_m_nCurrentAttack_set(swigCPtr, value); } get { byte retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nCurrentAttack_get(swigCPtr); return retVal; } } public byte m_nAttackGroup { set { NWNXLibPINVOKE.CNWSCombatRound_m_nAttackGroup_set(swigCPtr, value); } get { byte retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nAttackGroup_get(swigCPtr); return retVal; } } public int m_bDeflectArrow { set { NWNXLibPINVOKE.CNWSCombatRound_m_bDeflectArrow_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bDeflectArrow_get(swigCPtr); return retVal; } } public int m_bWeaponSucks { set { NWNXLibPINVOKE.CNWSCombatRound_m_bWeaponSucks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bWeaponSucks_get(swigCPtr); return retVal; } } public int m_bEpicDodgeUsed { set { NWNXLibPINVOKE.CNWSCombatRound_m_bEpicDodgeUsed_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_bEpicDodgeUsed_get(swigCPtr); return retVal; } } public int m_nParryIndex { set { NWNXLibPINVOKE.CNWSCombatRound_m_nParryIndex_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nParryIndex_get(swigCPtr); return retVal; } } public int m_nAttacksOfOpportunity { set { NWNXLibPINVOKE.CNWSCombatRound_m_nAttacksOfOpportunity_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nAttacksOfOpportunity_get(swigCPtr); return retVal; } } public int m_nCleaveAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nCleaveAttacks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nCleaveAttacks_get(swigCPtr); return retVal; } } public int m_nCircleKickAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nCircleKickAttacks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nCircleKickAttacks_get(swigCPtr); return retVal; } } public uint m_oidNewAttackTarget { set { NWNXLibPINVOKE.CNWSCombatRound_m_oidNewAttackTarget_set(swigCPtr, value); } get { uint retVal = NWNXLibPINVOKE.CNWSCombatRound_m_oidNewAttackTarget_get(swigCPtr); return retVal; } } public int m_nOnHandAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nOnHandAttacks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nOnHandAttacks_get(swigCPtr); return retVal; } } public int m_nOffHandAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nOffHandAttacks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nOffHandAttacks_get(swigCPtr); return retVal; } } public int m_nOffHandAttacksTaken { set { NWNXLibPINVOKE.CNWSCombatRound_m_nOffHandAttacksTaken_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nOffHandAttacksTaken_get(swigCPtr); return retVal; } } public int m_nExtraAttacksTaken { set { NWNXLibPINVOKE.CNWSCombatRound_m_nExtraAttacksTaken_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nExtraAttacksTaken_get(swigCPtr); return retVal; } } public int m_nAdditionalAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nAdditionalAttacks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nAdditionalAttacks_get(swigCPtr); return retVal; } } public int m_nBonusEffectAttacks { set { NWNXLibPINVOKE.CNWSCombatRound_m_nBonusEffectAttacks_set(swigCPtr, value); } get { int retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nBonusEffectAttacks_get(swigCPtr); return retVal; } } public byte m_nParryActions { set { NWNXLibPINVOKE.CNWSCombatRound_m_nParryActions_set(swigCPtr, value); } get { byte retVal = NWNXLibPINVOKE.CNWSCombatRound_m_nParryActions_get(swigCPtr); return retVal; } } public uint m_oidDodgeTarget { set { NWNXLibPINVOKE.CNWSCombatRound_m_oidDodgeTarget_set(swigCPtr, value); } get { uint retVal = NWNXLibPINVOKE.CNWSCombatRound_m_oidDodgeTarget_get(swigCPtr); return retVal; } } public CExoLinkedListCNWSCombatRoundAction m_pScheduledActions { set { NWNXLibPINVOKE.CNWSCombatRound_m_pScheduledActions_set(swigCPtr, CExoLinkedListCNWSCombatRoundAction.getCPtr(value)); } get { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_m_pScheduledActions_get(swigCPtr); CExoLinkedListCNWSCombatRoundAction ret = (cPtr == global::System.IntPtr.Zero) ? null : new CExoLinkedListCNWSCombatRoundAction(cPtr, false); return ret; } } public CNWSCreature m_pBaseCreature { set { NWNXLibPINVOKE.CNWSCombatRound_m_pBaseCreature_set(swigCPtr, CNWSCreature.getCPtr(value)); } get { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_m_pBaseCreature_get(swigCPtr); CNWSCreature ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWSCreature(cPtr, false); return ret; } } public CNWSCombatRound(CNWSCreature pCreature) : this(NWNXLibPINVOKE.new_CNWSCombatRound(CNWSCreature.getCPtr(pCreature)), true) { } public void StartCombatRound(uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_StartCombatRound(swigCPtr, oidTarget); } public void StartCombatRoundCast(uint nRoundLength) { NWNXLibPINVOKE.CNWSCombatRound_StartCombatRoundCast__SWIG_0(swigCPtr, nRoundLength); } public void StartCombatRoundCast() { NWNXLibPINVOKE.CNWSCombatRound_StartCombatRoundCast__SWIG_1(swigCPtr); } public void EndCombatRound() { NWNXLibPINVOKE.CNWSCombatRound_EndCombatRound(swigCPtr); } public void RecomputeRound() { NWNXLibPINVOKE.CNWSCombatRound_RecomputeRound(swigCPtr); } public void IncrementTimer(int nTimeDelta) { NWNXLibPINVOKE.CNWSCombatRound_IncrementTimer(swigCPtr, nTimeDelta); } public void DecrementPauseTimer(int nTimeDelta) { NWNXLibPINVOKE.CNWSCombatRound_DecrementPauseTimer(swigCPtr, nTimeDelta); } public void SetRoundPaused(int bValue, uint oidPausedBy) { NWNXLibPINVOKE.CNWSCombatRound_SetRoundPaused__SWIG_0(swigCPtr, bValue, oidPausedBy); } public void SetRoundPaused(int bValue) { NWNXLibPINVOKE.CNWSCombatRound_SetRoundPaused__SWIG_1(swigCPtr, bValue); } public void SetPauseTimer(int nValue, int bInfinite) { NWNXLibPINVOKE.CNWSCombatRound_SetPauseTimer__SWIG_0(swigCPtr, nValue, bInfinite); } public void SetPauseTimer(int nValue) { NWNXLibPINVOKE.CNWSCombatRound_SetPauseTimer__SWIG_1(swigCPtr, nValue); } public void DecrementRoundLength(int nValue, int bBleed) { NWNXLibPINVOKE.CNWSCombatRound_DecrementRoundLength__SWIG_0(swigCPtr, nValue, bBleed); } public void DecrementRoundLength(int nValue) { NWNXLibPINVOKE.CNWSCombatRound_DecrementRoundLength__SWIG_1(swigCPtr, nValue); } public CNWSCombatAttackData GetAttack(int nAttack) { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_GetAttack(swigCPtr, nAttack); CNWSCombatAttackData ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWSCombatAttackData(cPtr, false); return ret; } public void ClearAllAttacks() { NWNXLibPINVOKE.CNWSCombatRound_ClearAllAttacks(swigCPtr); } public void SignalCombatRoundStarted() { NWNXLibPINVOKE.CNWSCombatRound_SignalCombatRoundStarted(swigCPtr); } public int CheckActionLength(uint oidPauser, int nActionLength) { int retVal = NWNXLibPINVOKE.CNWSCombatRound_CheckActionLength(swigCPtr, oidPauser, nActionLength); return retVal; } public int CheckActionLengthAtTime(uint oidPauser, int nActionLength, int nTimeIndex) { int retVal = NWNXLibPINVOKE.CNWSCombatRound_CheckActionLengthAtTime(swigCPtr, oidPauser, nActionLength, nTimeIndex); return retVal; } public int GetActionPending() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetActionPending(swigCPtr); return retVal; } public int GetAttackActionPending() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetAttackActionPending(swigCPtr); return retVal; } public int GetSpellActionPending() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetSpellActionPending(swigCPtr); return retVal; } public CNWSCombatRoundAction GetAction() { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_GetAction(swigCPtr); CNWSCombatRoundAction ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWSCombatRoundAction(cPtr, false); return ret; } public void AddAction(CNWSCombatRoundAction pAction) { NWNXLibPINVOKE.CNWSCombatRound_AddAction(swigCPtr, CNWSCombatRoundAction.getCPtr(pAction)); } public void RemoveAllActions() { NWNXLibPINVOKE.CNWSCombatRound_RemoveAllActions(swigCPtr); } public void AddReaction(int nTimeIndex, int nTimeAnimation) { NWNXLibPINVOKE.CNWSCombatRound_AddReaction(swigCPtr, nTimeIndex, nTimeAnimation); } public void AddSpellAction() { NWNXLibPINVOKE.CNWSCombatRound_AddSpellAction(swigCPtr); } public void RemoveSpellAction() { NWNXLibPINVOKE.CNWSCombatRound_RemoveSpellAction(swigCPtr); } public void AddParryAttack(uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_AddParryAttack(swigCPtr, oidTarget); } public void AddParryIndex() { NWNXLibPINVOKE.CNWSCombatRound_AddParryIndex(swigCPtr); } public void AddCleaveAttack(uint oidTarget, int bGreatCleave) { NWNXLibPINVOKE.CNWSCombatRound_AddCleaveAttack__SWIG_0(swigCPtr, oidTarget, bGreatCleave); } public void AddCleaveAttack(uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_AddCleaveAttack__SWIG_1(swigCPtr, oidTarget); } public void AddCircleKickAttack(uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_AddCircleKickAttack(swigCPtr, oidTarget); } public void AddAttackOfOpportunity(uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_AddAttackOfOpportunity(swigCPtr, oidTarget); } public void AddWhirlwindAttack(uint oidTarget, int bImproved) { NWNXLibPINVOKE.CNWSCombatRound_AddWhirlwindAttack(swigCPtr, oidTarget, bImproved); } public void AddEquipAction(uint oidItem, uint nInventorySlot) { NWNXLibPINVOKE.CNWSCombatRound_AddEquipAction(swigCPtr, oidItem, nInventorySlot); } public void AddUnequipAction(uint oidItem, uint oidTargetRepository, byte x, byte y) { NWNXLibPINVOKE.CNWSCombatRound_AddUnequipAction(swigCPtr, oidItem, oidTargetRepository, x, y); } public void AddCombatStepAction(uint nTimeIndex, uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_AddCombatStepAction(swigCPtr, nTimeIndex, oidTarget); } public void InitializeAttackActions(uint oidTarget) { NWNXLibPINVOKE.CNWSCombatRound_InitializeAttackActions(swigCPtr, oidTarget); } public void InitializeNumberOfAttacks() { NWNXLibPINVOKE.CNWSCombatRound_InitializeNumberOfAttacks(swigCPtr); } public void InitializeCombatModes() { NWNXLibPINVOKE.CNWSCombatRound_InitializeCombatModes(swigCPtr); } public int CalculateOffHandAttacks() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_CalculateOffHandAttacks(swigCPtr); return retVal; } public int GetCombatStepRequired(uint oidTarget) { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetCombatStepRequired(swigCPtr, oidTarget); return retVal; } public byte GetTotalAttacks() { byte retVal = NWNXLibPINVOKE.CNWSCombatRound_GetTotalAttacks(swigCPtr); return retVal; } public void SetDeflectArrow(int bValue) { NWNXLibPINVOKE.CNWSCombatRound_SetDeflectArrow(swigCPtr, bValue); } public void SetCurrentAttack(byte nCurrentAttack) { NWNXLibPINVOKE.CNWSCombatRound_SetCurrentAttack(swigCPtr, nCurrentAttack); } public int GetOffHandAttack() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetOffHandAttack(swigCPtr); return retVal; } public int GetExtraAttack() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetExtraAttack(swigCPtr); return retVal; } public int HasCreatureWeapons() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_HasCreatureWeapons(swigCPtr); return retVal; } public int GetWeaponAttackType() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetWeaponAttackType(swigCPtr); return retVal; } public CNWSItem GetCurrentAttackWeapon(int nWeaponAttackType) { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_GetCurrentAttackWeapon__SWIG_0(swigCPtr, nWeaponAttackType); CNWSItem ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWSItem(cPtr, false); return ret; } public CNWSItem GetCurrentAttackWeapon() { global::System.IntPtr cPtr = NWNXLibPINVOKE.CNWSCombatRound_GetCurrentAttackWeapon__SWIG_1(swigCPtr); CNWSItem ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWSItem(cPtr, false); return ret; } public void UpdateAttackTargetForAllActions(uint oidNewTarget) { NWNXLibPINVOKE.CNWSCombatRound_UpdateAttackTargetForAllActions(swigCPtr, oidNewTarget); } public void InsertSpecialAttack(ushort nSpecialAttack, int nIndex) { NWNXLibPINVOKE.CNWSCombatRound_InsertSpecialAttack(swigCPtr, nSpecialAttack, nIndex); } public void AddSpecialAttack(ushort nSpecialAttack) { NWNXLibPINVOKE.CNWSCombatRound_AddSpecialAttack(swigCPtr, nSpecialAttack); } public void RemoveSpecialAttack(int nIndex) { NWNXLibPINVOKE.CNWSCombatRound_RemoveSpecialAttack(swigCPtr, nIndex); } public int GetNumSpecialAttacks() { int retVal = NWNXLibPINVOKE.CNWSCombatRound_GetNumSpecialAttacks(swigCPtr); return retVal; } public ushort GetSpecialAttack(int nIndex) { ushort retVal = NWNXLibPINVOKE.CNWSCombatRound_GetSpecialAttack(swigCPtr, nIndex); return retVal; } public ushort GetSpecialAttackID(int nIndex) { ushort retVal = NWNXLibPINVOKE.CNWSCombatRound_GetSpecialAttackID(swigCPtr, nIndex); return retVal; } public ushort GetNewAttackID() { ushort retVal = NWNXLibPINVOKE.CNWSCombatRound_GetNewAttackID(swigCPtr); return retVal; } public void ClearAllSpecialAttacks() { NWNXLibPINVOKE.CNWSCombatRound_ClearAllSpecialAttacks(swigCPtr); } public int SaveCombatRound(CResGFF pRes, CResStruct pStruct) { int retVal = NWNXLibPINVOKE.CNWSCombatRound_SaveCombatRound(swigCPtr, CResGFF.getCPtr(pRes), CResStruct.getCPtr(pStruct)); return retVal; } public int LoadCombatRound(CResGFF pRes, CResStruct pStruct) { int retVal = NWNXLibPINVOKE.CNWSCombatRound_LoadCombatRound(swigCPtr, CResGFF.getCPtr(pRes), CResStruct.getCPtr(pStruct)); return retVal; } public void _Destructor() { NWNXLibPINVOKE.CNWSCombatRound__Destructor(swigCPtr); } } }
29.288564
147
0.733303
[ "MIT" ]
nwn-dotnet/NWN.Core.LowLevel
src/main/API/CNWSCombatRound.cs
22,025
C#
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. namespace Microsoft.Azure.Management.OperationalInsights.Models { using System.Linq; /// <summary> /// The status of the storage insight. /// </summary> public partial class StorageInsightStatus { /// <summary> /// Initializes a new instance of the StorageInsightStatus class. /// </summary> public StorageInsightStatus() { } /// <summary> /// Initializes a new instance of the StorageInsightStatus class. /// </summary> /// <param name="state">The state of the storage insight connection to /// the workspace. Possible values include: 'OK', 'ERROR'</param> /// <param name="description">Description of the state of the storage /// insight.</param> public StorageInsightStatus(string state, string description = default(string)) { State = state; Description = description; } /// <summary> /// Gets or sets the state of the storage insight connection to the /// workspace. Possible values include: 'OK', 'ERROR' /// </summary> [Newtonsoft.Json.JsonProperty(PropertyName = "state")] public string State { get; set; } /// <summary> /// Gets or sets description of the state of the storage insight. /// </summary> [Newtonsoft.Json.JsonProperty(PropertyName = "description")] public string Description { get; set; } /// <summary> /// Validate the object. /// </summary> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (State == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "State"); } } } }
34.5
115
0.595169
[ "MIT" ]
216Giorgiy/azure-sdk-for-net
src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightStatus.cs
2,070
C#
//---------------------------------------------------------------------------------------------- // Copyright 2021 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. //--------------------------------------------------------------------------------------------- namespace AMSExplorer { public enum AzureMediaPlayerFormats { Auto = 0, Smooth = 1, Dash = 2, HLS = 3, VideoMP4 = 4 } }
34.275862
97
0.535211
[ "Apache-2.0" ]
Azure/Azure-Media-Services-Explorer
AMSExplorer/Utils/AzureMediaPlayerFormats.cs
996
C#
// <copyright file="BypassListManagement.cs" company="SendGrid"> // Copyright (c) SendGrid. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // </copyright> namespace SendGrid.Helpers.Mail { using Newtonsoft.Json; /// <summary> /// Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receives your email. Ex: outage emails, or forgot password emails. /// </summary> [JsonObject(IsReference = false)] public class BypassListManagement { /// <summary> /// Gets or sets a value indicating whether this setting is enabled. /// </summary> [JsonProperty(PropertyName = "enable")] public bool Enable { get; set; } } }
40.304348
293
0.699029
[ "MIT" ]
06needhamt/sendgrid-csharp
src/SendGrid/Helpers/Mail/Model/BypassListManagement.cs
929
C#
using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Rhinobyte.Extensions.Reflection.IntermediateLanguage; using System; using System.Reflection; using System.Reflection.Emit; namespace Rhinobyte.Extensions.Reflection.Tests.IntermediateLanguage; [TestClass] public class UnknownMemberReferenceInstructionTests { /****** TEST METHODS **************************** ********************************************************/ [TestMethod] public void ToString_gracefully_handles_null() { var unknownMemberReferenceInstruction = new UnknownMemberReferenceInstruction(0, 0, OpCodes.Nop, null); unknownMemberReferenceInstruction.ToString().Should().NotBeNullOrWhiteSpace(); var bogusMemberInfo = new BogusMemberInfo(); unknownMemberReferenceInstruction = new UnknownMemberReferenceInstruction(0, 0, OpCodes.Nop, bogusMemberInfo); unknownMemberReferenceInstruction.ToString().Should().NotBeNullOrWhiteSpace(); } /****** TEST SETUP ***************************** *******************************************************/ public class BogusMemberInfo : System.Reflection.MemberInfo { public override Type? DeclaringType => null; public override MemberTypes MemberType => MemberTypes.Custom; public override string Name => null!; public override Type? ReflectedType => null; public override object[] GetCustomAttributes(bool inherit) => Array.Empty<object>(); public override object[] GetCustomAttributes(Type attributeType, bool inherit) => Array.Empty<object>(); public override bool IsDefined(Type attributeType, bool inherit) => false; } }
37.674419
112
0.702469
[ "MIT" ]
RhinobyteSoftware/DependencyInjectionExtensions
tests/Rhinobyte.Extensions.Reflection.Tests/IntermediateLanguage/UnknownMemberReferenceInstructionTests.cs
1,622
C#
using Microsoft.AspNetCore.Mvc; namespace HrSystem.Controllers { public class Settings : Controller { public IActionResult Index() { return View(); } } }
14.769231
37
0.614583
[ "Apache-2.0" ]
AbhayVel/vmhr
HrSystem/HrSystem/Controllers/Settings.cs
194
C#
#pragma warning disable CS0672,CS0809,CS1591 namespace AlibabaCloud.SDK.ROS.CDK.Dns { /// <remarks> /// <h2>Aliyun ROS DNS Construct Library</h2> /// /// This module is part of the AliCloud ROS Cloud Development Kit (ROS CDK) project. /// /// <code><![CDATA[ /// // Example automatically generated from non-compiling source. May contain errors. /// import * as DNS from '@alicloud/ros-cdk-dns'; /// ]]></code> /// </remarks> [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public class NamespaceDoc { } }
30.2
93
0.655629
[ "Apache-2.0" ]
aliyun/Resource-Orchestration-Service-Cloud-Development-K
multiple-languages/dotnet/AlibabaCloud.SDK.ROS.CDK.Dns/AlibabaCloud/SDK/ROS/CDK/Dns/NamespaceDoc.cs
604
C#
global using Microsoft.Extensions.Options; global using Humanizer; global using Microsoft.Azure.Cosmos; global using ScotlandsMountains.Domain; global using MoreLinq.Extensions; global using Microsoft.Extensions.Logging; global using System.Net; global using System.Text; global using Microsoft.AspNetCore.WebUtilities; global using Microsoft.Azure.Cosmos.Linq;
28.076923
47
0.841096
[ "MIT" ]
graham-miller/ScotlandsMountains
Data/GlobalUsings.cs
367
C#
using Newtonsoft.Json; namespace SimpleJira.Impl.Dto { internal class JiraStatusDto { [JsonProperty("self")] public string Self { get; set; } [JsonProperty("description")] public string Description { get; set; } [JsonProperty("iconUrl")] public string IconUrl { get; set; } [JsonProperty("id")] public string Id { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("statusCategory")] public JiraStatusCategoryDto StatusCategory { get; set; } } }
38.357143
98
0.651769
[ "MIT" ]
4thGradeDropout/simple-jira
SimpleJira/Impl/Dto/JiraStatusDto.cs
537
C#
using NetTopologySuite.Geometries; using NetTopologySuite.IO; using NUnit.Framework; namespace NetTopologySuite.Samples.Tests.Various { [TestFixture] public class Precision { private const string wktpol = "POLYGON ((130 310, 390 310, 390 190, 130 190, 130 310))"; private const string wktline = "LINESTRING (390 350, 390.01 150)"; [Test] public void OverlayUsingDefaultPrecision() { var reader = new WKTReader(); var factory = NtsGeometryServices.Instance.CreateGeometryFactory(); var pol = reader.Read(wktpol); Assert.IsNotNull(pol); Assert.IsTrue(pol.IsValid); Assert.IsTrue(pol.Factory.PrecisionModel == factory.PrecisionModel); var line = reader.Read(wktline); Assert.IsNotNull(line); Assert.IsTrue(line.IsValid); Assert.IsTrue(line.Factory.PrecisionModel == factory.PrecisionModel); Assert.IsFalse(pol.Intersects(line)); } [Test] public void OverlayUsingFixedPrecision() { var gs = new NtsGeometryServices(PrecisionModel.Fixed.Value, 0); var factory = gs.CreateGeometryFactory(); var reader = new WKTReader(gs); var pol = reader.Read(wktpol); Assert.IsNotNull(pol); Assert.IsTrue(pol.IsValid); Assert.IsTrue(pol.Factory.PrecisionModel == factory.PrecisionModel); var line = reader.Read(wktline); Assert.IsNotNull(line); Assert.IsTrue(line.IsValid); Assert.IsTrue(line.Factory.PrecisionModel == factory.PrecisionModel); Assert.IsTrue(pol.Intersects(line)); } } }
33
97
0.612922
[ "EPL-1.0" ]
Amit909Singh/NetTopologySuite
test/NetTopologySuite.Samples.Console/Tests/Various/PrecisionTest.cs
1,749
C#
using RabbitMQ.Client; using RabbitMQ.Client.Events; using System; using System.Text; namespace Tutorial.RabbitMQ.Console.RPCServer { class RPCServer { static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; var queueName = "rpc_queue"; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: queueName, durable: false, exclusive: false, autoDelete: false, arguments: null); channel.BasicQos(0, 1, false); var consumer = new EventingBasicConsumer(channel); channel.BasicConsume(queue: queueName, autoAck: false, consumer: consumer); System.Console.WriteLine($"{DateTime.Now}: Awaiting RPC requests."); consumer.Received += Consumer_Received; System.Console.WriteLine($"{DateTime.Now}: Press [enter] to exit."); System.Console.ReadLine(); } } private static void Consumer_Received(object sender, BasicDeliverEventArgs e) { var channel = ((EventingBasicConsumer)sender).Model; string response = null; var body = e.Body.ToArray(); var props = e.BasicProperties; var replyProps = channel.CreateBasicProperties(); replyProps.CorrelationId = props.CorrelationId; try { var message = Encoding.UTF8.GetString(body); int n = int.Parse(message); System.Console.WriteLine($"{DateTime.Now}: fib({message})"); response = fib(n).ToString(); } catch (Exception ex) { System.Console.WriteLine($"{DateTime.Now}: ERROR {ex.Message}"); response = string.Empty; } finally { var responseBytes = Encoding.UTF8.GetBytes(response); channel.BasicPublish(exchange: string.Empty, routingKey: props.ReplyTo, basicProperties: replyProps, body: responseBytes); channel.BasicAck(deliveryTag: e.DeliveryTag, multiple: false); } } /// <summary> /// Assumes only valid positive integer input. /// Don't expect this one to work for big numbers, and it's probably the slowest recursive implementation possible. /// </summary> /// <param name="n"></param> /// <returns></returns> private static int fib(int n) { if (n == 0 || n == 1) { return n; } return fib(n - 1) + fib(n - 2); } } }
33.357895
123
0.486589
[ "MIT" ]
ahcantarim/tutorial-rabbitmq
src/Tutorial.RabbitMQ.Console.RPCServer/RPCServer.cs
3,171
C#
// 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.Collections; using System.Collections.Generic; using DotNetNuke.ComponentModel; using NUnit.Framework; namespace DotNetNuke.Tests.Core.ComponentModel { [TestFixture] public class SimpleContainerTests { [Test] //DNN-17622 http://support.dotnetnuke.com/issue/ViewIssue.aspx?id=17622&PROJID=2 public void GetComponenetListSupportsInterfaces() { var container = new SimpleContainer(); container.RegisterComponent<IList>("payload", ComponentLifeStyleType.Singleton); var retrieved = container.GetComponentList(typeof(IList)); CollectionAssert.AreEqual(new List<string> {"payload"}, retrieved); } [Test] public void RegisterComponentInstance_Must_Register_In_ComponentsList() { var container = new SimpleContainer(); ComponentFactory.Container = container; container.RegisterComponentInstance("test", typeof(IList<string>), new List<string>()); Assert.Contains("test", ComponentFactory.GetComponents<IList<string>>().Keys); } } }
32.634146
99
0.685351
[ "MIT" ]
MaiklT/Dnn.Platform
DNN Platform/Tests/DotNetNuke.Tests.Core/ComponentModel/SimpleContainerTests.cs
1,340
C#
using System; namespace ReceiverWebApi { public class WeatherForecast { public DateTime Date { get; set; } public int TemperatureC { get; set; } public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); public string Summary { get; set; } } }
18.4375
69
0.60678
[ "MIT" ]
esimkowitz/AzureFunctionsThroughputTest
ReceiverWebApi/WeatherForecast.cs
295
C#
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Azure.Network.Inputs { public sealed class NetworkInterfaceIpConfigurationGetArgs : Pulumi.ResourceArgs { /// <summary> /// A name used for this IP Configuration. /// </summary> [Input("name", required: true)] public Input<string> Name { get; set; } = null!; /// <summary> /// Is this the Primary IP Configuration? Must be `true` for the first `ip_configuration` when multiple are specified. Defaults to `false`. /// </summary> [Input("primary")] public Input<bool>? Primary { get; set; } /// <summary> /// The Static IP Address which should be used. /// </summary> [Input("privateIpAddress")] public Input<string>? PrivateIpAddress { get; set; } /// <summary> /// The allocation method used for the Private IP Address. Possible values are `Dynamic` and `Static`. /// </summary> [Input("privateIpAddressAllocation", required: true)] public Input<string> PrivateIpAddressAllocation { get; set; } = null!; /// <summary> /// The IP Version to use. Possible values are `IPv4` or `IPv6`. Defaults to `IPv4`. /// </summary> [Input("privateIpAddressVersion")] public Input<string>? PrivateIpAddressVersion { get; set; } /// <summary> /// Reference to a Public IP Address to associate with this NIC /// </summary> [Input("publicIpAddressId")] public Input<string>? PublicIpAddressId { get; set; } /// <summary> /// The ID of the Subnet where this Network Interface should be located in. /// </summary> [Input("subnetId")] public Input<string>? SubnetId { get; set; } public NetworkInterfaceIpConfigurationGetArgs() { } } }
35.016129
147
0.61216
[ "ECL-2.0", "Apache-2.0" ]
AdminTurnedDevOps/pulumi-azure
sdk/dotnet/Network/Inputs/NetworkInterfaceIpConfigurationGetArgs.cs
2,171
C#
using UnityEngine; public class NoiseData { private float _seed; private float _frequency; private float _amplitude; private float _lacunarity; private float _persistance; private int _octaves; public NoiseData(float seed, float frequency, float amplitude, float lacunarity, float persistance, int octaves) { _seed = seed; _frequency = frequency; _amplitude = amplitude; _lacunarity = lacunarity; _persistance = persistance; _octaves = octaves; } public float[,] GetNoiseValues(int worldSize, int noiseSize) { float[,] noiseValues = new float[worldSize, worldSize]; float max = 0f; float min = float.MaxValue; _seed = _seed * 0.00000001f; for (int i = 0; i < worldSize; i++) { for (int j = 0; j < worldSize; j++) { noiseValues[i, j] = 0f; float tempA = _amplitude; float tempF = _frequency; for (int k = 0; k < _octaves; k++) { noiseValues[i, j] += Mathf.PerlinNoise((i + _seed) / noiseSize * _frequency, (j + _seed) / noiseSize * _frequency) * _amplitude; _frequency *= _lacunarity; _amplitude *= _persistance; } _amplitude = tempA; _frequency = tempF; if (noiseValues[i, j] > max) max = noiseValues[i, j]; if (noiseValues[i, j] < min) min = noiseValues[i, j]; } } for (int i = 0; i < worldSize; i++) { for (int j = 0; j < worldSize; j++) { noiseValues[i, j] = Mathf.InverseLerp(max, min, noiseValues[i, j]); } } return noiseValues; } }
25.527027
148
0.501323
[ "MIT" ]
Valks-Games/Space-RPG-Game
Assets/Scripts/Unused/Data/NoiseData.cs
1,891
C#
using System; using System.Collections.Generic; using Android.Runtime; using Java.Interop; namespace Com.Github.Sundeepk.Compactcalendarview { // Metadata.xml XPath class reference: path="/api/package[@name='com.github.sundeepk.compactcalendarview']/class[@name='WeekUtils']" [global::Android.Runtime.Register ("com/github/sundeepk/compactcalendarview/WeekUtils", DoNotGenerateAcw=true)] public partial class WeekUtils : global::Java.Lang.Object { internal new static readonly JniPeerMembers _members = new XAPeerMembers ("com/github/sundeepk/compactcalendarview/WeekUtils", typeof (WeekUtils)); internal static new IntPtr class_ref { get { return _members.JniPeerType.PeerReference.Handle; } } public override global::Java.Interop.JniPeerMembers JniPeerMembers { get { return _members; } } protected override IntPtr ThresholdClass { get { return _members.JniPeerType.PeerReference.Handle; } } protected override global::System.Type ThresholdType { get { return _members.ManagedPeerType; } } protected WeekUtils (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} // Metadata.xml XPath constructor reference: path="/api/package[@name='com.github.sundeepk.compactcalendarview']/class[@name='WeekUtils']/constructor[@name='WeekUtils' and count(parameter)=0]" [Register (".ctor", "()V", "")] public unsafe WeekUtils () : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) { const string __id = "()V"; if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) return; try { var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null); SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef); _members.InstanceMethods.FinishCreateInstance (__id, this, null); } finally { } } } }
36.207547
195
0.715477
[ "MIT" ]
giuseppenovielli/Xamarin.Android-CompactCalendarView
obj/Release/generated/src/Com.Github.Sundeepk.Compactcalendarview.WeekUtils.cs
1,919
C#
using Javil; using Xamarin.SourceWriter; namespace generator2; class BoundFieldAsProperty : PropertyWriter { public static BoundFieldAsProperty Create (FieldDefinition field) { var p = new BoundFieldAsProperty { Name = field.GetName () }; if (field.IsPublic) p.IsPublic = true; if (field.IsProtected) p.IsProtected = true; p.IsStatic = field.IsStatic && !field.IsConstant; p.PropertyType = new TypeReferenceWriter (FormatExtensions.FormatTypeReference (field.FieldType)); p.HasGet = true; p.HasSet = true; p.GetBody.Add ("throw new NotImplementedException ();"); return p; } }
19.3125
100
0.723301
[ "MIT" ]
jonpryor/GenericBindingPrototype
tools/generator2/SourceWriters/BoundFieldAsProperty.cs
618
C#
namespace StockManager.Src.Views.Forms { partial class RefillStockForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefillStockForm)); this.pnlBody = new System.Windows.Forms.Panel(); this.numRefillQty = new System.Windows.Forms.NumericUpDown(); this.numCurrentStock = new System.Windows.Forms.NumericUpDown(); this.btnCancel = new System.Windows.Forms.Button(); this.pnlTopBar = new System.Windows.Forms.Panel(); this.lbTitle = new System.Windows.Forms.Label(); this.lbErrorRefillQty = new System.Windows.Forms.Label(); this.lbErrorCurrentStock = new System.Windows.Forms.Label(); this.btnSave = new System.Windows.Forms.Button(); this.lbRefillQty = new System.Windows.Forms.Label(); this.lbCurrentStock = new System.Windows.Forms.Label(); this.pnlBody.SuspendLayout(); (( System.ComponentModel.ISupportInitialize )(this.numRefillQty)).BeginInit(); (( System.ComponentModel.ISupportInitialize )(this.numCurrentStock)).BeginInit(); this.pnlTopBar.SuspendLayout(); this.SuspendLayout(); // // pnlBody // this.pnlBody.BackColor = System.Drawing.SystemColors.Control; this.pnlBody.Controls.Add(this.numRefillQty); this.pnlBody.Controls.Add(this.numCurrentStock); this.pnlBody.Controls.Add(this.btnCancel); this.pnlBody.Controls.Add(this.pnlTopBar); this.pnlBody.Controls.Add(this.lbErrorRefillQty); this.pnlBody.Controls.Add(this.lbErrorCurrentStock); this.pnlBody.Controls.Add(this.btnSave); this.pnlBody.Controls.Add(this.lbRefillQty); this.pnlBody.Controls.Add(this.lbCurrentStock); this.pnlBody.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlBody.Location = new System.Drawing.Point(0, 0); this.pnlBody.Margin = new System.Windows.Forms.Padding(4); this.pnlBody.Name = "pnlBody"; this.pnlBody.Size = new System.Drawing.Size(451, 299); this.pnlBody.TabIndex = 8; // // numRefillQty // this.numRefillQty.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.numRefillQty.Font = new System.Drawing.Font("Courier New", 11.25F); this.numRefillQty.Location = new System.Drawing.Point(103, 149); this.numRefillQty.Margin = new System.Windows.Forms.Padding(4); this.numRefillQty.Maximum = new decimal(new int[] { -1530494977, 232830, 0, 0}); this.numRefillQty.Name = "numRefillQty"; this.numRefillQty.Size = new System.Drawing.Size(252, 24); this.numRefillQty.TabIndex = 1; this.numRefillQty.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.numRefillQty.ThousandsSeparator = true; this.numRefillQty.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown); // // numCurrentStock // this.numCurrentStock.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.numCurrentStock.Font = new System.Drawing.Font("Courier New", 11.25F); this.numCurrentStock.Location = new System.Drawing.Point(103, 83); this.numCurrentStock.Margin = new System.Windows.Forms.Padding(4); this.numCurrentStock.Maximum = new decimal(new int[] { -1530494977, 232830, 0, 0}); this.numCurrentStock.Name = "numCurrentStock"; this.numCurrentStock.Size = new System.Drawing.Size(252, 24); this.numCurrentStock.TabIndex = 0; this.numCurrentStock.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.numCurrentStock.ThousandsSeparator = true; this.numCurrentStock.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown); // // btnCancel // this.btnCancel.BackColor = System.Drawing.Color.FromArgb((( int )((( byte )(217)))), (( int )((( byte )(83)))), (( int )((( byte )(79))))); this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancel.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.btnCancel.ForeColor = System.Drawing.Color.White; this.btnCancel.Location = new System.Drawing.Point(103, 229); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(120, 32); this.btnCancel.TabIndex = 3; this.btnCancel.Text = "btnCancel"; this.btnCancel.UseVisualStyleBackColor = false; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // pnlTopBar // this.pnlTopBar.BackColor = System.Drawing.Color.FromArgb((( int )((( byte )(26)))), (( int )((( byte )(29)))), (( int )((( byte )(33))))); this.pnlTopBar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pnlTopBar.Controls.Add(this.lbTitle); this.pnlTopBar.Dock = System.Windows.Forms.DockStyle.Top; this.pnlTopBar.Location = new System.Drawing.Point(0, 0); this.pnlTopBar.Name = "pnlTopBar"; this.pnlTopBar.Size = new System.Drawing.Size(451, 44); this.pnlTopBar.TabIndex = 16; // // lbTitle // this.lbTitle.AutoSize = true; this.lbTitle.BackColor = System.Drawing.Color.Transparent; this.lbTitle.Font = new System.Drawing.Font("Courier New", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.lbTitle.ForeColor = System.Drawing.Color.White; this.lbTitle.Location = new System.Drawing.Point(16, 14); this.lbTitle.Name = "lbTitle"; this.lbTitle.Size = new System.Drawing.Size(87, 22); this.lbTitle.TabIndex = 1; this.lbTitle.Text = "lbTitle"; // // lbErrorRefillQty // this.lbErrorRefillQty.AutoSize = true; this.lbErrorRefillQty.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.lbErrorRefillQty.ForeColor = System.Drawing.Color.Red; this.lbErrorRefillQty.Location = new System.Drawing.Point(106, 174); this.lbErrorRefillQty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbErrorRefillQty.MaximumSize = new System.Drawing.Size(252, 0); this.lbErrorRefillQty.Name = "lbErrorRefillQty"; this.lbErrorRefillQty.Size = new System.Drawing.Size(120, 16); this.lbErrorRefillQty.TabIndex = 15; this.lbErrorRefillQty.Text = "lbErrorRefillQty"; // // lbErrorCurrentStock // this.lbErrorCurrentStock.AutoSize = true; this.lbErrorCurrentStock.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.lbErrorCurrentStock.ForeColor = System.Drawing.Color.Red; this.lbErrorCurrentStock.Location = new System.Drawing.Point(106, 108); this.lbErrorCurrentStock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbErrorCurrentStock.Name = "lbErrorCurrentStock"; this.lbErrorCurrentStock.Size = new System.Drawing.Size(141, 16); this.lbErrorCurrentStock.TabIndex = 14; this.lbErrorCurrentStock.Text = "lbErrorCurrentStock"; // // btnSave // this.btnSave.BackColor = System.Drawing.Color.FromArgb((( int )((( byte )(92)))), (( int )((( byte )(184)))), (( int )((( byte )(92))))); this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnSave.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.btnSave.ForeColor = System.Drawing.Color.White; this.btnSave.Location = new System.Drawing.Point(235, 229); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(120, 32); this.btnSave.TabIndex = 2; this.btnSave.Text = "btnSave"; this.btnSave.UseVisualStyleBackColor = false; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // lbRefillQty // this.lbRefillQty.AutoSize = true; this.lbRefillQty.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.lbRefillQty.ForeColor = System.Drawing.Color.FromArgb((( int )((( byte )(5)))), (( int )((( byte )(118)))), (( int )((( byte )(185))))); this.lbRefillQty.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.lbRefillQty.Location = new System.Drawing.Point(100, 130); this.lbRefillQty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbRefillQty.Name = "lbRefillQty"; this.lbRefillQty.Size = new System.Drawing.Size(96, 16); this.lbRefillQty.TabIndex = 9; this.lbRefillQty.Text = "lbRefillQty"; // // lbCurrentStock // this.lbCurrentStock.AutoSize = true; this.lbCurrentStock.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (( byte )(0))); this.lbCurrentStock.ForeColor = System.Drawing.Color.FromArgb((( int )((( byte )(5)))), (( int )((( byte )(118)))), (( int )((( byte )(185))))); this.lbCurrentStock.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.lbCurrentStock.Location = new System.Drawing.Point(100, 64); this.lbCurrentStock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbCurrentStock.Name = "lbCurrentStock"; this.lbCurrentStock.Size = new System.Drawing.Size(120, 16); this.lbCurrentStock.TabIndex = 2; this.lbCurrentStock.Text = "lbCurrentStock"; // // RefillStockForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(451, 299); this.Controls.Add(this.pnlBody); this.Font = new System.Drawing.Font("Courier New", 9.75F); this.ForeColor = System.Drawing.Color.White; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = (( System.Drawing.Icon )(resources.GetObject("$this.Icon"))); this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "RefillStockForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Stock Manager | Edit stock"; this.pnlBody.ResumeLayout(false); this.pnlBody.PerformLayout(); (( System.ComponentModel.ISupportInitialize )(this.numRefillQty)).EndInit(); (( System.ComponentModel.ISupportInitialize )(this.numCurrentStock)).EndInit(); this.pnlTopBar.ResumeLayout(false); this.pnlTopBar.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Panel pnlBody; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Panel pnlTopBar; private System.Windows.Forms.Label lbTitle; private System.Windows.Forms.Label lbErrorRefillQty; private System.Windows.Forms.Label lbErrorCurrentStock; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Label lbRefillQty; private System.Windows.Forms.Label lbCurrentStock; private System.Windows.Forms.NumericUpDown numRefillQty; private System.Windows.Forms.NumericUpDown numCurrentStock; } }
56.674797
171
0.604289
[ "MIT" ]
ricardotx/StockManager
StockManager/Src/Views/Forms/RefillStockForm.Designer.cs
13,944
C#
#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange // // Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany) // // http://www.pdfsharp.com // http://sourceforge.net/projects/pdfsharp // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #endregion namespace PdfSharp.Drawing { /// <summary> /// Defines the direction an elliptical arc is drawn. /// </summary> public enum XSweepDirection // Same values as System.Windows.Media.SweepDirection. { /// <summary> /// Specifies that arcs are drawn in a counter clockwise (negative-angle) direction. /// </summary> Counterclockwise = 0, /// <summary> /// Specifies that arcs are drawn in a clockwise (positive-angle) direction. /// </summary> Clockwise = 1, } }
38.958333
92
0.71016
[ "MIT" ]
AVPolyakov/PDFsharp
src/PdfSharp/Drawing/enums/XSweepDirection.cs
1,870
C#
namespace hrmApp.Web.ViewModels { public class UserRoleViewModel : RoleViewModel { public bool HasRole { get; set; } } }
20
50
0.657143
[ "MIT" ]
gasparekferenc/hrmApp.N-Layer.MVC
scr/hrmApp/hrmApp.Web/ViewModels/UserRoleViewModel.cs
140
C#
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * Copyright (c) 2017-2018 Swan & The Quaver Team <support@quavergame.com>. */ using System; using System.Collections.Generic; using System.Linq; using Quaver.API.Enums; using Quaver.API.Helpers; using Quaver.API.Maps.Processors.Scoring.Data; using Quaver.API.Maps.Processors.Scoring.Multiplayer; using Quaver.API.Replays; namespace Quaver.API.Maps.Processors.Scoring { public abstract class ScoreProcessor { /// <summary> /// The map that will have its score processed. /// </summary> public Qua Map { get; } /// <summary> /// The mods for this play. /// </summary> public ModIdentifier Mods { get; set; } /// <summary> /// The total score the user has. /// </summary> public int Score { get; set; } /// <summary> /// The accuracy the user has. /// </summary> public float Accuracy { get; set; } /// <summary> /// The current health. /// </summary> public float Health { get; set; } = 100; /// <summary> /// The user's current combo. /// </summary> public int Combo { get; protected set; } /// <summary> /// The max combo achieved for this play session. /// </summary> public int MaxCombo { get; set; } /// <summary> /// If the score is currently failed. /// </summary> public bool Failed => Health <= 0; /// <summary> /// The user's stats per object. /// </summary> public List<HitStat> Stats { get; set; } /// <summary> /// The judgement count for each judgement, initialized to 0 by default. /// /// Note: Not sure if modes will use different judgements, probably not. /// </summary> public Dictionary<Judgement, int> CurrentJudgements { get; } = new Dictionary<Judgement, int>() { {Judgement.Marv, 0}, {Judgement.Perf, 0}, {Judgement.Great, 0}, {Judgement.Good, 0}, {Judgement.Okay, 0}, {Judgement.Miss, 0} }; /// <summary> /// The judgement windows defined per mode. /// </summary> public abstract SortedDictionary<Judgement, float> JudgementWindow { get; set; } /// <summary> /// The weighting for score defined per mode. /// </summary> public abstract Dictionary<Judgement, int> JudgementScoreWeighting { get; } /// <summary> /// The weighting for health defined per mode. /// </summary> public abstract Dictionary<Judgement, float> JudgementHealthWeighting { get; } /// <summary> /// The weighting for accuracy. /// </summary> public abstract Dictionary<Judgement, float> JudgementAccuracyWeighting { get; } /// <summary> /// The window multiplier for long notes. /// It multiplies the judgement window by this amount. /// </summary> public abstract SortedDictionary<Judgement, float> WindowReleaseMultiplier { get; } /// <summary> /// Determined by if the player has obtained a full combo in the score. /// This value can be applicable during real-time gameplay. /// </summary> public bool FullCombo => MaxCombo == TotalJudgementCount; /// <summary> /// The total amount of judgements that the user has gotten in this play session. /// </summary> public virtual int TotalJudgementCount { get { var sum = 0; foreach (var item in CurrentJudgements) sum += item.Value; return sum; } } /// <summary> /// Contains everything related to multiplayer scoring. /// </summary> public ScoreProcessorMultiplayer MultiplayerProcessor { get; } /// <summary> /// Ctor - /// </summary> /// <param name="map"></param> /// <param name="mods"></param> public ScoreProcessor(Qua map, ModIdentifier mods, JudgementWindows windows = null) { Map = map; Mods = mods; Stats = new List<HitStat>(); InitializeJudgementWindows(windows); InitializeMods(); } /// <summary> /// For multiplayer /// </summary> /// <param name="map"></param> /// <param name="mods"></param> /// <param name="multiplayerProcessor"></param> /// <param name="windows"></param> public ScoreProcessor(Qua map, ModIdentifier mods, ScoreProcessorMultiplayer multiplayerProcessor, JudgementWindows windows = null) : this(map, mods, windows) { MultiplayerProcessor = multiplayerProcessor; MultiplayerProcessor.Processor = this; } /// <summary> /// Score processor from replay. /// </summary> /// <param name="replay"></param> /// <param name="windows"></param> public ScoreProcessor(Replay replay, JudgementWindows windows = null) { Mods = replay.Mods; Score = replay.Score; Accuracy = replay.Accuracy; MaxCombo = replay.MaxCombo; CurrentJudgements[Judgement.Marv] = replay.CountMarv; CurrentJudgements[Judgement.Perf] = replay.CountPerf; CurrentJudgements[Judgement.Great] = replay.CountGreat; CurrentJudgements[Judgement.Good] = replay.CountGood; CurrentJudgements[Judgement.Okay] = replay.CountOkay; CurrentJudgements[Judgement.Miss] = replay.CountMiss; InitializeJudgementWindows(windows); InitializeMods(); } /// <summary> /// Adds a judgement to the score and recalculates the score. /// </summary> public abstract void CalculateScore(Judgement judgement); /// <summary> /// Calculates the accuracy of the current play session. /// </summary> /// <returns></returns> protected abstract float CalculateAccuracy(); /// <summary> /// Changes the judgement windows for the processor /// </summary> private void InitializeJudgementWindows(JudgementWindows windows) { if (windows == null) return; JudgementWindow[Judgement.Marv] = windows.Marvelous; JudgementWindow[Judgement.Perf] = windows.Perfect; JudgementWindow[Judgement.Great] = windows.Great; JudgementWindow[Judgement.Good] = windows.Good; JudgementWindow[Judgement.Okay] = windows.Okay; JudgementWindow[Judgement.Miss] = windows.Miss; } /// <summary> /// Initializes the mods for this given play. /// (Recalculates hit windows.) /// </summary> private void InitializeMods() { for (var i = 0; i < JudgementWindow.Count; i++) JudgementWindow[(Judgement) i] *= ModHelper.GetRateFromMods(Mods); } /// <summary> /// Gets the judgement breakdown from hit data. /// </summary> /// <returns></returns> public string GetJudgementBreakdown() { var breakdown = ""; Stats.ForEach(x => breakdown += (int) x.Judgement); return breakdown; } /// <summary> /// Computes the hit statistics from the hit data. /// </summary> /// <returns></returns> public HitStatistics GetHitStatistics() { var largestHitWindow = JudgementWindow.Values.Max(); var hitDifferences = new List<int>(); var sum = 0; foreach (var breakdown in Stats) { var hitDifference = breakdown.HitDifference; // The LN releases are _not_ scaled here because we want an accurate mean. // No need to check for Type == Miss as all of them have hitDifference == int.MinValue. if (hitDifference != int.MinValue && Math.Abs(hitDifference) <= largestHitWindow) { hitDifferences.Add(hitDifference); sum += hitDifference; // This overflows at like 13 million max judgements. } } double mean = 0.0; double standardDeviation = 0.0; var count = hitDifferences.Count(); if (count > 0) { mean = (double) sum / (double) count; standardDeviation = Math.Sqrt(hitDifferences.Average(v => Math.Pow(v - mean, 2))); // Undo the rate scaling. mean /= ModHelper.GetRateFromMods(Mods); // Since variance(ax) = a^2 variance(x), then std(ax) = a std(x) standardDeviation /= ModHelper.GetRateFromMods(Mods); } return new HitStatistics { Mean = mean, StandardDeviation = standardDeviation }; } } }
34.139286
166
0.546815
[ "MPL-2.0" ]
nobbele/Quaver.API
Quaver.API/Maps/Processors/Scoring/ScoreProcessor.cs
9,559
C#
using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; namespace Alpaca.Markets { /// <summary> /// Provides unified type-safe access for Alpaca Data API via HTTP/REST. /// </summary> public sealed class AlpacaDataClient : IAlpacaDataClient { private readonly HttpClient _httpClient; /// <summary> /// Creates new instance of <see cref="AlpacaDataClient"/> object. /// </summary> /// <param name="configuration">Configuration parameters object.</param> public AlpacaDataClient( AlpacaDataClientConfiguration configuration) { configuration .EnsureNotNull(nameof(configuration)) .EnsureIsValid(); _httpClient = configuration.HttpClient ?? new HttpClient(); _httpClient.AddAuthenticationHeaders(configuration.SecurityId); _httpClient.DefaultRequestHeaders.Accept .Add(new MediaTypeWithQualityHeaderValue("application/json")); _httpClient.BaseAddress = configuration.ApiEndpoint; _httpClient.SetSecurityProtocol(); } /// <inheritdoc /> public void Dispose() => _httpClient.Dispose(); /// <inheritdoc /> public Task<IReadOnlyDictionary<String, IReadOnlyList<IAgg>>> GetBarSetAsync( BarSetRequest request, CancellationToken cancellationToken = default) => _httpClient.GetAsync<String, IReadOnlyList<IAgg>, String, List<JsonAlpacaAgg>>( request.EnsureNotNull(nameof(request)).Validate().GetUriBuilder(_httpClient), StringComparer.Ordinal, cancellationToken); /// <inheritdoc /> public Task<ILastTrade> GetLastTradeAsync( String symbol, CancellationToken cancellationToken = default) => _httpClient.GetAsync<ILastTrade, JsonLastTradeAlpaca>( $"v1/last/stocks/{symbol}", cancellationToken); /// <inheritdoc /> public Task<ILastQuote> GetLastQuoteAsync( String symbol, CancellationToken cancellationToken = default) => _httpClient.GetAsync<ILastQuote, JsonLastQuoteAlpaca>( $"v1/last_quote/stocks/{symbol}", cancellationToken); /// <inheritdoc /> public Task<IPage<IAgg>> ListHistoricalBarsAsync( HistoricalBarsRequest request, CancellationToken cancellationToken = default) => _httpClient.GetAsync<IPage<IAgg>, JsonBarsPage>( request.EnsureNotNull(nameof(request)).Validate().GetUriBuilder(_httpClient), cancellationToken); /// <inheritdoc /> public Task<IPage<IHistoricalQuote>> ListHistoricalQuotesAsync( HistoricalQuotesRequest request, CancellationToken cancellationToken = default) => _httpClient.GetAsync<IPage<IHistoricalQuote>, JsonQuotesPage>( request.EnsureNotNull(nameof(request)).Validate().GetUriBuilder(_httpClient), cancellationToken); /// <inheritdoc /> public Task<IPage<IHistoricalTrade>> ListHistoricalTradesAsync( HistoricalTradesRequest request, CancellationToken cancellationToken = default) => _httpClient.GetAsync<IPage<IHistoricalTrade>, JsonTradesPage>( request.EnsureNotNull(nameof(request)).Validate().GetUriBuilder(_httpClient), cancellationToken); } }
40.875
93
0.647484
[ "Apache-2.0" ]
gjtorikian/alpaca-trade-api-csharp
Alpaca.Markets/AlpacaDataClient.cs
3,599
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.Network.V20200601 { /// <summary> /// Authorization in an ExpressRouteCircuit resource. /// </summary> [AzureNativeResourceType("azure-native:network/v20200601:ExpressRouteCircuitAuthorization")] public partial class ExpressRouteCircuitAuthorization : Pulumi.CustomResource { /// <summary> /// The authorization key. /// </summary> [Output("authorizationKey")] public Output<string?> AuthorizationKey { get; private set; } = null!; /// <summary> /// The authorization use status. /// </summary> [Output("authorizationUseStatus")] public Output<string?> AuthorizationUseStatus { get; private set; } = null!; /// <summary> /// A unique read-only string that changes whenever the resource is updated. /// </summary> [Output("etag")] public Output<string> Etag { get; private set; } = null!; /// <summary> /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// </summary> [Output("name")] public Output<string?> Name { get; private set; } = null!; /// <summary> /// The provisioning state of the authorization resource. /// </summary> [Output("provisioningState")] public Output<string> ProvisioningState { get; private set; } = null!; /// <summary> /// Type of the resource. /// </summary> [Output("type")] public Output<string> Type { get; private set; } = null!; /// <summary> /// Create a ExpressRouteCircuitAuthorization resource with the given unique name, arguments, and options. /// </summary> /// /// <param name="name">The unique name of the resource</param> /// <param name="args">The arguments used to populate this resource's properties</param> /// <param name="options">A bag of options that control this resource's behavior</param> public ExpressRouteCircuitAuthorization(string name, ExpressRouteCircuitAuthorizationArgs args, CustomResourceOptions? options = null) : base("azure-native:network/v20200601:ExpressRouteCircuitAuthorization", name, args ?? new ExpressRouteCircuitAuthorizationArgs(), MakeResourceOptions(options, "")) { } private ExpressRouteCircuitAuthorization(string name, Input<string> id, CustomResourceOptions? options = null) : base("azure-native:network/v20200601:ExpressRouteCircuitAuthorization", name, null, MakeResourceOptions(options, id)) { } private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id) { var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, Aliases = { new Pulumi.Alias { Type = "azure-nextgen:network/v20200601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20150501preview:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20150501preview:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20150615:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20150615:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20160330:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20160330:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20160601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20160601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20160901:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20160901:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20161201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20161201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20170301:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20170301:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20170601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20170601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20170801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20170801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20170901:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20170901:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20171001:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20171001:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20171101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20171101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20180101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20180101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20180201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20180201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20180401:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20180401:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20180601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20180601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20180701:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20180701:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20180801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20180801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20181001:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20181001:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20181101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20181101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20181201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20181201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20190201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20190201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20190401:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20190401:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20190601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20190601:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20190701:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20190701:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20190801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20190801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20190901:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20190901:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20191101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20191101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20191201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20191201:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20200301:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20200301:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20200401:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20200401:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20200501:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20200501:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20200701:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20200701:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20200801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20200801:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-native:network/v20201101:ExpressRouteCircuitAuthorization"}, new Pulumi.Alias { Type = "azure-nextgen:network/v20201101:ExpressRouteCircuitAuthorization"}, }, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return merged; } /// <summary> /// Get an existing ExpressRouteCircuitAuthorization resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static ExpressRouteCircuitAuthorization Get(string name, Input<string> id, CustomResourceOptions? options = null) { return new ExpressRouteCircuitAuthorization(name, id, options); } } public sealed class ExpressRouteCircuitAuthorizationArgs : Pulumi.ResourceArgs { /// <summary> /// The authorization key. /// </summary> [Input("authorizationKey")] public Input<string>? AuthorizationKey { get; set; } /// <summary> /// The name of the authorization. /// </summary> [Input("authorizationName")] public Input<string>? AuthorizationName { get; set; } /// <summary> /// The authorization use status. /// </summary> [Input("authorizationUseStatus")] public InputUnion<string, Pulumi.AzureNative.Network.V20200601.AuthorizationUseStatus>? AuthorizationUseStatus { get; set; } /// <summary> /// The name of the express route circuit. /// </summary> [Input("circuitName", required: true)] public Input<string> CircuitName { get; set; } = null!; /// <summary> /// Resource ID. /// </summary> [Input("id")] public Input<string>? Id { get; set; } /// <summary> /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// </summary> [Input("name")] public Input<string>? Name { get; set; } /// <summary> /// The name of the resource group. /// </summary> [Input("resourceGroupName", required: true)] public Input<string> ResourceGroupName { get; set; } = null!; public ExpressRouteCircuitAuthorizationArgs() { } } }
64.112613
177
0.650882
[ "Apache-2.0" ]
sebtelko/pulumi-azure-native
sdk/dotnet/Network/V20200601/ExpressRouteCircuitAuthorization.cs
14,233
C#
using System.Collections; using System.Collections.Generic; using NUnit.Framework; using U.DalilaDB; using UnityEngine; using UnityEngine.TestTools; public class CustomType_TimeLapse { [Test] public void TimeLapse_Create() { TimeLapse tl; tl = new TimeLapse { seconds = 20, }; Debug.Log(tl + ""); Assert.AreEqual(20, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = new TimeLapse { seconds = 122, }; Debug.Log(tl + ""); Assert.AreEqual(2, tl.seconds); Assert.AreEqual(2, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = new TimeLapse { minutes = 120, }; Debug.Log(tl + ""); Assert.AreEqual(0, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(2, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = new TimeLapse { hours = 49, }; Debug.Log(tl + ""); Assert.AreEqual(0, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(1, tl.hours); Assert.AreEqual(2, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = new TimeLapse { days = 30, }; Debug.Log(tl + ""); Assert.AreEqual(0, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(1, tl.months); Assert.AreEqual(0, tl.years); tl = new TimeLapse { months = 27, }; Debug.Log(tl + ""); Assert.AreEqual(0, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(3, tl.months); Assert.AreEqual(2, tl.years); tl = new TimeLapse { years = 23, }; Debug.Log(tl + ""); Assert.AreEqual(0, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(23, tl.years); } [Test] public void TimeLapse_OperatorAdd() { TimeLapse tl1, tl2, tl; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { seconds = 50, }; tl = tl1 + tl2; Debug.Log(tl + ""); Assert.AreEqual(10, tl.seconds); Assert.AreEqual(3, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = tl2 + tl1; Debug.Log(tl + ""); Assert.AreEqual(10, tl.seconds); Assert.AreEqual(3, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); } [Test] public void TimeLapse_OperatorSubstract() { TimeLapse tl1, tl2, tl; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { seconds = 50, }; tl = tl1 - tl2; Debug.Log(tl + ""); Assert.AreEqual(30, tl.seconds); Assert.AreEqual(1, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = tl2 - tl1; Debug.Log(tl + ""); Assert.AreEqual(0, tl.seconds); Assert.AreEqual(0, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl1 = new TimeLapse { years = 2, }; tl2 = new TimeLapse { seconds = 50, }; tl = tl1 - tl2; Debug.Log(tl + ""); Assert.AreEqual(10, tl.seconds); Assert.AreEqual(59, tl.minutes); Assert.AreEqual(23, tl.hours); Assert.AreEqual(29, tl.days); Assert.AreEqual(11, tl.months); Assert.AreEqual(1, tl.years); } [Test] public void TimeLapse_OperatorEqual() { TimeLapse tl1, tl2, tl3; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { minutes = 2, seconds = 20, }; tl3 = new TimeLapse { seconds = 50, }; Assert.IsTrue(tl1.Equals(tl2)); Assert.IsTrue(tl1 == tl2); Assert.IsTrue(tl2.Equals(tl1)); Assert.IsTrue(tl2 == tl1); Assert.IsFalse(tl1 == tl3); Assert.IsFalse(tl1.Equals(tl3)); Assert.IsFalse(tl3 == tl1); Assert.IsFalse(tl3.Equals(tl1)); Assert.IsFalse(tl1 != tl2); Assert.IsFalse(tl2 != tl1); Assert.IsTrue(tl1 != tl3); Assert.IsTrue(tl3 != tl1); } [Test] public void TimeLapse_OperatorGratherThan() { TimeLapse tl1, tl2, tl3; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { minutes = 2, seconds = 20, }; tl3 = new TimeLapse { seconds = 50, }; Assert.IsTrue(tl1 > tl3); Assert.IsTrue(tl3 < tl1); Assert.IsTrue(tl1 >= tl2); Assert.IsTrue(tl2 <= tl1); } [Test] public void TimeLapse_CastFromInt() { TimeLapse tl1, tl2, tl3,tl; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { minutes = 2, seconds = 20, }; tl3 = new TimeLapse { seconds = 50, }; tl = tl1 + 60; Debug.Log(tl + ""); Assert.AreEqual(20, tl.seconds); Assert.AreEqual(3, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); tl = tl1 + 60.45f; Debug.Log(tl + ""); Assert.AreEqual(20, tl.seconds); Assert.AreEqual(3, tl.minutes); Assert.AreEqual(0, tl.hours); Assert.AreEqual(0, tl.days); Assert.AreEqual(0, tl.months); Assert.AreEqual(0, tl.years); } [Test] public void TimeLapse_CastToUint() { TimeLapse tl1, tl2, tl3; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { minutes = 2, seconds = 20, }; tl3 = new TimeLapse { seconds = 50, }; var sec = (uint)tl2; Debug.Log(sec); Assert.AreEqual(140, sec); } [Test] public void TimeLapse_CastToInt() { TimeLapse tl1, tl2, tl3; tl1 = new TimeLapse { minutes = 2, seconds = 20, }; tl2 = new TimeLapse { minutes = 2, seconds = 20, }; tl3 = new TimeLapse { seconds = 50, }; var sec = (int)tl2; Debug.Log(sec); Assert.AreEqual(140, sec); } }
19.597561
47
0.479278
[ "MIT" ]
Pronnus/DalilaDB-Unity
Tests/EditorMode/TimeLapse.cs
8,035
C#
using System.Threading; using System.Threading.Tasks; using DotnetSpider.Core; using DotnetSpider.MessageQueue; using Microsoft.Extensions.Logging; namespace DotnetSpider.Statistics { /// <summary> /// 统计服务中心 /// </summary> public class StatisticsCenter : IStatisticsCenter { private bool _isRunning; private readonly IMessageQueue _mq; private readonly ILogger _logger; private readonly IStatisticsStore _statisticsStore; /// <summary> /// 构造方法 /// </summary> /// <param name="mq">消息队列接口</param> /// <param name="statisticsStore">统计存储接口</param> /// <param name="logger">日志接口</param> public StatisticsCenter(IMessageQueue mq, IStatisticsStore statisticsStore, ILogger<StatisticsCenter> logger) { _mq = mq; _statisticsStore = statisticsStore; _logger = logger; } /// <summary> /// 启动统计服务中心 /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> /// <exception cref="SpiderException"></exception> public async Task StartAsync(CancellationToken cancellationToken) { if (_isRunning) { throw new SpiderException("统计中心正在运行中"); } await _statisticsStore.EnsureDatabaseAndTableCreatedAsync(); _logger.LogInformation("统计中心准备数据库完成"); _mq.Subscribe(Framework.StatisticsServiceTopic, async message => { var commandMessage = message.ToCommandMessage(); if (commandMessage == null) { _logger.LogWarning($"接收到非法消息: {message}"); return; } switch (commandMessage.Command) { case "Success": { var ownerId = commandMessage.Message; await _statisticsStore.IncrementSuccessAsync(ownerId); break; } case "Failed": { var data = commandMessage.Message.Split(','); await _statisticsStore.IncrementFailedAsync(data[0], int.Parse(data[1])); break; } case "Start": { var ownerId = commandMessage.Message; await _statisticsStore.StartAsync(ownerId); break; } case "Exit": { var ownerId = commandMessage.Message; await _statisticsStore.ExitAsync(ownerId); break; } case "Total": { var data = commandMessage.Message.Split(','); await _statisticsStore.IncrementTotalAsync(data[0], int.Parse(data[1])); break; } case "DownloadSuccess": { var data = commandMessage.Message.Split(','); await _statisticsStore.IncrementDownloadSuccessAsync(data[0], int.Parse(data[1]), long.Parse(data[2])); break; } case "DownloadFailed": { var data = commandMessage.Message.Split(','); await _statisticsStore.IncrementDownloadFailedAsync(data[0], int.Parse(data[1]), long.Parse(data[2])); break; } case "Print": { var ownerId = commandMessage.Message; var statistics = await _statisticsStore.GetSpiderStatisticsAsync(ownerId); _logger.LogInformation( $"任务 {ownerId} 总计 {statistics.Total}, 成功 {statistics.Success}, 失败 {statistics.Failed}, 剩余 {statistics.Total - statistics.Success - statistics.Failed}"); break; } } }); _logger.LogInformation("统计中心启动"); } /// <summary> /// 停止统计中心 /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public Task StopAsync(CancellationToken cancellationToken) { _mq.Unsubscribe(Framework.StatisticsServiceTopic); _isRunning = false; _logger.LogInformation("统计中心退出"); #if NETFRAMEWORK return DotnetSpider.Core.Framework.CompletedTask; #else return Task.CompletedTask; #endif } } }
26.397059
159
0.663231
[ "MIT" ]
Mahi-Uddin/DotnetSpider
src/DotnetSpider/Statistics/StatisticsCenter.cs
3,768
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace DataAccessLayer { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] public string fffff { get { return ((string)(this["fffff"])); } set { this["fffff"] = value; } } } }
38.538462
152
0.547572
[ "Apache-2.0" ]
satveersaggu01/IMS
DALIMS/Settings.Designer.cs
1,505
C#
using System; using System.Linq; using System.Threading.Tasks; namespace ESO_LangEditorBlazorServer.Data { public class WeatherForecastService { private static readonly string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) { var rng = new Random(); return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = startDate.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }).ToArray()); } } }
30.153846
110
0.579082
[ "Apache-2.0" ]
bevisbear/ESO_LangEditor
ESO_LangEditorBlazorServer/Data/WeatherForecastService.cs
784
C#
using Newtonsoft.Json; using Ninject.Extensions.Factory; using Ninject.Modules; using Serilog; using System; using System.IO; using System.Text; using TeasmCompanion.Interfaces; using TeasmCompanion.Stores; using TeasmCompanion.Stores.Imap; using TeasmCompanion.TeamsInternal.TeamsInternalApiAccessor; using TeasmCompanion.TeamsMonitors; using TeasmCompanion.TeamsTokenRetrieval; #nullable enable namespace TeasmCompanion { public class Bindings : NinjectModule { CommandlineOptions? options { get; } public Bindings(CommandlineOptions? options) : base() { this.options = options; } public override void Load() { Configuration config; string jsonFilename = "config.json"; try { if (options?.Profile != null) { jsonFilename = $"config.{options.Profile}.json"; } var json = File.ReadAllText(jsonFilename, Encoding.UTF8); config = JsonConvert.DeserializeObject<Configuration>(json); } catch (Exception e) { Console.WriteLine($"Could not read configuration from '{jsonFilename}', using default values. See README for details on how to set up a config file. The error was: {e.Message}"); config = new Configuration(); } var logger = GetLoggerConfiguration(config.LogLevel).CreateLogger(); logger.Information("Loading configuration from [{JsonFileName}]", jsonFilename); Bind<ILogger>().ToConstant(logger); Bind<Configuration>().ToConstant(config); Bind<TeamsTokenRetriever>().ToSelf().InSingletonScope(); Bind<TeamsGlobalApiAccessor>().ToSelf().InSingletonScope(); Bind<TeamsUserTenantsRetriever>().ToSelf().InSingletonScope(); Bind<TeamsLongPollingRegistry>().ToSelf().InSingletonScope(); Bind<TeamsLongPollingApiAccessor>().ToSelf().InSingletonScope(); Bind<ImapConnectionFactory>().ToSelf(); Bind<TeamsUserRegistry>().ToSelf().InSingletonScope(); Bind<ITeamsUserRegistry>().To<TeamsUserRegistry>().InSingletonScope(); Bind<ITeamsUserStore>().To<ImapStore>().InSingletonScope(); Bind<ITeamsChatRegistry>().To<TeamsChatRegistry>().InSingletonScope(); Bind<ITeamsChatStore>().To<ImapStore>().InSingletonScope(); Bind<IProcessedMessageFactory>().ToFactory(); Bind<IProcessedNotificationMessageFactory>().ToFactory(); } private LoggerConfiguration GetLoggerConfiguration(string loglevel) { LoggerConfiguration logconf; switch (loglevel) { case "Debug": logconf = LoggerConfigurations.Debug(); break; case "Information": logconf = LoggerConfigurations.Information(); break; default: logconf = LoggerConfigurations.Debug(); break; } return logconf; } } }
37.454545
195
0.588896
[ "MIT" ]
heinrich-ulbricht/teasm-companion
TeasmCompanion/Bindings.cs
3,298
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; namespace ZaxHerbivoryTrainer.APP.Models { [Serializable()] [JsonObject(MemberSerialization.OptIn)] public class UserGuessModel { [JsonProperty(PropertyName = "UsersGuessId")] public int UsersGuessId { get; set; } [JsonProperty(PropertyName = "GuessPercentage")] public decimal GuessPercentage { get; set; } [JsonProperty(PropertyName = "UserId")] public int UserId { get; set; } [JsonProperty(PropertyName = "ImageId")] public int ImageId { get; set; } [JsonProperty(PropertyName = "Phase")] public Phase Phase { set; get; } [JsonProperty(PropertyName = "Image")] public virtual ImageModel Image { set; get; } //public virtual User User { set; get; } } public enum Phase:byte { ONE =0, TWO= 1, THREE =2 } }
25.512821
56
0.624121
[ "MIT" ]
Samueldebono/ZaxHerbivoryTrainer
ZaxHerbivoryTrainer.APP/Models/UserGuessModel.cs
997
C#
using NetPrints.Core; using System.Runtime.Serialization; namespace NetPrints.Graph { [DataContract] public abstract class ExecutionEntryNode : Node { /// <summary> /// Output execution pin that initially executes when a method gets called. /// </summary> public NodeOutputExecPin InitialExecutionPin { get { return OutputExecPins[0]; } } public ExecutionEntryNode(ExecutionGraph graph) : base(graph) { } } }
22.833333
84
0.578467
[ "MIT" ]
RobinKa/netprints
NetPrints/Graph/ExecutionEntryNode.cs
550
C#
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Xml.Linq; using Xunit.Internal; using Xunit.Runner.Common; using Xunit.v3; namespace Xunit.Runner.SystemConsole; class ConsoleRunner { readonly string[] args; volatile bool cancel; readonly object consoleLock = new(); readonly ConcurrentDictionary<string, ExecutionSummary> completionMessages = new(); bool failed; IRunnerLogger? logger; public ConsoleRunner( string[] args, object? consoleLock = null) { this.args = Guard.ArgumentNotNull(nameof(args), args); this.consoleLock = consoleLock ?? new object(); } public async ValueTask<int> EntryPoint() { var globalInternalDiagnosticMessages = false; var noColor = false; try { var runnerFolder = Path.GetDirectoryName(typeof(Program).Assembly.Location); var commandLine = new CommandLine(runnerFolder, args); if (args.Length == 0 || commandLine.HelpRequested) { PrintHeader(); var executableName = Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().GetLocalCodeBase()); Console.WriteLine("Copyright (C) .NET Foundation."); Console.WriteLine(); Console.WriteLine($"usage: {executableName} <assemblyFile> [configFile] [assemblyFile [configFile]...] [options] [reporter] [resultFormat filename [...]]"); Console.WriteLine(); Console.WriteLine("Note: Configuration files must end in .json (for JSON) or .config (for XML)"); Console.WriteLine(" XML is supported for v1 and v2 only, on .NET Framework only"); Console.WriteLine(" JSON is supported for v2 and later, on all supported plaforms"); commandLine.PrintUsage(); return 2; } var project = commandLine.Parse(); if (project.Assemblies.Count == 0) throw new ArgumentException("must specify at least one assembly"); AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; Console.CancelKeyPress += (sender, e) => { if (!cancel) { Console.WriteLine("Canceling... (Press Ctrl+C again to terminate)"); cancel = true; e.Cancel = true; } }; if (project.Configuration.PauseOrDefault) { Console.Write("Press any key to start execution..."); Console.ReadKey(true); Console.WriteLine(); } if (project.Configuration.DebugOrDefault) Debugger.Launch(); // We will enable "global" internal diagnostic messages if any test assembly wanted them globalInternalDiagnosticMessages = project.Assemblies.Any(a => a.Configuration.InternalDiagnosticMessagesOrDefault); noColor = project.Configuration.NoColorOrDefault; logger = new ConsoleRunnerLogger(!noColor, consoleLock); var diagnosticMessageSink = ConsoleDiagnosticMessageSink.ForInternalDiagnostics(consoleLock, globalInternalDiagnosticMessages, noColor); var reporter = project.RunnerReporter; var reporterMessageHandler = await reporter.CreateMessageHandler(logger, diagnosticMessageSink); if (!reporter.ForceNoLogo && !project.Configuration.NoLogoOrDefault) PrintHeader(); var failCount = 0; if (project.Configuration.List != null) await ListProject(project); else failCount = await RunProject(project, reporterMessageHandler); if (cancel) return -1073741510; // 0xC000013A: The application terminated as a result of a CTRL+C if (project.Configuration.WaitOrDefault) { Console.WriteLine(); Console.Write("Press any key to continue..."); Console.ReadKey(); Console.WriteLine(); } return project.Configuration.IgnoreFailures == true || failCount == 0 ? 0 : 1; } catch (Exception ex) { if (!noColor) ConsoleHelper.SetForegroundColor(ConsoleColor.Red); Console.WriteLine($"error: {ex.Message}"); if (globalInternalDiagnosticMessages) { if (!noColor) ConsoleHelper.SetForegroundColor(ConsoleColor.DarkGray); Console.WriteLine(ex.StackTrace); } return ex is ArgumentException ? 3 : 4; } finally { if (!noColor) ConsoleHelper.ResetColor(); } } void OnUnhandledException( object sender, UnhandledExceptionEventArgs e) { if (e.ExceptionObject is Exception ex) Console.WriteLine(ex.ToString()); else Console.WriteLine("Error of unknown type thrown in application domain"); Environment.Exit(1); } void PrintHeader() { #if NET472 var buildTarget = $"net472"; #elif NET48 var buildTarget = $"net48"; #else #error Unknown target framework #endif #if BUILD_X86 buildTarget += "/x86"; #else buildTarget += "/AnyCPU"; #endif Console.WriteLine($"xUnit.net v3 Console Runner v{ThisAssembly.AssemblyInformationalVersion} [{buildTarget}] ({IntPtr.Size * 8}-bit {RuntimeInformation.FrameworkDescription})"); } async ValueTask ListProject(XunitProject project) { var (listOption, listFormat) = project.Configuration.List!.Value; var testCasesByAssembly = new Dictionary<string, List<_TestCaseDiscovered>>(); foreach (var assembly in project.Assemblies) { var assemblyFileName = Guard.ArgumentNotNull("assembly.AssemblyFilename", assembly.AssemblyFileName); // Default to false for console runners assembly.Configuration.PreEnumerateTheories ??= false; // Setup discovery and execution options with command-line overrides var discoveryOptions = _TestFrameworkOptions.ForDiscovery(assembly.Configuration); var assemblyDisplayName = Path.GetFileNameWithoutExtension(assemblyFileName); var appDomainSupport = assembly.Configuration.AppDomainOrDefault; var shadowCopy = assembly.Configuration.ShadowCopyOrDefault; var longRunningSeconds = assembly.Configuration.LongRunningTestSecondsOrDefault; using var _ = AssemblyHelper.SubscribeResolveForAssembly(assemblyFileName); await using var controller = XunitFrontController.ForDiscoveryAndExecution(assembly); var discoverySink = new TestDiscoverySink(() => cancel); var settings = new FrontControllerFindSettings(discoveryOptions, assembly.Configuration.Filters); controller.Find(discoverySink, settings); discoverySink.Finished.WaitOne(); testCasesByAssembly.Add(assemblyFileName, discoverySink.TestCases); } ConsoleProjectLister.List(testCasesByAssembly, listOption, listFormat); } async ValueTask<int> RunProject( XunitProject project, _IMessageSink reporterMessageHandler) { XElement? assembliesElement = null; var clockTime = Stopwatch.StartNew(); var xmlTransformers = TransformFactory.GetXmlTransformers(project); var needsXml = xmlTransformers.Count > 0; // TODO: Parallelize the ones that will parallelize, and then run the rest sequentially? var parallelizeAssemblies = project.Assemblies.All(assembly => assembly.Configuration.ParallelizeAssemblyOrDefault); if (needsXml) assembliesElement = new XElement("assemblies"); var originalWorkingFolder = Directory.GetCurrentDirectory(); if (parallelizeAssemblies) { var tasks = project.Assemblies.Select( assembly => Task.Run( () => RunProjectAssembly( assembly, needsXml, reporterMessageHandler ).AsTask() ) ); var results = Task.WhenAll(tasks).GetAwaiter().GetResult(); foreach (var assemblyElement in results.WhereNotNull()) assembliesElement?.Add(assemblyElement); } else { foreach (var assembly in project.Assemblies) { var assemblyElement = await RunProjectAssembly( assembly, needsXml, reporterMessageHandler ); if (assemblyElement != null) assembliesElement?.Add(assemblyElement); } } clockTime.Stop(); if (assembliesElement != null) assembliesElement.Add(new XAttribute("timestamp", DateTime.Now.ToString(CultureInfo.InvariantCulture))); if (completionMessages.Count > 0) { var summaries = new TestExecutionSummaries { ElapsedClockTime = clockTime.Elapsed }; foreach (var completionMessage in completionMessages.OrderBy(kvp => kvp.Key)) summaries.Add(completionMessage.Key, completionMessage.Value); reporterMessageHandler.OnMessage(summaries); } Directory.SetCurrentDirectory(originalWorkingFolder); if (assembliesElement != null) xmlTransformers.ForEach(transformer => transformer(assembliesElement)); return failed ? 1 : completionMessages.Values.Sum(summary => summary.Failed + summary.Errors); } async ValueTask<XElement?> RunProjectAssembly( XunitProjectAssembly assembly, bool needsXml, _IMessageSink reporterMessageHandler) { if (cancel) return null; var assemblyElement = needsXml ? new XElement("assembly") : null; try { var assemblyFileName = Guard.ArgumentNotNull("assembly.AssemblyFilename", assembly.AssemblyFileName); // Default to false for console runners assembly.Configuration.PreEnumerateTheories ??= false; // Setup discovery and execution options with command-line overrides var discoveryOptions = _TestFrameworkOptions.ForDiscovery(assembly.Configuration); var executionOptions = _TestFrameworkOptions.ForExecution(assembly.Configuration); var assemblyDisplayName = Path.GetFileNameWithoutExtension(assemblyFileName); var noColor = assembly.Project.Configuration.NoColorOrDefault; var diagnosticMessageSink = ConsoleDiagnosticMessageSink.ForDiagnostics(consoleLock, assemblyDisplayName, assembly.Configuration.DiagnosticMessagesOrDefault, noColor); var internalDiagnosticsMessageSink = ConsoleDiagnosticMessageSink.ForInternalDiagnostics(consoleLock, assemblyDisplayName, assembly.Configuration.InternalDiagnosticMessagesOrDefault, noColor); var appDomainSupport = assembly.Configuration.AppDomainOrDefault; var shadowCopy = assembly.Configuration.ShadowCopyOrDefault; var longRunningSeconds = assembly.Configuration.LongRunningTestSecondsOrDefault; using var _ = AssemblyHelper.SubscribeResolveForAssembly(assemblyFileName, internalDiagnosticsMessageSink); await using var controller = XunitFrontController.ForDiscoveryAndExecution(assembly, diagnosticMessageSink: diagnosticMessageSink); var executionStarting = new TestAssemblyExecutionStarting { Assembly = assembly, ExecutionOptions = executionOptions }; reporterMessageHandler.OnMessage(executionStarting); IExecutionSink resultsSink = new DelegatingExecutionSummarySink(reporterMessageHandler, () => cancel, (summary, _) => completionMessages.TryAdd(controller.TestAssemblyUniqueID, summary)); if (assemblyElement != null) resultsSink = new DelegatingXmlCreationSink(resultsSink, assemblyElement); if (longRunningSeconds > 0) resultsSink = new DelegatingLongRunningTestDetectionSink(resultsSink, TimeSpan.FromSeconds(longRunningSeconds), diagnosticMessageSink); if (assembly.Configuration.FailSkipsOrDefault) resultsSink = new DelegatingFailSkipSink(resultsSink); using (resultsSink) { var settings = new FrontControllerFindAndRunSettings(discoveryOptions, executionOptions, assembly.Configuration.Filters); controller.FindAndRun(resultsSink, settings); resultsSink.Finished.WaitOne(); var executionFinished = new TestAssemblyExecutionFinished { Assembly = assembly, ExecutionOptions = executionOptions, ExecutionSummary = resultsSink.ExecutionSummary }; reporterMessageHandler.OnMessage(executionFinished); if (assembly.Configuration.StopOnFailOrDefault && resultsSink.ExecutionSummary.Failed != 0) { Console.WriteLine("Canceling due to test failure..."); cancel = true; } } } catch (Exception ex) { failed = true; var e = ex; while (e != null) { Console.WriteLine($"{e.GetType().FullName}: {e.Message}"); if (assembly.Configuration.InternalDiagnosticMessagesOrDefault) Console.WriteLine(e.StackTrace); e = e.InnerException; } } return assemblyElement; } }
32.606557
195
0.753561
[ "Apache-2.0" ]
scottdensmore/xunit
src/xunit.v3.runner.console/ConsoleRunner.cs
11,936
C#
namespace OdeToFood.Areas.HelpPage.ModelDescriptions { public class CollectionModelDescription : ModelDescription { public ModelDescription ElementDescription { get; set; } } }
28
64
0.75
[ "MIT" ]
alex-resdiary/ASP.Net-MVC4
OdeToFood/Areas/HelpPage/ModelDescriptions/CollectionModelDescription.cs
196
C#
namespace SFA.Apprenticeships.Web.Candidate.IoC { using Application.Application; using Application.Candidate.Strategies; using Application.Candidate.Strategies.Apprenticeships; using Application.Vacancies; using Application.Vacancy; using Domain.Entities.Vacancies.Apprenticeships; using Domain.Entities.Vacancies.Traineeships; using Infrastructure.Raa; using StructureMap.Configuration.DSL; public class VacancySourceRegistry : Registry { public VacancySourceRegistry() { // Strategies For<IGetCandidateVacancyDetailStrategy<ApprenticeshipVacancyDetail>>().Use<GetCandidateVacancyDetailStrategy<ApprenticeshipVacancyDetail>>(); For<IGetCandidateVacancyDetailStrategy<TraineeshipVacancyDetail>>().Use<GetCandidateVacancyDetailStrategy<TraineeshipVacancyDetail>>(); // Application status provider -> it's not exactly related with vacancy sources... For<IGetCandidateApprenticeshipApplicationsStrategy>().Use<GetCandidateApprenticeshipApplicationsStrategy>(); // Services -- For<IVacancyIndexDataProvider>().Use<VacancyIndexDataProvider>(); For<IVacancyDataProvider<ApprenticeshipVacancyDetail>>() .Use<ApprenticeshipVacancyDataProvider>() .Name = "ApprenticeshipVacancyDataProvider"; For<IVacancyDataProvider<TraineeshipVacancyDetail>>() .Use<TraineeshipVacancyDataProvider>() .Name = "TraineeshipVacancyDataProvider"; //-- } } }
42.972973
153
0.708805
[ "MIT" ]
BugsUK/FindApprenticeship
src/SFA.Apprenticeships.Web.Candidate/IoC/VacancySourceRegistry.cs
1,592
C#
// ------------------------------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // ------------------------------------------------------------------------------------------------- using System; namespace Microsoft.Health.Dicom.Core.Exceptions; public class FrameNotFoundException : ResourceNotFoundException { public FrameNotFoundException() : base(DicomCoreResource.FrameNotFound) { } public FrameNotFoundException(Exception innerException) : base(DicomCoreResource.FrameNotFound, innerException) { } }
33.045455
101
0.540578
[ "MIT" ]
IoTFier/dicom-server
src/Microsoft.Health.Dicom.Core/Exceptions/FrameNotFoundException.cs
729
C#
using Newtonsoft.Json; namespace FlareSolverrSharp.Types { public class FlareSolverrRequest { [JsonProperty("cmd")] public string Cmd; [JsonProperty("url")] public string Url; [JsonProperty("session")] public string Session; [JsonProperty("proxy")] public FlareSolverrRequestProxy Proxy; } }
18.65
46
0.616622
[ "MIT" ]
FlareSolverr/FlareSolverrSharp
src/FlareSolverrSharp/Types/FlareSolverrRequest.cs
375
C#
using DenCloud.Core.Authentication; using DenCloud.Core.Data; using DenCloud.Core.FileSystem; using DenCloud.Core.Logging; using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DenCloud.Core.Commands { public class RetrCommand : FtpCommand { public RetrCommand( ControlConnection controlConnection, ILogger logger) : base(controlConnection) { this.logger = logger; } ILogger logger { get; set; } public async override Task<FtpReply> Execute(string parameter) { try { var errorReply = CheckUserInput(parameter, true); if (errorReply != null) return errorReply; await controlConnection.OnDownloadFile(parameter); return new FtpReply() { ReplyCode = FtpReplyCode.SuccessClosingDataConnection, Message = "Transfer complete." }; } catch (Exception ex) { if (ex is ObjectDisposedException) return null; logger.Log(ex.Message, RecordKind.Error); if ((ex is FormatException) || (ex is InvalidOperationException) || (ex is DirectoryNotFoundException) || (ex is FileNotFoundException)) { return new FtpReply() { ReplyCode = FtpReplyCode.FileNoAccess, Message = ex.Message }; } if ((ex is UnauthorizedAccessException) || (ex is IOException)) return new FtpReply() { ReplyCode = FtpReplyCode.FileBusy, Message = ex.Message }; return new FtpReply() { Message = $"Error happened: {ex.Message}", ReplyCode = FtpReplyCode.LocalError }; } } } }
30.84507
121
0.513242
[ "MIT" ]
ActualDennis/CloudStorageFTP
DenCloud.Core/Commands/RetrCommand.cs
2,192
C#
using System.Collections.Generic; using System; using System.Linq; using LCGuidebook.Core.DataStructures; namespace LCGuidebook.Core { //public delegate void StageFinishedHandler(Task previous, Task next, Task task); public static class Misc { public const string BAD_ACTIVATION_SEQUENCE = "Must be activated after all dependencies"; public static int Round(double value) => (int)(value + 0.5); public static double Clamp(this double value) { if (value < 0) { return 0; } else if (value > 1) { return 1; } else { return value; } } public static LinkedList<Region> ShortestPath(Region start, Region end) { // Assume all weight between nodes are 1 for now // (node, predecessor, distance, isOutside) var table = ResourceManager.Regions.Select<Region, (Region, Region, int, bool)>(r => { if (r == start) return (r, null, int.MaxValue, true); else return (r, null, 0, true); } ).ToList(); while (table.Count != 0) { // find the tuple with least distance var tup = table.Aggregate((acc, t) => { if (acc.Item3 > t.Item3) { return t; } else { return acc; } }); tup.Item4 = false; tup.Item1.Neighbors.ForEach(n => { var t = table.Find(r => r.Item1 == n); if (tup.Item3 + 1 < t.Item3) { tup.Item3++; t.Item2 = tup.Item1; } }); } var path = new LinkedList<Region>(); path.AddFirst(end); var iter = table.Find(t => t.Item1 == end); while (iter.Item2 != null) { path.AddFirst(iter.Item2); iter = table.Find(t => t.Item1 == iter.Item2); } return path; } } }
21.265823
91
0.596429
[ "MIT" ]
Quantumzhao/Atomization
Core/Misc.cs
1,682
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.ML.Runtime.Data; using Microsoft.ML.Runtime.Internal.Utilities; using Microsoft.ML.Runtime.Tools; using Microsoft.ML.TestFramework; using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Xunit; using Xunit.Abstractions; namespace Microsoft.ML.Runtime.RunTests { /// <summary> /// This is a base test class designed to support baseline comparison. /// </summary> public abstract partial class BaseTestBaseline : BaseTestClass { public const int DigitsOfPrecision = 7; protected BaseTestBaseline(ITestOutputHelper output) : base(output) { } internal const string RawSuffix = ".raw"; private const string LogSuffix = ".log"; private readonly string _logRootRelPath = Path.Combine("Logs", BuildString); // Relative to OutDir. private const string TestDir = @"test"; private const string DataRootRegExp = @"[a-z]:\\[^/\t ]+\\test\\data" + @"\\[^/\t ]+"; private const string SamplesRootRegExp = @"[a-z]:\\[^/\t ]+\\Samples\\"; private const string SourceRootRegExp = @"[a-z]:\\[^/\t ]+\\source\\"; private const string TestsRootRegExp = @"[a-z]:\\[^/\t ]+\\Tests\\"; private const string DataRootUnixRegExp = @"\/[^\\\t ]+\/test\/data" + @"\/[^\\\t ]+"; private const string SamplesRootUnixRegExp = @"\/[^\\\t ]+\/Samples\/[^\\\t ]+"; private const string SourceRootUnixRegExp = @"\/[^\\\t ]+\/source\/[^\\\t ]+"; private const string TestsRootUnixRegExp = @"\/[^\\\t ]+\/Tests\/[^\\\t ]+"; #if DEBUG private const string BuildString = "SingleDebug"; private const string Mode = "Debug"; #else private const string BuildString = "SingleRelease"; private const string Mode = "Release"; #endif private const string OutputRootRegExp = @"[a-z]:\\[^/\t ]+\\TestOutput" + @"\\[^/\t ]+"; private static readonly string BinRegExp = @"[a-z]:\\[^\t ]+\\bin\\" + Mode; private static readonly string Bin64RegExp = @"[a-z]:\\[^/\t ]+\\bin\\x64\\" + Mode; private const string OutputRootUnixRegExp = @"\/[^\\\t ]+\/TestOutput" + @"\/[^\\\t ]+"; private static readonly string BinRegUnixExp = @"\/[^\\\t ]+\/bin\/" + Mode; private static readonly string Bin64RegUnixExp = @"\/[^\\\t ]+\/bin\/x64\/" + Mode; /// <summary> /// When the progress log is appended to the end of output (in test runs), this line precedes the progress log. /// </summary> protected const string ProgressLogLine = "--- Progress log ---"; // Full paths to the baseline directories. private string _baselineCommonDir; private string _baselineBuildStringDir; // The writer to write to test log files. protected StreamWriter LogWriter; protected ConsoleEnvironment Env; protected MLContext ML; private bool _normal; private bool _passed; protected override void Initialize() { base.Initialize(); // Create the output and log directories. string baselineRootDir = Path.Combine(RootDir, TestDir, "BaselineOutput"); Contracts.Check(Directory.Exists(baselineRootDir)); _baselineCommonDir = Path.Combine(baselineRootDir, "Common"); _baselineBuildStringDir = Path.Combine(baselineRootDir, BuildString); string logDir = Path.Combine(OutDir, _logRootRelPath); Directory.CreateDirectory(logDir); string logPath = Path.Combine(logDir, FullTestName + LogSuffix); LogWriter = OpenWriter(logPath); _passed = true; Env = new ConsoleEnvironment(42, outWriter: LogWriter, errWriter: LogWriter) .AddStandardComponents(); ML = new MLContext(42); } // This method is used by subclass to dispose of disposable objects // such as LocalEnvironment. // It is called as a first step in test clean up. protected override void Cleanup() { if (Env != null) Env.Dispose(); Env = null; Contracts.Assert(IsActive); Log("Test {0}: {1}: {2}", TestName, _normal ? "completed normally" : "aborted", _passed ? "passed" : "failed"); Contracts.AssertValue(LogWriter); LogWriter.Dispose(); LogWriter = null; base.Cleanup(); } protected bool IsActive { get { return LogWriter != null; } } protected bool IsPassing { get { return _passed; } } // Called by a test to signal normal completion. If this is not called before the // TestScope is disposed, we assume the test was aborted. protected void Done() { Contracts.Assert(IsActive); Contracts.Assert(!_normal, "Done() should only be called once!"); _normal = true; Assert.True(_passed); } protected bool Check(bool f, string msg) { if (!f) Fail(msg); return f; } protected bool Check(bool f, string msg, params object[] args) { if (!f) Fail(msg, args); return f; } protected void Fail(string msg) { Fail(false, msg); } protected void Fail(string fmt, params object[] args) { Fail(false, fmt, args); } protected void Fail(bool relax, string fmt, params object[] args) { Contracts.Assert(IsActive); if (!relax) _passed = false; Log("*** Failure: " + fmt, args); } protected void Log(string msg) { Contracts.Assert(IsActive); Contracts.AssertValue(LogWriter); LogWriter.WriteLine(msg); Output.WriteLine(msg); } protected void Log(string fmt, params object[] args) { Contracts.Assert(IsActive); Contracts.AssertValue(LogWriter); LogWriter.WriteLine(fmt, args); Output.WriteLine(fmt, args); } protected string GetBaselinePath(string name) { Contracts.Assert(IsActive); if (string.IsNullOrWhiteSpace(name)) return null; return GetBaselinePath(string.Empty, name); } protected string GetBaselinePath(string subDir, string name) { Contracts.Assert(IsActive); subDir = subDir ?? string.Empty; // first check the Common folder, and use it if it exists string commonBaselinePath = Path.GetFullPath(Path.Combine(_baselineCommonDir, subDir, name)); if (File.Exists(commonBaselinePath)) { return commonBaselinePath; } return Path.GetFullPath(Path.Combine(_baselineBuildStringDir, subDir, name)); } // Inverts the _passed flag. Do not ever use this except in rare conditions. Eg. Recording failure of a test as a success. protected void DoNotEverUseInvertPass() { _passed = !_passed; } // These are used to normalize output. private static readonly Regex _matchDataRoot = new Regex(DataRootRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchDataUnixRoot = new Regex(DataRootUnixRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchSamplesRoot = new Regex(SamplesRootRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchSamplesUnixRoot = new Regex(SamplesRootUnixRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchSourceRoot = new Regex(SourceRootRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchSourceUnixRoot = new Regex(SourceRootUnixRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTestsRoot = new Regex(TestsRootRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchOutputRoot = new Regex(OutputRootRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchOutputUnixRoot = new Regex(OutputRootUnixRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTL = new Regex(@"[a-z]:\\[a-z0-9_\.\\]+\\TL.exe", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTempFile = new Regex(@"[a-z]:\\users\\[a-z0-9_\.]+\\appdata\\local\\temp\\[a-z0-9_\.\\]*\.tmp", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTempDir = new Regex(@"[a-z]:\\users\\[a-z0-9_\.]+\\appdata\\local\\temp\\[a-z0-9_\.\\]+\\", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTempUnixDir = new Regex(@"\/(var\/)?tmp" + @"\/[^\\\t ]+", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTempDirServiceProfile = new Regex(@"[a-z]:\\Windows\\ServiceProfiles\\[a-z0-9_\.]+\\appdata\\local\\temp\\[a-z0-9_\.\\]+", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTempWindows = new Regex(@"[a-z]:\\Windows\\Temp\\[a-z0-9_\.]+", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchDateTime = new Regex(@"[0-9]{1,4}[-/][0-9]{1,2}[-/][0-9]{1,4} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,4}(\.[0-9]+)?( [AP]M)?", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchTime = new Regex(@"[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?", RegexOptions.Compiled); private static readonly Regex _matchShortTime = new Regex(@"\([0-9]{2}:[0-9]{2}(\.[0-9]+)?\)", RegexOptions.Compiled); private static readonly Regex _matchMemory = new Regex(@"memory usage\(MB\): [0-9]+", RegexOptions.Compiled); private static readonly Regex _matchElapsed = new Regex(@"Time elapsed\(s\): [0-9.]+", RegexOptions.Compiled); private static readonly Regex _matchTimes = new Regex(@"Instances caching time\(s\): [0-9\.]+", RegexOptions.Compiled); private static readonly Regex _matchUpdatesPerSec = new Regex(@", ([0-9\.]+|Infinity)M WeightUpdates/sec", RegexOptions.Compiled); private static readonly Regex _matchParameterT = new Regex(@"=PARAM:/t:[0-9]+", RegexOptions.Compiled); private static readonly Regex _matchInfinity = new Regex(@"\u221E", RegexOptions.Compiled); private static readonly Regex _matchErrorLog = new Regex(@"Error_[\w-]+\.log", RegexOptions.Compiled); private static readonly Regex _matchGuid = new Regex(@"[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchBin = new Regex(BinRegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchUnixBin = new Regex(BinRegUnixExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchBin64 = new Regex(Bin64RegExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex _matchUnixBin64 = new Regex(Bin64RegUnixExp, RegexOptions.IgnoreCase | RegexOptions.Compiled); protected void Normalize(string path) { string rawPath = path + RawSuffix; File.Delete(rawPath); File.Move(path, rawPath); using (StreamReader src = OpenReader(rawPath)) using (TextWriter dst = File.CreateText(path)) { string line; while ((line = src.ReadLine()) != null) { line = _matchDataRoot.Replace(line, "%Data%"); line = _matchDataUnixRoot.Replace(line, "%Data%"); line = _matchOutputRoot.Replace(line, "%Output%"); line = _matchOutputUnixRoot.Replace(line, "%Output%"); line = _matchSamplesRoot.Replace(line, "%Samples%\\"); line = _matchSamplesUnixRoot.Replace(line, "%Samples%\\"); line = _matchSourceRoot.Replace(line, "%Source%\\"); line = _matchSourceUnixRoot.Replace(line, "%Source%\\"); line = _matchTestsRoot.Replace(line, "%Tests%\\"); line = _matchBin.Replace(line, "%Bin%\\"); line = _matchUnixBin.Replace(line, "%Bin%\\"); line = _matchBin64.Replace(line, "%Bin%\\"); line = _matchUnixBin64.Replace(line, "%Bin%\\"); line = _matchTL.Replace(line, "%TL%"); line = _matchTempFile.Replace(line, "%Temp%"); line = _matchTempDir.Replace(line, "%Temp%\\"); line = _matchTempUnixDir.Replace(line, "%Temp%\\"); line = _matchTempDirServiceProfile.Replace(line, "%Temp%"); line = _matchTempWindows.Replace(line, "%Temp%"); line = _matchDateTime.Replace(line, "%DateTime%"); line = _matchTime.Replace(line, "%Time%"); line = _matchShortTime.Replace(line, "(%Time%)"); line = _matchElapsed.Replace(line, "Time elapsed(s): %Number%"); line = _matchMemory.Replace(line, "memory usage(MB): %Number%"); line = _matchTimes.Replace(line, "Instances caching time(s): %Number%"); line = _matchUpdatesPerSec.Replace(line, ", %Number%M WeightUpdates/sec"); line = _matchParameterT.Replace(line, "=PARAM:/t:%Number%"); line = _matchInfinity.Replace(line, "Infinity"); line = _matchErrorLog.Replace(line, "%ErrorLog%"); line = _matchGuid.Replace(line, "%Guid%"); dst.WriteLine(line); } } } // Set and restored by instances of MismatchContext. When this is true, baseline differences // are tolerated. They are still reported in the test log, but do not cause a test failure. // REVIEW: Perhaps they should cause the test to be inconclusive instead of pass? private bool _allowMismatch; /// <summary> /// When hardware dependent baseline values should be tolerated, scope the code /// that does the comparisons with an instance of this disposable struct. /// </summary> protected struct MismatchContext : IDisposable { // The test class instance. private readonly BaseTestBaseline _host; // Dispose restores this value to the _allowMismatch field of _host. private readonly bool _allowMismatch; public MismatchContext(BaseTestBaseline host) { _host = host; _allowMismatch = _host._allowMismatch; _host._allowMismatch = true; } public void Dispose() { Contracts.Assert(_host._allowMismatch); _host._allowMismatch = _allowMismatch; } } /// <summary> /// Compare the contents of an output file with its baseline. /// </summary> protected bool CheckEquality(string dir, string name, string nameBase = null, int digitsOfPrecision = DigitsOfPrecision) { return CheckEqualityCore(dir, name, nameBase ?? name, false, digitsOfPrecision); } /// <summary> /// Check whether two files are same ignoring volatile differences (path, dates, times, etc). /// Returns true if the check passes. /// </summary> protected bool CheckEqualityNormalized(string dir, string name, string nameBase = null, int digitsOfPrecision = DigitsOfPrecision) { return CheckEqualityCore(dir, name, nameBase ?? name, true, digitsOfPrecision); } protected bool CheckEqualityCore(string dir, string name, string nameBase, bool normalize, int digitsOfPrecision = DigitsOfPrecision) { Contracts.Assert(IsActive); Contracts.AssertValue(dir); // Can be empty. Contracts.AssertNonEmpty(name); Contracts.AssertNonEmpty(nameBase); // The following assert is necessary since some tests were attempting to // combine the ZBasline directory with an absolute path, leading to an output // file being compared with itself. Contracts.Assert(!Path.IsPathRooted(name), "file name should not be a full path"); Contracts.Assert(!Path.IsPathRooted(nameBase), "file nameBase should not be a full path"); string relPath = Path.Combine(dir, name); string basePath = GetBaselinePath(dir, nameBase); string outPath = GetOutputPath(dir, name); if (!CheckOutFile(outPath)) return false; // Normalize the output file. if (normalize) Normalize(outPath); if (!CheckBaseFile(basePath)) return false; bool res = CheckEqualityFromPathsCore(relPath, basePath, outPath, digitsOfPrecision: digitsOfPrecision); // No need to keep the raw (unnormalized) output file. if (normalize && res) File.Delete(outPath + RawSuffix); return res; } private bool FirstIsSuffix<T>(IEnumerator<T> suffix, IEnumerator<T> seq, Func<T, T, bool> equalFunc = null) { Contracts.AssertValue(suffix); Contracts.AssertValue(seq); Contracts.AssertValueOrNull(equalFunc); // It is possible to compose something that only stores part of suffix, and none of sequence, // but this is relatively harder to code. if (equalFunc == null) equalFunc = EqualityComparer<T>.Default.Equals; List<T> suffixList = new List<T>(); List<T> seqList = new List<T>(); while (suffix.MoveNext()) { if (!seq.MoveNext()) { Fail("Baseline sequence had {0} items, but the suffix seems to have more", suffixList.Count); return false; } suffixList.Add(suffix.Current); seqList.Add(seq.Current); } if (suffixList.Count == 0) // Empty suffix is trivially a suffix of anything. return true; Contracts.Assert(suffixList.Count == seqList.Count); int idx = 0; while (seq.MoveNext()) seqList[idx++ % seqList.Count] = seq.Current; Log("Suffix of length {0} compared against sequence of length {1}", suffixList.Count, seqList.Count + idx); for (int i = 0; i < suffixList.Count; ++i) { if (!equalFunc(suffixList[i], seqList[(idx + i) % seqList.Count])) { Fail("Baseline sequence mismatched {0} length suffix {1} item from the end", suffixList.Count, suffixList.Count - i - 1); return false; } } return true; } private IEnumerator<string> LineEnumerator(TextReader reader, Func<string, bool> stop) { string result; while ((result = reader.ReadLine()) != null && !stop(result)) yield return result; } /// <summary> /// Checks that <paramref name="outPath"/>'s contents are a suffix of <paramref name="basePath"/>'s /// contents, assuming one skips <paramref name="skip"/> lines from <paramref name="outPath"/>, and /// the file is read up to the <paramref name="tailSignature"/> line (or to the end, if it's not provided). /// </summary> protected bool CheckOutputIsSuffix(string basePath, string outPath, int skip = 0, string tailSignature = null) { Contracts.Assert(skip >= 0); Contracts.AssertValueOrNull(tailSignature); using (StreamReader baseline = OpenReader(basePath)) using (StreamReader result = OpenReader(outPath)) { while (--skip >= 0) result.ReadLine(); Func<string, bool> stop = x => x == tailSignature; return FirstIsSuffix(LineEnumerator(result, stop), LineEnumerator(baseline, stop), (a, b) => a == b); } } protected bool CheckEqualityFromPathsCore(string relPath, string basePath, string outPath, int skip = 0, int digitsOfPrecision = DigitsOfPrecision) { Contracts.Assert(skip >= 0); using (StreamReader baseline = OpenReader(basePath)) using (StreamReader result = OpenReader(outPath)) { int count = 0; if (skip > 0) { string line2; do { line2 = result.ReadLine(); if (line2 == null) { Fail("Output is shorter than the skip value of {0}!", skip); return false; } count++; } while (count <= skip); string line1; do { line1 = baseline.ReadLine(); if (line1 == null) { Fail("Couldn't match output file line to a line in the baseline!"); return false; } } while (line1 != line2); } for (; ; ) { // read lines while we can string line1 = baseline.ReadLine(); string line2 = result.ReadLine(); if (line1 == null && line2 == null) { Log("Output matches baseline: '{0}'", relPath); return true; } count++; GetNumbersFromFile(ref line1, ref line2, digitsOfPrecision); if (line1 != line2) { if (line1 == null || line2 == null) Fail("Output and baseline different lengths: '{0}'", relPath); else Fail(_allowMismatch, "Output and baseline mismatch at line {1}: '{0}'", relPath, count); return false; } } } } private static void GetNumbersFromFile(ref string firstString, ref string secondString, int digitsOfPrecision) { Regex _matchNumer = new Regex(@"\b[0-9]+\.?[0-9]*(E-[0-9]*)?\b", RegexOptions.IgnoreCase | RegexOptions.Compiled); MatchCollection firstCollection = _matchNumer.Matches(firstString); MatchCollection secondCollection = _matchNumer.Matches(secondString); MatchNumberWithTolerance(firstCollection, secondCollection, digitsOfPrecision); firstString = _matchNumer.Replace(firstString, "%Number%"); secondString = _matchNumer.Replace(secondString, "%Number%"); } private static void MatchNumberWithTolerance(MatchCollection firstCollection, MatchCollection secondCollection, int digitsOfPrecision) { for (int i = 0; i < firstCollection.Count; i++) { double f1 = double.Parse(firstCollection[i].ToString()); double f2 = double.Parse(secondCollection[i].ToString()); // this follows the IEEE recommendations for how to compare floating point numbers double allowedVariance = Math.Pow(10, -digitsOfPrecision); double delta = Round(f1, digitsOfPrecision) - Round(f2, digitsOfPrecision); // limitting to the digits we care about. delta = Math.Round(delta, digitsOfPrecision); bool inRange = delta > -allowedVariance && delta < allowedVariance; // for some cases, rounding up is not beneficial // so checking on whether the difference is significant prior to rounding, and failing only then. // example, for 5 digits of precision. // F1 = 1.82844949 Rounds to 1.8284 // F2 = 1.8284502 Rounds to 1.8285 // would fail the inRange == true check, but would suceed the following, and we doconsider those two numbers // (1.82844949 - 1.8284502) = -0.00000071 if (!inRange) { delta = Math.Round(f1 - f2, digitsOfPrecision); Assert.InRange(delta, -allowedVariance, allowedVariance); } } } private static double Round(double value, int digitsOfPrecision) { if ((value == 0) || double.IsInfinity(value) || double.IsNaN(value)) { return value; } double absValue = Math.Abs(value); double integralDigitCount = Math.Floor(Math.Log10(absValue) + 1); double scale = Math.Pow(10, integralDigitCount); return scale * Math.Round(value / scale, digitsOfPrecision); } #if TOLERANCE_ENABLED // This corresponds to how much relative error is tolerable for a value of 0. const Float RelativeToleranceStepSize = (Float)0.001; const Float AbsoluteTolerance = (Float)0.00001; /// <summary> /// Check whether two files are same, allowing for some tolerance in comparing numeric values /// </summary> protected void CheckEqualityApprox(string dir, string name, bool normalize) { Contracts.Assert(IsActive); Contracts.AssertValue(dir); // Can be empty. Contracts.AssertNonEmpty(name); //Contracts.Assert(0 <= tolerance && tolerance < Float.PositiveInfinity); string relPath = Path.Combine(dir, name); string basePath = GetBaselinePath(dir, name); string outPath = GetOutputPath(dir, name); if (!CheckOutFile(outPath)) return; // Normalize the output file. if (normalize) Normalize(outPath); if (!CheckBaseFile(basePath)) return; CheckEqualityApproxCore(relPath, basePath, outPath, normalize); } private void CheckEqualityApproxCore(string relPath, string basePath, string outPath, bool normalize) { string line1, line2; using (StreamReader perfect = new StreamReader(basePath)) using (StreamReader result = new StreamReader(outPath)) { int count = 0; for (; ; ) { line1 = perfect.ReadLine(); line2 = result.ReadLine(); if (line1 == null && line2 == null) { Log("Output matches baseline: '{0}'", relPath); // No need to keep the raw (unnormalized) output file. if (normalize) File.Delete(outPath + RawSuffix); return; } if (line1 == null || line2 == null) { Fail("Output and baseline different lengths: '{0}'", relPath); return; } count++; if (line1 != line2) { String[] Line1 = line1.Split(Seperators); String[] Line2 = line2.Split(Seperators); if (Line1.Length != Line2.Length) { Fail("Output and baseline mismatch at line {1}: '{0}'", relPath, count); return; } // string are same length, go through and try matching. for (int i = 0; i < Line1.Length; i++) { Float first = Float.MinValue, second = Float.MinValue; // couldn't parse either string. TODO: fix this bug! // REVIEW: What should this do if parsing fails? bool firstParseResult = Float.TryParse(Line1[i], out first); bool secondParseResult = Float.TryParse(Line2[i], out second); bool firstIsNan = Float.IsNaN(first); bool secondIsNan = Float.IsNaN(second); bool hasError = false; hasError |= firstParseResult ^ secondParseResult; hasError |= !firstParseResult && !secondParseResult && Line1[i] != Line2[i]; hasError |= firstIsNan ^ secondIsNan; hasError |= !firstIsNan && !secondIsNan && firstParseResult && secondParseResult && Math.Abs(first) > 0.00001 ? (Math.Abs(first - second) / Math.Abs(first) > GetTolerance(first)) : Math.Abs(first - second) > AbsoluteTolerance; if (hasError) { Fail("Output and baseline mismatch at line {1}, field {2}: '{0}'", relPath, count, i + 1); Log(" Baseline: {0}", line1); Log(" Output : {0}", line2); return; } } } } } } // REVIEW: Maybe need revamping. As values get closer to 0 , the tolerance needs to increase. // REVIEW: Every test should be able to override the RelativeToleranceStepSize. private double GetTolerance(Float value) { double stepSizeMultiplier; if (value == 0) stepSizeMultiplier = 1; else stepSizeMultiplier = Math.Log((double)Math.Abs(value)); if (stepSizeMultiplier <= 0) { stepSizeMultiplier = Math.Max(1, Math.Abs(stepSizeMultiplier)); // tolerance needs to increase faster as we start going towards smaller values. stepSizeMultiplier *= stepSizeMultiplier; } else stepSizeMultiplier = Math.Min(1, 1 / stepSizeMultiplier); return stepSizeMultiplier * RelativeToleranceStepSize; } #endif /// <summary> /// Make sure the baseline and output files exists. Optionally creates the baseline if it is missing. /// </summary> private bool CheckOutFile(string outPath) { if (!File.Exists(outPath)) { Fail("Output file not found: {0}", outPath); return false; } return true; } /// <summary> /// Make sure the baseline and output files exists. Optionally creates the baseline if it is missing. /// </summary> private bool CheckBaseFile(string basePath) { if (!File.Exists(basePath)) { Fail("Baseline file not found: {0}", basePath); return false; } return true; } public void RunMTAThread(ThreadStart fn) { Exception inner = null; Thread t = Utils.CreateBackgroundThread(() => { try { fn(); } catch (Exception e) { inner = e; Fail("The test threw an exception - {0}", e); } }); #if !CORECLR // CoreCLR does not support apartment state settings for threads. t.SetApartmentState(ApartmentState.MTA); #endif t.Start(); t.Join(); if (inner != null) throw Contracts.Except(inner, "MTA thread failed"); } /// <summary> /// Opens a stream writer for the specified file using the specified encoding and buffer size. /// If the file exists, it can be either overwritten or appended to. /// If the file does not exist, a new file is created. /// </summary> /// <param name="path">The complete file path to write to.</param> /// <param name="append"> /// true to append data to the file; false to overwrite the file. /// If the specified file does not exist, this parameter has no effect and a new file is created. /// </param> /// <param name="encoding">The character encoding to use.</param> /// <param name="bufferSize">The buffer size, in bytes.</param> /// <returns>The stream writer to write to the specified file.</returns> protected static StreamWriter OpenWriter(string path, bool append = false, Encoding encoding = null, int bufferSize = 1024) { Contracts.CheckNonWhiteSpace(path, nameof(path)); #if CORECLR return Utils.OpenWriter(File.Open(path, append ? FileMode.Append : FileMode.OpenOrCreate), encoding, bufferSize, false); #else return new StreamWriter(path, append); #endif } /// <summary> /// Opens a stream reader for the specified file name, with the specified character encoding, byte order mark detection option, and buffer size. /// </summary> /// <param name="path">The complete file path to be read.</param> /// <returns>The stream reader to read from the specified file.</returns> protected static StreamReader OpenReader(string path) { Contracts.CheckNonWhiteSpace(path, nameof(path)); #if CORECLR return new StreamReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)); #else return new StreamReader(path); #endif } /// <summary> /// Invoke MAML with specified arguments without output baseline. /// This method is used in unit tests when the output is not baselined. /// If the output is to be baselined and compared, the other overload should be used. /// </summary> protected static int MainForTest(string args) { using (var env = new ConsoleEnvironment()) { int result = Maml.MainCore(env, args, false); return result; } } } public partial class TestBaselineNormalize : BaseTestBaseline { [Fact(Skip = "Need CoreTLC specific baseline update")] [TestCategory("Baselines")] public void TestTimeRegex() { const string outDir = @"..\Common\BaselineNormalize"; const string name = "TestTimeRegex.txt"; string path = DeleteOutputPath(outDir, name); File.WriteAllText(path, @"00:04:58: Starting to train ... 00:04:58.3572: Starting to train ... 00:04:58.3xy7z3: Starting to train ... " ); CheckEqualityNormalized(outDir, name); Done(); } } }
45.01476
216
0.55745
[ "MIT" ]
ArieJones/machinelearning
test/Microsoft.ML.TestFramework/BaseTestBaseline.cs
36,597
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.Identity.UI")] [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.Identity.UI.Views.V4")] [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")] // MSBuild WriteCodeFragment クラスによって生成されました。
42.105263
123
0.6325
[ "MIT" ]
satohhd/aeframe
backend/obj/Debug/net5.0/backend.MvcApplicationPartsAssemblyInfo.cs
830
C#
using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using SSMLVerifier; using SSMLVerifier.Extensions; using SSMLVerifier.TagStrategies.All; namespace SSMLVerifierTests.TagStrategies.All { [TestClass] public class SStrategyTests { [TestMethod] public void ReturnValidForValidTag() { var element = "<s><p></p></s>".ToXElement(); var strategy = new SStrategy(); var errors = strategy.Verify(element); Assert.AreEqual(0, errors.Count()); } [TestMethod] public void ReturnInvalidvForInvalidAttribute() { var element = "<s name=\"test\"></s>".ToXElement(); var strategy = new SStrategy(); var errors = strategy.Verify(element); Assert.AreEqual(VerificationState.InvalidAttribute, errors.First().State); } } }
30.033333
86
0.619312
[ "MIT" ]
janniksam/SSMLVerifier
SSMLVerifierTests/TagStrategies/All/SStrategyTests.cs
903
C#
using System.ComponentModel.DataAnnotations; namespace Skrilla.OAuth.Controllers { public class RegisterViewModel { [Required] [DataType(DataType.EmailAddress)] public string Email { get; set; } [Required] [DataType(DataType.Password)] public string Password { get; set; } [Required] [DataType(DataType.Password)] [Compare("Password")] public string ConfirmPassword { get; set; } public string ReturnUrl { get; set; } } }
27.526316
51
0.619503
[ "MIT" ]
Martingt/SKRILLA-API
Skrilla/Skrilla.OAuth/Controllers/RegisterViewModel.cs
525
C#
using System.Collections.Concurrent; using Microsoft.Extensions.DependencyInjection; using NUnit.Framework; using Rebus.Bus; using Rebus.Config; using Rebus.Logging; using Rebus.Tests.Contracts; using Rebus.Transport.InMem; // ReSharper disable RedundantArgumentDefaultValue // ReSharper disable ArgumentsStyleNamedExpression namespace Rebus.ServiceProvider.Tests; [TestFixture] public class VerifyBusLifetimeEventsInContainer : FixtureBase { [Test] public void CanAddEventListenersAfterTheFact() { var serviceCollection = new ServiceCollection(); serviceCollection.AddRebus(configure => configure .Logging(l => l.Console(minLevel: LogLevel.Debug)) .Transport(t => t.UseInMemoryTransport(new InMemNetwork(), "bus lifetime events test"))); var serviceProvider = serviceCollection.BuildServiceProvider(); Using(serviceProvider); serviceProvider.StartRebus(); var events = serviceProvider.GetRequiredService<BusLifetimeEvents>(); var queue = new ConcurrentQueue<string>(); events.BusDisposing += () => queue.Enqueue("BusDisposing"); events.WorkersStopped += () => queue.Enqueue("WorkersStopped"); events.BusDisposed += () => queue.Enqueue("BusDisposed"); CleanUpDisposables(); Assert.That(queue, Is.EqualTo(new[] { "BusDisposing", "WorkersStopped", "BusDisposed" })); } }
29.959184
101
0.690054
[ "MIT" ]
calcasa/Rebus.ServiceProvider
Rebus.ServiceProvider.Tests/VerifyBusLifetimeEventsInContainer.cs
1,470
C#
// 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 Xunit; namespace System.ComponentModel.DataAnnotations.Schema.Tests { public class ColumnAttributeTests { [Fact] public static void Ctor_Default() { ColumnAttribute attribute = new ColumnAttribute(); Assert.Null(attribute.Name); Assert.Equal(-1, attribute.Order); Assert.Null(attribute.TypeName); } [Theory] [InlineData("Granny Weatherwax")] public static void Ctor_String(string name) { ColumnAttribute attribute = new ColumnAttribute(name); Assert.Equal(name, attribute.Name); Assert.Equal(-1, attribute.Order); Assert.Null(attribute.TypeName); } [Theory] [InlineData(null)] [InlineData("")] [InlineData(" \t\r\n")] public static void Ctor_String_NullOrWhitespaceName_ThrowsArgumentException(string name) { Assert.Throws<ArgumentException>(null, () => new ColumnAttribute(name)); } [Theory] [InlineData(0)] [InlineData(1)] public static void Order_Set_ReturnsExpected(int value) { ColumnAttribute attribute = new ColumnAttribute() { Order = value }; Assert.Equal(value, attribute.Order); } [Fact] public static void Order_Set_NegativeValue_ThrowsArgumentOutOfRangeException() { ColumnAttribute attribute = new ColumnAttribute(); AssertExtensions.Throws<ArgumentOutOfRangeException>("value", () => attribute.Order = -1); } [Theory] [InlineData("Nanny Ogg")] public static void TypeName_Set_ReturnsExpected(string value) { ColumnAttribute attribute = new ColumnAttribute() { TypeName = value }; Assert.Equal(value, attribute.TypeName); } [Theory] [InlineData(null)] [InlineData("")] [InlineData(" \t\r\n")] public static void TypeName_Set_NullOrWhitespaceValue_ThrowsArgumentException(string value) { ColumnAttribute attribute = new ColumnAttribute(); Assert.Throws<ArgumentException>(null, () => attribute.TypeName = value); } } }
33.106667
102
0.615385
[ "MIT" ]
Acidburn0zzz/corefx
src/System.ComponentModel.Annotations/tests/Schema/ColumnAttributeTests.cs
2,483
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Manual changes to this file may cause unexpected behavior in your application. // Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace YungChingRealtyPreview.Repository { using System; using System.Collections.Generic; public partial class Categories { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public Categories() { this.Products = new HashSet<Products>(); } public int CategoryID { get; set; } public string CategoryName { get; set; } public string Description { get; set; } public byte[] Picture { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<Products> Products { get; set; } } }
37.4375
128
0.584307
[ "Apache-2.0" ]
steny138/YungChingRealtyPreview
YungChingRealtyPreview/YungChingRealtyPreview.Repository/Categories.cs
1,198
C#
using Microsoft.Management.Infrastructure; using System; using System.Collections.Generic; using System.Linq; using SimCim.Core; namespace SimCim.Root.StandardCimV2 { public abstract class CIMManagedElement : GenericInfrastructureObject { protected CIMManagedElement() { } protected CIMManagedElement(IInfrastructureObjectScope scope, CimInstance instance): base(scope, instance) { } public System.String Caption { get { System.String result; this.GetProperty("Caption", out result); return result; } set { this.SetProperty("Caption", value); } } public System.String Description { get { System.String result; this.GetProperty("Description", out result); return result; } set { this.SetProperty("Description", value); } } public System.String ElementName { get { System.String result; this.GetProperty("ElementName", out result); return result; } set { this.SetProperty("ElementName", value); } } public System.String InstanceID { get { System.String result; this.GetProperty("InstanceID", out result); return result; } set { this.SetProperty("InstanceID", value); } } } }
23.556962
115
0.446534
[ "Apache-2.0" ]
simonferquel/simcim
SimCim.Root.StandardCimV2/ClassCIMManagedElement.cs
1,863
C#
using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Dorisoy.Pan.Data; using Dorisoy.Pan.Data.Dto; namespace Dorisoy.Pan.Repository { public class LoginAuditList : List<LoginAuditDto> { public LoginAuditList() { } public int Skip { get; private set; } public int TotalPages { get; private set; } public int PageSize { get; private set; } public int TotalCount { get; private set; } public LoginAuditList(List<LoginAuditDto> items, int count, int skip, int pageSize) { TotalCount = count; PageSize = pageSize; Skip = skip; TotalPages = (int)Math.Ceiling(count / (double)pageSize); AddRange(items); } public async Task<LoginAuditList> Create(IQueryable<LoginAudit> source, int skip, int pageSize) { var count = await GetCount(source); var dtoList = await GetDtos(source, skip, pageSize); var dtoPageList = new LoginAuditList(dtoList, count, skip, pageSize); return dtoPageList; } public async Task<int> GetCount(IQueryable<LoginAudit> source) { return await source.AsNoTracking().CountAsync(); } public async Task<List<LoginAuditDto>> GetDtos(IQueryable<LoginAudit> source, int skip, int pageSize) { var entities = await source .Skip(skip) .Take(pageSize) .AsNoTracking() .Select(c => new LoginAuditDto { Id = c.Id, LoginTime = c.LoginTime, Provider = c.Provider, RemoteIP = c.RemoteIP, Status = c.Status, UserName = c.UserName, Latitude = c.Latitude, Longitude = c.Longitude }) .ToListAsync(); return entities; } } }
31.666667
109
0.548325
[ "MIT" ]
dorisoy/-Dorisoy.Pan
SourceCode/Src/Dorisoy.Pan.Repository/LoginAudit/LoginAuditList.cs
2,092
C#
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using OSDP.Net.Connections; using OSDP.Net.Messages; using OSDP.Net.Model.CommandData; using OSDP.Net.Model.ReplyData; using OSDP.Net.Tracing; using CommunicationConfiguration = OSDP.Net.Model.CommandData.CommunicationConfiguration; using ManufacturerSpecific = OSDP.Net.Model.ReplyData.ManufacturerSpecific; namespace OSDP.Net { /// <summary>The OSDP control panel used to communicate to Peripheral Devices (PDs) as an Access Control Unit (ACU). If multiple connections are needed, add them to the control panel. Avoid creating multiple control panel objects.</summary> public class ControlPanel { private readonly ConcurrentDictionary<Guid, Bus> _buses = new ConcurrentDictionary<Guid, Bus>(); private readonly ILogger<ControlPanel> _logger; private readonly BlockingCollection<Reply> _replies = new BlockingCollection<Reply>(); private readonly TimeSpan _replyResponseTimeout = TimeSpan.FromSeconds(8); private readonly ConcurrentDictionary<int, SemaphoreSlim> _requestLocks = new ConcurrentDictionary<int, SemaphoreSlim>(); /// <summary>Initializes a new instance of the <see cref="T:OSDP.Net.ControlPanel" /> class.</summary> /// <param name="logger">The logger definition used for logging.</param> public ControlPanel(ILogger<ControlPanel> logger = null) { _logger = logger; Task.Factory.StartNew(() => { foreach (var reply in _replies.GetConsumingEnumerable()) { // _logger?.LogDebug($"Received a reply {reply}"); OnReplyReceived(reply); } }, TaskCreationOptions.LongRunning); } /// <summary> /// Start polling on the defined connection. /// </summary> /// <param name="connection">This represents the type of connection used for communicating to PDs.</param> /// <returns>An identifier that represents the connection</returns> public Guid StartConnection(IOsdpConnection connection) => StartConnection(connection, Bus.DefaultPollInterval); /// <summary> /// Start polling on the defined connection. /// </summary> /// <param name="connection">This represents the type of connection used for communicating to PDs.</param> /// <param name="pollInterval">The interval at which the devices will be polled, zero or less indicates no polling</param> /// <param name="isTracing">Write packet data to {Bus ID}.osdpcap file</param> /// <returns>An identifier that represents the connection</returns> public Guid StartConnection(IOsdpConnection connection, TimeSpan pollInterval, bool isTracing) => StartConnection(connection, pollInterval, isTracing ? OSDPFileCapTracer.Trace : _ => { }); /// <summary> /// Start polling on the defined connection. /// </summary> /// <param name="connection">This represents the type of connection used for communicating to PDs.</param> /// <param name="pollInterval">The interval at which the devices will be polled, zero or less indicates no polling</param> /// <returns>An identifier that represents the connection</returns> public Guid StartConnection(IOsdpConnection connection, TimeSpan pollInterval) => StartConnection(connection, pollInterval, _ => { }); /// <summary> /// Start polling on the defined connection. /// </summary> /// <param name="connection">This represents the type of connection used for communicating to PDs.</param> /// <param name="pollInterval">The interval at which the devices will be polled, zero or less indicates no polling</param> /// <param name="tracer">Delegate that will receive detailed trace information</param> /// <returns>An identifier that represents the connection</returns> public Guid StartConnection(IOsdpConnection connection, TimeSpan pollInterval, Action<TraceEntry> tracer) { var newBus = new Bus( connection, _replies, pollInterval, tracer, _logger); newBus.ConnectionStatusChanged += BusOnConnectionStatusChanged; _buses[newBus.Id] = newBus; Task.Factory.StartNew(async () => { await newBus.StartPollingAsync().ConfigureAwait(false); }, TaskCreationOptions.LongRunning); return newBus.Id; } /// <summary> /// Stop the bus for a specific connection. /// </summary> /// <param name="connectionId">The identifier that represents the connection.</param> public void StopConnection(Guid connectionId) { if (!_buses.TryRemove(connectionId, out Bus bus)) { return; } bus.ConnectionStatusChanged -= BusOnConnectionStatusChanged; bus.Close(); foreach (byte address in bus.ConfigureDeviceAddresses) { OnConnectionStatusChanged(bus.Id, address, false, false); } bus.Dispose(); } private void BusOnConnectionStatusChanged(object sender, Bus.ConnectionStatusEventArgs eventArgs) { if (sender is Bus bus) OnConnectionStatusChanged(bus.Id, eventArgs.Address, eventArgs.IsConnected, eventArgs.IsSecureSessionEstablished); } /// <summary> /// Send a custom command for testing. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="command">The custom command to send.</param> public async Task SendCustomCommand(Guid connectionId, Command command) { await SendCommand(connectionId, command).ConfigureAwait(false); } /// <summary>Request to get an ID Report from the PD.</summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns>ID report reply data that was requested.</returns> public async Task<DeviceIdentification> IdReport(Guid connectionId, byte address) { return DeviceIdentification.ParseData((await SendCommand(connectionId, new IdReportCommand(address)).ConfigureAwait(false)).ExtractReplyData); } /// <summary>Request to get the capabilities of the PD.</summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns>Device capabilities reply data that was requested.</returns> public async Task<DeviceCapabilities> DeviceCapabilities(Guid connectionId, byte address) { return Model.ReplyData.DeviceCapabilities.ParseData((await SendCommand(connectionId, new DeviceCapabilitiesCommand(address)).ConfigureAwait(false)).ExtractReplyData); } /// <summary> /// Command that implements extended write mode to facilitate communications with an ISO 7816-4 based credential to a PD. /// </summary> /// <summary>Request to get the capabilities of the PD.</summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="extendedWrite">The extended write data.</param> /// <returns>Reply data that is returned after sending the command. There is the possibility of different replies can be returned from PD.</returns> public async Task<ReturnReplyData<ExtendedRead>> ExtendedWriteData(Guid connectionId, byte address, ExtendedWrite extendedWrite) { var reply = await SendCommand(connectionId, new ExtendedWriteDataCommand(address, extendedWrite)).ConfigureAwait(false); return new ReturnReplyData<ExtendedRead> { Ack = reply.Type == ReplyType.Ack, Nak = reply.Type == ReplyType.Nak ? Nak.ParseData(reply.ExtractReplyData) : null, ReplyData = reply.Type == ReplyType.ExtendedRead ? ExtendedRead.ParseData(reply.ExtractReplyData) : null }; } /// <summary> /// Request to get the local status of a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns>Device local status reply data that was requested.</returns> public async Task<LocalStatus> LocalStatus(Guid connectionId, byte address) { return Model.ReplyData.LocalStatus.ParseData((await SendCommand(connectionId, new LocalStatusReportCommand(address)).ConfigureAwait(false)).ExtractReplyData); } /// <summary> /// Request to get the status all of the inputs of a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns>Device input status reply data that was requested.</returns> public async Task<InputStatus> InputStatus(Guid connectionId, byte address) { return Model.ReplyData.InputStatus.ParseData((await SendCommand(connectionId, new InputStatusReportCommand(address)).ConfigureAwait(false)).ExtractReplyData); } /// <summary> /// Request to get the status all of the outputs of a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns>Device output status reply data that was requested.</returns> public async Task<OutputStatus> OutputStatus(Guid connectionId, byte address) { return Model.ReplyData.OutputStatus.ParseData((await SendCommand(connectionId, new OutputStatusReportCommand(address)).ConfigureAwait(false)).ExtractReplyData); } /// <summary> /// Request to get PIV data from PD. Only one PIV request is processed at a time for each connection. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="getPIVData">Describe the PIV data to retrieve.</param> /// <param name="timeout">A TimeSpan that represents time to wait until waiting for the other requests to complete and it's own request, a TimeSpan that represents -1 milliseconds to wait indefinitely, or a TimeSpan that represents 0 milliseconds to test the wait handle and return immediately.</param> /// <param name="cancellationToken">The CancellationToken token to observe.</param> /// <returns>A response with the PIV data requested.</returns> public async Task<byte[]> GetPIVData(Guid connectionId, byte address, GetPIVData getPIVData, TimeSpan timeout, CancellationToken cancellationToken = default) { var requestLock = GetRequestLock(connectionId, address); if (!await requestLock.WaitAsync(timeout, cancellationToken)) { throw new TimeoutException("Timeout waiting for another request to complete."); } try { return await WaitForPIVData(connectionId, address, getPIVData, timeout, cancellationToken); } finally { requestLock.Release(); } } private SemaphoreSlim GetRequestLock(Guid connectionId, byte address) { int hash = new { connectionId, address }.GetHashCode(); if (_requestLocks.TryGetValue(hash, out var requestLock)) { return requestLock; } var newRequestLock = new SemaphoreSlim(1, 1); _requestLocks[hash] = newRequestLock; return newRequestLock; } private async Task<byte[]> WaitForPIVData(Guid connectionId, byte address, GetPIVData getPIVData, TimeSpan timeout, CancellationToken cancellationToken) { bool complete = false; DateTime endTime = DateTime.UtcNow + timeout; byte[] data = null; void Handler(object sender, MultiPartMessageDataReplyEventArgs args) { // Only process matching replies if (args.ConnectionId != connectionId || args.Address != address) return; var pivData = args.DataFragmentResponse; data ??= new byte[pivData.WholeMessageLength]; complete = Message.BuildMultiPartMessageData(pivData.WholeMessageLength, pivData.Offset, pivData.LengthOfFragment, pivData.Data, data); } PIVDataReplyReceived += Handler; try { await SendCommand(connectionId, new GetPIVDataCommand(address, getPIVData), cancellationToken).ConfigureAwait(false); while (DateTime.UtcNow <= endTime) { if (complete) { return data; } // Delay for default poll interval await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken); } throw new TimeoutException("Timeout waiting to receive PIV data."); } finally { PIVDataReplyReceived -= Handler; } } /// <summary> /// Request to get the status all of the readers of a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns>Device reader status reply data that was requested.</returns> public async Task<ReaderStatus> ReaderStatus(Guid connectionId, byte address) { return Model.ReplyData.ReaderStatus.ParseData((await SendCommand(connectionId, new ReaderStatusReportCommand(address)).ConfigureAwait(false)).ExtractReplyData); } /// <summary> /// Send a manufacture specific command to a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="manufacturerSpecific">The manufacturer specific data.</param> /// <returns>Reply data that is returned after sending the command. There is the possibility of different replies can be returned from PD.</returns> public async Task<ReturnReplyData<ManufacturerSpecific>> ManufacturerSpecificCommand(Guid connectionId, byte address, Model.CommandData.ManufacturerSpecific manufacturerSpecific) { var reply = await SendCommand(connectionId, new ManufacturerSpecificCommand(address, manufacturerSpecific)).ConfigureAwait(false); return new ReturnReplyData<ManufacturerSpecific> { Ack = reply.Type == ReplyType.Ack, Nak = reply.Type == ReplyType.Nak ? Nak.ParseData(reply.ExtractReplyData) : null, ReplyData = reply.Type == ReplyType.ManufactureSpecific ? ManufacturerSpecific.ParseData(reply.ExtractReplyData) : null }; } /// <summary> /// Send a command to alter the state of one or more outputs on a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="outputControls">Data for one or more outputs to control.</param> /// <returns>Reply data that is returned after sending the command. There is the possibility of different replies can be returned from PD.</returns> public async Task<ReturnReplyData<OutputStatus>> OutputControl(Guid connectionId, byte address, OutputControls outputControls) { var reply = await SendCommand(connectionId, new OutputControlCommand(address, outputControls)).ConfigureAwait(false); return new ReturnReplyData<OutputStatus> { Ack = reply.Type == ReplyType.Ack, Nak = reply.Type == ReplyType.Nak ? Nak.ParseData(reply.ExtractReplyData) : null, ReplyData = reply.Type == ReplyType.OutputStatusReport ? Model.ReplyData.OutputStatus.ParseData(reply.ExtractReplyData) : null }; } /// <summary> /// Send a command to alter the LED color on a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="readerLedControls">Data to change color on one or more reader LEDs.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> ReaderLedControl(Guid connectionId, byte address, ReaderLedControls readerLedControls) { var reply = await SendCommand(connectionId, new ReaderLedControlCommand(address, readerLedControls)).ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Send a command to control the buzzer on a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="readerBuzzerControl">Data for the reader buzzer control on the PD.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> ReaderBuzzerControl(Guid connectionId, byte address, ReaderBuzzerControl readerBuzzerControl) { var reply = await SendCommand(connectionId, new ReaderBuzzerControlCommand(address, readerBuzzerControl)).ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Send a command that sends text to be shown on a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="readerTextOutput">Data for the reader text output on the PD.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> ReaderTextOutput(Guid connectionId, byte address, ReaderTextOutput readerTextOutput) { var reply = await SendCommand(connectionId, new ReaderTextOutputCommand(address, readerTextOutput)).ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Send a command that sets the communication configuration on a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="communicationConfiguration">Data for the communication configuration on the PD.</param> /// <returns>Reply data of the actual communication configuration being set on the PD.</returns> public async Task<Model.ReplyData.CommunicationConfiguration> CommunicationConfiguration(Guid connectionId, byte address, CommunicationConfiguration communicationConfiguration) { return Model.ReplyData.CommunicationConfiguration.ParseData((await SendCommand(connectionId, new CommunicationSetCommand(address, communicationConfiguration)).ConfigureAwait(false)) .ExtractReplyData); } /// <summary> /// Send a command that sets the encryption key configuration on a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="encryptionKeyConfiguration">Data for the encryption key configuration on the PD.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> EncryptionKeySet(Guid connectionId, byte address, EncryptionKeyConfiguration encryptionKeyConfiguration) { var reply = await SendCommand(connectionId, new EncryptionKeySetCommand(address, encryptionKeyConfiguration)).ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Send a file to a PD. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="fileType">File transfer type</param> /// <param name="fileData">The complete file data being sent to the PD</param> /// <param name="fragmentSize">Initial size of the fragment sent with each packet</param> /// <param name="callback">Track the status of the file transfer</param> /// <param name="cancellationToken">The CancellationToken token to observe.</param> public void FileTransfer(Guid connectionId, byte address, byte fileType, byte[] fileData, ushort fragmentSize, Action<FileTransferStatus> callback, CancellationToken cancellationToken = default) { Task.Factory.StartNew(async () => { _buses[connectionId].SetSendingMultiMessage(address, true); try { await SendFileTransferCommands(connectionId, address, fileType, fileData, fragmentSize, callback, cancellationToken); } finally { _buses[connectionId].SetSendingMultiMessage(address, false); _buses[connectionId].SetSendingMultiMessageNoSecureChannel(address, false); } }, TaskCreationOptions.LongRunning); } private async Task SendFileTransferCommands(Guid connectionId, byte address, byte fileType, byte[] fileData, ushort fragmentSize, Action<FileTransferStatus> callback, CancellationToken cancellationToken) { int totalSize = fileData.Length; int offset = 0; bool continueTransfer = true; while (!cancellationToken.IsCancellationRequested && continueTransfer) { // Get the fragment size if it doesn't exceed the total size ushort updatedFragmentSize = (ushort)Math.Min(fragmentSize, totalSize - offset); var reply = await SendCommand(connectionId, new FileTransferCommand(address, new FileTransferFragment(fileType, totalSize, offset, updatedFragmentSize, fileData.Skip(offset).Take(updatedFragmentSize).ToArray())), cancellationToken) .ConfigureAwait(false); // Update offset offset += updatedFragmentSize; // Parse the fileTransfer status var fileTransferStatus = reply.Type == ReplyType.FileTransferStatus ? Model.ReplyData.FileTransferStatus.ParseData(reply.ExtractReplyData) : null; if (fileTransferStatus != null) { // Leave secure channel if needed if ((fileTransferStatus.Action & Model.ReplyData.FileTransferStatus.ControlFlags.LeaveSecureChannel) == Model.ReplyData.FileTransferStatus.ControlFlags.LeaveSecureChannel) { _buses[connectionId].SetSendingMultiMessageNoSecureChannel(address, true); } // Set request delay if specified if (fileTransferStatus is { RequestedDelay: > 0 }) { _buses[connectionId].SetRequestDelay(address, DateTime.UtcNow.AddMilliseconds(fileTransferStatus.RequestedDelay)); } // Set fragment size if requested if (fileTransferStatus is { UpdateMessageMaximum: > 0 }) { fragmentSize = Message.CalculateMaximumMessageSize(fileTransferStatus.UpdateMessageMaximum, reply.IsSecureMessage); } } callback(new FileTransferStatus( fileTransferStatus?.Detail ?? Model.ReplyData.FileTransferStatus.StatusDetail.UnknownError, offset, reply.Type == ReplyType.Nak ? Nak.ParseData(reply.ExtractReplyData) : null)); // End transfer is Nak reply is received if (reply.Type == ReplyType.Nak || (fileTransferStatus?.Detail ?? Model.ReplyData.FileTransferStatus.StatusDetail.UnknownError) < 0) return; // Determine if we should continue on successful status if (fileTransferStatus is not { Detail: Model.ReplyData.FileTransferStatus.StatusDetail.FinishingFileTransfer }) { continueTransfer = offset < totalSize; } else { fragmentSize = 0; } } } /// <summary> /// Send a request to the PD to read from a biometric scan and send back the data template. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="biometricReadData">Command data to send a request to the PD to send template data from a biometric scan.</param> /// <param name="timeout">A TimeSpan that represents time to wait until waiting for the other requests to complete and it's own request, a TimeSpan that represents -1 milliseconds to wait indefinitely, or a TimeSpan that represents 0 milliseconds to test the wait handle and return immediately.</param> /// <param name="cancellationToken">The CancellationToken token to observe.</param> /// <returns>Results from matching the biometric scan.</returns> public async Task<BiometricReadResult> ScanAndSendBiometricData(Guid connectionId, byte address, BiometricReadData biometricReadData, TimeSpan timeout, CancellationToken cancellationToken = default) { var requestLock = GetRequestLock(connectionId, address); if (!await requestLock.WaitAsync(timeout, cancellationToken)) { throw new TimeoutException("Timeout waiting for another request to complete."); } try { return await WaitForBiometricRead(connectionId, address, biometricReadData, timeout, cancellationToken); } finally { requestLock.Release(); } } private async Task<BiometricReadResult> WaitForBiometricRead(Guid connectionId, byte address, BiometricReadData biometricReadData, TimeSpan timeout, CancellationToken cancellationToken) { bool complete = false; BiometricReadResult result = null; void Handler(object sender, BiometricReadResultsReplyEventArgs args) { // Only process matching replies if (args.ConnectionId != connectionId || args.Address != address) return; complete = true; result = args.BiometricReadResult; } BiometricReadResultsReplyReceived += Handler; try { await SendCommand(connectionId, new BiometricReadDataCommand(address, biometricReadData), cancellationToken).ConfigureAwait(false); DateTime endTime = DateTime.UtcNow + timeout; while (DateTime.UtcNow <= endTime) { if (complete) { return result; } // Delay for default poll interval await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken); } throw new TimeoutException("Timeout waiting to for biometric read data."); } finally { BiometricReadResultsReplyReceived -= Handler; } } /// <summary> /// Send a request to the PD to perform a biometric scan and match it to the provided template. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="biometricTemplateData">Command data to send a request to the PD to perform a biometric scan and match.</param> /// <param name="timeout">A TimeSpan that represents time to wait until waiting for the other requests to complete and it's own request, a TimeSpan that represents -1 milliseconds to wait indefinitely, or a TimeSpan that represents 0 milliseconds to test the wait handle and return immediately.</param> /// <param name="cancellationToken">The CancellationToken token to observe.</param> /// <returns>Results from matching the biometric scan.</returns> public async Task<BiometricMatchResult> ScanAndMatchBiometricTemplate(Guid connectionId, byte address, BiometricTemplateData biometricTemplateData, TimeSpan timeout, CancellationToken cancellationToken = default) { var requestLock = GetRequestLock(connectionId, address); if (!await requestLock.WaitAsync(timeout, cancellationToken)) { throw new TimeoutException("Timeout waiting for another request to complete."); } try { return await WaitForBiometricMatch(connectionId, address, biometricTemplateData, timeout, cancellationToken); } finally { requestLock.Release(); } } private async Task<BiometricMatchResult> WaitForBiometricMatch(Guid connectionId, byte address, BiometricTemplateData biometricTemplateData, TimeSpan timeout, CancellationToken cancellationToken) { bool complete = false; BiometricMatchResult result = null; void Handler(object sender, BiometricMatchReplyEventArgs args) { // Only process matching replies if (args.ConnectionId != connectionId || args.Address != address) return; complete = true; result = args.BiometricMatchResult; } BiometricMatchReplyReceived += Handler; try { await SendCommand(connectionId, new BiometricMatchCommand(address, biometricTemplateData), cancellationToken).ConfigureAwait(false); DateTime endTime = DateTime.UtcNow + timeout; while (DateTime.UtcNow <= endTime) { if (complete) { return result; } // Delay for default poll interval await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken); } throw new TimeoutException("Timeout waiting to for biometric match."); } finally { BiometricMatchReplyReceived -= Handler; } } /// <summary> /// Instruct the PD to perform a challenge/response sequence. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="algorithm"></param> /// <param name="key"></param> /// <param name="challenge"></param> /// <param name="fragmentSize">Size of the fragment sent with each packet</param> /// <param name="timeout">A TimeSpan that represents time to wait until waiting for the other requests to complete and it's own request, a TimeSpan that represents -1 milliseconds to wait indefinitely, or a TimeSpan that represents 0 milliseconds to test the wait handle and return immediately.</param> /// <param name="cancellationToken">The CancellationToken token to observe.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<byte[]> AuthenticationChallenge(Guid connectionId, byte address, byte algorithm, byte key, byte[] challenge, ushort fragmentSize, TimeSpan timeout, CancellationToken cancellationToken = default) { var requestLock = GetRequestLock(connectionId, address); if (!await requestLock.WaitAsync(timeout, cancellationToken)) { throw new TimeoutException("Timeout waiting for another request to complete."); } try { return await WaitForChallengeResponse(connectionId, address, algorithm, key, challenge, fragmentSize, timeout, cancellationToken); } finally { requestLock.Release(); } } private async Task<byte[]> WaitForChallengeResponse(Guid connectionId, byte address, byte algorithm, byte key, byte[] challenge, ushort fragmentSize, TimeSpan timeout, CancellationToken cancellationToken) { bool complete = false; DateTime endTime = DateTime.UtcNow + timeout; var requestData = new List<byte> { algorithm, key }; requestData.AddRange(challenge); byte[] responseData = null; void Handler(object sender, MultiPartMessageDataReplyEventArgs args) { // Only process matching replies if (args.ConnectionId != connectionId || args.Address != address) return; var dataFragmentResponse = args.DataFragmentResponse; responseData ??= new byte[dataFragmentResponse.WholeMessageLength]; complete = Message.BuildMultiPartMessageData(dataFragmentResponse.WholeMessageLength, dataFragmentResponse.Offset, dataFragmentResponse.LengthOfFragment, dataFragmentResponse.Data, responseData); } AuthenticationChallengeResponseReceived += Handler; int totalSize = requestData.Count; int offset = 0; bool continueTransfer = true; try { while (!cancellationToken.IsCancellationRequested && continueTransfer) { var reply = await SendCommand(connectionId, new AuthenticationChallengeCommand(address, new AuthenticationChallengeFragment(totalSize, offset, fragmentSize, requestData.Skip(offset).Take((ushort)Math.Min(fragmentSize, totalSize - offset)) .ToArray())), cancellationToken) .ConfigureAwait(false); offset += fragmentSize; // End transfer is Nak reply is received if (reply.Type == ReplyType.Nak) throw new Exception("Unable to complete challenge request"); // Determine if we should continue on successful status continueTransfer = offset < totalSize; } while (DateTime.UtcNow <= endTime) { if (complete) { return responseData; } // Delay for default poll interval await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken); } throw new TimeoutException("Timeout waiting to receive challenge response."); } finally { AuthenticationChallengeResponseReceived -= Handler; } } /// <summary> /// Inform the PD the maximum size that the ACU can receive. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="maximumReceiveSize">The maximum size that the ACU can receive.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> ACUReceivedSize(Guid connectionId, byte address, ushort maximumReceiveSize) { var reply = await SendCommand(connectionId, new ACUReceiveSizeCommand(address, maximumReceiveSize)).ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Instructs the PD to maintain communication with the credential for a specified time. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="keepAliveTimeInMilliseconds">The length of time to maintain communication with credential.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> KeepReaderActive(Guid connectionId, byte address, ushort keepAliveTimeInMilliseconds) { var reply = await SendCommand(connectionId, new KeepReaderActiveCommand(address, keepAliveTimeInMilliseconds)).ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Instructs the PD to abort the current operation. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <returns><c>true</c> if successful, <c>false</c> otherwise.</returns> public async Task<bool> AbortCurrentOperation(Guid connectionId, byte address) { var reply = await SendCommand(connectionId, new AbortCurrentOperationCommand(address)) .ConfigureAwait(false); return reply.Type == ReplyType.Ack; } /// <summary> /// Is the PD online /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device</param> /// <param name="address">Address assigned to the device</param> /// <returns>Returns true if the PD is online</returns> public bool IsOnline(Guid connectionId, byte address) { return _buses[connectionId].IsOnline(address); } internal async Task<Reply> SendCommand(Guid connectionId, Command command, CancellationToken cancellationToken = default) { var source = new TaskCompletionSource<Reply>(); void EventHandler(object sender, ReplyEventArgs replyEventArgs) { if (!replyEventArgs.Reply.MatchIssuingCommand(command)) return; ReplyReceived -= EventHandler; source.SetResult(replyEventArgs.Reply); } ReplyReceived += EventHandler; if (_buses.TryGetValue(connectionId, out var bus)) { bus.SendCommand(command); } if (source.Task == await Task.WhenAny(source.Task, Task.Delay(_replyResponseTimeout, cancellationToken)) .ConfigureAwait(false)) { return await source.Task; } ReplyReceived -= EventHandler; throw new TimeoutException(); } /// <summary> /// Shutdown the control panel and stop all communication to PDs. /// </summary> public void Shutdown() { foreach (var bus in _buses.Values) { bus.ConnectionStatusChanged -= BusOnConnectionStatusChanged; bus.Close(); foreach (byte address in bus.ConfigureDeviceAddresses) { OnConnectionStatusChanged(bus.Id, address, false, false); } bus.Dispose(); } _buses.Clear(); foreach (var pivDataLock in _requestLocks.Values) { pivDataLock.Dispose(); } _requestLocks.Clear(); } /// <summary> /// Reset communication sequence with the PD specified. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> public void ResetDevice(Guid connectionId, int address) { if (_buses.TryGetValue(connectionId, out Bus bus)) { bus.ResetDevice(address); } } /// <summary> /// Add a PD to the control panel. This will replace an existing PD that is configured at the same address. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="useCrc">Use CRC for error checking.</param> /// <param name="useSecureChannel">Require the device to communicate with a secure channel.</param> /// <param name="secureChannelKey">Set the secure channel key, default installation key is used if not specified.</param> public void AddDevice(Guid connectionId, byte address, bool useCrc, bool useSecureChannel, byte[] secureChannelKey = null) { if (!_buses.TryGetValue(connectionId, out Bus foundBus)) { throw new ArgumentException("Connection could not be found", nameof(connectionId)); } if (address > 127) { throw new ArgumentOutOfRangeException(nameof(address), "Address is out of range, it must between 0 and 127."); } foundBus.AddDevice(address, useCrc, useSecureChannel, useSecureChannel ? secureChannelKey : null); } /// <summary> /// Remove a PD from the control panel. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> public void RemoveDevice(Guid connectionId, byte address) { if (_buses.TryGetValue(connectionId, out Bus bus)) { bus.RemoveDevice(address); } } private void OnConnectionStatusChanged(Guid connectionId, byte address, bool isConnected, bool isSecureChannelEstablished) { var handler = ConnectionStatusChanged; handler?.Invoke(this, new ConnectionStatusEventArgs(connectionId, address, isConnected, isSecureChannelEstablished)); } internal virtual void OnReplyReceived(Reply reply) { { var handler = ReplyReceived; handler?.Invoke(this, new ReplyEventArgs {Reply = reply}); } switch (reply.Type) { case ReplyType.Nak: { var handler = NakReplyReceived; handler?.Invoke(this, new NakReplyEventArgs(reply.ConnectionId, reply.Address, Nak.ParseData(reply.ExtractReplyData))); break; } case ReplyType.LocalStatusReport: { var handler = LocalStatusReportReplyReceived; handler?.Invoke(this, new LocalStatusReportReplyEventArgs(reply.ConnectionId, reply.Address, Model.ReplyData.LocalStatus.ParseData(reply.ExtractReplyData))); break; } case ReplyType.InputStatusReport: { var handler = InputStatusReportReplyReceived; handler?.Invoke(this, new InputStatusReportReplyEventArgs(reply.ConnectionId, reply.Address, Model.ReplyData.InputStatus.ParseData(reply.ExtractReplyData))); break; } case ReplyType.OutputStatusReport: { var handler = OutputStatusReportReplyReceived; handler?.Invoke(this, new OutputStatusReportReplyEventArgs(reply.ConnectionId, reply.Address, Model.ReplyData.OutputStatus.ParseData(reply.ExtractReplyData))); break; } case ReplyType.ReaderStatusReport: { var handler = ReaderStatusReportReplyReceived; handler?.Invoke(this, new ReaderStatusReportReplyEventArgs(reply.ConnectionId, reply.Address, Model.ReplyData.ReaderStatus.ParseData(reply.ExtractReplyData))); break; } case ReplyType.RawReaderData: { var handler = RawCardDataReplyReceived; handler?.Invoke(this, new RawCardDataReplyEventArgs(reply.ConnectionId, reply.Address, RawCardData.ParseData(reply.ExtractReplyData))); break; } case ReplyType.ManufactureSpecific: { var handler = ManufacturerSpecificReplyReceived; handler?.Invoke(this, new ManufacturerSpecificReplyEventArgs(reply.ConnectionId, reply.Address, ManufacturerSpecific.ParseData(reply.ExtractReplyData))); break; } case ReplyType.ExtendedRead: { var handler = ExtendedReadReplyReceived; handler?.Invoke(this, new ExtendedReadReplyEventArgs(reply.ConnectionId, reply.Address, ExtendedRead.ParseData(reply.ExtractReplyData))); break; } case ReplyType.PIVData: { var handler = PIVDataReplyReceived; handler?.Invoke(this, new MultiPartMessageDataReplyEventArgs(reply.ConnectionId, reply.Address, DataFragmentResponse.ParseData(reply.ExtractReplyData))); break; } case ReplyType.ResponseToChallenge: { var handler = AuthenticationChallengeResponseReceived; handler?.Invoke(this, new MultiPartMessageDataReplyEventArgs(reply.ConnectionId, reply.Address, DataFragmentResponse.ParseData(reply.ExtractReplyData))); break; } case ReplyType.KeypadData: { var handler = KeypadReplyReceived; handler?.Invoke(this, new KeypadReplyEventArgs(reply.ConnectionId, reply.Address, KeypadData.ParseData(reply.ExtractReplyData))); break; } case ReplyType.BiometricData: { var handler = BiometricReadResultsReplyReceived; handler?.Invoke(this, new BiometricReadResultsReplyEventArgs(reply.ConnectionId, reply.Address, BiometricReadResult.ParseData(reply.ExtractReplyData))); break; } case ReplyType.BiometricMatchResult: { var handler = BiometricMatchReplyReceived; handler?.Invoke(this, new BiometricMatchReplyEventArgs(reply.ConnectionId, reply.Address, BiometricMatchResult.ParseData(reply.ExtractReplyData))); break; } } } private event EventHandler<ReplyEventArgs> ReplyReceived; /// <summary> /// Occurs when connection status changed. /// </summary> public event EventHandler<ConnectionStatusEventArgs> ConnectionStatusChanged; /// <summary> /// Occurs when a negative reply is received. /// </summary> public event EventHandler<NakReplyEventArgs> NakReplyReceived; /// <summary> /// Occurs when local status report reply is received. /// </summary> public event EventHandler<LocalStatusReportReplyEventArgs> LocalStatusReportReplyReceived; /// <summary> /// Occurs when input status report reply is received. /// </summary> public event EventHandler<InputStatusReportReplyEventArgs> InputStatusReportReplyReceived; /// <summary> /// Occurs when output status report reply is received. /// </summary> public event EventHandler<OutputStatusReportReplyEventArgs> OutputStatusReportReplyReceived; /// <summary> /// Occurs when reader status report reply is received. /// </summary> public event EventHandler<ReaderStatusReportReplyEventArgs> ReaderStatusReportReplyReceived; /// <summary> /// Occurs when raw card data reply is received. /// </summary> public event EventHandler<RawCardDataReplyEventArgs> RawCardDataReplyReceived; /// <summary> /// Occurs when manufacturer specific reply is received. /// </summary> public event EventHandler<ManufacturerSpecificReplyEventArgs> ManufacturerSpecificReplyReceived; /// <summary> /// Occurs when extended read reply is received. /// </summary> public event EventHandler<ExtendedReadReplyEventArgs> ExtendedReadReplyReceived; /// <summary> /// Occurs when key pad data reply is received. /// </summary> public event EventHandler<KeypadReplyEventArgs> KeypadReplyReceived; /// <summary> /// Occurs when biometric read results reply is received. /// </summary> private event EventHandler<BiometricReadResultsReplyEventArgs> BiometricReadResultsReplyReceived; /// <summary> /// Occurs when biometric match reply is received. /// </summary> private event EventHandler<BiometricMatchReplyEventArgs> BiometricMatchReplyReceived; /// <summary> /// Occurs when piv data reply is received. /// </summary> private event EventHandler<MultiPartMessageDataReplyEventArgs> PIVDataReplyReceived; /// <summary> /// Occurs when authentication challenge response is received. /// </summary> private event EventHandler<MultiPartMessageDataReplyEventArgs> AuthenticationChallengeResponseReceived; /// <summary> /// A negative reply that has been received. /// </summary> public class NakReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="NakReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="nak">A negative reply that has been received.</param> public NakReplyEventArgs(Guid connectionId, byte address, Nak nak) { ConnectionId = connectionId; Address = address; Nak = nak; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A negative reply that has been received. /// </summary> public Nak Nak { get; } } /// <summary> /// A connection status has been changed. /// </summary> public class ConnectionStatusEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ConnectionStatusEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="isConnected">Is the device currently connected.</param> /// <param name="isSecureChannelEstablished">Is the secure channel currently established.</param> public ConnectionStatusEventArgs(Guid connectionId, byte address, bool isConnected, bool isSecureChannelEstablished) { ConnectionId = connectionId; Address = address; IsConnected = isConnected; IsSecureChannelEstablished = isSecureChannelEstablished; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// Is the device currently connected. /// </summary> public bool IsConnected { get; } /// <summary> /// Is the secure channel currently established /// </summary> public bool IsSecureChannelEstablished { get; } } /// <summary> /// The local status report reply has been received. /// </summary> public class LocalStatusReportReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="LocalStatusReportReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="localStatus">A local status report reply.</param> public LocalStatusReportReplyEventArgs(Guid connectionId, byte address, LocalStatus localStatus) { ConnectionId = connectionId; Address = address; LocalStatus = localStatus; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A local status report reply. /// </summary> public LocalStatus LocalStatus { get; } } /// <summary> /// The input status report reply has been received. /// </summary> public class InputStatusReportReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="LocalStatusReportReplyEventArgs" /> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="inputStatus">A input status report reply.</param> public InputStatusReportReplyEventArgs(Guid connectionId, byte address, InputStatus inputStatus) { ConnectionId = connectionId; Address = address; InputStatus = inputStatus; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A input status report reply. /// </summary> public InputStatus InputStatus { get; } } /// <summary> /// The output status report reply has been received. /// </summary> public class OutputStatusReportReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="OutputStatusReportReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="outputStatus">A output status report reply.</param> public OutputStatusReportReplyEventArgs(Guid connectionId, byte address, OutputStatus outputStatus) { ConnectionId = connectionId; Address = address; OutputStatus = outputStatus; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A output status report reply. /// </summary> public OutputStatus OutputStatus { get; } } /// <summary> /// The reader status report reply has been received. /// </summary> public class ReaderStatusReportReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ReaderStatusReportReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="readerStatus">A reader status report reply.</param> public ReaderStatusReportReplyEventArgs(Guid connectionId, byte address, ReaderStatus readerStatus) { ConnectionId = connectionId; Address = address; ReaderStatus = readerStatus; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A reader status report reply. /// </summary> public ReaderStatus ReaderStatus { get; } } /// <summary> /// The raw card data reply has been received. /// </summary> public class RawCardDataReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="RawCardDataReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="rawCardData">A raw card data reply.</param> public RawCardDataReplyEventArgs(Guid connectionId, byte address, RawCardData rawCardData) { ConnectionId = connectionId; Address = address; RawCardData = rawCardData; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A raw card data reply. /// </summary> public RawCardData RawCardData { get; } } /// <summary> /// The manufacture specific reply has been received. /// </summary> public class ManufacturerSpecificReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ManufacturerSpecificReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="manufacturerSpecific">A manufacturer specific reply.</param> public ManufacturerSpecificReplyEventArgs(Guid connectionId, byte address, ManufacturerSpecific manufacturerSpecific) { ConnectionId = connectionId; Address = address; ManufacturerSpecific = manufacturerSpecific; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A manufacturer specific reply. /// </summary> public ManufacturerSpecific ManufacturerSpecific { get; } } /// <summary> /// The extended read reply has been received. /// </summary> public class ExtendedReadReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ExtendedReadReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="extendedRead">A extended read reply.</param> public ExtendedReadReplyEventArgs(Guid connectionId, byte address, ExtendedRead extendedRead) { ConnectionId = connectionId; Address = address; ExtendedRead = extendedRead; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A extended read reply. /// </summary> public ExtendedRead ExtendedRead { get; } } /// <summary> /// The multi-part message reply has been received. /// </summary> private class MultiPartMessageDataReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="MultiPartMessageDataReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="dataFragmentResponse">A PIV data reply.</param> public MultiPartMessageDataReplyEventArgs(Guid connectionId, byte address, DataFragmentResponse dataFragmentResponse) { ConnectionId = connectionId; Address = address; DataFragmentResponse = dataFragmentResponse; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A PIV data reply. /// </summary> public DataFragmentResponse DataFragmentResponse { get; } } /// <summary> /// The keypad reply has been received. /// </summary> public class KeypadReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="KeypadReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="keypadData">A keypad reply.</param> public KeypadReplyEventArgs(Guid connectionId, byte address, KeypadData keypadData) { ConnectionId = connectionId; Address = address; KeypadData = keypadData; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A keypad reply.. /// </summary> public KeypadData KeypadData { get; } } /// <summary> /// A biometric match reply has been received. /// </summary> private class BiometricReadResultsReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="BiometricReadResultsReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="biometricReadResult">A biometric read results reply.</param> public BiometricReadResultsReplyEventArgs(Guid connectionId, byte address, BiometricReadResult biometricReadResult) { ConnectionId = connectionId; Address = address; BiometricReadResult = biometricReadResult; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A biometric read result reply. /// </summary> public BiometricReadResult BiometricReadResult { get; } } /// <summary> /// A biometric match reply has been received. /// </summary> private class BiometricMatchReplyEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="BiometricMatchReplyEventArgs"/> class. /// </summary> /// <param name="connectionId">Identify the connection for communicating to the device.</param> /// <param name="address">Address assigned to the device.</param> /// <param name="biometricMatchResult">A biometric match reply.</param> public BiometricMatchReplyEventArgs(Guid connectionId, byte address, BiometricMatchResult biometricMatchResult) { ConnectionId = connectionId; Address = address; BiometricMatchResult = biometricMatchResult; } /// <summary> /// Identify the connection for communicating to the device. /// </summary> public Guid ConnectionId { get; } /// <summary> /// Address assigned to the device. /// </summary> public byte Address { get; } /// <summary> /// A biometric match result reply.. /// </summary> public BiometricMatchResult BiometricMatchResult { get; } } /// <summary> /// Track the status of a file transfer to a PD /// </summary> public class FileTransferStatus { /// <summary> /// Initializes a new instance of the <see cref="FileTransferStatus"/> class. /// </summary> /// <param name="status">The last status returned from the PD</param> /// <param name="currentOffset">The current offset in the data of the file transfer</param> /// <param name="nak">Contains Nak reply data if returned</param> public FileTransferStatus(Model.ReplyData.FileTransferStatus.StatusDetail status, int currentOffset, Nak nak) { Status = status; CurrentOffset = currentOffset; Nak = nak; } /// <summary> /// The last status returned from the PD /// </summary> public Model.ReplyData.FileTransferStatus.StatusDetail Status { get; } /// <summary> /// The current offset in the data of the file transfer /// </summary> public int CurrentOffset { get; } /// <summary> /// Contains Nak reply if returned /// </summary> public Nak Nak { get; } } private class ReplyEventArgs : EventArgs { public Reply Reply { get; set; } } } }
44.748474
310
0.584955
[ "Apache-2.0" ]
IDmachinesOrg/OSDP.Net
src/OSDP.Net/ControlPanel.cs
73,298
C#
// Decompiled with JetBrains decompiler // Type: BstkTypeLib.__MIDL___MIDL_itf_VirtualBox_0000_0000_0070 // Assembly: BstkTypeLib, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null // MVID: 38E91E34-8BF8-4856-A23F-FE231831C5D8 // Assembly location: C:\Program Files\BlueStacks\BstkTypeLib.dll namespace BstkTypeLib { public enum __MIDL___MIDL_itf_VirtualBox_0000_0000_0070 { FileStatus_Undefined = 0, FileStatus_Opening = 10, // 0x0000000A FileStatus_Open = 100, // 0x00000064 FileStatus_Closing = 150, // 0x00000096 FileStatus_Closed = 200, // 0x000000C8 FileStatus_Down = 600, // 0x00000258 FileStatus_Error = 800, // 0x00000320 } }
33.75
79
0.758519
[ "MIT" ]
YehudaEi/Bluestacks-source-code
src/BstkTypeLib/__MIDL___MIDL_itf_VirtualBox_0000_0000_0070.cs
677
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using WorkplaceEngine.Contract; namespace WorkplaceEngine.Processors { /// <summary> /// Executes synchronous work items by assigning a new thread to each work item /// </summary> [Description("Single thread per work item")] public class Threads : IWorkItemProcessor<ISyncWorkItem> { public void Process(ISyncWorkItem[] items, CancellationToken cancel) { var threads = new Thread[items.Length]; for (int i = 0; i < threads.Length; i++) { int index = i; // Make a copy var tsi = new ThreadStart(() => items[index].WorkHard(cancel)); threads[i] = new Thread(tsi); } threads.AsParallel().ForAll(t => t.Start()); while (threads.Any(t => t.IsAlive)) { Thread.Sleep(100); } } } }
28.205128
85
0.566364
[ "MIT" ]
I71d0r/concurrency-visualizer
Src/WorkplaceEngine/Processors/Threads.cs
1,102
C#
using System.Collections; using System.Collections.Generic; using System; using NetRuntimeSystem = System; using System.ComponentModel; using NetOffice.Attributes; using NetOffice.CollectionsGeneric; using NetOffice.WordApi; namespace NetOffice.WordApi.Behind { /// <summary> /// DispatchInterface CategoryCollection /// SupportByVersion Word, 15, 16 /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/jj231100.aspx </remarks> public class CategoryCollection : COMObject, NetOffice.WordApi.CategoryCollection { #pragma warning disable #region Type Information /// <summary> /// Contract Type /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced), Browsable(false), Category("NetOffice"), CoreOverridden] public override Type ContractType { get { if(null == _contractType) _contractType = typeof(NetOffice.WordApi.CategoryCollection); return _contractType; } } private static Type _contractType; /// <summary> /// Instance Type /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced), Browsable(false), Category("NetOffice"), CoreOverridden] public override Type InstanceType { get { return LateBindingApiWrapperType; } } private static Type _type; [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public static Type LateBindingApiWrapperType { get { if (null == _type) _type = typeof(CategoryCollection); return _type; } } #endregion #region Ctor /// <summary> /// Stub Ctor, not indented to use /// </summary> public CategoryCollection() : base() { } #endregion #region Properties /// <summary> /// SupportByVersion Word 15,16 /// Get /// Unknown COM Proxy /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/jj231978.aspx </remarks> [SupportByVersion("Word", 15, 16), ProxyResult] public virtual object Parent { get { return InvokerService.InvokeInternal.ExecuteReferencePropertyGet(this, "Parent"); } } /// <summary> /// SupportByVersion Word 15,16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/jj231429.aspx </remarks> [SupportByVersion("Word", 15, 16)] public virtual Int32 Count { get { return InvokerService.InvokeInternal.ExecuteInt32PropertyGet(this, "Count"); } } /// <summary> /// SupportByVersion Word 15,16 /// Get /// Unknown COM Proxy /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/jj229558.aspx </remarks> [SupportByVersion("Word", 15, 16), ProxyResult] public virtual object Application { get { return InvokerService.InvokeInternal.ExecuteReferencePropertyGet(this, "Application"); } } /// <summary> /// SupportByVersion Word 15,16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/jj232266.aspx </remarks> [SupportByVersion("Word", 15, 16)] public virtual Int32 Creator { get { return InvokerService.InvokeInternal.ExecuteInt32PropertyGet(this, "Creator"); } } #endregion #region Methods /// <summary> /// SupportByVersion Word 15,16 /// </summary> /// <param name="index">object index</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] [SupportByVersion("Word", 15, 16)] [NetRuntimeSystem.Runtime.CompilerServices.IndexerName("Item"), IndexProperty] public virtual NetOffice.WordApi.ChartCategory this[object index] { get { return InvokerService.InvokeInternal.ExecuteKnownReferenceMethodGet<NetOffice.WordApi.ChartCategory>(this, "_Default", typeof(NetOffice.WordApi.ChartCategory), index); } } #endregion #region IEnumerableProvider<NetOffice.WordApi.ChartCategory> ICOMObject IEnumerableProvider<NetOffice.WordApi.ChartCategory>.GetComObjectEnumerator(ICOMObject parent) { return NetOffice.Utils.GetComObjectEnumeratorAsMethod(parent, this, false); } IEnumerable IEnumerableProvider<NetOffice.WordApi.ChartCategory>.FetchVariantComObjectEnumerator(ICOMObject parent, ICOMObject enumerator) { return NetOffice.Utils.FetchVariantComObjectEnumerator(parent, enumerator, false); } #endregion #region IEnumerable<NetOffice.WordApi.ChartCategory> /// <summary> /// SupportByVersion Word, 15, 16 /// </summary> [SupportByVersion("Word", 15, 16)] public virtual IEnumerator<NetOffice.WordApi.ChartCategory> GetEnumerator() { NetRuntimeSystem.Collections.IEnumerable innerEnumerator = (this as NetRuntimeSystem.Collections.IEnumerable); foreach (NetOffice.WordApi.ChartCategory item in innerEnumerator) yield return item; } #endregion #region IEnumerable /// <summary> /// SupportByVersion Word, 15, 16 /// </summary> [SupportByVersion("Word", 15, 16)] IEnumerator NetRuntimeSystem.Collections.IEnumerable.GetEnumerator() { return NetOffice.Utils.GetProxyEnumeratorAsMethod(this, false); } #endregion #pragma warning restore } }
27.121951
171
0.661151
[ "MIT" ]
igoreksiz/NetOffice
Source/Word/Behind/DispatchInterfaces/CategoryCollection.cs
5,562
C#
/******************************************************************************* * Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.OpsWorks; using Amazon.OpsWorks.Model; namespace Amazon.PowerShell.Cmdlets.OPS { /// <summary> /// Registers instances that were created outside of AWS OpsWorks Stacks with a specified /// stack. /// /// <note><para> /// We do not recommend using this action to register instances. The complete registration /// operation includes two tasks: installing the AWS OpsWorks Stacks agent on the instance, /// and registering the instance with the stack. <code>RegisterInstance</code> handles /// only the second step. You should instead use the AWS CLI <code>register</code> command, /// which performs the entire registration operation. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register.html"> /// Registering an Instance with an AWS OpsWorks Stacks Stack</a>. /// </para></note><para> /// Registered instances have the same requirements as instances that are created by using /// the <a>CreateInstance</a> API. For example, registered instances must be running a /// supported Linux-based operating system, and they must have a supported instance type. /// For more information about requirements for instances that you want to register, see /// <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register-registering-preparer.html"> /// Preparing the Instance</a>. /// </para><para><b>Required Permissions</b>: To use this action, an IAM user must have a Manage permissions /// level for the stack or an attached policy that explicitly grants permissions. For /// more information on user permissions, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing /// User Permissions</a>. /// </para> /// </summary> [Cmdlet("Register", "OPSInstance", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("System.String")] [AWSCmdlet("Calls the AWS OpsWorks RegisterInstance API operation.", Operation = new[] {"RegisterInstance"}, SelectReturnType = typeof(Amazon.OpsWorks.Model.RegisterInstanceResponse))] [AWSCmdletOutput("System.String or Amazon.OpsWorks.Model.RegisterInstanceResponse", "This cmdlet returns a System.String object.", "The service call response (type Amazon.OpsWorks.Model.RegisterInstanceResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class RegisterOPSInstanceCmdlet : AmazonOpsWorksClientCmdlet, IExecutor { #region Parameter InstanceIdentity_Document /// <summary> /// <para> /// <para>A JSON document that contains the metadata.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String InstanceIdentity_Document { get; set; } #endregion #region Parameter Hostname /// <summary> /// <para> /// <para>The instance's hostname.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Hostname { get; set; } #endregion #region Parameter PrivateIp /// <summary> /// <para> /// <para>The instance's private IP address.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String PrivateIp { get; set; } #endregion #region Parameter PublicIp /// <summary> /// <para> /// <para>The instance's public IP address.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String PublicIp { get; set; } #endregion #region Parameter RsaPublicKey /// <summary> /// <para> /// <para>The instances public RSA key. This key is used to encrypt communication between the /// instance and the service.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String RsaPublicKey { get; set; } #endregion #region Parameter RsaPublicKeyFingerprint /// <summary> /// <para> /// <para>The instances public RSA key fingerprint.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String RsaPublicKeyFingerprint { get; set; } #endregion #region Parameter InstanceIdentity_Signature /// <summary> /// <para> /// <para>A signature that can be used to verify the document's accuracy and authenticity.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String InstanceIdentity_Signature { get; set; } #endregion #region Parameter StackId /// <summary> /// <para> /// <para>The ID of the stack that the instance is to be registered with.</para> /// </para> /// </summary> #if !MODULAR [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] #else [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String StackId { get; set; } #endregion #region Parameter Select /// <summary> /// Use the -Select parameter to control the cmdlet output. The default value is 'InstanceId'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.OpsWorks.Model.RegisterInstanceResponse). /// Specifying the name of a property of type Amazon.OpsWorks.Model.RegisterInstanceResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "InstanceId"; #endregion #region Parameter PassThru /// <summary> /// Changes the cmdlet behavior to return the value passed to the StackId parameter. /// The -PassThru parameter is deprecated, use -Select '^StackId' instead. This parameter will be removed in a future version. /// </summary> [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^StackId' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter Force /// <summary> /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.StackId), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Register-OPSInstance (RegisterInstance)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate<Amazon.OpsWorks.Model.RegisterInstanceResponse, RegisterOPSInstanceCmdlet>(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); if (this.PassThru.IsPresent) { throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select)); } } else if (this.PassThru.IsPresent) { context.Select = (response, cmdlet) => this.StackId; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.Hostname = this.Hostname; context.InstanceIdentity_Document = this.InstanceIdentity_Document; context.InstanceIdentity_Signature = this.InstanceIdentity_Signature; context.PrivateIp = this.PrivateIp; context.PublicIp = this.PublicIp; context.RsaPublicKey = this.RsaPublicKey; context.RsaPublicKeyFingerprint = this.RsaPublicKeyFingerprint; context.StackId = this.StackId; #if MODULAR if (this.StackId == null && ParameterWasBound(nameof(this.StackId))) { WriteWarning("You are passing $null as a value for parameter StackId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.OpsWorks.Model.RegisterInstanceRequest(); if (cmdletContext.Hostname != null) { request.Hostname = cmdletContext.Hostname; } // populate InstanceIdentity var requestInstanceIdentityIsNull = true; request.InstanceIdentity = new Amazon.OpsWorks.Model.InstanceIdentity(); System.String requestInstanceIdentity_instanceIdentity_Document = null; if (cmdletContext.InstanceIdentity_Document != null) { requestInstanceIdentity_instanceIdentity_Document = cmdletContext.InstanceIdentity_Document; } if (requestInstanceIdentity_instanceIdentity_Document != null) { request.InstanceIdentity.Document = requestInstanceIdentity_instanceIdentity_Document; requestInstanceIdentityIsNull = false; } System.String requestInstanceIdentity_instanceIdentity_Signature = null; if (cmdletContext.InstanceIdentity_Signature != null) { requestInstanceIdentity_instanceIdentity_Signature = cmdletContext.InstanceIdentity_Signature; } if (requestInstanceIdentity_instanceIdentity_Signature != null) { request.InstanceIdentity.Signature = requestInstanceIdentity_instanceIdentity_Signature; requestInstanceIdentityIsNull = false; } // determine if request.InstanceIdentity should be set to null if (requestInstanceIdentityIsNull) { request.InstanceIdentity = null; } if (cmdletContext.PrivateIp != null) { request.PrivateIp = cmdletContext.PrivateIp; } if (cmdletContext.PublicIp != null) { request.PublicIp = cmdletContext.PublicIp; } if (cmdletContext.RsaPublicKey != null) { request.RsaPublicKey = cmdletContext.RsaPublicKey; } if (cmdletContext.RsaPublicKeyFingerprint != null) { request.RsaPublicKeyFingerprint = cmdletContext.RsaPublicKeyFingerprint; } if (cmdletContext.StackId != null) { request.StackId = cmdletContext.StackId; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return output; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.OpsWorks.Model.RegisterInstanceResponse CallAWSServiceOperation(IAmazonOpsWorks client, Amazon.OpsWorks.Model.RegisterInstanceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS OpsWorks", "RegisterInstance"); try { #if DESKTOP return client.RegisterInstance(request); #elif CORECLR return client.RegisterInstanceAsync(request).GetAwaiter().GetResult(); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.String Hostname { get; set; } public System.String InstanceIdentity_Document { get; set; } public System.String InstanceIdentity_Signature { get; set; } public System.String PrivateIp { get; set; } public System.String PublicIp { get; set; } public System.String RsaPublicKey { get; set; } public System.String RsaPublicKeyFingerprint { get; set; } public System.String StackId { get; set; } public System.Func<Amazon.OpsWorks.Model.RegisterInstanceResponse, RegisterOPSInstanceCmdlet, object> Select { get; set; } = (response, cmdlet) => response.InstanceId; } } }
46.134771
278
0.618427
[ "Apache-2.0" ]
5u5hma/aws-tools-for-powershell
modules/AWSPowerShell/Cmdlets/OpsWorks/Basic/Register-OPSInstance-Cmdlet.cs
17,116
C#
//------------------------------------------------------------------------------ // <auto-generated> // Ten kod został wygenerowany przez narzędzie. // Wersja środowiska uruchomieniowego: 4.0.30319.42000 // // Modyfikacje tego pliku mogą spowodować niewłaściwe zachowanie i zostaną utracone // w przypadku ponownego wygenerowania kodu. // </auto-generated> //------------------------------------------------------------------------------ namespace NowaEraDK.Properties { /// <summary> /// Silnie typizowana klasa zasobów do wyszukiwania zlokalizowanych ciągów itd. /// </summary> // Ta klasa została automatycznie wygenerowana za pomocą klasy StronglyTypedResourceBuilder // przez narzędzie, takie jak ResGen lub Visual Studio. // Aby dodać lub usunąć składowe, edytuj plik ResX, a następnie ponownie uruchom narzędzie ResGen // z opcją /str lub ponownie skompiluj projekt programu VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Zwraca buforowane wystąpienie składnika ResourceManager używane przez tę klasę. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NowaEraDK.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Przesłania właściwość CurrentUICulture bieżącego wątku dla wszystkich /// przypadków przeszukiwania zasobów za pomocą tej silnie typizowanej klasy zasobów. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
40.916667
175
0.626952
[ "MIT" ]
ProgramistaZpolski/nowa-era-dk
Properties/Resources.Designer.cs
2,986
C#
using Discord; using Discord.Commands; using Discord.WebSocket; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualBasic; using System; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; using TheOracle.BotCore; using TheOracle.Core; namespace TheOracle.StarForged.Starships { public class StarforgedShipCommands : ModuleBase<SocketCommandContext> { public Emoji missionEmoji = new Emoji("❗"); public Emoji oneEmoji = new Emoji("\u0031\u20E3"); public Emoji twoEmoji = new Emoji("\u0032\u20E3"); public Emoji threeEmoji = new Emoji("\u0033\u20E3"); public StarforgedShipCommands(ServiceProvider services) { var hooks = services.GetRequiredService<HookedEvents>(); if (!hooks.StarShipReactions) { var client = services.GetRequiredService<DiscordSocketClient>(); var reactionService = services.GetRequiredService<ReactionService>(); ReactionEvent reaction1 = new ReactionEventBuilder().WithEmote(oneEmoji).WithEvent(ShipReactionHandler).Build(); ReactionEvent reaction2 = new ReactionEventBuilder().WithEmote(twoEmoji).WithEvent(ShipReactionHandler).Build(); ReactionEvent reaction3 = new ReactionEventBuilder().WithEmote(threeEmoji).WithEvent(ShipReactionHandler).Build(); ReactionEvent misison = new ReactionEventBuilder().WithEmote(missionEmoji).WithEvent(ShipReactionHandler).Build(); reactionService.reactionList.Add(reaction1); reactionService.reactionList.Add(reaction2); reactionService.reactionList.Add(reaction3); reactionService.reactionList.Add(misison); hooks.StarShipReactions = true; } Services = services; } private async Task ShipReactionHandler(IUserMessage message, ISocketMessageChannel channel, SocketReaction reaction, IUser user) { var starshipHelperEmbed = message.Embeds.FirstOrDefault(embed => embed?.Title?.Contains(StarShipResources.StarshipHelperTitle) ?? false); if (starshipHelperEmbed != null) { var region = StarforgedUtilites.SpaceRegionFromEmote(reaction.Emote.Name); if (region == SpaceRegion.None) return; string name = starshipHelperEmbed.Fields.FirstOrDefault(fld => fld.Name == StarShipResources.StarshipName).Value ?? string.Empty; Starship newShip = Starship.GenerateShip(Services, region, name); Task.WaitAll(message.RemoveAllReactionsAsync()); await message.ModifyAsync(msg => { msg.Content = string.Empty; msg.Embed = newShip.GetEmbedBuilder().Build(); }).ConfigureAwait(false); await message.AddReactionAsync(missionEmoji).ConfigureAwait(false); return; } var shipEmbed = message.Embeds.FirstOrDefault(embed => embed?.Description?.Contains(StarShipResources.Starship, StringComparison.OrdinalIgnoreCase) ?? false); if (shipEmbed == null) return; Starship ship = Starship.FromEmbed(Services, shipEmbed); if (reaction.Emote.Name == missionEmoji.Name) { ship.MissionRevealed = true; await message.RemoveReactionAsync(reaction.Emote, message.Author).ConfigureAwait(false); } await message.ModifyAsync(msg => msg.Embed = ship.GetEmbedBuilder().Build()).ConfigureAwait(false); await message.RemoveReactionAsync(reaction.Emote, user).ConfigureAwait(false); return; } public ServiceProvider Services { get; } [Command("GenerateStarship", ignoreExtraArgs: true)] [Summary("Creates a template post for a new Starforged Starship")] [Alias("Starship", "Spaceship", "Ship")] public async Task StarShipPost([Remainder] string StarShipCommand = "") { var region = StarforgedUtilites.GetAnySpaceRegion(StarShipCommand); if (region == SpaceRegion.None) { EmbedBuilder builder = new EmbedBuilder() .WithTitle(StarShipResources.StarshipHelperTitle) .WithDescription(StarShipResources.PickSpaceRegionMessage); if (StarShipCommand.Length > 0) builder.WithFields(new EmbedFieldBuilder().WithName(StarShipResources.StarshipName).WithValue(StarShipCommand)); var msg = await ReplyAsync(embed: builder.Build()); await msg.AddReactionAsync(oneEmoji); await msg.AddReactionAsync(twoEmoji); await msg.AddReactionAsync(threeEmoji); return; } string ShipName = Regex.Replace(StarShipCommand, region.ToString(), "", RegexOptions.IgnoreCase).Trim(); var ship = Starship.GenerateShip(Services, region, ShipName); var message = await ReplyAsync("", false, ship.GetEmbedBuilder().Build()); await message.AddReactionAsync(missionEmoji); } } }
43.512397
170
0.646534
[ "Apache-2.0" ]
rsek/TheOracle
TheOracle/StarForged/Starships/StarforgedShipCommands.cs
5,269
C#
// Decompiled with JetBrains decompiler // Type: Functal.FnFunction_IsGreaterThan_Int32 // Assembly: Functal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: 47DC2DAE-D56F-4FC5-A0C3-CC69F2DF9A1F // Assembly location: \\WSE\Folder Redirection\JP\Downloads\Functal-1_0_0\Functal.dll namespace Functal { internal class FnFunction_IsGreaterThan_Int32 : FnFunction<bool> { [FnArg] protected FnObject<int> LeftVal; [FnArg] protected FnObject<int> RightVal; public override bool GetValue() { return this.LeftVal.GetValue() > this.RightVal.GetValue(); } } }
27.636364
85
0.733553
[ "MIT" ]
jpdillingham/Functal
src/FnFunction_IsGreaterThan_Int32.cs
610
C#
/* Copyright (C) 2019 Alex Watt (alexwatt@hotmail.com) This file is part of Highlander Project https://github.com/alexanderwatt/Hghlander.Net Highlander is free software: you can redistribute it and/or modify it under the terms of the Highlander license. You should have received a copy of the license along with this program; if not, license is available at <https://github.com/alexanderwatt/Hghlander.Net/blob/develop/LICENSE>. 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 license for more details. */ namespace Orion.Constants { public static class CurveProp { public const string MarketAndDate = "MarketName"; public const string Market = "Market"; public const string MarketDate = "MarketDate"; public const string MarketDateFormat = "yyyy-MM-dd"; public const string StressName = "StressName"; public const string PricingStructureType = "PricingStructureType"; public const string CurveName = "CurveName"; public const string BaseCurveType = "BaseCurveType"; public const string Function = "Function"; public const string DataGroup = "DataGroup"; public const string SourceSystem = "SourceSystem"; public const string Currency1 = "Currency"; public const string Currency2 = "Currency2"; public const string CurrencyPair = "CurrencyPair"; public const string QuoteBasis = "QuoteBasis"; public const string Algorithm = "Algorithm"; public const string Type = "Type"; public const string BaseDate = "BaseDate"; public const string UniqueIdentifier = "UniqueIdentifier"; public const string BuildDateTime = "BuildDateTime"; public const string IndexName = "IndexName"; public const string IndexTenor = "IndexTenor"; public const string CreditInstrumentId = "CreditInstrumentId"; public const string CreditSeniority = "CreditSeniority"; public const string ReferenceCurveName = "ReferenceCurveName"; public const string ReferenceCurveUniqueId = "ReferenceCurveUniqueId"; public const string ReferenceFxCurveName = "ReferenceFxCurveName"; public const string ReferenceFxCurveUniqueId = "ReferenceFxCurveUniqueId"; public const string ReferenceFxCurve2Name = "ReferenceFxCurve2Name"; public const string ReferenceFxCurve2UniqueId = "ReferenceFxCurve2UniqueId"; public const string ReferenceCurrency2CurveName = "ReferenceCurrency2CurveName"; public const string ReferenceCurrency2CurveId = "ReferenceCurrency2CurveId"; public const string Tolerance = "Tolerance"; public const string OptimizeBuild = "OptimizeBuild"; public const string ReferenceBond = "ReferenceBond"; public const string BootStrap = "BootStrap"; public const string CurveType = "CurveType"; public const string Identifier = "Identifier"; public const string AssetClass = "AssetClass"; public const string ContractCode = "ContractCode"; public const string ExchangeContractType = "ExchangeContractType"; public const string Instrument = "Instrument"; public const string Exchange = "Exchange"; public const string AssetId = "AssetId"; public const string AssetType = "AssetType"; public const string ValuationDate = "ValuationDate"; public const string StrikeQuoteUnits = "StrikeQuoteUnits"; public const string MeasureType = "MeasureType"; public const string QuoteUnits = "QuoteUnits"; public const string EngineHandle = "EngineHandle"; public const string CompoundingFrequency = "CompoundingFrequency"; public const string ExtrapolationPermitted = "ExtrapolationPermitted"; public const string BootstrapperInterpolation = "BootstrapperInterpolation"; } public static class CurveConst { public const string QR_EOD = "QR_EOD"; public const string QR_LIVE = "QR_LIVE"; public const string NAB_EOD = "NAB_EOD"; public const string SYD_LIVE = "SYD_LIVE"; public const string TEST_EOD = "TEST_EOD"; public const string LOCAL_USER = "LOCAL_USER"; } ///<summary> /// The type of curve evolution to use. ///</summary> public enum PricingStructureEvolutionType { ///<summary> /// Decay from the forward value to the spot value. ///</summary> ForwardToSpot, ///<summary> /// Evolution from the spot value to the forwad value. ///</summary> SpotToForward } ///<summary> /// The type of perturbation to use oon a child curve. ///</summary> public enum PricingStructureRiskSetType { ///<summary> /// Base curve. ///</summary> Parent, ///<summary> /// Dependent curve. ///</summary> Child, /// <summary> /// Both /// </summary> Hybid } ///<summary> /// The type of curve. ///</summary> public enum CurveType { ///<summary> /// Base curve. ///</summary> Parent, ///<summary> /// Dependent curve. ///</summary> Child } ///<summary> /// The curve asset class. ///</summary> public enum AssetClass { ///<summary> /// Rate. ///</summary> Rates, ///<summary> /// Fx. ///</summary> Fx, ///<summary> /// Equity. ///</summary> Equity, ///<summary> /// Credit. ///</summary> Credit, ///<summary> /// Inflation. ///</summary> Inflation, ///<summary> /// Commodity. ///</summary> Commodity, ///<summary> /// Energy. ///</summary> Energy } }
33.927778
88
0.630097
[ "BSD-3-Clause" ]
mmrath/Highlander.Net
Metadata/Constants/CurveConstants.cs
6,109
C#
using UnityEngine.EventSystems; namespace Unity.VisualScripting { [UnityEngine.AddComponentMenu("")] public sealed class UnityOnSubmitMessageListener : MessageListener, ISubmitHandler { public void OnSubmit(BaseEventData eventData) { EventBus.Trigger(EventHooks.OnSubmit, gameObject, eventData); } } }
25.357143
86
0.704225
[ "MIT" ]
2PUEG-VRIK/UnityEscapeGame
2P-UnityEscapeGame/Library/PackageCache/com.unity.visualscripting@1.6.1/Runtime/VisualScripting.Core/Events/MessageListeners/UIEventsInterfacesListeners/UnityOnSubmitMessageListener.cs
355
C#
// Copyright (c) Quarrel. All rights reserved. using System; using System.Text.RegularExpressions; namespace Quarrel.Helpers.AudioProcessing { /// <summary> /// Represents a complex value (real and imaginary). /// </summary> public struct Complex { /// <summary> /// A double-precision complex number that represents zero. /// </summary> public static readonly Complex Zero = new Complex(0, 0); /// <summary> /// A double-precision complex number that represents one. /// </summary> public static readonly Complex One = new Complex(1, 0); /// <summary> /// A double-precision complex number that represents the squere root of (-1). /// </summary> public static readonly Complex I = new Complex(0, 1); /// <summary> /// Real part of the complex number. /// </summary> public double Re; /// <summary> /// Imaginary part of the complex number. /// </summary> public double Im; /// <summary> /// Initializes a new instance of the <see cref="Complex"/> struct. /// </summary> /// <param name="re">Real part.</param> /// <param name="im">Imaginary part.</param> public Complex(double re, double im) { this.Re = re; this.Im = im; } /// <summary> /// Initializes a new instance of the <see cref="Complex"/> struct. /// </summary> /// <param name="c">Source complex number.</param> public Complex(Complex c) { this.Re = c.Re; this.Im = c.Im; } /// <summary> /// Gets the magnitude value of the complex number. /// </summary> /// <remarks><para>Magnitude of the complex number, which equals to <b>Sqrt( Re * Re + Im * Im )</b>.</para></remarks> public double Magnitude { get { return Math.Sqrt(SquaredMagnitude); } } /// <summary> /// Gets the phase value of the complex number. /// </summary> /// <remarks><para>Phase of the complex number, which equals to <b>Atan( Im / Re )</b>.</para></remarks> public double Phase { get { return Math.Atan2(Im, Re); } } /// <summary> /// Gets the squared magnitude value of the complex number. /// </summary> public double SquaredMagnitude { get { return (Re * Re) + (Im * Im); } } /// <summary> /// Converts from a single-precision real number to a complex number. /// </summary> /// <param name="value">Single-precision real number to convert to complex number.</param> /// <returns>Returns new <see cref="Complex"/> instance containing complex number with /// real part initialized to the specified value.</returns> public static explicit operator Complex(float value) { return new Complex(value, 0); } /// <summary> /// Converts from a double-precision real number to a complex number. /// </summary> /// <param name="value">Double-precision real number to convert to complex number.</param> /// <returns>Returns new <see cref="Complex"/> instance containing complex number with /// real part initialized to the specified value.</returns> public static explicit operator Complex(double value) { return new Complex(value, 0); } /// <summary> /// Tests whether two specified complex numbers are equal. /// </summary> /// <param name="u">The left-hand complex number.</param> /// <param name="v">The right-hand complex number.</param> /// <returns>Returns <see langword="true"/> if the two complex numbers are equal or <see langword="false"/> otherwise.</returns> public static bool operator ==(Complex u, Complex v) { return (u.Re == v.Re) && (u.Im == v.Im); } /// <summary> /// Tests whether two specified complex numbers are not equal. /// </summary> /// <param name="u">The left-hand complex number.</param> /// <param name="v">The right-hand complex number.</param> /// <returns>Returns <see langword="true"/> if the two complex numbers are not equal or <see langword="false"/> otherwise.</returns> public static bool operator !=(Complex u, Complex v) { return !(u == v); } /// <summary> /// Negates the complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the negated values.</returns> public static Complex operator -(Complex a) { return Negate(a); } /// <summary> /// Adds two complex numbers. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the sum.</returns> public static Complex operator +(Complex a, Complex b) { return Add(a, b); } /// <summary> /// Adds a complex number and a scalar value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the sum.</returns> public static Complex operator +(Complex a, double s) { return Add(a, s); } /// <summary> /// Adds a complex number and a scalar value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the sum.</returns> public static Complex operator +(double s, Complex a) { return Add(a, s); } /// <summary> /// Subtracts one complex number from another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the difference.</returns> public static Complex operator -(Complex a, Complex b) { return Subtract(a, b); } /// <summary> /// Subtracts a scalar value from a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the difference.</returns> public static Complex operator -(Complex a, double s) { return Subtract(a, s); } /// <summary> /// Subtracts a complex number from a scalar value. /// </summary> /// <param name="s">A scalar value.</param> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the difference.</returns> public static Complex operator -(double s, Complex a) { return Subtract(s, a); } /// <summary> /// Multiplies two complex numbers. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of multiplication.</returns> public static Complex operator *(Complex a, Complex b) { return Complex.Multiply(a, b); } /// <summary> /// Multiplies a complex number by a scalar value. /// </summary> /// <param name="s">A scalar value.</param> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of multiplication.</returns> public static Complex operator *(double s, Complex a) { return Multiply(a, s); } /// <summary> /// Multiplies a complex number by a scalar value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of multiplication.</returns> public static Complex operator *(Complex a, double s) { return Multiply(a, s); } /// <summary> /// Divides one complex number by another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>A new Complex instance containing the result.</returns> /// <returns>Returns new <see cref="Complex"/> instance containing the result of division.</returns> public static Complex operator /(Complex a, Complex b) { return Divide(a, b); } /// <summary> /// Divides a complex number by a scalar value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of division.</returns> public static Complex operator /(Complex a, double s) { return Divide(a, s); } /// <summary> /// Divides a scalar value by a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of division.</returns> public static Complex operator /(double s, Complex a) { return Divide(s, a); } /// <summary> /// Adds two complex numbers. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">nother <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the sum of specified /// complex numbers.</returns> public static Complex Add(Complex a, Complex b) { return new Complex(a.Re + b.Re, a.Im + b.Im); } /// <summary> /// Adds scalar value to a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns> /// Returns new <see cref="Complex"/> instance containing the sum of specified /// complex number and scalar value. /// </returns> public static Complex Add(Complex a, double s) { return new Complex(a.Re + s, a.Im); } /// <summary> /// Adds two complex numbers and puts the result into the third complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Add(Complex a, Complex b, ref Complex result) { result.Re = a.Re + b.Re; result.Im = a.Im + b.Im; } /// <summary> /// Adds scalar value to a complex number and puts the result into another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Add(Complex a, double s, ref Complex result) { result.Re = a.Re + s; result.Im = a.Im; } /// <summary> /// Subtracts one complex number from another. /// </summary> /// <param name="a">A <see cref="Complex"/> instance to subtract from.</param> /// <param name="b">A <see cref="Complex"/> instance to be subtracted.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the subtraction result (<b>a - b</b>).</returns> public static Complex Subtract(Complex a, Complex b) { return new Complex(a.Re - b.Re, a.Im - b.Im); } /// <summary> /// Subtracts a scalar from a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance to subtract from.</param> /// <param name="s">A scalar value to be subtracted.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the subtraction result (<b>a - s</b>).</returns> public static Complex Subtract(Complex a, double s) { return new Complex(a.Re - s, a.Im); } /// <summary> /// Subtracts a complex number from a scalar value. /// </summary> /// <param name="s">A scalar value to subtract from.</param> /// <param name="a">A <see cref="Complex"/> instance to be subtracted.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the subtraction result (<b>s - a</b>).</returns> public static Complex Subtract(double s, Complex a) { return new Complex(s - a.Re, a.Im); } /// <summary> /// Subtracts one complex number from another and puts the result in the third complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance to subtract from.</param> /// <param name="b">A <see cref="Complex"/> instance to be subtracted.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Subtract(Complex a, Complex b, ref Complex result) { result.Re = a.Re - b.Re; result.Im = a.Im - b.Im; } /// <summary> /// Subtracts a scalar value from a complex number and puts the result into another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance to subtract from.</param> /// <param name="s">A scalar value to be subtracted.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Subtract(Complex a, double s, ref Complex result) { result.Re = a.Re - s; result.Im = a.Im; } /// <summary> /// Subtracts a complex number from a scalar value and puts the result into another complex number. /// </summary> /// <param name="s">A scalar value to subtract from.</param> /// <param name="a">A <see cref="Complex"/> instance to be subtracted.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Subtract(double s, Complex a, ref Complex result) { result.Re = s - a.Re; result.Im = a.Im; } /// <summary> /// Multiplies two complex numbers. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of multiplication.</returns> public static Complex Multiply(Complex a, Complex b) { // (x + yi)(u + vi) = (xu � yv) + (xv + yu)i. double aRe = a.Re, aIm = a.Im; double bRe = b.Re, bIm = b.Im; return new Complex((aRe * bRe) - (aIm * bIm), (aRe * bIm) + (aIm * bRe)); } /// <summary> /// Multiplies a complex number by a scalar value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result of multiplication.</returns> public static Complex Multiply(Complex a, double s) { return new Complex(a.Re * s, a.Im * s); } /// <summary> /// Multiplies two complex numbers and puts the result in a third complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Multiply(Complex a, Complex b, ref Complex result) { // (x + yi)(u + vi) = (xu � yv) + (xv + yu)i. double aRe = a.Re, aIm = a.Im; double bRe = b.Re, bIm = b.Im; result.Re = (aRe * bRe) - (aIm * bIm); result.Im = (aRe * bIm) + (aIm * bRe); } /// <summary> /// Multiplies a complex number by a scalar value and puts the result into another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> public static void Multiply(Complex a, double s, ref Complex result) { result.Re = a.Re * s; result.Im = a.Im * s; } /// <summary> /// Divides one complex number by another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result.</returns> /// <exception cref="DivideByZeroException">Can not divide by zero.</exception> public static Complex Divide(Complex a, Complex b) { double aRe = a.Re, aIm = a.Im; double bRe = b.Re, bIm = b.Im; double modulusSquared = (bRe * bRe) + (bIm * bIm); if (modulusSquared == 0) { throw new DivideByZeroException("Can not divide by zero."); } double invModulusSquared = 1 / modulusSquared; return new Complex( ((aRe * bRe) + (aIm * bIm)) * invModulusSquared, ((aIm * bRe) - (aRe * bIm)) * invModulusSquared); } /// <summary> /// Divides a complex number by a scalar value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result.</returns> /// <exception cref="DivideByZeroException">Can not divide by zero.</exception> public static Complex Divide(Complex a, double s) { if (s == 0) { throw new DivideByZeroException("Can not divide by zero."); } return new Complex(a.Re / s, a.Im / s); } /// <summary> /// Divides a scalar value by a complex number. /// </summary> /// <param name="s">A scalar value.</param> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the result.</returns> /// <exception cref="DivideByZeroException">Can not divide by zero.</exception> public static Complex Divide(double s, Complex a) { if ((a.Re == 0) || (a.Im == 0)) { throw new DivideByZeroException("Can not divide by zero."); } return new Complex(s / a.Re, s / a.Im); } /// <summary> /// Divides one complex number by another complex number and puts the result in a third complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> /// <exception cref="DivideByZeroException">Can not divide by zero.</exception> public static void Divide(Complex a, Complex b, ref Complex result) { double aRe = a.Re, aIm = a.Im; double bRe = b.Re, bIm = b.Im; double modulusSquared = (bRe * bRe) + (bIm * bIm); if (modulusSquared == 0) { throw new DivideByZeroException("Can not divide by zero."); } double invModulusSquared = 1 / modulusSquared; result.Re = ((aRe * bRe) + (aIm * bIm)) * invModulusSquared; result.Im = ((aIm * bRe) - (aRe * bIm)) * invModulusSquared; } /// <summary> /// Divides a complex number by a scalar value and puts the result into another complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="s">A scalar value.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> /// <exception cref="DivideByZeroException">Can not divide by zero.</exception> public static void Divide(Complex a, double s, ref Complex result) { if (s == 0) { throw new DivideByZeroException("Can not divide by zero."); } result.Re = a.Re / s; result.Im = a.Im / s; } /// <summary> /// Divides a scalar value by a complex number and puts the result into another complex number. /// </summary> /// <param name="s">A scalar value.</param> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="result">A <see cref="Complex"/> instance to hold the result.</param> /// <exception cref="DivideByZeroException">Can not divide by zero.</exception> public static void Divide(double s, Complex a, ref Complex result) { if ((a.Re == 0) || (a.Im == 0)) { throw new DivideByZeroException("Can not divide by zero."); } result.Re = s / a.Re; result.Im = s / a.Im; } /// <summary> /// Negates a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the negated values.</returns> public static Complex Negate(Complex a) { return new Complex(-a.Re, -a.Im); } /// <summary> /// Tests whether two complex numbers are approximately equal using default tolerance value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <returns>Return <see langword="true"/> if the two vectors are approximately equal or <see langword="false"/> otherwise.</returns> /// <remarks><para>The default tolerance value, which is used for the test, equals to 8.8817841970012523233891E-16.</para></remarks> public static bool ApproxEqual(Complex a, Complex b) { return ApproxEqual(a, b, 8.8817841970012523233891E-16); } /// <summary> /// Tests whether two complex numbers are approximately equal given a tolerance value. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <param name="b">A 2nd <see cref="Complex"/> instance.</param> /// <param name="tolerance">The tolerance value used to test approximate equality.</param> /// <remarks><para>The default tolerance value, which is used for the test, equals to 8.8817841970012523233891E-16.</para></remarks> /// <returns>Whether or not the values are approximately equal by <paramref name="tolerance"/>.</returns> public static bool ApproxEqual(Complex a, Complex b, double tolerance) { return (Math.Abs(a.Re - b.Re) <= tolerance) && (Math.Abs(a.Im - b.Im) <= tolerance); } /// <summary> /// Converts the specified string to its <see cref="Complex"/> equivalent. /// </summary> /// <param name="s">A string representation of a complex number.</param> /// <returns>Returns new <see cref="Complex"/> instance that represents the complex number /// specified by the <paramref name="s"/> parameter.</returns> /// <exception cref="FormatException">String representation of the complex number is not correctly formatted.</exception> public static Complex Parse(string s) { Regex r = new Regex(@"\((?<real>.*),(?<imaginary>.*)\)", RegexOptions.None); Match m = r.Match(s); if (m.Success) { return new Complex( double.Parse(m.Result("${real}")), double.Parse(m.Result("${imaginary}"))); } else { throw new FormatException("String representation of the complex number is not correctly formatted."); } } /// <summary> /// Try to convert the specified string to its <see cref="Complex"/> equivalent. /// </summary> /// <param name="s">A string representation of a complex number.</param> /// <param name="result"><see cref="Complex"/> instance to output the result to.</param> /// <returns>Returns boolean value that indicates if the parse was successful or not.</returns> public static bool TryParse(string s, out Complex result) { try { Complex newComplex = Complex.Parse(s); result = newComplex; return true; } catch (FormatException) { result = default; return false; } } /// <summary> /// Calculates square root of a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the square root of the specified /// complex number.</returns> public static Complex Sqrt(Complex a) { Complex result = Complex.Zero; if ((a.Re == 0.0) && (a.Im == 0.0)) { return result; } else if (a.Im == 0.0) { result.Re = (a.Re > 0) ? System.Math.Sqrt(a.Re) : System.Math.Sqrt(-a.Re); result.Im = 0.0; } else { double modulus = a.Magnitude; result.Re = System.Math.Sqrt(0.5 * (modulus + a.Re)); result.Im = System.Math.Sqrt(0.5 * (modulus - a.Re)); if (a.Im < 0.0) { result.Im = -result.Im; } } return result; } /// <summary> /// Calculates natural (base <b>e</b>) logarithm of a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns> /// Returns new <see cref="Complex"/> instance containing the natural logarithm of the specified /// complex number. /// </returns> public static Complex Log(Complex a) { Complex result = Zero; if ((a.Re > 0.0) && (a.Im == 0.0)) { result.Re = Math.Log(a.Re); result.Im = 0.0; } else if (a.Re == 0.0) { if (a.Im > 0.0) { result.Re = Math.Log(a.Im); result.Im = Math.PI / 2.0; } else { result.Re = Math.Log(-a.Im); result.Im = -Math.PI / 2.0; } } else { result.Re = Math.Log(a.Magnitude); result.Im = Math.Atan2(a.Im, a.Re); } return result; } /// <summary> /// Calculates exponent (<b>e</b> raised to the specified power) of a complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns> /// Returns new <see cref="Complex"/> instance containing the exponent of the specified /// complex number. /// </returns> public static Complex Exp(Complex a) { Complex result = Zero; double r = Math.Exp(a.Re); result.Re = r * Math.Cos(a.Im); result.Im = r * Math.Sin(a.Im); return result; } /// <summary> /// Calculates Sine value of the complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the Sine value of the specified /// complex number.</returns> public static Complex Sin(Complex a) { Complex result = Zero; if (a.Im == 0.0) { result.Re = Math.Sin(a.Re); result.Im = 0.0; } else { result.Re = Math.Sin(a.Re) * Math.Cosh(a.Im); result.Im = Math.Cos(a.Re) * Math.Sinh(a.Im); } return result; } /// <summary> /// Calculates Cosine value of the complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the Cosine value of the specified /// complex number.</returns> public static Complex Cos(Complex a) { Complex result = Zero; if (a.Im == 0.0) { result.Re = Math.Cos(a.Re); result.Im = 0.0; } else { result.Re = Math.Cos(a.Re) * Math.Cosh(a.Im); result.Im = -Math.Sin(a.Re) * Math.Sinh(a.Im); } return result; } /// <summary> /// Calculates Tangent value of the complex number. /// </summary> /// <param name="a">A <see cref="Complex"/> instance.</param> /// <returns>Returns new <see cref="Complex"/> instance containing the Tangent value of the specified /// complex number.</returns> public static Complex Tan(Complex a) { Complex result = Complex.Zero; if (a.Im == 0.0) { result.Re = Math.Tan(a.Re); result.Im = 0.0; } else { double real2 = 2 * a.Re; double imag2 = 2 * a.Im; double denom = Math.Cos(real2) + Math.Cosh(real2); result.Re = Math.Sin(real2) / denom; result.Im = Math.Sinh(imag2) / denom; } return result; } /// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return Re.GetHashCode() ^ Im.GetHashCode(); } /// <summary> /// Returns a value indicating whether this instance is equal to the specified object. /// </summary> /// <param name="obj">An object to compare to this instance.</param> /// <returns>Returns <see langword="true"/> if <paramref name="obj"/> is a <see cref="Complex"/> and has the same values as this instance or <see langword="false"/> otherwise.</returns> public override bool Equals(object obj) { return (obj is Complex) ? (this == (Complex)obj) : false; } /// <summary> /// Returns a string representation of this object. /// </summary> /// <returns>A string representation of this object.</returns> public override string ToString() { return string.Format("({0}, {1})", Re, Im); } /// <summary> /// Creates an exact copy of this <see cref="Complex"/> object. /// </summary> /// <returns>Returns clone of the complex number.</returns> public Complex Clone() { return new Complex(this); } } }
39.658049
193
0.531808
[ "Apache-2.0" ]
UWPCommunity/Quarrel
src/Quarrel/Helpers/AudioProcessing/Complex.cs
33,755
C#
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 VirtualListBoxLib { /// <summary> /// Logique d'interaction pour VirtualListBox.xaml /// </summary> public partial class VirtualListBox : UserControl { public static readonly DependencyProperty ItemsCountProperty = DependencyProperty.Register("ItemsCount", typeof(int), typeof(VirtualListBox), new FrameworkPropertyMetadata(0)); public int ItemsCount { get { return (int)GetValue(ItemsCountProperty); } set { SetValue(ItemsCountProperty, value); } } public static readonly DependencyProperty VirtualCollectionProperty = DependencyProperty.Register("VirtualCollection", typeof(IVirtualCollection), typeof(VirtualListBox), new FrameworkPropertyMetadata(null)); public IVirtualCollection VirtualCollection { get { return (IVirtualCollection)GetValue(VirtualCollectionProperty); } set { SetValue(VirtualCollectionProperty, value); } } public static readonly DependencyProperty ItemsHeightProperty = DependencyProperty.Register("ItemsHeight", typeof(double), typeof(VirtualListBox), new FrameworkPropertyMetadata(20.0d)); public double ItemsHeight { get { return (double)GetValue(ItemsHeightProperty); } set { SetValue(ItemsHeightProperty, value); } } public static readonly DependencyProperty ExtentWidthProperty = DependencyProperty.Register("ExtentWidth", typeof(double), typeof(VirtualListBox)); public double ExtentWidth { get { return (double)GetValue(ExtentWidthProperty); } set { SetValue(ExtentWidthProperty, value); } } public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(VirtualListBox)); public DataTemplate ItemTemplate { get { return (DataTemplate)GetValue(ItemTemplateProperty); } set { SetValue(ItemTemplateProperty, value); } } public static readonly DependencyProperty SelectedItemIndexProperty = DependencyProperty.Register("SelectedItemIndex", typeof(int), typeof(VirtualListBox)); public int SelectedItemIndex { get { return (int)GetValue(SelectedItemIndexProperty); } set { SetValue(SelectedItemIndexProperty, value); } } public static readonly DependencyProperty VerticalOffsetProperty = DependencyProperty.Register("VerticalOffset", typeof(double), typeof(VirtualListBox)); public double VerticalOffset { get { return (double)GetValue(VerticalOffsetProperty); } set { SetValue(VerticalOffsetProperty, value); } } public static readonly DependencyProperty HorizontalOffsetProperty = DependencyProperty.Register("HorizontalOffset", typeof(double), typeof(VirtualListBox)); public double HorizontalOffset { get { return (double)GetValue(HorizontalOffsetProperty); } set { SetValue(HorizontalOffsetProperty, value); } } public VirtualListBox() { InitializeComponent(); } } }
34.191489
210
0.782825
[ "MIT" ]
dfgs/VirtualListBoxLib
VirtualListBoxLib/VirtualListBox.xaml.cs
3,216
C#
using System; using System.Xml.Serialization; using System.ComponentModel.DataAnnotations; using BroadWorksConnector.Ocip.Validation; using System.Collections.Generic; namespace BroadWorksConnector.Ocip.Models { /// <summary> /// Modify system Personal Assistant Parameters. /// The response is either a SuccessResponse or an ErrorResponse. /// <see cref="SuccessResponse"/> /// <see cref="ErrorResponse"/> /// </summary> [Serializable] [XmlRoot(Namespace = "")] [Groups(@"[{""__type"":""Sequence:#BroadWorksConnector.Ocip.Validation"",""id"":""f53ece1c00394ef2d3d76f532f9a9663:82""}]")] public class SystemPersonalAssistantModifyRequest : BroadWorksConnector.Ocip.Models.C.OCIRequest { private string _transferToAttendantKey; [XmlElement(ElementName = "transferToAttendantKey", IsNullable = false, Namespace = "")] [Optional] [Group(@"f53ece1c00394ef2d3d76f532f9a9663:82")] [Length(1)] [RegularExpression(@"[0-9]|\*|#")] public string TransferToAttendantKey { get => _transferToAttendantKey; set { TransferToAttendantKeySpecified = true; _transferToAttendantKey = value; } } [XmlIgnore] protected bool TransferToAttendantKeySpecified { get; set; } private string _transferToVoiceMessagingKey; [XmlElement(ElementName = "transferToVoiceMessagingKey", IsNullable = false, Namespace = "")] [Optional] [Group(@"f53ece1c00394ef2d3d76f532f9a9663:82")] [Length(1)] [RegularExpression(@"[0-9]|\*|#")] public string TransferToVoiceMessagingKey { get => _transferToVoiceMessagingKey; set { TransferToVoiceMessagingKeySpecified = true; _transferToVoiceMessagingKey = value; } } [XmlIgnore] protected bool TransferToVoiceMessagingKeySpecified { get; set; } } }
31.921875
128
0.631914
[ "MIT" ]
Rogn/broadworks-connector-net
BroadworksConnector/Ocip/Models/SystemPersonalAssistantModifyRequest.cs
2,043
C#
using System.Runtime.Serialization; namespace Epi.Cloud.Common.BusinessObjects { [DataContract(Namespace = "http://www.yourcompany.com/types/")] public class AdminBO { private string _AdminEmail; private string _OrganizationId; private bool _IsActive; [DataMember] public string AdminEmail { get { return _AdminEmail; } set { _AdminEmail = value; } } [DataMember] public string OrganizationId { get { return _OrganizationId; } set { _OrganizationId = value; } } [DataMember] public bool IsActive { get { return _IsActive; } set { _IsActive = value; } } } }
21.444444
67
0.547927
[ "Apache-2.0" ]
82ndAirborneDiv/Epi-Info-Cloud-Contact-Tracing
Cloud Enter/Epi.Cloud.Common/BusinessObjects/AdminBO.cs
774
C#
using System; using System.Collections.Generic; using System.Text; namespace EuroMobileApp.Models.Common.Request { public class LoginRequest { public string Username { get; set; } public string Password { get; set; } } }
19.307692
45
0.681275
[ "Apache-2.0" ]
HkInfotech/Euroapplianceservices
EuroMobileApp/EuroMobileApp/Models/Common/Request/LoginRequest.cs
253
C#
using DAL.DTO.Apply; using System; using System.ComponentModel.DataAnnotations; using TrainSchdule.ViewModels.Verify; namespace TrainSchdule.ViewModels.Apply.ApplyAuditStream { /// <summary> /// 创建方案规则 /// </summary> public class StreamSolutionRuleCreateDataModel : GoogleAuthViewModel { /// <summary> /// 当为编辑时需要 /// </summary> public Guid Id { get; set; } /// <summary> /// 方面规则名称 /// </summary> [Required(ErrorMessage = "方案规则名称不能为空")] [MinLength(1, ErrorMessage = "方案规则名称不能为空白")] public string Name { get; set; } /// <summary> /// 单位作用域 /// </summary> [Required(ErrorMessage = "节点作用域不能为空")] [MinLength(1, ErrorMessage = "节点作用域不能为空白")] public string CompanyRegion { get; set; } /// <summary> /// 方案规则描述 /// </summary> public string Description { get; set; } /// <summary> /// 满足条件后使用何解决方案 /// </summary> public string SolutionName { get; set; } /// <summary> /// 方案的优先级,值越大优先级越高 /// </summary> public int Priority { get; set; } /// <summary> /// 方案是否启用 /// </summary> public bool Enable { get; set; } /// <summary> /// 方案规则候选人 /// </summary> public MembersFilterDto Filter { get; set; } } }
25.214286
72
0.526204
[ "MIT" ]
serfend/Project.Web.SfMVC.TrainSchdule.1903
TrainSchdule/ViewModels/Apply/ApplyAuditStream/StreamSolutionRuleCreateDataModel.cs
1,634
C#
//------------------------------------------------------------------------------ // <auto-generated> // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:4.0.30319.42000 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. // </auto-generated> //------------------------------------------------------------------------------ namespace TestUI.Properties { using System; /// <summary> /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. /// </summary> // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestUI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol). /// </summary> internal static System.Drawing.Icon favicon { get { object obj = ResourceManager.GetObject("favicon", resourceCulture); return ((System.Drawing.Icon)(obj)); } } } }
45.621622
172
0.624408
[ "MIT" ]
R0ckzo0r/Homestate.Launcher
HomeState.Launcher.UI/Properties/Resources.Designer.cs
3,387
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class SceneLoader : MonoBehaviour { public void LoadScene(string SceneToLoad) { SceneManager.LoadScene(SceneToLoad); } public void QuitGame() { Application.Quit(); } }
18.333333
44
0.709091
[ "MIT" ]
sidrk/Luminull
Assets/Scripts/GameStateScripts/SceneLoader.cs
332
C#
/* * Mojang Session API * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * OpenAPI spec version: 2020-06-05 * * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using RestSharp; using Org.OpenAPITools.Client; using Org.OpenAPITools.com.github.asyncmc.mojang.sessions.csharp.model; namespace Org.OpenAPITools.com.github.asyncmc.mojang.sessions.csharp.api { /// <summary> /// Represents a collection of functions to interact with the API endpoints /// </summary> public interface ILoginApi : IApiAccessor { #region Synchronous Operations /// <summary> /// Gets the player&#39;s game profile /// </summary> /// <remarks> /// This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </remarks> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>PlayerProfile</returns> PlayerProfile GetPlayerProfile (string strippedUuid, bool? unsigned = null); /// <summary> /// Gets the player&#39;s game profile /// </summary> /// <remarks> /// This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </remarks> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>ApiResponse of PlayerProfile</returns> ApiResponse<PlayerProfile> GetPlayerProfileWithHttpInfo (string strippedUuid, bool? unsigned = null); #endregion Synchronous Operations #region Asynchronous Operations /// <summary> /// Gets the player&#39;s game profile /// </summary> /// <remarks> /// This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </remarks> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>Task of PlayerProfile</returns> System.Threading.Tasks.Task<PlayerProfile> GetPlayerProfileAsync (string strippedUuid, bool? unsigned = null); /// <summary> /// Gets the player&#39;s game profile /// </summary> /// <remarks> /// This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </remarks> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>Task of ApiResponse (PlayerProfile)</returns> System.Threading.Tasks.Task<ApiResponse<PlayerProfile>> GetPlayerProfileAsyncWithHttpInfo (string strippedUuid, bool? unsigned = null); #endregion Asynchronous Operations } /// <summary> /// Represents a collection of functions to interact with the API endpoints /// </summary> public partial class LoginApi : ILoginApi { private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; /// <summary> /// Initializes a new instance of the <see cref="LoginApi"/> class. /// </summary> /// <returns></returns> public LoginApi(String basePath) { this.Configuration = new Org.OpenAPITools.Client.Configuration { BasePath = basePath }; ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } /// <summary> /// Initializes a new instance of the <see cref="LoginApi"/> class /// </summary> /// <returns></returns> public LoginApi() { this.Configuration = Org.OpenAPITools.Client.Configuration.Default; ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } /// <summary> /// Initializes a new instance of the <see cref="LoginApi"/> class /// using Configuration object /// </summary> /// <param name="configuration">An instance of Configuration</param> /// <returns></returns> public LoginApi(Org.OpenAPITools.Client.Configuration configuration = null) { if (configuration == null) // use the default one in Configuration this.Configuration = Org.OpenAPITools.Client.Configuration.Default; else this.Configuration = configuration; ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; } /// <summary> /// Gets the base path of the API client. /// </summary> /// <value>The base path</value> public String GetBasePath() { return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); } /// <summary> /// Sets the base path of the API client. /// </summary> /// <value>The base path</value> [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] public void SetBasePath(String basePath) { // do nothing } /// <summary> /// Gets or sets the configuration object /// </summary> /// <value>An instance of the Configuration</value> public Org.OpenAPITools.Client.Configuration Configuration {get; set;} /// <summary> /// Provides a factory method hook for the creation of exceptions. /// </summary> public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory { get { if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) { throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); } return _exceptionFactory; } set { _exceptionFactory = value; } } /// <summary> /// Gets the default header. /// </summary> /// <returns>Dictionary of HTTP header</returns> [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] public IDictionary<String, String> DefaultHeader() { return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader); } /// <summary> /// Add default header. /// </summary> /// <param name="key">Header field name.</param> /// <param name="value">Header field value.</param> /// <returns></returns> [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] public void AddDefaultHeader(string key, string value) { this.Configuration.AddDefaultHeader(key, value); } /// <summary> /// Gets the player&#39;s game profile This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>PlayerProfile</returns> public PlayerProfile GetPlayerProfile (string strippedUuid, bool? unsigned = null) { ApiResponse<PlayerProfile> localVarResponse = GetPlayerProfileWithHttpInfo(strippedUuid, unsigned); return localVarResponse.Data; } /// <summary> /// Gets the player&#39;s game profile This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>ApiResponse of PlayerProfile</returns> public ApiResponse< PlayerProfile > GetPlayerProfileWithHttpInfo (string strippedUuid, bool? unsigned = null) { // verify the required parameter 'strippedUuid' is set if (strippedUuid == null) throw new ApiException(400, "Missing required parameter 'strippedUuid' when calling LoginApi->GetPlayerProfile"); var localVarPath = "/session/minecraft/profile/{stripped_uuid}"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new List<KeyValuePair<String, String>>(); var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary<String, String>(); var localVarFileParams = new Dictionary<String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); if (strippedUuid != null) localVarPathParams.Add("stripped_uuid", this.Configuration.ApiClient.ParameterToString(strippedUuid)); // path parameter if (unsigned != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "unsigned", unsigned)); // query parameter // make the HTTP request IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("GetPlayerProfile", localVarResponse); if (exception != null) throw exception; } return new ApiResponse<PlayerProfile>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (PlayerProfile) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PlayerProfile))); } /// <summary> /// Gets the player&#39;s game profile This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>Task of PlayerProfile</returns> public async System.Threading.Tasks.Task<PlayerProfile> GetPlayerProfileAsync (string strippedUuid, bool? unsigned = null) { ApiResponse<PlayerProfile> localVarResponse = await GetPlayerProfileAsyncWithHttpInfo(strippedUuid, unsigned); return localVarResponse.Data; } /// <summary> /// Gets the player&#39;s game profile This will return the player&#39;s username plus any additional information about them (e.g. skins). This has a much stricter rate limit: You can request the same profile once per minute, however you can send as many unique requests as you like. /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="strippedUuid">The player UUID without hyphens</param> /// <param name="unsigned">When set to false, the signature data are sent (optional)</param> /// <returns>Task of ApiResponse (PlayerProfile)</returns> public async System.Threading.Tasks.Task<ApiResponse<PlayerProfile>> GetPlayerProfileAsyncWithHttpInfo (string strippedUuid, bool? unsigned = null) { // verify the required parameter 'strippedUuid' is set if (strippedUuid == null) throw new ApiException(400, "Missing required parameter 'strippedUuid' when calling LoginApi->GetPlayerProfile"); var localVarPath = "/session/minecraft/profile/{stripped_uuid}"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new List<KeyValuePair<String, String>>(); var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary<String, String>(); var localVarFileParams = new Dictionary<String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); if (strippedUuid != null) localVarPathParams.Add("stripped_uuid", this.Configuration.ApiClient.ParameterToString(strippedUuid)); // path parameter if (unsigned != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "unsigned", unsigned)); // query parameter // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("GetPlayerProfile", localVarResponse); if (exception != null) throw exception; } return new ApiResponse<PlayerProfile>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (PlayerProfile) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PlayerProfile))); } } }
53.388379
291
0.659239
[ "Apache-2.0" ]
AsyncMC/Mojang-API-Libs
generated-sources/csharp/mojang-sessions/src/Org.OpenAPITools/com.github.asyncmc.mojang.sessions.csharp.api/LoginApi.cs
17,458
C#
// Copyright (c) MicroElements. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; namespace MicroElements.Metadata { /// <summary> /// Represent property renderer. /// </summary> public interface IPropertyRenderer : IMetadataProvider { /// <summary> /// Gets property to render. /// </summary> IProperty PropertyUntyped { get; } /// <summary> /// Gets property type. /// </summary> Type PropertyType { get; } /// <summary> /// Gets target name. /// </summary> string TargetName { get; } /// <summary> /// Method to render property as text value. /// </summary> /// <param name="source">Source object to render.</param> /// <returns>Rendered text value.</returns> string? Render(IPropertyContainer source); /// <summary> /// Configures renderer. /// Can be called many times. /// </summary> /// <param name="configure">Action to configure renderer.</param> /// <returns>Returns the same renderer instance for chaining.</returns> IPropertyRenderer ConfigureRenderer(Action<PropertyRendererOptions> configure); } /// <summary> /// Generic property renderer. /// </summary> /// <typeparam name="T">Property type.</typeparam> public interface IPropertyRenderer<T> : IPropertyRenderer { /// <summary> /// Gets property to render. /// </summary> IProperty<T> Property { get; } } /// <summary> /// Options to configure <see cref="IPropertyRenderer"/>. /// </summary> public class PropertyRendererOptions { /// <summary> /// Gets property to render. /// </summary> public IProperty PropertyUntyped { get; } /// <summary> /// Gets or sets target name. /// </summary> public string? TargetName { get; set; } /// <summary> /// Gets or sets <see cref="SearchOptions"/> for property search. /// </summary> public SearchOptions? SearchOptions { get; set; } /// <summary> /// Gets or sets value that is renders when property value is null. /// </summary> public string? NullValue { get; set; } /// <summary> /// Gets or sets CustomRender function that overrides entire Render for renderer. /// </summary> public Func<IProperty, IPropertyContainer, string?>? CustomRender { get; set; } /// <summary> /// Gets or sets callback that invokes after configuring. /// </summary> public Action<IPropertyRenderer>? AfterConfigure { get; set; } /// <summary> /// Initializes a new instance of the <see cref="PropertyRendererOptions"/> class. /// </summary> /// <param name="propertyUntyped">Property to render.</param> public PropertyRendererOptions(IProperty propertyUntyped) { PropertyUntyped = propertyUntyped; } } }
31.326733
101
0.578066
[ "MIT" ]
micro-elements/MicroElements.Metadata
src/MicroElements.Metadata/Metadata/IPropertyRenderer.cs
3,166
C#
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the sagemaker-2017-07-24.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.SageMaker.Model { /// <summary> /// Provides summary information about a hyperparameter tuning job. /// </summary> public partial class HyperParameterTuningJobSummary { private DateTime? _creationTime; private DateTime? _hyperParameterTuningEndTime; private string _hyperParameterTuningJobArn; private string _hyperParameterTuningJobName; private HyperParameterTuningJobStatus _hyperParameterTuningJobStatus; private DateTime? _lastModifiedTime; private ObjectiveStatusCounters _objectiveStatusCounters; private ResourceLimits _resourceLimits; private HyperParameterTuningJobStrategyType _strategy; private TrainingJobStatusCounters _trainingJobStatusCounters; /// <summary> /// Gets and sets the property CreationTime. /// <para> /// The date and time that the tuning job was created. /// </para> /// </summary> [AWSProperty(Required=true)] public DateTime CreationTime { get { return this._creationTime.GetValueOrDefault(); } set { this._creationTime = value; } } // Check to see if CreationTime property is set internal bool IsSetCreationTime() { return this._creationTime.HasValue; } /// <summary> /// Gets and sets the property HyperParameterTuningEndTime. /// <para> /// The date and time that the tuning job ended. /// </para> /// </summary> public DateTime HyperParameterTuningEndTime { get { return this._hyperParameterTuningEndTime.GetValueOrDefault(); } set { this._hyperParameterTuningEndTime = value; } } // Check to see if HyperParameterTuningEndTime property is set internal bool IsSetHyperParameterTuningEndTime() { return this._hyperParameterTuningEndTime.HasValue; } /// <summary> /// Gets and sets the property HyperParameterTuningJobArn. /// <para> /// The Amazon Resource Name (ARN) of the tuning job. /// </para> /// </summary> [AWSProperty(Required=true, Max=256)] public string HyperParameterTuningJobArn { get { return this._hyperParameterTuningJobArn; } set { this._hyperParameterTuningJobArn = value; } } // Check to see if HyperParameterTuningJobArn property is set internal bool IsSetHyperParameterTuningJobArn() { return this._hyperParameterTuningJobArn != null; } /// <summary> /// Gets and sets the property HyperParameterTuningJobName. /// <para> /// The name of the tuning job. /// </para> /// </summary> [AWSProperty(Required=true, Min=1, Max=32)] public string HyperParameterTuningJobName { get { return this._hyperParameterTuningJobName; } set { this._hyperParameterTuningJobName = value; } } // Check to see if HyperParameterTuningJobName property is set internal bool IsSetHyperParameterTuningJobName() { return this._hyperParameterTuningJobName != null; } /// <summary> /// Gets and sets the property HyperParameterTuningJobStatus. /// <para> /// The status of the tuning job. /// </para> /// </summary> [AWSProperty(Required=true)] public HyperParameterTuningJobStatus HyperParameterTuningJobStatus { get { return this._hyperParameterTuningJobStatus; } set { this._hyperParameterTuningJobStatus = value; } } // Check to see if HyperParameterTuningJobStatus property is set internal bool IsSetHyperParameterTuningJobStatus() { return this._hyperParameterTuningJobStatus != null; } /// <summary> /// Gets and sets the property LastModifiedTime. /// <para> /// The date and time that the tuning job was modified. /// </para> /// </summary> public DateTime LastModifiedTime { get { return this._lastModifiedTime.GetValueOrDefault(); } set { this._lastModifiedTime = value; } } // Check to see if LastModifiedTime property is set internal bool IsSetLastModifiedTime() { return this._lastModifiedTime.HasValue; } /// <summary> /// Gets and sets the property ObjectiveStatusCounters. /// <para> /// The <a>ObjectiveStatusCounters</a> object that specifies the numbers of training jobs, /// categorized by objective metric status, that this tuning job launched. /// </para> /// </summary> [AWSProperty(Required=true)] public ObjectiveStatusCounters ObjectiveStatusCounters { get { return this._objectiveStatusCounters; } set { this._objectiveStatusCounters = value; } } // Check to see if ObjectiveStatusCounters property is set internal bool IsSetObjectiveStatusCounters() { return this._objectiveStatusCounters != null; } /// <summary> /// Gets and sets the property ResourceLimits. /// <para> /// The <a>ResourceLimits</a> object that specifies the maximum number of training jobs /// and parallel training jobs allowed for this tuning job. /// </para> /// </summary> public ResourceLimits ResourceLimits { get { return this._resourceLimits; } set { this._resourceLimits = value; } } // Check to see if ResourceLimits property is set internal bool IsSetResourceLimits() { return this._resourceLimits != null; } /// <summary> /// Gets and sets the property Strategy. /// <para> /// Specifies the search strategy hyperparameter tuning uses to choose which hyperparameters /// to use for each iteration. Currently, the only valid value is Bayesian. /// </para> /// </summary> [AWSProperty(Required=true)] public HyperParameterTuningJobStrategyType Strategy { get { return this._strategy; } set { this._strategy = value; } } // Check to see if Strategy property is set internal bool IsSetStrategy() { return this._strategy != null; } /// <summary> /// Gets and sets the property TrainingJobStatusCounters. /// <para> /// The <a>TrainingJobStatusCounters</a> object that specifies the numbers of training /// jobs, categorized by status, that this tuning job launched. /// </para> /// </summary> [AWSProperty(Required=true)] public TrainingJobStatusCounters TrainingJobStatusCounters { get { return this._trainingJobStatusCounters; } set { this._trainingJobStatusCounters = value; } } // Check to see if TrainingJobStatusCounters property is set internal bool IsSetTrainingJobStatusCounters() { return this._trainingJobStatusCounters != null; } } }
34.861345
107
0.618416
[ "Apache-2.0" ]
FoxBearBear/aws-sdk-net
sdk/src/Services/SageMaker/Generated/Model/HyperParameterTuningJobSummary.cs
8,297
C#
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using System.Collections; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using ICSharpCode.Core; using ICSharpCode.Core.Presentation; using ICSharpCode.SharpDevelop.Editor.Search; using ICSharpCode.SharpDevelop.Gui; namespace SearchAndReplace { public class ObserverSearchResult : DefaultSearchResult, IObserver<SearchedFile> { Button stopButton; bool finished; public ObserverSearchResult(string title) { rootNode = new SearchRootNode(title, new List<SearchResultMatch>()); } public IDisposable Registration { get; set; } public override object GetControl() { WorkbenchSingleton.AssertMainThread(); if (resultsTreeViewInstance == null) resultsTreeViewInstance = new ResultsTreeView(); rootNode.GroupResultsByFile(ResultsTreeView.GroupResultsByFile); resultsTreeViewInstance.ItemsSource = new object[] { rootNode }; return resultsTreeViewInstance; } public override IList GetToolbarItems() { var items = base.GetToolbarItems(); if (!finished) { stopButton = new Button { Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.Debug.StopProcess") } }; stopButton.Click += StopButtonClick; items.Add(stopButton); } return items; } void StopButtonClick(object sender, RoutedEventArgs e) { try { stopButton.Visibility = Visibility.Hidden; if (Registration != null) Registration.Dispose(); } finally { rootNode.WasCancelled = true; finished = true; } } void IObserver<SearchedFile>.OnNext(SearchedFile value) { rootNode.Add(value); } void IObserver<SearchedFile>.OnError(Exception error) { // flatten AggregateException and // filter OperationCanceledException try { if (error is AggregateException) ((AggregateException)error).Flatten().Handle(ex => ex is OperationCanceledException); else if (!(error is OperationCanceledException)) throw error; } catch (Exception ex) { MessageService.ShowException(ex); } OnCompleted(); } void OnCompleted() { try { stopButton.Visibility = Visibility.Collapsed; if (Registration != null) Registration.Dispose(); } finally { finished = true; } } void IObserver<SearchedFile>.OnCompleted() { OnCompleted(); } } }
25.524752
155
0.716059
[ "MIT" ]
Plankankul/SharpDevelop-w-Framework
src/AddIns/Misc/SearchAndReplace/Project/Gui/ObserverSearchResult.cs
2,580
C#
using System.ComponentModel; namespace Xamarin.Forms { public interface IItemsLayout : INotifyPropertyChanged {} }
19.5
58
0.811966
[ "MIT" ]
Arobono/Xamarin.Forms
Xamarin.Forms.Core/Items/IItemsLayout.cs
119
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace EXTREMECompairingTests.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EXTREMECompairingTests.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
44.859375
189
0.602926
[ "MIT" ]
SMihand/Cach-GlobalsProxy-Framework
SpeedTest_Save/Properties/Resources.Designer.cs
2,873
C#
using System; using BurgerBackend.Identity.Interface.Services.Models; namespace BurgerBackend.Identity.Service.Services { public interface IUserService { AuthenticateResponse Authenticate(AuthenticateRequest request); Guid? ValidateToken(string token); GetUserResponse GetById(Guid id); void Register(RegisterRequest request); void Update(Guid id, UpdateRequest request); void Delete(Guid id); } }
28.75
71
0.721739
[ "MIT" ]
anderson-rancan/burger_backend
src/BurgerBackend.Identity.Service/Services/IUserService.cs
462
C#
/******************************************************************************* INTEL CORPORATION PROPRIETARY INFORMATION This software is supplied under the terms of a license agreement or nondisclosure agreement with Intel Corporation and may not be copied or disclosed except in accordance with the terms of that agreement Copyright(c) 2012-2014 Intel Corporation. All Rights Reserved. ******************************************************************************/ using System; using UnityEngine; using RSUnityToolkit; [System.Serializable] public class SmoothingUtility : System.Object { private SmoothingTypes _type3D; private SmoothingTypes _type2D; private SmoothingTypes _type1D; private float _factor3D; private float _factor2D; private float _factor1D; private PXCMDataSmoothing _dataSmoothing; private PXCMDataSmoothing.Smoother3D _smoother3D; private PXCMDataSmoothing.Smoother2D _smoother2D; private PXCMDataSmoothing.Smoother1D _smoother1D; private bool _initialized = false; public enum SmoothingTypes { Spring, Stabilizer, Weighted, Quadratic } public SmoothingUtility() { } public void Dispose() { if (_smoother1D != null) { _smoother1D.Dispose(); } if (_smoother2D != null) { _smoother2D.Dispose(); } if (_smoother3D != null) { _smoother3D.Dispose(); } if (_dataSmoothing != null) { _dataSmoothing.Dispose(); } } ~SmoothingUtility() { } public bool Init() { if (!_initialized && SenseToolkitManager.Instance != null) { SenseToolkitManager.Instance.AddDisposeFunction(Dispose); _initialized = true; } return _initialized; } public Quaternion ProcessSmoothing(SmoothingTypes type, float factor, Quaternion vec) { Init(); Vector3 vec3 = new Vector3(vec.x, vec.y, vec.z); vec3 = ProcessSmoothing(type, factor, vec3); float w = vec.w; w = ProcessSmoothing(type, factor, w); return new Quaternion(vec3.x, vec3.y, vec3.z, w); } public Vector3 ProcessSmoothing(SmoothingTypes type, float factor, Vector3 vec) { Init(); if (_dataSmoothing == null) { SenseToolkitManager.Instance.SenseManager.session.CreateImpl<PXCMDataSmoothing>(out _dataSmoothing); } if (_smoother3D == null || _type3D != type || factor != _factor3D) { if (_smoother3D != null) { _smoother3D.Dispose(); } CreateSmootherType(type, factor, out _smoother3D); _type3D = type; _factor3D = factor; } PXCMPoint3DF32 point = new PXCMPoint3DF32(){x = vec.x, y = vec.y, z = vec.z}; _smoother3D.AddSample(point); point = _smoother3D.GetSample(); return new Vector3(point.x, point.y, point.z); } public Vector2 ProcessSmoothing(SmoothingTypes type, float factor, Vector2 vec) { Init(); if (_dataSmoothing == null) { SenseToolkitManager.Instance.SenseManager.session.CreateImpl<PXCMDataSmoothing>(out _dataSmoothing); } if (_smoother2D == null || _type2D != type || factor != _factor2D) { if (_smoother2D != null) { _smoother2D.Dispose(); } CreateSmootherType(type, factor, out _smoother2D); _type2D = type; _factor2D = factor; } PXCMPointF32 point = new PXCMPointF32(){x = vec.x, y = vec.y}; _smoother2D.AddSample(point); point = _smoother2D.GetSample(); return new Vector2(point.x, point.y); } public float ProcessSmoothing(SmoothingTypes type, float factor, float sample) { Init(); if (_dataSmoothing == null) { SenseToolkitManager.Instance.SenseManager.session.CreateImpl<PXCMDataSmoothing>(out _dataSmoothing); } if (_smoother1D == null || _type1D != type || factor != _factor1D) { if (_smoother1D != null) { _smoother1D.Dispose(); } CreateSmootherType(type, factor, out _smoother1D); _type1D = type; _factor1D = factor; } _smoother1D.AddSample(sample); sample = _smoother1D.GetSample(); return sample; } private void CreateSmootherType(SmoothingTypes type, float factor, out PXCMDataSmoothing.Smoother3D smoother) { switch (type) { case SmoothingTypes.Quadratic: smoother = _dataSmoothing.Create3DQuadratic(factor); break; case SmoothingTypes.Stabilizer: smoother = _dataSmoothing.Create3DStabilizer(7, factor); break; case SmoothingTypes.Weighted: smoother = _dataSmoothing.Create3DWeighted((int)factor); break; case SmoothingTypes.Spring: default: smoother = _dataSmoothing.Create3DSpring(factor); break; } } private void CreateSmootherType(SmoothingTypes type, float factor, out PXCMDataSmoothing.Smoother2D smoother) { switch (type) { case SmoothingTypes.Quadratic: smoother = _dataSmoothing.Create2DQuadratic(factor); break; case SmoothingTypes.Stabilizer: smoother = _dataSmoothing.Create2DStabilizer(7, factor); break; case SmoothingTypes.Weighted: smoother = _dataSmoothing.Create2DWeighted((int)factor); break; case SmoothingTypes.Spring: default: smoother = _dataSmoothing.Create2DSpring(factor); break; } } private void CreateSmootherType(SmoothingTypes type, float factor, out PXCMDataSmoothing.Smoother1D smoother) { switch (type) { case SmoothingTypes.Quadratic: smoother = _dataSmoothing.Create1DQuadratic(factor); break; case SmoothingTypes.Stabilizer: smoother = _dataSmoothing.Create1DStabilizer(7, factor); break; case SmoothingTypes.Weighted: smoother = _dataSmoothing.Create1DWeighted((int)factor); break; case SmoothingTypes.Spring: default: smoother = _dataSmoothing.Create1DSpring(factor); break; } } }
23.682203
110
0.696189
[ "MIT" ]
intentor/sensewizard
Assets/Vendor/RSUnityToolkit/Internals/Actions Utils/SmoothingUtility.cs
5,589
C#
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using Microsoft.Extensions.Logging; using TtsApi.ExternalApis.Discord.WebhookObjects; namespace TtsApi.ExternalApis.Discord { public class DiscordLogger { private const int DiscordWebhookGroupingDelay = 2000; private readonly ConcurrentQueue<WebhookPostContent> _messageQueue = new(); private static DiscordLogger GetInstance { get; } = new(); private DiscordLogger() { new Thread(ThreadRunner).Start(); } public static void LogException(Exception e) { Log( LogLevel.Error, e.ToString().Split(Environment.NewLine).Select(s => s.Trim()).Take(2).ToArray() ); } public static void Log(LogLevel logLevel, params string[] messages) => Log(logLevel, LogChannel.Main, messages); public static void Log(LogLevel logLevel, LogChannel logChannel, params string[] messages) { Manual( logLevel.ToString(), $"```\n{string.Join("\n``` ```\n", messages)}\n```", GetLogLevelColour(logLevel), logChannel ); } private static void Manual(string title, string description, int color, LogChannel logChannel = LogChannel.Main) { WebhookEmbeds embed = new() { Title = title, Timestamp = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture), Description = description, Color = color, Footer = new WebhookFooter { Text = nameof(TtsApi) } }; WebhookPostContent content = new() { Username = nameof(TtsApi), Embeds = new List<WebhookEmbeds> {embed}, LogChannel = logChannel }; GetInstance._messageQueue.Enqueue(content); } private static void ManualFile(string fileContent) { WebhookPostContent content = new() { Username = nameof(TtsApi), FileContent = fileContent, //PayloadJson = JsonSerializer.Serialize( // new WebhookCreateMessage {Embed = new List<WebhookEmbeds> {embed}}, // new JsonSerializerOptions {IgnoreNullValues = true}), }; GetInstance._messageQueue.Enqueue(content); } private static int GetDecimalFromHexString(string hex) { hex = hex.Replace("#", ""); return Convert.ToInt32(hex, 16); } private static int GetLogLevelColour(LogLevel level) { return level switch { LogLevel.Trace => 12648384, //#C0FFC0 LogLevel.Debug => 8379242, //#7FDB6A LogLevel.Information => 15653937, //#EEDC31 LogLevel.Warning => 14971382, //#E47200 LogLevel.Error => 16009031, //#F44747 LogLevel.Critical => 0, //#000000 LogLevel.None => 16777215, //#FFFFFF _ => throw new ArgumentOutOfRangeException(nameof(level), level, null) }; } private void ThreadRunner() { while (true) { Thread.Sleep(DiscordWebhookGroupingDelay); if (_messageQueue.IsEmpty) continue; if (_messageQueue.TryDequeue(out WebhookPostContent content)) { if (string.IsNullOrEmpty(content.FileContent)) { DiscordWebhook.SendEmbedsWebhook(content.LogChannel, content); } else { Dictionary<string, string> files = new() { {"Stacktrace", content.FileContent} }; DiscordWebhook.SendFilesWebhook(content.LogChannel, content.Username, files, content.PayloadJson); } } } } } }
34.234375
120
0.518713
[ "MIT" ]
icecreamdatabase/TtsApi
TtsApi/ExternalApis/Discord/DiscordLogger.cs
4,384
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DocumentFormat.OpenXml.Tests.ThreadingInfo { using Xunit; using DocumentFormat.OpenXml.Tests.TaskLibraries; using DocumentFormat.OpenXml.Tests.ChartTrackingRefBasedClass; using System.IO; using OxTest; public class ThreadingInfoTest : OpenXmlTestBase { //private readonly string generateDocumentFile = "TestThreadingInfoBase.pptx"; //private readonly string editDocumentFile = "EditedThreadingInfo.pptx"; //private readonly string deleteDocumentFile = "DeletedThreadingInfo.pptx"; //private readonly string addDocumentFile = "AddedThreadingInfo.pptx"; private readonly string generateDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".pptx"); private readonly string editDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".pptx"); private readonly string deleteDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".pptx"); private readonly string addDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".pptx"); TestEntities testEntities = null; #region Constructor /// <summary> /// Constructor /// </summary> public ThreadingInfoTest() { } #endregion #region Initialize /// <summary> /// Creates a base Word file for the tests /// </summary> /// <param name="createFilePath">Create Power Point file path</param> private void Initialize(string createFilePath) { GeneratedDocument generatedDocument = new GeneratedDocument(); generatedDocument.CreatePackage(createFilePath); this.Log.Pass("Create Power Point file. File path=[{0}]", createFilePath); this.testEntities = new TestEntities(createFilePath); } #endregion #region Test Methods /// <summary> /// Creates a base Excel file for the tests /// </summary> protected override void TestInitializeOnce() { string generatDocumentFilePath = this.GetTestFilePath(this.generateDocumentFile); Initialize(generatDocumentFilePath); } /// <summary> /// Element editing test for PresentationExtensionList element /// </summary> [Fact] public void ThreadingInfo01EditElement() { this.MyTestInitialize(TestContext.GetCurrentMethod()); string originalFilepath = this.GetTestFilePath(this.generateDocumentFile); string editFilePath = this.GetTestFilePath(this.editDocumentFile); System.IO.File.Copy(originalFilepath, editFilePath, true); this.testEntities.EditElements(editFilePath, this.Log); this.testEntities.VerifyElements(editFilePath, this.Log); } /// <summary> /// Element deleting test for PresentationExtensionList element /// </summary> [Fact] public void ThreadingInfo03DeleteAddElement() { this.MyTestInitialize(TestContext.GetCurrentMethod()); string originalFilepath = this.GetTestFilePath(this.generateDocumentFile); string deleteFilePath = this.GetTestFilePath(this.deleteDocumentFile); string addFilePath = this.GetTestFilePath(this.addDocumentFile); System.IO.File.Copy(originalFilepath, deleteFilePath, true); this.testEntities.DeleteElements(deleteFilePath, this.Log); this.testEntities.VerifyDeleteElements(deleteFilePath, this.Log); System.IO.File.Copy(deleteFilePath, addFilePath, true); this.testEntities.AddElements(addFilePath, this.Log); this.testEntities.VerifyAddElements(addFilePath, this.Log); } #endregion } }
39.037037
184
0.670066
[ "Apache-2.0" ]
Aliceljm1/openxml
DocumentFormat.OpenXml.Tests/ConformanceTest/ThreadingInfo/ThreadingInfoTest.cs
4,218
C#
using MyTagPocket.CoreUtil; using MyTagPocket.CoreUtil.Exceptions; using MyTagPocket.CoreUtil.Interfaces; using MyTagPocket.Repository.Files.Interfaces; using MyTagPocket.Repository.Interfaces; using MyTagPocket.Resources; using System; using System.IO.Abstractions; using System.Threading.Tasks; namespace MyTagPocket.Repository { /// <summary> /// File system repository /// </summary> public class FileRepository : IFileRepository { /// <summary> /// Identifikation class for localization code /// <see cref="_ClassCodeLast.cs"/> /// </summary> const string classCode = "C10024"; /// <summary> /// Logger instance /// </summary> public static ILogger Log; /// <summary> /// Root path for application file data /// </summary> private string applicationDataPath; /// <summary> /// File storage /// </summary> private FileStorage.FileSystem fs; /// <summary> /// Constructor /// </summary> /// <param name="logManager">Log manager</param> /// <param name="storage">Path to folder for data</param> public FileRepository(ILogManager logManager, string dataPath) { Log = logManager.GetLog(classCode); applicationDataPath = dataPath; fs = new FileStorage.FileSystem(new FileSystem()); } /// <summary> /// Constructor /// </summary> /// <param name="logManager">Log manager</param> /// <param name="fileSystem">File system</param> /// <param name="dataPath">Path to folder for data</param> public FileRepository(ILogManager logManager, IFileSystem fileSystem, string dataPath) { Log = logManager.GetLog(classCode); applicationDataPath = dataPath; fs = new FileStorage.FileSystem(fileSystem); } /// <summary> /// Save entity to file system /// </summary> /// <typeparam name="T">Entity type</typeparam> /// <param name="entity">Instance entity</param> public Task<T> LoadAsync<T>(IFileEntityBase<T> entity) { return Task.Run(() => { const string methodCode = "M02"; try { Log.Trace(methodCode, "Load Entity={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); string path = GetLocalFilePath(entity.TypeEntity, entity.FolderId, entity.EntityId); string jsonString = fs.File.ReadFile(path); int versionExpect = entity.Version; T result = entity.DeserializeJson(jsonString); if (result is IFileEntityBase<T>) return result; Log.Error(methodCode, "File is not compatible in format MyTagPocket. TypeEntity={@entity.TypeEntity.Name}] EntityId={@EntityId}", entity.TypeEntity.Name, entity.EntityId); throw new ErrorException(ResourceApp.ExceptionCantLoadFile); } catch (Exception ex) { Log.Error(ex, methodCode, "Cant load file TypeEntity={@entity.TypeEntity.Name}] EntityId={@EntityId}", entity.TypeEntity.Name, entity.EntityId); throw new ErrorException(ResourceApp.ExceptionCantLoadFile); } }); } /* /// <summary> /// Load entity file from archive /// </summary> /// <typeparam name="T">Entity type</typeparam> /// <param name="fileInfo">Fistory file to restore</param> /// <param name="fileHistory">File with full history</param> public Task<T> LoadFromArchivAsync<T>(IFileHistoryInfo fileInfo) { return Task.Run(() => { const string methodCode = "M04"; try { if (string.IsNullOrEmpty(fileInfo.CommitId)) { throw new ErrorException(ResourceApp.ExceptionCantLoadFileFromArchive); } Log.Trace(methodCode, "Load from archive {@FileType} ID={@FileId} commit={@CommitId}", fileInfo.FileType, fileInfo.FileId, fileInfo.CommitId); var entityType = DataTypeEnum.ValueOf(fileInfo.FileType); string path = GetLocalFilePath(entityType, fileInfo.FolderId, fileInfo.FileId); string archivePath = System.IO.Path.ChangeExtension(path, DataTypeEnum.Archive.LocalizedName); string historyPath = System.IO.Path.ChangeExtension(path, DataTypeEnum.History.LocalizedName); var archives = LoadHistoryFile(historyPath); var dmp = new diff_match_patch(); bool readPatch = false; List<string> patches = new List<string>(); long startPosition = 0; using (BinaryReader b = new BinaryReader(storage.File.Open(archivePath, FileMode.Open))) { foreach (var archiv in archives) { //var = dmp.patch_fromText(patch); if (archiv.CommitId == fileInfo.CommitId) readPatch = true; if (!readPatch) { startPosition += archiv.LengthContent; continue; } // Seek to our required position. b.BaseStream.Seek(startPosition, SeekOrigin.Begin); byte[] contentBytes = b.ReadBytes(archiv.LengthContent); startPosition += archiv.LengthContent; var patch = Text.DecompressToString(contentBytes, Encoding.UTF8); patches.Add(patch); } } string restore = storage.File.ReadAllText(path); //restore old file string restoreContent = (string)restore.Clone(); for (int i = patches.Count - 1; i >= 0; i--) { var restorePatch = dmp.patch_fromText(patches[i]); restoreContent = dmp.patch_apply(restorePatch, restoreContent)[0].ToString(); } IFileEntityBase<T> entity; switch (entityType.Value) { case DataTypeEnum.DataType.Package: entity = (IFileEntityBase<T>)new Package(); break; case DataTypeEnum.DataType.Device: entity = (IFileEntityBase<T>)new Files.Entities.Devices.Device(); break; default: Log.Error(methodCode, "Cant recognize type file for load from archive type={@FileType} file ID={@FileId}", fileInfo.FileType, fileInfo.FileId); throw new ErrorException(ResourceApp.ExceptionCantLoadFileFromArchive); } T result = entity.DeserializeJson(restoreContent);//contentJson); return result; } catch (Exception ex) { Log.Error(ex, methodCode, "Cant load file from archive type={@FileType} file ID {@FileId}", fileInfo.FileType, fileInfo.FileId); throw new Exception(ResourceApp.ExceptionCantLoadFileFromArchive); } }); } */ /* /// <summary> /// Load history save of file entity /// </summary> /// <typeparam name="T">Type File entity</typeparam> /// <param name="entity">Entity object</param> /// <returns>List of file entity history</returns> public async Task<IEnumerable<IFileHistoryInfo>> LoadHistoryAsync<T>(IFileEntityBase<T> entity) { return await Task.Run(() => { const string methodCode = "M05"; try { Log.Trace(methodCode, "Load history Entity={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); string path = GetLocalFilePath(entity.TypeEntity, entity.FolderId, entity.EntityId); var pathHistory = System.IO.Path.ChangeExtension(path, DataTypeEnum.History.LocalizedName); return LoadHistoryFile(pathHistory).AsEnumerable(); } catch (Exception ex) { Log.Error(ex, methodCode, "Cant load type={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); throw new ErrorException(ResourceApp.ExceptionCantLoadFileHistory); } }); } */ /// <summary> /// Load entity from file system /// </summary> /// <typeparam name="T">Entity type</typeparam> /// <param name="entity">Instance entity</param> /// <param name="path">Path to folder where entity save</param> public async Task SaveAsync<T>(IFileEntityBase<T> entity, string path) { await Task.Run(() => { const string methodCode = "M01"; try { Log.Trace(methodCode, "Save Entity={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); entity.UpdatedWhen = DateTimeOffset.Now; entity.CommitId = Guid.NewGuid().ToString("N"); entity.Hash = entity.GetHashCode().ToString(); string jsonStringNew = entity.SerializeJson(); //string path = GetLocalFilePath(entityNew.TypeEntity, entityNew.FolderId, entityNew.EntityId); if (fs.Directory.FolderExists(path)) fs.File.SaveFile(path, jsonStringNew); else throw new Exception("Folder not exists"); entity.FullPathFile = path; } catch (Exception ex) { Log.Error(ex, methodCode, "Cant Save Entity={@TypeEntity} ID={@EntityId} path={@Path}", entity.TypeEntity.Name, entity.EntityId, path); throw ex; } }); } /* /// <summary> /// Load entity from file system /// </summary> /// <typeparam name="T">Entity type</typeparam> /// <param name="entity">Instance entity</param> /// <param name="toArchive">Save entity to archive too</param> public async Task SaveAsync<T>(IFileEntityBase<T> entityNew, IFileEntityBase<T> entityOld) { await Task.Run(() => { const string methodCode = "M01"; try { Log.Trace(methodCode, "Save Entity={@TypeEntity} ID={@EntityId}", entityNew.TypeEntity.Name, entityNew.EntityId); entityNew.UpdatedWhen = DateTimeOffset.Now; entityNew.CommitId = Guid.NewGuid().ToString("N"); entityNew.Hash = entityNew.GetHashCode().ToString(); string jsonStringNew = entityNew.SerializeJson(); string path = GetLocalFilePath(entityNew.TypeEntity, entityNew.FolderId, entityNew.EntityId); fs.File.SaveFile(path, jsonStringNew); entityNew.FullPathFile = path; if (entityOld == null) return; var dmp = new diff_match_patch(); string jsonStringOld = entityOld.SerializeJson(); var newToOld = dmp.patch_make(jsonStringNew, jsonStringOld); var patch = dmp.patch_toText(newToOld); var compress = Text.Compress(patch, Encoding.UTF8); var infoSave = new FileHistoryInfo(); infoSave.FileId = entityNew.EntityId; infoSave.FolderId = entityNew.FolderId; infoSave.CommitId = entityNew.CommitId; infoSave.CreatedDate = entityNew.UpdatedWhen.ConvertToText(); infoSave.CreatedWhoFullname = entityNew.UpdatedWho?.FullName; infoSave.CreatedWhoEmail = entityNew.UpdatedWho?.Email; infoSave.CreatedWhoId = entityNew.UpdatedWho?.EntityId; infoSave.CreatedOnDeviceName = entityNew.UpdatedDevice?.Name; infoSave.CreatedOnDeviceId = entityNew.UpdatedDevice?.EntityId; infoSave.LengthContent = compress.Length; infoSave.FileType = entityNew.TypeEntity.Name; string jsonHistory = infoSave.SerializeJson(); int h = jsonHistory.Length; var historyFile = System.IO.Path.ChangeExtension(path, DataTypeEnum.History.LocalizedName); var archiveFile = System.IO.Path.ChangeExtension(path, DataTypeEnum.Archive.LocalizedName); //TODO: Refactoring - transaction fs.File.SaveAppendToFile(historyFile, jsonHistory); fileHelper.SaveAppendToFile(historyFile, Environment.NewLine); fileHelper.SaveAppendToFile(archiveFile, compress); } catch (Exception ex) { Log.Error(ex, methodCode, "Cant Save Entity={@TypeEntity} ID={@EntityId}", entityNew.TypeEntity.Name, entityNew.EntityId); throw ex; } }); } */ /// <summary> /// Delete entity /// </summary> /// <param name="entity">Entity</param> public async Task DeleteAsync<T>(IFileEntityBase<T> entity) { await Task.Run(() => { const string methodCode = "M03"; try { Log.Trace(methodCode, "Delete Entity={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); string path = GetLocalFilePath(entity.TypeEntity, entity.FolderId, entity.EntityId); fs.File.Delete(path); } catch (Exception ex) { Log.Error(ex, methodCode, "Cant Delete={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); throw new ErrorException(ResourceApp.ExceptionCantDeleteFile); } }); } /// <summary> /// Delete entity /// </summary> /// <param name="entity">Entity</param> /*public async Task DeleteAsync<T>(IFileEntityBase<T> entity) { await Task.Run(() => { const string methodCode = "M03"; try { Log.Trace(methodCode, "Delete Entity={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); string path = GetLocalFilePath(entity.TypeEntity, entity.FolderId, entity.EntityId); fs.File.Delete(path); //Delete the archive switch (entity.TypeEntity.Value) { case DataTypeEnum.DataType.Package: case DataTypeEnum.DataType.Tag: var pathArchive = System.IO.Path.ChangeExtension(path, DataTypeEnum.Archive.LocalizedName); fs.File.Delete(pathArchive); var pathHistory = System.IO.Path.ChangeExtension(path, DataTypeEnum.History.LocalizedName); fs.File.Delete(pathHistory); break; default: break; } } catch (Exception ex) { Log.Error(ex, methodCode, "Cant Delete={@TypeEntity} ID={@EntityId}", entity.TypeEntity.Name, entity.EntityId); throw new ErrorException(ResourceApp.ExceptionCantDeleteFile); } }); } */ /// <summary> /// Load entity from archive /// </summary> /// <param name="entity"></param> /// <returns></returns> public Task<IFileEntityBase<T>> LoadArchiveAsync<T>(IFileEntityBase<T> entity) { throw new NotImplementedException(); } /* /// <summary> /// Load history file /// </summary> /// <param name="path">Full path to history</param> /// <returns>List history</returns> private List<IFileHistoryInfo> LoadHistoryFile(string path) { var historyJson = fs.LoadFileLines(path); var result = new List<IFileHistoryInfo>(); int startPosition = 0; foreach (var str in historyJson) { var info = new FileHistoryInfo(); info = info.DeserializeJson(str); info.StartPosition = startPosition; result.Add(info); startPosition += info.LengthContent; } return result; } */ #region Basic file/directory operation /// <summary> /// Get path for file /// </summary> /// <param name="typeEntity"></param> /// <param name="folderId"></param> /// <param name="entityId"></param> /// <returns></returns> public string GetLocalFilePath(DataTypeEnum typeEntity, string folderId, string entityId) { //AppGlobal.Folders. throw new NotImplementedException(); } /* /// <summary> /// Add binary data to file /// </summary> /// <param name="path">Full path to file</param> /// <param name="content">Content</param> public void SaveAppendToFile(string path, byte[] content) { using (var FS = fileSystemStorage.FileStream.Create(path, fileSystemStorage.File.Exists(path) ? FileMode.Append : FileMode.OpenOrCreate, FileAccess.Write)) { FS.Write(content, 0, content.Length); FS.Close(); } } */ /* /// <summary> /// Load contet from file /// </summary> /// <param name="path">Full path to file</param> /// <param name="startPosition">Position from where to start reading</param> /// <param name="lengthContent">Length of content to be read</param> /// <returns></returns> public byte[] LoadContentFromFile(string path, int startPosition, int lengthContent) { byte[] result; using (BinaryReader b = new BinaryReader(fileSystemStorage.File.Open(path, FileMode.Open))) { // Seek to our required position. b.BaseStream.Seek(startPosition, SeekOrigin.Begin); result = b.ReadBytes(lengthContent); } return result; } */ #endregion Basic file/directory operation } }
39.266219
180
0.592012
[ "MIT" ]
psaf01/MyTagPocket
MyTagPocket/Repository/FileRepository.cs
17,554
C#
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // Template Source: Templates\CSharp\Requests\IEntityWithReferenceRequest.cs.tt namespace Microsoft.Graph { using System; using System.IO; using System.Net.Http; using System.Threading; using System.Linq.Expressions; /// <summary> /// The interface IManagedAppRegistrationWithReferenceRequest. /// </summary> public partial interface IManagedAppRegistrationWithReferenceRequest : IBaseRequest { /// <summary> /// Gets the specified ManagedAppRegistration. /// </summary> /// <returns>The ManagedAppRegistration.</returns> System.Threading.Tasks.Task<ManagedAppRegistration> GetAsync(); /// <summary> /// Gets the specified ManagedAppRegistration. /// </summary> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The ManagedAppRegistration.</returns> System.Threading.Tasks.Task<ManagedAppRegistration> GetAsync(CancellationToken cancellationToken); /// <summary> /// Adds the specified expand value to the request. /// </summary> /// <param name="value">The expand value.</param> /// <returns>The request object to send.</returns> IManagedAppRegistrationWithReferenceRequest Expand(string value); /// <summary> /// Adds the specified expand value to the request. /// </summary> /// <param name="expandExpression">The expression from which to calculate the expand value.</param> /// <returns>The request object to send.</returns> IManagedAppRegistrationWithReferenceRequest Expand(Expression<Func<ManagedAppRegistration, object>> expandExpression); /// <summary> /// Adds the specified select value to the request. /// </summary> /// <param name="value">The select value.</param> /// <returns>The request object to send.</returns> IManagedAppRegistrationWithReferenceRequest Select(string value); /// <summary> /// Adds the specified select value to the request. /// </summary> /// <param name="selectExpression">The expression from which to calculate the select value.</param> /// <returns>The request object to send.</returns> IManagedAppRegistrationWithReferenceRequest Select(Expression<Func<ManagedAppRegistration, object>> selectExpression); } }
43.784615
153
0.636332
[ "MIT" ]
mlafleur/msgraph-sdk-dotnet
src/Microsoft.Graph/Requests/Generated/IManagedAppRegistrationWithReferenceRequest.cs
2,846
C#
using System; using NUnit.Framework; public class Test07 { //Count [TestCase] public void Count_Should_IncreaseOnMultiple_Elements() { //Arrange IArena RA = new RoyaleArena(); Battlecard cd1 = new Battlecard(5, CardType.SPELL, "joro", 3, 5); Battlecard cd2 = new Battlecard(6, CardType.SPELL, "joro", 8, 5); Battlecard cd3 = new Battlecard(7, CardType.SPELL, "joro", 9, 5); //Act RA.Add(cd1); RA.Add(cd2); RA.Add(cd3); //Assert Assert.AreEqual(3, RA.Count); } }
22.96
73
0.578397
[ "Apache-2.0" ]
KostadinovK/Data-Structures
12-Exam-Prep/Exam-20.05.2018/02-RoyalArena/RoyaleArena.Tests/Correctness/Test07.cs
576
C#
// <copyright file="FreePurchaseSpecification.cs" company="Automate The Planet Ltd."> // Copyright 2016 Automate The Planet Ltd. // 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. // </copyright> // <author>Anton Angelov</author> // <site>http://automatetheplanet.com/</site> using SpecificationDesignPattern.Data; using SpecificationDesignPattern.Specifications.Core; namespace SpecificationDesignPattern.Specifications { public class FreePurchaseSpecification : Specification<PurchaseTestInput> { public override bool IsSatisfiedBy(PurchaseTestInput entity) { return entity.TotalPrice == 0; } } }
42.222222
86
0.751754
[ "Apache-2.0" ]
alanmacgowan/AutomateThePlanet-Learning-Series
DesignPatternsInAutomatedTesting-Series/SpecificationDesignPattern/Specifications/FreePurchaseSpecification.cs
1,142
C#
// ------------------------------------------------------------------------------ // <auto-generated> // Generated by Xsd2Code. Version 3.4.0.18239 Microsoft Reciprocal License (Ms-RL) // <NameSpace>Mim.V6301</NameSpace><Collection>Array</Collection><codeType>CSharp</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net35</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>True</ExcludeIncludedTypes><EnableInitializeFields>False</EnableInitializeFields> // </auto-generated> // ------------------------------------------------------------------------------ namespace Mim.V6301 { using System; using System.Diagnostics; using System.Xml.Serialization; using System.Collections; using System.Xml.Schema; using System.ComponentModel; using System.IO; using System.Text; [System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.4.0.18239")] [System.SerializableAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:hl7-org:v3")] public partial class CV_Interpretation : CV { private static System.Xml.Serialization.XmlSerializer serializer; private static System.Xml.Serialization.XmlSerializer Serializer { get { if ((serializer == null)) { serializer = new System.Xml.Serialization.XmlSerializer(typeof(CV_Interpretation)); } return serializer; } } #region Serialize/Deserialize /// <summary> /// Serializes current CV_Interpretation object into an XML document /// </summary> /// <returns>string XML value</returns> public virtual string Serialize() { System.IO.StreamReader streamReader = null; System.IO.MemoryStream memoryStream = null; try { memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); return streamReader.ReadToEnd(); } finally { if ((streamReader != null)) { streamReader.Dispose(); } if ((memoryStream != null)) { memoryStream.Dispose(); } } } /// <summary> /// Deserializes workflow markup into an CV_Interpretation object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output CV_Interpretation object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out CV_Interpretation obj, out System.Exception exception) { exception = null; obj = default(CV_Interpretation); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool Deserialize(string xml, out CV_Interpretation obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); } public static CV_Interpretation Deserialize(string xml) { System.IO.StringReader stringReader = null; try { stringReader = new System.IO.StringReader(xml); return ((CV_Interpretation)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)))); } finally { if ((stringReader != null)) { stringReader.Dispose(); } } } /// <summary> /// Serializes current CV_Interpretation object into file /// </summary> /// <param name="fileName">full path of outupt xml file</param> /// <param name="exception">output Exception value if failed</param> /// <returns>true if can serialize and save into file; otherwise, false</returns> public virtual bool SaveToFile(string fileName, out System.Exception exception) { exception = null; try { SaveToFile(fileName); return true; } catch (System.Exception e) { exception = e; return false; } } public virtual void SaveToFile(string fileName) { System.IO.StreamWriter streamWriter = null; try { string xmlString = Serialize(); System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName); streamWriter = xmlFile.CreateText(); streamWriter.WriteLine(xmlString); streamWriter.Close(); } finally { if ((streamWriter != null)) { streamWriter.Dispose(); } } } /// <summary> /// Deserializes xml markup from file into an CV_Interpretation object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output CV_Interpretation object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out CV_Interpretation obj, out System.Exception exception) { exception = null; obj = default(CV_Interpretation); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool LoadFromFile(string fileName, out CV_Interpretation obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); } public static CV_Interpretation LoadFromFile(string fileName) { System.IO.FileStream file = null; System.IO.StreamReader sr = null; try { file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read); sr = new System.IO.StreamReader(file); string xmlString = sr.ReadToEnd(); sr.Close(); file.Close(); return Deserialize(xmlString); } finally { if ((file != null)) { file.Dispose(); } if ((sr != null)) { sr.Dispose(); } } } #endregion #region Clone method /// <summary> /// Create a clone of this CV_Interpretation object /// </summary> public virtual CV_Interpretation Clone() { return ((CV_Interpretation)(this.MemberwiseClone())); } #endregion } }
45.687831
1,358
0.586219
[ "MIT" ]
Kusnaditjung/MimDms
src/Mim.V6301/Generated/CV_Interpretation.cs
8,635
C#
#region Copyright // // DotNetNuke® - http://www.dotnetnuke.com // Copyright (c) 2002-2013 // by DotNetNuke Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and // to permit persons to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or substantial portions // of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #endregion using System; using System.Configuration; using System.Diagnostics; using System.IO; using System.Reflection; using System.Xml; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer; using DotNetNuke.Tests.Utilities; using NUnit.Framework; namespace DotNetNuke.Tests.Integration.Services.Installer { [TestFixture] public class XmlMergeTests : DnnUnitTest { private readonly Assembly _assembly = typeof (XmlMergeTests).Assembly; private const bool OutputXml = true; /// <summary> /// Merges the Merge and Target files based on the name of the calling method. /// </summary> /// <remarks>xml files must be embedded resources in the MergeFiles folder named {method}Merge.xml and {method}Target.xml</remarks> /// <returns>XmlDocument with the result of the merge operation</returns> private XmlDocument ExecuteMerge() { return ExecuteMerge(null); } /// <summary> /// As ExecuteMerge but allows the merge file prefix to be specified /// </summary> private XmlDocument ExecuteMerge(string mergeName) { string testMethodName = GetTestMethodName(); XmlMerge merge = GetXmlMerge(mergeName ?? testMethodName); XmlDocument targetDoc = LoadTargetDoc(testMethodName); merge.UpdateConfig(targetDoc); WriteToDebug(targetDoc); return targetDoc; } private string GetTestMethodName() { var st = new StackTrace(2); string name; int i = 0; do { name = st.GetFrame(i).GetMethod().Name; i++; } while (name == "ExecuteMerge"); return name; } private XmlDocument LoadTargetDoc(string testMethodName) { using (Stream targetStream = _assembly.GetManifestResourceStream(string.Format("DotNetNuke.Tests.Integration.Services.Installer.MergeFiles.{0}Target.xml", testMethodName))) { Debug.Assert(targetStream != null, string.Format("Unable to location embedded resource for {0}Target.xml", testMethodName)); var targetDoc = new XmlDocument(); targetDoc.Load(targetStream); return targetDoc; } } private XmlMerge GetXmlMerge(string fileName) { using (Stream mergeStream = _assembly.GetManifestResourceStream(string.Format("DotNetNuke.Tests.Integration.Services.Installer.MergeFiles.{0}Merge.xml", fileName))) { Debug.Assert(mergeStream != null, string.Format("Unable to location embedded resource for {0}Merge.xml", fileName)); var merge = new XmlMerge(mergeStream, "version", "sender"); return merge; } } private void WriteToDebug(XmlDocument targetDoc) { // ReSharper disable ConditionIsAlwaysTrueOrFalse if (OutputXml) // ReSharper restore ConditionIsAlwaysTrueOrFalse { var writer = new StreamWriter(new MemoryStream()); targetDoc.Save(writer); writer.BaseStream.Seek(0, SeekOrigin.Begin); Debug.WriteLine(new StreamReader(writer.BaseStream).ReadToEnd()); } } [SetUp] public void SetUp() { AppDomain.CurrentDomain.SetData("APPBASE", WebsitePhysicalAppPath); LoggerSource.SetTestableInstance(new TestLogSource()); } // ReSharper disable PossibleNullReferenceException [Test] public void SimpleUpdate() { XmlDocument targetDoc = ExecuteMerge(); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void SimpleUpdateInLocation() { XmlDocument targetDoc = ExecuteMerge("SimpleUpdate"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/location/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void SimpleUpdateInLocationWithDistractingLocations() { XmlDocument targetDoc = ExecuteMerge("SimpleUpdate"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/location/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void UpdateWithTargetPath() { XmlDocument targetDoc = ExecuteMerge(); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void UpdateInLocationWithTargetPath() { XmlDocument targetDoc = ExecuteMerge("UpdateWithTargetPath"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/location/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void UpdateWithDistractingLocationAndTargetPath() { XmlDocument targetDoc = ExecuteMerge("UpdateWithTargetPath"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void UpdateInLocationWithDistractingLocationAndTargetPath() { XmlDocument targetDoc = ExecuteMerge("UpdateWithTargetPath"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/location/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); } [Test] public void UpdateInFirstLocationWithDistractingLocationAndTargetPath() { XmlDocument targetDoc = ExecuteMerge("UpdateWithTargetPath"); //children are in correct location //first location/updateme has updated node XmlNode root = targetDoc.SelectSingleNode("/configuration/location[1]"); XmlNodeList nodes = root.SelectNodes("updateme/children/child"); Assert.AreEqual(2, nodes.Count); //second location/updateme still empty root = targetDoc.SelectSingleNode("/configuration/location[2]"); nodes = root.SelectNodes("updateme/children/child"); Assert.AreEqual(0, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); //two instances of location/updateme exist nodes = targetDoc.SelectNodes("//configuration/location/updateme"); Assert.AreEqual(2, nodes.Count); } [Test] public void SimpleAdd() { XmlDocument targetDoc = ExecuteMerge(); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); } [Test] public void AddWithLocation() { XmlDocument targetDoc = ExecuteMerge("SimpleAdd"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //second location/updateme still empty var root = targetDoc.SelectSingleNode("/configuration/location[2]"); nodes = root.SelectNodes("updateme/children/child"); Assert.AreEqual(0, nodes.Count); //children only inserted once nodes = targetDoc.SelectNodes("//child"); Assert.AreEqual(2, nodes.Count); //1 instance of location/updateme exist nodes = targetDoc.SelectNodes("//configuration/location/updateme"); Assert.AreEqual(1, nodes.Count); } [Test] public void SimpleInsertBefore() { XmlDocument targetDoc = ExecuteMerge(); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //inserted before node2 XmlNode node = targetDoc.SelectSingleNode("/configuration/updateme"); Assert.AreEqual("node2", node.NextSibling.Name); } [Test] public void InsertBeforeInLocation() { XmlDocument targetDoc = ExecuteMerge("SimpleInsertBefore"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/location/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //inserted before node2 XmlNode node = targetDoc.SelectSingleNode("/configuration/location/updateme"); Assert.AreEqual("node2", node.NextSibling.Name); } [Test] public void SimpleInsertAfter() { XmlDocument targetDoc = ExecuteMerge(); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //inserted before node2 XmlNode node = targetDoc.SelectSingleNode("/configuration/updateme"); Assert.AreEqual("node1", node.PreviousSibling.Name); } [Test] public void InsertAfterInLocation() { XmlDocument targetDoc = ExecuteMerge("SimpleInsertAfter"); //children are in correct location XmlNodeList nodes = targetDoc.SelectNodes("/configuration/location/updateme/children/child"); Assert.AreEqual(2, nodes.Count); //inserted before node2 XmlNode node = targetDoc.SelectSingleNode("/configuration/location/updateme"); Assert.AreEqual("node2", node.NextSibling.Name); } [Test] public void SimpleRemove() { XmlDocument targetDoc = ExecuteMerge(); //node is gone var nodes = targetDoc.SelectNodes("//removeme"); Assert.AreEqual(0, nodes.Count); //other nodes still present nodes = targetDoc.SelectNodes("/configuration/distraction"); Assert.AreEqual(1, nodes.Count); } [Test] public void RemoveFromLocation() { XmlDocument targetDoc = ExecuteMerge("SimpleRemove"); //node is gone var nodes = targetDoc.SelectNodes("//removeme"); Assert.AreEqual(0, nodes.Count); //other nodes still present nodes = targetDoc.SelectNodes("/configuration/distraction"); Assert.AreEqual(1, nodes.Count); } [Test] public void SimpleRemoveAttribute() { var targetDoc = ExecuteMerge(); var node = targetDoc.SelectSingleNode("/configuration/updateme"); Assert.AreEqual(0, node.Attributes.Count); } [Test] public void RemoveAttributeFromLocation() { var targetDoc = ExecuteMerge("SimpleRemoveAttribute"); var node = targetDoc.SelectSingleNode("/configuration/location/updateme"); Assert.AreEqual(0, node.Attributes.Count); } [Test] public void SimpleInsertAttribute() { var targetDoc = ExecuteMerge(); var node = targetDoc.SelectSingleNode("/configuration/updateme"); Assert.AreEqual(2, node.Attributes.Count); Assert.AreEqual("fee", node.Attributes["attrib2"].Value); } [Test] public void InsertAttributeInLocation() { var targetDoc = ExecuteMerge("SimpleInsertAttribute"); var node = targetDoc.SelectSingleNode("/configuration/location/updateme"); Assert.AreEqual(2, node.Attributes.Count); Assert.AreEqual("fee", node.Attributes["attrib2"].Value); } [Test] public void UpdateAttributeInLocation() { var targetDoc = ExecuteMerge("SimpleInsertAttribute"); var node = targetDoc.SelectSingleNode("/configuration/location/updateme"); Assert.AreEqual(2, node.Attributes.Count); Assert.AreEqual("fee", node.Attributes["attrib2"].Value); } [Test] public void SimpleUpdateWithKey() { var targetDoc = ExecuteMerge(); //a key was added var nodes = targetDoc.SelectNodes("/configuration/updateme/add"); Assert.AreEqual(1, nodes.Count); //test attribute is set var node = nodes[0]; Assert.AreEqual("foo", node.Attributes["test"].Value); } [Test] public void UpdateWithKeyInLocation() { var targetDoc = ExecuteMerge("SimpleUpdateWithKey"); //a key was added var nodes = targetDoc.SelectNodes("/configuration/location/updateme/add"); Assert.AreEqual(1, nodes.Count); //test attribute is set var node = nodes[0]; Assert.AreEqual("foo", node.Attributes["test"].Value); } // ReSharper restore PossibleNullReferenceException } class TestLogSource : ILoggerSource { public ILog GetLogger(string name) { return new TestLogger(); } public ILog GetLogger(Type type) { return new TestLogger(); } } class TestLogger : ILog { public void Debug(object message, Exception exception) { } public void Debug(object message) { } public void DebugFormat(IFormatProvider provider, string format, params object[] args) { } public void DebugFormat(string format, params object[] args) { } public void Error(object message, Exception exception) { } public void Error(object message) { } public void ErrorFormat(IFormatProvider provider, string format, params object[] args) { } public void ErrorFormat(string format, params object[] args) { } public void Fatal(object message, Exception exception) { } public void Fatal(object message) { } public void FatalFormat(IFormatProvider provider, string format, params object[] args) { } public void FatalFormat(string format, params object[] args) { } public void Info(object message, Exception exception) { } public void Info(object message) { } public void InfoFormat(IFormatProvider provider, string format, params object[] args) { } public void InfoFormat(string format, params object[] args) { } public bool IsDebugEnabled { get { return false; } } public bool IsErrorEnabled { get { return false; } } public bool IsFatalEnabled { get { return false; } } public bool IsInfoEnabled { get { return false; } } public bool IsTraceEnabled { get { return false; } } public bool IsWarnEnabled { get { return false; } } public void Trace(object message, Exception exception) { } public void Trace(object message) { } public void TraceFormat(IFormatProvider provider, string format, params object[] args) { } public void TraceFormat(string format, params object[] args) { } public void Warn(object message, Exception exception) { } public void Warn(object message) { } public void WarnFormat(IFormatProvider provider, string format, params object[] args) { } public void WarnFormat(string format, params object[] args) { } } }
30.948161
141
0.615335
[ "MIT" ]
51Degrees/Dnn.Platform
DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/XmlMergeTests.cs
18,510
C#
namespace ClassLib087 { public class Class093 { public static string Property => "ClassLib087"; } }
15
55
0.633333
[ "MIT" ]
333fred/performance
src/scenarios/weblarge2.0/src/ClassLib087/Class093.cs
120
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace IconifyXamarin.MaterialCommunity { public class MaterialCommunityIcons : IIcon { public const char mdi_account = '\uf101'; public const char mdi_account_alert = '\uf102'; public const char mdi_account_box = '\uf103'; public const char mdi_account_box_outline = '\uf104'; public const char mdi_account_check = '\uf105'; public const char mdi_account_circle = '\uf106'; public const char mdi_account_key = '\uf107'; public const char mdi_account_location = '\uf108'; public const char mdi_account_minus = '\uf109'; public const char mdi_account_multiple = '\uf10a'; public const char mdi_account_multiple_outline = '\uf10b'; public const char mdi_account_multiple_plus = '\uf10c'; public const char mdi_account_network = '\uf10d'; public const char mdi_account_outline = '\uf10e'; public const char mdi_account_plus = '\uf10f'; public const char mdi_account_remove = '\uf110'; public const char mdi_account_search = '\uf111'; public const char mdi_account_star = '\uf112'; public const char mdi_account_star_variant = '\uf113'; public const char mdi_account_switch = '\uf114'; public const char mdi_airballoon = '\uf115'; public const char mdi_airplane = '\uf116'; public const char mdi_airplane_off = '\uf117'; public const char mdi_alarm = '\uf118'; public const char mdi_alarm_check = '\uf119'; public const char mdi_alarm_multiple = '\uf11a'; public const char mdi_alarm_off = '\uf11b'; public const char mdi_alarm_plus = '\uf11c'; public const char mdi_album = '\uf11d'; public const char mdi_alert = '\uf11e'; public const char mdi_alert_box = '\uf11f'; public const char mdi_alert_circle = '\uf120'; public const char mdi_alert_octagon = '\uf121'; public const char mdi_alpha = '\uf122'; public const char mdi_alphabetical = '\uf123'; public const char mdi_amazon = '\uf124'; public const char mdi_amazon_clouddrive = '\uf125'; public const char mdi_ambulance = '\uf126'; public const char mdi_android = '\uf127'; public const char mdi_android_debug_bridge = '\uf128'; public const char mdi_android_studio = '\uf129'; public const char mdi_apple = '\uf12a'; public const char mdi_apple_finder = '\uf12b'; public const char mdi_apple_ios = '\uf12c'; public const char mdi_apple_mobileme = '\uf12d'; public const char mdi_apple_safari = '\uf12e'; public const char mdi_appnet = '\uf12f'; public const char mdi_apps = '\uf130'; public const char mdi_archive = '\uf131'; public const char mdi_arrange_bring_forward = '\uf132'; public const char mdi_arrange_bring_to_front = '\uf133'; public const char mdi_arrange_send_backward = '\uf134'; public const char mdi_arrange_send_to_back = '\uf135'; public const char mdi_arrow_all = '\uf136'; public const char mdi_arrow_bottom_left = '\uf137'; public const char mdi_arrow_bottom_right = '\uf138'; public const char mdi_arrow_collapse = '\uf139'; public const char mdi_arrow_down = '\uf13a'; public const char mdi_arrow_down_bold = '\uf13b'; public const char mdi_arrow_down_bold_circle = '\uf13c'; public const char mdi_arrow_down_bold_circle_outline = '\uf13d'; public const char mdi_arrow_down_bold_hexagon_outline = '\uf13e'; public const char mdi_arrow_expand = '\uf13f'; public const char mdi_arrow_left = '\uf140'; public const char mdi_arrow_left_bold = '\uf141'; public const char mdi_arrow_left_bold_circle = '\uf142'; public const char mdi_arrow_left_bold_circle_outline = '\uf143'; public const char mdi_arrow_left_bold_hexagon_outline = '\uf144'; public const char mdi_arrow_right = '\uf145'; public const char mdi_arrow_right_bold = '\uf146'; public const char mdi_arrow_right_bold_circle = '\uf147'; public const char mdi_arrow_right_bold_circle_outline = '\uf148'; public const char mdi_arrow_right_bold_hexagon_outline = '\uf149'; public const char mdi_arrow_top_left = '\uf14a'; public const char mdi_arrow_top_right = '\uf14b'; public const char mdi_arrow_up = '\uf14c'; public const char mdi_arrow_up_bold = '\uf14d'; public const char mdi_arrow_up_bold_circle = '\uf14e'; public const char mdi_arrow_up_bold_circle_outline = '\uf14f'; public const char mdi_arrow_up_bold_hexagon_outline = '\uf150'; public const char mdi_at = '\uf151'; public const char mdi_attachment = '\uf152'; public const char mdi_audiobook = '\uf153'; public const char mdi_auto_fix = '\uf154'; public const char mdi_auto_upload = '\uf155'; public const char mdi_baby = '\uf156'; public const char mdi_backburger = '\uf157'; public const char mdi_backup_restore = '\uf158'; public const char mdi_bank = '\uf159'; public const char mdi_barcode = '\uf15a'; public const char mdi_barley = '\uf15b'; public const char mdi_barrel = '\uf15c'; public const char mdi_basecamp = '\uf15d'; public const char mdi_basket = '\uf15e'; public const char mdi_basket_fill = '\uf15f'; public const char mdi_basket_unfill = '\uf160'; public const char mdi_battery = '\uf161'; public const char mdi_battery_10 = '\uf162'; public const char mdi_battery_20 = '\uf163'; public const char mdi_battery_30 = '\uf164'; public const char mdi_battery_40 = '\uf165'; public const char mdi_battery_50 = '\uf166'; public const char mdi_battery_60 = '\uf167'; public const char mdi_battery_70 = '\uf168'; public const char mdi_battery_80 = '\uf169'; public const char mdi_battery_90 = '\uf16a'; public const char mdi_battery_alert = '\uf16b'; public const char mdi_battery_charging_100 = '\uf16c'; public const char mdi_battery_charging_20 = '\uf16d'; public const char mdi_battery_charging_30 = '\uf16e'; public const char mdi_battery_charging_40 = '\uf16f'; public const char mdi_battery_charging_60 = '\uf170'; public const char mdi_battery_charging_80 = '\uf171'; public const char mdi_battery_charging_90 = '\uf172'; public const char mdi_battery_minus = '\uf173'; public const char mdi_battery_negative = '\uf174'; public const char mdi_battery_outline = '\uf175'; public const char mdi_battery_plus = '\uf176'; public const char mdi_battery_positive = '\uf177'; public const char mdi_battery_unknown = '\uf178'; public const char mdi_beach = '\uf179'; public const char mdi_beaker = '\uf17a'; public const char mdi_beaker_empty = '\uf17b'; public const char mdi_beaker_empty_outline = '\uf17c'; public const char mdi_beaker_outline = '\uf17d'; public const char mdi_beats = '\uf17e'; public const char mdi_beer = '\uf17f'; public const char mdi_behance = '\uf180'; public const char mdi_bell = '\uf181'; public const char mdi_bell_off = '\uf182'; public const char mdi_bell_outline = '\uf183'; public const char mdi_bell_ring = '\uf184'; public const char mdi_bell_ring_outline = '\uf185'; public const char mdi_bell_sleep = '\uf186'; public const char mdi_beta = '\uf187'; public const char mdi_bike = '\uf188'; public const char mdi_bing = '\uf189'; public const char mdi_binoculars = '\uf18a'; public const char mdi_bio = '\uf18b'; public const char mdi_biohazard = '\uf18c'; public const char mdi_bitbucket = '\uf18d'; public const char mdi_black_mesa = '\uf18e'; public const char mdi_blackberry = '\uf18f'; public const char mdi_blinds = '\uf190'; public const char mdi_block_helper = '\uf191'; public const char mdi_blogger = '\uf192'; public const char mdi_bluetooth = '\uf193'; public const char mdi_bluetooth_audio = '\uf194'; public const char mdi_bluetooth_connect = '\uf195'; public const char mdi_bluetooth_settings = '\uf196'; public const char mdi_bluetooth_transfer = '\uf197'; public const char mdi_blur = '\uf198'; public const char mdi_blur_linear = '\uf199'; public const char mdi_blur_off = '\uf19a'; public const char mdi_blur_radial = '\uf19b'; public const char mdi_bone = '\uf19c'; public const char mdi_book = '\uf19d'; public const char mdi_book_multiple = '\uf19e'; public const char mdi_book_multiple_variant = '\uf19f'; public const char mdi_book_open = '\uf1a0'; public const char mdi_book_variant = '\uf1a1'; public const char mdi_bookmark = '\uf1a2'; public const char mdi_bookmark_check = '\uf1a3'; public const char mdi_bookmark_music = '\uf1a4'; public const char mdi_bookmark_outline = '\uf1a5'; public const char mdi_bookmark_outline_plus = '\uf1a6'; public const char mdi_bookmark_plus = '\uf1a7'; public const char mdi_bookmark_remove = '\uf1a8'; public const char mdi_border_all = '\uf1a9'; public const char mdi_border_bottom = '\uf1aa'; public const char mdi_border_color = '\uf1ab'; public const char mdi_border_horizontal = '\uf1ac'; public const char mdi_border_inside = '\uf1ad'; public const char mdi_border_left = '\uf1ae'; public const char mdi_border_none = '\uf1af'; public const char mdi_border_outside = '\uf1b0'; public const char mdi_border_right = '\uf1b1'; public const char mdi_border_top = '\uf1b2'; public const char mdi_border_vertical = '\uf1b3'; public const char mdi_bowling = '\uf1b4'; public const char mdi_box = '\uf1b5'; public const char mdi_briefcase = '\uf1b6'; public const char mdi_briefcase_check = '\uf1b7'; public const char mdi_briefcase_download = '\uf1b8'; public const char mdi_briefcase_upload = '\uf1b9'; public const char mdi_brightness_1 = '\uf1ba'; public const char mdi_brightness_2 = '\uf1bb'; public const char mdi_brightness_3 = '\uf1bc'; public const char mdi_brightness_4 = '\uf1bd'; public const char mdi_brightness_5 = '\uf1be'; public const char mdi_brightness_6 = '\uf1bf'; public const char mdi_brightness_7 = '\uf1c0'; public const char mdi_brightness_auto = '\uf1c1'; public const char mdi_broom = '\uf1c2'; public const char mdi_brush = '\uf1c3'; public const char mdi_bug = '\uf1c4'; public const char mdi_bulletin_board = '\uf1c5'; public const char mdi_bullhorn = '\uf1c6'; public const char mdi_bus = '\uf1c7'; public const char mdi_cake = '\uf1c8'; public const char mdi_cake_variant = '\uf1c9'; public const char mdi_calculator = '\uf1ca'; public const char mdi_calendar = '\uf1cb'; public const char mdi_calendar_blank = '\uf1cc'; public const char mdi_calendar_check = '\uf1cd'; public const char mdi_calendar_clock = '\uf1ce'; public const char mdi_calendar_multiple = '\uf1cf'; public const char mdi_calendar_multiple_check = '\uf1d0'; public const char mdi_calendar_plus = '\uf1d1'; public const char mdi_calendar_remove = '\uf1d2'; public const char mdi_calendar_text = '\uf1d3'; public const char mdi_calendar_today = '\uf1d4'; public const char mdi_camcorder = '\uf1d5'; public const char mdi_camcorder_box = '\uf1d6'; public const char mdi_camcorder_box_off = '\uf1d7'; public const char mdi_camcorder_off = '\uf1d8'; public const char mdi_camera = '\uf1d9'; public const char mdi_camera_front = '\uf1da'; public const char mdi_camera_front_variant = '\uf1db'; public const char mdi_camera_iris = '\uf1dc'; public const char mdi_camera_party_mode = '\uf1dd'; public const char mdi_camera_rear = '\uf1de'; public const char mdi_camera_rear_variant = '\uf1df'; public const char mdi_camera_switch = '\uf1e0'; public const char mdi_camera_timer = '\uf1e1'; public const char mdi_candycane = '\uf1e2'; public const char mdi_car = '\uf1e3'; public const char mdi_car_wash = '\uf1e4'; public const char mdi_carrot = '\uf1e5'; public const char mdi_cart = '\uf1e6'; public const char mdi_cart_outline = '\uf1e7'; public const char mdi_cash = '\uf1e8'; public const char mdi_cash_100 = '\uf1e9'; public const char mdi_cash_multiple = '\uf1ea'; public const char mdi_cash_usd = '\uf1eb'; public const char mdi_cast = '\uf1ec'; public const char mdi_cast_connected = '\uf1ed'; public const char mdi_castle = '\uf1ee'; public const char mdi_cat = '\uf1ef'; public const char mdi_cellphone = '\uf1f0'; public const char mdi_cellphone_android = '\uf1f1'; public const char mdi_cellphone_dock = '\uf1f2'; public const char mdi_cellphone_iphone = '\uf1f3'; public const char mdi_cellphone_link = '\uf1f4'; public const char mdi_cellphone_link_off = '\uf1f5'; public const char mdi_cellphone_settings = '\uf1f6'; public const char mdi_chair_school = '\uf1f7'; public const char mdi_chart_arc = '\uf1f8'; public const char mdi_chart_areaspline = '\uf1f9'; public const char mdi_chart_bar = '\uf1fa'; public const char mdi_chart_histogram = '\uf1fb'; public const char mdi_chart_line = '\uf1fc'; public const char mdi_chart_pie = '\uf1fd'; public const char mdi_check = '\uf1fe'; public const char mdi_check_all = '\uf1ff'; public const char mdi_checkbox_blank = '\uf200'; public const char mdi_checkbox_blank_circle = '\uf201'; public const char mdi_checkbox_blank_circle_outline = '\uf202'; public const char mdi_checkbox_blank_outline = '\uf203'; public const char mdi_checkbox_marked = '\uf204'; public const char mdi_checkbox_marked_circle = '\uf205'; public const char mdi_checkbox_marked_circle_outline = '\uf206'; public const char mdi_checkbox_marked_outline = '\uf207'; public const char mdi_checkbox_multiple_blank = '\uf208'; public const char mdi_checkbox_multiple_blank_outline = '\uf209'; public const char mdi_checkbox_multiple_marked = '\uf20a'; public const char mdi_checkbox_multiple_marked_outline = '\uf20b'; public const char mdi_checkerboard = '\uf20c'; public const char mdi_chevron_double_down = '\uf20d'; public const char mdi_chevron_double_left = '\uf20e'; public const char mdi_chevron_double_right = '\uf20f'; public const char mdi_chevron_double_up = '\uf210'; public const char mdi_chevron_down = '\uf211'; public const char mdi_chevron_left = '\uf212'; public const char mdi_chevron_right = '\uf213'; public const char mdi_chevron_up = '\uf214'; public const char mdi_church = '\uf215'; public const char mdi_cisco_webex = '\uf216'; public const char mdi_city = '\uf217'; public const char mdi_clipboard = '\uf218'; public const char mdi_clipboard_account = '\uf219'; public const char mdi_clipboard_alert = '\uf21a'; public const char mdi_clipboard_arrow_down = '\uf21b'; public const char mdi_clipboard_arrow_left = '\uf21c'; public const char mdi_clipboard_check = '\uf21d'; public const char mdi_clipboard_outline = '\uf21e'; public const char mdi_clipboard_text = '\uf21f'; public const char mdi_clippy = '\uf220'; public const char mdi_clock = '\uf221'; public const char mdi_clock_fast = '\uf222'; public const char mdi_close = '\uf223'; public const char mdi_close_box = '\uf224'; public const char mdi_close_box_outline = '\uf225'; public const char mdi_close_circle = '\uf226'; public const char mdi_close_circle_outline = '\uf227'; public const char mdi_close_network = '\uf228'; public const char mdi_closed_caption = '\uf229'; public const char mdi_cloud = '\uf22a'; public const char mdi_cloud_check = '\uf22b'; public const char mdi_cloud_circle = '\uf22c'; public const char mdi_cloud_download = '\uf22d'; public const char mdi_cloud_outline = '\uf22e'; public const char mdi_cloud_outline_off = '\uf22f'; public const char mdi_cloud_upload = '\uf230'; public const char mdi_code_array = '\uf231'; public const char mdi_code_braces = '\uf232'; public const char mdi_code_equal = '\uf233'; public const char mdi_code_greater_than = '\uf234'; public const char mdi_code_less_than = '\uf235'; public const char mdi_code_less_than_or_equal = '\uf236'; public const char mdi_code_not_equal = '\uf237'; public const char mdi_code_not_equal_variant = '\uf238'; public const char mdi_code_string = '\uf239'; public const char mdi_code_tags = '\uf23a'; public const char mdi_codepen = '\uf23b'; public const char mdi_coffee = '\uf23c'; public const char mdi_coffee_to_go = '\uf23d'; public const char mdi_coin = '\uf23e'; public const char mdi_color_helper = '\uf23f'; public const char mdi_comment = '\uf240'; public const char mdi_comment_account = '\uf241'; public const char mdi_comment_account_outline = '\uf242'; public const char mdi_comment_alert = '\uf243'; public const char mdi_comment_alert_outline = '\uf244'; public const char mdi_comment_check = '\uf245'; public const char mdi_comment_check_outline = '\uf246'; public const char mdi_comment_multiple_outline = '\uf247'; public const char mdi_comment_outline = '\uf248'; public const char mdi_comment_plus_outline = '\uf249'; public const char mdi_comment_processing = '\uf24a'; public const char mdi_comment_processing_outline = '\uf24b'; public const char mdi_comment_remove_outline = '\uf24c'; public const char mdi_comment_text = '\uf24d'; public const char mdi_comment_text_outline = '\uf24e'; public const char mdi_compare = '\uf24f'; public const char mdi_compass = '\uf250'; public const char mdi_compass_outline = '\uf251'; public const char mdi_console = '\uf252'; public const char mdi_content_copy = '\uf253'; public const char mdi_content_cut = '\uf254'; public const char mdi_content_duplicate = '\uf255'; public const char mdi_content_paste = '\uf256'; public const char mdi_content_save = '\uf257'; public const char mdi_content_save_all = '\uf258'; public const char mdi_contrast = '\uf259'; public const char mdi_contrast_box = '\uf25a'; public const char mdi_contrast_circle = '\uf25b'; public const char mdi_cow = '\uf25c'; public const char mdi_credit_card = '\uf25d'; public const char mdi_credit_card_multiple = '\uf25e'; public const char mdi_crop = '\uf25f'; public const char mdi_crop_free = '\uf260'; public const char mdi_crop_landscape = '\uf261'; public const char mdi_crop_portrait = '\uf262'; public const char mdi_crop_square = '\uf263'; public const char mdi_crosshairs = '\uf264'; public const char mdi_crosshairs_gps = '\uf265'; public const char mdi_crown = '\uf266'; public const char mdi_cube = '\uf267'; public const char mdi_cube_outline = '\uf268'; public const char mdi_cube_unfolded = '\uf269'; public const char mdi_cup = '\uf26a'; public const char mdi_cup_water = '\uf26b'; public const char mdi_currency_btc = '\uf26c'; public const char mdi_currency_eur = '\uf26d'; public const char mdi_currency_gbp = '\uf26e'; public const char mdi_currency_inr = '\uf26f'; public const char mdi_currency_rub = '\uf270'; public const char mdi_currency_try = '\uf271'; public const char mdi_currency_usd = '\uf272'; public const char mdi_cursor_default = '\uf273'; public const char mdi_cursor_default_outline = '\uf274'; public const char mdi_cursor_move = '\uf275'; public const char mdi_cursor_pointer = '\uf276'; public const char mdi_database = '\uf277'; public const char mdi_database_minus = '\uf278'; public const char mdi_database_outline = '\uf279'; public const char mdi_database_plus = '\uf27a'; public const char mdi_debug_step_into = '\uf27b'; public const char mdi_debug_step_out = '\uf27c'; public const char mdi_debug_step_over = '\uf27d'; public const char mdi_decimal_decrease = '\uf27e'; public const char mdi_decimal_increase = '\uf27f'; public const char mdi_delete = '\uf280'; public const char mdi_delete_variant = '\uf281'; public const char mdi_deskphone = '\uf282'; public const char mdi_desktop_mac = '\uf283'; public const char mdi_desktop_tower = '\uf284'; public const char mdi_details = '\uf285'; public const char mdi_deviantart = '\uf286'; public const char mdi_diamond = '\uf287'; public const char mdi_dice = '\uf288'; public const char mdi_dice_1 = '\uf289'; public const char mdi_dice_2 = '\uf28a'; public const char mdi_dice_3 = '\uf28b'; public const char mdi_dice_4 = '\uf28c'; public const char mdi_dice_5 = '\uf28d'; public const char mdi_dice_6 = '\uf28e'; public const char mdi_directions = '\uf28f'; public const char mdi_disk_alert = '\uf290'; public const char mdi_disqus = '\uf291'; public const char mdi_disqus_outline = '\uf292'; public const char mdi_division = '\uf293'; public const char mdi_division_box = '\uf294'; public const char mdi_dns = '\uf295'; public const char mdi_domain = '\uf296'; public const char mdi_dots_horizontal = '\uf297'; public const char mdi_dots_vertical = '\uf298'; public const char mdi_download = '\uf299'; public const char mdi_drag = '\uf29a'; public const char mdi_drag_horizontal = '\uf29b'; public const char mdi_drag_vertical = '\uf29c'; public const char mdi_drawing = '\uf29d'; public const char mdi_drawing_box = '\uf29e'; public const char mdi_dribbble = '\uf29f'; public const char mdi_dribbble_box = '\uf2a0'; public const char mdi_drone = '\uf2a1'; public const char mdi_dropbox = '\uf2a2'; public const char mdi_drupal = '\uf2a3'; public const char mdi_duck = '\uf2a4'; public const char mdi_dumbbell = '\uf2a5'; public const char mdi_earth = '\uf2a6'; public const char mdi_earth_off = '\uf2a7'; public const char mdi_edge = '\uf2a8'; public const char mdi_eject = '\uf2a9'; public const char mdi_elevation_decline = '\uf2aa'; public const char mdi_elevation_rise = '\uf2ab'; public const char mdi_elevator = '\uf2ac'; public const char mdi_email = '\uf2ad'; public const char mdi_email_open = '\uf2ae'; public const char mdi_email_outline = '\uf2af'; public const char mdi_email_secure = '\uf2b0'; public const char mdi_emoticon = '\uf2b1'; public const char mdi_emoticon_cool = '\uf2b2'; public const char mdi_emoticon_devil = '\uf2b3'; public const char mdi_emoticon_happy = '\uf2b4'; public const char mdi_emoticon_neutral = '\uf2b5'; public const char mdi_emoticon_poop = '\uf2b6'; public const char mdi_emoticon_sad = '\uf2b7'; public const char mdi_emoticon_tongue = '\uf2b8'; public const char mdi_engine = '\uf2b9'; public const char mdi_engine_outline = '\uf2ba'; public const char mdi_equal = '\uf2bb'; public const char mdi_equal_box = '\uf2bc'; public const char mdi_eraser = '\uf2bd'; public const char mdi_escalator = '\uf2be'; public const char mdi_etsy = '\uf2bf'; public const char mdi_evernote = '\uf2c0'; public const char mdi_exclamation = '\uf2c1'; public const char mdi_exit_to_app = '\uf2c2'; public const char mdi_export = '\uf2c3'; public const char mdi_eye = '\uf2c4'; public const char mdi_eye_off = '\uf2c5'; public const char mdi_eyedropper = '\uf2c6'; public const char mdi_eyedropper_variant = '\uf2c7'; public const char mdi_facebook = '\uf2c8'; public const char mdi_facebook_box = '\uf2c9'; public const char mdi_facebook_messenger = '\uf2ca'; public const char mdi_factory = '\uf2cb'; public const char mdi_fan = '\uf2cc'; public const char mdi_fast_forward = '\uf2cd'; public const char mdi_ferry = '\uf2ce'; public const char mdi_file = '\uf2cf'; public const char mdi_file_cloud = '\uf2d0'; public const char mdi_file_delimited = '\uf2d1'; public const char mdi_file_document = '\uf2d2'; public const char mdi_file_document_box = '\uf2d3'; public const char mdi_file_excel = '\uf2d4'; public const char mdi_file_excel_box = '\uf2d5'; public const char mdi_file_find = '\uf2d6'; public const char mdi_file_image = '\uf2d7'; public const char mdi_file_image_box = '\uf2d8'; public const char mdi_file_multiple = '\uf2d9'; public const char mdi_file_music = '\uf2da'; public const char mdi_file_outline = '\uf2db'; public const char mdi_file_pdf = '\uf2dc'; public const char mdi_file_pdf_box = '\uf2dd'; public const char mdi_file_powerpoint = '\uf2de'; public const char mdi_file_powerpoint_box = '\uf2df'; public const char mdi_file_presentation_box = '\uf2e0'; public const char mdi_file_video = '\uf2e1'; public const char mdi_file_word = '\uf2e2'; public const char mdi_file_word_box = '\uf2e3'; public const char mdi_file_xml = '\uf2e4'; public const char mdi_film = '\uf2e5'; public const char mdi_filmstrip = '\uf2e6'; public const char mdi_filmstrip_off = '\uf2e7'; public const char mdi_filter = '\uf2e8'; public const char mdi_filter_outline = '\uf2e9'; public const char mdi_filter_remove = '\uf2ea'; public const char mdi_filter_remove_outline = '\uf2eb'; public const char mdi_filter_variant = '\uf2ec'; public const char mdi_fire = '\uf2ed'; public const char mdi_firefox = '\uf2ee'; public const char mdi_fish = '\uf2ef'; public const char mdi_flag = '\uf2f0'; public const char mdi_flag_checkered = '\uf2f1'; public const char mdi_flag_outline = '\uf2f2'; public const char mdi_flag_outline_variant = '\uf2f3'; public const char mdi_flag_triangle = '\uf2f4'; public const char mdi_flag_variant = '\uf2f5'; public const char mdi_flash = '\uf2f6'; public const char mdi_flash_auto = '\uf2f7'; public const char mdi_flash_off = '\uf2f8'; public const char mdi_flashlight = '\uf2f9'; public const char mdi_flashlight_off = '\uf2fa'; public const char mdi_flattr = '\uf2fb'; public const char mdi_flip_to_back = '\uf2fc'; public const char mdi_flip_to_front = '\uf2fd'; public const char mdi_floppy = '\uf2fe'; public const char mdi_flower = '\uf2ff'; public const char mdi_folder = '\uf300'; public const char mdi_folder_account = '\uf301'; public const char mdi_folder_download = '\uf302'; public const char mdi_folder_google_drive = '\uf303'; public const char mdi_folder_image = '\uf304'; public const char mdi_folder_lock = '\uf305'; public const char mdi_folder_lock_open = '\uf306'; public const char mdi_folder_move = '\uf307'; public const char mdi_folder_multiple = '\uf308'; public const char mdi_folder_multiple_image = '\uf309'; public const char mdi_folder_multiple_outline = '\uf30a'; public const char mdi_folder_outline = '\uf30b'; public const char mdi_folder_plus = '\uf30c'; public const char mdi_folder_remove = '\uf30d'; public const char mdi_folder_upload = '\uf30e'; public const char mdi_food = '\uf30f'; public const char mdi_food_apple = '\uf310'; public const char mdi_food_variant = '\uf311'; public const char mdi_football = '\uf312'; public const char mdi_football_helmet = '\uf313'; public const char mdi_format_align_center = '\uf314'; public const char mdi_format_align_justify = '\uf315'; public const char mdi_format_align_left = '\uf316'; public const char mdi_format_align_right = '\uf317'; public const char mdi_format_bold = '\uf318'; public const char mdi_format_clear = '\uf319'; public const char mdi_format_color_fill = '\uf31a'; public const char mdi_format_float_center = '\uf31b'; public const char mdi_format_float_left = '\uf31c'; public const char mdi_format_float_none = '\uf31d'; public const char mdi_format_float_right = '\uf31e'; public const char mdi_format_header_1 = '\uf31f'; public const char mdi_format_header_2 = '\uf320'; public const char mdi_format_header_3 = '\uf321'; public const char mdi_format_header_4 = '\uf322'; public const char mdi_format_header_5 = '\uf323'; public const char mdi_format_header_6 = '\uf324'; public const char mdi_format_header_decrease = '\uf325'; public const char mdi_format_header_equal = '\uf326'; public const char mdi_format_header_increase = '\uf327'; public const char mdi_format_header_pound = '\uf328'; public const char mdi_format_indent_decrease = '\uf329'; public const char mdi_format_indent_increase = '\uf32a'; public const char mdi_format_italic = '\uf32b'; public const char mdi_format_line_spacing = '\uf32c'; public const char mdi_format_list_bulleted = '\uf32d'; public const char mdi_format_list_numbers = '\uf32e'; public const char mdi_format_paint = '\uf32f'; public const char mdi_format_paragraph = '\uf330'; public const char mdi_format_quote = '\uf331'; public const char mdi_format_size = '\uf332'; public const char mdi_format_strikethrough = '\uf333'; public const char mdi_format_subscript = '\uf334'; public const char mdi_format_superscript = '\uf335'; public const char mdi_format_text = '\uf336'; public const char mdi_format_textdirection_l_to_r = '\uf337'; public const char mdi_format_textdirection_r_to_l = '\uf338'; public const char mdi_format_underline = '\uf339'; public const char mdi_format_wrap_inline = '\uf33a'; public const char mdi_format_wrap_square = '\uf33b'; public const char mdi_format_wrap_tight = '\uf33c'; public const char mdi_format_wrap_top_bottom = '\uf33d'; public const char mdi_forum = '\uf33e'; public const char mdi_forward = '\uf33f'; public const char mdi_foursquare = '\uf340'; public const char mdi_fridge = '\uf341'; public const char mdi_fullscreen = '\uf342'; public const char mdi_fullscreen_exit = '\uf343'; public const char mdi_function = '\uf344'; public const char mdi_gamepad = '\uf345'; public const char mdi_gamepad_variant = '\uf346'; public const char mdi_gas_station = '\uf347'; public const char mdi_gavel = '\uf348'; public const char mdi_gender_female = '\uf349'; public const char mdi_gender_male = '\uf34a'; public const char mdi_gender_male_female = '\uf34b'; public const char mdi_gender_transgender = '\uf34c'; public const char mdi_gift = '\uf34d'; public const char mdi_git = '\uf34e'; public const char mdi_github_box = '\uf34f'; public const char mdi_github_circle = '\uf350'; public const char mdi_glass_flute = '\uf351'; public const char mdi_glass_mug = '\uf352'; public const char mdi_glass_stange = '\uf353'; public const char mdi_glass_tulip = '\uf354'; public const char mdi_glasses = '\uf355'; public const char mdi_gmail = '\uf356'; public const char mdi_google = '\uf357'; public const char mdi_google_chrome = '\uf358'; public const char mdi_google_circles = '\uf359'; public const char mdi_google_circles_communities = '\uf35a'; public const char mdi_google_circles_extended = '\uf35b'; public const char mdi_google_circles_group = '\uf35c'; public const char mdi_google_controller = '\uf35d'; public const char mdi_google_controller_off = '\uf35e'; public const char mdi_google_drive = '\uf35f'; public const char mdi_google_earth = '\uf360'; public const char mdi_google_glass = '\uf361'; public const char mdi_google_maps = '\uf362'; public const char mdi_google_pages = '\uf363'; public const char mdi_google_play = '\uf364'; public const char mdi_google_plus = '\uf365'; public const char mdi_google_plus_box = '\uf366'; public const char mdi_grid = '\uf367'; public const char mdi_grid_off = '\uf368'; public const char mdi_group = '\uf369'; public const char mdi_guitar = '\uf36a'; public const char mdi_guitar_pick = '\uf36b'; public const char mdi_guitar_pick_outline = '\uf36c'; public const char mdi_hand_pointing_right = '\uf36d'; public const char mdi_hanger = '\uf36e'; public const char mdi_hangouts = '\uf36f'; public const char mdi_harddisk = '\uf370'; public const char mdi_headphones = '\uf371'; public const char mdi_headphones_box = '\uf372'; public const char mdi_headphones_settings = '\uf373'; public const char mdi_headset = '\uf374'; public const char mdi_headset_dock = '\uf375'; public const char mdi_headset_off = '\uf376'; public const char mdi_heart = '\uf377'; public const char mdi_heart_box = '\uf378'; public const char mdi_heart_box_outline = '\uf379'; public const char mdi_heart_broken = '\uf37a'; public const char mdi_heart_outline = '\uf37b'; public const char mdi_help = '\uf37c'; public const char mdi_help_circle = '\uf37d'; public const char mdi_hexagon = '\uf37e'; public const char mdi_hexagon_outline = '\uf37f'; public const char mdi_history = '\uf380'; public const char mdi_hololens = '\uf381'; public const char mdi_home = '\uf382'; public const char mdi_home_modern = '\uf383'; public const char mdi_home_variant = '\uf384'; public const char mdi_hops = '\uf385'; public const char mdi_hospital = '\uf386'; public const char mdi_hospital_building = '\uf387'; public const char mdi_hospital_marker = '\uf388'; public const char mdi_hotel = '\uf389'; public const char mdi_houzz = '\uf38a'; public const char mdi_houzz_box = '\uf38b'; public const char mdi_human = '\uf38c'; public const char mdi_human_child = '\uf38d'; public const char mdi_human_male_female = '\uf38e'; public const char mdi_image_album = '\uf38f'; public const char mdi_image_area = '\uf390'; public const char mdi_image_area_close = '\uf391'; public const char mdi_image_broken = '\uf392'; public const char mdi_image_filter = '\uf393'; public const char mdi_image_filter_black_white = '\uf394'; public const char mdi_image_filter_center_focus = '\uf395'; public const char mdi_image_filter_drama = '\uf396'; public const char mdi_image_filter_frames = '\uf397'; public const char mdi_image_filter_hdr = '\uf398'; public const char mdi_image_filter_none = '\uf399'; public const char mdi_image_filter_tilt_shift = '\uf39a'; public const char mdi_image_filter_vintage = '\uf39b'; public const char mdi_import = '\uf39c'; public const char mdi_inbox = '\uf39d'; public const char mdi_information = '\uf39e'; public const char mdi_information_outline = '\uf39f'; public const char mdi_instagram = '\uf3a0'; public const char mdi_instapaper = '\uf3a1'; public const char mdi_internet_explorer = '\uf3a2'; public const char mdi_invert_colors = '\uf3a3'; public const char mdi_jira = '\uf3a4'; public const char mdi_jsfiddle = '\uf3a5'; public const char mdi_keg = '\uf3a6'; public const char mdi_key = '\uf3a7'; public const char mdi_key_change = '\uf3a8'; public const char mdi_key_minus = '\uf3a9'; public const char mdi_key_plus = '\uf3aa'; public const char mdi_key_remove = '\uf3ab'; public const char mdi_key_variant = '\uf3ac'; public const char mdi_keyboard = '\uf3ad'; public const char mdi_keyboard_backspace = '\uf3ae'; public const char mdi_keyboard_caps = '\uf3af'; public const char mdi_keyboard_close = '\uf3b0'; public const char mdi_keyboard_off = '\uf3b1'; public const char mdi_keyboard_return = '\uf3b2'; public const char mdi_keyboard_tab = '\uf3b3'; public const char mdi_keyboard_variant = '\uf3b4'; public const char mdi_label = '\uf3b5'; public const char mdi_label_outline = '\uf3b6'; public const char mdi_language_csharp = '\uf3b7'; public const char mdi_language_css3 = '\uf3b8'; public const char mdi_language_html5 = '\uf3b9'; public const char mdi_language_javascript = '\uf3ba'; public const char mdi_language_python = '\uf3bb'; public const char mdi_language_python_text = '\uf3bc'; public const char mdi_laptop = '\uf3bd'; public const char mdi_laptop_chromebook = '\uf3be'; public const char mdi_laptop_mac = '\uf3bf'; public const char mdi_laptop_windows = '\uf3c0'; public const char mdi_lastfm = '\uf3c1'; public const char mdi_launch = '\uf3c2'; public const char mdi_layers = '\uf3c3'; public const char mdi_layers_off = '\uf3c4'; public const char mdi_leaf = '\uf3c5'; public const char mdi_library = '\uf3c6'; public const char mdi_library_books = '\uf3c7'; public const char mdi_library_music = '\uf3c8'; public const char mdi_library_plus = '\uf3c9'; public const char mdi_lightbulb = '\uf3ca'; public const char mdi_lightbulb_outline = '\uf3cb'; public const char mdi_link = '\uf3cc'; public const char mdi_link_off = '\uf3cd'; public const char mdi_link_variant = '\uf3ce'; public const char mdi_link_variant_off = '\uf3cf'; public const char mdi_linkedin = '\uf3d0'; public const char mdi_linkedin_box = '\uf3d1'; public const char mdi_linux = '\uf3d2'; public const char mdi_lock = '\uf3d3'; public const char mdi_lock_open = '\uf3d4'; public const char mdi_lock_open_outline = '\uf3d5'; public const char mdi_lock_outline = '\uf3d6'; public const char mdi_login = '\uf3d7'; public const char mdi_logout = '\uf3d8'; public const char mdi_looks = '\uf3d9'; public const char mdi_loupe = '\uf3da'; public const char mdi_lumx = '\uf3db'; public const char mdi_magnet = '\uf3dc'; public const char mdi_magnet_on = '\uf3dd'; public const char mdi_magnify = '\uf3de'; public const char mdi_magnify_minus = '\uf3df'; public const char mdi_magnify_plus = '\uf3e0'; public const char mdi_mail_ru = '\uf3e1'; public const char mdi_map = '\uf3e2'; public const char mdi_map_marker = '\uf3e3'; public const char mdi_map_marker_circle = '\uf3e4'; public const char mdi_map_marker_multiple = '\uf3e5'; public const char mdi_map_marker_off = '\uf3e6'; public const char mdi_map_marker_radius = '\uf3e7'; public const char mdi_margin = '\uf3e8'; public const char mdi_markdown = '\uf3e9'; public const char mdi_marker_check = '\uf3ea'; public const char mdi_martini = '\uf3eb'; public const char mdi_material_ui = '\uf3ec'; public const char mdi_math_compass = '\uf3ed'; public const char mdi_maxcdn = '\uf3ee'; public const char mdi_medium = '\uf3ef'; public const char mdi_memory = '\uf3f0'; public const char mdi_menu = '\uf3f1'; public const char mdi_menu_down = '\uf3f2'; public const char mdi_menu_left = '\uf3f3'; public const char mdi_menu_right = '\uf3f4'; public const char mdi_menu_up = '\uf3f5'; public const char mdi_message = '\uf3f6'; public const char mdi_message_alert = '\uf3f7'; public const char mdi_message_draw = '\uf3f8'; public const char mdi_message_image = '\uf3f9'; public const char mdi_message_processing = '\uf3fa'; public const char mdi_message_reply = '\uf3fb'; public const char mdi_message_text = '\uf3fc'; public const char mdi_message_text_outline = '\uf3fd'; public const char mdi_message_video = '\uf3fe'; public const char mdi_microphone = '\uf3ff'; public const char mdi_microphone_off = '\uf400'; public const char mdi_microphone_outline = '\uf401'; public const char mdi_microphone_settings = '\uf402'; public const char mdi_microphone_variant = '\uf403'; public const char mdi_microphone_variant_off = '\uf404'; public const char mdi_minus = '\uf405'; public const char mdi_minus_box = '\uf406'; public const char mdi_minus_circle = '\uf407'; public const char mdi_minus_circle_outline = '\uf408'; public const char mdi_minus_network = '\uf409'; public const char mdi_monitor = '\uf40a'; public const char mdi_monitor_multiple = '\uf40b'; public const char mdi_more = '\uf40c'; public const char mdi_motorbike = '\uf40d'; public const char mdi_mouse = '\uf40e'; public const char mdi_mouse_off = '\uf40f'; public const char mdi_mouse_variant = '\uf410'; public const char mdi_mouse_variant_off = '\uf411'; public const char mdi_movie = '\uf412'; public const char mdi_multiplication = '\uf413'; public const char mdi_multiplication_box = '\uf414'; public const char mdi_music_box = '\uf415'; public const char mdi_music_box_outline = '\uf416'; public const char mdi_music_circle = '\uf417'; public const char mdi_music_note = '\uf418'; public const char mdi_music_note_eighth = '\uf419'; public const char mdi_music_note_half = '\uf41a'; public const char mdi_music_note_off = '\uf41b'; public const char mdi_music_note_quarter = '\uf41c'; public const char mdi_music_note_sixteenth = '\uf41d'; public const char mdi_music_note_whole = '\uf41e'; public const char mdi_nature = '\uf41f'; public const char mdi_nature_people = '\uf420'; public const char mdi_navigation = '\uf421'; public const char mdi_needle = '\uf422'; public const char mdi_nest_protect = '\uf423'; public const char mdi_nest_thermostat = '\uf424'; public const char mdi_newspaper = '\uf425'; public const char mdi_nfc = '\uf426'; public const char mdi_nfc_tap = '\uf427'; public const char mdi_nfc_variant = '\uf428'; public const char mdi_note = '\uf429'; public const char mdi_note_outline = '\uf42a'; public const char mdi_note_text = '\uf42b'; public const char mdi_numeric = '\uf42c'; public const char mdi_numeric_0_box = '\uf42d'; public const char mdi_numeric_0_box_multiple_outline = '\uf42e'; public const char mdi_numeric_0_box_outline = '\uf42f'; public const char mdi_numeric_1_box = '\uf430'; public const char mdi_numeric_1_box_multiple_outline = '\uf431'; public const char mdi_numeric_1_box_outline = '\uf432'; public const char mdi_numeric_2_box = '\uf433'; public const char mdi_numeric_2_box_multiple_outline = '\uf434'; public const char mdi_numeric_2_box_outline = '\uf435'; public const char mdi_numeric_3_box = '\uf436'; public const char mdi_numeric_3_box_multiple_outline = '\uf437'; public const char mdi_numeric_3_box_outline = '\uf438'; public const char mdi_numeric_4_box = '\uf439'; public const char mdi_numeric_4_box_multiple_outline = '\uf43a'; public const char mdi_numeric_4_box_outline = '\uf43b'; public const char mdi_numeric_5_box = '\uf43c'; public const char mdi_numeric_5_box_multiple_outline = '\uf43d'; public const char mdi_numeric_5_box_outline = '\uf43e'; public const char mdi_numeric_6_box = '\uf43f'; public const char mdi_numeric_6_box_multiple_outline = '\uf440'; public const char mdi_numeric_6_box_outline = '\uf441'; public const char mdi_numeric_7_box = '\uf442'; public const char mdi_numeric_7_box_multiple_outline = '\uf443'; public const char mdi_numeric_7_box_outline = '\uf444'; public const char mdi_numeric_8_box = '\uf445'; public const char mdi_numeric_8_box_multiple_outline = '\uf446'; public const char mdi_numeric_8_box_outline = '\uf447'; public const char mdi_numeric_9_box = '\uf448'; public const char mdi_numeric_9_box_multiple_outline = '\uf449'; public const char mdi_numeric_9_box_outline = '\uf44a'; public const char mdi_numeric_9_plus_box = '\uf44b'; public const char mdi_numeric_9_plus_box_multiple_outline = '\uf44c'; public const char mdi_numeric_9_plus_box_outline = '\uf44d'; public const char mdi_nutriton = '\uf44e'; public const char mdi_odnoklassniki = '\uf44f'; public const char mdi_office = '\uf450'; public const char mdi_oil = '\uf451'; public const char mdi_omega = '\uf452'; public const char mdi_onedrive = '\uf453'; public const char mdi_open_in_app = '\uf454'; public const char mdi_open_in_new = '\uf455'; public const char mdi_ornament = '\uf456'; public const char mdi_ornament_variant = '\uf457'; public const char mdi_outbox = '\uf458'; public const char mdi_owl = '\uf459'; public const char mdi_package = '\uf45a'; public const char mdi_package_down = '\uf45b'; public const char mdi_package_up = '\uf45c'; public const char mdi_package_variant = '\uf45d'; public const char mdi_package_variant_closed = '\uf45e'; public const char mdi_palette = '\uf45f'; public const char mdi_palette_advanced = '\uf460'; public const char mdi_panda = '\uf461'; public const char mdi_pandora = '\uf462'; public const char mdi_panorama = '\uf463'; public const char mdi_panorama_fisheye = '\uf464'; public const char mdi_panorama_horizontal = '\uf465'; public const char mdi_panorama_vertical = '\uf466'; public const char mdi_panorama_wide_angle = '\uf467'; public const char mdi_paper_cut_vertical = '\uf468'; public const char mdi_paperclip = '\uf469'; public const char mdi_parking = '\uf46a'; public const char mdi_pause = '\uf46b'; public const char mdi_pause_circle = '\uf46c'; public const char mdi_pause_circle_outline = '\uf46d'; public const char mdi_pause_octagon = '\uf46e'; public const char mdi_pause_octagon_outline = '\uf46f'; public const char mdi_paw = '\uf470'; public const char mdi_pen = '\uf471'; public const char mdi_pencil = '\uf472'; public const char mdi_pencil_box = '\uf473'; public const char mdi_pencil_box_outline = '\uf474'; public const char mdi_percent = '\uf475'; public const char mdi_pharmacy = '\uf476'; public const char mdi_phone = '\uf477'; public const char mdi_phone_bluetooth = '\uf478'; public const char mdi_phone_forward = '\uf479'; public const char mdi_phone_hangup = '\uf47a'; public const char mdi_phone_in_talk = '\uf47b'; public const char mdi_phone_incoming = '\uf47c'; public const char mdi_phone_locked = '\uf47d'; public const char mdi_phone_log = '\uf47e'; public const char mdi_phone_missed = '\uf47f'; public const char mdi_phone_outgoing = '\uf480'; public const char mdi_phone_paused = '\uf481'; public const char mdi_phone_settings = '\uf482'; public const char mdi_pig = '\uf483'; public const char mdi_pill = '\uf484'; public const char mdi_pin = '\uf485'; public const char mdi_pin_off = '\uf486'; public const char mdi_pine_tree = '\uf487'; public const char mdi_pine_tree_box = '\uf488'; public const char mdi_pinterest = '\uf489'; public const char mdi_pinterest_box = '\uf48a'; public const char mdi_pizza = '\uf48b'; public const char mdi_play = '\uf48c'; public const char mdi_play_box_outline = '\uf48d'; public const char mdi_play_circle = '\uf48e'; public const char mdi_play_circle_outline = '\uf48f'; public const char mdi_playlist_minus = '\uf490'; public const char mdi_playlist_plus = '\uf491'; public const char mdi_playstation = '\uf492'; public const char mdi_plus = '\uf493'; public const char mdi_plus_box = '\uf494'; public const char mdi_plus_circle = '\uf495'; public const char mdi_plus_circle_outline = '\uf496'; public const char mdi_plus_network = '\uf497'; public const char mdi_plus_one = '\uf498'; public const char mdi_pocket = '\uf499'; public const char mdi_poll = '\uf49a'; public const char mdi_poll_box = '\uf49b'; public const char mdi_polymer = '\uf49c'; public const char mdi_popcorn = '\uf49d'; public const char mdi_pound = '\uf49e'; public const char mdi_pound_box = '\uf49f'; public const char mdi_power = '\uf4a0'; public const char mdi_power_settings = '\uf4a1'; public const char mdi_power_socket = '\uf4a2'; public const char mdi_presentation = '\uf4a3'; public const char mdi_presentation_play = '\uf4a4'; public const char mdi_printer = '\uf4a5'; public const char mdi_printer_3d = '\uf4a6'; public const char mdi_pulse = '\uf4a7'; public const char mdi_puzzle = '\uf4a8'; public const char mdi_qrcode = '\uf4a9'; public const char mdi_quadcopter = '\uf4aa'; public const char mdi_quality_high = '\uf4ab'; public const char mdi_quicktime = '\uf4ac'; public const char mdi_radiator = '\uf4ad'; public const char mdi_radio = '\uf4ae'; public const char mdi_radio_tower = '\uf4af'; public const char mdi_radioactive = '\uf4b0'; public const char mdi_radiobox_blank = '\uf4b1'; public const char mdi_radiobox_marked = '\uf4b2'; public const char mdi_raspberrypi = '\uf4b3'; public const char mdi_rdio = '\uf4b4'; public const char mdi_read = '\uf4b5'; public const char mdi_readability = '\uf4b6'; public const char mdi_receipt = '\uf4b7'; public const char mdi_recycle = '\uf4b8'; public const char mdi_redo = '\uf4b9'; public const char mdi_redo_variant = '\uf4ba'; public const char mdi_refresh = '\uf4bb'; public const char mdi_relative_scale = '\uf4bc'; public const char mdi_reload = '\uf4bd'; public const char mdi_remote = '\uf4be'; public const char mdi_rename_box = '\uf4bf'; public const char mdi_repeat = '\uf4c0'; public const char mdi_repeat_off = '\uf4c1'; public const char mdi_repeat_once = '\uf4c2'; public const char mdi_replay = '\uf4c3'; public const char mdi_reply = '\uf4c4'; public const char mdi_reply_all = '\uf4c5'; public const char mdi_reproduction = '\uf4c6'; public const char mdi_resize_bottom_right = '\uf4c7'; public const char mdi_responsive = '\uf4c8'; public const char mdi_rewind = '\uf4c9'; public const char mdi_ribbon = '\uf4ca'; public const char mdi_road = '\uf4cb'; public const char mdi_rocket = '\uf4cc'; public const char mdi_rotate_3d = '\uf4cd'; public const char mdi_rotate_left = '\uf4ce'; public const char mdi_rotate_left_variant = '\uf4cf'; public const char mdi_rotate_right = '\uf4d0'; public const char mdi_rotate_right_variant = '\uf4d1'; public const char mdi_routes = '\uf4d2'; public const char mdi_rss = '\uf4d3'; public const char mdi_rss_box = '\uf4d4'; public const char mdi_ruler = '\uf4d5'; public const char mdi_run = '\uf4d6'; public const char mdi_sale = '\uf4d7'; public const char mdi_satellite = '\uf4d8'; public const char mdi_satellite_variant = '\uf4d9'; public const char mdi_scale = '\uf4da'; public const char mdi_scale_bathroom = '\uf4db'; public const char mdi_school = '\uf4dc'; public const char mdi_screen_rotation = '\uf4dd'; public const char mdi_screen_rotation_lock = '\uf4de'; public const char mdi_script = '\uf4df'; public const char mdi_sd = '\uf4e0'; public const char mdi_security = '\uf4e1'; public const char mdi_security_network = '\uf4e2'; public const char mdi_select = '\uf4e3'; public const char mdi_select_all = '\uf4e4'; public const char mdi_select_inverse = '\uf4e5'; public const char mdi_select_off = '\uf4e6'; public const char mdi_send = '\uf4e7'; public const char mdi_server = '\uf4e8'; public const char mdi_server_minus = '\uf4e9'; public const char mdi_server_network = '\uf4ea'; public const char mdi_server_network_off = '\uf4eb'; public const char mdi_server_off = '\uf4ec'; public const char mdi_server_plus = '\uf4ed'; public const char mdi_server_remove = '\uf4ee'; public const char mdi_server_security = '\uf4ef'; public const char mdi_settings = '\uf4f0'; public const char mdi_settings_box = '\uf4f1'; public const char mdi_shape_plus = '\uf4f2'; public const char mdi_share = '\uf4f3'; public const char mdi_share_variant = '\uf4f4'; public const char mdi_shield = '\uf4f5'; public const char mdi_shield_outline = '\uf4f6'; public const char mdi_shopping = '\uf4f7'; public const char mdi_shopping_music = '\uf4f8'; public const char mdi_shuffle = '\uf4f9'; public const char mdi_sigma = '\uf4fa'; public const char mdi_sign_caution = '\uf4fb'; public const char mdi_signal = '\uf4fc'; public const char mdi_silverware = '\uf4fd'; public const char mdi_silverware_fork = '\uf4fe'; public const char mdi_silverware_spoon = '\uf4ff'; public const char mdi_silverware_variant = '\uf500'; public const char mdi_sim_alert = '\uf501'; public const char mdi_sitemap = '\uf502'; public const char mdi_skip_next = '\uf503'; public const char mdi_skip_previous = '\uf504'; public const char mdi_skype = '\uf505'; public const char mdi_skype_business = '\uf506'; public const char mdi_sleep = '\uf507'; public const char mdi_sleep_off = '\uf508'; public const char mdi_smoking = '\uf509'; public const char mdi_smoking_off = '\uf50a'; public const char mdi_snapchat = '\uf50b'; public const char mdi_snowman = '\uf50c'; public const char mdi_sofa = '\uf50d'; public const char mdi_sort = '\uf50e'; public const char mdi_sort_alphabetical = '\uf50f'; public const char mdi_sort_ascending = '\uf510'; public const char mdi_sort_descending = '\uf511'; public const char mdi_sort_numeric = '\uf512'; public const char mdi_sort_variant = '\uf513'; public const char mdi_soundcloud = '\uf514'; public const char mdi_source_fork = '\uf515'; public const char mdi_source_pull = '\uf516'; public const char mdi_speaker = '\uf517'; public const char mdi_speaker_off = '\uf518'; public const char mdi_speedometer = '\uf519'; public const char mdi_spellcheck = '\uf51a'; public const char mdi_spotify = '\uf51b'; public const char mdi_spotlight = '\uf51c'; public const char mdi_spotlight_beam = '\uf51d'; public const char mdi_square_inc = '\uf51e'; public const char mdi_square_inc_cash = '\uf51f'; public const char mdi_stackoverflow = '\uf520'; public const char mdi_star = '\uf521'; public const char mdi_star_circle = '\uf522'; public const char mdi_star_half = '\uf523'; public const char mdi_star_outline = '\uf524'; public const char mdi_steam = '\uf525'; public const char mdi_stethoscope = '\uf526'; public const char mdi_stocking = '\uf527'; public const char mdi_stop = '\uf528'; public const char mdi_store = '\uf529'; public const char mdi_store_24_hour = '\uf52a'; public const char mdi_stove = '\uf52b'; public const char mdi_subway = '\uf52c'; public const char mdi_sunglasses = '\uf52d'; public const char mdi_swap_horizontal = '\uf52e'; public const char mdi_swap_vertical = '\uf52f'; public const char mdi_swim = '\uf530'; public const char mdi_sword = '\uf531'; public const char mdi_sync = '\uf532'; public const char mdi_sync_alert = '\uf533'; public const char mdi_sync_off = '\uf534'; public const char mdi_tab = '\uf535'; public const char mdi_tab_unselected = '\uf536'; public const char mdi_table = '\uf537'; public const char mdi_table_column_plus_after = '\uf538'; public const char mdi_table_column_plus_before = '\uf539'; public const char mdi_table_column_remove = '\uf53a'; public const char mdi_table_column_width = '\uf53b'; public const char mdi_table_edit = '\uf53c'; public const char mdi_table_large = '\uf53d'; public const char mdi_table_row_height = '\uf53e'; public const char mdi_table_row_plus_after = '\uf53f'; public const char mdi_table_row_plus_before = '\uf540'; public const char mdi_table_row_remove = '\uf541'; public const char mdi_tablet = '\uf542'; public const char mdi_tablet_android = '\uf543'; public const char mdi_tablet_ipad = '\uf544'; public const char mdi_tag = '\uf545'; public const char mdi_tag_faces = '\uf546'; public const char mdi_tag_multiple = '\uf547'; public const char mdi_tag_outline = '\uf548'; public const char mdi_tag_text_outline = '\uf549'; public const char mdi_taxi = '\uf54a'; public const char mdi_teamviewer = '\uf54b'; public const char mdi_telegram = '\uf54c'; public const char mdi_television = '\uf54d'; public const char mdi_television_guide = '\uf54e'; public const char mdi_temperature_celsius = '\uf54f'; public const char mdi_temperature_fahrenheit = '\uf550'; public const char mdi_temperature_kelvin = '\uf551'; public const char mdi_tennis = '\uf552'; public const char mdi_tent = '\uf553'; public const char mdi_terrain = '\uf554'; public const char mdi_text_to_speech = '\uf555'; public const char mdi_text_to_speech_off = '\uf556'; public const char mdi_texture = '\uf557'; public const char mdi_theater = '\uf558'; public const char mdi_theme_light_dark = '\uf559'; public const char mdi_thermometer = '\uf55a'; public const char mdi_thermometer_lines = '\uf55b'; public const char mdi_thumb_down = '\uf55c'; public const char mdi_thumb_down_outline = '\uf55d'; public const char mdi_thumb_up = '\uf55e'; public const char mdi_thumb_up_outline = '\uf55f'; public const char mdi_thumbs_up_down = '\uf560'; public const char mdi_ticket = '\uf561'; public const char mdi_ticket_account = '\uf562'; public const char mdi_tie = '\uf563'; public const char mdi_timelapse = '\uf564'; public const char mdi_timer = '\uf565'; public const char mdi_timer_10 = '\uf566'; public const char mdi_timer_3 = '\uf567'; public const char mdi_timer_off = '\uf568'; public const char mdi_timer_sand = '\uf569'; public const char mdi_timetable = '\uf56a'; public const char mdi_toggle_switch = '\uf56b'; public const char mdi_toggle_switch_off = '\uf56c'; public const char mdi_tooltip = '\uf56d'; public const char mdi_tooltip_edit = '\uf56e'; public const char mdi_tooltip_image = '\uf56f'; public const char mdi_tooltip_outline = '\uf570'; public const char mdi_tooltip_outline_plus = '\uf571'; public const char mdi_tooltip_text = '\uf572'; public const char mdi_tor = '\uf573'; public const char mdi_traffic_light = '\uf574'; public const char mdi_train = '\uf575'; public const char mdi_tram = '\uf576'; public const char mdi_transcribe = '\uf577'; public const char mdi_transcribe_close = '\uf578'; public const char mdi_transfer = '\uf579'; public const char mdi_tree = '\uf57a'; public const char mdi_trello = '\uf57b'; public const char mdi_trending_down = '\uf57c'; public const char mdi_trending_neutral = '\uf57d'; public const char mdi_trending_up = '\uf57e'; public const char mdi_trophy = '\uf57f'; public const char mdi_trophy_award = '\uf580'; public const char mdi_trophy_variant = '\uf581'; public const char mdi_truck = '\uf582'; public const char mdi_tshirt_crew = '\uf583'; public const char mdi_tshirt_v = '\uf584'; public const char mdi_tumblr = '\uf585'; public const char mdi_tumblr_reblog = '\uf586'; public const char mdi_twitch = '\uf587'; public const char mdi_twitter = '\uf588'; public const char mdi_twitter_box = '\uf589'; public const char mdi_twitter_circle = '\uf58a'; public const char mdi_twitter_retweet = '\uf58b'; public const char mdi_ubuntu = '\uf58c'; public const char mdi_umbrella = '\uf58d'; public const char mdi_umbrella_outline = '\uf58e'; public const char mdi_undo = '\uf58f'; public const char mdi_undo_variant = '\uf590'; public const char mdi_unfold_less = '\uf591'; public const char mdi_unfold_more = '\uf592'; public const char mdi_ungroup = '\uf593'; public const char mdi_untappd = '\uf594'; public const char mdi_upload = '\uf595'; public const char mdi_usb = '\uf596'; public const char mdi_vector_curve = '\uf597'; public const char mdi_vector_point = '\uf598'; public const char mdi_vector_square = '\uf599'; public const char mdi_verified = '\uf59a'; public const char mdi_vibrate = '\uf59b'; public const char mdi_video = '\uf59c'; public const char mdi_video_off = '\uf59d'; public const char mdi_video_switch = '\uf59e'; public const char mdi_view_agenda = '\uf59f'; public const char mdi_view_array = '\uf5a0'; public const char mdi_view_carousel = '\uf5a1'; public const char mdi_view_column = '\uf5a2'; public const char mdi_view_dashboard = '\uf5a3'; public const char mdi_view_day = '\uf5a4'; public const char mdi_view_grid = '\uf5a5'; public const char mdi_view_headline = '\uf5a6'; public const char mdi_view_list = '\uf5a7'; public const char mdi_view_module = '\uf5a8'; public const char mdi_view_quilt = '\uf5a9'; public const char mdi_view_stream = '\uf5aa'; public const char mdi_view_week = '\uf5ab'; public const char mdi_vimeo = '\uf5ac'; public const char mdi_vine = '\uf5ad'; public const char mdi_vk = '\uf5ae'; public const char mdi_vk_box = '\uf5af'; public const char mdi_vk_circle = '\uf5b0'; public const char mdi_voicemail = '\uf5b1'; public const char mdi_volume_high = '\uf5b2'; public const char mdi_volume_low = '\uf5b3'; public const char mdi_volume_medium = '\uf5b4'; public const char mdi_volume_off = '\uf5b5'; public const char mdi_vpn = '\uf5b6'; public const char mdi_walk = '\uf5b7'; public const char mdi_wallet = '\uf5b8'; public const char mdi_wallet_giftcard = '\uf5b9'; public const char mdi_wallet_membership = '\uf5ba'; public const char mdi_wallet_travel = '\uf5bb'; public const char mdi_watch = '\uf5bc'; public const char mdi_watch_export = '\uf5bd'; public const char mdi_watch_import = '\uf5be'; public const char mdi_water = '\uf5bf'; public const char mdi_water_off = '\uf5c0'; public const char mdi_water_pump = '\uf5c1'; public const char mdi_weather_cloudy = '\uf5c2'; public const char mdi_weather_fog = '\uf5c3'; public const char mdi_weather_hail = '\uf5c4'; public const char mdi_weather_lightning = '\uf5c5'; public const char mdi_weather_night = '\uf5c6'; public const char mdi_weather_partlycloudy = '\uf5c7'; public const char mdi_weather_pouring = '\uf5c8'; public const char mdi_weather_rainy = '\uf5c9'; public const char mdi_weather_snowy = '\uf5ca'; public const char mdi_weather_sunny = '\uf5cb'; public const char mdi_weather_sunset = '\uf5cc'; public const char mdi_weather_sunset_down = '\uf5cd'; public const char mdi_weather_sunset_up = '\uf5ce'; public const char mdi_weather_windy = '\uf5cf'; public const char mdi_weather_windy_variant = '\uf5d0'; public const char mdi_web = '\uf5d1'; public const char mdi_webcam = '\uf5d2'; public const char mdi_weight = '\uf5d3'; public const char mdi_weight_kilogram = '\uf5d4'; public const char mdi_whatsapp = '\uf5d5'; public const char mdi_wheelchair_accessibility = '\uf5d6'; public const char mdi_white_balance_auto = '\uf5d7'; public const char mdi_white_balance_incandescent = '\uf5d8'; public const char mdi_white_balance_irradescent = '\uf5d9'; public const char mdi_white_balance_sunny = '\uf5da'; public const char mdi_wifi = '\uf5db'; public const char mdi_wii = '\uf5dc'; public const char mdi_wikipedia = '\uf5dd'; public const char mdi_window_close = '\uf5de'; public const char mdi_window_closed = '\uf5df'; public const char mdi_window_maximize = '\uf5e0'; public const char mdi_window_minimize = '\uf5e1'; public const char mdi_window_open = '\uf5e2'; public const char mdi_window_restore = '\uf5e3'; public const char mdi_windows = '\uf5e4'; public const char mdi_wordpress = '\uf5e5'; public const char mdi_worker = '\uf5e6'; public const char mdi_wunderlist = '\uf5e7'; public const char mdi_xbox = '\uf5e8'; public const char mdi_xbox_controller = '\uf5e9'; public const char mdi_xbox_controller_off = '\uf5ea'; public const char mdi_xda = '\uf5eb'; public const char mdi_xml = '\uf5ec'; public const char mdi_yeast = '\uf5ed'; public const char mdi_yelp = '\uf5ee'; public const char mdi_youtube_play = '\uf5ef'; public const char mdi_zip_box = '\uf5f0'; public static readonly List<KeyValuePair<char, string>> Characters; public static IIcon[] Icons { get; } static MaterialCommunityIcons() { Characters = IconReflectionUtils.GetIcons<MaterialCommunityIcons>(); Icons = Characters.Select(p => new MaterialCommunityIcons(p.Value, p.Key)).Cast<IIcon>().ToArray(); } private readonly string _key; public MaterialCommunityIcons(string key, char @char) { _key = key; Character = @char; } public string Key => Characters.Single(p => p.Value == _key).Value.Replace("_", "-"); public char Character { get; } } }
54.040062
111
0.652957
[ "Apache-2.0" ]
Mitch528/IconifyXamarin
IconifyXamarin.MaterialCommunity/MaterialCommunityIcons.cs
70,144
C#
using System; using System.Net.Http; using Akka.TestKit.Xunit2; using Moq; using PixelBot.Orchestrator.Data; using Quiltoni.PixelBot.Core.Domain; namespace PixelBot.StandardFeaturesTests.UserActivityTrain { public abstract class BaseTestKit : TestKit { private readonly Mock<IChannelConfigurationContext> _ConfigurationContext; public MockRepository _Mockery = new MockRepository(MockBehavior.Default); protected BaseTestKit() { _ConfigurationContext = _Mockery.Create<IChannelConfigurationContext>(); } protected void AddChannelConfiguration(string channelName, ChannelConfiguration config) { _ConfigurationContext.Setup(c => c.GetConfigurationForChannel(channelName)).Returns(config); } protected IChannelConfigurationContext ConfigurationContext { get { return _ConfigurationContext.Object; } } } }
25.424242
110
0.805721
[ "MIT" ]
csharpfritz/Quiltoni.PixelBot
PixelBot.StandardFeaturesTests/UserActivityTrain/BaseTestKit.cs
841
C#
using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace BudgetTrack.Migrations { public partial class ExpenseTableInit : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ExpenseCategory", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ParentId = table.Column<int>(nullable: true), Name = table.Column<string>(maxLength: 100, nullable: false), Description = table.Column<string>(maxLength: 500, nullable: true) }, constraints: table => { table.PrimaryKey("PK_ExpenseCategory", x => x.Id); }); migrationBuilder.CreateTable( name: "Expenses", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ExpenseCategoryId = table.Column<int>(nullable: false), Date = table.Column<DateTime>(nullable: false), Description = table.Column<string>(maxLength: 500, nullable: true), Ammount = table.Column<decimal>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Expenses", x => x.Id); table.ForeignKey( name: "FK_Expenses_ExpenseCategory_ExpenseCategoryId", column: x => x.ExpenseCategoryId, principalTable: "ExpenseCategory", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Expenses_ExpenseCategoryId", table: "Expenses", column: "ExpenseCategoryId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Expenses"); migrationBuilder.DropTable( name: "ExpenseCategory"); } } }
40
114
0.530859
[ "MIT" ]
ermirbeqiraj/expense-tracker
BudgetTrack/Migrations/20180619142227_ExpenseTableInit.cs
2,562
C#
using Microsoft.EntityFrameworkCore.Migrations; namespace DataAccess.Migrations { public partial class ccTable : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "CreditCards", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CustomerId = table.Column<int>(nullable: false), NameOnTheCard = table.Column<string>(nullable: true), CardNumber = table.Column<string>(nullable: true), CVV = table.Column<string>(nullable: true), ExpirationDate = table.Column<string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_CreditCards", x => x.Id); }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CreditCards"); } } }
34.705882
73
0.521186
[ "MIT" ]
CerenSusuz/RentACarProject
DataAccess/Migrations/20210328114649_ccTable.cs
1,182
C#
using System; using CMS.Base.Web.UI; using CMS.Helpers; using CMS.Membership; using CMS.UIControls; public partial class CMSFormControls_Selectors_InsertImageOrMedia_Tabs_Anchor : CMSModalPage { protected void Page_Load(object sender, EventArgs e) { // Check UIProfile if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink")) { RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertLink"); } else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "AnchorTab")) { RedirectToUIElementAccessDenied("CMS.MediaDialog", "AnchorTab"); } // CKEditor's plugin filebrowser add custom params to url. // This ensures that custom params aren't validated if (QueryHelper.ValidateHash("hash", "CKEditor;CKEditorFuncNum;langCode", validateWithoutExcludedParameters: true)) { ScriptHelper.RegisterJQuery(Page); CMSDialogHelper.RegisterDialogHelper(Page); } else { anchorProperties.StopProcessing = true; anchorProperties.Visible = false; string url = ResolveUrl(AdministrationUrlHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true)); ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }"); } } }
38.461538
131
0.666
[ "MIT" ]
CMeeg/kentico-contrib
src/CMS/CMSFormControls/Selectors/InsertImageOrMedia/Tabs_Anchor.aspx.cs
1,502
C#
using System; using System.Collections.Generic; using System.Reflection; using Nest; using Newtonsoft.Json; using Tests.Framework; using static Tests.Framework.RoundTripper; #pragma warning disable 618 namespace Tests.ClientConcepts.HighLevel.Mapping { /** * [[auto-map]] * === Auto mapping * * When creating a mapping either when creating an index or through the Put Mapping API, * NEST offers a feature called auto mapping that can automagically infer the correct * Elasticsearch field datatypes from the CLR POCO property types you are mapping. **/ public class AutoMap { /** * We'll look at the features of auto mapping with a number of examples. For this, * we'll define two POCOs, `Company`, which has a name * and a collection of Employees, and `Employee` which has various properties of * different types, and itself has a collection of `Employee` types. */ public class Company { public string Name { get; set; } public List<Employee> Employees { get; set; } } public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public int Salary { get; set; } public DateTime Birthday { get; set; } public bool IsManager { get; set; } public List<Employee> Employees { get; set; } public TimeSpan Hours { get; set; } } [U] public void UsingAutoMap() { /** * Auto mapping can take the pain out of having to define a manual mapping for all properties * on the POCO */ var descriptor = new CreateIndexDescriptor("myindex") .Mappings(ms => ms .Map<Company>(m => m.AutoMap()) // <1> Auto map `Company` .Map<Employee>(m => m.AutoMap()) // <2> Auto map `Employee` ); // json var expected = new { mappings = new { company = new { properties = new { employees = new { properties = new { birthday = new { type = "date" }, employees = new { properties = new { }, type = "object" }, firstName = new { type = "string" }, hours = new { type = "long" }, isManager = new { type = "boolean" }, lastName = new { type = "string" }, salary = new { type = "integer" } }, type = "object" }, name = new { type = "string" } } }, employee = new { properties = new { birthday = new { type = "date" }, employees = new { properties = new { }, type = "object" }, firstName = new { type = "string" }, hours = new { type = "long" }, isManager = new { type = "boolean" }, lastName = new { type = "string" }, salary = new { type = "integer" } } } } }; // hide Expect(expected).WhenSerializing((ICreateIndexRequest)descriptor); } // hide public class ParentWithStringId : IgnoringProperties.Parent { public new string Id { get; set; } } [U] public void OverridingInheritedProperties() { var descriptor = new CreateIndexDescriptor("myindex") .Mappings(ms => ms .Map<ParentWithStringId>(m => m .AutoMap() ) ); var expected = new { mappings = new { parent = new { properties = new { id = new { type = "string", } } } } }; var settings = WithConnectionSettings(s => s .InferMappingFor<ParentWithStringId>(m => m .TypeName("parent") .Ignore(p => p.Description) .Ignore(p => p.IgnoreMe) ) ); settings.Expect(expected).WhenSerializing((ICreateIndexRequest) descriptor); } /** * Observe that NEST has inferred the Elasticsearch types based on the CLR type of our POCO properties. * In this example, * * - Birthday is mapped as a `date`, * - Hours is mapped as a `long` (`TimeSpan` ticks) * - IsManager is mapped as a `boolean`, * - Salary is mapped as an `integer` * - Employees is mapped as an `object` * * and the remaining string properties as `string` datatypes. * * NEST has inferred mapping support for the following .NET types * * - `String` maps to `"string"` * - `Int32` maps to `"integer"` * - `UInt16` maps to `"integer"` * - `Int16` maps to `"short"` * - `Byte` maps to `"short"` * - `Int64` maps to `"long"` * - `UInt32` maps to `"long"` * - `TimeSpan` maps to `"long"` * - `Single` maps to `"float"` * - `Double` maps to `"double"` * - `Decimal` maps to `"double"` * - `UInt64` maps to `"double"` * - `DateTime` maps to `"date"` * - `DateTimeOffset` maps to `"date"` * - `Boolean` maps to `"boolean"` * - `Char` maps to `"string"` * - `Guid` maps to `"string"` * * and supports a number of special types defined in NEST * * - `Nest.GeoLocation` maps to `"geo_point"` * - `Nest.CompletionField<TPayload>` maps to `"completion"` * - `Nest.Attachment` maps to `"attachment"` * * All other types map to `"object"` by default. * *[IMPORTANT] * -- * Some .NET types do not have direct equivalent Elasticsearch types. For example, `System.Decimal` is a type * commonly used to express currencies and other financial calculations that require large numbers of significant * integral and fractional digits and no round-off errors. There is no equivalent type in Elasticsearch, and the * nearest type is {ref_current}/number.html[double], a double-precision 64-bit IEEE 754 floating point. * * When a POCO has a `System.Decimal` property, it is automapped to the Elasticsearch `double` type. With the caveat * of a potential loss of precision, this is generally acceptable for a lot of use cases, but it can however cause * problems in _some_ edge cases. * * As the https://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-75351c669b09/csharp%20language%20specification.doc[C# Specification states], * * [quote, C# Specification section 6.2.1] * For a conversion from `decimal` to `float` or `double`, the `decimal` value is rounded to the nearest `double` or `float` value. * While this conversion may lose precision, it never causes an exception to be thrown. * * This conversion causes an exception to be thrown at deserialization time for `Decimal.MinValue` and `Decimal.MaxValue` because, at * serialization time, the nearest `double` value that is converted to is outside of the bounds of `Decimal.MinValue` or `Decimal.MaxValue`, * respectively. In these cases, it is advisable to use `double` as the POCO property type. * -- */ /**[float] * === Mapping Recursion * If you notice in our previous `Company` and `Employee` example, the `Employee` type is recursive * in that the `Employee` class itself contains a collection of type `Employee`. By default, `.AutoMap()` will only * traverse a single depth when it encounters recursive instances like this; the collection of type `Employee` * on the `Employee` class did not get any of its properties mapped. * * This is done as a safe-guard to prevent stack overflows and all the fun that comes with * __infinite__ recursion. Additionally, in most cases, when it comes to Elasticsearch mappings, it is * often an edge case to have deeply nested mappings like this. However, you may still have * the need to do this, so you can control the recursion depth of `.AutoMap()`. * * Let's introduce a very simple class, `A`, which itself has a property * Child of type `A`. */ public class A { public A Child { get; set; } } [U] public void ControllingRecursionDepth() { /** By default, `.AutoMap()` only goes as far as depth 1 */ var descriptor = new CreateIndexDescriptor("myindex") .Mappings(ms => ms .Map<A>(m => m.AutoMap()) ); /** Thus we do not map properties on the second occurrence of our Child property */ //json var expected = new { mappings = new { a = new { properties = new { child = new { properties = new { }, type = "object" } } } } }; //hide Expect(expected).WhenSerializing((ICreateIndexRequest)descriptor); /** Now let's specify a maxRecursion of `3` */ var withMaxRecursionDescriptor = new CreateIndexDescriptor("myindex") .Mappings(ms => ms .Map<A>(m => m.AutoMap(3)) ); /** `.AutoMap()` has now mapped three levels of our Child property */ //json var expectedWithMaxRecursion = new { mappings = new { a = new { properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { } } } } } } } } } } } }; //hide Expect(expectedWithMaxRecursion).WhenSerializing((ICreateIndexRequest)withMaxRecursionDescriptor); } //hide [U] public void PutMappingAlsoAdheresToMaxRecursion() { var descriptor = new PutMappingDescriptor<A>().AutoMap(); var expected = new { properties = new { child = new { properties = new { }, type = "object" } } }; Expect(expected).WhenSerializing((IPutMappingRequest)descriptor); var withMaxRecursionDescriptor = new PutMappingDescriptor<A>().AutoMap(3); var expectedWithMaxRecursion = new { properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { } } } } } } } } } }; Expect(expectedWithMaxRecursion).WhenSerializing((IPutMappingRequest)withMaxRecursionDescriptor); } } }
26.080952
158
0.559065
[ "Apache-2.0" ]
BedeGaming/elasticsearch-net
src/Tests/ClientConcepts/HighLevel/Mapping/AutoMap.doc.cs
10,956
C#
// Copyright (c) Microsoft. All rights reserved. // Copyright (c) Denis Kuzmin <x-3F@outlook.com> github/3F // Copyright (c) IeXod contributors https://github.com/3F/IeXod/graphs/contributors // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using System.Reflection; using System.Collections; using net.r_eg.IeXod.Framework; using net.r_eg.IeXod.Tasks; using net.r_eg.IeXod.Utilities; using net.r_eg.IeXod.Evaluation; using System.Text.RegularExpressions; using System.Globalization; using Xunit; namespace net.r_eg.IeXod.UnitTests { /* * Class: AspNetCompilerTests * * Test the AspNetCompiler task in various ways. * */ sealed public class AspNetCompilerTests { [Fact] public void NoParameters() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); // It's invalid to have zero parameters, so we expect a "false" return value from ValidateParameters. Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void OnlyMetabasePath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; // This should be valid. Assert.True(CommandLine.CallValidateParameters(t)); CommandLine.ValidateEquals(t, @"-m /LM/W3SVC/1/Root/MyApp", false); } [Fact] public void OnlyVirtualPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.VirtualPath = @"/MyApp"; // This should be valid. Assert.True(CommandLine.CallValidateParameters(t)); CommandLine.ValidateEquals(t, @"-v /MyApp", false); } [Fact] public void OnlyPhysicalPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.PhysicalPath = @"c:\MyApp"; // This is not valid. Either MetabasePath or VirtualPath must be specified. Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void OnlyTargetPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.TargetPath = @"c:\MyTarget"; // This is not valid. Either MetabasePath or VirtualPath must be specified. Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void MetabasePathAndVirtualPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.VirtualPath = @"/MyApp"; // This is not valid. Can't specify both MetabasePath and (VirtualPath or PhysicalPath). Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void MetabasePathAndPhysicalPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.PhysicalPath = @"c:\MyApp"; // This is not valid. Can't specify both MetabasePath and (VirtualPath or PhysicalPath). Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void MetabasePathAndTargetPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.TargetPath = @"c:\MyTarget"; // This is valid. Assert.True(CommandLine.CallValidateParameters(t)); CommandLine.ValidateEquals(t, @"-m /LM/W3SVC/1/Root/MyApp c:\MyTarget", false); } [Fact] public void VirtualPathAndPhysicalPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.VirtualPath = @"/MyApp"; t.PhysicalPath = @"c:\MyApp"; // This is valid. Assert.True(CommandLine.CallValidateParameters(t)); CommandLine.ValidateEquals(t, @"-v /MyApp -p c:\MyApp", false); } [Fact] public void VirtualPathAndTargetPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.VirtualPath = @"/MyApp"; t.TargetPath = @"c:\MyTarget"; // This is valid. Assert.True(CommandLine.CallValidateParameters(t)); CommandLine.ValidateEquals(t, @"-v /MyApp c:\MyTarget", false); } [Fact] public void PhysicalPathAndTargetPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.PhysicalPath = @"c:\MyApp"; t.TargetPath = @"c:\MyTarget"; // This is not valid. Either MetabasePath or VirtualPath must be specified. Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void AllExceptMetabasePath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.VirtualPath = @"/MyApp"; t.PhysicalPath = @"c:\MyApp"; t.TargetPath = @"c:\MyTarget"; // This is valid. Assert.True(CommandLine.CallValidateParameters(t)); CommandLine.ValidateEquals(t, @"-v /MyApp -p c:\MyApp c:\MyTarget", false); } [Fact] public void AllExceptVirtualPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.PhysicalPath = @"c:\MyApp"; t.TargetPath = @"c:\MyTarget"; // This is not valid. Can't specify both MetabasePath and (VirtualPath or PhysicalPath). Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void AllExceptPhysicalPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.VirtualPath = @"/MyApp"; t.TargetPath = @"c:\MyTarget"; // This is not valid. Can't specify both MetabasePath and (VirtualPath or PhysicalPath). Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void AllExceptTargetPath() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.VirtualPath = @"/MyApp"; t.PhysicalPath = @"c:\MyApp"; // This is not valid. Can't specify both MetabasePath and (VirtualPath or PhysicalPath). Assert.False(CommandLine.CallValidateParameters(t)); } [Fact] public void AllParameters() { AspNetCompiler t = new AspNetCompiler(); t.BuildEngine = new MockEngine(); t.MetabasePath = @"/LM/W3SVC/1/Root/MyApp"; t.VirtualPath = @"/MyApp"; t.PhysicalPath = @"c:\MyApp"; t.TargetPath = @"c:\MyTarget"; // This is not valid. Can't specify both MetabasePath and (VirtualPath or PhysicalPath). Assert.False(CommandLine.CallValidateParameters(t)); } /// <summary> /// Make sure AspNetCompiler sends ExternalProjectStarted/Finished events properly. The tasks will fail since /// the project files don't exist, but we only care about the events anyway. /// </summary> [Fact] [Trait("Category", "mono-osx-failing")] public void TestExternalProjectEvents() { string projectFileContents = @" <Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`> <UsingTask TaskName=`AspNetCompiler` AssemblyName=`{0}`/> <Target Name=`Build`> <AspNetCompiler VirtualPath=`/WebSite1` PhysicalPath=`..\..\solutions\WebSite1\`/> <OnError ExecuteTargets=`Build2`/> </Target> <Target Name=`Build2`> <AspNetCompiler VirtualPath=`/WebSite2` Clean=`true`/> <OnError ExecuteTargets=`Build3`/> </Target> <Target Name=`Build3`> <AspNetCompiler MetabasePath=`/LM/W3SVC/1/Root/MyApp`/> </Target> </Project>"; string fullProjectFile = string.Format(CultureInfo.InvariantCulture, projectFileContents, typeof(AspNetCompiler).Assembly.FullName); MockLogger logger = new MockLogger(); Project proj = ObjectModelHelpers.CreateInMemoryProject(fullProjectFile, logger); Assert.False(proj.Build(logger)); Assert.Equal(3, logger.ExternalProjectStartedEvents.Count); Assert.Equal(3, logger.ExternalProjectFinishedEvents.Count); Assert.Equal(@"..\..\solutions\WebSite1\", logger.ExternalProjectStartedEvents[0].ProjectFile); Assert.Equal("/WebSite2", logger.ExternalProjectStartedEvents[1].ProjectFile); Assert.Equal("/LM/W3SVC/1/Root/MyApp", logger.ExternalProjectStartedEvents[2].ProjectFile); Assert.Equal(@"..\..\solutions\WebSite1\", logger.ExternalProjectFinishedEvents[0].ProjectFile); Assert.Equal("/WebSite2", logger.ExternalProjectFinishedEvents[1].ProjectFile); Assert.Equal("/LM/W3SVC/1/Root/MyApp", logger.ExternalProjectFinishedEvents[2].ProjectFile); Assert.Null(logger.ExternalProjectStartedEvents[0].TargetNames); Assert.Equal("Clean", logger.ExternalProjectStartedEvents[1].TargetNames); Assert.Null(logger.ExternalProjectStartedEvents[2].TargetNames); Assert.False(logger.ExternalProjectFinishedEvents[0].Succeeded); Assert.False(logger.ExternalProjectFinishedEvents[1].Succeeded); Assert.False(logger.ExternalProjectFinishedEvents[2].Succeeded); } } }
35.563333
144
0.584497
[ "MIT" ]
3F/IeXod
src/Tasks.UnitTests/AspNetCompiler_Tests.cs
10,669
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; namespace Azure.AI.TextAnalytics { /// <summary> /// HealthcareRelation class. /// </summary> public partial class HealthcareRelation { /// <summary> Initializes a new instance of HealthcareRelation. </summary> /// <param name="relationType"> Type of relation. Examples include: `DosageOfMedication` or `FrequencyOfMedication`, etc. </param> /// <param name="bidirectional"> If true the relation between the entities is bidirectional, otherwise directionality is source to target. </param> /// <param name="source"> Reference link to the source entity. </param> /// <param name="target"> Reference link to the target entity. </param> /// <exception cref="ArgumentNullException"> <paramref name="relationType"/>, <paramref name="source"/>, or <paramref name="target"/> is null. </exception> internal HealthcareRelation(string relationType, bool bidirectional, HealthcareEntity source, HealthcareEntity target) { if (relationType == null) { throw new ArgumentNullException(nameof(relationType)); } if (source == null) { throw new ArgumentNullException(nameof(source)); } if (target == null) { throw new ArgumentNullException(nameof(target)); } RelationType = relationType; Bidirectional = bidirectional; Source = source; Target = target; } /// <summary> /// Source Entity /// </summary> public HealthcareEntity Source { get; } /// <summary> /// Target Entity /// </summary> public HealthcareEntity Target { get; } /// <summary> Type of relation. Examples include: `DosageOfMedication` or `FrequencyOfMedication`, etc. </summary> public string RelationType { get; } /// <summary> If true the relation between the entities is bidirectional, otherwise directionality is source to target. </summary> public bool Bidirectional { get; } } }
40.107143
163
0.612645
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/textanalytics/Azure.AI.TextAnalytics/src/HealthcareRelation.cs
2,248
C#
using UnityEditor; using UnityEngine; namespace GTVariable.Editor { /// <summary> /// Derive from this class to create editor for one argument collision event trigger /// </summary> public class CollisionEventTriggerEditor<GameEventType, EventType, ParameterType> : CollisionEventTriggerEditor where GameEventType : GameEvent<EventType, ParameterType> where EventType : UnityEngine.Events.UnityEvent<ParameterType> { private bool dynamicParameterValid; protected override void OnEnable() { base.OnEnable(); //Check if parameter type derive from Component dynamicParameterValid = typeof(UnityEngine.Component).IsAssignableFrom(typeof(ParameterType)); } protected override void DrawTrigger() { property = trigger.FindPropertyRelative("any"); EditorGUILayout.PropertyField(property); if (property.boolValue == false) { property = trigger.FindPropertyRelative("tag"); property.stringValue = EditorGUILayout.TagField(property.displayName, property.stringValue); } property = trigger.FindPropertyRelative("gameEvent"); EditorGUILayout.PropertyField(property); property = trigger.FindPropertyRelative("eventType"); EditorGUILayout.PropertyField(property); if (dynamicParameterValid) { property = trigger.FindPropertyRelative("dynamicParameter"); EditorGUILayout.PropertyField(property); if (property.boolValue) { property = trigger.FindPropertyRelative("behaviour"); EditorGUILayout.PropertyField(property); } else { property = trigger.FindPropertyRelative("parameter"); EditorGUILayout.PropertyField(property); } } else { property = trigger.FindPropertyRelative("parameter"); EditorGUILayout.PropertyField(property); } } } }
37.409836
116
0.578878
[ "MIT" ]
GhooTS/GTScriptableVariable
Editor/Events/EventTriggers/CollisionTriggers/Generic/CollisionEventTriggerEditor.cs
2,284
C#