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
// *** 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 SubnetDelegationServiceDelegationGetArgs : Pulumi.ResourceArgs { [Input("actions")] private InputList<string>? _actions; /// <summary> /// A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values include `Microsoft.Network/networkinterfaces/*`, `Microsoft.Network/virtualNetworks/subnets/action`, `Microsoft.Network/virtualNetworks/subnets/join/action`, `Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action` and `Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action`. /// </summary> public InputList<string> Actions { get => _actions ?? (_actions = new InputList<string>()); set => _actions = value; } /// <summary> /// The name of service to delegate to. Possible values include `Microsoft.ApiManagement/service`, `Microsoft.AzureCosmosDB/clusters`, `Microsoft.BareMetal/AzureVMware`, `Microsoft.BareMetal/CrayServers`, `Microsoft.Batch/batchAccounts`, `Microsoft.ContainerInstance/containerGroups`, `Microsoft.ContainerService/managedClusters`, `Microsoft.Databricks/workspaces`, `Microsoft.DBforMySQL/flexibleServers`, `Microsoft.DBforMySQL/serversv2`, `Microsoft.DBforPostgreSQL/flexibleServers`, `Microsoft.DBforPostgreSQL/serversv2`, `Microsoft.DBforPostgreSQL/singleServers`, `Microsoft.HardwareSecurityModules/dedicatedHSMs`, `Microsoft.Kusto/clusters`, `Microsoft.Logic/integrationServiceEnvironments`, `Microsoft.MachineLearningServices/workspaces`, `Microsoft.Netapp/volumes`, `Microsoft.Network/managedResolvers`, `Microsoft.PowerPlatform/vnetaccesslinks`, `Microsoft.ServiceFabricMesh/networks`, `Microsoft.Sql/managedInstances`, `Microsoft.Sql/servers`, `Microsoft.StreamAnalytics/streamingJobs`, `Microsoft.Synapse/workspaces`, `Microsoft.Web/hostingEnvironments`, and `Microsoft.Web/serverFarms`. /// </summary> [Input("name", required: true)] public Input<string> Name { get; set; } = null!; public SubnetDelegationServiceDelegationGetArgs() { } } }
66
1,104
0.747209
[ "ECL-2.0", "Apache-2.0" ]
ScriptBox99/pulumi-azure
sdk/dotnet/Network/Inputs/SubnetDelegationServiceDelegationGetArgs.cs
2,508
C#
using Avalonia.Controls; using MessageBox.Avalonia; using MessageBox.Avalonia.DTO; using MessageBox.Avalonia.Enums; using MessageBox.Avalonia.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace UABEAvalonia { public static class MessageBoxUtil { public static async Task<ButtonResult> ShowDialog(Window window, string header, string message) { return await ShowDialog(window, header, message, ButtonEnum.Ok); } public static async Task<ButtonResult> ShowDialog(Window window, string header, string message, ButtonEnum buttons) { return await MessageBoxManager.GetMessageBoxStandardWindow(new MessageBoxStandardParams { ButtonDefinitions = buttons, Style = Style.Windows, ContentHeader = header, ContentMessage = message }).ShowDialog(window); } public static async Task<string> ShowDialogCustom(Window window, string header, string message, params string[] buttons) { ButtonDefinition[] definitions = new ButtonDefinition[buttons.Length]; for (int i = 0; i < buttons.Length; i++) { definitions[i] = new ButtonDefinition { Name = buttons[i], Type = ButtonType.Default }; } return await MessageBoxManager.GetMessageBoxCustomWindow(new MessageBoxCustomParams { Style = Style.Windows, ContentHeader = header, ContentMessage = message, ButtonDefinitions = definitions }).ShowDialog(window); } } }
34.78
128
0.635998
[ "MIT" ]
chaoscube/PhoenixPointKoreanPatcher
UABEAvalonia/MessageBoxUtil.cs
1,741
C#
namespace IdleTimeModule { partial class IdleTimeModuleForm { /// <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() { this.acceptButton = new System.Windows.Forms.Button(); this.DisplayingInfoLabel = new System.Windows.Forms.Label(); this.timerLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // acceptButton // this.acceptButton.Location = new System.Drawing.Point(12, 106); this.acceptButton.Name = "acceptButton"; this.acceptButton.Size = new System.Drawing.Size(246, 23); this.acceptButton.TabIndex = 0; this.acceptButton.Text = "Подтвердить"; this.acceptButton.UseVisualStyleBackColor = true; this.acceptButton.Click += new System.EventHandler(this.acceptButton_Click); // // DisplayingInfoLabel // this.DisplayingInfoLabel.Location = new System.Drawing.Point(12, 9); this.DisplayingInfoLabel.Name = "DisplayingInfoLabel"; this.DisplayingInfoLabel.Size = new System.Drawing.Size(246, 64); this.DisplayingInfoLabel.TabIndex = 1; this.DisplayingInfoLabel.Text = "Пожалуйста, подтвердите свою активность. Для этого нажмите кнопку \'Подтвердить\'. " + "В противном случае программа Eplan будет закрыта через 1 минуту."; // // timerLabel // this.timerLabel.AutoSize = true; this.timerLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.timerLabel.Location = new System.Drawing.Point(80, 74); this.timerLabel.Name = "timerLabel"; this.timerLabel.Size = new System.Drawing.Size(110, 17); this.timerLabel.TabIndex = 2; this.timerLabel.Text = "Осталось: 60 с."; // // IdleForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(270, 141); this.ControlBox = false; this.Controls.Add(this.timerLabel); this.Controls.Add(this.DisplayingInfoLabel); this.Controls.Add(this.acceptButton); this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(286, 180); this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(286, 180); this.Name = "IdleForm"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Подтвердите активность"; this.TopMost = true; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button acceptButton; private System.Windows.Forms.Label DisplayingInfoLabel; private System.Windows.Forms.Label timerLabel; } }
42.4
172
0.593595
[ "MIT" ]
dimabeel/EplanDowntimeModule
EplanIdleTimeModule/IdleTimeModuleForm.designer.cs
4,186
C#
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace RadzenCrm.Models.Crm { [Table("TaskTypes", Schema = "dbo")] public partial class TaskType { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public ICollection<Task> Tasks { get; set; } public string Name { get; set; } } }
18.037037
57
0.665298
[ "MIT" ]
bryanmitchellhowell/RadzenCRM
server/Models/CRM/TaskType.cs
487
C#
using Coreflow.Runtime.Storage; namespace Coreflow.Test.Tests { internal static class TestHelper { internal static CoreflowService InitCoreflow() { MemoryFlowDefinitionStorage dstorage = new MemoryFlowDefinitionStorage(); MemoryFlowInstanceStorage istorage = new MemoryFlowInstanceStorage(); CoreflowService ret = new CoreflowService(dstorage, istorage, null); ret.CodeCreatorStorage.AddCodeActivity(typeof(AdderActivity)); return ret; } } }
27.15
85
0.679558
[ "MIT" ]
lordmampf/Coreflow
Coreflow.Test/Tests/TestHelper.cs
545
C#
 //=============================================================================== // // IMPORTANT NOTICE, PLEASE READ CAREFULLY: // // => This code is licensed under the GNU General Public License (GPL v3). A copy of the license is available at: // https://www.gnu.org/licenses/gpl.txt // // => As stated in the license text linked above, "The GNU General Public License does not permit incorporating your program into proprietary programs". It also does not permit incorporating this code into non-GPL-licensed code (such as MIT-licensed code) in such a way that results in a non-GPL-licensed work (please refer to the license text for the precise terms). // // => Licenses that permit proprietary use are available at: // http://www.cshtml5.com // // => Copyright 2019 Userware/CSHTML5. This code is part of the CSHTML5 product (cshtml5.com). // //=============================================================================== using System; namespace System.ServiceModel { // Summary: // Defines the contract for the basic state machine for all communication-oriented // objects in the system, including channels, the channel managers, factories, // listeners, and dispatchers, and service hosts. public partial interface ICommunicationObject { // Summary: // Gets the current state of the communication-oriented object. // // Returns: // The value of the System.ServiceModel.CommunicationState of the object. CommunicationState State { get; } // Summary: // Occurs when the communication object completes its transition from the closing // state into the closed state. event EventHandler Closed; // // Summary: // Occurs when the communication object first enters the closing state. event EventHandler Closing; // // Summary: // Occurs when the communication object first enters the faulted state. event EventHandler Faulted; // // Summary: // Occurs when the communication object completes its transition from the opening // state into the opened state. event EventHandler Opened; // // Summary: // Occurs when the communication object first enters the opening state. event EventHandler Opening; // Summary: // Causes a communication object to transition immediately from its current // state into the closed state. void Abort(); // // Summary: // Begins an asynchronous operation to close a communication object. // // Parameters: // callback: // The System.AsyncCallback delegate that receives notification of the completion // of the asynchronous close operation. // // state: // An object, specified by the application, that contains state information // associated with the asynchronous close operation. // // Returns: // The System.IAsyncResult that references the asynchronous close operation. // // Exceptions: // System.ServiceModel.CommunicationObjectFaultedException: // System.ServiceModel.ICommunicationObject.BeginClose() was called on an object // in the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The default time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to close gracefully. IAsyncResult BeginClose(AsyncCallback callback, object state); // // Summary: // Begins an asynchronous operation to close a communication object with a specified // time-out. // // Parameters: // timeout: // The System.Timespan that specifies how long the send operation has to complete // before timing out. // // callback: // The System.AsyncCallback delegate that receives notification of the completion // of the asynchronous close operation. // // state: // An object, specified by the application, that contains state information // associated with the asynchronous close operation. // // Returns: // The System.IAsyncResult that references the asynchronous close operation. // // Exceptions: // System.ServiceModel.CommunicationObjectFaultedException: // System.ServiceModel.ICommunicationObject.BeginClose() was called on an object // in the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The specified time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to close gracefully. IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state); // // Summary: // Begins an asynchronous operation to open a communication object. // // Parameters: // callback: // The System.AsyncCallback delegate that receives notification of the completion // of the asynchronous open operation. // // state: // An object, specified by the application, that contains state information // associated with the asynchronous open operation. // // Returns: // The System.IAsyncResult that references the asynchronous open operation. // // Exceptions: // System.ServiceModel.CommunicationException: // The System.ServiceModel.ICommunicationObject was unable to be opened and // has entered the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The default open time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to enter the System.ServiceModel.CommunicationState.Opened state // and has entered the System.ServiceModel.CommunicationState.Faulted state. IAsyncResult BeginOpen(AsyncCallback callback, object state); // // Summary: // Begins an asynchronous operation to open a communication object within a // specified interval of time. // // Parameters: // timeout: // The System.Timespan that specifies how long the send operation has to complete // before timing out. // // callback: // The System.AsyncCallback delegate that receives notification of the completion // of the asynchronous open operation. // // state: // An object, specified by the application, that contains state information // associated with the asynchronous open operation. // // Returns: // The System.IAsyncResult that references the asynchronous open operation. // // Exceptions: // System.ServiceModel.CommunicationException: // The System.ServiceModel.ICommunicationObject was unable to be opened and // has entered the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The specified time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to enter the System.ServiceModel.CommunicationState.Opened state // and has entered the System.ServiceModel.CommunicationState.Faulted state. IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state); // // Summary: // Causes a communication object to transition from its current state into the // closed state. // // Exceptions: // System.ServiceModel.CommunicationObjectFaultedException: // System.ServiceModel.ICommunicationObject.Close() was called on an object // in the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The default close time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to close gracefully. void Close(); // // Summary: // Causes a communication object to transition from its current state into the // closed state. // // Parameters: // timeout: // The System.Timespan that specifies how long the send operation has to complete // before timing out. // // Exceptions: // System.ServiceModel.CommunicationObjectFaultedException: // System.ServiceModel.ICommunicationObject.Close() was called on an object // in the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to close gracefully. void Close(TimeSpan timeout); // // Summary: // Completes an asynchronous operation to close a communication object. // // Parameters: // result: // The System.IAsyncResult that is returned by a call to the System.ServiceModel.ICommunicationObject.BeginClose() // method. // // Exceptions: // System.ServiceModel.CommunicationObjectFaultedException: // System.ServiceModel.ICommunicationObject.BeginClose() was called on an object // in the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to close gracefully. void EndClose(IAsyncResult result); // // Summary: // Completes an asynchronous operation to open a communication object. // // Parameters: // result: // The System.IAsyncResult that is returned by a call to the System.ServiceModel.ICommunicationObject.BeginOpen() // method. // // Exceptions: // System.ServiceModel.CommunicationException: // The System.ServiceModel.ICommunicationObject was unable to be opened and // has entered the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to enter the System.ServiceModel.CommunicationState.Opened state // and has entered the System.ServiceModel.CommunicationState.Faulted state. void EndOpen(IAsyncResult result); // // Summary: // Causes a communication object to transition from the created state into the // opened state. // // Exceptions: // System.ServiceModel.CommunicationException: // The System.ServiceModel.ICommunicationObject was unable to be opened and // has entered the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The default open time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to enter the System.ServiceModel.CommunicationState.Opened state // and has entered the System.ServiceModel.CommunicationState.Faulted state. void Open(); // // Summary: // Causes a communication object to transition from the created state into the // opened state within a specified interval of time. // // Parameters: // timeout: // The System.Timespan that specifies how long the send operation has to complete // before timing out. // // Exceptions: // System.ServiceModel.CommunicationException: // The System.ServiceModel.ICommunicationObject was unable to be opened and // has entered the System.ServiceModel.CommunicationState.Faulted state. // // System.TimeoutException: // The specified time-out elapsed before the System.ServiceModel.ICommunicationObject // was able to enter the System.ServiceModel.CommunicationState.Opened state // and has entered the System.ServiceModel.CommunicationState.Faulted state. void Open(TimeSpan timeout); } }
45.857651
368
0.620751
[ "MIT" ]
Barjonp/OpenSilver
src/Runtime/Runtime/System.ServiceModel/ICommunicationObject.cs
12,888
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Resurrection")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Resurrection")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2d990c14-eb5a-4f5a-b1dc-d78b349eb359")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.621622
84
0.747845
[ "MIT" ]
GeorgiGarnenkov/ProgrammingFundamentals-Extended
DataTypesVariablesAndMethods/Resurrection/Properties/AssemblyInfo.cs
1,395
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; namespace AddressbookWebTests { public class GroupTestBase : AuthTestBase { [TearDown] public void CompareGroupsUI_DB() { if (PERFORM_LONG_UI_CHECKS) { List<GroupData> fromUI = app.Groups.GetGroupList(); List<GroupData> fromDB = GroupData.GetAll(); fromUI.Sort(); fromDB.Sort(); Assert.AreEqual(fromUI, fromDB); } } } }
24.346154
67
0.565561
[ "Apache-2.0" ]
Vegard1666/Testcases
addressbook-web-tests/addressbook-web-tests/Tests/GroupTestBase.cs
635
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; namespace TODOFilePickerSample.Converters { class DateTimeFormatConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { try { return System.Convert.ToDateTime(value).ToString(parameter.ToString()); } catch { return value; } } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }
26.296296
99
0.64507
[ "MIT" ]
HydAu/WebDevCamp
Presentation/z102. File Management/Demos/TODOFilePickerSample/TODOFilePickerSample/Converters/DateTimeFormatConverter.cs
712
C#
namespace DataLater.Migrations { using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration<FBHelper.Data.FB> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(FBHelper.Data.FB context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } } }
30.40625
85
0.545735
[ "MIT" ]
adhadimohd/AUTO-POST-FB-CSHARP
DataLater/Migrations/Configuration.cs
973
C#
using System; namespace DICOMcloud.Wado.Areas.HelpPage { /// <summary> /// This represents a preformatted text sample on the help page. There's a display template named TextSample associated with this class. /// </summary> public class TextSample { public TextSample(string text) { if (text == null) { throw new ArgumentNullException("text"); } Text = text; } public string Text { get; private set; } public override bool Equals(object obj) { TextSample other = obj as TextSample; return other != null && Text == other.Text; } public override int GetHashCode() { return Text.GetHashCode(); } public override string ToString() { return Text; } } }
24.081081
140
0.534231
[ "Apache-2.0" ]
gitter-badger/DICOMcloud
DICOMcloud.Wado/Areas/HelpPage/SampleGeneration/TextSample.cs
891
C#
using System.Collections.Generic; using Essensoft.AspNetCore.Payment.Alipay.Response; namespace Essensoft.AspNetCore.Payment.Alipay.Request { /// <summary> /// AOP API: alipay.mobile.beacon.message.send /// </summary> public class AlipayMobileBeaconMessageSendRequest : IAlipayRequest<AlipayMobileBeaconMessageSendResponse> { /// <summary> /// 设备关联数据 /// </summary> public string BizContent { get; set; } #region IAlipayRequest Members private bool needEncrypt=false; private string apiVersion = "1.0"; private string terminalType; private string terminalInfo; private string prodCode; private string notifyUrl; private string returnUrl; private AlipayObject bizModel; public void SetNeedEncrypt(bool needEncrypt){ this.needEncrypt=needEncrypt; } public bool GetNeedEncrypt(){ return needEncrypt; } public void SetNotifyUrl(string notifyUrl){ this.notifyUrl = notifyUrl; } public string GetNotifyUrl(){ return notifyUrl; } public void SetReturnUrl(string returnUrl){ this.returnUrl = returnUrl; } public string GetReturnUrl(){ return returnUrl; } public void SetTerminalType(string terminalType){ this.terminalType=terminalType; } public string GetTerminalType(){ return terminalType; } public void SetTerminalInfo(string terminalInfo){ this.terminalInfo=terminalInfo; } public string GetTerminalInfo(){ return terminalInfo; } public void SetProdCode(string prodCode){ this.prodCode=prodCode; } public string GetProdCode(){ return prodCode; } public string GetApiName() { return "alipay.mobile.beacon.message.send"; } public void SetApiVersion(string apiVersion){ this.apiVersion=apiVersion; } public string GetApiVersion(){ return apiVersion; } public IDictionary<string, string> GetParameters() { var parameters = new AlipayDictionary { { "biz_content", BizContent } }; return parameters; } public AlipayObject GetBizModel() { return bizModel; } public void SetBizModel(AlipayObject bizModel) { this.bizModel = bizModel; } #endregion } }
23.536364
109
0.598301
[ "MIT" ]
Aosir/Payment
src/Essensoft.AspNetCore.Payment.Alipay/Request/AlipayMobileBeaconMessageSendRequest.cs
2,601
C#
// System using System; using System.Threading; using System.Threading.Tasks; // Unity using UnityEngine; using UnityEngine.UI; // Project // Alias public class ThreadHelperSample : MonoBehaviour { public Text txt_log = null; private Task sampleTask = null; private CancellationTokenSource sampleTaskCancelTokenSource = new CancellationTokenSource(); private CancellationToken sampleTaskCancelToken; private static System.Object lockObject = new System.Object(); private void Start() { txt_log.text = string.Empty; sampleTaskCancelTokenSource = new CancellationTokenSource(); sampleTaskCancelToken = sampleTaskCancelTokenSource.Token; Run(); } private async void Run() { // Must be created before run task MainThreadHelper.GetOrCreate(); sampleTask = Task.Factory.StartNew(SampleTask, sampleTaskCancelToken); await sampleTask; } private async void SampleTask() { Debug.Log($"SampleTask Started"); //sampleTaskCancelToken.ThrowIfCancellationRequested(); int index = 0; while (true) { if (sampleTaskCancelToken.IsCancellationRequested) return; lock (lockObject) { MainThreadHelper.AddAction(() => { txt_log.text += $"{index}\t"; Debug.Log($"{index}\t"); index++; }); } await Task.Delay(1000); } } private void OnDestroy() { sampleTaskCancelTokenSource.Cancel(); } }
22.630137
96
0.598668
[ "Apache-2.0" ]
JungukHom/UnityUtility
Project/UnityUtility/Assets/ThreadHelper/Sample/ThreadHelperSample.cs
1,652
C#
using HarmonyLib; using RimWorld; using System.Reflection; using Verse; namespace DeepRimPatch { [StaticConstructorOnStartup] static class DeepRimPatch { static DeepRimPatch() { var harmony = new Harmony("Mlie.CaveBiome.DeepRimPatch"); harmony.PatchAll(Assembly.GetExecutingAssembly()); } [HarmonyPatch(typeof(Map))] [HarmonyPatch("Biome")] [HarmonyAfter(new string[] { "com.deeprim.rimworld.mod" })] private static void MapBiomePostfix(Map __instance, ref BiomeDef __result) { bool flag = __instance.ParentHolder is DeepRim.UndergroundMapParent; if (flag) { __result = DefDatabase<BiomeDef>.GetNamed("Cave", true); } } } }
25.935484
82
0.605721
[ "MIT" ]
Mersid/CaveBiome
Source/DeepRimPatch/DeepRimPatch.cs
806
C#
using PhilipDaubmeier.DigitalstromClient.Model.Core; using System; using System.Collections.Generic; namespace PhilipDaubmeier.DigitalstromClient.Model.PropertyTree { public class ZonesAndSensorValuesResponse : IWiremessagePayload { public List<ZonesAndSensorValues> Zones { get; set; } = new List<ZonesAndSensorValues>(); } public class ZonesAndSensorValues { public Zone ZoneID { get; set; } = 0; public List<SensorTypeAndValues> Sensor { get; set; } = new List<SensorTypeAndValues>(); } public class SensorTypeAndValues { public Sensor Type { get; set; } = SensorType.UnknownType; public double Value { get; set; } public long Time { get; set; } public DateTime Timestamp { get { return DateTimeOffset.FromUnixTimeSeconds(Time).UtcDateTime.ToLocalTime(); } } } }
33.153846
120
0.696056
[ "MIT" ]
Abrissirba/GraphIoT
src/DigitalstromClient/Model/PropertyTree/ZonesAndSensorValuesResponse.cs
864
C#
#region Usings using System; #endregion namespace FinancialCharting.Library.ProjectExceptions { [Serializable] public class IndicatorException : Exception { public IndicatorException() : base("Invalid indicator parameters") {} public IndicatorException(string message) : base(message) {} public IndicatorException(Exception inner) : base("Invalid indicator parameters", inner) {} public IndicatorException(string message, Exception inner) : base(message, inner) {} } }
17.517241
60
0.73622
[ "MIT" ]
AnCh7/FinancialCharting
src/FinancialCharting.Library/ProjectExceptions/IndicatorException.cs
510
C#
using Newtonsoft.Json; namespace UbiqSecurity.Model { internal class FpeBillingResponse { #region Serializable Properties [JsonProperty("message")] internal string Message { get; set; } [JsonProperty("status")] internal int Status { get; set; } [JsonProperty("last_valid")] internal IdRecord LastValidRecord { get; set; } #endregion } internal class IdRecord { #region Serializable Properties [JsonProperty("id")] internal string Id { get; set; } #endregion } }
16.16129
49
0.704591
[ "MIT" ]
ubiqsecurity/ubiq-dotnet
UbiqSecurity/Model/FpeBillingResponse.cs
503
C#
using System.Globalization; using System.Windows.Data; namespace Connect4.Converters; public class EnumBooleanConverter : IValueConverter { public object Convert( object value, Type targetType, object parameter, CultureInfo culture ) { return value.Equals( parameter ); } public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture ) { return ( (bool)value ) ? parameter : Binding.DoNothing; } }
23.526316
98
0.767338
[ "MIT" ]
xeorast/Connect4
Connect4/Converters/EnumBooleanConverter.cs
449
C#
using System; using System.Runtime.InteropServices; namespace AppsPlugin.Native { public static partial class user32 { [DllImport("user32.dll")] public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam); [DllImport("user32.dll", SetLastError = true)] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); } public static partial class user32 { public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); public enum GWL { GWL_WNDPROC = (-4), GWL_HINSTANCE = (-6), GWL_HWNDPARENT = (-8), GWL_STYLE = (-16), GWL_EXSTYLE = (-20), GWL_USERDATA = (-21), GWL_ID = (-12) } public const uint WS_CAPTION = 0x00C00000; public const uint WS_VISIBLE = 0x10000000; } }
28.236842
96
0.613234
[ "MIT" ]
dahanj95/Telebot
Plugins/AppsPlugin/Native/User32.cs
1,075
C#
namespace IteratorPattern { public interface IIterator<T> { bool HasNext { get; } T Next(); } }
15.5
33
0.548387
[ "MIT" ]
kado-yasuyuki/StudyIterator
StudyIterator/Assets/01_IteratorPattern/IIterator.cs
126
C#
/* * CdCmd.java * * This file contains the Jacl implementation of the built-in Tcl "cd" * command. * * Copyright (c) 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL * WARRANTIES. * * Included in SQLite3 port to C# for use in testharness only; 2008 Noah B Hart * * RCS @(#) $Id: CdCmd.java,v 1.2 1999/05/08 23:53:08 dejong Exp $ * */ using System; namespace tcl.lang { // This class implements the built-in "cd" command in Tcl. class CdCmd : Command { public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv ) { string dirName; if ( argv.Length > 2 ) { throw new TclNumArgsException( interp, 1, argv, "?dirName?" ); } if ( argv.Length == 1 ) { dirName = "~"; } else { dirName = argv[1].ToString(); } if ( ( JACL.PLATFORM == JACL.PLATFORM_WINDOWS ) && ( dirName.Length == 2 ) && ( dirName[1] == ':' ) ) { dirName = dirName + "/"; } // Set the interp's working dir. interp.setWorkingDir( dirName ); return TCL.CompletionCode.RETURN; } } // end CdCmd class }
22.473684
108
0.563622
[ "MIT" ]
ARLM-Keller/csharp-sqlite
TCL/src/commands/CdCmd.cs
1,281
C#
using System; using System.Collections.Generic; using System.Text; namespace Sdf.Redis { public class RedisConnectionOption { public string Host { get; set; } public string Password { get; set; } } }
17.692308
44
0.66087
[ "Apache-2.0" ]
yyalon/Sdf
src/Sdf.Redis/RedisConnectionOption.cs
232
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. namespace TerraFX.Interop { public unsafe partial struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS { public ID3D12Resource* pSrcResource; public ID3D12Resource* pDstResource; [NativeTypeName("UINT")] public uint SubresourceCount; [NativeTypeName("const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS *")] public D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS* pSubresourceParameters; public DXGI_FORMAT Format; public D3D12_RESOLVE_MODE ResolveMode; [NativeTypeName("BOOL")] public int PreserveResolveSource; } }
33.428571
145
0.748932
[ "MIT" ]
DaZombieKiller/terrafx.interop.windows
sources/Interop/Windows/um/d3d12/D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS.cs
938
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ServerRegistrationManager")] [assembly: AssemblyDescription("Server Registration Manager for SharpShell, can be used in install or uninstall servers.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1968ce66-74ce-4167-9a2c-8a23cc975cd4")]
47.95
123
0.787278
[ "MIT" ]
0x4a616e/sharpshell
SharpShell/Tools/ServerRegistrationManager/Properties/AssemblyInfo.cs
961
C#
namespace main { partial class frmMain { /// <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() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tab = new System.Windows.Forms.TabPage(); this.btn_es = new System.Windows.Forms.Button(); this.btn_cancle = new System.Windows.Forms.Button(); this.turn_to = new System.Windows.Forms.Button(); this.txt_move_turnto = new System.Windows.Forms.TextBox(); this.turn_local = new System.Windows.Forms.Button(); this.txt_move_turnlocal = new System.Windows.Forms.TextBox(); this.btn_y = new System.Windows.Forms.Button(); this.btn_x = new System.Windows.Forms.Button(); this.txt_move_y = new System.Windows.Forms.TextBox(); this.txt_move_x = new System.Windows.Forms.TextBox(); this.laser_9 = new System.Windows.Forms.ProgressBar(); this.laser_10 = new System.Windows.Forms.ProgressBar(); this.txt_isobstacle = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.txt_isrobotmove = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.laser_8 = new System.Windows.Forms.ProgressBar(); this.laser_7 = new System.Windows.Forms.ProgressBar(); this.laser_6 = new System.Windows.Forms.ProgressBar(); this.laser_5 = new System.Windows.Forms.ProgressBar(); this.laser_4 = new System.Windows.Forms.ProgressBar(); this.laser_3 = new System.Windows.Forms.ProgressBar(); this.laser_2 = new System.Windows.Forms.ProgressBar(); this.label7 = new System.Windows.Forms.Label(); this.laser_1 = new System.Windows.Forms.ProgressBar(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.txt_voltage3 = new System.Windows.Forms.TextBox(); this.txt_voltage2 = new System.Windows.Forms.TextBox(); this.txt_voltage1 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.odom2_t = new System.Windows.Forms.TextBox(); this.odom2_y = new System.Windows.Forms.TextBox(); this.odom2_x = new System.Windows.Forms.TextBox(); this.odom1_t = new System.Windows.Forms.TextBox(); this.odom1_y = new System.Windows.Forms.TextBox(); this.odom1_x = new System.Windows.Forms.TextBox(); this.btn_turn_right = new System.Windows.Forms.Button(); this.btn_turn_left = new System.Windows.Forms.Button(); this.btn_stop = new System.Windows.Forms.Button(); this.btn_right = new System.Windows.Forms.Button(); this.btn_down = new System.Windows.Forms.Button(); this.btn_left = new System.Windows.Forms.Button(); this.btn_up = new System.Windows.Forms.Button(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.numericUpDown19 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown20 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown17 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown18 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown15 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown16 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown13 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown14 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown11 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown12 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown9 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown10 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown7 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown8 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown5 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown6 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown4 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.right_grip_open = new System.Windows.Forms.Button(); this.right_grip_close = new System.Windows.Forms.Button(); this.left_grip_open = new System.Windows.Forms.Button(); this.left_grip_close = new System.Windows.Forms.Button(); this.arm_right_5 = new System.Windows.Forms.TrackBar(); this.arm_right_4 = new System.Windows.Forms.TrackBar(); this.arm_right_3 = new System.Windows.Forms.TrackBar(); this.arm_right_2 = new System.Windows.Forms.TrackBar(); this.arm_right_1 = new System.Windows.Forms.TrackBar(); this.robot_z = new System.Windows.Forms.TrackBar(); this.arm_left_5 = new System.Windows.Forms.TrackBar(); this.arm_left_4 = new System.Windows.Forms.TrackBar(); this.arm_left_3 = new System.Windows.Forms.TrackBar(); this.arm_left_2 = new System.Windows.Forms.TrackBar(); this.arm_left_1 = new System.Windows.Forms.TrackBar(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.label19 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); this.txt_offsety = new System.Windows.Forms.TextBox(); this.txt_offsetx = new System.Windows.Forms.TextBox(); this.btn_hector_offset = new System.Windows.Forms.Button(); this.PencilSize_label = new System.Windows.Forms.Label(); this.track_size = new System.Windows.Forms.TrackBar(); this.button4 = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); this.btn_selectHand = new System.Windows.Forms.Button(); this.btn_selectPencil = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.label11 = new System.Windows.Forms.Label(); this.btn_paint_g = new System.Windows.Forms.Button(); this.btn_paint_w = new System.Windows.Forms.Button(); this.btn_paint_b = new System.Windows.Forms.Button(); this.btn_zoom_out = new System.Windows.Forms.Button(); this.btn_zoom_in = new System.Windows.Forms.Button(); this.btn_show_lables = new System.Windows.Forms.Button(); this.btn_edit_selected = new System.Windows.Forms.Button(); this.btn_delete_selected = new System.Windows.Forms.Button(); this.btn_add_current = new System.Windows.Forms.Button(); this.lst_points = new System.Windows.Forms.ListBox(); this.btn_load_map = new System.Windows.Forms.Button(); this.btn_save_map = new System.Windows.Forms.Button(); this.btn_get_current_map = new System.Windows.Forms.Button(); this.txt_map = new System.Windows.Forms.TextBox(); this.img_map = new System.Windows.Forms.PictureBox(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.rad_stop = new System.Windows.Forms.RadioButton(); this.rad_start = new System.Windows.Forms.RadioButton(); this.btn_m20 = new System.Windows.Forms.Button(); this.label17 = new System.Windows.Forms.Label(); this.btn_m19 = new System.Windows.Forms.Button(); this.label16 = new System.Windows.Forms.Label(); this.btn_m9 = new System.Windows.Forms.Button(); this.btn_m8 = new System.Windows.Forms.Button(); this.btn_m18 = new System.Windows.Forms.Button(); this.label15 = new System.Windows.Forms.Label(); this.btn_m7 = new System.Windows.Forms.Button(); this.btn_m11 = new System.Windows.Forms.Button(); this.btn_m10 = new System.Windows.Forms.Button(); this.label14 = new System.Windows.Forms.Label(); this.btn_m14 = new System.Windows.Forms.Button(); this.btn_m13 = new System.Windows.Forms.Button(); this.label13 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.btn_m2 = new System.Windows.Forms.Button(); this.btn_m15 = new System.Windows.Forms.Button(); this.btn_m16 = new System.Windows.Forms.Button(); this.btn_m12 = new System.Windows.Forms.Button(); this.btn_m17 = new System.Windows.Forms.Button(); this.btn_m5 = new System.Windows.Forms.Button(); this.btn_m4 = new System.Windows.Forms.Button(); this.btn_m3 = new System.Windows.Forms.Button(); this.btn_m6 = new System.Windows.Forms.Button(); this.btn_m1 = new System.Windows.Forms.Button(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.txt_path = new System.Windows.Forms.TextBox(); this.rad_linux = new System.Windows.Forms.RadioButton(); this.rad_windows = new System.Windows.Forms.RadioButton(); this.chk_coonect = new System.Windows.Forms.CheckBox(); this.label10 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.txt_port = new System.Windows.Forms.TextBox(); this.txt_ip = new System.Windows.Forms.TextBox(); this.btn_disconnect = new System.Windows.Forms.Button(); this.btn_connect = new System.Windows.Forms.Button(); this.lst_tcp = new System.Windows.Forms.ListBox(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.tabControl1.SuspendLayout(); this.tab.SuspendLayout(); this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown19)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown20)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown17)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown18)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown15)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown16)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown13)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown14)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown12)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown9)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.robot_z)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_1)).BeginInit(); this.tabPage3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.track_size)).BeginInit(); this.panel2.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.img_map)).BeginInit(); this.tabPage4.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "down.png"); this.imageList1.Images.SetKeyName(1, "left.png"); this.imageList1.Images.SetKeyName(2, "r_left.png"); this.imageList1.Images.SetKeyName(3, "r_right.png"); this.imageList1.Images.SetKeyName(4, "right.png"); this.imageList1.Images.SetKeyName(5, "up.png"); // // tabControl1 // this.tabControl1.Controls.Add(this.tab); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage4); this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage5); this.tabControl1.Location = new System.Drawing.Point(12, 12); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(737, 541); this.tabControl1.TabIndex = 1; // // tab // this.tab.Controls.Add(this.btn_es); this.tab.Controls.Add(this.btn_cancle); this.tab.Controls.Add(this.turn_to); this.tab.Controls.Add(this.txt_move_turnto); this.tab.Controls.Add(this.turn_local); this.tab.Controls.Add(this.txt_move_turnlocal); this.tab.Controls.Add(this.btn_y); this.tab.Controls.Add(this.btn_x); this.tab.Controls.Add(this.txt_move_y); this.tab.Controls.Add(this.txt_move_x); this.tab.Controls.Add(this.laser_9); this.tab.Controls.Add(this.laser_10); this.tab.Controls.Add(this.txt_isobstacle); this.tab.Controls.Add(this.label9); this.tab.Controls.Add(this.txt_isrobotmove); this.tab.Controls.Add(this.label8); this.tab.Controls.Add(this.laser_8); this.tab.Controls.Add(this.laser_7); this.tab.Controls.Add(this.laser_6); this.tab.Controls.Add(this.laser_5); this.tab.Controls.Add(this.laser_4); this.tab.Controls.Add(this.laser_3); this.tab.Controls.Add(this.laser_2); this.tab.Controls.Add(this.label7); this.tab.Controls.Add(this.laser_1); this.tab.Controls.Add(this.label6); this.tab.Controls.Add(this.label5); this.tab.Controls.Add(this.txt_voltage3); this.tab.Controls.Add(this.txt_voltage2); this.tab.Controls.Add(this.txt_voltage1); this.tab.Controls.Add(this.label4); this.tab.Controls.Add(this.label2); this.tab.Controls.Add(this.label1); this.tab.Controls.Add(this.odom2_t); this.tab.Controls.Add(this.odom2_y); this.tab.Controls.Add(this.odom2_x); this.tab.Controls.Add(this.odom1_t); this.tab.Controls.Add(this.odom1_y); this.tab.Controls.Add(this.odom1_x); this.tab.Controls.Add(this.btn_turn_right); this.tab.Controls.Add(this.btn_turn_left); this.tab.Controls.Add(this.btn_stop); this.tab.Controls.Add(this.btn_right); this.tab.Controls.Add(this.btn_down); this.tab.Controls.Add(this.btn_left); this.tab.Controls.Add(this.btn_up); this.tab.Location = new System.Drawing.Point(4, 22); this.tab.Name = "tab"; this.tab.Padding = new System.Windows.Forms.Padding(3); this.tab.Size = new System.Drawing.Size(729, 515); this.tab.TabIndex = 0; this.tab.Text = "Main"; this.tab.UseVisualStyleBackColor = true; // // btn_es // this.btn_es.BackColor = System.Drawing.Color.White; this.btn_es.Location = new System.Drawing.Point(231, 194); this.btn_es.Name = "btn_es"; this.btn_es.Size = new System.Drawing.Size(106, 81); this.btn_es.TabIndex = 49; this.btn_es.Text = "ES"; this.btn_es.UseVisualStyleBackColor = false; this.btn_es.Click += new System.EventHandler(this.btn_es_Click); // // btn_cancle // this.btn_cancle.Location = new System.Drawing.Point(487, 374); this.btn_cancle.Name = "btn_cancle"; this.btn_cancle.Size = new System.Drawing.Size(192, 23); this.btn_cancle.TabIndex = 48; this.btn_cancle.Text = "Cancle Operation"; this.btn_cancle.UseVisualStyleBackColor = true; this.btn_cancle.Click += new System.EventHandler(this.btn_cancle_Click); // // turn_to // this.turn_to.Location = new System.Drawing.Point(487, 338); this.turn_to.Name = "turn_to"; this.turn_to.Size = new System.Drawing.Size(75, 23); this.turn_to.TabIndex = 47; this.turn_to.Text = "Turn_To"; this.turn_to.UseVisualStyleBackColor = true; this.turn_to.Click += new System.EventHandler(this.turn_to_Click); // // txt_move_turnto // this.txt_move_turnto.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_move_turnto.Location = new System.Drawing.Point(579, 333); this.txt_move_turnto.Name = "txt_move_turnto"; this.txt_move_turnto.Size = new System.Drawing.Size(100, 32); this.txt_move_turnto.TabIndex = 46; this.txt_move_turnto.Text = "0"; // // turn_local // this.turn_local.Location = new System.Drawing.Point(487, 300); this.turn_local.Name = "turn_local"; this.turn_local.Size = new System.Drawing.Size(75, 23); this.turn_local.TabIndex = 45; this.turn_local.Text = "Turn_Local"; this.turn_local.UseVisualStyleBackColor = true; this.turn_local.Click += new System.EventHandler(this.turn_local_Click); // // txt_move_turnlocal // this.txt_move_turnlocal.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_move_turnlocal.Location = new System.Drawing.Point(579, 295); this.txt_move_turnlocal.Name = "txt_move_turnlocal"; this.txt_move_turnlocal.Size = new System.Drawing.Size(100, 32); this.txt_move_turnlocal.TabIndex = 44; this.txt_move_turnlocal.Text = "0"; // // btn_y // this.btn_y.Location = new System.Drawing.Point(487, 261); this.btn_y.Name = "btn_y"; this.btn_y.Size = new System.Drawing.Size(75, 23); this.btn_y.TabIndex = 43; this.btn_y.Text = "Move_Y"; this.btn_y.UseVisualStyleBackColor = true; this.btn_y.Click += new System.EventHandler(this.btn_y_Click); // // btn_x // this.btn_x.Location = new System.Drawing.Point(487, 223); this.btn_x.Name = "btn_x"; this.btn_x.Size = new System.Drawing.Size(75, 23); this.btn_x.TabIndex = 42; this.btn_x.Text = "Move_X"; this.btn_x.UseVisualStyleBackColor = true; this.btn_x.Click += new System.EventHandler(this.btn_x_Click); // // txt_move_y // this.txt_move_y.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_move_y.Location = new System.Drawing.Point(579, 256); this.txt_move_y.Name = "txt_move_y"; this.txt_move_y.Size = new System.Drawing.Size(100, 32); this.txt_move_y.TabIndex = 41; this.txt_move_y.Text = "0"; // // txt_move_x // this.txt_move_x.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_move_x.Location = new System.Drawing.Point(579, 218); this.txt_move_x.Name = "txt_move_x"; this.txt_move_x.Size = new System.Drawing.Size(100, 32); this.txt_move_x.TabIndex = 40; this.txt_move_x.Text = "0"; // // laser_9 // this.laser_9.Location = new System.Drawing.Point(487, 174); this.laser_9.Name = "laser_9"; this.laser_9.Size = new System.Drawing.Size(192, 12); this.laser_9.TabIndex = 39; // // laser_10 // this.laser_10.Location = new System.Drawing.Point(487, 191); this.laser_10.Name = "laser_10"; this.laser_10.Size = new System.Drawing.Size(192, 12); this.laser_10.TabIndex = 38; // // txt_isobstacle // this.txt_isobstacle.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_isobstacle.Location = new System.Drawing.Point(375, 364); this.txt_isobstacle.Name = "txt_isobstacle"; this.txt_isobstacle.Size = new System.Drawing.Size(59, 32); this.txt_isobstacle.TabIndex = 37; this.txt_isobstacle.Text = "0"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(292, 374); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(63, 13); this.label9.TabIndex = 36; this.label9.Text = "IsObstacle :"; // // txt_isrobotmove // this.txt_isrobotmove.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_isrobotmove.Location = new System.Drawing.Point(375, 308); this.txt_isrobotmove.Name = "txt_isrobotmove"; this.txt_isrobotmove.Size = new System.Drawing.Size(59, 32); this.txt_isrobotmove.TabIndex = 35; this.txt_isrobotmove.Text = "0"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(292, 318); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(77, 13); this.label8.TabIndex = 34; this.label8.Text = "IsRobotMove :"; // // laser_8 // this.laser_8.Location = new System.Drawing.Point(487, 157); this.laser_8.Name = "laser_8"; this.laser_8.Size = new System.Drawing.Size(192, 12); this.laser_8.TabIndex = 33; // // laser_7 // this.laser_7.Location = new System.Drawing.Point(487, 141); this.laser_7.Name = "laser_7"; this.laser_7.Size = new System.Drawing.Size(192, 12); this.laser_7.TabIndex = 32; // // laser_6 // this.laser_6.Location = new System.Drawing.Point(487, 125); this.laser_6.Name = "laser_6"; this.laser_6.Size = new System.Drawing.Size(192, 12); this.laser_6.TabIndex = 31; // // laser_5 // this.laser_5.Location = new System.Drawing.Point(487, 109); this.laser_5.Name = "laser_5"; this.laser_5.Size = new System.Drawing.Size(192, 12); this.laser_5.TabIndex = 30; // // laser_4 // this.laser_4.Location = new System.Drawing.Point(487, 94); this.laser_4.Name = "laser_4"; this.laser_4.Size = new System.Drawing.Size(192, 12); this.laser_4.TabIndex = 29; // // laser_3 // this.laser_3.Location = new System.Drawing.Point(487, 78); this.laser_3.Name = "laser_3"; this.laser_3.Size = new System.Drawing.Size(192, 12); this.laser_3.TabIndex = 28; // // laser_2 // this.laser_2.Location = new System.Drawing.Point(487, 63); this.laser_2.Name = "laser_2"; this.laser_2.Size = new System.Drawing.Size(192, 12); this.laser_2.TabIndex = 27; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(484, 32); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(83, 13); this.label7.TabIndex = 26; this.label7.Text = "Laser Segments"; // // laser_1 // this.laser_1.Location = new System.Drawing.Point(487, 48); this.laser_1.Name = "laser_1"; this.laser_1.Size = new System.Drawing.Size(192, 12); this.laser_1.TabIndex = 25; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(362, 129); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(101, 13); this.label6.TabIndex = 24; this.label6.Text = "System Voltage (3) :"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(362, 78); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(101, 13); this.label5.TabIndex = 23; this.label5.Text = "System Voltage (2) :"; // // txt_voltage3 // this.txt_voltage3.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_voltage3.Location = new System.Drawing.Point(363, 145); this.txt_voltage3.Name = "txt_voltage3"; this.txt_voltage3.Size = new System.Drawing.Size(100, 32); this.txt_voltage3.TabIndex = 22; this.txt_voltage3.Text = "0"; // // txt_voltage2 // this.txt_voltage2.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_voltage2.Location = new System.Drawing.Point(363, 94); this.txt_voltage2.Name = "txt_voltage2"; this.txt_voltage2.Size = new System.Drawing.Size(100, 32); this.txt_voltage2.TabIndex = 21; this.txt_voltage2.Text = "0"; // // txt_voltage1 // this.txt_voltage1.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_voltage1.Location = new System.Drawing.Point(363, 43); this.txt_voltage1.Name = "txt_voltage1"; this.txt_voltage1.Size = new System.Drawing.Size(100, 32); this.txt_voltage1.TabIndex = 20; this.txt_voltage1.Text = "0"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(360, 27); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(101, 13); this.label4.TabIndex = 19; this.label4.Text = "System Voltage (1) :"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(20, 348); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(96, 13); this.label2.TabIndex = 17; this.label2.Text = "Odometry_Hector :"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(20, 292); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(88, 13); this.label1.TabIndex = 16; this.label1.Text = "Odometry_Base :"; // // odom2_t // this.odom2_t.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.odom2_t.Location = new System.Drawing.Point(202, 364); this.odom2_t.Name = "odom2_t"; this.odom2_t.Size = new System.Drawing.Size(80, 32); this.odom2_t.TabIndex = 12; this.odom2_t.Text = "0"; this.odom2_t.TextChanged += new System.EventHandler(this.textBox4_TextChanged); // // odom2_y // this.odom2_y.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.odom2_y.Location = new System.Drawing.Point(114, 364); this.odom2_y.Name = "odom2_y"; this.odom2_y.Size = new System.Drawing.Size(82, 32); this.odom2_y.TabIndex = 11; this.odom2_y.Text = "0"; this.odom2_y.TextChanged += new System.EventHandler(this.textBox5_TextChanged); // // odom2_x // this.odom2_x.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.odom2_x.Location = new System.Drawing.Point(19, 364); this.odom2_x.Name = "odom2_x"; this.odom2_x.Size = new System.Drawing.Size(89, 32); this.odom2_x.TabIndex = 10; this.odom2_x.Text = "0"; this.odom2_x.TextChanged += new System.EventHandler(this.textBox6_TextChanged); // // odom1_t // this.odom1_t.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.odom1_t.Location = new System.Drawing.Point(202, 308); this.odom1_t.Name = "odom1_t"; this.odom1_t.Size = new System.Drawing.Size(80, 32); this.odom1_t.TabIndex = 9; this.odom1_t.Text = "0"; // // odom1_y // this.odom1_y.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.odom1_y.Location = new System.Drawing.Point(114, 308); this.odom1_y.Name = "odom1_y"; this.odom1_y.Size = new System.Drawing.Size(82, 32); this.odom1_y.TabIndex = 8; this.odom1_y.Text = "0"; // // odom1_x // this.odom1_x.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.odom1_x.Location = new System.Drawing.Point(19, 308); this.odom1_x.Name = "odom1_x"; this.odom1_x.Size = new System.Drawing.Size(89, 32); this.odom1_x.TabIndex = 7; this.odom1_x.Text = "0"; // // btn_turn_right // this.btn_turn_right.BackColor = System.Drawing.Color.White; this.btn_turn_right.ImageIndex = 3; this.btn_turn_right.ImageList = this.imageList1; this.btn_turn_right.Location = new System.Drawing.Point(231, 32); this.btn_turn_right.Name = "btn_turn_right"; this.btn_turn_right.Size = new System.Drawing.Size(106, 81); this.btn_turn_right.TabIndex = 6; this.btn_turn_right.UseVisualStyleBackColor = false; this.btn_turn_right.Click += new System.EventHandler(this.btn_turn_right_Click); // // btn_turn_left // this.btn_turn_left.BackColor = System.Drawing.Color.White; this.btn_turn_left.ImageIndex = 2; this.btn_turn_left.ImageList = this.imageList1; this.btn_turn_left.Location = new System.Drawing.Point(19, 32); this.btn_turn_left.Name = "btn_turn_left"; this.btn_turn_left.Size = new System.Drawing.Size(106, 81); this.btn_turn_left.TabIndex = 5; this.btn_turn_left.UseVisualStyleBackColor = false; this.btn_turn_left.Click += new System.EventHandler(this.btn_turn_left_Click); // // btn_stop // this.btn_stop.BackColor = System.Drawing.Color.White; this.btn_stop.Location = new System.Drawing.Point(125, 111); this.btn_stop.Name = "btn_stop"; this.btn_stop.Size = new System.Drawing.Size(106, 81); this.btn_stop.TabIndex = 4; this.btn_stop.Text = "Stop"; this.btn_stop.UseVisualStyleBackColor = false; this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click); // // btn_right // this.btn_right.BackColor = System.Drawing.Color.White; this.btn_right.ImageIndex = 4; this.btn_right.ImageList = this.imageList1; this.btn_right.Location = new System.Drawing.Point(231, 111); this.btn_right.Name = "btn_right"; this.btn_right.Size = new System.Drawing.Size(106, 81); this.btn_right.TabIndex = 3; this.btn_right.UseVisualStyleBackColor = false; this.btn_right.Click += new System.EventHandler(this.button4_Click); // // btn_down // this.btn_down.BackColor = System.Drawing.Color.White; this.btn_down.ImageIndex = 0; this.btn_down.ImageList = this.imageList1; this.btn_down.Location = new System.Drawing.Point(125, 194); this.btn_down.Name = "btn_down"; this.btn_down.Size = new System.Drawing.Size(106, 81); this.btn_down.TabIndex = 2; this.btn_down.UseVisualStyleBackColor = false; this.btn_down.Click += new System.EventHandler(this.btn_down_Click); // // btn_left // this.btn_left.BackColor = System.Drawing.Color.White; this.btn_left.ImageIndex = 1; this.btn_left.ImageList = this.imageList1; this.btn_left.Location = new System.Drawing.Point(19, 111); this.btn_left.Name = "btn_left"; this.btn_left.Size = new System.Drawing.Size(106, 81); this.btn_left.TabIndex = 1; this.btn_left.UseVisualStyleBackColor = false; this.btn_left.Click += new System.EventHandler(this.btn_left_Click); // // btn_up // this.btn_up.BackColor = System.Drawing.Color.White; this.btn_up.ImageIndex = 5; this.btn_up.ImageList = this.imageList1; this.btn_up.Location = new System.Drawing.Point(125, 32); this.btn_up.Name = "btn_up"; this.btn_up.Size = new System.Drawing.Size(106, 81); this.btn_up.TabIndex = 0; this.btn_up.UseVisualStyleBackColor = false; this.btn_up.Click += new System.EventHandler(this.btn_up_Click); // // tabPage2 // this.tabPage2.Controls.Add(this.numericUpDown19); this.tabPage2.Controls.Add(this.numericUpDown20); this.tabPage2.Controls.Add(this.numericUpDown17); this.tabPage2.Controls.Add(this.numericUpDown18); this.tabPage2.Controls.Add(this.numericUpDown15); this.tabPage2.Controls.Add(this.numericUpDown16); this.tabPage2.Controls.Add(this.numericUpDown13); this.tabPage2.Controls.Add(this.numericUpDown14); this.tabPage2.Controls.Add(this.numericUpDown11); this.tabPage2.Controls.Add(this.numericUpDown12); this.tabPage2.Controls.Add(this.numericUpDown9); this.tabPage2.Controls.Add(this.numericUpDown10); this.tabPage2.Controls.Add(this.numericUpDown7); this.tabPage2.Controls.Add(this.numericUpDown8); this.tabPage2.Controls.Add(this.numericUpDown5); this.tabPage2.Controls.Add(this.numericUpDown6); this.tabPage2.Controls.Add(this.numericUpDown3); this.tabPage2.Controls.Add(this.numericUpDown4); this.tabPage2.Controls.Add(this.numericUpDown2); this.tabPage2.Controls.Add(this.numericUpDown1); this.tabPage2.Controls.Add(this.right_grip_open); this.tabPage2.Controls.Add(this.right_grip_close); this.tabPage2.Controls.Add(this.left_grip_open); this.tabPage2.Controls.Add(this.left_grip_close); this.tabPage2.Controls.Add(this.arm_right_5); this.tabPage2.Controls.Add(this.arm_right_4); this.tabPage2.Controls.Add(this.arm_right_3); this.tabPage2.Controls.Add(this.arm_right_2); this.tabPage2.Controls.Add(this.arm_right_1); this.tabPage2.Controls.Add(this.robot_z); this.tabPage2.Controls.Add(this.arm_left_5); this.tabPage2.Controls.Add(this.arm_left_4); this.tabPage2.Controls.Add(this.arm_left_3); this.tabPage2.Controls.Add(this.arm_left_2); this.tabPage2.Controls.Add(this.arm_left_1); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(729, 515); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Upperbody"; this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.Click += new System.EventHandler(this.tabPage2_Click); // // numericUpDown19 // this.numericUpDown19.Location = new System.Drawing.Point(603, 382); this.numericUpDown19.Name = "numericUpDown19"; this.numericUpDown19.Size = new System.Drawing.Size(100, 20); this.numericUpDown19.TabIndex = 47; // // numericUpDown20 // this.numericUpDown20.Location = new System.Drawing.Point(497, 382); this.numericUpDown20.Name = "numericUpDown20"; this.numericUpDown20.Size = new System.Drawing.Size(100, 20); this.numericUpDown20.TabIndex = 46; // // numericUpDown17 // this.numericUpDown17.Location = new System.Drawing.Point(603, 305); this.numericUpDown17.Name = "numericUpDown17"; this.numericUpDown17.Size = new System.Drawing.Size(100, 20); this.numericUpDown17.TabIndex = 45; // // numericUpDown18 // this.numericUpDown18.Location = new System.Drawing.Point(497, 305); this.numericUpDown18.Name = "numericUpDown18"; this.numericUpDown18.Size = new System.Drawing.Size(100, 20); this.numericUpDown18.TabIndex = 44; // // numericUpDown15 // this.numericUpDown15.Location = new System.Drawing.Point(603, 228); this.numericUpDown15.Name = "numericUpDown15"; this.numericUpDown15.Size = new System.Drawing.Size(100, 20); this.numericUpDown15.TabIndex = 43; // // numericUpDown16 // this.numericUpDown16.Location = new System.Drawing.Point(497, 228); this.numericUpDown16.Name = "numericUpDown16"; this.numericUpDown16.Size = new System.Drawing.Size(100, 20); this.numericUpDown16.TabIndex = 42; // // numericUpDown13 // this.numericUpDown13.Location = new System.Drawing.Point(603, 153); this.numericUpDown13.Name = "numericUpDown13"; this.numericUpDown13.Size = new System.Drawing.Size(100, 20); this.numericUpDown13.TabIndex = 41; // // numericUpDown14 // this.numericUpDown14.Location = new System.Drawing.Point(497, 153); this.numericUpDown14.Name = "numericUpDown14"; this.numericUpDown14.Size = new System.Drawing.Size(100, 20); this.numericUpDown14.TabIndex = 40; // // numericUpDown11 // this.numericUpDown11.Location = new System.Drawing.Point(603, 76); this.numericUpDown11.Name = "numericUpDown11"; this.numericUpDown11.Size = new System.Drawing.Size(100, 20); this.numericUpDown11.TabIndex = 39; // // numericUpDown12 // this.numericUpDown12.Location = new System.Drawing.Point(497, 76); this.numericUpDown12.Name = "numericUpDown12"; this.numericUpDown12.Size = new System.Drawing.Size(100, 20); this.numericUpDown12.TabIndex = 38; // // numericUpDown9 // this.numericUpDown9.Location = new System.Drawing.Point(232, 382); this.numericUpDown9.Name = "numericUpDown9"; this.numericUpDown9.Size = new System.Drawing.Size(100, 20); this.numericUpDown9.TabIndex = 37; // // numericUpDown10 // this.numericUpDown10.Location = new System.Drawing.Point(126, 382); this.numericUpDown10.Name = "numericUpDown10"; this.numericUpDown10.Size = new System.Drawing.Size(100, 20); this.numericUpDown10.TabIndex = 36; // // numericUpDown7 // this.numericUpDown7.Location = new System.Drawing.Point(232, 305); this.numericUpDown7.Name = "numericUpDown7"; this.numericUpDown7.Size = new System.Drawing.Size(100, 20); this.numericUpDown7.TabIndex = 35; // // numericUpDown8 // this.numericUpDown8.Location = new System.Drawing.Point(126, 305); this.numericUpDown8.Name = "numericUpDown8"; this.numericUpDown8.Size = new System.Drawing.Size(100, 20); this.numericUpDown8.TabIndex = 34; // // numericUpDown5 // this.numericUpDown5.Location = new System.Drawing.Point(232, 228); this.numericUpDown5.Name = "numericUpDown5"; this.numericUpDown5.Size = new System.Drawing.Size(100, 20); this.numericUpDown5.TabIndex = 33; // // numericUpDown6 // this.numericUpDown6.Location = new System.Drawing.Point(126, 228); this.numericUpDown6.Name = "numericUpDown6"; this.numericUpDown6.Size = new System.Drawing.Size(100, 20); this.numericUpDown6.TabIndex = 32; // // numericUpDown3 // this.numericUpDown3.Location = new System.Drawing.Point(232, 151); this.numericUpDown3.Name = "numericUpDown3"; this.numericUpDown3.Size = new System.Drawing.Size(100, 20); this.numericUpDown3.TabIndex = 31; // // numericUpDown4 // this.numericUpDown4.Location = new System.Drawing.Point(126, 151); this.numericUpDown4.Name = "numericUpDown4"; this.numericUpDown4.Size = new System.Drawing.Size(100, 20); this.numericUpDown4.TabIndex = 30; // // numericUpDown2 // this.numericUpDown2.Location = new System.Drawing.Point(232, 75); this.numericUpDown2.Name = "numericUpDown2"; this.numericUpDown2.Size = new System.Drawing.Size(100, 20); this.numericUpDown2.TabIndex = 29; // // numericUpDown1 // this.numericUpDown1.Location = new System.Drawing.Point(126, 75); this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Size = new System.Drawing.Size(100, 20); this.numericUpDown1.TabIndex = 28; // // right_grip_open // this.right_grip_open.Location = new System.Drawing.Point(389, 424); this.right_grip_open.Name = "right_grip_open"; this.right_grip_open.Size = new System.Drawing.Size(156, 32); this.right_grip_open.TabIndex = 19; this.right_grip_open.Text = "Grip Open"; this.right_grip_open.UseVisualStyleBackColor = true; // // right_grip_close // this.right_grip_close.Location = new System.Drawing.Point(547, 424); this.right_grip_close.Name = "right_grip_close"; this.right_grip_close.Size = new System.Drawing.Size(156, 32); this.right_grip_close.TabIndex = 18; this.right_grip_close.Text = "Grip Close"; this.right_grip_close.UseVisualStyleBackColor = true; // // left_grip_open // this.left_grip_open.Location = new System.Drawing.Point(18, 424); this.left_grip_open.Name = "left_grip_open"; this.left_grip_open.Size = new System.Drawing.Size(156, 32); this.left_grip_open.TabIndex = 17; this.left_grip_open.Text = "Grip Open"; this.left_grip_open.UseVisualStyleBackColor = true; // // left_grip_close // this.left_grip_close.Location = new System.Drawing.Point(176, 424); this.left_grip_close.Name = "left_grip_close"; this.left_grip_close.Size = new System.Drawing.Size(156, 32); this.left_grip_close.TabIndex = 16; this.left_grip_close.Text = "Grip Close"; this.left_grip_close.UseVisualStyleBackColor = true; // // arm_right_5 // this.arm_right_5.Location = new System.Drawing.Point(389, 331); this.arm_right_5.Name = "arm_right_5"; this.arm_right_5.Size = new System.Drawing.Size(314, 45); this.arm_right_5.TabIndex = 15; // // arm_right_4 // this.arm_right_4.Location = new System.Drawing.Point(389, 254); this.arm_right_4.Name = "arm_right_4"; this.arm_right_4.Size = new System.Drawing.Size(314, 45); this.arm_right_4.TabIndex = 14; // // arm_right_3 // this.arm_right_3.Location = new System.Drawing.Point(389, 177); this.arm_right_3.Name = "arm_right_3"; this.arm_right_3.Size = new System.Drawing.Size(314, 45); this.arm_right_3.TabIndex = 13; // // arm_right_2 // this.arm_right_2.Location = new System.Drawing.Point(389, 102); this.arm_right_2.Name = "arm_right_2"; this.arm_right_2.Size = new System.Drawing.Size(314, 45); this.arm_right_2.TabIndex = 12; // // arm_right_1 // this.arm_right_1.Location = new System.Drawing.Point(389, 24); this.arm_right_1.Name = "arm_right_1"; this.arm_right_1.Size = new System.Drawing.Size(314, 45); this.arm_right_1.TabIndex = 11; // // robot_z // this.robot_z.Location = new System.Drawing.Point(338, 24); this.robot_z.Name = "robot_z"; this.robot_z.Orientation = System.Windows.Forms.Orientation.Vertical; this.robot_z.Size = new System.Drawing.Size(45, 352); this.robot_z.TabIndex = 10; // // arm_left_5 // this.arm_left_5.Location = new System.Drawing.Point(18, 331); this.arm_left_5.Name = "arm_left_5"; this.arm_left_5.Size = new System.Drawing.Size(314, 45); this.arm_left_5.TabIndex = 4; // // arm_left_4 // this.arm_left_4.Location = new System.Drawing.Point(18, 254); this.arm_left_4.Name = "arm_left_4"; this.arm_left_4.Size = new System.Drawing.Size(314, 45); this.arm_left_4.TabIndex = 3; // // arm_left_3 // this.arm_left_3.Location = new System.Drawing.Point(18, 177); this.arm_left_3.Name = "arm_left_3"; this.arm_left_3.Size = new System.Drawing.Size(314, 45); this.arm_left_3.TabIndex = 2; // // arm_left_2 // this.arm_left_2.Location = new System.Drawing.Point(18, 102); this.arm_left_2.Name = "arm_left_2"; this.arm_left_2.Size = new System.Drawing.Size(314, 45); this.arm_left_2.TabIndex = 1; // // arm_left_1 // this.arm_left_1.Location = new System.Drawing.Point(18, 26); this.arm_left_1.Name = "arm_left_1"; this.arm_left_1.Size = new System.Drawing.Size(314, 45); this.arm_left_1.TabIndex = 0; // // tabPage3 // this.tabPage3.Controls.Add(this.label19); this.tabPage3.Controls.Add(this.label18); this.tabPage3.Controls.Add(this.txt_offsety); this.tabPage3.Controls.Add(this.txt_offsetx); this.tabPage3.Controls.Add(this.btn_hector_offset); this.tabPage3.Controls.Add(this.PencilSize_label); this.tabPage3.Controls.Add(this.track_size); this.tabPage3.Controls.Add(this.button4); this.tabPage3.Controls.Add(this.panel2); this.tabPage3.Controls.Add(this.panel1); this.tabPage3.Controls.Add(this.btn_show_lables); this.tabPage3.Controls.Add(this.btn_edit_selected); this.tabPage3.Controls.Add(this.btn_delete_selected); this.tabPage3.Controls.Add(this.btn_add_current); this.tabPage3.Controls.Add(this.lst_points); this.tabPage3.Controls.Add(this.btn_load_map); this.tabPage3.Controls.Add(this.btn_save_map); this.tabPage3.Controls.Add(this.btn_get_current_map); this.tabPage3.Controls.Add(this.txt_map); this.tabPage3.Controls.Add(this.img_map); this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Name = "tabPage3"; this.tabPage3.Padding = new System.Windows.Forms.Padding(3); this.tabPage3.Size = new System.Drawing.Size(729, 515); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Maptools"; this.tabPage3.UseVisualStyleBackColor = true; // // label19 // this.label19.AutoSize = true; this.label19.Location = new System.Drawing.Point(278, 465); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(15, 13); this.label19.TabIndex = 25; this.label19.Text = "y:"; // // label18 // this.label18.AutoSize = true; this.label18.Location = new System.Drawing.Point(171, 465); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(15, 13); this.label18.TabIndex = 24; this.label18.Text = "x:"; // // txt_offsety // this.txt_offsety.Location = new System.Drawing.Point(278, 480); this.txt_offsety.Name = "txt_offsety"; this.txt_offsety.Size = new System.Drawing.Size(100, 20); this.txt_offsety.TabIndex = 23; // // txt_offsetx // this.txt_offsetx.Location = new System.Drawing.Point(172, 480); this.txt_offsetx.Name = "txt_offsetx"; this.txt_offsetx.Size = new System.Drawing.Size(100, 20); this.txt_offsetx.TabIndex = 22; // // btn_hector_offset // this.btn_hector_offset.Location = new System.Drawing.Point(6, 465); this.btn_hector_offset.Name = "btn_hector_offset"; this.btn_hector_offset.Size = new System.Drawing.Size(159, 38); this.btn_hector_offset.TabIndex = 21; this.btn_hector_offset.Text = "hector Set Offset"; this.btn_hector_offset.UseVisualStyleBackColor = true; this.btn_hector_offset.Click += new System.EventHandler(this.btn_hector_offset_Click); // // PencilSize_label // this.PencilSize_label.AutoSize = true; this.PencilSize_label.Location = new System.Drawing.Point(55, 414); this.PencilSize_label.Name = "PencilSize_label"; this.PencilSize_label.Size = new System.Drawing.Size(65, 13); this.PencilSize_label.TabIndex = 16; this.PencilSize_label.Text = "Pencil Size: "; // // track_size // this.track_size.Location = new System.Drawing.Point(126, 411); this.track_size.Minimum = 1; this.track_size.Name = "track_size"; this.track_size.Size = new System.Drawing.Size(207, 45); this.track_size.TabIndex = 18; this.track_size.Value = 4; this.track_size.Scroll += new System.EventHandler(this.track_size_Scroll); // // button4 // this.button4.Location = new System.Drawing.Point(600, 210); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(114, 37); this.button4.TabIndex = 20; this.button4.Text = "Add New"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click_1); // // panel2 // this.panel2.Controls.Add(this.btn_selectHand); this.panel2.Controls.Add(this.btn_selectPencil); this.panel2.Location = new System.Drawing.Point(6, 55); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(41, 350); this.panel2.TabIndex = 19; // // btn_selectHand // this.btn_selectHand.Location = new System.Drawing.Point(8, 3); this.btn_selectHand.Name = "btn_selectHand"; this.btn_selectHand.Size = new System.Drawing.Size(25, 25); this.btn_selectHand.TabIndex = 9; this.btn_selectHand.Text = "H"; this.btn_selectHand.UseVisualStyleBackColor = true; this.btn_selectHand.Click += new System.EventHandler(this.btn_selectHand_Click); // // btn_selectPencil // this.btn_selectPencil.Enabled = false; this.btn_selectPencil.Location = new System.Drawing.Point(8, 32); this.btn_selectPencil.Name = "btn_selectPencil"; this.btn_selectPencil.Size = new System.Drawing.Size(25, 25); this.btn_selectPencil.TabIndex = 8; this.btn_selectPencil.Text = "P"; this.btn_selectPencil.UseVisualStyleBackColor = true; this.btn_selectPencil.Click += new System.EventHandler(this.btn_selectPencil_Click); // // panel1 // this.panel1.Controls.Add(this.label11); this.panel1.Controls.Add(this.btn_paint_g); this.panel1.Controls.Add(this.btn_paint_w); this.panel1.Controls.Add(this.btn_paint_b); this.panel1.Controls.Add(this.btn_zoom_out); this.panel1.Controls.Add(this.btn_zoom_in); this.panel1.Location = new System.Drawing.Point(54, 6); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(350, 43); this.panel1.TabIndex = 18; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(12, 14); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(40, 13); this.label11.TabIndex = 21; this.label11.Text = "Zoom :"; // // btn_paint_g // this.btn_paint_g.Location = new System.Drawing.Point(306, 4); this.btn_paint_g.Name = "btn_paint_g"; this.btn_paint_g.Size = new System.Drawing.Size(38, 35); this.btn_paint_g.TabIndex = 9; this.btn_paint_g.Text = "G"; this.btn_paint_g.UseVisualStyleBackColor = true; this.btn_paint_g.Click += new System.EventHandler(this.btn_paint_g_Click); // // btn_paint_w // this.btn_paint_w.Enabled = false; this.btn_paint_w.Location = new System.Drawing.Point(215, 3); this.btn_paint_w.Name = "btn_paint_w"; this.btn_paint_w.Size = new System.Drawing.Size(41, 36); this.btn_paint_w.TabIndex = 7; this.btn_paint_w.Text = "W"; this.btn_paint_w.UseVisualStyleBackColor = true; this.btn_paint_w.Click += new System.EventHandler(this.btn_paint_w_Click); // // btn_paint_b // this.btn_paint_b.Location = new System.Drawing.Point(263, 4); this.btn_paint_b.Name = "btn_paint_b"; this.btn_paint_b.Size = new System.Drawing.Size(37, 35); this.btn_paint_b.TabIndex = 8; this.btn_paint_b.Text = "B"; this.btn_paint_b.UseVisualStyleBackColor = true; this.btn_paint_b.Click += new System.EventHandler(this.btn_paint_b_Click); // // btn_zoom_out // this.btn_zoom_out.Enabled = false; this.btn_zoom_out.Location = new System.Drawing.Point(104, 4); this.btn_zoom_out.Name = "btn_zoom_out"; this.btn_zoom_out.Size = new System.Drawing.Size(40, 35); this.btn_zoom_out.TabIndex = 2; this.btn_zoom_out.Text = "-"; this.btn_zoom_out.UseVisualStyleBackColor = true; this.btn_zoom_out.Click += new System.EventHandler(this.btn_zoom_out_Click); // // btn_zoom_in // this.btn_zoom_in.Enabled = false; this.btn_zoom_in.Location = new System.Drawing.Point(58, 4); this.btn_zoom_in.Name = "btn_zoom_in"; this.btn_zoom_in.Size = new System.Drawing.Size(40, 35); this.btn_zoom_in.TabIndex = 1; this.btn_zoom_in.Text = "+"; this.btn_zoom_in.UseVisualStyleBackColor = true; this.btn_zoom_in.Click += new System.EventHandler(this.btn_zoom_in_Click); // // btn_show_lables // this.btn_show_lables.Location = new System.Drawing.Point(600, 396); this.btn_show_lables.Name = "btn_show_lables"; this.btn_show_lables.Size = new System.Drawing.Size(114, 37); this.btn_show_lables.TabIndex = 15; this.btn_show_lables.Text = "Navigate To"; this.btn_show_lables.UseVisualStyleBackColor = true; // // btn_edit_selected // this.btn_edit_selected.Location = new System.Drawing.Point(600, 253); this.btn_edit_selected.Name = "btn_edit_selected"; this.btn_edit_selected.Size = new System.Drawing.Size(114, 37); this.btn_edit_selected.TabIndex = 14; this.btn_edit_selected.Text = "Edit Selected"; this.btn_edit_selected.UseVisualStyleBackColor = true; this.btn_edit_selected.Click += new System.EventHandler(this.btn_edit_selected_Click); // // btn_delete_selected // this.btn_delete_selected.Location = new System.Drawing.Point(600, 296); this.btn_delete_selected.Name = "btn_delete_selected"; this.btn_delete_selected.Size = new System.Drawing.Size(114, 37); this.btn_delete_selected.TabIndex = 13; this.btn_delete_selected.Text = "Delete Selected"; this.btn_delete_selected.UseVisualStyleBackColor = true; this.btn_delete_selected.Click += new System.EventHandler(this.btn_delete_selected_Click); // // btn_add_current // this.btn_add_current.Location = new System.Drawing.Point(600, 167); this.btn_add_current.Name = "btn_add_current"; this.btn_add_current.Size = new System.Drawing.Size(114, 37); this.btn_add_current.TabIndex = 11; this.btn_add_current.Text = "Add Current"; this.btn_add_current.UseVisualStyleBackColor = true; this.btn_add_current.Click += new System.EventHandler(this.btn_add_current_Click); // // lst_points // this.lst_points.FormattingEnabled = true; this.lst_points.Location = new System.Drawing.Point(427, 169); this.lst_points.Name = "lst_points"; this.lst_points.Size = new System.Drawing.Size(167, 264); this.lst_points.TabIndex = 10; this.lst_points.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lst_points_MouseDoubleClick); // // btn_load_map // this.btn_load_map.Location = new System.Drawing.Point(427, 118); this.btn_load_map.Name = "btn_load_map"; this.btn_load_map.Size = new System.Drawing.Size(287, 45); this.btn_load_map.TabIndex = 6; this.btn_load_map.Text = "Load Map"; this.btn_load_map.UseVisualStyleBackColor = true; this.btn_load_map.Click += new System.EventHandler(this.btn_load_map_Click); // // btn_save_map // this.btn_save_map.Enabled = false; this.btn_save_map.Location = new System.Drawing.Point(427, 67); this.btn_save_map.Name = "btn_save_map"; this.btn_save_map.Size = new System.Drawing.Size(287, 45); this.btn_save_map.TabIndex = 5; this.btn_save_map.Text = "Save Map"; this.btn_save_map.UseVisualStyleBackColor = true; this.btn_save_map.Click += new System.EventHandler(this.btn_save_map_Click); // // btn_get_current_map // this.btn_get_current_map.Location = new System.Drawing.Point(427, 16); this.btn_get_current_map.Name = "btn_get_current_map"; this.btn_get_current_map.Size = new System.Drawing.Size(287, 45); this.btn_get_current_map.TabIndex = 4; this.btn_get_current_map.Text = "Get Current Map"; this.btn_get_current_map.UseVisualStyleBackColor = true; this.btn_get_current_map.Click += new System.EventHandler(this.btn_get_current_map_Click); // // txt_map // this.txt_map.Location = new System.Drawing.Point(339, 411); this.txt_map.Name = "txt_map"; this.txt_map.Size = new System.Drawing.Size(65, 20); this.txt_map.TabIndex = 3; // // img_map // this.img_map.Location = new System.Drawing.Point(54, 55); this.img_map.Name = "img_map"; this.img_map.Size = new System.Drawing.Size(350, 350); this.img_map.TabIndex = 0; this.img_map.TabStop = false; this.img_map.MouseDown += new System.Windows.Forms.MouseEventHandler(this.img_map_MouseDown); this.img_map.MouseMove += new System.Windows.Forms.MouseEventHandler(this.img_map_MouseMove); this.img_map.MouseUp += new System.Windows.Forms.MouseEventHandler(this.img_map_MouseUp); // // tabPage4 // this.tabPage4.Controls.Add(this.rad_stop); this.tabPage4.Controls.Add(this.rad_start); this.tabPage4.Controls.Add(this.btn_m20); this.tabPage4.Controls.Add(this.label17); this.tabPage4.Controls.Add(this.btn_m19); this.tabPage4.Controls.Add(this.label16); this.tabPage4.Controls.Add(this.btn_m9); this.tabPage4.Controls.Add(this.btn_m8); this.tabPage4.Controls.Add(this.btn_m18); this.tabPage4.Controls.Add(this.label15); this.tabPage4.Controls.Add(this.btn_m7); this.tabPage4.Controls.Add(this.btn_m11); this.tabPage4.Controls.Add(this.btn_m10); this.tabPage4.Controls.Add(this.label14); this.tabPage4.Controls.Add(this.btn_m14); this.tabPage4.Controls.Add(this.btn_m13); this.tabPage4.Controls.Add(this.label13); this.tabPage4.Controls.Add(this.label12); this.tabPage4.Controls.Add(this.btn_m2); this.tabPage4.Controls.Add(this.btn_m15); this.tabPage4.Controls.Add(this.btn_m16); this.tabPage4.Controls.Add(this.btn_m12); this.tabPage4.Controls.Add(this.btn_m17); this.tabPage4.Controls.Add(this.btn_m5); this.tabPage4.Controls.Add(this.btn_m4); this.tabPage4.Controls.Add(this.btn_m3); this.tabPage4.Controls.Add(this.btn_m6); this.tabPage4.Controls.Add(this.btn_m1); this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Name = "tabPage4"; this.tabPage4.Padding = new System.Windows.Forms.Padding(3); this.tabPage4.Size = new System.Drawing.Size(729, 515); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "Managment"; this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.Click += new System.EventHandler(this.tabPage4_Click); // // rad_stop // this.rad_stop.AutoSize = true; this.rad_stop.Location = new System.Drawing.Point(24, 447); this.rad_stop.Name = "rad_stop"; this.rad_stop.Size = new System.Drawing.Size(47, 17); this.rad_stop.TabIndex = 28; this.rad_stop.Text = "Stop"; this.rad_stop.UseVisualStyleBackColor = true; // // rad_start // this.rad_start.AutoSize = true; this.rad_start.Checked = true; this.rad_start.Location = new System.Drawing.Point(24, 415); this.rad_start.Name = "rad_start"; this.rad_start.Size = new System.Drawing.Size(47, 17); this.rad_start.TabIndex = 27; this.rad_start.TabStop = true; this.rad_start.Text = "Start"; this.rad_start.UseVisualStyleBackColor = true; // // btn_m20 // this.btn_m20.BackColor = System.Drawing.Color.Black; this.btn_m20.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m20.ForeColor = System.Drawing.Color.White; this.btn_m20.Location = new System.Drawing.Point(462, 295); this.btn_m20.Name = "btn_m20"; this.btn_m20.Size = new System.Drawing.Size(127, 37); this.btn_m20.TabIndex = 26; this.btn_m20.Text = "Main [20]"; this.btn_m20.UseVisualStyleBackColor = false; this.btn_m20.Click += new System.EventHandler(this.btn_m20_Click); // // label17 // this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(459, 277); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(55, 13); this.label17.TabIndex = 25; this.label17.Text = "Scenario :"; // // btn_m19 // this.btn_m19.BackColor = System.Drawing.Color.Black; this.btn_m19.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m19.ForeColor = System.Drawing.Color.White; this.btn_m19.Location = new System.Drawing.Point(462, 127); this.btn_m19.Name = "btn_m19"; this.btn_m19.Size = new System.Drawing.Size(127, 37); this.btn_m19.TabIndex = 24; this.btn_m19.Text = "Human Core [19]"; this.btn_m19.UseVisualStyleBackColor = false; this.btn_m19.Click += new System.EventHandler(this.btn_m19_Click); // // label16 // this.label16.AutoSize = true; this.label16.Location = new System.Drawing.Point(459, 108); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(47, 13); this.label16.TabIndex = 23; this.label16.Text = "Human :"; // // btn_m9 // this.btn_m9.BackColor = System.Drawing.Color.Black; this.btn_m9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m9.ForeColor = System.Drawing.Color.White; this.btn_m9.Location = new System.Drawing.Point(291, 127); this.btn_m9.Name = "btn_m9"; this.btn_m9.Size = new System.Drawing.Size(127, 37); this.btn_m9.TabIndex = 22; this.btn_m9.Text = "Watch dog [9]"; this.btn_m9.UseVisualStyleBackColor = false; this.btn_m9.Click += new System.EventHandler(this.btn_m9_Click); // // btn_m8 // this.btn_m8.BackColor = System.Drawing.Color.Black; this.btn_m8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m8.ForeColor = System.Drawing.Color.White; this.btn_m8.Location = new System.Drawing.Point(157, 127); this.btn_m8.Name = "btn_m8"; this.btn_m8.Size = new System.Drawing.Size(127, 37); this.btn_m8.TabIndex = 21; this.btn_m8.Text = "Odometry [8]"; this.btn_m8.UseVisualStyleBackColor = false; this.btn_m8.Click += new System.EventHandler(this.btn_m8_Click); // // btn_m18 // this.btn_m18.BackColor = System.Drawing.Color.Black; this.btn_m18.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m18.ForeColor = System.Drawing.Color.White; this.btn_m18.Location = new System.Drawing.Point(462, 41); this.btn_m18.Name = "btn_m18"; this.btn_m18.Size = new System.Drawing.Size(127, 37); this.btn_m18.TabIndex = 20; this.btn_m18.Text = "Object Recognition [18]"; this.btn_m18.UseVisualStyleBackColor = false; this.btn_m18.Click += new System.EventHandler(this.btn_m18_Click); // // label15 // this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(459, 25); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(44, 13); this.label15.TabIndex = 19; this.label15.Text = "Object :"; // // btn_m7 // this.btn_m7.BackColor = System.Drawing.Color.Black; this.btn_m7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m7.ForeColor = System.Drawing.Color.White; this.btn_m7.Location = new System.Drawing.Point(24, 127); this.btn_m7.Name = "btn_m7"; this.btn_m7.Size = new System.Drawing.Size(127, 37); this.btn_m7.TabIndex = 18; this.btn_m7.Text = "TCP/IP Core [7]"; this.btn_m7.UseVisualStyleBackColor = false; this.btn_m7.Click += new System.EventHandler(this.btn_m7_Click); // // btn_m11 // this.btn_m11.BackColor = System.Drawing.Color.Black; this.btn_m11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m11.ForeColor = System.Drawing.Color.White; this.btn_m11.Location = new System.Drawing.Point(157, 210); this.btn_m11.Name = "btn_m11"; this.btn_m11.Size = new System.Drawing.Size(127, 37); this.btn_m11.TabIndex = 16; this.btn_m11.Text = "WebSocket [11]"; this.btn_m11.UseVisualStyleBackColor = false; this.btn_m11.Click += new System.EventHandler(this.btn_m11_Click); // // btn_m10 // this.btn_m10.BackColor = System.Drawing.Color.Black; this.btn_m10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m10.ForeColor = System.Drawing.Color.White; this.btn_m10.Location = new System.Drawing.Point(24, 210); this.btn_m10.Name = "btn_m10"; this.btn_m10.Size = new System.Drawing.Size(127, 37); this.btn_m10.TabIndex = 15; this.btn_m10.Text = "TTS Controller [10]"; this.btn_m10.UseVisualStyleBackColor = false; this.btn_m10.Click += new System.EventHandler(this.btn_m10_Click); // // label14 // this.label14.AutoSize = true; this.label14.Location = new System.Drawing.Point(21, 194); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(50, 13); this.label14.TabIndex = 14; this.label14.Text = "Speech :"; // // btn_m14 // this.btn_m14.BackColor = System.Drawing.Color.Black; this.btn_m14.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m14.ForeColor = System.Drawing.Color.White; this.btn_m14.Location = new System.Drawing.Point(291, 295); this.btn_m14.Name = "btn_m14"; this.btn_m14.Size = new System.Drawing.Size(127, 37); this.btn_m14.TabIndex = 13; this.btn_m14.Text = "HectorMain [14]"; this.btn_m14.UseVisualStyleBackColor = false; this.btn_m14.Click += new System.EventHandler(this.btn_m14_Click); // // btn_m13 // this.btn_m13.BackColor = System.Drawing.Color.Black; this.btn_m13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m13.ForeColor = System.Drawing.Color.White; this.btn_m13.Location = new System.Drawing.Point(157, 295); this.btn_m13.Name = "btn_m13"; this.btn_m13.Size = new System.Drawing.Size(127, 37); this.btn_m13.TabIndex = 12; this.btn_m13.Text = "Hector Rec [13]"; this.btn_m13.UseVisualStyleBackColor = false; this.btn_m13.Click += new System.EventHandler(this.btn_m13_Click); // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(21, 277); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(64, 13); this.label13.TabIndex = 11; this.label13.Text = "Navigation :"; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(21, 25); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(37, 13); this.label12.TabIndex = 10; this.label12.Text = "DCM :"; // // btn_m2 // this.btn_m2.BackColor = System.Drawing.Color.Black; this.btn_m2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m2.ForeColor = System.Drawing.Color.White; this.btn_m2.Location = new System.Drawing.Point(157, 41); this.btn_m2.Name = "btn_m2"; this.btn_m2.Size = new System.Drawing.Size(127, 37); this.btn_m2.TabIndex = 9; this.btn_m2.Text = "Kinect Xbox360 [2]"; this.btn_m2.UseVisualStyleBackColor = false; this.btn_m2.Click += new System.EventHandler(this.btn_m2_Click); // // btn_m15 // this.btn_m15.BackColor = System.Drawing.Color.Black; this.btn_m15.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m15.ForeColor = System.Drawing.Color.White; this.btn_m15.Location = new System.Drawing.Point(24, 338); this.btn_m15.Name = "btn_m15"; this.btn_m15.Size = new System.Drawing.Size(127, 37); this.btn_m15.TabIndex = 8; this.btn_m15.Text = "Map Engine [15]"; this.btn_m15.UseVisualStyleBackColor = false; this.btn_m15.Click += new System.EventHandler(this.btn_m15_Click); // // btn_m16 // this.btn_m16.BackColor = System.Drawing.Color.Black; this.btn_m16.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m16.ForeColor = System.Drawing.Color.White; this.btn_m16.Location = new System.Drawing.Point(157, 338); this.btn_m16.Name = "btn_m16"; this.btn_m16.Size = new System.Drawing.Size(127, 37); this.btn_m16.TabIndex = 7; this.btn_m16.Text = "Move Base [16]"; this.btn_m16.UseVisualStyleBackColor = false; this.btn_m16.Click += new System.EventHandler(this.btn_m16_Click); // // btn_m12 // this.btn_m12.BackColor = System.Drawing.Color.Black; this.btn_m12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m12.ForeColor = System.Drawing.Color.White; this.btn_m12.Location = new System.Drawing.Point(24, 295); this.btn_m12.Name = "btn_m12"; this.btn_m12.Size = new System.Drawing.Size(127, 37); this.btn_m12.TabIndex = 6; this.btn_m12.Text = "Hector Calib [12]"; this.btn_m12.UseVisualStyleBackColor = false; this.btn_m12.Click += new System.EventHandler(this.btn_m12_Click); // // btn_m17 // this.btn_m17.BackColor = System.Drawing.Color.Black; this.btn_m17.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m17.ForeColor = System.Drawing.Color.White; this.btn_m17.Location = new System.Drawing.Point(291, 338); this.btn_m17.Name = "btn_m17"; this.btn_m17.Size = new System.Drawing.Size(127, 37); this.btn_m17.TabIndex = 5; this.btn_m17.Text = "Sepanta Move [17]"; this.btn_m17.UseVisualStyleBackColor = false; this.btn_m17.Click += new System.EventHandler(this.btn_m17_Click); // // btn_m5 // this.btn_m5.BackColor = System.Drawing.Color.Black; this.btn_m5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m5.ForeColor = System.Drawing.Color.White; this.btn_m5.Location = new System.Drawing.Point(157, 84); this.btn_m5.Name = "btn_m5"; this.btn_m5.Size = new System.Drawing.Size(127, 37); this.btn_m5.TabIndex = 4; this.btn_m5.Text = "Upperbodycore [5]"; this.btn_m5.UseVisualStyleBackColor = false; this.btn_m5.Click += new System.EventHandler(this.btn_m5_Click); // // btn_m4 // this.btn_m4.BackColor = System.Drawing.Color.Black; this.btn_m4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m4.ForeColor = System.Drawing.Color.White; this.btn_m4.Location = new System.Drawing.Point(24, 84); this.btn_m4.Name = "btn_m4"; this.btn_m4.Size = new System.Drawing.Size(127, 37); this.btn_m4.TabIndex = 3; this.btn_m4.Text = "Lowerbodycore [4]"; this.btn_m4.UseVisualStyleBackColor = false; this.btn_m4.Click += new System.EventHandler(this.btn_m4_Click); // // btn_m3 // this.btn_m3.BackColor = System.Drawing.Color.Black; this.btn_m3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m3.ForeColor = System.Drawing.Color.White; this.btn_m3.Location = new System.Drawing.Point(291, 41); this.btn_m3.Name = "btn_m3"; this.btn_m3.Size = new System.Drawing.Size(127, 37); this.btn_m3.TabIndex = 2; this.btn_m3.Text = "Dynamixel Motors [3]"; this.btn_m3.UseVisualStyleBackColor = false; this.btn_m3.Click += new System.EventHandler(this.btn_m3_Click); // // btn_m6 // this.btn_m6.BackColor = System.Drawing.Color.Black; this.btn_m6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m6.ForeColor = System.Drawing.Color.White; this.btn_m6.Location = new System.Drawing.Point(291, 84); this.btn_m6.Name = "btn_m6"; this.btn_m6.Size = new System.Drawing.Size(127, 37); this.btn_m6.TabIndex = 1; this.btn_m6.Text = "Laser [6]"; this.btn_m6.UseVisualStyleBackColor = false; this.btn_m6.Click += new System.EventHandler(this.btn_m6_Click); // // btn_m1 // this.btn_m1.BackColor = System.Drawing.Color.Black; this.btn_m1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_m1.ForeColor = System.Drawing.Color.White; this.btn_m1.Location = new System.Drawing.Point(24, 41); this.btn_m1.Name = "btn_m1"; this.btn_m1.Size = new System.Drawing.Size(127, 37); this.btn_m1.TabIndex = 0; this.btn_m1.Text = "Kinect V 2.0 [1]"; this.btn_m1.UseVisualStyleBackColor = false; this.btn_m1.Click += new System.EventHandler(this.btn_m1_Click); // // tabPage1 // this.tabPage1.Controls.Add(this.txt_path); this.tabPage1.Controls.Add(this.rad_linux); this.tabPage1.Controls.Add(this.rad_windows); this.tabPage1.Controls.Add(this.chk_coonect); this.tabPage1.Controls.Add(this.label10); this.tabPage1.Controls.Add(this.label3); this.tabPage1.Controls.Add(this.txt_port); this.tabPage1.Controls.Add(this.txt_ip); this.tabPage1.Controls.Add(this.btn_disconnect); this.tabPage1.Controls.Add(this.btn_connect); this.tabPage1.Controls.Add(this.lst_tcp); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(729, 515); this.tabPage1.TabIndex = 4; this.tabPage1.Text = "TCP_Client"; this.tabPage1.UseVisualStyleBackColor = true; // // txt_path // this.txt_path.Location = new System.Drawing.Point(460, 22); this.txt_path.Name = "txt_path"; this.txt_path.ReadOnly = true; this.txt_path.Size = new System.Drawing.Size(244, 20); this.txt_path.TabIndex = 12; // // rad_linux // this.rad_linux.AutoSize = true; this.rad_linux.Location = new System.Drawing.Point(352, 43); this.rad_linux.Name = "rad_linux"; this.rad_linux.Size = new System.Drawing.Size(74, 17); this.rad_linux.TabIndex = 11; this.rad_linux.TabStop = true; this.rad_linux.Text = "Linux path"; this.rad_linux.UseVisualStyleBackColor = true; this.rad_linux.CheckedChanged += new System.EventHandler(this.rad_linux_CheckedChanged); // // rad_windows // this.rad_windows.AutoSize = true; this.rad_windows.Location = new System.Drawing.Point(352, 21); this.rad_windows.Name = "rad_windows"; this.rad_windows.Size = new System.Drawing.Size(93, 17); this.rad_windows.TabIndex = 10; this.rad_windows.TabStop = true; this.rad_windows.Text = "Windows path"; this.rad_windows.UseVisualStyleBackColor = true; this.rad_windows.CheckedChanged += new System.EventHandler(this.rad_windows_CheckedChanged); // // chk_coonect // this.chk_coonect.AutoSize = true; this.chk_coonect.Checked = true; this.chk_coonect.CheckState = System.Windows.Forms.CheckState.Checked; this.chk_coonect.Location = new System.Drawing.Point(227, 22); this.chk_coonect.Name = "chk_coonect"; this.chk_coonect.Size = new System.Drawing.Size(105, 17); this.chk_coonect.TabIndex = 9; this.chk_coonect.Text = "Auto Connection"; this.chk_coonect.UseVisualStyleBackColor = true; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(6, 128); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(96, 13); this.label10.TabIndex = 8; this.label10.Text = "TCP Remote Port :"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(6, 76); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(87, 13); this.label3.TabIndex = 7; this.label3.Text = "TCP Remote IP :"; this.label3.Click += new System.EventHandler(this.label3_Click); // // txt_port // this.txt_port.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_port.Location = new System.Drawing.Point(6, 144); this.txt_port.Name = "txt_port"; this.txt_port.Size = new System.Drawing.Size(203, 29); this.txt_port.TabIndex = 6; this.txt_port.Text = "3000"; // // txt_ip // this.txt_ip.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_ip.Location = new System.Drawing.Point(6, 92); this.txt_ip.Name = "txt_ip"; this.txt_ip.Size = new System.Drawing.Size(203, 29); this.txt_ip.TabIndex = 4; this.txt_ip.Text = "127.0.0.1"; // // btn_disconnect // this.btn_disconnect.Location = new System.Drawing.Point(6, 47); this.btn_disconnect.Name = "btn_disconnect"; this.btn_disconnect.Size = new System.Drawing.Size(203, 23); this.btn_disconnect.TabIndex = 2; this.btn_disconnect.Text = "Disconnect"; this.btn_disconnect.UseVisualStyleBackColor = true; this.btn_disconnect.Click += new System.EventHandler(this.btn_disconnect_Click); // // btn_connect // this.btn_connect.Location = new System.Drawing.Point(6, 18); this.btn_connect.Name = "btn_connect"; this.btn_connect.Size = new System.Drawing.Size(203, 23); this.btn_connect.TabIndex = 1; this.btn_connect.Text = "Connect"; this.btn_connect.UseVisualStyleBackColor = true; this.btn_connect.Click += new System.EventHandler(this.btn_connect_Click); // // lst_tcp // this.lst_tcp.FormattingEnabled = true; this.lst_tcp.Location = new System.Drawing.Point(6, 179); this.lst_tcp.Name = "lst_tcp"; this.lst_tcp.Size = new System.Drawing.Size(717, 277); this.lst_tcp.TabIndex = 0; // // tabPage5 // this.tabPage5.Controls.Add(this.pictureBox1); this.tabPage5.Location = new System.Drawing.Point(4, 22); this.tabPage5.Name = "tabPage5"; this.tabPage5.Padding = new System.Windows.Forms.Padding(3); this.tabPage5.Size = new System.Drawing.Size(729, 515); this.tabPage5.TabIndex = 5; this.tabPage5.Text = "Viewer"; this.tabPage5.UseVisualStyleBackColor = true; // // pictureBox1 // this.pictureBox1.Location = new System.Drawing.Point(14, 17); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(640, 480); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // timer1 // this.timer1.Enabled = true; this.timer1.Interval = 3000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // frmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ClientSize = new System.Drawing.Size(761, 565); this.Controls.Add(this.tabControl1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.Name = "frmMain"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Main"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmMain_FormClosed); this.Load += new System.EventHandler(this.frmMain_Load); this.tabControl1.ResumeLayout(false); this.tab.ResumeLayout(false); this.tab.PerformLayout(); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown19)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown20)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown17)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown18)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown15)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown16)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown13)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown14)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown12)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown9)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_right_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.robot_z)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.arm_left_1)).EndInit(); this.tabPage3.ResumeLayout(false); this.tabPage3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.track_size)).EndInit(); this.panel2.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.img_map)).EndInit(); this.tabPage4.ResumeLayout(false); this.tabPage4.PerformLayout(); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); this.tabPage5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Button btn_up; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tab; private System.Windows.Forms.Button btn_turn_right; private System.Windows.Forms.Button btn_turn_left; private System.Windows.Forms.Button btn_stop; private System.Windows.Forms.Button btn_right; private System.Windows.Forms.Button btn_down; private System.Windows.Forms.Button btn_left; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.Button right_grip_open; private System.Windows.Forms.Button right_grip_close; private System.Windows.Forms.Button left_grip_open; private System.Windows.Forms.Button left_grip_close; private System.Windows.Forms.TrackBar arm_right_5; private System.Windows.Forms.TrackBar arm_right_4; private System.Windows.Forms.TrackBar arm_right_3; private System.Windows.Forms.TrackBar arm_right_2; private System.Windows.Forms.TrackBar arm_right_1; private System.Windows.Forms.TrackBar robot_z; private System.Windows.Forms.TrackBar arm_left_5; private System.Windows.Forms.TrackBar arm_left_4; private System.Windows.Forms.TrackBar arm_left_3; private System.Windows.Forms.TrackBar arm_left_2; private System.Windows.Forms.TrackBar arm_left_1; private System.Windows.Forms.TextBox odom2_t; private System.Windows.Forms.TextBox odom2_y; private System.Windows.Forms.TextBox odom2_x; private System.Windows.Forms.TextBox odom1_t; private System.Windows.Forms.TextBox odom1_y; private System.Windows.Forms.TextBox odom1_x; private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox txt_voltage3; private System.Windows.Forms.TextBox txt_voltage2; private System.Windows.Forms.TextBox txt_voltage1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button btn_m17; private System.Windows.Forms.Button btn_m5; private System.Windows.Forms.Button btn_m4; private System.Windows.Forms.Button btn_m3; private System.Windows.Forms.Button btn_m6; private System.Windows.Forms.Button btn_m1; private System.Windows.Forms.TextBox txt_isobstacle; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox txt_isrobotmove; private System.Windows.Forms.Label label8; private System.Windows.Forms.ProgressBar laser_8; private System.Windows.Forms.ProgressBar laser_7; private System.Windows.Forms.ProgressBar laser_6; private System.Windows.Forms.ProgressBar laser_5; private System.Windows.Forms.ProgressBar laser_4; private System.Windows.Forms.ProgressBar laser_3; private System.Windows.Forms.ProgressBar laser_2; private System.Windows.Forms.Label label7; private System.Windows.Forms.ProgressBar laser_1; private System.Windows.Forms.Button btn_y; private System.Windows.Forms.Button btn_x; private System.Windows.Forms.TextBox txt_move_y; private System.Windows.Forms.TextBox txt_move_x; private System.Windows.Forms.ProgressBar laser_9; private System.Windows.Forms.ProgressBar laser_10; private System.Windows.Forms.Button btn_cancle; private System.Windows.Forms.Button turn_to; private System.Windows.Forms.TextBox txt_move_turnto; private System.Windows.Forms.Button turn_local; private System.Windows.Forms.TextBox txt_move_turnlocal; private System.Windows.Forms.Button btn_zoom_out; private System.Windows.Forms.Button btn_zoom_in; private System.Windows.Forms.TextBox txt_map; private System.Windows.Forms.Button btn_get_current_map; private System.Windows.Forms.Button btn_paint_w; private System.Windows.Forms.Button btn_load_map; private System.Windows.Forms.Button btn_save_map; private System.Windows.Forms.Button btn_paint_g; private System.Windows.Forms.Button btn_paint_b; private System.Windows.Forms.Button btn_add_current; private System.Windows.Forms.ListBox lst_points; private System.Windows.Forms.Button btn_show_lables; private System.Windows.Forms.Button btn_edit_selected; private System.Windows.Forms.Button btn_delete_selected; private System.Windows.Forms.NumericUpDown numericUpDown2; private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.NumericUpDown numericUpDown9; private System.Windows.Forms.NumericUpDown numericUpDown10; private System.Windows.Forms.NumericUpDown numericUpDown7; private System.Windows.Forms.NumericUpDown numericUpDown8; private System.Windows.Forms.NumericUpDown numericUpDown5; private System.Windows.Forms.NumericUpDown numericUpDown6; private System.Windows.Forms.NumericUpDown numericUpDown3; private System.Windows.Forms.NumericUpDown numericUpDown4; private System.Windows.Forms.NumericUpDown numericUpDown19; private System.Windows.Forms.NumericUpDown numericUpDown20; private System.Windows.Forms.NumericUpDown numericUpDown17; private System.Windows.Forms.NumericUpDown numericUpDown18; private System.Windows.Forms.NumericUpDown numericUpDown15; private System.Windows.Forms.NumericUpDown numericUpDown16; private System.Windows.Forms.NumericUpDown numericUpDown13; private System.Windows.Forms.NumericUpDown numericUpDown14; private System.Windows.Forms.NumericUpDown numericUpDown11; private System.Windows.Forms.NumericUpDown numericUpDown12; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.ListBox lst_tcp; private System.Windows.Forms.Button btn_disconnect; private System.Windows.Forms.Button btn_connect; private System.Windows.Forms.TextBox txt_ip; private System.Windows.Forms.Button btn_es; private System.Windows.Forms.Label PencilSize_label; private System.Windows.Forms.PictureBox img_map; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Button btn_selectHand; private System.Windows.Forms.Button btn_selectPencil; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txt_port; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button btn_m16; private System.Windows.Forms.Button btn_m12; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button btn_m15; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.CheckBox chk_coonect; private System.Windows.Forms.TrackBar track_size; private System.Windows.Forms.Label label11; private System.Windows.Forms.RadioButton rad_linux; private System.Windows.Forms.RadioButton rad_windows; private System.Windows.Forms.TextBox txt_path; private System.Windows.Forms.TabPage tabPage5; private System.Windows.Forms.Button btn_m2; private System.Windows.Forms.Button btn_m18; private System.Windows.Forms.Label label15; private System.Windows.Forms.Button btn_m7; private System.Windows.Forms.Button btn_m11; private System.Windows.Forms.Button btn_m10; private System.Windows.Forms.Label label14; private System.Windows.Forms.Button btn_m14; private System.Windows.Forms.Button btn_m13; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label12; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Button btn_m20; private System.Windows.Forms.Label label17; private System.Windows.Forms.Button btn_m19; private System.Windows.Forms.Label label16; private System.Windows.Forms.Button btn_m9; private System.Windows.Forms.Button btn_m8; private System.Windows.Forms.Button btn_hector_offset; private System.Windows.Forms.Label label19; private System.Windows.Forms.Label label18; private System.Windows.Forms.TextBox txt_offsety; private System.Windows.Forms.TextBox txt_offsetx; private System.Windows.Forms.RadioButton rad_stop; private System.Windows.Forms.RadioButton rad_start; } }
53.328422
177
0.591918
[ "MIT" ]
cxdcxd/sepanta3
GUI/sepanta_gui/main/main/frmMain.Designer.cs
112,205
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.Generic; namespace SsdtProjectHelper.Common.Interfaces { public interface ISiblingFilesManager { string MainDatapatchPattern { get; } IList<ProcessingResult> ProcessingResults { get; } string ProjectRootFolder { get; } string ReferenceFilePath { get; } IEnumerable<string> SiblingPathsRelativeToProject { get; } void ProcessSingleFileAsPartialPath(string targetFilePartialPath); IList<ProcessingResult> ProcessAllFiles(); } }
35.52381
75
0.710456
[ "MIT" ]
matei-tm/SSDT-Continuous-Deployment-Project-Template-Helpers
src/projects/SsdtProjectHelper.Common/Interfaces/ISiblingFilesManager.cs
748
C#
#pragma checksum "C:\Users\Reza\source\Workspaces\MicroservicesBMI\WebFramework\WebFramework\Website\Views\Account\Register.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a5a7bc655f0f023deb673935debef42017d5cb01" // <auto-generated/> #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Account_Register), @"mvc.1.0.view", @"/Views/Account/Register.cshtml")] [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/Account/Register.cshtml", typeof(AspNetCore.Views_Account_Register))] namespace AspNetCore { #line hidden using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; #line 1 "C:\Users\Reza\source\Workspaces\MicroservicesBMI\WebFramework\WebFramework\Website\Views\_ViewImports.cshtml" using Website; #line default #line hidden #line 2 "C:\Users\Reza\source\Workspaces\MicroservicesBMI\WebFramework\WebFramework\Website\Views\_ViewImports.cshtml" using Website.Models; #line default #line hidden [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"a5a7bc655f0f023deb673935debef42017d5cb01", @"/Views/Account/Register.cshtml")] [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"971d47fbe439df3910fb180c393f0b2f21208c79", @"/Views/_ViewImports.cshtml")] public class Views_Account_Register : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic> { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("method", "post", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0169 private string __tagHelperStringValueBuffer; #pragma warning restore 0169 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager { get { if (__backed__tagHelperScopeManager == null) { __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); } return __backed__tagHelperScopeManager; } } private global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 1 "C:\Users\Reza\source\Workspaces\MicroservicesBMI\WebFramework\WebFramework\Website\Views\Account\Register.cshtml" ViewData["Title"] = "Register"; #line default #line hidden BeginContext(44, 4, true); WriteLiteral("<h1>"); EndContext(); BeginContext(49, 17, false); #line 4 "C:\Users\Reza\source\Workspaces\MicroservicesBMI\WebFramework\WebFramework\Website\Views\Account\Register.cshtml" Write(ViewData["Title"]); #line default #line hidden EndContext(); BeginContext(66, 9, true); WriteLiteral("</h1>\r\n\r\n"); EndContext(); DefineSection("Scripts", async() => { BeginContext(94, 1018, true); WriteLiteral(@" <script> $(document).ready(function(){ $('#btnajx').click(function () { var _listRole = [{ RoleID: 'ULI' }, { RoleID: 'AMR' }]; _listRole = JSON.stringify(_listRole); var datapar = $('form').serialize()+'&listRole='+_listRole; debugger; $.ajax({ url: ""SignUp"", type: 'post', datatype: 'application/json', /*data: $('form').serialize()+'&'+JSON.stringify({ listRole: listRole }),*/ /*data: { listRole: _listRole },*/ data: datapar, success: function (data) { debugger; /*$(""#showResults"").html(data)*/ }, error: function () { alert('Ajax error!'); } }); }); }); </script> "); EndContext(); } ); BeginContext(1115, 17, true); WriteLiteral("<p>Register</p>\r\n"); EndContext(); BeginContext(1132, 690, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "a5a7bc655f0f023deb673935debef42017d5cb015633", async() => { BeginContext(1194, 323, true); WriteLiteral(@" Full Name: <input type=""text"" name=""fullname"" /> <br /> Email: <input type=""email"" name=""email"" /> <br /> Username: <input type=""text"" name=""username"" /> <br /> Password: <input type=""password"" name=""password"" /> <br /> Confirm Password: <input type=""password"" name=""password2"" /> <br /> "); EndContext(); BeginContext(1638, 177, true); WriteLiteral(" <input type=\"button\" value=\"Test Ajax\" id=\"btnajx\" class=\"btn btn-sm btn-primary btn-block\" />\r\n <input type=\"submit\" value=\"Submit\" class=\"submit\" /><br />\r\n\r\n\r\n"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "action", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 35 "C:\Users\Reza\source\Workspaces\MicroservicesBMI\WebFramework\WebFramework\Website\Views\Account\Register.cshtml" AddHtmlAttributeValue("", 1160, Url.Action("SignUp", "Account"), 1160, 32, false); #line default #line hidden EndAddHtmlAttributeValues(__tagHelperExecutionContext); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1822, 2, true); WriteLiteral("\r\n"); EndContext(); } #pragma warning restore 1998 [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; } } } #pragma warning restore 1591
55.442424
293
0.677634
[ "MIT" ]
rezaseptiandra/AssetManagement
Solution/Website/obj/Debug/netcoreapp2.2/Razor/Views/Account/Register.cshtml.g.cs
9,148
C#
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Text; using Coinbase.Wallet; using System.Linq; namespace Coinbase.NetSDK.UnitTest.Wallet { [TestClass] public class AccountTest : TestEssential { [TestMethod] public void ListAccountsTest() { var accounts = client.GetAccounts(); Assert.IsTrue(accounts.Data.ToList().Count > 0); var account = client.GetAccount(accounts.Data.First().Id); Assert.IsTrue(account.Id == accounts.Data.First().Id); } [TestMethod] public void SetPrimaryAccountTest() { var accounts = client.GetAccounts().Data.Where(x => x.Type == Models.AccountType.Wallet).ToList(); int idx = new Random().Next(accounts.Count); var primaryAccount = accounts[idx]; client.SetPrimaryAccount(primaryAccount.Id); var primaryAccount2 = client.GetPrimaryAccount(); Assert.IsTrue(primaryAccount.Id == primaryAccount2.Id); } } }
26.357143
110
0.631436
[ "MIT" ]
Haiping-Chen/Coinbase.NetSDK
Coinbase.NetSDK.UnitTest/Wallet/AccountTest.cs
1,109
C#
// Copyright (c) 2015 Augie R. Maddox, Guavaman Enterprises. All rights reserved. #pragma warning disable 0219 #pragma warning disable 0618 #pragma warning disable 0649 namespace Rewired.UI.ControlMapper { using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using UnityEngine.Events; using System.Collections.Generic; using System.Collections; using Rewired; [AddComponentMenu("")] public class InputBehaviorWindow : Window { private const float minSensitivity = 0.1f; [SerializeField] private RectTransform spawnTransform; [SerializeField] private Button doneButton; [SerializeField] private Button cancelButton; [SerializeField] private Button defaultButton; [SerializeField] private Text doneButtonLabel; [SerializeField] private Text cancelButtonLabel; [SerializeField] private Text defaultButtonLabel; [SerializeField] private GameObject uiControlSetPrefab; [SerializeField] private GameObject uiSliderControlPrefab; private List<InputBehaviorInfo> inputBehaviorInfo; private Dictionary<int, System.Action<int>> buttonCallbacks; private int playerId; public override void Initialize(int id, System.Func<int, bool> isFocusedCallback) { if( spawnTransform == null || doneButton == null || cancelButton == null || defaultButton == null || uiControlSetPrefab == null || uiSliderControlPrefab == null || doneButtonLabel == null || cancelButtonLabel == null || defaultButtonLabel == null ) { Debug.LogError("Rewired Control Mapper: All inspector values must be assigned!"); return; } inputBehaviorInfo = new List<InputBehaviorInfo>(); buttonCallbacks = new Dictionary<int, System.Action<int>>(); // Set static element labels doneButtonLabel.text = ControlMapper.GetLanguage().done; cancelButtonLabel.text = ControlMapper.GetLanguage().cancel; defaultButtonLabel.text = ControlMapper.GetLanguage().default_; base.Initialize(id, isFocusedCallback); } public void SetData(int playerId, ControlMapper.InputBehaviorSettings[] data) { if(!initialized) return; this.playerId = playerId; // Create control sets for(int i = 0; i < data.Length; i++) { var item = data[i]; if(item == null || !item.isValid) continue; InputBehavior inputBehavior = GetInputBehavior(item.inputBehaviorId); if(inputBehavior == null) continue; UIControlSet set = CreateControlSet(); Dictionary<int, PropertyType> idToProperty = new Dictionary<int, PropertyType>(); ; // Set the title string customTitle = ControlMapper.GetLanguage().GetCustomEntry(item.labelLanguageKey); if(!string.IsNullOrEmpty(customTitle)) set.SetTitle(customTitle); else set.SetTitle(inputBehavior.name); // Create sliders if(item.showJoystickAxisSensitivity) { UISliderControl slider = CreateSlider( set, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(item.joystickAxisSensitivityLabelLanguageKey), item.joystickAxisSensitivityIcon, item.joystickAxisSensitivityMin, item.joystickAxisSensitivityMax, JoystickAxisSensitivityValueChanged, JoystickAxisSensitivityCanceled ); // Set initial value slider.slider.value = Mathf.Clamp(inputBehavior.joystickAxisSensitivity, item.joystickAxisSensitivityMin, item.joystickAxisSensitivityMax); // Store property type idToProperty.Add(slider.id, PropertyType.JoystickAxisSensitivity); } if(item.showMouseXYAxisSensitivity) { UISliderControl slider = CreateSlider( set, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(item.mouseXYAxisSensitivityLabelLanguageKey), item.mouseXYAxisSensitivityIcon, item.mouseXYAxisSensitivityMin, item.mouseXYAxisSensitivityMax, MouseXYAxisSensitivityValueChanged, MouseXYAxisSensitivityCanceled ); // Set initial value slider.slider.value = Mathf.Clamp(inputBehavior.mouseXYAxisSensitivity, item.mouseXYAxisSensitivityMin, item.mouseXYAxisSensitivityMax); // Store property type idToProperty.Add(slider.id, PropertyType.MouseXYAxisSensitivity); } // mouseOtherAxisSensitivity not implemented // Add to the list inputBehaviorInfo.Add(new InputBehaviorInfo(inputBehavior, set, idToProperty)); } // Set default UI element defaultUIElement = doneButton.gameObject; } public void SetButtonCallback(ButtonIdentifier buttonIdentifier, System.Action<int> callback) { if(!initialized) return; if(callback == null) return; if(buttonCallbacks.ContainsKey((int)buttonIdentifier)) buttonCallbacks[(int)buttonIdentifier] = callback; else buttonCallbacks.Add((int)buttonIdentifier, callback); } public override void Cancel() { if(!initialized) return; // don't call on base // Restore original data to input behaviors foreach(InputBehaviorInfo info in inputBehaviorInfo) { info.RestorePreviousData(); } System.Action<int> callback; if(!buttonCallbacks.TryGetValue((int)ButtonIdentifier.Cancel, out callback)) { if(cancelCallback != null) cancelCallback(); return; } callback(id); } #region Window Button Event Handlers public void OnDone() { if(!initialized) return; System.Action<int> callback; if(!buttonCallbacks.TryGetValue((int)ButtonIdentifier.Done, out callback)) return; callback(id); } public void OnCancel() { Cancel(); } public void OnRestoreDefault() { if(!initialized) return; // Revert to default settings in each input behavior foreach(InputBehaviorInfo info in inputBehaviorInfo) { info.RestoreDefaultData(); } } #endregion #region Slider Control Event Handlers private void JoystickAxisSensitivityValueChanged(int inputBehaviorId, int controlId, float value) { GetInputBehavior(inputBehaviorId).joystickAxisSensitivity = value; } private void MouseXYAxisSensitivityValueChanged(int inputBehaviorId, int controlId, float value) { GetInputBehavior(inputBehaviorId).mouseXYAxisSensitivity = value; } private void JoystickAxisSensitivityCanceled(int inputBehaviorId, int controlId) { InputBehaviorInfo info = GetInputBehaviorInfo(inputBehaviorId); if(info == null) return; info.RestoreData(PropertyType.JoystickAxisSensitivity, controlId); } private void MouseXYAxisSensitivityCanceled(int inputBehaviorId, int controlId) { InputBehaviorInfo info = GetInputBehaviorInfo(inputBehaviorId); if(info == null) return; info.RestoreData(PropertyType.MouseXYAxisSensitivity, controlId); } #endregion public override void TakeInputFocus() { base.TakeInputFocus(); } private UIControlSet CreateControlSet() { GameObject instance = (GameObject)Object.Instantiate(uiControlSetPrefab); instance.transform.SetParent(spawnTransform, false); return instance.GetComponent<UIControlSet>(); } private UISliderControl CreateSlider(UIControlSet set, int inputBehaviorId, string defaultTitle, string overrideTitle, Sprite icon, float minValue, float maxValue, System.Action<int, int, float> valueChangedCallback, System.Action<int, int> cancelCallback) { // Create slider control UISliderControl control = set.CreateSlider( uiSliderControlPrefab, icon, minValue, maxValue, (int cId, float value) => { valueChangedCallback(inputBehaviorId, cId, value); }, (int cId) => { cancelCallback(inputBehaviorId, cId); } ); // Title string title = string.IsNullOrEmpty(overrideTitle) ? defaultTitle : overrideTitle; if(!string.IsNullOrEmpty(title)) { control.showTitle = true; control.title.text = title; } else { control.showTitle = false; } // Icon control.showIcon = icon != null; return control; } private InputBehavior GetInputBehavior(int id) { return ReInput.mapping.GetInputBehavior(playerId, id); } private InputBehaviorInfo GetInputBehaviorInfo(int inputBehaviorId) { int count = inputBehaviorInfo.Count; for(int i = 0; i < count; i++) { if(inputBehaviorInfo[i].inputBehavior.id != inputBehaviorId) continue; return inputBehaviorInfo[i]; } return null; } // Classes private class InputBehaviorInfo { private InputBehavior _inputBehavior; private UIControlSet _controlSet; private Dictionary<int, PropertyType> idToProperty; public InputBehavior inputBehavior { get { return _inputBehavior; } } public UIControlSet controlSet { get { return _controlSet; } } private InputBehavior copyOfOriginal; public InputBehaviorInfo(InputBehavior inputBehavior, UIControlSet controlSet, Dictionary<int, PropertyType> idToProperty) { this._inputBehavior = inputBehavior; this._controlSet = controlSet; this.idToProperty = idToProperty; copyOfOriginal = new InputBehavior(inputBehavior); } public void RestorePreviousData() { _inputBehavior.ImportData(copyOfOriginal); } public void RestoreDefaultData() { _inputBehavior.Reset(); RefreshControls(); } public void RestoreData(PropertyType propertyType, int controlId) { switch(propertyType) { case PropertyType.JoystickAxisSensitivity: { float value = copyOfOriginal.joystickAxisSensitivity; _inputBehavior.joystickAxisSensitivity = value; UISliderControl control = _controlSet.GetControl<UISliderControl>(controlId); if(control != null) control.slider.value = value; // update control break; } case PropertyType.MouseXYAxisSensitivity: { float value = copyOfOriginal.mouseXYAxisSensitivity; _inputBehavior.mouseXYAxisSensitivity = value; UISliderControl control = _controlSet.GetControl<UISliderControl>(controlId); if(control != null) control.slider.value = value; // update control break; } } } public void RefreshControls() { if(_controlSet == null) return; if(idToProperty == null) return; // Redraw the controls with the current values foreach(KeyValuePair<int, PropertyType> pair in idToProperty) { UISliderControl control = _controlSet.GetControl<UISliderControl>(pair.Key); if(control == null) continue; switch(pair.Value) { case PropertyType.JoystickAxisSensitivity: control.slider.value = _inputBehavior.joystickAxisSensitivity; break; case PropertyType.MouseXYAxisSensitivity: control.slider.value = _inputBehavior.mouseXYAxisSensitivity; break; } } } } // Enums public enum ButtonIdentifier { Done, Cancel, Default } private enum PropertyType { JoystickAxisSensitivity = 0, MouseXYAxisSensitivity = 1 } } }
40.275362
267
0.566463
[ "MIT" ]
Constrained-Development/Magmescape
src/Assets/Plugins/Rewired/Extras/ControlMapper/Scripts/InputBehaviorWindow.cs
13,897
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DotNetify { public interface IMasterViewVM { IBaseVM GetSubVM(string vmTypeName, string vmInstanceId); void OnSubVMDisposing(IBaseVM subVM); void OnSubVMCreated(IBaseVM subVM); void OnUnresolvedUpdate(string vmPath, string value); } }
23.941176
65
0.72973
[ "Apache-2.0" ]
lrhmx/dotNetify
DotNetifyLib.Core/IMasterViewVM.cs
409
C#
using System; using System.Data.Common; using System.Threading; using System.Threading.Tasks; using Baseline; using Marten.Services; using Npgsql; namespace Marten.Schema { public class HierarchicalDocumentStorage<T> : DocumentStorage<T> where T : class { private readonly DocumentMapping _hierarchy; public HierarchicalDocumentStorage(ISerializer serializer, DocumentMapping hierarchy) : base(serializer, hierarchy) { _hierarchy = hierarchy; } public override T Resolve(int startingIndex, DbDataReader reader, IIdentityMap map) { var id = reader[startingIndex + 1]; var typeAlias = reader.GetString(startingIndex + 2); var version = reader.GetFieldValue<Guid>(startingIndex + 3); var json = reader.GetTextReader(startingIndex); return map.Get<T>(id, _hierarchy.TypeFor(typeAlias), json, version); } public override async Task<T> ResolveAsync(int startingIndex, DbDataReader reader, IIdentityMap map, CancellationToken token) { if (await reader.IsDBNullAsync(startingIndex, token).ConfigureAwait(false)) return null; var id = await reader.GetFieldValueAsync<object>(startingIndex + 1, token).ConfigureAwait(false); var typeAlias = await reader.GetFieldValueAsync<string>(startingIndex + 2, token).ConfigureAwait(false); var version = await reader.GetFieldValueAsync<Guid>(3, token).ConfigureAwait(false); var json = await reader.As<NpgsqlDataReader>().GetTextReaderAsync(startingIndex).ConfigureAwait(false); return map.Get<T>(id, _hierarchy.TypeFor(typeAlias), json, version); } public override T Fetch(object id, DbDataReader reader, IIdentityMap map) { if (!reader.Read()) return null; var typeAlias = reader.GetString(2); var actualType = _hierarchy.TypeFor(typeAlias); var version = reader.GetFieldValue<Guid>(3); var json = reader.GetTextReader(0); return map.Get<T>(id, actualType, json, version); } public override async Task<T> FetchAsync(object id, DbDataReader reader, IIdentityMap map, CancellationToken token) { var found = await reader.ReadAsync(token).ConfigureAwait(false); if (!found) return null; var typeAlias = await reader.GetFieldValueAsync<string>(2, token).ConfigureAwait(false); var actualType = _hierarchy.TypeFor(typeAlias); var version = await reader.GetFieldValueAsync<Guid>(3, token).ConfigureAwait(false); var json = await reader.As<NpgsqlDataReader>().GetTextReaderAsync(0).ConfigureAwait(false); return map.Get<T>(id, actualType, json, version); } } }
36.3625
133
0.650739
[ "MIT" ]
Maximusya/marten
src/Marten/Schema/HierarchicalResolver.cs
2,909
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable enable using System; using System.Collections.Generic; using System.Linq; using Microsoft.TemplateEngine.Abstractions; using Microsoft.TemplateEngine.Abstractions.TemplatePackage; using Microsoft.TemplateEngine.Cli.UnitTests.CliMocks; using Microsoft.TemplateEngine.Mocks; using Microsoft.TemplateEngine.TestHelper; using Microsoft.TemplateSearch.Common; using Xunit; namespace Microsoft.TemplateEngine.Cli.UnitTests { public class TemplateSearcherTests : IClassFixture<EnvironmentSettingsHelper> { private IEngineEnvironmentSettings _engineEnvironmentSettings; public TemplateSearcherTests(EnvironmentSettingsHelper environmentSettingsHelper) { _engineEnvironmentSettings = environmentSettingsHelper.CreateEnvironment(hostIdentifier: this.GetType().Name, virtualize: true); } private static readonly PackInfo _fooPackInfo = new PackInfo("fooPack", "1.0.0"); private static readonly PackInfo _barPackInfo = new PackInfo("barPack", "2.0.0"); private static readonly PackInfo _redPackInfo = new PackInfo("redPack", "1.1"); private static readonly PackInfo _bluePackInfo = new PackInfo("bluePack", "2.1"); private static readonly PackInfo _greenPackInfo = new PackInfo("greenPack", "3.0.0"); [Fact(DisplayName = nameof(TwoSourcesAreBothSearched))] public void TwoSourcesAreBothSearched() { _engineEnvironmentSettings.Components.AddComponent(typeof(ITemplateSearchSource), new MockTemplateSearchSource()); _engineEnvironmentSettings.Components.AddComponent(typeof(ITemplateSearchSource), new MockTemplateSearchSource()); IList<ITemplateSearchSource> searchSources = _engineEnvironmentSettings.Components.OfType<ITemplateSearchSource>().ToList(); Assert.Equal(2, searchSources.Count); } [Fact(DisplayName = nameof(SourcesCorrectlySearchOnName))] public void SourcesCorrectlySearchOnName() { MockTemplateSearchSource.ClearResultsForAllSources(); IReadOnlyDictionary<string, Guid> sourceNameToIdMap = MockTemplateSearchSource.SetupMultipleSources(_engineEnvironmentSettings, GetMockNameSearchResults()); const string templateName = "foo"; TemplateSearcher searcher = new TemplateSearcher(_engineEnvironmentSettings, "C#", MockTemplateSearchHelpers.DefaultMatchFilter); List<IManagedTemplatePackage> existingInstalls = new List<IManagedTemplatePackage>(); SearchResults searchResults = searcher.SearchForTemplatesAsync(existingInstalls, templateName, default).Result; Assert.True(searchResults.AnySources); Assert.Equal(1, searchResults.MatchesBySource.Count); Assert.Equal("source one", searchResults.MatchesBySource[0].SourceDisplayName); Assert.Equal(1, searchResults.MatchesBySource[0].PacksWithMatches.Count); Assert.True(searchResults.MatchesBySource[0].PacksWithMatches.ContainsKey(_fooPackInfo)); Assert.Single(searchResults.MatchesBySource[0].PacksWithMatches[_fooPackInfo].TemplateMatches.Where(x => string.Equals(x.Info.Name, "MockFooTemplateOne"))); Assert.Single(searchResults.MatchesBySource[0].PacksWithMatches[_fooPackInfo].TemplateMatches.Where(x => string.Equals(x.Info.Name, "MockFooTemplateTwo"))); } [Fact(DisplayName = nameof(SearcherCorrectlyFiltersSpecifiedPack))] public void SearcherCorrectlyFiltersSpecifiedPack() { const string templateName = "foo"; TemplateSearcher searcher = new TemplateSearcher(_engineEnvironmentSettings, "C#", MockTemplateSearchHelpers.DefaultMatchFilter); IReadOnlyList<IManagedTemplatePackage> packsToIgnore = new List<IManagedTemplatePackage>() { new MockManagedTemplatePackage() }; SearchResults searchResults = searcher.SearchForTemplatesAsync(packsToIgnore, templateName, default).Result; Assert.Equal(0, searchResults.MatchesBySource.Count); } private static IReadOnlyDictionary<string, IReadOnlyList<ITemplateNameSearchResult>> GetMockNameSearchResults() { Dictionary<string, IReadOnlyList<ITemplateNameSearchResult>> dataForSources = new Dictionary<string, IReadOnlyList<ITemplateNameSearchResult>>(); List<TemplateNameSearchResult> sourceOneResults = new List<TemplateNameSearchResult>(); ITemplateInfo sourceOneTemplateOne = new MockTemplateInfo("foo1", name: "MockFooTemplateOne", identity: "Mock.Foo.1").WithDescription("Mock Foo template one"); TemplateNameSearchResult sourceOneResultOne = new TemplateNameSearchResult(sourceOneTemplateOne, _fooPackInfo); sourceOneResults.Add(sourceOneResultOne); ITemplateInfo sourceOneTemplateTwo = new MockTemplateInfo("foo2", name: "MockFooTemplateTwo", identity: "Mock.Foo.2").WithDescription("Mock Foo template two"); TemplateNameSearchResult sourceOneResultTwo = new TemplateNameSearchResult(sourceOneTemplateTwo, _fooPackInfo); sourceOneResults.Add(sourceOneResultTwo); ITemplateInfo sourceOneTemplateThree = new MockTemplateInfo("bar1", name: "MockBarTemplateOne", identity: "Mock.Bar.1").WithDescription("Mock Bar template one"); TemplateNameSearchResult sourceOneResultThree = new TemplateNameSearchResult(sourceOneTemplateThree, _barPackInfo); sourceOneResults.Add(sourceOneResultThree); dataForSources["source one"] = sourceOneResults; List<TemplateNameSearchResult> sourceTwoResults = new List<TemplateNameSearchResult>(); ITemplateInfo sourceTwoTemplateOne = new MockTemplateInfo("red", name: "MockRedTemplate", identity: "Mock.Red.1").WithDescription("Mock red template"); TemplateNameSearchResult sourceTwoResultOne = new TemplateNameSearchResult(sourceTwoTemplateOne, _redPackInfo); sourceTwoResults.Add(sourceTwoResultOne); ITemplateInfo sourceTwoTemplateTwo = new MockTemplateInfo("blue", name: "MockBlueTemplate", identity: "Mock.Blue.1").WithDescription("Mock blue template"); TemplateNameSearchResult sourceTwoResultTwo = new TemplateNameSearchResult(sourceTwoTemplateTwo, _bluePackInfo); sourceTwoResults.Add(sourceTwoResultTwo); ITemplateInfo sourceTwoTemplateThree = new MockTemplateInfo("green", name: "MockGreenTemplate", identity: "Mock.Green.1").WithDescription("Mock green template"); TemplateNameSearchResult sourceTwoResultThree = new TemplateNameSearchResult(sourceTwoTemplateThree, _greenPackInfo); sourceTwoResults.Add(sourceTwoResultThree); dataForSources["source two"] = sourceTwoResults; return dataForSources; } } }
55.401575
173
0.742325
[ "MIT" ]
2mol/templating
test/Microsoft.TemplateEngine.Cli.UnitTests/TemplateSearcherTests.cs
7,036
C#
using Cysharp.Threading.Tasks; using LWFramework.Core; using System.Collections; using System.Collections.Generic; using UnityEngine; public class UILoadAB : IUILoad { public Sprite GetSprite(string path) { var asset = MainManager.Instance.GetManager<IAssetsManager>().Load<UnityEngine.Sprite>(path); return (Sprite)asset; } public GameObject LoadUIGameObject(string path) { GameObject asset = MainManager.Instance.GetManager<IAssetsManager>().Load<GameObject>(path); GameObject uiGameObject = (GameObject)GameObject.Instantiate(asset); return uiGameObject; } UniTask<GameObject> IUILoad.LoadUIGameObjectAsync(string path) { LWDebug.LogError("UILoadAB不支持异步加载,请编写自定义加载器"); throw new System.NotImplementedException(); } }
29.142857
101
0.720588
[ "Apache-2.0" ]
chen0123bin/MyTools
ToolsProject/Assets/Packages/LWFramework/Runtime/_UI/UILoadAB.cs
850
C#
using System; using System.Collections.Generic; using WEBCON.FormsGenerator.BusinessLogic.Domain.Exceptions; namespace WEBCON.FormsGenerator.BusinessLogic.Domain.Model { public class BpsWorkflow : BpsEntity { public BpsWorkflow() { } public BpsWorkflow(Guid guid, string name, BpsProcess process) : base(guid, name) { BpsProcess = process ?? throw new BpsEntityArgumentException("Workflow process is not specified"); } public BpsProcess BpsProcess { get; protected set; } public ICollection<BpsWorkflowStep> BpsWorkflowSteps { get; set; } public void Update(BpsProcess process) { BpsProcess = process ?? throw new BpsEntityArgumentException("Workflow process is not specified"); } } }
33.791667
110
0.674476
[ "MIT" ]
WEBCON-BPS/public-forms
WEBCON.FormsGenerator.BuisnessLogic/Domain/Model/BpsWorkflow.cs
813
C#
using System.Threading; using System.Threading.Tasks; using Manatee.Trello.Internal.Caching; using Manatee.Trello.Internal.Synchronization; namespace Manatee.Trello { /// <summary> /// A read-only collection of scaled versions of board backgrounds. /// </summary> public class ReadOnlyBoardBackgroundScalesCollection : ReadOnlyCollection<IImagePreview> { private readonly BoardBackgroundContext _context; internal ReadOnlyBoardBackgroundScalesCollection(BoardBackgroundContext context, TrelloAuthorization auth) : base(() => context.Data.Id, auth) { _context = context; } internal sealed override async Task PerformRefresh(bool force, CancellationToken ct) { await _context.Synchronize(force, ct); if (_context.Data.ImageScaled == null) return; Items.Clear(); foreach (var jsonPreview in _context.Data.ImageScaled) { var preview = jsonPreview.GetFromCache<ImagePreview>(Auth); Items.Add(preview); } } } }
30.060606
109
0.733871
[ "MIT" ]
Muhammad1Nouman/Manatee.Trello
Manatee.Trello/ReadOnlyBoardBackgroundScalesCollection.cs
994
C#
namespace CookingHub.Services.Data.Tests { using System; using System.Reflection; using System.Threading.Tasks; using CookingHub.Data; using CookingHub.Data.Models; using CookingHub.Data.Repositories; using CookingHub.Models.ViewModels.Contacts; using CookingHub.Services.Data.Contracts; using CookingHub.Services.Mapping; using CookingHub.Services.Messaging; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Xunit; public class ContactsServiceTests : IAsyncDisposable, IClassFixture<Configuration> { private readonly IEmailSender emailSender; private readonly IContactsService contactsService; private EfRepository<ContactFormEntry> userContactsRepository; private SqliteConnection connection; private ContactFormEntry firstUserContactFormEntry; public ContactsServiceTests(Configuration configuration) { this.InitializeMapper(); this.InitializeDatabaseAndRepositories(); this.InitializeFields(); this.emailSender = new SendGridEmailSender(configuration.ConfigurationRoot["SendGridCookingHub:ApiKey"]); this.contactsService = new ContactsService(this.userContactsRepository, this.emailSender); } [Fact] public async Task CheckIfSendContactToAdminAsyncWorksCorrectly() { var model = new ContactFormEntryViewModel { FirstName = "Pesho", LastName = "Petrov", Email = "pesho777@gmail.com", Subject = "Question about recipes", Content = "Sample content about recipes", }; await this.contactsService.SendContactToAdminAsync(model); var count = await this.userContactsRepository.All().CountAsync(); Assert.Equal(1, count); } public async ValueTask DisposeAsync() { await this.connection.CloseAsync(); await this.connection.DisposeAsync(); } private void InitializeDatabaseAndRepositories() { this.connection = new SqliteConnection("DataSource=:memory:"); this.connection.Open(); var options = new DbContextOptionsBuilder<CookingHubDbContext>().UseSqlite(this.connection); var dbContext = new CookingHubDbContext(options.Options); dbContext.Database.EnsureCreated(); this.userContactsRepository = new EfRepository<ContactFormEntry>(dbContext); } private void InitializeFields() { this.firstUserContactFormEntry = new ContactFormEntry { FirstName = "Stanislav", LastName = "Stoyanov", Email = "stan_99@gmail.com", Subject = "Question about register form", Content = "I have to ask you something connected with the register form.", }; } private void InitializeMapper() => AutoMapperConfig. RegisterMappings(Assembly.Load("CookingHub.Models.ViewModels")); } }
34.423913
117
0.641932
[ "MIT" ]
IvanMihovpz/CookingHub
src/Tests/CookingHub.Services.Data.Tests/ContactsServiceTests.cs
3,169
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Net.Sockets; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; namespace System.Net.NameResolution.Tests { [CollectionDefinition("NoParallelTests", DisableParallelization = true)] public partial class NoParallelTests { } internal static class TestSettings { // A hostname that will not exist in any DNS caches, forcing some I/O to lookup. public static string UncachedHost => $"nonexistent-{Guid.NewGuid():N}.contoso.com"; public const string IPv4Host = LocalHost; // Linux CI servers not configured with IPv6 localhost. // Windows CI servers not configured with IPv6 name resolution. public static readonly string IPv6Host = PlatformDetection.IsWindows ? LocalHost : "ipv6.google.com"; public const string LocalHost = "localhost"; public const string LocalIPString = "127.0.0.1"; // Timeout values in milliseconds. public const int PassingTestTimeout = 30_000; public static Task<IPAddress> GetLocalIPAddress() => ResolveHost(TestSettings.LocalHost, TestSettings.AddressFamily); public static AddressFamily AddressFamily => AddressFamily.InterNetwork; public static Task WhenAllOrAnyFailedWithTimeout(params Task[] tasks) => tasks.WhenAllOrAnyFailed(PassingTestTimeout); private static async Task<IPAddress> ResolveHost(string host, AddressFamily family) { IPHostEntry hostEntry = await Dns.GetHostEntryAsync(host); foreach (IPAddress address in hostEntry.AddressList) { if (address.AddressFamily == family) { return address; } } return null; } } }
34.517857
126
0.669426
[ "MIT" ]
3DCloud/runtime
src/libraries/System.Net.NameResolution/tests/FunctionalTests/TestSettings.cs
1,933
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.Storage.V20210401 { /// <summary> /// The properties of a storage account’s Blob service. /// </summary> [AzureNativeResourceType("azure-native:storage/v20210401:BlobServiceProperties")] public partial class BlobServiceProperties : Pulumi.CustomResource { /// <summary> /// Deprecated in favor of isVersioningEnabled property. /// </summary> [Output("automaticSnapshotPolicyEnabled")] public Output<bool?> AutomaticSnapshotPolicyEnabled { get; private set; } = null!; /// <summary> /// The blob service properties for change feed events. /// </summary> [Output("changeFeed")] public Output<Outputs.ChangeFeedResponse?> ChangeFeed { get; private set; } = null!; /// <summary> /// The blob service properties for container soft delete. /// </summary> [Output("containerDeleteRetentionPolicy")] public Output<Outputs.DeleteRetentionPolicyResponse?> ContainerDeleteRetentionPolicy { get; private set; } = null!; /// <summary> /// Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. /// </summary> [Output("cors")] public Output<Outputs.CorsRulesResponse?> Cors { get; private set; } = null!; /// <summary> /// DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. /// </summary> [Output("defaultServiceVersion")] public Output<string?> DefaultServiceVersion { get; private set; } = null!; /// <summary> /// The blob service properties for blob soft delete. /// </summary> [Output("deleteRetentionPolicy")] public Output<Outputs.DeleteRetentionPolicyResponse?> DeleteRetentionPolicy { get; private set; } = null!; /// <summary> /// Versioning is enabled if set to true. /// </summary> [Output("isVersioningEnabled")] public Output<bool?> IsVersioningEnabled { get; private set; } = null!; /// <summary> /// The blob service property to configure last access time based tracking policy. /// </summary> [Output("lastAccessTimeTrackingPolicy")] public Output<Outputs.LastAccessTimeTrackingPolicyResponse?> LastAccessTimeTrackingPolicy { get; private set; } = null!; /// <summary> /// The name of the resource /// </summary> [Output("name")] public Output<string> Name { get; private set; } = null!; /// <summary> /// The blob service properties for blob restore policy. /// </summary> [Output("restorePolicy")] public Output<Outputs.RestorePolicyPropertiesResponse?> RestorePolicy { get; private set; } = null!; /// <summary> /// Sku name and tier. /// </summary> [Output("sku")] public Output<Outputs.SkuResponse> Sku { get; private set; } = null!; /// <summary> /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" /// </summary> [Output("type")] public Output<string> Type { get; private set; } = null!; /// <summary> /// Create a BlobServiceProperties 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 BlobServiceProperties(string name, BlobServicePropertiesArgs args, CustomResourceOptions? options = null) : base("azure-native:storage/v20210401:BlobServiceProperties", name, args ?? new BlobServicePropertiesArgs(), MakeResourceOptions(options, "")) { } private BlobServiceProperties(string name, Input<string> id, CustomResourceOptions? options = null) : base("azure-native:storage/v20210401:BlobServiceProperties", 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:storage/v20210401:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20180701:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20180701:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20181101:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20181101:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20190401:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20190401:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20190601:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20190601:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20200801preview:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20200801preview:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20210101:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20210101:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20210201:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20210201:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-native:storage/v20210601:BlobServiceProperties"}, new Pulumi.Alias { Type = "azure-nextgen:storage/v20210601:BlobServiceProperties"}, }, }; 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 BlobServiceProperties 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 BlobServiceProperties Get(string name, Input<string> id, CustomResourceOptions? options = null) { return new BlobServiceProperties(name, id, options); } } public sealed class BlobServicePropertiesArgs : Pulumi.ResourceArgs { /// <summary> /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. /// </summary> [Input("accountName", required: true)] public Input<string> AccountName { get; set; } = null!; /// <summary> /// Deprecated in favor of isVersioningEnabled property. /// </summary> [Input("automaticSnapshotPolicyEnabled")] public Input<bool>? AutomaticSnapshotPolicyEnabled { get; set; } /// <summary> /// The name of the blob Service within the specified storage account. Blob Service Name must be 'default' /// </summary> [Input("blobServicesName")] public Input<string>? BlobServicesName { get; set; } /// <summary> /// The blob service properties for change feed events. /// </summary> [Input("changeFeed")] public Input<Inputs.ChangeFeedArgs>? ChangeFeed { get; set; } /// <summary> /// The blob service properties for container soft delete. /// </summary> [Input("containerDeleteRetentionPolicy")] public Input<Inputs.DeleteRetentionPolicyArgs>? ContainerDeleteRetentionPolicy { get; set; } /// <summary> /// Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. /// </summary> [Input("cors")] public Input<Inputs.CorsRulesArgs>? Cors { get; set; } /// <summary> /// DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. /// </summary> [Input("defaultServiceVersion")] public Input<string>? DefaultServiceVersion { get; set; } /// <summary> /// The blob service properties for blob soft delete. /// </summary> [Input("deleteRetentionPolicy")] public Input<Inputs.DeleteRetentionPolicyArgs>? DeleteRetentionPolicy { get; set; } /// <summary> /// Versioning is enabled if set to true. /// </summary> [Input("isVersioningEnabled")] public Input<bool>? IsVersioningEnabled { get; set; } /// <summary> /// The blob service property to configure last access time based tracking policy. /// </summary> [Input("lastAccessTimeTrackingPolicy")] public Input<Inputs.LastAccessTimeTrackingPolicyArgs>? LastAccessTimeTrackingPolicy { get; set; } /// <summary> /// The name of the resource group within the user's subscription. The name is case insensitive. /// </summary> [Input("resourceGroupName", required: true)] public Input<string> ResourceGroupName { get; set; } = null!; /// <summary> /// The blob service properties for blob restore policy. /// </summary> [Input("restorePolicy")] public Input<Inputs.RestorePolicyPropertiesArgs>? RestorePolicy { get; set; } public BlobServicePropertiesArgs() { } } }
49.24359
253
0.636206
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/Storage/V20210401/BlobServiceProperties.cs
11,529
C#
/*----------------------------------------------------------------------- Copyright (c) Microsoft Corporation. Licensed under the MIT license. -----------------------------------------------------------------------*/ using Dapper; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Text; using System.Reflection; using Namotion.Reflection; namespace AdsGoFast.GetTaskInstanceJSON { /// <summary> /// Handles creation of Base Object that needs to be sent to ADF or AF includes internal properties etc that are not in the POCO /// </summary> partial class ADFJsonBaseTask : BaseTask { private Logging logging { get; set; } private JObject _JsonObjectForADF { get; set; } private JObject _TaskMasterJson { get; set; } private JObject _SourceSystemJson { get; set; } private JObject _TargetSystemJson { get; set; } private JObject _TaskMasterJsonSource { get; set; } private JObject _TaskMasterJsonTarget { get; set; } private JObject _TaskInstanceJson { get; set; } private bool _TaskIsValid { get; set; } public ADFJsonBaseTask(BaseTask T, Logging logging) { this.logging = logging; foreach (PropertyInfo SourcePropertyInfo in T.GetType() .GetProperties( BindingFlags.Public | BindingFlags.Instance)) { PropertyInfo TargetPropertyInfo = this.GetType().GetProperty(SourcePropertyInfo.Name, BindingFlags.Public | BindingFlags.Instance); if (null != TargetPropertyInfo && TargetPropertyInfo.CanWrite) { TargetPropertyInfo.SetValue(this, SourcePropertyInfo.GetValue(T), null); } } } /// <summary> /// Adds the default attributes common across all task types /// </summary> /// <param name="ExecutionUid"></param> public void CreateJsonObjectForADF(Guid ExecutionUid) { _JsonObjectForADF = new JObject { ["TaskInstanceId"] = this.TaskInstanceId, ["TaskMasterId"] = this.TaskMasterId, ["TaskStatus"] = this.TaskStatus, ["TaskType"] = this.TaskType, ["Enabled"] = 1, ["ExecutionUid"] = ExecutionUid, ["NumberOfRetries"] = this.NumberOfRetries, ["DegreeOfCopyParallelism"] = this.DegreeOfCopyParallelism, ["KeyVaultBaseUrl"] = this.SourceKeyVaultBaseUrl == null ? this.TargetKeyVaultBaseUrl : this.SourceKeyVaultBaseUrl, ["ScheduleMasterId"] = this.ScheduleMasterId, ["TaskGroupConcurrency"] = this.TaskGroupConcurrency, ["TaskGroupPriority"] = this.TaskGroupPriority, ["TaskExecutionType"] = this.TaskExecutionType }; JObject DataFactory = new JObject { ["Id"] = this.DataFactoryId, ["Name"] = this.DataFactoryName, ["ResourceGroup"] = this.DataFactoryResourceGroup, ["SubscriptionId"] = this.DataFactorySubscriptionId, ["ADFPipeline"] = this.ADFPipeline }; _JsonObjectForADF["DataFactory"] = DataFactory; } public JObject GetJsonObjectForADF() { return _JsonObjectForADF; } public void CreateInternalObjectsForProcessingJsonFields() { this._TaskMasterJson = new JObject(); this._TaskMasterJsonSource = new JObject(); if (Shared.JsonHelpers.IsValidJson(this.TaskMasterJson)) { _TaskMasterJson = JObject.Parse(this.TaskMasterJson); if (Shared.JsonHelpers.CheckForJSONProperty(logging, "Source", JObject.Parse(this.TaskMasterJson))) { _TaskMasterJsonSource = (JObject)_TaskMasterJson["Source"]; } } this._TaskMasterJsonTarget = new JObject(); if (Shared.JsonHelpers.IsValidJson(this.TaskMasterJson)) { _TaskMasterJson = JObject.Parse(this.TaskMasterJson); if (Shared.JsonHelpers.CheckForJSONProperty(logging, "Target", JObject.Parse(this.TaskMasterJson))) { _TaskMasterJsonTarget = (JObject)_TaskMasterJson["Target"]; } } _TargetSystemJson = new JObject(); if (Shared.JsonHelpers.IsValidJson(this.TargetSystemJSON)) { _TargetSystemJson = JObject.Parse(this.TargetSystemJSON); } _SourceSystemJson = new JObject(); if (Shared.JsonHelpers.IsValidJson(this.SourceSystemJSON)) { _SourceSystemJson = JObject.Parse(this.SourceSystemJSON); } _TaskInstanceJson = new JObject(); if (Shared.JsonHelpers.IsValidJson(this.TaskInstanceJson)) { _TaskInstanceJson = JObject.Parse(this.TaskInstanceJson); } } //Processing Core ***/ public JObject ProcessRoot(TaskTypeMappings ttm,SourceAndTargetSystem_JsonSchemas system_schemas) { CreateInternalObjectsForProcessingJsonFields(); ProcessSourceSystem(system_schemas); ProcessTargetSystem(system_schemas); ProcessTaskInstance(ttm); ProcessTaskMaster(ttm); return _JsonObjectForADF; } /***** Process Source *****/ public void ProcessSourceSystem(SourceAndTargetSystem_JsonSchemas schemas) { bool Processed = false; JObject Source = new JObject { ["Type"] = this.SourceSystemType }; //Validate SourceSystemJson based on JSON Schema string sourcesystem_schema = schemas.GetBySystemType(this.SourceSystemType).JsonSchema; _TaskIsValid = Shared.JsonHelpers.ValidateJsonUsingSchema(logging, sourcesystem_schema, this.SourceSystemJSON, "Failed to validate SourceSystem JSON for System Type: " + this.SourceSystemType + ". "); if (SourceSystemType == "ADLS" || SourceSystemType == "Azure Blob" || SourceSystemType == "File") { ProcessSourceSystem_TypeIsStorage(ref Source); Processed = true; } if (SourceSystemType == "Azure SQL" || SourceSystemType == "SQL Server") { ProcessSourceSystem_TypeIsSQL(ref Source); Processed = true; } if (!Processed) { ProcessSourceSystem_Default(ref Source); } _JsonObjectForADF["Source"] = Source; } public void ProcessSourceSystem_Default(ref JObject Source) { Source.Merge(_SourceSystemJson, new JsonMergeSettings { // union array values together to avoid duplicates MergeArrayHandling = MergeArrayHandling.Union }); } public void ProcessSourceSystem_TypeIsStorage(ref JObject Source) { AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsStorage SourceSystemObject = JsonConvert.DeserializeObject<AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsStorage>(JsonConvert.SerializeObject(_SourceSystemJson)); //Properties on Source System Source["SystemId"] = this.SourceSystemId; Source["StorageAccountName"] = this.SourceSystemServer; Source["StorageAccountAccessMethod"] = this.SourceSystemAuthType; if (Source["StorageAccountAccessMethod"].ToString() == "SASURI") { //ToDo Raise error if null Source["StorageAccountSASUriKeyVaultSecretName"] = SourceSystemObject.SASUriKeyVaultSecretName; } Source["StorageAccountContainer"] = SourceSystemObject.Container; } public void ProcessSourceSystem_TypeIsSQL(ref JObject Source) { AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsSQL SourceSystemObject = JsonConvert.DeserializeObject<AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsSQL>(JsonConvert.SerializeObject(_SourceSystemJson)); JObject Database = new JObject { //Properties on Source System ["SystemName"] = this.SourceSystemServer, ["Name"] = SourceSystemObject.Database, ["AuthenticationType"] = this.SourceSystemAuthType }; if (Database["AuthenticationType"].ToString() == "Username/Password") { //ToDo Raise Error if these are null Database["UsernameKeyVaultSecretName"] = SourceSystemObject.UsernameKeyVaultSecretName; Database["PasswordKeyVaultSecretName"] = SourceSystemObject.PasswordKeyVaultSecretName; } if (Database["AuthenticationType"].ToString() == "SQLAuth") { //ToDo Raise Error if these are null Database["Username"] = this.SourceSystemUserName; Database["PasswordKeyVaultSecretName"] = this.SourceSystemSecretName; } Source["Database"] = Database; } /***** Process Target *****/ public void ProcessTargetSystem(SourceAndTargetSystem_JsonSchemas schemas) { JObject Target = new JObject { ["Type"] = this.TargetSystemType }; //Validate SourceSystemJson based on JSON Schema string targetsystem_schema = schemas.GetBySystemType(this.TargetSystemType).JsonSchema; _TaskIsValid = Shared.JsonHelpers.ValidateJsonUsingSchema(logging, targetsystem_schema, this.TargetSystemJSON, "Failed to validate TargetSystem JSON for System Type: " + this.TargetSystemId + ". "); if (TargetSystemType == "ADLS" || TargetSystemType == "Azure Blob" || TargetSystemType == "File") { ProcessTargetSystem_TypeIsStorage(ref Target); goto ProcessTargetSystemEnd; } if (TargetSystemType == "Azure SQL" || TargetSystemType == "SQL Server") { ProcessTargetSystem_TypeIsSQL(ref Target); goto ProcessTargetSystemEnd; } //Default Processing Branch Target.Merge(_TargetSystemJson, new JsonMergeSettings { // union array values together to avoid duplicates MergeArrayHandling = MergeArrayHandling.Union }); ProcessTargetSystemEnd: _JsonObjectForADF["Target"] = Target; } public void ProcessTargetSystem_TypeIsStorage(ref JObject Target) { AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsStorage TargetSystemObject = JsonConvert.DeserializeObject<AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsStorage>(JsonConvert.SerializeObject(_TargetSystemJson)); //Properties on Source System Target["SystemId"] = this.TargetSystemId; Target["StorageAccountName"] = this.TargetSystemServer; Target["StorageAccountAccessMethod"] = this.TargetSystemAuthType; if (Target["StorageAccountAccessMethod"].ToString() == "SASURI") { //ToDo Raise error if null Target["StorageAccountSASUriKeyVaultSecretName"] = TargetSystemObject.SASUriKeyVaultSecretName; } Target["StorageAccountContainer"] = TargetSystemObject.Container; } public void ProcessTargetSystem_TypeIsSQL(ref JObject Target) { AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsSQL TargetSystemObject = JsonConvert.DeserializeObject<AdsGoFast.GetTaskInstanceJSON.SystemJson.TypeIsSQL>(JsonConvert.SerializeObject(_TargetSystemJson)); JObject Database = new JObject { //Properties on Source System ["SystemName"] = this.TargetSystemServer, ["Name"] = TargetSystemObject.Database, ["AuthenticationType"] = this.TargetSystemAuthType }; if (Database["AuthenticationType"].ToString() == "Username/Password") { //ToDo Raise Error if these are null Database["UsernameKeyVaultSecretName"] = TargetSystemObject.UsernameKeyVaultSecretName; Database["PasswordKeyVaultSecretName"] = TargetSystemObject.PasswordKeyVaultSecretName; } if (Database["AuthenticationType"].ToString() == "SQLAuth") { //ToDo Raise Error if these are null Database["Username"] = this.TargetSystemUserName; Database["PasswordKeyVaultSecretName"] = this.TargetSystemSecretName; } Target["Database"] = Database; } } //Generates the JSON array that needs to be iterated class ADFJsonArray : IDisposable { private Logging logging { get; set; } private Guid ExecutionUid { get; set; } private short TaskRunnerId { get; set; } private DataTable InvalidTIs { get; set; } private IEnumerable<AdsGoFast.GetTaskInstanceJSON.BaseTask> TIs { get; set; } private JArray TIsJson {get; set;} public ADFJsonArray(Guid _ExecutionUid, short _TaskRunnerId, Logging _logging) { this.logging = _logging; this.ExecutionUid = _ExecutionUid; this.TaskRunnerId = _TaskRunnerId; TaskMetaDataDatabase TMD = new TaskMetaDataDatabase(); //Get All Task Instance Objects for the current Framework Task Runner this.TIs = TMD.GetSqlConnection().Query<AdsGoFast.GetTaskInstanceJSON.BaseTask>(string.Format("Exec [dbo].[GetTaskInstanceJSON] {0}", TaskRunnerId.ToString())); this.TIsJson = new JArray(); //Instantiate the Collections that contain the JSON Schemas using TaskTypeMappings ttm = new TaskTypeMappings(); using SourceAndTargetSystem_JsonSchemas system_schemas = new SourceAndTargetSystem_JsonSchemas(); //Set up table to Store Invalid Task Instance Objects this.InvalidTIs = new DataTable(); InvalidTIs.Columns.Add("ExecutionUid", System.Type.GetType("System.Guid")); InvalidTIs.Columns.Add("TaskInstanceId", System.Type.GetType("System.Int64")); InvalidTIs.Columns.Add("LastExecutionComment", System.Type.GetType("System.String")); foreach (AdsGoFast.GetTaskInstanceJSON.BaseTask TBase in TIs) { try { bool TaskIsValid = true; //Cast Raw Database Result into Base Class for ADF Json Creation ADFJsonBaseTask T = (ADFJsonBaseTask)(TBase); //T.logging = logging; //Set the base properties using data stored in non-json columns of the database T.CreateJsonObjectForADF(ExecutionUid); JObject Root = T.GetJsonObjectForADF(); T.CreateInternalObjectsForProcessingJsonFields(); T.ProcessSourceSystem(system_schemas); T.ProcessTargetSystem(system_schemas); T.ProcessTaskMaster(ttm); } catch (Exception e) { } } } public void Dispose() { //ToDo Add Internal Object Disposal } } }
40.761421
222
0.594147
[ "MIT" ]
JonHarding/azure-data-services-go-fast-codebase
solution/FunctionApp/TaskMetaData/GetTaskInstanceJSON/ADFJsonBaseTask.cs
16,060
C#
using System.Collections.Generic; using System.Linq; using AdventOfCode.Common; using JetBrains.Annotations; namespace AdventOfCode.Solutions._2015._14; [UsedImplicitly] public class Year2015Day14 : ISolution { public object Part1(IEnumerable<string> lines) { var deers = GetDeers(lines); var enumerable = deers as Deer[] ?? deers.ToArray(); for (var i = 0; i < 2503; i++) { foreach (var deer in enumerable) { deer.Tick(); } } return enumerable.Select(r => r.TravelledDistance).Max().ToString(); } public object Part2(IEnumerable<string> lines) { var deers = GetDeers(lines); var enumerable = deers as Deer[] ?? deers.ToArray(); for (var i = 0; i < 2503; i++) { foreach (var deer in enumerable) { deer.Tick(); } var max = enumerable.Select(r => r.TravelledDistance).Max(); enumerable = enumerable.Select(r => { if(r.TravelledDistance == max) r.Points++; return r; }).ToArray(); } return enumerable.Select(r => r.Points).Max().ToString(); } private class Deer { private readonly int _speed; private readonly int _flyTime; private readonly int _restTime; private int _flyTimeLeft; private int _restTimeLeft; private bool _isResting; public int TravelledDistance { get; set; } public int Points { get; set; } public Deer(int speed, int flyTime, int restTime) { _speed = speed; _flyTime = flyTime; _restTime = restTime; _flyTimeLeft = flyTime; } public void Tick() { if (_isResting) { _restTimeLeft--; if (_restTimeLeft != 0) return; _flyTimeLeft = _flyTime; _isResting = false; return; } _flyTimeLeft--; TravelledDistance += _speed; if(_flyTimeLeft != 0) return; _restTimeLeft = _restTime; _isResting = true; } } private static IEnumerable<Deer> GetDeers(IEnumerable<string> lines) { return lines .Select(r => r.Split(" ")) .Select(r => new Deer(int.Parse(r[3]), int.Parse(r[6]), int.Parse(r[13]))); } }
20.734694
78
0.643209
[ "MIT" ]
PDmatrix/advent-of-code
CSharp/Solutions/2015/14/Year2015Day14.cs
2,032
C#
using System; using System.Data; using System.Security.Cryptography.X509Certificates; using DbUp; using DbUp.Builder; using DbUp.Engine.Output; using DbUp.Engine.Transactions; using DbUp.Postgresql; using Npgsql; // ReSharper disable once CheckNamespace /// <summary> /// Configuration extension methods for PostgreSQL. /// </summary> public static class PostgresqlExtensions { /// <summary> /// Creates an upgrader for PostgreSQL databases. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionString">PostgreSQL database connection string.</param> /// <returns> /// A builder for a database upgrader designed for PostgreSQL databases. /// </returns> public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, string connectionString) => PostgresqlDatabase(supported, connectionString, null); /// <summary> /// Creates an upgrader for PostgreSQL databases. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionString">PostgreSQL database connection string.</param> /// <param name="schema">The schema in which to check for changes</param> /// <returns> /// A builder for a database upgrader designed for PostgreSQL databases. /// </returns> public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, string connectionString, string schema) => PostgresqlDatabase(new PostgresqlConnectionManager(connectionString), schema); /// <summary> /// Creates an upgrader for PostgreSQL databases that use SSL. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionString">PostgreSQL database connection string.</param> /// <param name="schema">The schema in which to check for changes</param> /// <param name="certificate">Certificate for securing connection.</param> /// <returns> /// A builder for a database upgrader designed for PostgreSQL databases. /// </returns> public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, string connectionString, string schema, X509Certificate2 certificate) => PostgresqlDatabase(new PostgresqlConnectionManager(connectionString, certificate), schema); /// <summary> /// Creates an upgrader for PostgreSQL databases. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionManager">The <see cref="PostgresqlConnectionManager"/> to be used during a database upgrade.</param> /// <returns> /// A builder for a database upgrader designed for PostgreSQL databases. /// </returns> public static UpgradeEngineBuilder PostgresqlDatabase(this SupportedDatabases supported, IConnectionManager connectionManager) => PostgresqlDatabase(connectionManager); /// <summary> /// Creates an upgrader for PostgreSQL databases. /// </summary> /// <param name="connectionManager">The <see cref="PostgresqlConnectionManager"/> to be used during a database upgrade.</param> /// <returns> /// A builder for a database upgrader designed for PostgreSQL databases. /// </returns> public static UpgradeEngineBuilder PostgresqlDatabase(IConnectionManager connectionManager) => PostgresqlDatabase(connectionManager, null); /// <summary> /// Creates an upgrader for PostgreSQL databases. /// </summary> /// <param name="connectionManager">The <see cref="PostgresqlConnectionManager"/> to be used during a database upgrade.</param> /// <param name="schema">The schema in which to check for changes</param> /// <returns> /// A builder for a database upgrader designed for PostgreSQL databases. /// </returns> public static UpgradeEngineBuilder PostgresqlDatabase(IConnectionManager connectionManager, string schema) { var builder = new UpgradeEngineBuilder(); builder.Configure(c => c.ConnectionManager = connectionManager); builder.Configure(c => c.ScriptExecutor = new PostgresqlScriptExecutor(() => c.ConnectionManager, () => c.Log, schema, () => c.VariablesEnabled, c.ScriptPreprocessors, () => c.Journal)); builder.Configure(c => c.Journal = new PostgresqlTableJournal(() => c.ConnectionManager, () => c.Log, () => c.Hasher, schema, "schemaversions")); builder.WithPreprocessor(new PostgresqlPreprocessor()); return builder; } /// <summary> /// Ensures that the database specified in the connection string exists. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionString">The connection string.</param> /// <returns></returns> public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString) { PostgresqlDatabase(supported, connectionString, new ConsoleUpgradeLog()); } /// <summary> /// Ensures that the database specified in the connection string exists using SSL for the connection. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionString">The connection string.</param> /// <param name="certificate">Certificate for securing connection.</param> /// <returns></returns> public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString, X509Certificate2 certificate) { PostgresqlDatabase(supported, connectionString, new ConsoleUpgradeLog(), certificate); } /// <summary> /// Ensures that the database specified in the connection string exists. /// </summary> /// <param name="supported">Fluent helper type.</param> /// <param name="connectionString">The connection string.</param> /// <param name="logger">The <see cref="DbUp.Engine.Output.IUpgradeLog"/> used to record actions.</param> /// <returns></returns> public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString, IUpgradeLog logger) { PostgresqlDatabase(supported, connectionString, logger, null); } private static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString, IUpgradeLog logger, X509Certificate2 certificate) { if (supported == null) throw new ArgumentNullException("supported"); if (string.IsNullOrEmpty(connectionString) || connectionString.Trim() == string.Empty) { throw new ArgumentNullException("connectionString"); } if (logger == null) throw new ArgumentNullException("logger"); var masterConnectionStringBuilder = new NpgsqlConnectionStringBuilder(connectionString); var databaseName = masterConnectionStringBuilder.Database; if (string.IsNullOrEmpty(databaseName) || databaseName.Trim() == string.Empty) { throw new InvalidOperationException("The connection string does not specify a database name."); } masterConnectionStringBuilder.Database = "postgres"; var logMasterConnectionStringBuilder = new NpgsqlConnectionStringBuilder(masterConnectionStringBuilder.ConnectionString); if (!string.IsNullOrEmpty(logMasterConnectionStringBuilder.Password)) { logMasterConnectionStringBuilder.Password = string.Empty.PadRight(masterConnectionStringBuilder.Password.Length, '*'); } logger.WriteInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString); using (var connection = new NpgsqlConnection(masterConnectionStringBuilder.ConnectionString)) { if (certificate != null) { connection.ProvideClientCertificatesCallback += certs => certs.Add(certificate); } connection.Open(); var sqlCommandText = string.Format ( @"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{0}' limit 1;", databaseName ); // check to see if the database already exists.. using (var command = new NpgsqlCommand(sqlCommandText, connection) { CommandType = CommandType.Text }) { var results = (int?)command.ExecuteScalar(); // if the database exists, we're done here... if (results.HasValue && results.Value == 1) { return; } } sqlCommandText = string.Format ( "create database \"{0}\";", databaseName ); // Create the database... using (var command = new NpgsqlCommand(sqlCommandText, connection) { CommandType = CommandType.Text }) { command.ExecuteNonQuery(); } logger.WriteInformation(@"Created database {0}", databaseName); } } /// <summary> /// Tracks the list of executed scripts in a SQL Server table. /// </summary> /// <param name="builder">The builder.</param> /// <param name="schema">The schema.</param> /// <param name="table">The table.</param> /// <returns></returns> public static UpgradeEngineBuilder JournalToPostgresqlTable(this UpgradeEngineBuilder builder, string schema, string table) { builder.Configure(c => c.Journal = new PostgresqlTableJournal(() => c.ConnectionManager, () => c.Log, () => c.Hasher, schema, table)); return builder; } }
44.387387
194
0.670591
[ "MIT" ]
ajhall/DbUp
src/dbup-postgresql/PostgresqlExtensions.cs
9,856
C#
using NSL.Runtime; using NSL.Tokenization.General; namespace NSL.Executable { public interface IInstruction { Position Start { get; } Position End { get; } int IndentDiff { get; } void Execute(Runner.State state); } public abstract class InstructionBase : IInstruction { public Position Start { get; protected set; } public Position End { get; protected set; } public virtual int IndentDiff => 0; public abstract void Execute(Runner.State state); protected InstructionBase(Position start, Position end) { Start = start; End = end; } } }
23.344828
63
0.602659
[ "MIT" ]
bt7s7k7/NSL
src/NSLCSharp/Executable/InstructionBase.cs
677
C#
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Xml.Linq; using Dapper; using EQService.ApiSubmissionModel; using EQService.MessageArguments; using EQService.MessageHandlers; using EQService.MessageTypeModels; namespace EQService.MessageTypeHandlers { /// <summary> /// Handler class for ship to store emails. /// </summary> public sealed class ShipToHomeMessageTypeHandler : MessageTypeHandlerBase<ShipToHomeMessageArgs>, IMessageTypeHandler { /// <summary> /// handel method that brings the map, getData and arguments together for Ship to store /// </summary> /// <param name="message"></param> /// <returns></returns> public ApiSubmission Handle(Message message) { var Args = ParseMessageArguments(message); var dataResult = GetData(Args); var model = new ApiSubmission(); //Checks to see if the dataResult returns a null value. if (dataResult == null) { model = null; } else if (dataResult != null) { model = Map(dataResult, message); } return model; } /// <summary> /// /// </summary> /// <param name="message"></param> /// <returns></returns> protected override ShipToHomeMessageArgs ParseMessageArguments(Message message) { XDocument doc = XDocument.Parse(message.Arguments); var root = doc.Root; var result = new ShipToHomeMessageArgs(); return result; } /// <summary> /// Mapper method to write out the Xml from the data gathered by the GetData method. /// </summary> /// <param name="model"></param> /// <returns></returns> private ApiSubmission Map(MessageTypeModelWrapper model, Message message) { ApiSubmission mapper = new ApiSubmission(); var rt = model.RT; var odts = model.ODTr; mapper.CustomerID = rt.CustId; mapper.Records = new List<ApiSubmissionRecords>(); var RecepientTransRecord = new ApiSubmissionRecords(); RecepientTransRecord.SubmissionSequence = 2; RecepientTransRecord.FormId = int.Parse(rt.RT_FormID); RecepientTransRecord.TableName = "Recepient_Transactional"; RecepientTransRecord.Records = new List<ApiSubmissionRecord>(); var rtrecord = new ApiSubmissionRecord(); rtrecord.Fields = new List<ApiSubmissionRecordField>(); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "EQTMID", Value = message.EQTMID }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "email", Value = rt.ToEmail }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "division", Value = rt.Division }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "name_first", Value = rt.FirstName }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "referral_note", Value = rt.ReferralNote }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "referrer_name", Value = rt.ReferrerName }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "sender_email", Value = rt.SenderEmail }); rtrecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "subject", Value = rt.Subject }); RecepientTransRecord.Records.Add(rtrecord); var OrderDetailTransRecord = new ApiSubmissionRecords(); OrderDetailTransRecord.SubmissionSequence = 1; OrderDetailTransRecord.FormId = int.Parse(rt.ODT_FormID); OrderDetailTransRecord.TableName = "Order_Detail_Transactional"; OrderDetailTransRecord.Records = new List<ApiSubmissionRecord>(); foreach (var odt in odts) { var odtRecord = new ApiSubmissionRecord(); odtRecord.Fields = new List<ApiSubmissionRecordField>(); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "EQTMID", Value = message.EQTMID }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "brand", Value = odt.Brand }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "color", Value = odt.Color }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "productid", Value = odt.ProductID }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "producturl", Value = odt.ProductUrl }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "productvariantid", Value = odt.ProductvariantID }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "quantity", Value = odt.Quantity }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "size", Value = odt.Size }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "thumbnailurl", Value = odt.ThumbnailUrl }); odtRecord.Fields.Add(new ApiSubmissionRecordField { FieldName = "MaterialType", Value = odt.MaterialType }); OrderDetailTransRecord.Records.Add(odtRecord); } mapper.Records.Add(RecepientTransRecord); mapper.Records.Add(OrderDetailTransRecord); return mapper; } /// <summary> /// /// </summary> /// <param name="args"></param> /// <returns></returns> private MessageTypeModelWrapper GetData(ShipToHomeMessageArgs args) { var rt = new RecipientTransactionalModelMaster(); IEnumerable<OrderDetailTransactionalModelMaster> odts = null; using (var con = new SqlConnection("")) { con.Open(); using (var multi = con.QueryMultiple("[].[dbo].[]", param: args, commandType: CommandType.StoredProcedure)) { rt = multi.Read<RecipientTransactionalModelMaster>().FirstOrDefault(); odts = multi.Read<OrderDetailTransactionalModelMaster>(); } } if (rt == null || !odts.Any()) { throw new NullReferenceException(); } return new MessageTypeModelWrapper() { RT = rt, ODTr = odts }; } } }
41.147929
133
0.588295
[ "MIT" ]
Saifune87/EQSample
MessageTypesHandlers/ShipToHomeMessageTypeHandler.cs
6,956
C#
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Composition; namespace StarkPlatform.Compiler.Options.Providers { [AttributeUsage(AttributeTargets.Class)] internal sealed class ExportOptionProviderAttribute : ExportAttribute { public ExportOptionProviderAttribute() : base(typeof(IOptionProvider)) { } } }
30.5625
161
0.738241
[ "BSD-2-Clause", "MIT" ]
encrypt0r/stark
src/compiler/StarkPlatform.Compiler.Workspaces/Options/Providers/ExportOptionProviderAttribute.cs
491
C#
using DatabaseUpgraderLib; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; using DatabaseModelLib; using SqlDatabaseModelLib; namespace SqlDatabaseUpgraderLib { public class SqlDatabaseUpgrader : DatabaseUpgrader<SqlConnection, SqlCommand,SqlTransaction> { public SqlDatabaseUpgrader(SqlDatabase Database) : base(Database) { } protected override SqlConnection OnCreateConnection() { SqlConnection connection; connection = new SqlConnection(@"Data Source=" + ((SqlDatabase)Database).DataSource + ";Integrated Security=True;"); if (((SqlDatabase)Database).AdditionalParameters != null) connection.ConnectionString += ((SqlDatabase)Database).AdditionalParameters; return connection; } private string GetTypeName(IColumn Column) { string result; if (Column.DataType.IsEnum) return "int"; switch (Column.DataType.Name) { case "Text": result = "nvarchar(MAX)"; break; case "Byte": result = "tinyint"; break; case "Int32": result = "int"; break; case "UInt16": result = "int"; break; case "Int64": result = "bigint"; break; case "Boolean": result = "bit"; break; case "DateTime": result = "DateTime"; break; case "TimeSpan": result = "Time(7)"; break; case "Byte[]": result = "varbinary(max)"; break; default: throw (new NotImplementedException("Cannot convert CLR type " + Column.DataType.Name)); } if (Column.IsIdentity) result += " IDENTITY(1, 1)"; return result; } protected override SqlCommand OnCreateColumnCreateCommand(IColumn Column) { string sql; SqlCommand command; sql = "alter table " + OnFormatTableName(Column.TableName) + " ADD " + OnFormatColumnName(Column) + " " + GetTypeName(Column) + (Column.IsNullable ? " NULL" : " NOT NULL"); ; if (Column.DefaultValue != null) sql += " DEFAULT('" + Column.DefaultValue.ToString() + "')"; command = new SqlCommand(sql); return command; } protected override SqlCommand OnCreateRelationCreateCommand(IRelation Relation) { string sql; sql = "ALTER TABLE [" + Relation.ForeignColumn.TableName + "] WITH CHECK ADD CONSTRAINT [FK_" + Relation.ForeignColumn.TableName + "_" + Relation.PrimaryColumn.TableName + "] FOREIGN KEY([" + Relation.ForeignColumn.Name + "]) " + "REFERENCES [" + Relation.PrimaryColumn.TableName + "] ([" + Relation.PrimaryColumn.Name + "])"; if (Relation.DeleteReferentialAction == DeleteReferentialAction.Delete) sql += " ON DELETE CASCADE"; return new SqlCommand(sql); } protected override SqlCommand OnCreateTableCreateCommand(ITable Table) { string sql; sql = "create table [" + Table.Name + "] ("; foreach (IColumn column in Table.Columns.Where(item => (item.Revision == 0 ) && !item.IsVirtual)) { sql += OnFormatColumnName(column) + " " + GetTypeName(column) + (column.IsNullable ? " NULL," : " NOT NULL,"); } sql += "CONSTRAINT [PK_" + Table.Name + "]" + " PRIMARY KEY CLUSTERED ([" + Table.PrimaryKey.Name + "] ASC))"; return new SqlCommand(sql); } protected override SqlCommand OnCreateTableDropCommand(ITable Table) { string sql; sql = "drop table [" + Table.Name + "];"; return new SqlCommand(sql); } protected override async Task<bool> OnDatabaseExistsAsync() { SqlCommand command; SqlConnection connection = null; SqlDataReader reader; using (connection = OnCreateConnection()) { await connection.OpenAsync(); command = new SqlCommand("select name from sys.databases where name = '" + Database.Name + "'"); command.Connection = connection; reader = await command.ExecuteReaderAsync(); return reader.HasRows; } } protected override async Task<bool> OnSchemaExistsAsync() { SqlCommand command; SqlConnection connection = null; SqlDataReader reader; using (connection = OnCreateConnection()) { await connection.OpenAsync(); connection.ChangeDatabase(Database.Name); command = new SqlCommand("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'UpgradeLog'"); command.Connection = connection; reader = await command.ExecuteReaderAsync(); return reader.HasRows; } } protected override Task OnBackupAsync(string Path) { throw new NotImplementedException(); } protected override async Task OnDropAsync() { SqlCommand command; SqlConnection connection = null; using (connection = OnCreateConnection()) { await connection.OpenAsync(); command = new SqlCommand("drop database [" + Database.Name + "]"); command.Connection = connection; await command.ExecuteNonQueryAsync(); } } protected override async Task OnCreateDatabaseAsync() { SqlCommand command; SqlConnection connection; using (connection = OnCreateConnection()) { await connection.OpenAsync(); command = new SqlCommand("create database [" + Database.Name + "]"); command.Connection = connection; await command.ExecuteNonQueryAsync(); } } } }
25.223301
137
0.677252
[ "MIT" ]
dfgs/MVVMLib
SqlDatabaseUpgraderLib/SqlDatabaseUpgrader.cs
5,198
C#
using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; namespace Meziantou.Analyzer.Rules { [ExportCodeFixProvider(LanguageNames.CSharp), Shared] public sealed class NamedParameterFixer : CodeFixProvider { public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(RuleIdentifiers.UseNamedParameter); public override FixAllProvider GetFixAllProvider() { return WellKnownFixAllProviders.BatchFixer; } public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); // In case the ArrayCreationExpressionSyntax is wrapped in an ArgumentSyntax or some other node with the same span, // get the innermost node for ties. var nodeToFix = root?.FindNode(context.Span, getInnermostNodeForTie: true); if (nodeToFix == null) return; var title = "Add parameter name"; var codeAction = CodeAction.Create( title, ct => AddParameterName(context.Document, nodeToFix, ct), equivalenceKey: title); context.RegisterCodeFix(codeAction, context.Diagnostics); } private static async Task<Document> AddParameterName(Document document, SyntaxNode nodeToFix, CancellationToken cancellationToken) { var editor = await DocumentEditor.CreateAsync(document, cancellationToken).ConfigureAwait(false); var semanticModel = editor.SemanticModel; var argument = nodeToFix.FirstAncestorOrSelf<ArgumentSyntax>(); if (argument == null || argument.NameColon != null) return document; var parameters = FindParameters(semanticModel, argument); if (parameters == null) return document; var index = NamedParameterAnalyzer.ArgumentIndex(argument); if (index < 0 || index >= parameters.Count) return document; var parameter = parameters[index]; var argumentName = parameter.Name; editor.ReplaceNode(argument, argument.WithNameColon(SyntaxFactory.NameColon(argumentName))); return editor.GetChangedDocument(); } private static IReadOnlyList<IParameterSymbol>? FindParameters(SemanticModel semanticModel, SyntaxNode? node) { while (node != null) { switch (node) { case InvocationExpressionSyntax invocationExpression: var method = (IMethodSymbol?)semanticModel.GetSymbolInfo(invocationExpression).Symbol; return method?.Parameters; case ObjectCreationExpressionSyntax objectCreationExpression: var ctor = (IMethodSymbol?)semanticModel.GetSymbolInfo(objectCreationExpression).Symbol; return ctor?.Parameters; case ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpression: var implicitCtor = (IMethodSymbol?)semanticModel.GetSymbolInfo(implicitObjectCreationExpression).Symbol; return implicitCtor?.Parameters; case ConstructorInitializerSyntax constructorInitializerSyntax: var ctor2 = (IMethodSymbol?)semanticModel.GetSymbolInfo(constructorInitializerSyntax).Symbol; return ctor2?.Parameters; } node = node.Parent; } return null; } } }
42.092784
138
0.647808
[ "MIT" ]
jannesrsa/Meziantou.Analyzer
src/Meziantou.Analyzer/Rules/NamedParameterFixer.cs
4,085
C#
using System; using System.CodeDom.Compiler; using System.IO; using System.Linq; using System.Runtime.Serialization; using ysoserial.Helpers; namespace ysoserial.Generators { [Serializable] public class PayloadClassFromFile : PayloadClass { protected PayloadClassFromFile(SerializationInfo info, StreamingContext context) : base(info, context) { } public PayloadClassFromFile(string file) { string[] files = file.Split(new[] { ';' }).Select(s => s.Trim()).ToArray(); CodeDomProvider codeDomProvider = CodeDomProvider.CreateProvider("CSharp"); CompilerParameters compilerParameters = new CompilerParameters(); compilerParameters.CompilerOptions = "-t:library -o+"; compilerParameters.ReferencedAssemblies.AddRange(files.Skip(1).ToArray()); CompilerResults compilerResults = codeDomProvider.CompileAssemblyFromFile(compilerParameters, files[0]); if (compilerResults.Errors.Count > 0) { foreach (CompilerError error in compilerResults.Errors) { Console.Error.WriteLine(error.ErrorText); } Environment.Exit(-1); } base.assemblyBytes = File.ReadAllBytes(compilerResults.PathToAssembly); File.Delete(compilerResults.PathToAssembly); } } public class ActivitySurrogateSelectorFromFileGenerator : ActivitySurrogateSelectorGenerator { public override string AdditionalInfo() { return "Another variant of the ActivitySurrogateSelector gadget. This gadget interprets the command parameter as path to the .cs file that should be compiled as exploit class. Use semicolon to separate the file from additionally required assemblies, e. g., '-c ExploitClass.cs;System.Windows.Forms.dll'"; } public override string Name() { return "ActivitySurrogateSelectorFromFile"; } public override object Generate(string formatter, InputArgs inputArgs) { try { PayloadClassFromFile payload = new PayloadClassFromFile(inputArgs.Cmd); return Serialize(payload, formatter, inputArgs); } catch(System.IO.FileNotFoundException e1) { Console.WriteLine("Error in provided file(s): \r\n" + e1.Message); return ""; } } } }
38.424242
316
0.630915
[ "MIT" ]
ekgg/ysoserial.net
ysoserial/Generators/ActivitySurrogateSelectorFromFileGenerator.cs
2,538
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Node { public int X; public int Y; public bool IsWall; public Vector3 Position; public Node ParentNode; public int G;//현재 비용 public int H;//맨해튼 거리 사용 public int F { get { return G + H; } } public Node(bool _isWall, Vector3 _position, int _x, int _y) { IsWall = _isWall; Position = _position; X = _x; Y = _y; } }
17.428571
64
0.602459
[ "MIT" ]
gaebhi/PathFinder_A-Star
Assets/Scripts/Path/Node.cs
512
C#
namespace FunnelWeb.Settings { public interface ISettings { } }
13.5
31
0.617284
[ "BSD-3-Clause" ]
dsmalik/FunnelWeb
src/FunnelWeb/Settings/ISettings.cs
78
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.Models.Api20210210 { using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; /// <summary>Input definition for test failover cleanup input properties.</summary> [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupInputPropertiesTypeConverter))] public partial class TestFailoverCleanupInputProperties { /// <summary> /// <c>AfterDeserializeDictionary</c> will be called after the deserialization has finished, allowing customization of the /// object before it is returned. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); /// <summary> /// <c>AfterDeserializePSObject</c> will be called after the deserialization has finished, allowing customization of the object /// before it is returned. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); /// <summary> /// <c>BeforeDeserializeDictionary</c> will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter. /// Implement this method in a partial class to enable this behavior. /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return /// instantly.</param> partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); /// <summary> /// <c>BeforeDeserializePSObject</c> will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter. /// Implement this method in a partial class to enable this behavior. /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return /// instantly.</param> partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// <summary> /// Deserializes a <see cref="global::System.Collections.IDictionary" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.TestFailoverCleanupInputProperties" /// />. /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> /// <returns> /// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputProperties" /// />. /// </returns> public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TestFailoverCleanupInputProperties(content); } /// <summary> /// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.TestFailoverCleanupInputProperties" /// />. /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> /// <returns> /// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputProperties" /// />. /// </returns> public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TestFailoverCleanupInputProperties(content); } /// <summary> /// Creates a new instance of <see cref="TestFailoverCleanupInputProperties" />, deserializing the content from a json string. /// </summary> /// <param name="jsonText">a string containing a JSON serialized instance of this model.</param> /// <returns>an instance of the <see cref="className" /> model class.</returns> public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); /// <summary> /// Deserializes a <see cref="global::System.Collections.IDictionary" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.TestFailoverCleanupInputProperties" /// />. /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> internal TestFailoverCleanupInputProperties(global::System.Collections.IDictionary content) { bool returnNow = false; BeforeDeserializeDictionary(content, ref returnNow); if (returnNow) { return; } // actually deserialize ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); AfterDeserializeDictionary(content); } /// <summary> /// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.TestFailoverCleanupInputProperties" /// />. /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> internal TestFailoverCleanupInputProperties(global::System.Management.Automation.PSObject content) { bool returnNow = false; BeforeDeserializePSObject(content, ref returnNow); if (returnNow) { return; } // actually deserialize ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.ITestFailoverCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); AfterDeserializePSObject(content); } /// <summary>Serializes this instance to a json string.</summary> /// <returns>a <see cref="System.String" /> containing this model serialized to JSON text.</returns> public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); } /// Input definition for test failover cleanup input properties. [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupInputPropertiesTypeConverter))] public partial interface ITestFailoverCleanupInputProperties { } }
63.391304
340
0.697417
[ "MIT" ]
Agazoth/azure-powershell
src/Migrate/generated/api/Models/Api20210210/TestFailoverCleanupInputProperties.PowerShell.cs
8,611
C#
using SIS.MvcFramework.Attributes.Validation; namespace PandaRTA.Web.ViewModels { public class LoginInputModel { [RequiredSis] [StringLengthSis(5, 20, "Username should be between 5 and 20 characters")] public string Username { get; set; } [RequiredSis] public string Password { get; set; } } }
24.857143
82
0.652299
[ "MIT" ]
EmORz/SULS
Apps/PandaRTA/PandaRTA.Web/ViewModels/Users/LoginInputModel.cs
350
C#
using System.Drawing; using System.Windows.Forms; using CefSharp.WinForms; using TweetDuck.Browser; using TweetDuck.Browser.Base; using TweetDuck.Controls; using TweetDuck.Management; using TweetDuck.Utils; using TweetLib.Core.Features; namespace TweetDuck.Dialogs { sealed partial class FormGuide : Form, FormManager.IAppDialog { private const string GuideUrl = "td://guide/index.html"; public static void Show(string hash = null) { string url = GuideUrl + (string.IsNullOrEmpty(hash) ? string.Empty : "#" + hash); FormGuide guide = FormManager.TryFind<FormGuide>(); if (guide == null) { FormBrowser owner = FormManager.TryFind<FormBrowser>(); if (owner != null) { new FormGuide(url, owner).Show(owner); } } else { guide.Reload(url); guide.Activate(); } } private readonly ChromiumWebBrowser browser; private FormGuide(string url, Form owner) { InitializeComponent(); Text = Program.BrandName + " Guide"; Size = new Size(owner.Size.Width * 3 / 4, owner.Size.Height * 3 / 4); VisibleChanged += (sender, args) => this.MoveToCenter(owner); browser = new ChromiumWebBrowser(url) { KeyboardHandler = new CustomKeyboardHandler(null) }; browser.BrowserSettings.BackgroundColor = (uint) BackColor.ToArgb(); var browserComponent = new CefBrowserComponent(browser); var browserImpl = new BaseBrowser(browserComponent); BrowserUtils.SetupDockOnLoad(browserComponent, browser); Controls.Add(browser); Disposed += (sender, args) => { browserImpl.Dispose(); browser.Dispose(); }; } protected override void Dispose(bool disposing) { if (disposing) { components?.Dispose(); } base.Dispose(disposing); } private void Reload(string url) { browser.Load(url); } } }
24.60274
84
0.695991
[ "MIT" ]
chylex/TweetDick
windows/TweetDuck/Dialogs/FormGuide.cs
1,798
C#
using NUnit.Framework; using System; public class DatabaseTests { private Database database; private readonly int[] initialData = new int[] { 1, 2 }; [SetUp] public void Setup() { this.database = new Database(initialData); } [TestCase(new int[] { 1, 2, 3 })] [TestCase(new int[] { })] public void ConstructorShouldWorkCorrectly(int[] data) { //int[] data = new int[] { 1, 2, 3 }; this.database = new Database(data); int expectedCount = data.Length; int actualCount = this.database.Count; Assert.AreEqual(expectedCount, actualCount); } [Test] public void ConstructorShouldThrowExceptionWhenBiggerCollection() { int[] data = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }; Assert.Throws<InvalidOperationException>(() => { this.database = new Database(data); }); } [Test] public void AddShoulsIncreaseCountWhenSuccess() { this.database.Add(3); int expectedCount = 3; int actualCount = this.database.Count; Assert.That(expectedCount, Is.EqualTo(actualCount)); } [Test] public void AddShouldThrowExceptionWhenDatabaseFull() { for (int i = 3; i <= 16; i++) { this.database.Add(i); } Assert.Throws<InvalidOperationException>(() => { this.database.Add(17); }); } [Test] public void RemoveShouleDecreaseCountWhenSuccessfully() { this.database.Remove(); int expectedCount = 1; int actualCount = this.database.Count; Assert.That(expectedCount, Is.EqualTo(actualCount)); } [Test] public void RemoveShouldThrowExceptionWhenEmptyCollection() { for (int i = 0; i < 2; i++) { this.database.Remove(); } Assert.Throws<InvalidOperationException>(() => { this.database.Remove(); }, "The collection is empty!"); } [TestCase(new int[] { 1, 2, 3, })] [TestCase(new int[] { })] [TestCase(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 })] public void FetchShouldReturnCopyOfDatabase(int[] expectedData) { this.database = new Database(expectedData); int[] actualData = this.database.Fetch(); CollectionAssert.AreEqual(expectedData, actualData); //CollectionAssert.AreEquivalent(expectedData, actualData); -usefull for collections with the same items but different order } }
26.03
132
0.578947
[ "MIT" ]
tonchevaAleksandra/C-Sharp-OOP
UnitTesting/Database.Tests/DatabaseTests.cs
2,603
C#
// <auto-generated /> using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; namespace Data.Data.Migrations { [DbContext(typeof(ECommerceDbContext))] partial class ECommerceDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Data.Models.Product", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<string>("Company") .IsRequired() .HasMaxLength(100); b.Property<string>("ImageUrl") .HasMaxLength(255); b.Property<string>("Info"); b.Property<decimal>("Price") .HasColumnType("DECIMAL(18,2)"); b.Property<string>("Title") .IsRequired() .HasMaxLength(100); b.HasKey("Id"); b.ToTable("Products"); }); #pragma warning restore 612, 618 } } }
30.1875
114
0.639752
[ "MIT" ]
pedrofrohmut/ecommerce-webapi
ECommerce/Data/Data/Migrations/ECommerceDbContextModelSnapshot.cs
1,451
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.IdentityManagement; using Amazon.IdentityManagement.Model; namespace Amazon.PowerShell.Cmdlets.IAM { /// <summary> /// Returns information about the SSH public keys associated with the specified IAM user. /// If none exists, the operation returns an empty list. /// /// /// <para> /// The SSH public keys returned by this operation are used only for authenticating the /// IAM user to an AWS CodeCommit repository. For more information about using SSH keys /// to authenticate to an AWS CodeCommit repository, see <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html">Set /// up AWS CodeCommit for SSH Connections</a> in the <i>AWS CodeCommit User Guide</i>. /// </para><para> /// Although each user is limited to a small number of keys, you can still paginate the /// results using the <code>MaxItems</code> and <code>Marker</code> parameters. /// </para><br/><br/>This cmdlet automatically pages all available results to the pipeline - parameters related to iteration are only needed if you want to manually control the paginated output. To disable autopagination, use -NoAutoIteration. /// </summary> [Cmdlet("Get", "IAMSSHPublicKeyList")] [OutputType("Amazon.IdentityManagement.Model.SSHPublicKeyMetadata")] [AWSCmdlet("Calls the AWS Identity and Access Management ListSSHPublicKeys API operation.", Operation = new[] {"ListSSHPublicKeys"}, SelectReturnType = typeof(Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse))] [AWSCmdletOutput("Amazon.IdentityManagement.Model.SSHPublicKeyMetadata or Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse", "This cmdlet returns a collection of Amazon.IdentityManagement.Model.SSHPublicKeyMetadata objects.", "The service call response (type Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class GetIAMSSHPublicKeyListCmdlet : AmazonIdentityManagementServiceClientCmdlet, IExecutor { #region Parameter UserName /// <summary> /// <para> /// <para>The name of the IAM user to list SSH public keys for. If none is specified, the <code>UserName</code> /// field is determined implicitly based on the AWS access key used to sign the request.</para><para>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex /// pattern</a>) a string of characters consisting of upper and lowercase alphanumeric /// characters with no spaces. You can also include any of the following characters: _+=,.@-</para> /// </para> /// </summary> [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] public System.String UserName { get; set; } #endregion #region Parameter Marker /// <summary> /// <para> /// <para>Use this parameter only when paginating results and only after you receive a response /// indicating that the results are truncated. Set it to the value of the <code>Marker</code> /// element in the response that you received to indicate where the next call should start.</para> /// </para> /// <para> /// <br/><b>Note:</b> This parameter is only used if you are manually controlling output pagination of the service API call. /// <br/>In order to manually control output pagination, use '-Marker $null' for the first call and '-Marker $AWSHistory.LastServiceResponse.Marker' for subsequent calls. /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("NextToken")] public System.String Marker { get; set; } #endregion #region Parameter MaxItem /// <summary> /// <para> /// <para>Use this only when paginating results to indicate the maximum number of items you /// want in the response. If additional items exist beyond the maximum you specify, the /// <code>IsTruncated</code> response element is <code>true</code>.</para><para>If you do not include this parameter, the number of items defaults to 100. Note that /// IAM might return fewer results, even when there are more results available. In that /// case, the <code>IsTruncated</code> response element returns <code>true</code>, and /// <code>Marker</code> contains a value to include in the subsequent call that tells /// the service where to continue from.</para> /// </para> /// <para> /// <br/><b>Note:</b> In AWSPowerShell and AWSPowerShell.NetCore this parameter is used to limit the total number of items returned by the cmdlet. /// <br/>In AWS.Tools this parameter is simply passed to the service to specify how many items should be returned by each service call. /// <br/>Pipe the output of this cmdlet into Select-Object -First to terminate retrieving data pages early and control the number of items returned. /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("MaxItems")] public int? MaxItem { get; set; } #endregion #region Parameter Select /// <summary> /// Use the -Select parameter to control the cmdlet output. The default value is 'SSHPublicKeys'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse). /// Specifying the name of a property of type Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse 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; } = "SSHPublicKeys"; #endregion #region Parameter PassThru /// <summary> /// Changes the cmdlet behavior to return the value passed to the UserName parameter. /// The -PassThru parameter is deprecated, use -Select '^UserName' instead. This parameter will be removed in a future version. /// </summary> [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^UserName' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter NoAutoIteration /// <summary> /// By default the cmdlet will auto-iterate and retrieve all results to the pipeline by performing multiple /// service calls. If set, the cmdlet will retrieve only the next 'page' of results using the value of Marker /// as the start point. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter NoAutoIteration { get; set; } #endregion protected override void ProcessRecord() { base.ProcessRecord(); 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.IdentityManagement.Model.ListSSHPublicKeysResponse, GetIAMSSHPublicKeyListCmdlet>(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.UserName; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.Marker = this.Marker; context.MaxItem = this.MaxItem; #if !MODULAR if (ParameterWasBound(nameof(this.MaxItem)) && this.MaxItem.HasValue) { WriteWarning("AWSPowerShell and AWSPowerShell.NetCore use the MaxItem parameter to limit the total number of items returned by the cmdlet." + " This behavior is obsolete and will be removed in a future version of these modules. Pipe the output of this cmdlet into Select-Object -First to terminate" + " retrieving data pages early and control the number of items returned. AWS.Tools already implements the new behavior of simply passing MaxItem" + " to the service to specify how many items should be returned by each service call."); } #endif context.UserName = this.UserName; // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members #if MODULAR public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent; #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute // create request and set iteration invariants var request = new Amazon.IdentityManagement.Model.ListSSHPublicKeysRequest(); if (cmdletContext.MaxItem != null) { request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToServiceTypeInt32(cmdletContext.MaxItem.Value); } if (cmdletContext.UserName != null) { request.UserName = cmdletContext.UserName; } // Initialize loop variant and commence piping var _nextToken = cmdletContext.Marker; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; _nextToken = response.Marker; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return null; } #else public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent; // create request and set iteration invariants var request = new Amazon.IdentityManagement.Model.ListSSHPublicKeysRequest(); if (cmdletContext.UserName != null) { request.UserName = cmdletContext.UserName; } // Initialize loop variants and commence piping System.String _nextToken = null; int? _emitLimit = null; int _retrievedSoFar = 0; if (AutoIterationHelpers.HasValue(cmdletContext.Marker)) { _nextToken = cmdletContext.Marker; } if (cmdletContext.MaxItem.HasValue) { // The service has a maximum page size of 1000. If the user has // asked for more items than page max, and there is no page size // configured, we rely on the service ignoring the set maximum // and giving us 1000 items back. If a page size is set, that will // be used to configure the pagination. // We'll make further calls to satisfy the user's request. _emitLimit = cmdletContext.MaxItem; } var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; if (_emitLimit.HasValue) { int correctPageSize = Math.Min(1000, _emitLimit.Value); request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToInt32(correctPageSize); } CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; int _receivedThisCall = response.SSHPublicKeys.Count; _nextToken = response.Marker; _retrievedSoFar += _receivedThisCall; if (_emitLimit.HasValue) { _emitLimit -= _receivedThisCall; } } catch (Exception e) { if (_retrievedSoFar == 0 || !_emitLimit.HasValue) { output = new CmdletOutput { ErrorResponse = e }; } else { break; } } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return null; } #endif public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.ListSSHPublicKeysRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "ListSSHPublicKeys"); try { #if DESKTOP return client.ListSSHPublicKeys(request); #elif CORECLR return client.ListSSHPublicKeysAsync(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 Marker { get; set; } public int? MaxItem { get; set; } public System.String UserName { get; set; } public System.Func<Amazon.IdentityManagement.Model.ListSSHPublicKeysResponse, GetIAMSSHPublicKeyListCmdlet, object> Select { get; set; } = (response, cmdlet) => response.SSHPublicKeys; } } }
48.828205
247
0.593289
[ "Apache-2.0" ]
JekzVadaria/aws-tools-for-powershell
modules/AWSPowerShell/Cmdlets/IdentityManagement/Basic/Get-IAMSSHPublicKeyList-Cmdlet.cs
19,043
C#
//----------------------------------------------------------------------- // <copyright file="ClientGeneratorBase.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; using System.Linq; using NJsonSchema; using NJsonSchema.CodeGeneration; using NSwag.CodeGeneration.Models; namespace NSwag.CodeGeneration { /// <summary>The client generator base.</summary> /// <typeparam name="TOperationModel">The type of the operation model.</typeparam> /// <typeparam name="TParameterModel">The type of the parameter model.</typeparam> /// <typeparam name="TResponseModel">The type of the response model.</typeparam> /// <seealso cref="IClientGenerator" /> public abstract class ClientGeneratorBase<TOperationModel, TParameterModel, TResponseModel> : IClientGenerator where TOperationModel : OperationModelBase<TParameterModel, TResponseModel> where TResponseModel : ResponseModelBase where TParameterModel : ParameterModelBase { private readonly OpenApiDocument _document; /// <summary>Initializes a new instance of the <see cref="ClientGeneratorBase{TOperationModel, TParameterModel, TResponseModel}"/> class.</summary> /// <param name="document">The document.</param> /// <param name="settings">The code generator settings.</param> /// <param name="resolver">The type resolver.</param> protected ClientGeneratorBase(OpenApiDocument document, CodeGeneratorSettingsBase settings, TypeResolverBase resolver) { _document = document; Resolver = resolver; settings.SchemaType = document.SchemaType; // enforce Swagger schema output } /// <summary>Gets the base settings.</summary> public abstract ClientGeneratorBaseSettings BaseSettings { get; } /// <summary>Gets the type resolver.</summary> protected TypeResolverBase Resolver { get; } /// <summary>Gets the type.</summary> /// <param name="schema">The schema.</param> /// <param name="isNullable">Specifies whether the type is nullable..</param> /// <param name="typeNameHint">The type name hint.</param> /// <returns>The type name.</returns> public abstract string GetTypeName(JsonSchema schema, bool isNullable, string typeNameHint); /// <summary>Gets the file response type name.</summary> /// <returns>The type name.</returns> public virtual string GetBinaryResponseTypeName() { return "FileResponse"; } /// <summary>Generates the the whole file containing all needed types.</summary> /// <returns>The code</returns> public string GenerateFile() { return GenerateFile(ClientGeneratorOutputType.Full); } /// <summary>Generates the the whole file containing all needed types.</summary> /// <param name="outputType">Type of the output.</param> /// <returns>The code</returns> public string GenerateFile(ClientGeneratorOutputType outputType) { var clientTypes = GenerateAllClientTypes(); var dtoTypes = BaseSettings.GenerateDtoTypes ? GenerateDtoTypes() : Enumerable.Empty<CodeArtifact>(); clientTypes = outputType == ClientGeneratorOutputType.Full || outputType == ClientGeneratorOutputType.Implementation ? clientTypes : Enumerable.Empty<CodeArtifact>(); dtoTypes = outputType == ClientGeneratorOutputType.Full || outputType == ClientGeneratorOutputType.Contracts ? dtoTypes : Enumerable.Empty<CodeArtifact>(); return GenerateFile(clientTypes, dtoTypes, outputType) .Replace("\r", string.Empty) .Replace("\n\n\n\n", "\n\n") .Replace("\n\n\n", "\n\n"); } /// <summary>Generates the file.</summary> /// <param name="clientTypes">The client types.</param> /// <param name="dtoTypes">The DTO types.</param> /// <param name="outputType">Type of the output.</param> /// <returns>The code.</returns> protected abstract string GenerateFile(IEnumerable<CodeArtifact> clientTypes, IEnumerable<CodeArtifact> dtoTypes, ClientGeneratorOutputType outputType); /// <summary>Generates the client types.</summary> /// <returns>The code artifact collection.</returns> protected virtual IEnumerable<CodeArtifact> GenerateAllClientTypes() { var operations = GetOperations(_document); var clientTypes = new List<CodeArtifact>(); if (BaseSettings.OperationNameGenerator.SupportsMultipleClients) { var controllerOperationsGroups = operations.GroupBy(o => o.ControllerName).ToList(); foreach (var controllerOperations in controllerOperationsGroups) { var controllerName = controllerOperations.Key; var controllerClassName = BaseSettings.GenerateControllerName(controllerOperations.Key); var clientType = GenerateClientTypes(controllerName, controllerClassName, controllerOperations.ToList()); clientTypes.AddRange(clientType); } } else { var controllerName = string.Empty; var controllerClassName = BaseSettings.GenerateControllerName(controllerName); var clientType = GenerateClientTypes(controllerName, controllerClassName, operations); clientTypes.AddRange(clientType); } return clientTypes; } /// <summary>Generates the client class.</summary> /// <param name="controllerName">Name of the controller.</param> /// <param name="controllerClassName">Name of the controller class.</param> /// <param name="operations">The operations.</param> /// <returns>The code.</returns> protected abstract IEnumerable<CodeArtifact> GenerateClientTypes(string controllerName, string controllerClassName, IEnumerable<TOperationModel> operations); /// <summary>Generates all DTO types.</summary> /// <returns>The code artifact collection.</returns> protected abstract IEnumerable<CodeArtifact> GenerateDtoTypes(); /// <summary>Creates an operation model.</summary> /// <param name="operation">The operation.</param> /// <param name="settings">The settings.</param> /// <returns>The operation model.</returns> protected abstract TOperationModel CreateOperationModel(OpenApiOperation operation, ClientGeneratorBaseSettings settings); private List<TOperationModel> GetOperations(OpenApiDocument document) { document.GenerateOperationIds(); return document.Paths .SelectMany(pair => pair.Value.Select(p => new { Path = pair.Key.TrimStart('/'), HttpMethod = p.Key, Operation = p.Value })) .Select(tuple => { var operationName = BaseSettings.OperationNameGenerator.GetOperationName(document, tuple.Path, tuple.HttpMethod, tuple.Operation); if (operationName.EndsWith("Async")) { operationName = operationName.Substring(0, operationName.Length - "Async".Length); } var operationModel = CreateOperationModel(tuple.Operation, BaseSettings); operationModel.ControllerName = BaseSettings.OperationNameGenerator.GetClientName(document, tuple.Path, tuple.HttpMethod, tuple.Operation); operationModel.Path = tuple.Path; operationModel.HttpMethod = tuple.HttpMethod; operationModel.OperationName = operationName; return operationModel; }) .ToList(); } } }
49.190476
165
0.633107
[ "MIT" ]
alexdresko/NSwag
src/NSwag.CodeGeneration/ClientGeneratorBase.cs
8,264
C#
using System.Collections.Generic; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Abp.Authorization; using Abp.Authorization.Roles; using Abp.Domain.Repositories; using Abp.Domain.Uow; using Abp.Organizations; using Abp.Runtime.Caching; using Abp.Zero.Configuration; using UniSolution.Ebsene.Authorization.Users; namespace UniSolution.Ebsene.Authorization.Roles { public class RoleManager : AbpRoleManager<Role, User> { public RoleManager( RoleStore store, IEnumerable<IRoleValidator<Role>> roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger<AbpRoleManager<Role, User>> logger, IPermissionManager permissionManager, ICacheManager cacheManager, IUnitOfWorkManager unitOfWorkManager, IRoleManagementConfig roleManagementConfig, IRepository<OrganizationUnit, long> organizationUnitRepository, IRepository<OrganizationUnitRole, long> organizationUnitRoleRepository) : base( store, roleValidators, keyNormalizer, errors, logger, permissionManager, cacheManager, unitOfWorkManager, roleManagementConfig, organizationUnitRepository, organizationUnitRoleRepository) { } } }
33.886364
83
0.652582
[ "MIT" ]
ebsene/unisolution-ebsene
aspnet-core/src/UniSolution.Ebsene.Core/Authorization/Roles/RoleManager.cs
1,491
C#
// Toony Colors Pro+Mobile 2 // (c) 2014-2019 Jean Moreno using System; using System.Collections.Generic; using System.Globalization; using System.IO; using UnityEditor; using UnityEngine; // Utility to generate custom Toony Colors Pro 2 shaders with specific features public partial class TCP2_ShaderGenerator : EditorWindow { //-------------------------------------------------------------------------------------------------- // UI from Template System public class UIFeature { protected const float LABEL_WIDTH = 210f; static Rect LastPosition; static Rect LastPositionFull; static bool LastVisible; static GUIContent tempContent = new GUIContent(); protected static GUIContent TempContent(string label, string tooltip = null) { tempContent.text = label; tempContent.tooltip = tooltip; return tempContent; } protected string label; protected string tooltip; protected string[] requires; //features required for this feature to be enabled (AND) protected string[] requiresOr; //features required for this feature to be enabled (OR) protected string[] excludes; //features required to be OFF for this feature to be enabled protected string[] excludesAll; //features required to be OFF for this feature to be enabled protected bool showHelp = true; protected bool increaseIndent; protected string helpTopic; protected bool customGUI; //complete custom GUI that overrides the default behaviors (e.g. separator) protected bool ignoreVisibility; //ignore the current visible state and force the UI element to be drawn private bool wasEnabled; //track when the Enabled flag changes private bool inline; //draw next to previous position private bool halfWidth; //draw in half space of the position (for inline) protected static Stack<bool> FoldoutStack = new Stack<bool>(); public static void ClearFoldoutStack() { UIFeature_DropDownStart.ClearDropDownsList(); FoldoutStack.Clear(); } //Initialize a UIFeature given a list of arbitrary properties public UIFeature(List<KeyValuePair<string, string>> list) { if(list != null) { foreach(var kvp in list) { ProcessProperty(kvp.Key, kvp.Value); } } } //Process a property from the Template in the form key=value protected virtual void ProcessProperty(string key, string value) { //Direct inline properties, no need for a value if(string.IsNullOrEmpty(value)) { switch(key) { case "nohelp": showHelp = false; break; case "indent": increaseIndent = true; break; case "inline": inline = true; break; case "half": halfWidth = true; break; } } else { //Common properties to all UIFeature classes switch(key) { case "lbl": label = value.Replace(" ", "\n"); break; case "tt": tooltip = value.Replace(@"\n", "\n").Replace(" ", "\n"); break; case "help": showHelp = bool.Parse(value); break; case "indent": increaseIndent = bool.Parse(value); break; case "needs": requires = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); break; case "needsOr": requiresOr = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); break; case "excl": excludes = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); break; case "exclAll": excludesAll = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); break; case "hlptop": helpTopic = value; break; case "inline": inline = bool.Parse(value); break; case "half": halfWidth = bool.Parse(value); break; } } } static Rect HeaderRect(ref Rect lineRect, float width) { var rect = lineRect; rect.width = width; lineRect.x += rect.width; lineRect.width -= rect.width; return rect; } public void DrawGUI(TCP2_Config config) { var enabled = Enabled(config); GUI.enabled = enabled; var visible = (sHideDisabled && increaseIndent) ? enabled : true; if(inline) { visible = LastVisible; } visible &= (FoldoutStack.Count > 0) ? FoldoutStack.Peek() : true; ForceValue(config); if(customGUI) { if(visible || ignoreVisibility) { DrawGUI(new Rect(0,0,EditorGUIUtility.currentViewWidth, 0), config); return; } } else if(visible) { //Total line rect Rect position; position = inline ? LastPosition : EditorGUILayout.GetControlRect(); Rect fullPosition = position; if (halfWidth) { position.width = Mathf.Max((position.width/2f) - 8f, LABEL_WIDTH + 10f); } //LastPosition is already halved if(inline) { position.x += position.width + 8f; position.width = LastPositionFull.width - LastPosition.width - 8f; } //Last Position for inlined properties LastPosition = position; LastPositionFull = fullPosition; if(!inline) { //Help if(showHelp) { var helpRect = HeaderRect(ref position, 20f); TCP2_GUI.HelpButton(helpRect, label, string.IsNullOrEmpty(helpTopic) ? label : helpTopic); } else { HeaderRect(ref position, 20f); } //Indent if(increaseIndent) { HeaderRect(ref position, 6f); } } //Label var guiContent = TempContent((increaseIndent ? "▪ " : "") + label, tooltip); var labelPosition = HeaderRect(ref position, inline ? (EditorStyles.label.CalcSize(guiContent)).x + 8f : LABEL_WIDTH - position.x); TCP2_GUI.SubHeader(labelPosition, guiContent, Highlighted(config) && Enabled(config)); //Actual property DrawGUI(position, config); } LastVisible = visible; GUI.enabled = sGUIEnabled; } //Internal DrawGUI: actually draws the feature protected virtual void DrawGUI(Rect position, TCP2_Config config) { GUI.Label(position, "Unknown feature type for: " + label); } //Defines if the feature is selected/toggle/etc. or not public virtual bool Highlighted(TCP2_Config config) { return false; } //Called when processing this UIFeature, in case any forced value needs to be set even if the UI component isn't visible protected virtual void ForceValue(TCP2_Config config) { } //Called when Enabled(config) has changed state //Originally used to force Multiple UI to enable the default feature, if any protected virtual void OnEnabledChangedState(TCP2_Config config, bool newState) { } public bool Enabled(TCP2_Config config) { var enabled = true; if(requiresOr != null) { enabled = false; enabled |= config.HasFeaturesAny(requiresOr); } if(excludesAll != null) enabled &= !config.HasFeaturesAll(excludesAll); if(requires != null) enabled &= config.HasFeaturesAll(requires); if(excludes != null) enabled &= !config.HasFeaturesAny(excludes); if(wasEnabled != enabled) { OnEnabledChangedState(config, enabled); } wasEnabled = enabled; return enabled; } //Parses a #FEATURES text block public static UIFeature[] GetUIFeatures(StringReader reader) { var uiFeaturesList = new List<UIFeature>(); string subline; var overflow = 0; while((subline = reader.ReadLine()) != "#END") { //Just in case template file is badly written overflow++; if(overflow > 99999) break; //Empty line if(string.IsNullOrEmpty(subline)) continue; var data = subline.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); //Skip empty or comment # lines if(data == null || data.Length == 0 || (data.Length > 0 && data[0].StartsWith("#"))) continue; var kvpList = new List<KeyValuePair<string, string>>(); for(var i = 1; i < data.Length; i++) { var sdata = data[i].Split('='); if(sdata.Length == 2) kvpList.Add(new KeyValuePair<string, string>(sdata[0], sdata[1])); else if(sdata.Length == 1) kvpList.Add(new KeyValuePair<string, string>(sdata[0], null)); else Debug.LogError("Couldn't parse UI property from Template:\n" + data[i]); } UIFeature feature = null; switch(data[0]) { case "---": feature = new UIFeature_Separator(); break; case "space": feature = new UIFeature_Space(kvpList); break; case "flag": feature = new UIFeature_Flag(kvpList); break; case "float": feature = new UIFeature_Float(kvpList); break; case "subh": feature = new UIFeature_SubHeader(kvpList); break; case "header": feature = new UIFeature_Header(kvpList); break; case "warning": feature = new UIFeature_Warning(kvpList); break; case "sngl": feature = new UIFeature_Single(kvpList); break; case "mult": feature = new UIFeature_Multiple(kvpList); break; case "keyword": feature = new UIFeature_Keyword(kvpList); break; case "mask": feature = new UIFeature_Mask(kvpList); break; case "shader_target": feature = new UIFeature_ShaderTarget(); break; case "dd_start": feature = new UIFeature_DropDownStart(kvpList); break; case "dd_end": feature = new UIFeature_DropDownEnd(); break; //case "texture_list": feature = new UIFeature_TextureList(); break; //case "tex": feature = new UIFeature_Texture(kvpList); break; default: feature = new UIFeature(kvpList); break; } uiFeaturesList.Add(feature); } return uiFeaturesList.ToArray(); } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // SINGLE FEATURE TOGGLE public class UIFeature_Single : UIFeature { string keyword; string[] toggles; //features forced to be toggled when this feature is enabled public UIFeature_Single(List<KeyValuePair<string, string>> list) : base(list) { } protected override void ProcessProperty(string key, string value) { if(key == "kw") keyword = value; else if(key == "toggles") toggles = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); else base.ProcessProperty(key, value); } protected override void DrawGUI(Rect position, TCP2_Config config) { var feature = Highlighted(config); EditorGUI.BeginChangeCheck(); feature = EditorGUI.Toggle(position, feature); if(EditorGUI.EndChangeCheck()) { config.ToggleFeature(keyword, feature); if(toggles != null) { foreach(var t in toggles) config.ToggleFeature(t, feature); } } } public override bool Highlighted(TCP2_Config config) { return config.HasFeature(keyword); } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // FEATURES COMBOBOX public class UIFeature_Multiple : UIFeature { string[] labels; string[] features; string[] toggles; //features forced to be toggled when this feature is enabled public UIFeature_Multiple(List<KeyValuePair<string, string>> list) : base(list) { } protected override void ProcessProperty(string key, string value) { if(key == "kw") { var data = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); labels = new string[data.Length]; features = new string[data.Length]; for(var i = 0; i < data.Length; i++) { var lbl_feat = data[i].Split('|'); if(lbl_feat.Length != 2) { Debug.LogWarning("[UIFeature_Multiple] Invalid data:" + data[i]); continue; } labels[i] = lbl_feat[0]; features[i] = lbl_feat[1]; } } else if(key == "toggles") toggles = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); else base.ProcessProperty(key, value); } protected override void DrawGUI(Rect position, TCP2_Config config) { var feature = GetSelectedFeature(config); if(feature < 0) feature = 0; EditorGUI.BeginChangeCheck(); feature = EditorGUI.Popup(position, feature, labels); if(EditorGUI.EndChangeCheck()) { ToggleSelectedFeature(config, feature); } } private int GetSelectedFeature(TCP2_Config config) { for(var i = 0; i < features.Length; i++) { if(config.HasFeature(features[i])) return i; } return -1; } public override bool Highlighted(TCP2_Config config) { var feature = GetSelectedFeature(config); return feature > 0; } protected override void OnEnabledChangedState(TCP2_Config config, bool newState) { var feature = -1; if(newState) { feature = GetSelectedFeature(config); if(feature < 0) feature = 0; } ToggleSelectedFeature(config, feature); } private void ToggleSelectedFeature(TCP2_Config config, int selectedFeature) { for(var i = 0; i < features.Length; i++) { var enable = (i == selectedFeature); config.ToggleFeature(features[i], enable); } if(toggles != null) { foreach(var t in toggles) config.ToggleFeature(t, selectedFeature > 0); } } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // KEYWORD COMBOBOX public class UIFeature_Keyword : UIFeature { string keyword; string[] labels; string[] values; int defaultValue; bool forceValue; public UIFeature_Keyword(List<KeyValuePair<string, string>> list) : base(list) { } protected override void ProcessProperty(string key, string value) { if(key == "kw") keyword = value; else if(key == "default") defaultValue = int.Parse(value, CultureInfo.InvariantCulture); else if(key == "forceKeyword") forceValue = bool.Parse(value); else if(key == "values") { var data = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); labels = new string[data.Length]; values = new string[data.Length]; for(var i = 0; i < data.Length; i++) { var lbl_feat = data[i].Split('|'); if(lbl_feat.Length != 2) { Debug.LogWarning("[UIFeature_Keyword] Invalid data:" + data[i]); continue; } labels[i] = lbl_feat[0]; values[i] = lbl_feat[1]; } } else base.ProcessProperty(key, value); } protected override void ForceValue(TCP2_Config config) { var selectedValue = GetSelectedValue(config); if(selectedValue < 0) selectedValue = defaultValue; if(forceValue && Enabled(config) && !config.HasKeyword(keyword)) { config.SetKeyword(keyword, values[selectedValue]); } } protected override void DrawGUI(Rect position, TCP2_Config config) { var selectedValue = GetSelectedValue(config); if(selectedValue < 0) { selectedValue = defaultValue; if(forceValue && Enabled(config)) { config.SetKeyword(keyword, values[defaultValue]); } } EditorGUI.BeginChangeCheck(); selectedValue = EditorGUI.Popup(position, selectedValue, labels); if(EditorGUI.EndChangeCheck()) { if(string.IsNullOrEmpty(values[selectedValue])) config.RemoveKeyword(keyword); else config.SetKeyword(keyword, values[selectedValue]); } } private int GetSelectedValue(TCP2_Config config) { var currentValue = config.GetKeyword(keyword); for(var i = 0; i < values.Length; i++) { if(currentValue == values[i]) return i; } return -1; } public override bool Highlighted(TCP2_Config config) { var feature = GetSelectedValue(config); return feature != defaultValue; } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // MASK public class UIFeature_Mask : UIFeature { public string Keyword { get { return keyword; } } public string MaskKeyword { get { return maskKeyword; } } public string DisplayName { get { return displayName; } } string maskKeyword; string channelKeyword; string keyword; string displayName; public UIFeature_Mask(List<KeyValuePair<string, string>> list) : base(list) { } protected override void ProcessProperty(string key, string value) { if(key == "kw") keyword = value; else if(key == "ch") channelKeyword = value; else if(key == "msk") maskKeyword = value; else if(key == "dispName") displayName = value; else base.ProcessProperty(key, value); } string[] labels = { "Off", "Main Texture", "Mask 1", "Mask 2", "Mask 3", "Vertex Colors" }; string[] masks = { "", "mainTex", "mask1", "mask2", "mask3", "vcolors" }; string[] uvs = { "Main Tex UV", "Independent UV0", "Independent UV1" }; protected override void DrawGUI(Rect position, TCP2_Config config) { //GUIMask(config, this.label, this.tooltip, this.maskKeyword, this.channelKeyword, this.keyword, this.Enabled(config), this.increaseIndent, helpTopic: this.helpTopic, helpIndent: this.helpIndent); var curMask = Array.IndexOf(masks, config.GetKeyword(maskKeyword)); if(curMask < 0) curMask = 0; var curChannel = TCP2_Utils.FromShader(config.GetKeyword(channelKeyword)); var uvKey = (curMask > 1 && curMask < 5) ? "UV_" + masks[curMask] : null; var curUv = Array.IndexOf(uvs, config.GetKeyword(uvKey)); if(curUv < 0) curUv = 0; EditorGUI.BeginChangeCheck(); //Calculate rects var helpButton = position; helpButton.width = 16f; helpButton.x += 2f; position.width -= helpButton.width; helpButton.x += position.width; //Mask type (MainTex, 1, 2, 3) var sideRect = position; sideRect.width = position.width * 0.75f / 2f; curMask = EditorGUI.Popup(sideRect, curMask, labels); //Mask Channel (RGBA) var middleRect = position; middleRect.width = position.width * 0.25f; middleRect.x += sideRect.width; GUI.enabled &= curMask > 0; curChannel = (TCP2_Utils.TextureChannel)EditorGUI.EnumPopup(middleRect, curChannel); //Mask UVs sideRect.x += sideRect.width + middleRect.width; GUI.enabled &= curMask > 1 && curMask < 5; curUv = EditorGUI.Popup(sideRect, curUv, uvs); //Mask Help TCP2_GUI.HelpButton(helpButton, "Masks"); if(EditorGUI.EndChangeCheck()) { config.SetKeyword(maskKeyword, masks[curMask]); if(curMask > 0) { config.SetKeyword(channelKeyword, curChannel.ToShader()); } if(curMask > 1 && !string.IsNullOrEmpty(uvKey)) { config.SetKeyword(uvKey, uvs[curUv]); } config.ToggleFeature("VCOLORS_MASK", (curMask == 5)); config.ToggleFeature(keyword, (curMask > 0)); } } public override bool Highlighted(TCP2_Config config) { var curMask = GetCurrentMask(config); return curMask > 0; } int GetCurrentMask(TCP2_Config config) { var curMask = Array.IndexOf(masks, config.GetKeyword(maskKeyword)); return curMask; } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // SHADER TARGET public class UIFeature_ShaderTarget : UIFeature { public UIFeature_ShaderTarget() : base(null) { customGUI = true; } protected override void DrawGUI(Rect position, TCP2_Config config) { EditorGUILayout.BeginHorizontal(); TCP2_GUI.HelpButton("Shader Target"); TCP2_GUI.SubHeader("Shader Target", "Defines the shader target level to compile for", config.shaderTarget != 30, LABEL_WIDTH - 24f); var newTarget = EditorGUILayout.IntPopup(config.shaderTarget, #if UNITY_5_4_OR_NEWER new[] { "2.0", "2.5", "3.0", "3.5", "4.0", "5.0" }, new[] { 20, 25, 30, 35, 40, 50 }); #else new string[] { "2.0", "3.0", "4.0", "5.0" }, new int[] { 20, 30, 40, 50 }); #endif if(newTarget != config.shaderTarget) { config.shaderTarget = newTarget; } EditorGUILayout.EndHorizontal(); } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // SURFACE SHADER FLAG public class UIFeature_Flag : UIFeature { string keyword; string[] toggles; //features forced to be toggled when this flag is enabled public UIFeature_Flag(List<KeyValuePair<string, string>> list) : base(list) { showHelp = false; } protected override void ProcessProperty(string key, string value) { if(key == "kw") keyword = value; else if(key == "toggles") toggles = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); else base.ProcessProperty(key, value); } protected override void DrawGUI(Rect position, TCP2_Config config) { var flag = Highlighted(config); EditorGUI.BeginChangeCheck(); flag = EditorGUI.Toggle(position, flag); if(EditorGUI.EndChangeCheck()) { config.ToggleFlag(keyword, flag); if(toggles != null) { foreach(var t in toggles) config.ToggleFeature(t, flag); } } } public override bool Highlighted(TCP2_Config config) { return config.HasFlag(keyword); } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // FIXED FLOAT public class UIFeature_Float : UIFeature { string keyword; float defaultValue; float min = float.MinValue; float max = float.MaxValue; public UIFeature_Float(List<KeyValuePair<string, string>> list) : base(list) { } protected override void ProcessProperty(string key, string value) { if(key == "kw") keyword = value; else if(key == "default") defaultValue = float.Parse(value, CultureInfo.InvariantCulture); else if(key == "min") min = float.Parse(value, CultureInfo.InvariantCulture); else if(key == "max") max = float.Parse(value, CultureInfo.InvariantCulture); else base.ProcessProperty(key, value); } protected override void DrawGUI(Rect position, TCP2_Config config) { var currentValueStr = config.GetKeyword(keyword); var currentValue = defaultValue; if(!float.TryParse(currentValueStr, NumberStyles.Float, CultureInfo.InvariantCulture, out currentValue)) { currentValue = defaultValue; //Only enforce keyword if feature is enabled if(Enabled(config)) config.SetKeyword(keyword, currentValue.ToString("0.0###############")); } EditorGUI.BeginChangeCheck(); var newValue = currentValue; newValue = Mathf.Clamp(EditorGUI.FloatField(position, currentValue), min, max); if(EditorGUI.EndChangeCheck()) { if(newValue != currentValue) { config.SetKeyword(keyword, newValue.ToString("0.0###############")); } } } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- // DECORATORS public class UIFeature_Separator : UIFeature { public UIFeature_Separator() : base(null) { customGUI = true; } protected override void DrawGUI(Rect position, TCP2_Config config) { Space(); } } public class UIFeature_Space : UIFeature { float space = 8f; public UIFeature_Space(List<KeyValuePair<string, string>> list) : base(list) { customGUI = true; } protected override void ProcessProperty(string key, string value) { if(key == "space") space = float.Parse(value, CultureInfo.InvariantCulture); else base.ProcessProperty(key, value); } protected override void DrawGUI(Rect position, TCP2_Config config) { if(Enabled(config)) GUILayout.Space(space); } } public class UIFeature_SubHeader : UIFeature { public UIFeature_SubHeader(List<KeyValuePair<string, string>> list) : base(list) { customGUI = true; } protected override void DrawGUI(Rect position, TCP2_Config config) { TCP2_GUI.SubHeaderGray(label); } } public class UIFeature_Header : UIFeature { public UIFeature_Header(List<KeyValuePair<string, string>> list) : base(list) { customGUI = true; } protected override void DrawGUI(Rect position, TCP2_Config config) { TCP2_GUI.Header(label); } } public class UIFeature_Warning : UIFeature { MessageType msgType = MessageType.Warning; public UIFeature_Warning(List<KeyValuePair<string, string>> list) : base(list) { customGUI = true; } protected override void ProcessProperty(string key, string value) { if(key == "msgType") msgType = (MessageType)Enum.Parse(typeof(MessageType), value, true); else base.ProcessProperty(key, value); } protected override void DrawGUI(Rect position, TCP2_Config config) { if(Enabled(config)) { //EditorGUILayout.HelpBox(this.label, msgType); TCP2_GUI.HelpBoxLayout(label, msgType); } } } public class UIFeature_DropDownStart : UIFeature { static List<UIFeature_DropDownStart> AllDropDowns = new List<UIFeature_DropDownStart>(); public static void ClearDropDownsList() { AllDropDowns.Clear(); } bool foldout; GUIContent guiContent = GUIContent.none; public UIFeature_DropDownStart(List<KeyValuePair<string, string>> list) : base(list) { customGUI = true; ignoreVisibility = true; if(list != null) { foreach(var kvp in list) { if(kvp.Key == "lbl") guiContent = new GUIContent(kvp.Value); } } foldout = sOpenedFoldouts.Contains(guiContent.text); AllDropDowns.Add(this); } protected override void DrawGUI(Rect position, TCP2_Config config) { //Check if any feature within that Foldout are enabled, and show different color if so var hasToggledFeatures = false; var i = Array.IndexOf(ShaderGeneratorTemplate.CurrentTemplate.uiFeatures, this); if(i >= 0) { for(i++; i < ShaderGeneratorTemplate.CurrentTemplate.uiFeatures.Length; i++) { var uiFeature = ShaderGeneratorTemplate.CurrentTemplate.uiFeatures[i]; if(uiFeature is UIFeature_DropDownEnd) break; hasToggledFeatures |= uiFeature.Highlighted(config) && uiFeature.Enabled(config); } } var color = GUI.color; GUI.color *= 0.95f; EditorGUILayout.BeginVertical(EditorStyles.helpBox); GUI.color = color; EditorGUI.BeginChangeCheck(); foldout = TCP2_GUI.HeaderFoldoutHighlight(foldout, guiContent, hasToggledFeatures); FoldoutStack.Push(foldout); if(EditorGUI.EndChangeCheck()) { UpdatePersistentState(); if(Event.current.alt || Event.current.control) { var state = foldout; foreach(var dd in AllDropDowns) { dd.foldout = state; dd.UpdatePersistentState(); } } } } void UpdatePersistentState() { if(foldout && !sOpenedFoldouts.Contains(guiContent.text)) sOpenedFoldouts.Add(guiContent.text); else if(!foldout && sOpenedFoldouts.Contains(guiContent.text)) sOpenedFoldouts.Remove(guiContent.text); } } public class UIFeature_DropDownEnd : UIFeature { public UIFeature_DropDownEnd() : base(null) { customGUI = true; ignoreVisibility = true; } protected override void DrawGUI(Rect position, TCP2_Config config) { FoldoutStack.Pop(); EditorGUILayout.EndVertical(); } } }
28.094595
199
0.63962
[ "Unlicense" ]
mehmetcanari/Seasaw-Delivery
Seasaw Delivery/Assets/Assets/JMO Assets/Toony Colors Pro/Editor/TCP2_ShaderGenerator.UIFeatures.cs
27,029
C#
/* Copyright 2012 Nils Kopal, Uni Duisburg-Essen the underlying password strength algorithm was obtained from http://people.mozilla.org/~jfinette/public_html/topics/passwords/test/ 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 CrypTool.PluginBase; using CrypTool.PluginBase.Miscellaneous; using System; using System.ComponentModel; using System.Text; using System.Threading; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Threading; namespace CrypTool.Plugins.Tools { [Author("Nils Kopal", "nils.kopal@CrypTool.de", "Uni Duisburg", "http://www.uni-duisburg-essen.de")] [PluginInfo("CrypTool.Plugins.Tools.Properties.Resources", "PluginCaption", "PluginTooltip", "PasswordStrength/DetailedDescription/doc.xml", "PasswordStrength/images/icon.png")] [ComponentCategory(ComponentCategory.ToolsMisc)] public class PasswordStrength : ICrypComponent { private readonly PasswordStrengthPresentation _presentation = new PasswordStrengthPresentation(); private byte[] _password; private int _strength; private double _entropy; private int _keePass; public event PropertyChangedEventHandler PropertyChanged; [PropertyInfo(Direction.InputData, "PasswordCaption", "PasswordTooltip", false)] public byte[] Password { get => _password; set => _password = value; } [PropertyInfo(Direction.OutputData, "KeePassCaption", "KeePassTooltip", false)] public int KeePass { get => _keePass; set { _keePass = value; OnPropertyChanged("KeePass"); } } [PropertyInfo(Direction.OutputData, "StrengthCaption", "StrengthTooltip", false)] public int Strength { get => _strength; set { _strength = value; OnPropertyChanged("Strength"); } } [PropertyInfo(Direction.OutputData, "EntropyCaption", "EntropyTooltip", false)] public double Entropy { get => _entropy; set { _entropy = value; OnPropertyChanged("Entropy"); } } public void Dispose() { } public event GuiLogNotificationEventHandler OnGuiLogNotificationOccured; public ISettings Settings => null; public UserControl Presentation => _presentation; public void Execute() { if (_password == null) { return; } string password = Encoding.UTF8.GetString(_password); int numberOfCharacters = password.Length; int numberOfLowercaseLetters = 0; int numberOfUppercaseLetters = 0; int numberOfNumbers = 0; int numberOfSymbols = 0; int middleNumberOfSymbols = 0; int requirements = 0; int lettersOnly = 0; int numbersOnly = 0; int consecutiveUppercaseLetters = 0; int consecutiveLowercaseLetters = 0; int consecutiveNumbers = 0; int sequentialLetters = 0; int sequentialNumbers = 0; int sequentialSymbols = 0; int repeatCharacters = 0; double repeatedCharsBonus = 0; int position = 0; char lastChar = (char)0; foreach (char c in password) { //Number of lowercase letters if (c >= 'a' && c <= 'z') { numberOfLowercaseLetters++; } //Number of uppercase letters if (c >= 'A' && c <= 'Z') { numberOfUppercaseLetters++; } //Number of numbers if (c >= '0' && c <= '9') { numberOfNumbers++; } //Number or symbols if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && !(c >= '0' && c <= '9') && c != ' ') { numberOfSymbols++; } //middle number of symbols if (position > 0 && position < numberOfCharacters - 1 && !(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && c != ' ') { middleNumberOfSymbols++; } //Consecutive Uppercase Letters if ((c >= 'A' && c <= 'Z') && (lastChar >= 'A' && lastChar <= 'Z')) { consecutiveUppercaseLetters++; } //Consecutive Lowercase Letters if ((c >= 'a' && c <= 'z') && (lastChar >= 'a' && lastChar <= 'z')) { consecutiveLowercaseLetters++; } //Consecutive Numbers if ((c >= '0' && c <= '9') && (lastChar >= '0' && lastChar <= '9')) { consecutiveNumbers++; } //Repeated Characters bool charExists = false; for (int j = 0; j < password.Length; j++) { if (password[position] == password[j] && position != j) { charExists = true; double add = password.Length / ((double)j - position); if (add < 0) { add *= -1; } repeatedCharsBonus += add; } } if (charExists) { repeatCharacters++; int nUnqChar = password.Length - repeatCharacters; repeatedCharsBonus = (nUnqChar != 0) ? Math.Ceiling(repeatedCharsBonus / nUnqChar) : Math.Ceiling(repeatedCharsBonus); } position++; lastChar = c; }//foreach (byte b in _password) const string alphas = "abcdefghijklmnopqrstuvwxyz"; for (int s = 0; s < 23; s++) { string sFwd = alphas.Substring(s, 3); string sRev = reverseString(sFwd); if (password.ToLower().IndexOf(sFwd, StringComparison.Ordinal) != -1 || password.ToLower().IndexOf(sRev, StringComparison.Ordinal) != -1) { sequentialLetters++; } } const string numerics = "01234567890"; for (int s = 0; s < 8; s++) { string sFwd = numerics.Substring(s, 3); string sRev = reverseString(sFwd); if (password.ToLower().IndexOf(sFwd, StringComparison.Ordinal) != -1 || password.ToLower().IndexOf(sRev, StringComparison.Ordinal) != -1) { sequentialNumbers++; } } //Sequential Symbols const string usSymbols = ")!@#$%^&*()"; const string gerSymbols = "=!\"§$%&/()="; for (int s = 0; s < 8; s++) { //US Keyboard string sFwd = usSymbols.Substring(s, 3); string sRev = reverseString(sFwd); if (password.ToLower().IndexOf(sFwd, StringComparison.OrdinalIgnoreCase) != -1 || password.ToLower().IndexOf(sRev, StringComparison.OrdinalIgnoreCase) != -1) { sequentialSymbols++; } //German Keyboard sFwd = gerSymbols.Substring(s, 3); sRev = reverseString(sFwd); if (password.ToLower().IndexOf(sFwd, StringComparison.OrdinalIgnoreCase) != -1 || password.ToLower().IndexOf(sRev, StringComparison.OrdinalIgnoreCase) != -1) { sequentialSymbols++; } } //Requirements if (numberOfLowercaseLetters > 0) { requirements++; } if (numberOfUppercaseLetters > 0) { requirements++; } if (numberOfNumbers > 0) { requirements++; } if (numberOfSymbols > 0) { requirements++; } //Letters only if ((numberOfLowercaseLetters != 0 || numberOfUppercaseLetters != 0) && numberOfSymbols == 0 && numberOfNumbers == 0) { lettersOnly = numberOfCharacters; } //Numbers Only if (numberOfLowercaseLetters == 0 && numberOfUppercaseLetters == 0 && numberOfSymbols == 0 && numberOfNumbers > 0) { numbersOnly = numberOfCharacters; } _presentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate { try { // Additions: //Number of characters _presentation.NumberOfCharacters_CountTextBlock.Text = string.Format("{0}", numberOfCharacters); _presentation.NumberOfCharacters_BonusTextBlock.Text = string.Format("{0}", numberOfCharacters * 4); _presentation.NumberOfCharacters_BonusTextBlock.Foreground = numberOfCharacters < 8 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (numberOfCharacters < 8) { _presentation.NumberOfCharactersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (numberOfCharacters == 8) { _presentation.NumberOfCharactersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.NumberOfCharactersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Number of lowercase letters _presentation.LowercaseLetters_CountTextBlock.Text = string.Format("{0}", numberOfLowercaseLetters); _presentation.LowercaseLetters_BonusTextBlock.Text = string.Format("{0}", numberOfLowercaseLetters > 0 && (numberOfCharacters - numberOfLowercaseLetters) > 0 ? (numberOfCharacters - numberOfLowercaseLetters) * 2 : 0); _presentation.LowercaseLetters_BonusTextBlock.Foreground = numberOfLowercaseLetters == 0 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (numberOfLowercaseLetters < 1) { _presentation.LowercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (numberOfLowercaseLetters == 1) { _presentation.LowercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.LowercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Number of uppercase letters _presentation.UppercaseLetters_CountTextBlock.Text = string.Format("{0}", numberOfUppercaseLetters); _presentation.UppercaseLetters_BonusTextBlock.Text = string.Format("{0}", numberOfUppercaseLetters > 0 && (numberOfCharacters - numberOfUppercaseLetters) > 0 ? (numberOfCharacters - numberOfUppercaseLetters) * 2 : 0); _presentation.UppercaseLetters_BonusTextBlock.Foreground = numberOfUppercaseLetters == 0 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (numberOfUppercaseLetters < 1) { _presentation.UppercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (numberOfUppercaseLetters == 1) { _presentation.UppercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.UppercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Number of numbers _presentation.Numbers_CountTextBlock.Text = string.Format("{0}", numberOfNumbers); _presentation.Numbers_BonusTextBlock.Text = string.Format("{0}", numberOfNumbers < numberOfCharacters ? numberOfNumbers * 4 : 0); _presentation.Numbers_BonusTextBlock.Foreground = numberOfNumbers == 0 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (numberOfNumbers < 1) { _presentation.NumbersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (numberOfNumbers == 1) { _presentation.NumbersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.NumbersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Number of symbols _presentation.Symbols_CountTextBlock.Text = string.Format("{0}", numberOfSymbols); _presentation.Symbols_BonusTextBlock.Text = string.Format("{0}", numberOfSymbols * 6); _presentation.Symbols_BonusTextBlock.Foreground = numberOfSymbols == 0 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (numberOfSymbols < 1) { _presentation.SymbolsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (numberOfSymbols == 1) { _presentation.SymbolsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.SymbolsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Middle number of symbols _presentation.MiddleNumberOrSymbols_CountTextBlock.Text = string.Format("{0}", middleNumberOfSymbols); _presentation.MiddleNumberOrSymbols_BonusTextBlock.Text = string.Format("{0}", middleNumberOfSymbols * 2); _presentation.MiddleNumberOrSymbols_BonusTextBlock.Foreground = middleNumberOfSymbols == 0 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (middleNumberOfSymbols < 1) { _presentation.MiddleNumbersOrSymbolsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (middleNumberOfSymbols == 1) { _presentation.MiddleNumbersOrSymbolsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.MiddleNumbersOrSymbolsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Requirements _presentation.Requirements_CountTextBlock.Text = string.Format("{0}", requirements + (numberOfCharacters > 8 ? 1 : 0)); _presentation.Requirements_BonusTextBlock.Text = string.Format("{0}", (requirements >= 3 && numberOfCharacters >= 8) ? ((requirements + (numberOfCharacters > 8 ? 1 : 0)) * 2) : 0); _presentation.Requirements_BonusTextBlock.Foreground = requirements < 3 || numberOfCharacters < 8 ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Green); if (requirements < 3 || numberOfCharacters < 8) { _presentation.RequirementsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/failure.png", UriKind.Relative)); } else if (requirements + (numberOfCharacters > 8 ? 1 : 0) == 4) { _presentation.RequirementsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.RequirementsImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/exceptional.png", UriKind.Relative)); } //Deductions //Letters only _presentation.LettersOnly_CountTextBlock.Text = string.Format("{0}", lettersOnly); _presentation.LettersOnly_BonusTextBlock.Text = string.Format("{0}", lettersOnly); _presentation.LettersOnly_BonusTextBlock.Foreground = lettersOnly == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (lettersOnly == 0) { _presentation.LettersOnlyImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.LettersOnlyImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Numbers only _presentation.NumbersOnly_CountTextBlock.Text = string.Format("{0}", numbersOnly); _presentation.NumbersOnly_BonusTextBlock.Text = string.Format("{0}", numbersOnly); _presentation.NumbersOnly_BonusTextBlock.Foreground = numbersOnly == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (numbersOnly == 0) { _presentation.NumbersOnlyImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.NumbersOnlyImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Consecutive Uppercase Letters _presentation.ConsecutiveUppercaseLetters_CountTextBlock.Text = string.Format("{0}", consecutiveUppercaseLetters); _presentation.ConsecutiveUppercaseLetters_BonusTextBlock.Text = string.Format("{0}", consecutiveUppercaseLetters * 2); _presentation.ConsecutiveUppercaseLetters_BonusTextBlock.Foreground = consecutiveUppercaseLetters == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (consecutiveUppercaseLetters == 0) { _presentation.ConsecutiveUppercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.ConsecutiveUppercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Consecutive Lowercase Letters _presentation.ConsecutiveLowercaseLetters_CountTextBlock.Text = string.Format("{0}", consecutiveLowercaseLetters); _presentation.ConsecutiveLowercaseLetters_BonusTextBlock.Text = string.Format("{0}", consecutiveLowercaseLetters * 2); _presentation.ConsecutiveLowercaseLetters_BonusTextBlock.Foreground = consecutiveLowercaseLetters == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (consecutiveLowercaseLetters == 0) { _presentation.ConsecutiveLowercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.ConsecutiveLowercaseLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Consecutive numbers _presentation.ConsecutiveNumbers_CountTextBlock.Text = string.Format("{0}", consecutiveNumbers); _presentation.ConsecutiveNumbers_BonusTextBlock.Text = string.Format("{0}", consecutiveNumbers * 2); _presentation.ConsecutiveNumbers_BonusTextBlock.Foreground = consecutiveNumbers == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (consecutiveNumbers == 0) { _presentation.ConsecutiveNumbersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.ConsecutiveNumbersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Sequential Letters _presentation.SequentialLetters_CountTextBlock.Text = string.Format("{0}", sequentialLetters); _presentation.SequentialLetters_BonusTextBlock.Text = string.Format("{0}", sequentialLetters * 3); _presentation.SequentialLetters_BonusTextBlock.Foreground = sequentialLetters == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (sequentialLetters == 0) { _presentation.SequentialLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.SequentialLettersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Sequential Numbers _presentation.SequentialNumbers_CountTextBlock.Text = string.Format("{0}", sequentialNumbers); _presentation.SequentialNumbers_BonusTextBlock.Text = string.Format("{0}", sequentialNumbers * 3); _presentation.SequentialNumbers_BonusTextBlock.Foreground = sequentialNumbers == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (sequentialNumbers == 0) { _presentation.SequentialNumbers.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.SequentialNumbers.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Sequential Symbols _presentation.SequentialSymbols_CountTextBlock.Text = string.Format("{0}", sequentialSymbols); _presentation.SequentialSymbols_BonusTextBlock.Text = string.Format("{0}", sequentialSymbols * 3); _presentation.SequentialSymbols_BonusTextBlock.Foreground = sequentialSymbols == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (sequentialSymbols == 0) { _presentation.SequentialSymbols.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.SequentialSymbols.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Repeat Symbols _presentation.RepeatCharactersCaseInsensitive_CountTextBlock.Text = string.Format("{0}", repeatCharacters); _presentation.RepeatCharactersCaseInsensitive_BonusTextBlock.Text = string.Format("{0}", repeatedCharsBonus); _presentation.RepeatCharactersCaseInsensitive_BonusTextBlock.Foreground = repeatCharacters == 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); if (repeatCharacters == 0) { _presentation.RepeatCharactersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/sufficient.png", UriKind.Relative)); } else { _presentation.RepeatCharactersImage.Source = new BitmapImage(new Uri(@"/PasswordStrength;component/Images/warning.png", UriKind.Relative)); } //Calculate and set progress bar int totalValue = int.Parse(_presentation.NumberOfCharacters_BonusTextBlock.Text) + int.Parse(_presentation.LowercaseLetters_BonusTextBlock.Text) + int.Parse(_presentation.UppercaseLetters_BonusTextBlock.Text) + int.Parse(_presentation.Numbers_BonusTextBlock.Text) + int.Parse(_presentation.Symbols_BonusTextBlock.Text) + int.Parse(_presentation.Requirements_BonusTextBlock.Text) + int.Parse(_presentation.MiddleNumberOrSymbols_BonusTextBlock.Text) - int.Parse(_presentation.LettersOnly_BonusTextBlock.Text) - int.Parse(_presentation.NumbersOnly_BonusTextBlock.Text) - int.Parse(_presentation.ConsecutiveUppercaseLetters_BonusTextBlock.Text) - int.Parse(_presentation.ConsecutiveLowercaseLetters_BonusTextBlock.Text) - int.Parse(_presentation.ConsecutiveNumbers_BonusTextBlock.Text) - int.Parse(_presentation.SequentialLetters_BonusTextBlock.Text) - int.Parse(_presentation.SequentialNumbers_BonusTextBlock.Text) - int.Parse(_presentation.SequentialSymbols_BonusTextBlock.Text) - int.Parse(_presentation.RepeatCharactersCaseInsensitive_BonusTextBlock.Text); if (totalValue > 100) { totalValue = 100; } if (totalValue < 0) { totalValue = 0; } _presentation.ScoreBar.Value = totalValue; _presentation.ScoreValue.Text = string.Format("{0}", totalValue); byte r = (byte)((1.0 - totalValue / 100.0) * 255.0); byte g = (byte)((totalValue / 100.0) * 255.0); Brush brush = new SolidColorBrush(Color.FromRgb(r, g, 0)); _presentation.ScoreBar.Foreground = brush; //Calculate and set Complexity string complexity = null; if (totalValue >= 0 && totalValue < 20) { complexity = Properties.Resources._VeryWeak; } else if (totalValue >= 20 && totalValue < 40) { complexity = Properties.Resources._Weak; } else if (totalValue >= 40 && totalValue < 60) { complexity = Properties.Resources._Good; } else if (totalValue >= 60 && totalValue < 80) { complexity = Properties.Resources._Strong; } else if (totalValue >= 80 && totalValue <= 100) { complexity = Properties.Resources._VeryStrong; } _presentation.ComplexityTextBlock.Text = complexity; Strength = totalValue; double entropyValue = calculateEntropy(_password); _presentation.EntropyTextblock.Text = string.Format("{0}", Math.Round(entropyValue, 3)); Entropy = entropyValue; int keePassValue = KeePassQualityEstimation.EstimatePasswordBits(_password); _presentation.BitStrengthTextBlock.Text = string.Format("{0}", keePassValue, 3); KeePass = keePassValue; } catch (Exception ex) { GuiLogMessage(string.Format("Exception during update of PasswordStrenghPresentation: {0}", ex.Message), NotificationLevel.Error); } }, null); } private void GuiLogMessage(string message, NotificationLevel logLevel) { if (OnGuiLogNotificationOccured != null) { OnGuiLogNotificationOccured(this, new GuiLogEventArgs(message, this, logLevel)); } } private string reverseString(string str) { string ret = ""; for (int i = str.Length; i > 0; i--) { ret += str.Substring(i - 1, 1); } return ret; } public void Stop() { } public void Initialize() { } public void PreExecution() { } public void PostExecution() { _password = new byte[0]; Execute(); } public event StatusChangedEventHandler OnPluginStatusChanged; public event PluginProgressChangedEventHandler OnPluginProgressChanged; private void OnPropertyChanged(string p) { EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(p)); } /// <summary> /// Calculates the Entropy of a given byte array /// for example a German text has about 4.0629 /// </summary> /// <param name="text">text to use</param> /// <returns>Entropy</returns> public double calculateEntropy(byte[] text) { float[] xlogx = new float[text.Length + 1]; //precomputations for fast entropy calculation xlogx[0] = 0.0f; for (int i = 1; i <= text.Length; i++) { xlogx[i] = (float)(-1.0f * i * Math.Log(i / (double)text.Length) / Math.Log(2.0)); } int[] n = new int[256]; //count all ASCII symbols for (int counter = 0; counter < text.Length; counter++) { n[text[counter]]++; } float entropy = 0; //calculate probabilities and sum entropy for (int i = 0; i < 256; i++) { entropy += xlogx[n[i]]; } return entropy / (double)text.Length; } } }
50.431138
237
0.547435
[ "Apache-2.0" ]
CrypToolProject/CrypTool-2
CrypPlugins/PasswordStrength/PasswordStrength.cs
33,691
C#
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Adribot.src.entities { public class Guild { public ulong GuildId { get; set; } public List<Member> Members { get; set; } } }
18.5
49
0.679537
[ "Apache-2.0" ]
DKnightADRI/Adribot
Adribot/src/entities/Guild.cs
261
C#
namespace TaskList.Helpers { public static class Locations { public static readonly string AppServiceUrl = "https://zumobook-chapter5.azurewebsites.net"; public static readonly string AlternateLoginHost = null; public static readonly string AadClientId = "75e20edb-2809-4849-8fd8-89d26ed41016"; public static readonly string AadRedirectUri = $"{AppServiceUrl}/.auth/login/done"; public static readonly string AadAuthority = "https://login.windows.net/photoadrianoutlook.onmicrosoft.com"; public static readonly string CommonAuthority = "https://login.windows.net/common"; } }
45.571429
116
0.730408
[ "MIT" ]
adrianhall/develop-mobile-apps-with-csharp-and-azure
Chapter5/TaskList/TaskList/Helpers/Locations.cs
640
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 System.Collections.Generic; using System.Net; using System.Threading.Tasks; using Microsoft.Spark.Network; using Xunit; namespace Microsoft.Spark.Worker.UnitTest { [Collection("Spark Unit Tests")] public class DaemonWorkerTests : IDisposable { private const string ReuseWorkerEnvVariable = "SPARK_REUSE_WORKER"; private readonly string _reuseWorker; public DaemonWorkerTests() { _reuseWorker = Environment.GetEnvironmentVariable(ReuseWorkerEnvVariable); Environment.SetEnvironmentVariable(ReuseWorkerEnvVariable, "1"); } [Theory] [MemberData(nameof(TestData.VersionData), MemberType = typeof(TestData))] public void TestsDaemonWorkerTaskRunners(string version) { ISocketWrapper daemonSocket = SocketFactory.CreateSocket(); int taskRunnerNumber = 2; var typedVersion = new Version(version); var daemonWorker = new DaemonWorker(typedVersion); Task.Run(() => daemonWorker.Run(daemonSocket)); var clientSockets = new List<ISocketWrapper>(); for (int i = 0; i < taskRunnerNumber; ++i) { CreateAndVerifyConnection(daemonSocket, clientSockets, typedVersion); } Assert.Equal(taskRunnerNumber, daemonWorker.CurrentNumTaskRunners); } private static void CreateAndVerifyConnection( ISocketWrapper daemonSocket, List<ISocketWrapper> clientSockets, Version version) { var ipEndpoint = (IPEndPoint)daemonSocket.LocalEndPoint; int port = ipEndpoint.Port; ISocketWrapper clientSocket = SocketFactory.CreateSocket(); clientSockets.Add(clientSocket); clientSocket.Connect(ipEndpoint.Address, port); // Now process the bytes flowing in from the client. PayloadWriter payloadWriter = new PayloadWriterFactory().Create(version); payloadWriter.WriteTestData(clientSocket.OutputStream); List<object[]> rowsReceived = PayloadReader.Read(clientSocket.InputStream); // Validate rows received. Assert.Equal(10, rowsReceived.Count); for (int i = 0; i < 10; ++i) { // Two UDFs registered, thus expecting two columns. // Refer to TestData.GetDefaultCommandPayload(). object[] row = rowsReceived[i]; Assert.Equal(2, rowsReceived[i].Length); Assert.Equal($"udf2 udf1 {i}", row[0]); Assert.Equal(i + i, row[1]); } } public void Dispose() { Environment.SetEnvironmentVariable(ReuseWorkerEnvVariable, _reuseWorker); } } }
37.048193
87
0.625041
[ "MIT" ]
AFFogarty/spark
src/csharp/Microsoft.Spark.Worker.UnitTest/DaemonWorkerTests.cs
3,075
C#
using System.Linq; using Algorithms.SortAlgorithms; namespace AlgorithmsTests.SortAlgorithms { class SorterDoubleTester: ISorterTester<double> { private const int testLength = 50; public void TestSortedSequence(ISorter<double> sorter) { var baseSequense = Enumerable .Range(1, testLength) .Select(x => x + 0.5); var input = baseSequense.ToArray(); var expected = baseSequense.ToArray(); SorterTestsHelper.TestSorter(input, expected, sorter); } public void TestReverseSortedSequence(ISorter<double> sorter) { var input = Enumerable .Range(-3, testLength) .Select(x => x + 0.5) .Reverse() .ToArray(); var expected = Enumerable .Range(-3, testLength) .Select(x => x + 0.5) .ToArray(); SorterTestsHelper.TestSorter(input, expected, sorter); } public void TestRandomSequence(ISorter<double> sorter) { var input = new double[] { 4.5, 1.5, 2.5, 3.5, 5.5 }; var expected = Enumerable .Range(1, 5) .Select(x => x + 0.5) .ToArray(); SorterTestsHelper.TestSorter(input, expected, sorter); } } }
30.955556
69
0.523331
[ "MIT" ]
PranamBhat/Algorithms
AlgorithmsTests/SorterHelper/SorterDoubleTester.cs
1,395
C#
using System.Threading; using System.Threading.Tasks; using EasyNetQ; using EasyNetQ.Topology; using Microsoft.Extensions.Options; using Realmar.Jobbernetes.Infrastructure.Options.RabbitMQ; namespace Realmar.Jobbernetes.Infrastructure.Messaging.EasyNetQ { internal static class BusExtensions { internal static async Task<(IExchange, IQueue)> DeclareAndBindQueueAsync(this IBus bus, IOptions<RabbitMQPubSubOptions> options, CancellationToken cancellationToken) { var exchange = await bus.DeclareExchangeAsync(options, cancellationToken).ConfigureAwait(false); var queue = await bus.DeclareQueue(options, cancellationToken).ConfigureAwait(false); await bus.BindQueue(exchange, queue, options, cancellationToken).ConfigureAwait(false); return (exchange, queue); } private static Task<IExchange> DeclareExchangeAsync(this IBus bus, IOptions<RabbitMQPubSubOptions> options, CancellationToken cancellationToken) => bus.Advanced.ExchangeDeclareAsync(options.Value.Exchange, configuration => { configuration.AsAutoDelete(false); configuration.AsDurable(true); configuration.WithType("direct"); }, cancellationToken); private static Task<IQueue> DeclareQueue(this IBus bus, IOptions<RabbitMQPubSubOptions> options, CancellationToken cancellationToken) => bus.Advanced.QueueDeclareAsync(options.Value.Queue, configuration => { configuration.AsAutoDelete(false); configuration.AsDurable(true); }, cancellationToken); private static Task<IBinding> BindQueue(this IBus bus, IExchange exchange, IQueue queue, IOptions<RabbitMQPubSubOptions> options, CancellationToken cancellationToken) => bus.Advanced.BindAsync(exchange, queue, options.Value.BindingKey, cancellationToken); } }
53.46
121
0.521137
[ "Apache-2.0" ]
realmar/Jobbernetes
job-system/Realmar.Jobbernetes.Infrastructure/Messaging/EasyNetQ/BusExtensions.cs
2,673
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Diagnostics.Tracing; using Azure.Core.Diagnostics; namespace Azure.Messaging.EventHubs.Processor.Diagnostics { /// <summary> /// EventSource for Azure-Messaging-EventHubs-Processor-BlobEventStore traces. /// </summary> /// /// <remarks> /// When defining Start/Stop tasks, the StopEvent.Id must be exactly StartEvent.Id + 1. /// /// Do not explicitly include the Guid here, since EventSource has a mechanism to automatically /// map to an EventSource Guid based on the Name (Azure-Messaging-EventHubs-Processor-BlobEventStore). /// </remarks> /// [EventSource(Name = EventSourceName)] internal class BlobEventStoreEventSource : EventSource { /// <summary>The name to use for the event source.</summary> private const string EventSourceName = "Azure-Messaging-EventHubs-Processor-BlobEventStore"; /// <summary> /// Provides a singleton instance of the event source for callers to /// use for logging. /// </summary> /// public static BlobEventStoreEventSource Log { get; } = new BlobEventStoreEventSource(EventSourceName); /// <summary> /// Prevents an instance of the <see cref="BlobEventStoreEventSource" /> class from being created /// outside the scope of this library. Exposed for testing purposes only. /// </summary> /// protected BlobEventStoreEventSource() { } /// <summary> /// Prevents an instance of the <see cref="BlobEventStoreEventSource" /> class from being created /// outside the scope of this library. Exposed for testing purposes only. /// </summary> /// /// <param name="eventSourceName">The name to assign to the event source.</param> /// private BlobEventStoreEventSource(string eventSourceName) : base(eventSourceName, EventSourceSettings.Default, AzureEventSourceListener.TraitName, AzureEventSourceListener.TraitValue) { } /// <summary> /// Indicates that a <see cref="BlobsCheckpointStore" /> was created. /// </summary> /// /// <param name="typeName">The type name for the checkpoint store.</param> /// <param name="accountName">The Storage account name corresponding to the associated container client.</param> /// <param name="containerName">The name of the associated container client.</param> /// [Event(20, Level = EventLevel.Verbose, Message = "{0} created. AccountName: '{1}'; ContainerName: '{2}'.")] public virtual void BlobsCheckpointStoreCreated(string typeName, string accountName, string containerName) { if (IsEnabled()) { WriteEvent(20, typeName, accountName ?? string.Empty, containerName ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve a list of ownership has started. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership are associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> /// [Event(21, Level = EventLevel.Informational, Message = "Starting to list ownership for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'.")] public virtual void ListOwnershipStart(string fullyQualifiedNamespace, string eventHubName, string consumerGroup) { if (IsEnabled()) { WriteEvent(21, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve a list of ownership has completed. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership are associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> /// <param name="ownershipCount">The amount of ownership received from the storage service.</param> /// [Event(22, Level = EventLevel.Informational, Message = "Completed listing ownership for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'. There were {3} ownership entries were found.")] public virtual void ListOwnershipComplete(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, int ownershipCount) { if (IsEnabled()) { WriteEvent(22, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, ownershipCount); } } /// <summary> /// Indicates that an unhandled exception was encountered while retrieving a list of ownership. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership are associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> /// <param name="errorMessage">The message for the exception that occurred.</param> /// [Event(23, Level = EventLevel.Error, Message = "An exception occurred when listing ownership for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'; ErrorMessage: '{3}'.")] public virtual void ListOwnershipError(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string errorMessage) { if (IsEnabled()) { WriteEvent(23, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, errorMessage ?? string.Empty); } } /// <summary> /// Indicates that an attempt to claim a partition ownership has started. /// </summary> /// /// <param name="partitionId">The identifier of the partition being claimed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> /// [Event(24, Level = EventLevel.Informational, Message = "Starting to claim ownership of partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}' for the owner '{4}'.")] public virtual void ClaimOwnershipStart(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) { if (IsEnabled()) { WriteEvent(24, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, ownerIdentifier ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve claim partition ownership has completed. /// </summary> /// /// <param name="partitionId">The identifier of the partition being claimed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> /// [Event(25, Level = EventLevel.Informational, Message = "Completed the attempt to claim ownership of partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}' for the owner '{4}'.")] public virtual void ClaimOwnershipComplete(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) { if (IsEnabled()) { WriteEvent(25, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, ownerIdentifier ?? string.Empty); } } /// <summary> /// Indicates that an exception was encountered while attempting to retrieve claim partition ownership. /// </summary> /// /// <param name="partitionId">The identifier of the partition being claimed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> /// <param name="errorMessage">The message for the exception that occurred.</param> /// [Event(26, Level = EventLevel.Error, Message = "An exception occurred when claiming ownership of partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}' for the owner '{4}'. ErrorMessage: '{5}'.")] public virtual void ClaimOwnershipError(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier, string errorMessage) { if (IsEnabled()) { WriteEvent(26, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, ownerIdentifier ?? string.Empty, errorMessage ?? string.Empty); } } /// <summary> /// Indicates that ownership was unable to be claimed. /// </summary> /// /// <param name="partitionId">The identifier of the partition being claimed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> /// <param name="message">The message for the failure.</param> /// [Event(27, Level = EventLevel.Informational, Message = "Unable to claim ownership of partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}' for the owner '{4}'. Message: '{5}'.")] public virtual void OwnershipNotClaimable(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier, string message) { if (IsEnabled()) { WriteEvent(27, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, ownerIdentifier ?? string.Empty, message ?? string.Empty); } } /// <summary> /// Indicates that ownership was successfully claimed. /// </summary> /// /// <param name="partitionId">The identifier of the partition being claimed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> /// [Event(28, Level = EventLevel.Informational, Message = "Successfully claimed ownership of partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}' for the owner '{4}'.")] public virtual void OwnershipClaimed(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) { if (IsEnabled()) { WriteEvent(28, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, ownerIdentifier ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve a list of checkpoints has started. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoints are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoints are associated with.</param> /// [Event(29, Level = EventLevel.Informational, Message = "Starting to list checkpoints for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'.")] public virtual void ListCheckpointsStart(string fullyQualifiedNamespace, string eventHubName, string consumerGroup) { if (IsEnabled()) { WriteEvent(29, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve a list of checkpoints has completed. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoints are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoints are associated with.</param> /// <param name="checkpointCount">The amount of checkpoints received from the storage service.</param> /// [Event(30, Level = EventLevel.Informational, Message = "Completed listing checkpoints for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'. There were '{3}' checkpoints found.")] public virtual void ListCheckpointsComplete(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, int checkpointCount) { if (IsEnabled()) { WriteEvent(30, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, checkpointCount); } } /// <summary> /// Indicates that an unhandled exception was encountered while retrieving a list of checkpoints. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoints are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> /// <param name="errorMessage">The message for the exception that occurred.</param> /// [Event(31, Level = EventLevel.Error, Message = "An exception occurred when listing checkpoints for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'; ErrorMessage: '{3}'.")] public virtual void ListCheckpointsError(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string errorMessage) { if (IsEnabled()) { WriteEvent(31, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, errorMessage ?? string.Empty); } } /// <summary> /// Indicates that an attempt to create/update a checkpoint has started. /// </summary> /// /// <param name="partitionId">The identifier of the partition being checkpointed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> /// [Event(32, Level = EventLevel.Informational, Message = "Starting to create/update a checkpoint for partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}'.")] public virtual void UpdateCheckpointStart(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup) { if (IsEnabled()) { WriteEvent(32, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty); } } /// <summary> /// Indicates that an attempt to update a checkpoint has completed. /// </summary> /// /// <param name="partitionId">The identifier of the partition being checkpointed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> /// [Event(33, Level = EventLevel.Informational, Message = "Completed the attempt to create/update a checkpoint for partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}'.")] public virtual void UpdateCheckpointComplete(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup) { if (IsEnabled()) { WriteEvent(33, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty); } } /// <summary> /// Indicates that an unhandled exception was encountered while updating a checkpoint. /// </summary> /// /// <param name="partitionId">The identifier of the partition being checkpointed.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> /// <param name="errorMessage">The message for the exception that occurred.</param> /// [Event(34, Level = EventLevel.Error, Message = "An exception occurred when creating/updating a checkpoint for partition: `{0}` of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}'. ErrorMessage: '{4}'.")] public virtual void UpdateCheckpointError(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string errorMessage) { if (IsEnabled()) { WriteEvent(34, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, errorMessage ?? string.Empty); } } /// <summary> /// Indicates that invalid checkpoint data was found during an attempt to retrieve a list of checkpoints. /// </summary> /// /// <param name="partitionId">The identifier of the partition the data is associated with.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the data is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the data is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the data is associated with.</param> /// [Event(35, Level = EventLevel.Warning, Message = "An invalid checkpoint was found for partition: '{0}' of FullyQualifiedNamespace: '{1}'; EventHubName: '{2}'; ConsumerGroup: '{3}'. This checkpoint is not valid and will be ignored.")] public virtual void InvalidCheckpointFound(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup) { if (IsEnabled()) { WriteEvent(35, partitionId ?? string.Empty, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve a checkpoint has started. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> /// <param name="partitionId">The partition id the specific checkpoint is associated with.</param> /// [Event(36, Level = EventLevel.Informational, Message = "Starting to retrieve checkpoint for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'; PartitionId: '{3}'.")] public virtual void GetCheckpointStart(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string partitionId) { if (IsEnabled()) { WriteEvent(36, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, partitionId ?? string.Empty); } } /// <summary> /// Indicates that an attempt to retrieve a checkpoint has completed. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> /// <param name="partitionId">The partition id the specific checkpoint is associated with.</param> /// [Event(37, Level = EventLevel.Informational, Message = "Completed retrieving checkpoint for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'. PartitionId: '{3}'.")] public virtual void GetCheckpointComplete(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string partitionId) { if (IsEnabled()) { WriteEvent(37, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, partitionId); } } /// <summary> /// Indicates that an unhandled exception was encountered while retrieving a checkpoint. /// </summary> /// /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> /// <param name="partitionId">The partition id the specific checkpoint is associated with.</param> /// <param name="errorMessage">The message for the exception that occurred.</param> /// [Event(38, Level = EventLevel.Error, Message = "An exception occurred when retrieving checkpoint for FullyQualifiedNamespace: '{0}'; EventHubName: '{1}'; ConsumerGroup: '{2}'; PartitionId: '{3}'; ErrorMessage: '{4}'.")] public virtual void GetCheckpointError(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string partitionId, string errorMessage) { if (IsEnabled()) { WriteEvent(38, fullyQualifiedNamespace ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, partitionId ?? string.Empty, errorMessage ?? string.Empty); } } } }
68.062366
244
0.604474
[ "MIT" ]
PSanetra/azure-sdk-for-net
sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/Diagnostics/BlobEventStoreEventSource.cs
31,649
C#
using System.Collections; using System.Collections.Generic; using System.Linq; using Captura.Video; using SharpDX.Direct3D; using SharpDX.Direct3D11; namespace Captura.Windows.MediaFoundation { // ReSharper disable once ClassNeverInstantiated.Global public class MfWriterProvider : IVideoWriterProvider { readonly Device _device; public MfWriterProvider() { _device = new Device(DriverType.Hardware, DeviceCreationFlags.BgraSupport); } public string Name => "MF"; public IEnumerator<IVideoWriterItem> GetEnumerator() { yield return new MfItem(_device); } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); public override string ToString() => Name; public IVideoWriterItem ParseCli(string Cli) { return Cli == "mf" ? this.First() : null; } public string Description => "Encode to Mp4: H.264 with AAC audio using Media Foundation Hardware encoder"; } }
27.184211
115
0.662149
[ "MIT" ]
121986645/Captura
src/Captura.Windows/MediaFoundation/MfWriterProvider.cs
1,035
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Triples_of_Letters { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); for (int i1 = 0; i1 < n; i1++) { for (int i2 = 0; i2 < n; i2++) { for (int i3 = 0; i3 < n; i3++) { var letterone = (char)('a' + i1); var lettertwo = (char)('a' + i2); var letterthree = (char)('a' + i3); Console.WriteLine("{0}{1}{2}",letterone , lettertwo, letterthree); } } } } } }
25.3125
90
0.412346
[ "MIT" ]
vasilchavdarov/SoftUniHomework
Projects/Intiger and real numbers/Triples of Letters/Program.cs
812
C#
using System; using UnityEngine; namespace UTJ { [Serializable] public class DataPath { public enum Root { CurrentDirectory, PersistentDataPath, StreamingAssetsPath, TemporaryCachePath, DataPath, } public Root m_root; public string m_leaf; public DataPath() { } public DataPath(Root root, string leaf) { m_root = root; m_leaf = leaf; } public string GetPath() { string ret = ""; switch (m_root) { case Root.CurrentDirectory: ret += "."; break; case Root.PersistentDataPath: ret += Application.persistentDataPath; break; case Root.StreamingAssetsPath: ret += Application.streamingAssetsPath; break; case Root.TemporaryCachePath: ret += Application.temporaryCachePath; break; case Root.DataPath: ret += Application.dataPath; break; } if (m_leaf.Length > 0) { ret += "/"; ret += m_leaf; } return ret; } public void CreateDirectory() { System.IO.Directory.CreateDirectory(GetPath()); } } }
24.301587
59
0.436969
[ "MIT" ]
SanukGames/NVIDIAHairWorksIntegration
HairWorksIntegration/Assets/UTJ/Misc/Scripts/DataPath.cs
1,531
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.Owin; namespace WebApplication1.Account { public partial class VerifyPhoneNumber : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>(); var phonenumber = Request.QueryString["PhoneNumber"]; var code = manager.GenerateChangePhoneNumberToken(User.Identity.GetUserId(), phonenumber); PhoneNumber.Value = phonenumber; } protected void Code_Click(object sender, EventArgs e) { if (!ModelState.IsValid) { ModelState.AddModelError("", "Invalid code"); return; } var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>(); var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>(); var result = manager.ChangePhoneNumber(User.Identity.GetUserId(), PhoneNumber.Value, Code.Text); if (result.Succeeded) { var user = manager.FindById(User.Identity.GetUserId()); if (user != null) { signInManager.SignIn(user, isPersistent: false, rememberBrowser: false); Response.Redirect("/Account/Manage?m=AddPhoneNumberSuccess"); } } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "Failed to verify phone"); } } }
35.4
113
0.614689
[ "CC0-1.0" ]
BlackWinged/testApp
WebApplication1/Account/VerifyPhoneNumber.aspx.cs
1,772
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.5456 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace XenOvf.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] public 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.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://schemas.dmtf.org/ovf/envelope/1")] public string cimEnvelopeURI { get { return ((string)(this["cimEnvelopeURI"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://www.microsoft.com/technet/virtualserver/downloads/vhdspec.mspx")] public string winFileFormatURI { get { return ((string)(this["winFileFormatURI"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Audit, Error, Warning")] public string LogLevel { get { return ((string)(this["LogLevel"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("XenApplianceWizard.log")] public string LogFile { get { return ((string)(this["LogFile"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Audit, Console")] public string LogType { get { return ((string)(this["LogType"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("XenLocalOVF")] public string LogSource { get { return ((string)(this["LogSource"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("ApplicationData")] public string LogPath { get { return ((string)(this["LogPath"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("XenServer P2V (Orela) Server")] public string p2vTemplate { get { return ((string)(this["p2vTemplate"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Orela")] public string p2vGuestName { get { return ((string)(this["p2vGuestName"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1.0.0")] public string ovfversion { get { return ((string)(this["ovfversion"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("{0}")] public string FileURI { get { return ((string)(this["FileURI"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Virtual Hardware Requirements: {0} MB RAM; {1} CPU(s), {2} Disk(s), {3} Network(s" + ")")] public string vhsSettings { get { return ((string)(this["vhsSettings"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("CPU;MEMORY;DISK")] public string OvfMimimalManifest { get { return ((string)(this["OvfMimimalManifest"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0.9;1.0;1.0.0;1.0.0a;1.0.0.b;1.0.0c;1.0.0d;1.0.1;1.0.0e")] public string Versions { get { return ((string)(this["Versions"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(@"ovf=http://schemas.dmtf.org/ovf/envelope/1, xs=http://www.w3.org/2001/XMLSchema,cim=http://schemas.dmtf.org/wbem/wscim/1/common,rasd=http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData,vssd=http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData,xsi=http://www.w3.org/2001/XMLSchema-instance,xenovf=http://schemas.citrix.com/ovf/envelope/1,wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd,ds=http://www.w3.org/2000/09/xmldsig#,wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd,xenc=http://www.w3.org/2001/04/xmlenc#")] public string KnownNamespaces { get { return ((string)(this["KnownNamespaces"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("true")] public string VerifySignatureOnly { get { return ((string)(this["VerifySignatureOnly"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("pygrub")] public string xenPVBootloader { get { return ((string)(this["xenPVBootloader"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("graphical utf8")] public string xenKernelOptions { get { return ((string)(this["xenKernelOptions"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("BIOS order")] public string xenBootOptions { get { return ((string)(this["xenBootOptions"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("dc")] public string xenBootOrder { get { return ((string)(this["xenBootOrder"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("nx=true;acpi=true;apic=true;pae=true;viridian=true;")] public string xenPVPlatformSetting { get { return ((string)(this["xenPVPlatformSetting"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("nx=true;acpi=true;apic=true;pae=true;stdvga=0;")] public string xenPlatformSetting { get { return ((string)(this["xenPlatformSetting"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("hvm-3.0-unknown")] public string xenDefaultVirtualSystemType { get { return ((string)(this["xenDefaultVirtualSystemType"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("xenbr0")] public string xenDefaultNetwork { get { return ((string)(this["xenDefaultNetwork"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("P2V Automatically created.")] public string xenP2VDiskName { get { return ((string)(this["xenP2VDiskName"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("vmwovf:http://www.vmware/schema/ovf")] public string vmwNameSpace { get { return ((string)(this["vmwNameSpace"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("network=")] public string xenNetworkKey { get { return ((string)(this["xenNetworkKey"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\DSP8023.xsd")] public string ovfEnvelopeSchemaLocation { get { return ((string)(this["ovfEnvelopeSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\DSP8027.xsd")] public string ovfEnvironmentSchemaLocation { get { return ((string)(this["ovfEnvironmentSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\xml.xsd")] public string xmlNamespaceSchemaLocation { get { return ((string)(this["xmlNamespaceSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\common.xsd")] public string cimCommonSchemaLocation { get { return ((string)(this["cimCommonSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\CIM_ResourceAllocationSettingData.xsd")] public string cimRASDSchemaLocation { get { return ((string)(this["cimRASDSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\CIM_VirtualSystemSettingData.xsd")] public string cimVSSDSchemaLocation { get { return ((string)(this["cimVSSDSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://schemas.dmtf.org/ovf/envelope/1/dsp8023.xsd")] public string dsp8023OnlineSchema { get { return ((string)(this["dsp8023OnlineSchema"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("false")] public string useOnlineSchema { get { return ((string)(this["useOnlineSchema"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Version, Files, Cpu, Memory, Networks, Capability, Schema")] public string RequiredValidations { get { return ((string)(this["RequiredValidations"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] public bool enforceValidation { get { return ((bool)(this["enforceValidation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("vmwovf")] public string vmwNamespacePrefix { get { return ((string)(this["vmwNamespacePrefix"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://www.vmware.com/schema/ovf/1/envelope")] public string vmwEnvelopeNamespace { get { return ((string)(this["vmwEnvelopeNamespace"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Plain//Stamp")] public string LogFormat { get { return ((string)(this["LogFormat"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(".vhd,.pvp,.vmdk,.mf,.cert,.xva,.ovf,.wim,.vdi,.sdi,.iso,.gz")] public string knownFileExtensions { get { return ((string)(this["knownFileExtensions"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(".mf")] public string manifestFileExtension { get { return ((string)(this["manifestFileExtension"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(".cert")] public string certificateFileExtension { get { return ((string)(this["certificateFileExtension"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("SHA1")] public string securityAlgorithm { get { return ((string)(this["securityAlgorithm"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\secext-1.0.xsd")] public string wsseSchemaLocation { get { return ((string)(this["wsseSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" + "")] public string wsseOnlineSchema { get { return ((string)(this["wsseOnlineSchema"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\xenc-schema.xsd")] public string xencSchemaLocation { get { return ((string)(this["xencSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\wss-utility-1.0.xsd")] public string wsuSchemaLocation { get { return ((string)(this["wsuSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Schemas\\xmldsig-core-schema.xsd")] public string xmldsigSchemaLocation { get { return ((string)(this["xmldsigSchemaLocation"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string encryptMicrosoftAlgorithmClass { get { return ((string)(this["encryptMicrosoftAlgorithmClass"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("192")] public string encryptKeyLength { get { return ((string)(this["encryptKeyLength"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://www.w3.org/2001/04/xmlenc#aes192-cbc")] public string encryptAlgorithmURI { get { return ((string)(this["encryptAlgorithmURI"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("CitrixEncryptedKey")] public string encryptKeyName { get { return ((string)(this["encryptKeyName"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.TripleDESCryptoServiceProvider")] public string tripledes_cbc { get { return ((string)(this["tripledes_cbc"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string aes128_cbc { get { return ((string)(this["aes128_cbc"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string aes256_cbc { get { return ((string)(this["aes256_cbc"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string aes192_cbc { get { return ((string)(this["aes192_cbc"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RSACryptoServiceProvider")] public string rsa_1_5 { get { return ((string)(this["rsa_1_5"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RSACryptoServiceProvider")] public string rsa_oaep_mgf1p { get { return ((string)(this["rsa_oaep_mgf1p"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.TripleDESCryptoServiceProvider")] public string kw_tripledes { get { return ((string)(this["kw_tripledes"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string kw_aes128 { get { return ((string)(this["kw_aes128"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string kw_aes256 { get { return ((string)(this["kw_aes256"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RijndaelManaged")] public string kw_aes192 { get { return ((string)(this["kw_aes192"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.SHA1CryptoServiceProvider")] public string sha1 { get { return ((string)(this["sha1"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.SHA256CryptoServiceProvider")] public string sha256 { get { return ((string)(this["sha256"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.FromBase64Transform")] public string base64 { get { return ((string)(this["base64"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.SHA384CryptoServiceProvider")] public string sha384 { get { return ((string)(this["sha384"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.SHA512CryptoServiceProvider")] public string sha512 { get { return ((string)(this["sha512"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("xen-3.0-unknown")] public string xenDefaultPVVirtualSystemType { get { return ((string)(this["xenDefaultPVVirtualSystemType"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://www.osta.org/specs/pdf/udf260.pdf")] public string isoFileFormatURI { get { return ((string)(this["isoFileFormatURI"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("en-US")] public string Language { get { return ((string)(this["Language"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("External Tools\\xenserver-linuxfixup-disk.iso")] public string xenLinuxFixUpDisk { get { return ((string)(this["xenLinuxFixUpDisk"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("off//XenOvfLogFwd.dll,XenOvfLogFwd.Log4Net")] public string LogForwarding { get { return ((string)(this["LogForwarding"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("128")] public double minPasswordStrength { get { return ((double)(this["minPasswordStrength"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("sr=")] public string xenSRKey { get { return ((string)(this["xenSRKey"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("device=")] public string xenDeviceKey { get { return ((string)(this["xenDeviceKey"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.DESCryptoServiceProvider")] public string des { get { return ((string)(this["des"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("System.Security.Cryptography.RC2CryptoServiceProvider\r\n")] public string rc2 { get { return ((string)(this["rc2"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] public bool useGZip { get { return ((bool)(this["useGZip"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("ovf:/disk/{0}")] public string hostresource { get { return ((string)(this["hostresource"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("CIM_OperatingSystem.xml, CIM_ResourceAllocationSettingData.xml, CIM_VirtualSystem" + "SettingData.xml")] public string mofFiles { get { return ((string)(this["mofFiles"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?> <ArrayOfString xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <string>xen-3.0-unknown</string> <string>xen-3.0-x32</string> <string>xen-3.0-x86</string> <string>xen-3.0-x64</string> <string>hvm-3.0-unknown</string> <string>hvm-3.0-x32</string> <string>hvm-3.0-x86</string> <string>hvm-3.0-x64</string> <string>hvm-3.0-hvm</string> <string>301</string> <string>vmx-4</string> <string>vmx-04</string> <string>vmx-6</string> <string>vmx-06</string> <string>vmx-7</string> <string>vmx-07</string> <string>DMTF:xen:pv</string> <string>DMTF:xen:hvm</string> <string>virtualbox-2.2</string> </ArrayOfString>")] public global::System.Collections.Specialized.StringCollection knownVirtualSystemTypes { get { return ((global::System.Collections.Specialized.StringCollection)(this["knownVirtualSystemTypes"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("vmx-07")] public string vmwHardwareType { get { return ((string)(this["vmwHardwareType"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1.3.1")] public string securityVersion { get { return ((string)(this["securityVersion"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Citrix\\XenCenter\\logs")] public string LogSubPath { get { return ((string)(this["LogSubPath"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("4096")] public int CompressBufferSize { get { return ((int)(this["CompressBufferSize"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute(".ovf")] public string ovfFileExtension { get { return ((string)(this["ovfFileExtension"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("vdi=")] public string xenVDIKey { get { return ((string)(this["xenVDIKey"])); } } } }
45.086595
718
0.614029
[ "BSD-2-Clause" ]
ChrisH4rding/xenadmin
XenOvfApi/Properties/Settings.Designer.cs
38,010
C#
using System.Xml.Serialization; namespace CarDealer.DTO.ExportDtos { [XmlType("car")] public class ExportSaleCarsDto { [XmlAttribute("make")] public string Make { get; set; } [XmlAttribute("model")] public string Model { get; set; } [XmlAttribute("travelled-distance")] public string TravelledDistance { get; set; } } }
21.555556
53
0.613402
[ "MIT" ]
Siaa17/softuni-csharp-modules
CSharp Entity Framework Core/CSharpEFCore - XML Processing - CarDealerDb/CarDealer/DTO/ExportDtos/ExportSaleCarsDto.cs
390
C#
using System; using System.Collections.Generic; using System.Text; namespace IspcaNotas.Features.Enums { public enum EnumAdmCRUD { Cadastrar = 1, Editar = 0 } }
14.692308
35
0.65445
[ "MIT" ]
Abeltomas16/Notas-ISPCAN
IspcaNotas/IspcaNotas/Features/Enums/EnumAdmCRUD.cs
193
C#
using HDF5CSharp.DataTypes; using Microsoft.Extensions.Logging; using System; using System.Buffers; using System.Threading.Tasks; namespace HDF5CSharp.Example.DataTypes { [Hdf5GroupName("eit")] public class EIT : Hdf5BaseFile, IDisposable { [Hdf5EntryName("configuration")] public string Configuration { get; set; } [Hdf5EntryName("start_datetime")] public long? StartDateTime { get; set; } [Hdf5EntryName("end_datetime")] public long EndDateTime { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<float> VoltagesReal { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<float> VoltagesIm { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<float> CurrentsReal { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<float> CurrentsIm { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<ulong> Saturation { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<long> Timestamps { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private ChunkedDataset<ulong> PacketIds { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private BlockingCollectionQueue<ElectrodeFrame> ElectrodeSamplesData { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private Task ElectrodeTaskWriter { get; set; } [Hdf5Save(Hdf5Save.DoNotSave)] private bool completed; [Hdf5Save(Hdf5Save.DoNotSave)] private int ChunkSize; public EIT(int recordNumber, int chunkSize, string acquisitionProtocol, long fileId, long groupRoot, ILogger logger) : base(fileId, groupRoot, "d" + recordNumber, logger) { ChunkSize = chunkSize; var pool = ArrayPool<ElectrodeFrame>.Shared; ElectrodeSamplesData = new BlockingCollectionQueue<ElectrodeFrame>(); Configuration = acquisitionProtocol; VoltagesReal = new ChunkedDataset<float>("voltages.re", GroupId); VoltagesIm = new ChunkedDataset<float>("voltages.im", GroupId); CurrentsReal = new ChunkedDataset<float>("currents.re", GroupId); CurrentsIm = new ChunkedDataset<float>("currents.im", GroupId); Saturation = new ChunkedDataset<ulong>("saturations", GroupId); Timestamps = new ChunkedDataset<long>("timestamps", GroupId); PacketIds = new ChunkedDataset<ulong>("packetids", GroupId); ElectrodeTaskWriter = Task.Factory.StartNew(() => { var buffer = pool.Rent(ChunkSize); completed = false; int count = 0; foreach (ElectrodeFrame data in ElectrodeSamplesData.GetConsumingEnumerable()) { buffer[count++] = data; if (count == ChunkSize) { EndDateTime = data.timestamp; AppendSample(buffer, chunkSize); count = 0; } } if (count != 0) { EndDateTime = buffer[count - 1].timestamp; AppendSample(buffer, count); } FlushData();//end of data samples. flush data pool.Return(buffer); }); } private void AppendSample(ElectrodeFrame[] samples, int length) { float[,] vReData = new float[length, samples[0].ComplexVoltageMatrix.Length]; float[,] vImData = new float[length, samples[0].ComplexVoltageMatrix.Length]; float[,] cReData = new float[length, samples[0].ComplexCurrentMatrix.Length]; float[,] cImData = new float[length, samples[0].ComplexCurrentMatrix.Length]; ulong[,] saturationData = new ulong[length, 1]; long[,] timestampData = new long[length, 1]; // Write packet id, kalpa clock only if exist => value != Uint64.MaxValue (default value) ulong[,] packetIdData = samples[0].PacketId == UInt64.MaxValue ? null : new ulong[length, 1]; for (var i = 0; i < length; i++) { ElectrodeFrame electrodeFrame = samples[i]; for (int j = 0; j < electrodeFrame.ComplexVoltageMatrix.Length; j++) { vReData[i, j] = electrodeFrame.ComplexVoltageMatrix[j].Re; vImData[i, j] = electrodeFrame.ComplexVoltageMatrix[j].Im; } for (int j = 0; j < electrodeFrame.ComplexCurrentMatrix.Length; j++) { cReData[i, j] = electrodeFrame.ComplexCurrentMatrix[j].Re; cImData[i, j] = electrodeFrame.ComplexCurrentMatrix[j].Im; } saturationData[i, 0] = electrodeFrame.SaturationMask; timestampData[i, 0] = electrodeFrame.timestamp; if (packetIdData != null) { packetIdData[i, 0] = electrodeFrame.PacketId; } } VoltagesReal.AppendOrCreateDataset(vReData); VoltagesIm.AppendOrCreateDataset(vImData); CurrentsReal.AppendOrCreateDataset(cReData); CurrentsIm.AppendOrCreateDataset(cImData); Saturation.AppendOrCreateDataset(saturationData); Timestamps.AppendOrCreateDataset(timestampData); if (packetIdData != null) { PacketIds.AppendOrCreateDataset(packetIdData); } } public void Dispose() { try { if (!Disposed) { VoltagesReal.Dispose(); VoltagesIm.Dispose(); CurrentsReal?.Dispose(); CurrentsIm.Dispose(); Saturation.Dispose(); Timestamps.Dispose(); PacketIds?.Dispose(); ElectrodeTaskWriter.Dispose(); Hdf5.CloseGroup(GroupId); Disposed = true; } } catch (Exception e) { Logger.LogError($"Error during dispose of EIT: {e.Message}"); } } public void Enqueue(ElectrodeFrame sample) { if (completed) { return; } if (!StartDateTime.HasValue) { StartDateTime = sample.timestamp; } ElectrodeSamplesData.Enqueue(sample); } public void CompleteAdding() { if (completed) { return; } completed = true; ElectrodeSamplesData.CompleteAdding(); } public async Task WaitForDataWritten() { CompleteAdding(); await ElectrodeTaskWriter; } } }
40.485549
178
0.556111
[ "MIT" ]
DavidSabbah/HDF5-CSharp
HDF5-CSharp.Example/DataTypes/EIT.cs
7,006
C#
using Assets.Gamelogic.Core; using Improbable.Core; using Improbable.Unity; using Improbable.Unity.Core; using Improbable.Unity.Visualizer; using UnityEngine; namespace Assets.Gamelogic.Player { [EngineType(EnginePlatform.Client)] class PlayerLifecycle : MonoBehaviour { [Require] private ClientAuthorityCheck.Writer clientAuthorityCheck; private void OnApplicationQuit() { if (SpatialOS.IsConnected) { ClientPlayerSpawner.DeletePlayer(); } } } }
22.75
69
0.672161
[ "MIT" ]
teostoleru/SpatialLink
workers/unity/Assets/Gamelogic/Player/PlayerLifecycle.cs
548
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using TokenServiceApi.Data; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using TokenServiceApi.Models; using TokenServiceApi.Services; namespace TokenServiceApi { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity<ApplicationUser, IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient<IEmailSender, EmailSender>(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); // configure identity server with in-memory stores, keys, clients and scopes services.AddIdentityServer() .AddDeveloperSigningCredential() .AddInMemoryPersistedGrants() .AddInMemoryIdentityResources(Config.GetIdentityResources()) .AddInMemoryApiResources(Config.GetApiResources()) .AddInMemoryClients(Config.GetClients(Config.GetUrls(Configuration))) .AddAspNetIdentity<ApplicationUser>(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); // app.UseIdentity(); // not needed, since UseIdentityServer adds the authentication middleware app.UseIdentityServer(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } }
36.202247
119
0.638423
[ "MIT" ]
Janani-Sankar/janani-assignments
Assignment3b/EventBrit/TokenServiceApi/Startup.cs
3,224
C#
/* * @author : Jagepard <jagepard@yandex.ru> * @license https://mit-license.org/ MIT */ namespace CsDesignPatterns_Interpreter { internal class Album : IAlbum { private readonly string _name; private readonly string _author; public Album(string author, string name) { _name = name; _author = author; } public string GetAuthor() { return _author; } public string GetName() { return _name; } } }
18.366667
48
0.529946
[ "MIT" ]
Jagepard/CsDesignPatterns-Interpreter
Album.cs
553
C#
using Pchp.Core; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Pchp.Core.Utilities; namespace Pchp.Library { public static partial class PhpPath { #region Constants /// <summary> /// Fill the "dirname" field in results. /// </summary> public const int PATHINFO_DIRNAME = (int)PathInfoOptions.DirName; /// <summary> /// Fill the "basename" field in results. /// </summary> public const int PATHINFO_BASENAME = (int)PathInfoOptions.BaseName; /// <summary> /// Fill the "extension" field in results. /// </summary> public const int PATHINFO_EXTENSION = (int)PathInfoOptions.Extension; /// <summary> /// Fill the "filename" field in results. Since PHP 5.2.0. /// </summary> public const int PATHINFO_FILENAME = (int)PathInfoOptions.FileName; #endregion #region basename, dirname, pathinfo /// <summary> /// The flags indicating which fields the <see cref="pathinfo(string, PathInfoOptions)"/> /// method should fill in the result array. /// </summary> [Flags] public enum PathInfoOptions { /// <summary> /// Fill the "dirname" field in results. /// </summary> DirName = 1, /// <summary> /// Fill the "basename" field in results. /// </summary> BaseName = 2, /// <summary> /// Fill the "extension" field in results. /// </summary> Extension = 4, /// <summary> /// Fill the "filename" field in results. Since PHP 5.2.0. /// </summary> FileName = 8, /// <summary> /// All the four options result in an array returned by <see cref="PhpPath.GetInfo"/>. /// </summary> All = DirName | BaseName | Extension | FileName } /// <summary> /// Returns path component of path. /// </summary> /// <remarks> /// Given a <see cref="string"/> containing a path to a file, this function will return the base name of the file. /// If the path ends in this will also be cut off. /// On Windows, both slash (/) and backslash (\) are used as path separator character. /// In other environments, it is the forward slash (/). /// </remarks> /// <param name="path">A <see cref="string"/> containing a path to a file.</param> /// <returns>The path conponent of the given <paramref name="path"/>.</returns> public static string basename(string path) => basename(path, null); /// <summary> /// Returns path component of path. /// </summary> /// <remarks> /// Given a <see cref="string"/> containing a path to a file, this function will return the base name of the file. /// If the path ends in this will also be cut off. /// On Windows, both slash (/) and backslash (\) are used as path separator character. /// In other environments, it is the forward slash (/). /// </remarks> /// <param name="path">A <see cref="string"/> containing a path to a file.</param> /// <param name="suffix">A <see cref="string"/> containing suffix to be cut off the path if present.</param> /// <returns>The path conponent of the given <paramref name="path"/>.</returns> public static string basename(string path, string suffix /*= null*/) { if (string.IsNullOrEmpty(path)) return string.Empty; int end = path.Length - 1; while (end >= 0 && path[end].IsDirectorySeparator()) end--; int start = end; while (start >= 0 && !path[start].IsDirectorySeparator()) start--; start++; int name_length = end - start + 1; if (!string.IsNullOrEmpty(suffix) && suffix.Length < name_length && string.Compare(path, end - suffix.Length + 1, suffix, 0, suffix.Length, StringComparison.CurrentCultureIgnoreCase) == 0) { name_length -= suffix.Length; } return path.Substring(start, name_length); } /// <summary> /// Returns directory name component of path. /// </summary> /// <param name="path">The full path.</param> /// <returns>The directory portion of the given path.</returns> public static string dirname(string path) => dirname(path, levels: 1); /// <summary> /// Returns directory name component of path. /// </summary> /// <param name="path">The full path.</param> /// <param name="levels">The number of parent directories to go up. Must be greater than zero.</param> /// <returns>The directory portion of the given path.</returns> public static string dirname(string path, int levels /*= 1*/) { if (string.IsNullOrEmpty(path)) return string.Empty; if (levels < 1) throw new ArgumentOutOfRangeException(nameof(levels)); var pathspan = path.AsSpan(); while (levels-- > 0) { pathspan = dirname(pathspan); } // return pathspan.ToString(); } static ReadOnlySpan<char> dirname(ReadOnlySpan<char> path) { if (path.IsEmpty) { return ReadOnlySpan<char>.Empty; } if (path.IndexOfAny(CurrentPlatform.DirectorySeparator, CurrentPlatform.AltDirectorySeparator) < 0) { // If there are no slashes in path, a dot ('.') is returned, indicating the current directory return ".".AsSpan(); } int start = 0; int end = path.Length - 1; // advance start position beyond drive specifier: if (path.Length >= 2 && path[1] == ':' && (path[0] >= 'a' && path[0] <= 'z' || path[0] >= 'A' && path[0] <= 'Z')) { start = 2; if (path.Length == 2) { return path; } } // strip slashes from the end: while (end >= start && path[end].IsDirectorySeparator()) end--; if (end < start) return (path.Slice(0, end + 1).ToString() + CurrentPlatform.DirectorySeparator).AsSpan(); // strip file name: while (end >= start && !path[end].IsDirectorySeparator()) end--; if (end < start) return (path.Slice(0, end + 1).ToString() + ".").AsSpan(); // strip slashes from the end: while (end >= start && path[end].IsDirectorySeparator()) end--; if (end < start) return (path.Slice(0, end + 1).ToString() + CurrentPlatform.DirectorySeparator).AsSpan(); // result: return path.Slice(0, end + 1); } /// <summary> /// Extracts part(s) from a specified path. /// </summary> /// <param name="path">The path to be parsed.</param> /// <param name="options">Flags determining the result.</param> /// <returns> /// If <paramref name="options"/> is <see cref="PathInfoOptions.All"/> then returns array /// keyed by <c>"dirname"</c>, <c>"basename"</c>, and <c>"extension"</c>. Otherwise, /// it returns string value containing a single part of the path. /// </returns> public static PhpValue pathinfo(string path, PathInfoOptions options = PathInfoOptions.All) { // collect strings string dirname = null, basename = null, extension = null, filename = null; if ((options & PathInfoOptions.BaseName) != 0 || (options & PathInfoOptions.Extension) != 0 || (options & PathInfoOptions.FileName) != 0) basename = PhpPath.basename(path); if ((options & PathInfoOptions.DirName) != 0) dirname = PhpPath.dirname(path); if ((options & PathInfoOptions.Extension) != 0) { int last_dot = basename.LastIndexOf('.'); if (last_dot >= 0) extension = basename.Substring(last_dot + 1); } if ((options & PathInfoOptions.FileName) != 0) { int last_dot = basename.LastIndexOf('.'); if (last_dot >= 0) filename = basename.Substring(0, last_dot); else filename = basename; } // return requested value or all of them in an associative array if (options == PathInfoOptions.All) { var result = new PhpArray(4); result.Add("dirname", dirname); result.Add("basename", basename); result.Add("extension", extension); result.Add("filename", filename); return PhpValue.Create(result); } if ((options & PathInfoOptions.DirName) != 0) return PhpValue.Create(dirname); if ((options & PathInfoOptions.BaseName) != 0) return PhpValue.Create(basename); if ((options & PathInfoOptions.Extension) != 0) return PhpValue.Create(extension); if ((options & PathInfoOptions.FileName) != 0) return PhpValue.Create(filename); return PhpValue.Null; } #endregion #region tempnam, realpath, sys_get_temp_dir /// <summary> /// Creates a file with a unique path in the specified directory. /// If the directory does not exist, <c>tempnam()</c> may generate /// a file in the system's temporary directory, and return the name of that. /// </summary> /// <param name="ctx">The current runtime context.</param> /// <param name="dir">The directory where the temporary file should be created.</param> /// <param name="prefix">The prefix of the unique path.</param> /// <returns>A unique path for a temporary file /// in the given <paramref name="dir"/>.</returns> [return: CastToFalse] public static string tempnam(Context ctx, string dir, string prefix) { // makes "dir" a valid directory: dir = FileSystemUtils.AbsolutePath(ctx, dir); // Resolve to current working directory (Context.WorkingDirectory) if (string.IsNullOrEmpty(dir) || !System.IO.Directory.Exists(dir)) { dir = Path.GetTempPath(); } else { dir += Path.DirectorySeparatorChar; } // makes "prefix" a valid file prefix: if (string.IsNullOrEmpty(prefix) || prefix.IndexOfAny(Path.GetInvalidPathChars()) >= 0) { prefix = "tmp_"; } var suffix = unchecked((ulong)System.DateTime.UtcNow.Ticks / 5) & 0xffff; string result; try { for (; ; suffix++) { result = string.Concat(dir, prefix, suffix.ToString("x4"), ".tmp"); if (!File.Exists(result)) { try { File.Open(result, FileMode.CreateNew).Close(); break; } catch (UnauthorizedAccessException) { // try system temp directory: dir = Path.GetTempPath(); } catch (PathTooLongException e) { PhpException.Throw(PhpError.Notice, PhpException.ToErrorMessage(e.Message)); return Path.GetTempFileName(); } } } } catch (Exception e) { PhpException.Throw(PhpError.Notice, PhpException.ToErrorMessage(e.Message)); return null; } return result; } /// <summary> /// Returns the path of the directory PHP stores temporary files in by default. /// </summary> /// <returns>Returns the path of the temporary directory.</returns> /// <remarks>Path ends with "\"</remarks> public static string sys_get_temp_dir() => Path.GetTempPath(); ///// <summary> ///// A counter used to generate unique filenames for <see cref="tempnam(string, string)"/>. ///// </summary> //static int _tempCounter = 0; /// <summary> /// Returns canonicalized absolute path name. /// </summary> /// <param name="ctx">Runtime context.</param> /// <param name="path">Arbitrary path.</param> /// <returns> /// The given <paramref name="path"/> combined with the current working directory or /// <B>false</B> if the path is invalid or doesn't exists. /// </returns> [return: CastToFalse] public static string realpath(Context ctx, string path) { if (string.IsNullOrEmpty(path)) { return ctx.WorkingDirectory; } // string ending slash path = path.TrimEndSeparator(); // var realpath = FileSystemUtils.AbsolutePath(ctx, path); if (File.Exists(realpath) || System.IO.Directory.Exists(realpath) || Context.TryResolveScript(ctx.RootPath, realpath).IsValid) // check a compiled script { return realpath; } return null; } #endregion } }
37.55
146
0.52134
[ "Apache-2.0" ]
G7h7/peachpie
src/Peachpie.Library/FileSystem.Path.cs
14,271
C#
using System; using System.Collections.Generic; using PureToContensisImporter.Contensis; using PureToContensisImporter.Pure; namespace PureToContensisImporter { class Program { static void Main(string[] args) { // 1. Get list of current staff from Pure var pureClient = PureClientFactory.GetClient(); var persons = pureClient.GetPersons(5); // 2. Construct AcademicStaff objects for each member var staff = ConvertPersonsToAcademicStaff(persons); // 3. Delete current Academic Staff in CMS var cmsClient = CmsClientFactory.GetClient(); bool deleteSuccess = cmsClient.DeleteAcademicStaff(); bool addSuccess = false; // 4. Add the AcademicStaff to CMS if (deleteSuccess) { addSuccess = cmsClient.AddAcademicStaff(staff); } if (addSuccess) { Console.WriteLine("Old CMS Staff deleted and new data from Pure uploaded"); } else { Console.WriteLine("There were issues - check the console output, hopefully we wrote out some of the error messages"); } } /// <summary> /// Converts a list from Pure PersonsResponse.Person to CMS AcademicStaff /// </summary> /// <param name="persons"></param> /// <returns></returns> static List<AcademicStaff> ConvertPersonsToAcademicStaff(List<PersonsResponse.Person> persons) { var staff = new List<AcademicStaff>(); foreach (var person in persons) { var member = new AcademicStaff { Id = person.Id, Title = person.Title, FirstName = person.FirstName, LastName = person.LastName, Email = person.Email }; staff.Add(member); } return staff; } } }
31.772727
133
0.538865
[ "MIT" ]
UniversityOfBrightonComputing/PureToContensisImporter
PureToContensisImporter/Program.cs
2,099
C#
using System; namespace YoloTrain.Mvvm.ApplicationServices { /// <summary> /// IDispatcher /// </summary> public interface IDispatcher { /// <summary> /// Executes the specified delegate with the specified arguments on the thread the <see cref="System.Windows.Threading.Dispatcher" /> was created on. /// </summary> /// <param name="method">An <see cref="Action" /> which is pushed onto the <see cref="System.Windows.Threading.Dispatcher" /> event queue.</param> void BeginInvoke(Action method); /// <summary>Determines whether the calling thread is the thread associated with this <see cref="System.Windows.Threading.Dispatcher" />.</summary> /// <returns><c>true</c> if the calling thread is the thread associated with this <see cref="System.Windows.Threading.Dispatcher" />; otherwise, <c>false</c>.</returns> bool CheckAccess(); } }
44.190476
176
0.665948
[ "MIT" ]
judwhite/YoloTrain
YoloTrain/Mvvm/ApplicationServices/IDispatcher.cs
930
C#
using System.Linq; namespace Algo.Sorting { /// <summary> /// QuickSort implementation. /// </summary> public class QuickSort : Sorter<int> { /// <summary> /// Sorts the elements of an array. /// </summary> /// <param name="input">The input array.</param> /// <returns>A sorted array containing the input elements.</returns> public override int[] Sort(int[] input) { // though QuickSort can do in-place sorting, // leave the original array untouched as per the base class contract int[] copy = input.ToArray(); Sort(copy, 0, input.Length - 1); return copy; } /// <summary> /// In-place recursive QuickSort. /// </summary> /// <param name="input">Input array.</param> /// <param name="start">Start index.</param> /// <param name="end">End index.</param> /// <returns></returns> private void Sort(int[] input, int start, int end) { if (start >= end) { return; } int pivot = input[start]; int temp; int i, j; for (i = start + 1, j = start + 1; j <= end; j++) { if (input[j] < pivot) { temp = input[j]; input[j] = input[i]; input[i] = temp; i++; } } temp = input[i - 1]; input[i - 1] = input[start]; input[start] = temp; Sort(input, start, i - 2); Sort(input, i, end); return; } } }
26
80
0.433984
[ "MIT" ]
scripni/algo
Algo/Algo/Sorting/QuickSort.cs
1,744
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace TShockAPI { 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", "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> /// 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("TShockAPI.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.09375
165
0.59674
[ "MIT" ]
BloodARG/tModLoaderTShock
TShock-general-devel/TShockAPI/Resources.Designer.cs
2,761
C#
using System.Linq; using System.Threading; using System.Threading.Tasks; using JetBrains.Collections.Viewable; using JetBrains.Core; using JetBrains.Lifetimes; using JetBrains.Rd.Reflection; using JetBrains.Rd.Tasks; using NUnit.Framework; namespace Test.RdFramework.Reflection { /// <summary> /// Live models can be returned from calls. Provided lifetime in method's parameters should define the lifetime of /// "connection" of two sides. /// </summary> [TestFixture] public class ProxyGeneratorModelTest : ProxyGeneratorTestBase { protected override bool IsAsync => true; [RdRpc] public interface IModelOwner { Task<LiveModel> QueryModel(Lifetime m); LiveModel QueryModelSync(Lifetime m); } [RdExt] public class ModelOwner : RdExtReflectionBindableBase, IModelOwner { public string State; private readonly ReflectionRdActivator myActivator; public ModelOwner(ReflectionRdActivator activator) { myActivator = activator; } public Task<LiveModel> QueryModel(Lifetime m) { return Task.FromResult(QueryModelSync(m)); } public LiveModel QueryModelSync(Lifetime m) { var model = myActivator.Activate<LiveModel>(); model.Values.Advise(m, e => State = e.NewValue); return model; } } [RdModel] public class LiveModel : RdReflectionBindableBase { public IViewableList<string> Values { get; } } [Test] public async Task TestAsync() { await YieldToClient(); var client = CFacade.ActivateProxy<IModelOwner>(TestLifetime, ClientProtocol); await YieldToServer(); var server = SFacade.InitBind(new ModelOwner(SFacade.Activator), TestLifetime, ServerProtocol); await Wait(); await YieldToClient(); var liveModel = await client.QueryModel(TestLifetime); await YieldToClient(); liveModel.Values.Add("Test"); await Wait(); Assert.AreEqual("Test", server.State); } [Test, Repeat(10), Description("Repeat test as it reveal cancellation race")] public async Task TestSyncCall() { SwitchingScheduler.Disable(TestLifetime); await YieldToClient(); var client = CFacade.ActivateProxy<IModelOwner>(TestLifetime, ClientProtocol); await YieldToServer(); var server = SFacade.InitBind(new ModelOwner(SFacade.Activator), TestLifetime, ServerProtocol); await Wait(); LiveModel liveModel; using (var modelLifetimeDef = new LifetimeDefinition(TestLifetime)) { await YieldToClient(); liveModel = client.QueryModelSync(modelLifetimeDef.Lifetime); liveModel.Values.Add("proper set"); } liveModel.Values.Add("unbound set"); await Wait(); Assert.AreEqual("proper set", server.State); } } }
27.304762
116
0.676666
[ "Apache-2.0" ]
IlyaAI/rd
rd-net/Test.RdFramework/Reflection/ProxyGeneratorModelTest.cs
2,869
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.239 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Resources; using System.Runtime.CompilerServices; namespace DotSpatial.Serialization.Properties { /// <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. [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [DebuggerNonUserCode()] [CompilerGenerated()] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (ReferenceEquals(resourceMan, null)) { ResourceManager temp = new ResourceManager("DotSpatial.Serialization.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> [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized string similar to The collection cannot be altered because it is read only.. /// </summary> internal static string ReadOnly { get { return ResourceManager.GetString("ReadOnly", resourceCulture); } } } }
37.512821
141
0.568353
[ "MIT" ]
sdrmaps/dotspatial
Source/DotSpatial.Serialization/Properties/Resources.Designer.cs
2,928
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 Northwind.Models { using System; using System.Collections.Generic; public partial class Order_Subtotal { public int OrderID { get; set; } public Nullable<decimal> Subtotal { get; set; } } }
31.666667
85
0.511278
[ "MIT" ]
NinoSimeonov/Telerik-Academy
Databases/08. Entity Framework/Northwind.Models/Order_Subtotal.cs
665
C#
// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; using System.Runtime.CompilerServices; // ReSharper disable CompareOfFloatsByEqualityOperator namespace SixLabors.ImageSharp.ColorSpaces { /// <summary> /// Represents the coordinates of CIEXY chromaticity space /// </summary> public readonly struct CieXyChromaticityCoordinates : IEquatable<CieXyChromaticityCoordinates> { /// <summary> /// Gets the chromaticity X-coordinate. /// </summary> /// <remarks> /// Ranges usually from 0 to 1. /// </remarks> public readonly float X; /// <summary> /// Gets the chromaticity Y-coordinate /// </summary> /// <remarks> /// Ranges usually from 0 to 1. /// </remarks> public readonly float Y; /// <summary> /// Initializes a new instance of the <see cref="CieXyChromaticityCoordinates"/> struct. /// </summary> /// <param name="x">Chromaticity coordinate x (usually from 0 to 1)</param> /// <param name="y">Chromaticity coordinate y (usually from 0 to 1)</param> [MethodImpl(InliningOptions.ShortMethod)] public CieXyChromaticityCoordinates(float x, float y) { this.X = x; this.Y = y; } /// <summary> /// Compares two <see cref="CieXyChromaticityCoordinates"/> objects for equality. /// </summary> /// <param name="left">The <see cref="CieXyChromaticityCoordinates"/> on the left side of the operand.</param> /// <param name="right">The <see cref="CieXyChromaticityCoordinates"/> on the right side of the operand.</param> /// <returns> /// True if the current left is equal to the <paramref name="right"/> parameter; otherwise, false. /// </returns> [MethodImpl(InliningOptions.ShortMethod)] public static bool operator ==(CieXyChromaticityCoordinates left, CieXyChromaticityCoordinates right) => left.Equals(right); /// <summary> /// Compares two <see cref="CieXyChromaticityCoordinates"/> objects for inequality /// </summary> /// <param name="left">The <see cref="CieXyChromaticityCoordinates"/> on the left side of the operand.</param> /// <param name="right">The <see cref="CieXyChromaticityCoordinates"/> on the right side of the operand.</param> /// <returns> /// True if the current left is unequal to the <paramref name="right"/> parameter; otherwise, false. /// </returns> [MethodImpl(InliningOptions.ShortMethod)] public static bool operator !=(CieXyChromaticityCoordinates left, CieXyChromaticityCoordinates right) => !left.Equals(right); /// <inheritdoc /> [MethodImpl(InliningOptions.ShortMethod)] public override int GetHashCode() => HashCode.Combine(this.X, this.Y); /// <inheritdoc/> public override string ToString() => FormattableString.Invariant($"CieXyChromaticityCoordinates({this.X:#0.##}, {this.Y:#0.##})"); /// <inheritdoc/> public override bool Equals(object obj) => obj is CieXyChromaticityCoordinates other && this.Equals(other); /// <inheritdoc/> [MethodImpl(InliningOptions.ShortMethod)] public bool Equals(CieXyChromaticityCoordinates other) => this.X.Equals(other.X) && this.Y.Equals(other.Y); } }
43.835443
138
0.635865
[ "Apache-2.0" ]
HighEndGuy/ImageSharp
src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
3,465
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; using RazorStripe.Data; using RazorStripe.Models; namespace RazorStripe.Areas.Identity.Pages.Account.Manage { public class ResetAuthenticatorModel : PageModel { UserManager<ApplicationUser> _userManager; private readonly SignInManager<ApplicationUser> _signInManager; ILogger<ResetAuthenticatorModel> _logger; public ResetAuthenticatorModel( UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, ILogger<ResetAuthenticatorModel> logger) { _userManager = userManager; _signInManager = signInManager; _logger = logger; } [TempData] public string StatusMessage { get; set; } public async Task<IActionResult> OnGet() { var user = await _userManager.GetUserAsync(User); if (user == null) { return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } return Page(); } public async Task<IActionResult> OnPostAsync() { var user = await _userManager.GetUserAsync(User); if (user == null) { return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } await _userManager.SetTwoFactorEnabledAsync(user, false); await _userManager.ResetAuthenticatorKeyAsync(user); _logger.LogInformation("User with ID '{UserId}' has reset their authentication app key.", user.Id); await _signInManager.RefreshSignInAsync(user); StatusMessage = "Your authenticator app key has been reset, you will need to configure your authenticator app using the new key."; return RedirectToPage("./EnableAuthenticator"); } } }
34.354839
142
0.648357
[ "MIT" ]
DragonMastery/RazorStripe
Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs
2,132
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using ContosoUniversity.Models; namespace ContosoUniversity.Pages.Courses { public class DetailsModel : PageModel { private readonly ContosoUniversity.Models.SchoolContext _context; public DetailsModel(ContosoUniversity.Models.SchoolContext context) { _context = context; } public Course Course { get; set; } public async Task<IActionResult> OnGetAsync(int? id) { if (id == null) { return NotFound(); } Course = await _context.Courses .AsNoTracking() .Include(c => c.Department) .FirstOrDefaultAsync(m => m.CourseID == id); if (Course == null) { return NotFound(); } return Page(); } } }
25.181818
76
0.562274
[ "MIT" ]
LouisT123/EFCoreRazorPAges
ContosoUniversity/ContosoUniversity/Pages/Courses/Details.cshtml.cs
1,108
C#
 using System; using System.Runtime.Serialization; namespace WOWSharp.Community.Wow { /// <summary> /// Item source types /// </summary> [Flags] [DataContract] public enum ItemSourceTypes { /// <summary> /// None /// </summary> [EnumMember(Value = "NONE")] None = 0, /// <summary> /// Creature Drop /// </summary> [EnumMember(Value = "CREATURE_DROP")] CreatureDrop = 1, /// <summary> /// Game object drop /// </summary> [EnumMember(Value = "GAME_OBJECT_DROP")] GameObjectDrop = 2, /// <summary> /// Quest Reward /// </summary> [EnumMember(Value = "REWARD_FOR_QUEST")] QuestReward = 4, /// <summary> /// Faction Reward /// </summary> [EnumMember(Value = "FACTION_REWARD")] FactionReward = 8, /// <summary> /// crafted /// </summary> [EnumMember(Value = "CREATED_BY_SPELL")] Crafted = 16, /// <summary> /// achievement /// </summary> [EnumMember(Value = "ACHIEVEMENT_REWARD")] Achievement = 32 } }
21.982143
50
0.483347
[ "MIT" ]
Shogobg/Blizzard.net-API
WOWSharp.Community/Wow/Items/ItemSourceTypes.cs
1,233
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Reflection; namespace GrayStorm { public partial class shellcode : UserControl { #region init GrayStorm.dataBox payload; public shellcode() { InitializeComponent(); } public void loadShellcode() { foreach (var payloads in GrayStorm.shellcodes.payloads.payloadsList()) payloads_LB.Items.Add(payloads); foreach (var metaPayloads in GrayStorm.shellcodes.payloads.metaSploitList()) metaSploit_LB.Items.Add(metaPayloads); } #endregion init #region listBox selecting private void payloads_LB_SelectedIndexChanged(object sender, EventArgs e) { if (payloads_LB.SelectedIndex == -1) return; object shellcode = payloads_LB.SelectedItem; displayPayload(shellcode); metaSploit_LB.SelectedIndex = -1; } private void metaSploit_LB_SelectedIndexChanged(object sender, EventArgs e) { if (metaSploit_LB.SelectedIndex == -1) return; object shellcode = metaSploit_LB.SelectedItem; displayPayload(shellcode); payloads_LB.SelectedIndex = -1; } private void displayPayload(object shellcode) { shellcode_RTB.Clear(); payload = shellcode as GrayStorm.dataBox; if (shellcode is GrayStorm.dataBox) { if (disassemble_CB.Checked) { beaEngine.disassemble disasm = new beaEngine.disassemble(); unsafe { //Prevent garbage collector from relocating a movable variable for the duration of the disassembly and get the IntPtr of a byte array. fixed (byte* pointer = payload.data) { IntPtr offset = (IntPtr)pointer; disasm.disassembler(payload.data, this.shellcode_RTB, offset); } } } else { foreach (byte opcode in payload.data) { shellcode_RTB.AppendText(String.Format("0x{0:X2}\n", opcode)); } } } } #endregion listBox selecting #region inject shellcode private void fireShellcode_BT_Click(object sender, EventArgs e) { if (metaSploit_LB.SelectedIndex != -1 || payloads_LB.SelectedIndex != -1) { GrayStorm.assemblyHelpers.holder = payload.data; } else return; int containedIndex = methodHelpers.containedInList(GrayStorm.domainTraverser.currentMethod); if (containedIndex == -1) return; methodHelpers.StorageInformationArrayList[containedIndex].dumped = false; if (hookMethod_CB.Checked && IntPtr.Size == 4) hookTargetMethod(containedIndex); else if (hookMethod_CB.Checked && IntPtr.Size == 8) hookTargetMethod64(containedIndex); else { try { DialogResult dialogResult = DialogResult.Yes; if (payload.data.Length >= methodHelpers.StorageInformationArrayList[containedIndex].oldMethod.Length) { dialogResult = MessageBox.Show("Length of shellcode is longer than the origional memory... Continue?", "Warning", MessageBoxButtons.YesNo); } if (dialogResult == DialogResult.Yes) { methodHijacking.writeAMethod(methodHelpers.StorageInformationArrayList[containedIndex].methodIntPtr); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } } } private void hookTargetMethod(int containedIndex) { int indexToStartCleaning = payload.indexToStartCleaning; //payload cannot be used with this attack chain if there is no proper index to store reset assembly. if (indexToStartCleaning == 0) { System.Windows.Forms.MessageBox.Show("Payload doesn't support hooking"); return; } MethodInfo safeCall = typeof(shellcode).GetMethod("returnOldMethod", BindingFlags.Public | BindingFlags.Static); IntPtr safeCallPtr = (IntPtr)safeCall.MethodHandle.GetFunctionPointer().ToInt64(); CToAsmAttackChain.payloadCleaner(containedIndex, safeCallPtr, indexToStartCleaning); IntPtr payloadAddress = assemblyHelpers.VirtualAlloc(GrayStorm.assemblyHelpers.holder); System.Runtime.InteropServices.Marshal.Copy(GrayStorm.assemblyHelpers.holder, 0, payloadAddress, GrayStorm.assemblyHelpers.holder.Length); byte[] newMemory = CToAsmAttackChain.newPrelude(payloadAddress); GrayStorm.assemblyHelpers.holder = newMemory; methodHijacking.writeAMethod(methodHelpers.StorageInformationArrayList[containedIndex].methodIntPtr); } //method called in the hook phase of the CToAsmAttack cycle. public static void returnOldMethod(int somePtr, int selectedIndex) { GrayStorm.assemblyHelpers.holder = methodHelpers.StorageInformationArrayList[selectedIndex].oldMethod; methodHijacking.writeAMethod(methodHelpers.StorageInformationArrayList[selectedIndex].methodIntPtr); try { methodHelpers.StorageInformationArrayList[selectedIndex].methodDelegate.DynamicInvoke(null, new object[] { }); } catch { } } //TODO private void hookTargetMethod64(int containedIndex) { //int indexToStartCleaning = payload.indexToStartCleaning; ////payload cannot be used with this attack chain if there is no proper index to store reset assembly. //if (indexToStartCleaning == 0) //{ // System.Windows.Forms.MessageBox.Show("Payload doesn't support hooking"); // return; //} //MethodInfo safeCall = typeof(shellcodeGUI).GetMethod("returnOldMethod", BindingFlags.NonPublic | BindingFlags.Instance); //IntPtr safeCallPtr = (IntPtr)safeCall.MethodHandle.GetFunctionPointer().ToInt64(); //CToAsmAttackChain.payloadCleaner64(containedIndex, safeCallPtr, indexToStartCleaning); //IntPtr payloadAddress = assemblyHelpers.VirtualAlloc(memoryHijacker.assemblyHelpers.holder); //System.Runtime.InteropServices.Marshal.Copy(memoryHijacker.assemblyHelpers.holder, 0, payloadAddress, memoryHijacker.assemblyHelpers.holder.Length); //byte[] newMemory = CToAsmAttackChain.newPrelude64(payloadAddress); //GrayStorm.assemblyHelpers.holder = newMemory; //methodHijacking.writeAMethod(methodHelpers.StorageInformationArrayList[containedIndex].methodIntPtr); } #endregion inject shellcode #region restore code private void restoreCode_BT_Click(object sender, EventArgs e) { int containedIndex = GrayStorm.methodHelpers.containedInList(domainTraverser.currentMethod); if (containedIndex == -1) return; try { GrayStorm.assemblyHelpers.holder = methodHelpers.StorageInformationArrayList[containedIndex].oldMethod; methodHijacking.writeAMethod(methodHelpers.StorageInformationArrayList[containedIndex].methodIntPtr); methodHelpers.StorageInformationArrayList[containedIndex].dumped = false; } catch { } } #endregion restore code #region newShellcode private void createShellcode_BT_Click(object sender, EventArgs e) { byte[] shellcode; string insertedShellcode = createShellcode_RTB.Text; bool metaSploit = false; int offset = 0; shellcode_RTB.Clear(); insertedShellcode = insertedShellcode.Replace("\\x", string.Empty); insertedShellcode = insertedShellcode.Replace("0x", string.Empty); insertedShellcode = insertedShellcode.Replace(", ", string.Empty); insertedShellcode = insertedShellcode.Replace("\n", string.Empty); insertedShellcode = System.Text.RegularExpressions.Regex.Replace(insertedShellcode, @"\W+", ""); shellcode = new byte[insertedShellcode.Length]; try { for (int i = 0; i < insertedShellcode.Length; i += 2) shellcode[i / 2] = Convert.ToByte(insertedShellcode.Substring(i, 2), 16); if (payloads_LB.SelectedIndex == -1 && metaSploit_LB.SelectedIndex == -1) return; else if (payloads_LB.SelectedIndex == -1) metaSploit = true; else metaSploit = false; //remove those tailing 0's int lastIndex = Array.FindLastIndex(shellcode, b => b != 0); Array.Resize(ref shellcode, lastIndex + 1); } catch { shellcode_RTB.AppendText("Invalid shellcode detected. Only use shellcode in the form of \n\"\\x##\" \n\"0x##\" \n##\n Shellcode must have 0x##, assembler does not support 0x# operands"); return; } try { offset = Convert.ToInt32(hookOffset_TB.Text); } catch { shellcode_RTB.AppendText("Payload hook offset not in the correct format.\n Please make it a value. -1 means there is none"); return; } dataBox newPayload = new dataBox(payloadName_TB.Text, shellcode, offset); if (metaSploit) { metaSploit_LB.Items.Add(newPayload); } else payloads_LB.Items.Add(newPayload); } #endregion newShellcode } }
41.189922
202
0.590007
[ "MIT" ]
GrayKernel/GrayStorm
GUI/shellcode.cs
10,629
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Euler.Problems { public class euler7 : problem { public euler7() { int primeCount = 0; int i = 0; while(primeCount <= 10001) { if (isPrime(i)) { primeCount++; } i++; } Console.WriteLine(i-1); } /* Function to check wether number is prime */ private bool isPrime(long number) { if (number == 1) return false; if (number == 2) return true; var boundary = (int)Math.Floor(Math.Sqrt(number)); for (int i = 2; i <= boundary; ++i) { if (number % i == 0) return false; } return true; } } }
15.044444
53
0.595273
[ "MIT" ]
Mastermindzh/c-sharp-testing-ground
c#/Euler/src/Euler/Problems/euler7.cs
679
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> //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Ler_Nomes_Notas")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("Ler_Nomes_Notas")] [assembly: System.Reflection.AssemblyTitleAttribute("Ler_Nomes_Notas")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] // Generated by the MSBuild WriteCodeFragment class.
41.458333
80
0.652261
[ "MIT" ]
Cicerofer/Udemy_Poo_Projetos_CSharp
Ler_Nomes_Notas/Ler_Nomes_Notas/obj/Debug/netcoreapp3.1/Ler_Nomes_Notas.AssemblyInfo.cs
995
C#
using FluentHub.Helpers; using FluentHub.Octokit.Queries.Repositories; using FluentHub.ViewModels.Repositories; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace FluentHub.ViewModels.UserControls.Blocks { public class FileContentBlockViewModel : INotifyPropertyChanged { private CommonRepoViewModel commonRepoViewModel; public CommonRepoViewModel CommonRepoViewModel { get => commonRepoViewModel; set => SetProperty(ref commonRepoViewModel, value); } private string blobContent; public string BlobContent { get => blobContent; set => SetProperty(ref blobContent, value); } private string formattedFileDetails; public string FormattedFileDetails { get => formattedFileDetails; set => SetProperty(ref formattedFileDetails, value); } private string formattedFileSize; public string FormattedFileSize { get => formattedFileSize; set => SetProperty(ref formattedFileSize, value); } private string lineText; public string LineText { get => lineText; set => SetProperty(ref lineText, value); } public async Task GetFileContent() { BlobQueries queries = new(); var content = await queries.Get( CommonRepoViewModel.Name, CommonRepoViewModel.Owner, CommonRepoViewModel.BranchName, CommonRepoViewModel.Path); BlobContent = content.Item1; var lines = BlobDetailsHelpers.GetBlobActualLines(ref content.Item1); var sloc = BlobDetailsHelpers.GetBlobSloc(ref content.Item1); FormattedFileDetails = $"{lines} lines ({sloc} sloc)"; FormattedFileSize = BlobDetailsHelpers.FormatSize(content.Item2); for (int i = 0; i < lines; i++) { LineText += $"{i}\n"; } LineText += $"{lines}"; } public event PropertyChangedEventHandler PropertyChanged; protected bool SetProperty<T>(ref T field, T newValue, [CallerMemberName] string propertyName = null) { if (!Equals(field, newValue)) { field = newValue; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); return true; } return false; } } }
34.324324
128
0.63937
[ "MIT" ]
esibruti/FluentHub
src/FluentHub/ViewModels/UserControls/Blocks/FileContentBlockViewModel.cs
2,542
C#
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace Famoser.MassPass.Presentation.UniversalWindows.Pages.ContentPages { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class FolderContentPage : Page { public FolderContentPage() { this.InitializeComponent(); } private void MenuButtonClick(object sender, RoutedEventArgs e) { MySplitView.IsPaneOpen = !MySplitView.IsPaneOpen; } } }
27.916667
94
0.664179
[ "MIT" ]
famoser/MassPass
Famoser.MassPass.Presentation.UniversalWindows/Pages/ContentPages/FolderContentPage.xaml.cs
672
C#
#nullable enable namespace Avalonia.Data.Core { interface ITransformNode { object? Transform(object? value); } }
13.5
41
0.651852
[ "MIT" ]
jairbubbles/Avalonia
src/Avalonia.Base/Data/Core/ITransformNode.cs
137
C#
using AutoMapper; using LinqKit; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; using TestCase.DataAccess.Contracts; using TestCase.DataAccess.Entities.Locking; using TestCase.Model.Locking; using TestCase.Repository.Locking.Contracts; namespace TestCase.Repository.Locking { /// <summary> /// Lock repository. /// </summary> /// <seealso cref="TestCase.Repository.Locking.Contracts.ILockRepository" /> public class LockRepository : ILockRepository { private readonly IGenericRepository<LockEntity> genericLockRepository; private readonly IGenericRepository<LockLocationEntity> genericLockLocationRepository; private readonly IGenericRepository<LockPermissionPolicyEntity> genericLockPermissionPolicyRepository; private readonly IMapper mapper; /// <summary> /// Initializes a new instance of the <see cref="LockRepository" /> class. /// </summary> /// <param name="genericLockRepository">The generic lock repository.</param> /// <param name="genericLockLocationRepository">The generic lock location repository.</param> /// <param name="genericLockPermissionPolicyRepository">The generic lock permission policy repository.</param> /// <param name="mapper">The mapper.</param> public LockRepository( IGenericRepository<LockEntity> genericLockRepository, IGenericRepository<LockLocationEntity> genericLockLocationRepository, IGenericRepository<LockPermissionPolicyEntity> genericLockPermissionPolicyRepository, IMapper mapper) { this.genericLockRepository = genericLockRepository; this.genericLockLocationRepository = genericLockLocationRepository; this.genericLockPermissionPolicyRepository = genericLockPermissionPolicyRepository; this.mapper = mapper; } /// <summary> /// Asynchronously gets the lock. /// </summary> /// <param name="lockId">The lock identifier.</param> /// <returns></returns> public async Task<Lock> GetLockAsync(Guid lockId) { var query = await this.genericLockRepository.FindAsync(); query = query .Include(p => p.Location) .Include(p => p.Events) .Include(p => p.Events.Select(e => e.LockEventType)); query = query.Where(p => p.Id == lockId); var entity = await query.SingleOrDefaultAsync(); return this.mapper.Map<Lock>(entity); } /// <summary> /// Asynchronously inserts the lock. /// </summary> /// <param name="lock">The lock.</param> /// <returns></returns> public Task InsertLockAsync(Lock @lock) { if (@lock == null) throw new ArgumentNullException(nameof(@lock)); var entity = this.mapper.Map<LockEntity>(@lock); return this.genericLockRepository.InsertAsync(entity); } /// <summary> /// Asynchronously inserts the lock location. /// </summary> /// <param name="lockLocation">The lock location.</param> /// <returns></returns> public Task InsertLockLocationAsync(LockLocation lockLocation) { if (lockLocation == null) throw new ArgumentNullException(nameof(lockLocation)); var entity = this.mapper.Map<LockLocationEntity>(lockLocation); return this.genericLockLocationRepository.InsertAsync(entity); } /// <summary> /// Asynchronously inserts the lock permission policy. /// </summary> /// <param name="lockPermissionPolicy">The lock permission policy.</param> /// <returns></returns> public Task InsertLockPermissionPolicyAsync(LockPermissionPolicy lockPermissionPolicy) { if (lockPermissionPolicy == null) throw new ArgumentNullException(nameof(lockPermissionPolicy)); var entity = this.mapper.Map<LockPermissionPolicyEntity>(lockPermissionPolicy); return this.genericLockPermissionPolicyRepository.InsertAsync(entity); } /// <summary> /// Asynchronously finds the lock permission policies. /// </summary> /// <param name="lockId">The lock identifier.</param> /// <param name="permissionId">The permission identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="roleIds">The role ids.</param> /// <returns></returns> public async Task<IEnumerable<LockPermissionPolicy>> FindLockPermissionPoliciesAsync(Guid lockId, Guid permissionId, Guid userId, params Guid[] roleIds) { var query = await this.genericLockPermissionPolicyRepository.FindAsync(); var predicate = PredicateBuilder.New<LockPermissionPolicyEntity>(pp => pp.LockId == lockId && pp.PermissionId == permissionId); var innerPredicate = PredicateBuilder.New<LockPermissionPolicyEntity>(pp => pp.UserId.HasValue && pp.UserId.Value.Equals(userId)); innerPredicate.Or(pp => pp.RoleId.HasValue && roleIds.Contains(pp.RoleId.Value)); predicate.And(innerPredicate); var policies = await query.Where(predicate).ToListAsync(); return this.mapper.Map<IEnumerable<LockPermissionPolicy>>(policies); } /// <summary> /// Asynchronously updates the lock. /// </summary> /// <param name="lock">The lock.</param> /// <returns></returns> public Task UpdateLockAsync(Lock @lock) { if (@lock == null) throw new ArgumentNullException(nameof(@lock)); var entity = this.mapper.Map<LockEntity>(@lock); return this.genericLockRepository.UpdateAsync(entity); } /// <summary> /// Asynchronously deletes the lock permission. /// </summary> /// <param name="lockPermissionId">The lock permission identifier.</param> /// <returns></returns> public Task DeleteLockPermissionAsync(Guid lockPermissionId) { return this.genericLockPermissionPolicyRepository.DeleteAsync(lockPermissionId); } /// <summary> /// Asynchronously gets the lock permission. /// </summary> /// <param name="lockPermissionId">The lock permission identifier.</param> /// <returns></returns> public async Task<LockPermissionPolicy> GetLockPermissionAsync(Guid lockPermissionId) { var entity = await this.genericLockPermissionPolicyRepository.GetAsync(lockPermissionId); return this.mapper.Map<LockPermissionPolicyEntity, LockPermissionPolicy>(entity); } } }
42.8
161
0.633532
[ "MIT" ]
darjanbogdan/test-case
src/TestCase.Repository/Locking/LockRepository.cs
7,064
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; namespace ArtShop.Web.Models.ManageViewModels { public class ExternalLoginsViewModel { public IList<UserLoginInfo> CurrentLogins { get; set; } public IList<AuthenticationScheme> OtherLogins { get; set; } public bool ShowRemoveButton { get; set; } public string StatusMessage { get; set; } } }
24.714286
68
0.73025
[ "MIT" ]
Rusev12/ArtShop-ASP.NET-Core-MVC
ArtShop.Web/ArtShop.Web/Models/ManageViewModels/ExternalLoginsViewModel.cs
521
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using System.Collections; using System.Globalization; using System.Text; using System.Threading; using System.Runtime.CompilerServices; using Xunit; public class Directory_GetDirectories_str { public static String s_strDtTmVer = "2000/04/27 17:00"; public static String s_strClassMethod = "Directory.GetDirectories()"; public static String s_strTFName = "GetDirectories_str.cs"; public static String s_strTFPath = Directory.GetCurrentDirectory(); [Fact] public static void runTest() { int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; String strValue = String.Empty; try { ///////////////////////// START TESTS //////////////////////////// /////////////////////////////////////////////////////////////////// DirectoryInfo dir2; String dirName = "GetDirectories_str_TestDir"; DirectoryInfo[] dirArr; if (Directory.Exists(dirName)) Directory.Delete(dirName, true); // [] Should throw ArgumentNullException for null argument //----------------------------------------------------------------- strLoc = "Loc_477g8"; iCountTestcases++; try { Directory.GetDirectories(null); iCountErrors++; printerr("Error_2988b! Expected exception not thrown"); } catch (ArgumentNullException) { } catch (Exception exc) { iCountErrors++; printerr("Error_0707t! Incorrect exception thrown, exc==" + exc.ToString()); } //----------------------------------------------------------------- // [] ArgumentException for String.Empty //----------------------------------------------------------------- strLoc = "Loc_4yg7b"; iCountTestcases++; try { Directory.GetDirectories(String.Empty); iCountErrors++; printerr("Error_8ytbm! Expected exception not thrown"); } catch (ArgumentException) { } catch (Exception exc) { iCountErrors++; printerr("Error_2908y! Incorrect exception thrown, exc==" + exc.ToString()); } //----------------------------------------------------------------- // [] ArgumentException for invalid path //----------------------------------------------------------------- strLoc = "Loc_1190x"; iCountTestcases++; try { Directory.GetDirectories("\0"); iCountErrors++; printerr("Error_2198y! Expected exception not thrown"); } catch (ArgumentException) { } catch (Exception exc) { iCountErrors++; printerr("Error_17888! Incorrect exception thrown, exc==" + exc.ToString()); } //----------------------------------------------------------------- // [] Should return zero length array for an empty directory //----------------------------------------------------------------- strLoc = "Loc_4y982"; dir2 = Directory.CreateDirectory(dirName); dirArr = dir2.GetDirectories(); iCountTestcases++; if (dirArr.Length != 0) { iCountErrors++; printerr("Error_207v7! Incorrect number of directories returned"); } //----------------------------------------------------------------- // [] Create a directorystructure and check it //----------------------------------------------------------------- strLoc = "Loc_2398c"; dir2.CreateSubdirectory("TestDir1"); dir2.CreateSubdirectory("TestDir2"); dir2.CreateSubdirectory("TestDir3"); dir2.CreateSubdirectory("Test1Dir1"); dir2.CreateSubdirectory("Test1Dir2"); new FileInfo(dir2.ToString() + "TestFile1"); new FileInfo(dir2.ToString() + "TestFile2"); // [] Searchstring ending with '*' iCountTestcases++; dirArr = dir2.GetDirectories("TestDir*"); iCountTestcases++; if (dirArr.Length != 3) { iCountErrors++; printerr("Error_1yt75! Incorrect number of directories returned"); } String[] names = new String[3]; int i = 0; foreach (DirectoryInfo d in dirArr) names[i++] = d.Name; iCountTestcases++; if (Array.IndexOf(names, "TestDir1") < 0) { iCountErrors++; printerr("Error_3y775! Incorrect name==" + dirArr[0].Name); } iCountTestcases++; if (Array.IndexOf(names, "TestDir2") < 0) { iCountErrors++; printerr("Error_90885! Incorrect name==" + dirArr[1].Name); } iCountTestcases++; if (Array.IndexOf(names, "TestDir3") < 0) { iCountErrors++; printerr("Error_879by! Incorrect name==" + dirArr[2].Name); } // [] Searchstring is '*' dirArr = dir2.GetDirectories("*"); iCountTestcases++; if (dirArr.Length != 5) { iCountErrors++; printerr("Error_t5792! Incorrect number of directories==" + dirArr.Length); } names = new String[5]; i = 0; foreach (DirectoryInfo d in dirArr) names[i++] = d.Name; iCountTestcases++; if (Array.IndexOf(names, "Test1Dir1") < 0) { iCountErrors++; printerr("Error_4898v! Incorrect name==" + dirArr[0].Name); } iCountTestcases++; if (Array.IndexOf(names, "Test1Dir2") < 0) { iCountErrors++; printerr("Error_4598c! Incorrect name==" + dirArr[1].Name); } iCountTestcases++; if (Array.IndexOf(names, "TestDir1") < 0) { iCountErrors++; printerr("Error_209d8! Incorrect name==" + dirArr[2].Name); } iCountTestcases++; if (Array.IndexOf(names, "TestDir2") < 0) { iCountErrors++; printerr("Error_10vtu! Incorrect name==" + dirArr[3].Name); } iCountTestcases++; if (Array.IndexOf(names, "TestDir3") < 0) { iCountErrors++; printerr("Error_190vh! Incorrect name==" + dirArr[4].Name); } // [] Searchstring starting with '*' dirArr = dir2.GetDirectories("*Dir2"); iCountTestcases++; if (dirArr.Length != 2) { iCountErrors++; printerr("Error_8019x! Incorrect number of directories==" + dirArr.Length); } names = new String[2]; i = 0; foreach (DirectoryInfo d in dirArr) names[i++] = d.Name; iCountTestcases++; if (Array.IndexOf(names, "Test1Dir2") < 0) { iCountErrors++; printerr("Error_167yb! Incorrect name==" + dirArr[0].Name); } iCountTestcases++; if (Array.IndexOf(names, "TestDir2") < 0) { iCountErrors++; printerr("Error_49yb7! Incorrect name==" + dirArr[1].Name); } // [] Exact match strLoc = "Loc_fy87e"; dirArr = dir2.GetDirectories("Test1Dir2"); iCountTestcases++; if (dirArr.Length != 1) { iCountErrors++; printerr("Error_2398v! Incorrect number of directories returned, expected==1, got==" + dirArr.Length); } iCountTestcases++; if (!dirArr[0].Name.Equals("Test1Dir2")) { iCountErrors++; printerr("Error_88gbb! Incorrect directory returned==" + dirArr[0]); } // [] Multiple wildcards strLoc = "Loc_48yg7"; dirArr = dir2.GetDirectories("T*st*D*2"); iCountTestcases++; if (dirArr.Length != 2) { iCountErrors++; printerr("Error_39g8b! Incorrect number of directories returned, expected==2, got==" + dirArr.Length); } // [] Searchstring starting and ending with '*' // [] Search is case insensitive dir2.CreateSubdirectory("AAABB"); dir2.CreateSubdirectory("aaabbcc"); dirArr = dir2.GetDirectories("*BB*"); iCountTestcases++; if (dirArr.Length != (Interop.IsLinux ? 1 : 2)) // Linux is case-sensitive { iCountErrors++; printerr("Error_4y190! Incorrect number of directories==" + dirArr.Length); } names = new String[2]; i = 0; foreach (DirectoryInfo d in dirArr) names[i++] = d.Name; iCountTestcases++; if (Array.IndexOf(names, "AAABB") < 0) { iCountErrors++; printerr("Error_956yb! Incorrect name==" + dirArr[0]); } if (!Interop.IsLinux) // linux is case-sensitive { iCountTestcases++; if (Array.IndexOf(names, "aaabbcc") < 0) { iCountErrors++; printerr("Error_48yg7! Incorrect name==" + dirArr[1]); } } // [] Should not search on fullpath // [] No match should return zero length array dirArr = dir2.GetDirectories("Directory"); iCountTestcases++; if (dirArr.Length != 0) { iCountErrors++; printerr("Error_209v7! Incorrect number of directories==" + dirArr.Length); } //----------------------------------------------------------------- if (Directory.Exists(dirName)) Directory.Delete(dirName, true); /////////////////////////////////////////////////////////////////// /////////////////////////// END TESTS ///////////////////////////// } catch (Exception exc_general) { ++iCountErrors; Console.WriteLine(s_strTFName + " : Error Err_8888yyy! strLoc==" + strLoc + ", exc_general==" + exc_general.ToString()); } //// Finish Diagnostics if (iCountErrors != 0) { Console.WriteLine("FAiL! " + s_strTFName + " ,iCountErrors==" + iCountErrors.ToString()); } Assert.Equal(iCountErrors, 0); } public static void printerr(String err, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) { Console.WriteLine("ERROR: ({0}, {1}, {2}) {3}", memberName, filePath, lineNumber, err); } }
33.532578
164
0.451212
[ "MIT" ]
ProgramFOX/corefx
src/System.IO.FileSystem/tests/Directory/GetDirectories_str.cs
11,839
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.WebSockets; using System.Reflection; using System.Text.Json; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Remora.Commands.Extensions; using Remora.Commands.Tokenization; using Remora.Discord.API.Abstractions.Gateway.Commands; using Remora.Discord.API.Abstractions.Objects; using Remora.Discord.Caching.Services; using Remora.Discord.Commands.Conditions; using Remora.Discord.Commands.Extensions; using Remora.Discord.Commands.Services; using Remora.Discord.Gateway; using Remora.Discord.Gateway.Extensions; using Remora.Discord.Gateway.Services; using Remora.Discord.Gateway.Transport; using Remora.Discord.Interactivity.Extensions; using Remora.Discord.Pagination; using Remora.Discord.Pagination.Extensions; using Remora.Discord.Rest.Extensions; using Remora.Extensions.Options.Immutable; using Remora.Plugins.Services; using Remora.Rest.Core; using Remora.Results; using Serilog; using Serilog.Events; using Serilog.Templates; using Silk.Commands.Conditions; using Silk.Extensions; using Silk.Extensions.Remora; using Silk.Infrastructure; using Silk.Interactivity; using Silk.Services.Bot; using Silk.Services.Bot.Help; using Silk.Shared; using Silk.Shared.Configuration; using Silk.Shared.Constants; using Silk.Utilities.HelpFormatter; using Silk.Utilities.HttpClient; using VTP.Remora.Commands.HelpSystem; namespace Silk.Utilities; public static class IServiceCollectionExtensions { public static IHostBuilder AddRemoraHosting(this IHostBuilder hostBuilder) { hostBuilder.ConfigureServices ( serviceCollection => { // Add REST and tack on our own policy serviceCollection .AddDiscordRest(s => s.Get<IConfiguration>()!.GetSilkConfigurationOptions().Discord.BotToken, b => b.AddPolicyHandler(PollyMetricsHandler.Create())); serviceCollection.TryAddSingleton<Random>(); serviceCollection.TryAddSingleton<ResponderDispatchService>(); serviceCollection.TryAddSingleton<IResponderTypeRepository>(s => s.GetRequiredService<IOptions<ResponderService>>().Value); serviceCollection.TryAddSingleton<DiscordGatewayClient>(); serviceCollection.TryAddTransient<ClientWebSocket>(); serviceCollection.TryAddTransient<IPayloadTransportService>(s => new WebSocketPayloadTransportService ( s, s.GetRequiredService<IOptionsMonitor<JsonSerializerOptions>>().Get("Discord"), s.GetRequiredService<ILogger<WebSocketPayloadTransportService>>() )); serviceCollection.AddDiscordGateway(s => s.GetService<IOptions<SilkConfigurationOptions>>()!.Value.Discord.BotToken); serviceCollection.AddSingleton<ShardAwareGateweayHelper>(); serviceCollection.AddHostedService(s => s.GetRequiredService<ShardAwareGateweayHelper>()); } ); return hostBuilder; } public static IServiceCollection AddRemoraServices(this IServiceCollection services) { var asm = Assembly.GetEntryAssembly()!; services .AddResponders(asm) .AddInteractivity() .AddInteractiveEntity<ReminderModalHandler>() .AddInteractiveEntity<JoinEmbedButtonHandler>() .AddInteractiveEntity<MemberScanButtonHandler>() .AddPagination() .AddSilkInteractivity(); services .AddCondition<RequireBotDiscordPermissionsCondition>() .AddCondition<NonSelfActionableCondition>() .AddCondition<RequireNSFWCondition>(); services .AddDiscordCommands(true) .AddSlashCommands(asm) .AddHelpSystem() .AddScoped<ICommandPrefixMatcher, SilkPrefixMatcher>() .AddScoped<ITreeNameResolver, SilkTreeNameResolver>(); services //.AddPostExecutionEvent<FailedCommandResponder>() .AddCommands(asm) // Register types .AddCommands() .AddPostExecutionEvent<PostCommandHandler>() .AddPostExecutionEvent<CommandMetricsHandler>(); // Register commands //.Replace(ServiceDescriptor.Scoped<CommandResponder>(s => s.GetRequiredService<SilkCommandResponder>())); services.AddParser<EmojiParser>() .AddParser<MessageParser>(); services.AddPostExecutionEvent<AfterSlashHandler>(); services .AddSingleton<IShardIdentification>(s => s.GetRequiredService<IOptions<DiscordGatewayClientOptions>>().Value.ShardIdentification!) .Configure<HelpSystemOptions>(hso => hso.CommandCategories.AddRange(Categories.Order)) .Configure<PaginatedAppearanceOptions>(pap => pap with { HelpText = "Use the buttons to navigate and the close button to stop."}) .Configure<DiscordGatewayClientOptions>(gw => { gw.Intents |= GatewayIntents.GuildMembers | GatewayIntents.DirectMessages | GatewayIntents.MessageContents; }) .Configure<CacheSettings>(cs => { cs .SetDefaultAbsoluteExpiration(TimeSpan.Zero) .SetDefaultSlidingExpiration(null) .SetAbsoluteExpiration<IReadOnlyList<Snowflake>>(null) .SetAbsoluteExpiration<IGuildMember>(TimeSpan.FromDays(1)) .SetAbsoluteExpiration<IReadOnlyList<IRole>>(TimeSpan.FromMinutes(30)) .SetAbsoluteExpiration<IChannel>(null) .SetAbsoluteExpiration<IMessage>(null) .SetAbsoluteExpiration<IGuild>(null) .SetAbsoluteExpiration<IUser>(TimeSpan.FromDays(7)); }) .Configure<TokenizerOptions>(t => t with { RetainQuotationMarks = true, IgnoreEmptyValues = false }); return services; } public static IHostBuilder AddPlugins(this IHostBuilder hostBuilder) { Directory.CreateDirectory("./plugins"); // In case it doesn't exist. return hostBuilder.ConfigureServices((_, services) => { var pluginOptions = new PluginServiceOptions(new[] { "./plugins" }, false); var pluginService = new PluginService(Options.Create(pluginOptions)); var tree = pluginService.LoadPluginTree(); services .AddSingleton(tree) .AddSingleton(pluginService) .AddHostedService<PluginInitializerService>(); var configResult = tree.ConfigureServices(services); if (!configResult.IsSuccess) { Log.Logger.Error("Plugin configuration failed: {@Error}", ((AggregateError)configResult.Error) .Errors.Select(err => err.Error!.Message + "\n")); } }); } public static IServiceCollection AddSilkLogging(this IServiceCollection services, IConfiguration configuration) { var config = configuration.GetSilkConfigurationOptions(); LoggerConfiguration logger = new LoggerConfiguration() .Enrich.FromLogContext() .WriteTo.Sentry() .WriteTo.Console(new ExpressionTemplate(StringConstants.LogFormat, theme: SilkLogTheme.TemplateTheme)) .WriteTo.File("./logs/silkLog.log", LogEventLevel.Verbose, StringConstants.FileLogFormat, retainedFileCountLimit: null, rollingInterval: RollingInterval.Day, flushToDiskInterval: TimeSpan.FromMinutes(1)) .MinimumLevel.Override("Microsoft", LogEventLevel.Error) .MinimumLevel.Override("Remora", LogEventLevel.Information) .MinimumLevel.Override("System.Net", LogEventLevel.Fatal); Log.Logger = config.LogLevel switch { "All" => logger.MinimumLevel.Verbose().CreateLogger(), "Info" => logger.MinimumLevel.Information().CreateLogger(), "Debug" => logger.MinimumLevel.Debug().CreateLogger(), "Warning" => logger.MinimumLevel.Warning().CreateLogger(), "Error" => logger.MinimumLevel.Error().CreateLogger(), "Panic" => logger.MinimumLevel.Fatal().CreateLogger(), _ => logger.MinimumLevel.Verbose().CreateLogger() }; return services.AddLogging(l => l.ClearProviders().AddSerilog()); } public static IServiceCollection AddHelpSystem(this IServiceCollection services, string? treeName = null, bool addHelpCommand = true) { services.Configure<HelpSystemOptions>(o => o.TreeName = treeName); if (addHelpCommand) { services .AddDiscordCommands() .AddCommandTree(treeName) .WithCommandGroup<HelpCommand>() .Finish(); } services.TryAddScoped<TreeWalker>(); services.TryAddScoped<IHelpFormatter, DefaultHelpFormatter>(); services.TryAddScoped<ICommandHelpService, CommandHelpService>(); return services; } }
42.493506
239
0.643847
[ "Apache-2.0" ]
VelvetThePanda/SilkBot
src/Silk/Utilities/IServiceCollectionExtensions.cs
9,816
C#
using System; using System.Collections.Generic; using UnityEditor; namespace Obi { [InitializeOnLoad] public class ObiOniInitialize { private static BuildTargetGroup[] supportedBuildTargetGroups = { BuildTargetGroup.Standalone, BuildTargetGroup.Android, BuildTargetGroup.iOS }; static ObiOniInitialize() { foreach(var group in supportedBuildTargetGroups) { var defines = GetDefinesList(group); if (!defines.Contains("OBI_ONI_SUPPORTED")) { defines.Add("OBI_ONI_SUPPORTED"); PlayerSettings.SetScriptingDefineSymbolsForGroup(group, string.Join(";", defines.ToArray())); } } } private static List<string> GetDefinesList(BuildTargetGroup group) { return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';')); } } }
27.972973
113
0.578744
[ "Apache-2.0" ]
Kasunay/Venomx
Assets/Obi/Editor/Common/ObiOniInitialize.cs
1,037
C#
using System.ComponentModel.DataAnnotations; namespace yzn.Users.Dto { public class ChangeUserLanguageDto { [Required] public string LanguageName { get; set; } } }
19.2
48
0.677083
[ "MIT" ]
sesamefly/abp
aspnet-core/src/yzn.Application/Users/Dto/ChangeUserLanguageDto.cs
192
C#