content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://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. // Generated code. DO NOT EDIT! namespace Google.Cloud.Osconfig.V1Beta.Snippets { using Google.Api.Gax.ResourceNames; using Google.Cloud.Osconfig.V1Beta; using System.Threading.Tasks; public sealed partial class GeneratedOsConfigServiceClientStandaloneSnippets { /// <summary>Snippet for CreateGuestPolicyAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateGuestPolicyRequestObjectAsync() { // Create client OsConfigServiceClient osConfigServiceClient = await OsConfigServiceClient.CreateAsync(); // Initialize request argument(s) CreateGuestPolicyRequest request = new CreateGuestPolicyRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), GuestPolicyId = "", GuestPolicy = new GuestPolicy(), }; // Make the request GuestPolicy response = await osConfigServiceClient.CreateGuestPolicyAsync(request); } } }
39.282609
100
0.6829
[ "Apache-2.0" ]
googleapis/googleapis-gen
google/cloud/osconfig/v1beta/google-cloud-osconfig-v1beta-csharp/Google.Cloud.Osconfig.V1Beta.StandaloneSnippets/OsConfigServiceClient.CreateGuestPolicyRequestObjectAsyncSnippet.g.cs
1,807
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Data.SqlClient; namespace BzLoans { class SqlCustomerRepository : RepositoryInterface { public List<Customer> All() { SqlCommand cmd = new SqlCommand("SELECT * FROM main.customers", Program.Connection); List<Customer> output = new List<Customer>(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Customer customer = new Customer(); customer.Id = (Int32) reader[0]; output.Add(customer); } reader.Close(); return output; } } }
24.935484
96
0.587322
[ "MIT" ]
biler/bzloans
BzLoans/SqlCustomerRepository.cs
775
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.Functions.Models.Api20190801 { using static Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.Extensions; /// <summary>Static Site Function Overview ARM resource.</summary> public partial class StaticSiteFunctionOverviewArmResource : Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResource, Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.IValidates { /// <summary> /// Backing field for Inherited model <see cref= "Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResource" /// /> /// </summary> private Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResource __proxyOnlyResource = new Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.ProxyOnlyResource(); /// <summary>The name for the function</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Inlined)] public string FunctionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourcePropertiesInternal)Property).FunctionName; } /// <summary>Resource Id.</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Inherited)] public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Id; } /// <summary>Kind of resource.</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Inherited)] public string Kind { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Kind; set => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Kind = value ?? null; } /// <summary>Internal Acessors for Id</summary> string Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Id = value; } /// <summary>Internal Acessors for Name</summary> string Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Name = value; } /// <summary>Internal Acessors for Type</summary> string Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Type = value; } /// <summary>Internal Acessors for FunctionName</summary> string Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceInternal.FunctionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourcePropertiesInternal)Property).FunctionName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourcePropertiesInternal)Property).FunctionName = value; } /// <summary>Internal Acessors for Property</summary> Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceProperties Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.StaticSiteFunctionOverviewArmResourceProperties()); set { {_property = value;} } } /// <summary>Internal Acessors for TriggerType</summary> Microsoft.Azure.PowerShell.Cmdlets.Functions.Support.TriggerTypes? Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceInternal.TriggerType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourcePropertiesInternal)Property).TriggerType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourcePropertiesInternal)Property).TriggerType = value; } /// <summary>Resource Name.</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Inherited)] public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Name; } /// <summary>Backing field for <see cref="Property" /> property.</summary> private Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceProperties _property; /// <summary>StaticSiteFunctionOverviewARMResource resource specific properties</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Owned)] internal Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.StaticSiteFunctionOverviewArmResourceProperties()); set => this._property = value; } /// <summary>The trigger type of the function</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Inlined)] public Microsoft.Azure.PowerShell.Cmdlets.Functions.Support.TriggerTypes? TriggerType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourcePropertiesInternal)Property).TriggerType; } /// <summary>Resource type.</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Origin(Microsoft.Azure.PowerShell.Cmdlets.Functions.PropertyOrigin.Inherited)] public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal)__proxyOnlyResource).Type; } /// <summary>Creates an new <see cref="StaticSiteFunctionOverviewArmResource" /> instance.</summary> public StaticSiteFunctionOverviewArmResource() { } /// <summary>Validates that this object meets the validation criteria.</summary> /// <param name="eventListener">an <see cref="Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.IEventListener" /> instance that will receive validation /// events.</param> /// <returns> /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. /// </returns> public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.IEventListener eventListener) { await eventListener.AssertNotNull(nameof(__proxyOnlyResource), __proxyOnlyResource); await eventListener.AssertObjectIsValid(nameof(__proxyOnlyResource), __proxyOnlyResource); } } /// Static Site Function Overview ARM resource. public partial interface IStaticSiteFunctionOverviewArmResource : Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.IJsonSerializable, Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResource { /// <summary>The name for the function</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.Info( Required = false, ReadOnly = true, Description = @"The name for the function", SerializedName = @"functionName", PossibleTypes = new [] { typeof(string) })] string FunctionName { get; } /// <summary>The trigger type of the function</summary> [Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.Info( Required = false, ReadOnly = true, Description = @"The trigger type of the function", SerializedName = @"triggerType", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Functions.Support.TriggerTypes) })] Microsoft.Azure.PowerShell.Cmdlets.Functions.Support.TriggerTypes? TriggerType { get; } } /// Static Site Function Overview ARM resource. internal partial interface IStaticSiteFunctionOverviewArmResourceInternal : Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IProxyOnlyResourceInternal { /// <summary>The name for the function</summary> string FunctionName { get; set; } /// <summary>StaticSiteFunctionOverviewARMResource resource specific properties</summary> Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.Api20190801.IStaticSiteFunctionOverviewArmResourceProperties Property { get; set; } /// <summary>The trigger type of the function</summary> Microsoft.Azure.PowerShell.Cmdlets.Functions.Support.TriggerTypes? TriggerType { get; set; } } }
83.685484
516
0.763419
[ "MIT" ]
Agazoth/azure-powershell
src/Functions/generated/api/Models/Api20190801/StaticSiteFunctionOverviewArmResource.cs
10,254
C#
using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using Eto.Drawing; using Eto.Forms; using Eto.GtkSharp.Drawing; namespace Eto.GtkSharp.Forms { class NotificationWrapper : GLib.Object { #if !GTK2 public delegate void ClosedHandler(object o, EventArgs args); public event ClosedHandler Closed { add { this.AddSignalHandler("closed", value, typeof(EventArgs)); } remove { this.RemoveSignalHandler("closed", value); } } #endif public NotificationWrapper(IntPtr handle) : base(handle) { } } public class LinuxNotificationHandler : WidgetHandler<IntPtr, Notification, Notification.ICallback>, Notification.IHandler { private const string libnotify = "libnotify.so.4"; [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static bool notify_init(string app_name); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static void notify_uninit(); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static IntPtr notify_get_server_caps(); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static IntPtr notify_notification_new(string summary, string body, string icon); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static IntPtr notify_notification_update(IntPtr notification, string summary, string body, string icon); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static bool notify_notification_show(IntPtr notification, IntPtr error); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static void notify_notification_add_action(IntPtr notification, string action, string label, Delegate callback, IntPtr user_data, IntPtr free_func); [DllImport(libnotify, CallingConvention = CallingConvention.Cdecl)] protected extern static void notify_notification_clear_actions(IntPtr notification); private static bool init; private static bool allowactions; private static MethodInfo activatedmethod; public static void Init() { try { notify_init(Assembly.GetExecutingAssembly().FullName); var list = new GLib.List(notify_get_server_caps(), typeof(string)); foreach (var item in list) { if (item.ToString() == "actions") { allowactions = true; break; } } var methods = typeof(LinuxNotificationHandler).GetMethods(BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic); foreach(var m in methods) { if (m.Name == "Activated") { activatedmethod = m; break; } } init = true; } catch { Console.WriteLine("Error, libnotify.so.4 was not found, notifications won't be displayed."); init = false; } } public static void DeInit() { if (init) notify_uninit(); } Image _contentImage; string iconPath; public string Title { get; set; } public bool RequiresTrayIndicator { get { return false; } } public string Message { get; set; } public string UserData { get; set; } public Image ContentImage { get { return _contentImage; } set { _contentImage = value; var pb = _contentImage.ToGdk(); if (pb != null) { if (iconPath == null) { iconPath = Path.GetTempFileName(); ApplicationHandler.TempFiles.Add(iconPath); } pb.Save(iconPath, "png"); } else if (iconPath != null) { if (File.Exists(iconPath)) File.Delete(iconPath); ApplicationHandler.TempFiles.Remove(iconPath); iconPath = null; } } } public void Show(TrayIndicator indicator = null) { if (!init) return; // Empty string will show the default icon, while an incorrect one will show no icon var notification = new NotificationWrapper(notify_notification_new(Title, Message, iconPath ?? "???")); var data = Marshal.StringToHGlobalUni(ID + (char)1 + UserData); #if !GTK2 notification.Closed += (sender, e) => { Marshal.FreeHGlobal(data); notification.Dispose(); }; #endif if (allowactions) { // Undocumented AFAIK: If action is "default" it will not create a button. notify_notification_add_action( notification.Handle, "default", "default", Delegate.CreateDelegate(typeof(ActivatedDelegate), activatedmethod), data, IntPtr.Zero ); } notify_notification_show(notification.Handle, IntPtr.Zero); } private delegate void ActivatedDelegate(IntPtr notification, IntPtr action, IntPtr user_data); private static void Activated(IntPtr notification, IntPtr action, IntPtr user_data) { var data = Marshal.PtrToStringUni(user_data).Split((char)1); var app = ApplicationHandler.Instance; app?.Callback.OnNotificationActivated(app.Widget, new NotificationEventArgs(data[0], data[1])); } } }
26.609375
167
0.695244
[ "BSD-3-Clause" ]
745564106/Eto
src/Eto.Gtk/Forms/LinuxNotificationHandler.cs
5,111
C#
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Core.Common.Reflect; namespace Core.Identification { public delegate void SetIdentity<TId, T>(T item, TId id); public delegate TId GetIdentity<TId, T>(T item); public class DelegateIdentityAccessor< T,TId> : IIdentityAccessor<T, TId> { public DelegateIdentityAccessor(GetIdentity<TId, T> get, SetIdentity<TId, T> set) { this.Getter = get; this.Setter = set; } protected DelegateIdentityAccessor() { } public SetIdentity<TId, T> Setter { get; protected set; } public GetIdentity<TId, T> Getter { get; protected set; } public TId GetIdentity(T item) { return Getter(item); } public void SetIdentity(T item, TId id) { Setter(item, id); } } public class PropertyIdentityAccessor<T,TId> : IIdentityAccessor< T,TId> { public PropertyIdentityAccessor(PropertyInfo property) { if (!typeof(T).IsAssignableFrom(property.DeclaringType)) throw new ArgumentException("property must be a property of T "); if (typeof(TId) != property.PropertyType) throw new ArgumentException("property's type must be of TId"); Property = property; } public TId GetIdentity(T item) { return (TId)Property.GetValue(item); } public void SetIdentity(T item, TId id) { Property.SetValue(item, id); } public PropertyInfo Property { get; private set; } } public class IdentifiableIdentityAccessor<TId, T> : IIdentityAccessor<T, TId> where T : IIdentityAssignable<TId> { public TId GetIdentity(T item) { return item.Id; } public void SetIdentity(T item, TId id) { item.Id = id; } } }
23.636364
128
0.667582
[ "MIT" ]
toeb/core.common
Core.Common/Identification/IIdentifiableIdentityAccessor.cs
1,822
C#
using CarDealer.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CarDealer.Data.Config { public class SaleConfig : IEntityTypeConfiguration<Sale> { public void Configure(EntityTypeBuilder<Sale> builder) { builder .HasKey(x => x.SaleId); builder .HasOne(x => x.Car) .WithMany(x => x.Sales) .HasForeignKey(x => x.CarId); builder .HasOne(x => x.Customer) .WithMany(x => x.Sales) .HasForeignKey(x => x.CustomerId); } } }
25.615385
62
0.545045
[ "MIT" ]
DimchoLakov/CSharp-Databases-Fundamentals
02.C# Databases - Advanced/10.XML-Processing/CarDealer/CarDealer.Data/Config/SaleConfig.cs
668
C#
using System; class AccountBalance { static void Main() { int transactionNum = int.Parse(Console.ReadLine()); int transactionCounter = 0; double balance = 0.0; while (transactionCounter < transactionNum) { double amounPaid = double.Parse(Console.ReadLine()); if (amounPaid < 0) { Console.WriteLine("Invalid operation!"); break; } balance = balance + amounPaid; Console.WriteLine($"Increase: {amounPaid:F2}"); ++transactionCounter; } Console.WriteLine($"Total: {balance:F2}"); } }
25.653846
64
0.530735
[ "MIT" ]
galin-kostadinov/Software-Engineering
C#/Programming Basics with C#/08. While-Loop/06. Account BalanceII/AccountBalanceII.cs
669
C#
using chocolatey.infrastructure.logging; using logtesting; using NUnit.Framework; using System; using System.Security.Cryptography; namespace chocolatey.tests2 { [Parallelizable(ParallelScope.All)] public class Logging: LogTesting { [LogTest] public void Multiline() { LogService.console.Info("line1\nline2"); LogService.console.Info("line3\rline4"); LogService.console.Info("line5\r\nline6"); LogService.console.Info(""); LogService.console.Info("line7"); } } }
24.875
55
0.61139
[ "Apache-2.0" ]
tapika/choco
src/chocolatey.tests2/Logging/Logging.cs
599
C#
// Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information using Elastic.Elasticsearch.Xunit.XunitPlumbing; using FluentAssertions; using Nest; using Tests.Core.Extensions; namespace Tests.ClientConcepts.HighLevel.Inference.Equality { public class LongIdEqualityTests { [U] public void Eq() { LongId types = 2; LongId[] equal = { 2L, 2 }; foreach (var t in equal) { (t == types).ShouldBeTrue(t); t.Should().Be(types); } LongId l1 = 2, l2 = 2; (l1 == l2).ShouldBeTrue(l2); (l1 == 2).ShouldBeTrue(l1); l1.Should().Be(l2); l1.Should().Be(2); } [U] public void NotEq() { LongId types = 3; LongId[] notEqual = { 4L, 4 }; foreach (var t in notEqual) { (t != types).ShouldBeTrue(t); t.Should().NotBe(types); } LongId l1 = 2, l2 = 3; (l1 != l2).ShouldBeTrue(l2); (l1 != 3).ShouldBeTrue(l1); l1.Should().NotBe(l2); l1.Should().NotBe(3); } [U] public void Null() { LongId c = 10; (c == null).Should().BeFalse(); (null == c).Should().BeFalse(); } } }
21.763636
76
0.616541
[ "Apache-2.0" ]
Atharvpatel21/elasticsearch-net
tests/Tests/ClientConcepts/HighLevel/Inference/Equality/LongIdEqualityTests.cs
1,197
C#
namespace MassTransit.Serialization.JsonConverters { using System; using System.Collections.Generic; using System.Reflection; using Internals.Extensions; using Newtonsoft.Json; public class CaseInsensitiveDictionaryJsonConverter : BaseJsonConverter { public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotSupportedException("This converter should not be used for writing as it can create loops"); } protected override IConverter ValueFactory(Type objectType) { if (CanConvert(objectType, out _, out var valueType) && valueType == typeof(object)) return (IConverter)Activator.CreateInstance(typeof(CachedConverter<>).MakeGenericType(valueType)); return new Unsupported(); } static bool CanConvert(Type objectType, out Type keyType, out Type valueType) { var typeInfo = objectType.GetTypeInfo(); if (typeInfo.IsGenericType) { if (typeInfo.ClosesType(typeof(IDictionary<,>), out Type[] elementTypes) || typeInfo.ClosesType(typeof(IReadOnlyDictionary<,>), out elementTypes) || typeInfo.ClosesType(typeof(Dictionary<,>), out elementTypes) || typeInfo.ClosesType(typeof(IEnumerable<>), out Type[] enumerableType) && enumerableType[0].ClosesType(typeof(KeyValuePair<,>), out elementTypes)) { keyType = elementTypes[0]; valueType = elementTypes[1]; if (keyType != typeof(string)) return false; if (typeInfo.IsFSharpType()) return false; return true; } } keyType = default; valueType = default; return false; } class CachedConverter<T> : IConverter { object IConverter.Deserialize(JsonReader reader, Type objectType, JsonSerializer serializer) { if (reader.TokenType == JsonToken.StartObject) { object result = new CaseInsensitiveDictionary<T>(); serializer.Populate(reader, result); return result; } return null; } public bool IsSupported => true; } } }
33.051948
116
0.557957
[ "ECL-2.0", "Apache-2.0" ]
Aerodynamite/MassTrans
src/MassTransit/Serialization/JsonConverters/CaseInsensitiveDictionaryJsonConverter.cs
2,545
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MySql.Data.MySqlClient; using EOM_auth; using EOM_stores; using EOM_stores._contr.__; using System.Data; namespace EOM_stores.dataChannel { class _sinCtrlChannel { private _ctrlChannel ced = new _ctrlChannel(); private string _dedicator { get; set; } private string CollectVodka(string ra1,string ra2) { string ge1, rahoul; ge1 = "select Max(";rahoul = ") from"; _dedicator = ge1 + ra1 + rahoul + ra2; return _dedicator; } //protected string CollectVodka(string ra1, string ra2, string ra3, string ra4, string ra5) //{ // string ge1, rahoul, raina; // ge1 = "select"; rahoul = "from"; raina = "where"; // _dedicator = ge1 + ra1 + // return _dedicator; //} public DataTable storeData(string element,string direction) { _ctrlChannel.InitializeDb(); MySqlCommand Transmeter = new MySqlCommand { CommandType = CommandType.Text, CommandText = CollectVodka(element,direction), Connection = _ctrlChannel.dbcon }; MySqlDataAdapter massenger = new MySqlDataAdapter(Transmeter); DataTable _mainContainer = new DataTable(); massenger.Fill(_mainContainer); _ctrlChannel.dbcon.Clone(); //int xdv = _mainContainer.Rows[0].Field<int>(); return _mainContainer; } } }
29.508772
100
0.577883
[ "CC0-1.0" ]
Sam-Rex/Interwood
EOM_stores/dataChannel/_sinCtrlChannel.cs
1,684
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace SPD.GUI { /// <summary> /// /// </summary> public partial class PrintHtml : Form { /// <summary> /// /// </summary> public PrintHtml() { InitializeComponent(); } /// <summary> /// /// </summary> public WebBrowser PrintWebBrowser { get { return this.webBrowser1; } } private void buttonPrint_Click(object sender, EventArgs e) { this.webBrowser1.ShowPrintDialog(); } private void buttonClose_Click(object sender, EventArgs e) { this.Close(); } private void PrintHtml_Resize(object sender, EventArgs e) { this.webBrowser1.Width = this.Width - 12; this.webBrowser1.Height = this.Height - 70; this.buttonPrint.Location = new System.Drawing.Point(0, this.Height - 62); this.buttonClose.Location = new System.Drawing.Point(82, this.Height - 62); } private void PrintHtml_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 0x1b) { this.Close(); } } } }
27
88
0.542735
[ "CC0-1.0" ]
tgassner/SPDPatientDocumentation
SPDGUI/PrintHtml.cs
1,406
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using MonoMac.Foundation; using MonoMac.AppKit; namespace macdoc { public partial class AppleDocMergeWindowController : MonoMac.AppKit.NSWindowController { public AppleDocMergeWindowController (IntPtr handle) : base (handle) { Initialize (); } [Export ("initWithCoder:")] public AppleDocMergeWindowController (NSCoder coder) : base (coder) { Initialize (); } public AppleDocMergeWindowController () : base ("AppleDocMergeWindow") { Initialize (); } void Initialize () { } public override void WindowDidLoad () { ProgressWidget.StartAnimation (this); } public void TrackProcessTask (Task<int> task) { task.ContinueWith (t => { var faulted = t.IsFaulted; if (faulted) Logger.LogError ("Merger exception", t.Exception); BeginInvokeOnMainThread (() => Finish (faulted || t.Result > 0, faulted ? 99 : t.Result)); }); } void Finish (bool errored, int code) { ProgressWidget.Hidden = true; WizardButton.Hidden = false; if (errored) { WizardText.StringValue = string.Format ("There was a problem running the update (code {0}).", code); WizardButton.Title = "Close"; WizardButton.Activated += CloseCallback; } else { WizardText.StringValue = "Update successful. Restart MacDoc for changes to take effect."; WizardButton.Title = "Restart MacDoc"; WizardButton.Activated += RestartCallback; } } void CloseCallback (object sender, EventArgs e) { Close (); } void RestartCallback (object sender, EventArgs e) { AppDelegate.RestartRequested = true; NSApplication.SharedApplication.Terminate (this); } public new AppleDocMergeWindow Window { get { return (AppleDocMergeWindow)base.Window; } } } }
21.764706
104
0.691351
[ "MIT" ]
Devolutions/monomac
samples/macdoc/AppleDocMergeWindowController.cs
1,850
C#
// Copyright (c) 2022 AccelByte Inc. All Rights Reserved. // This is licensed software from AccelByte Inc, for limitations // and restrictions contact your company contract manager. // This code is generated by tool. DO NOT EDIT. using AccelByte.Sdk.Api.Social.Model; using AccelByte.Sdk.Api.Social.Operation; using AccelByte.Sdk.Core; namespace AccelByte.Sdk.Api.Social.Wrapper { public class SlotConfig { private readonly AccelByteSDK _sdk; public SlotConfig(AccelByteSDK sdk) { _sdk = sdk; } #region Operation Builders public GetNamespaceSlotConfig.GetNamespaceSlotConfigBuilder GetNamespaceSlotConfigOp { get { return Operation.GetNamespaceSlotConfig.Builder.SetWrapperObject(this); } } public UpdateNamespaceSlotConfig.UpdateNamespaceSlotConfigBuilder UpdateNamespaceSlotConfigOp { get { return Operation.UpdateNamespaceSlotConfig.Builder.SetWrapperObject(this); } } public DeleteNamespaceSlotConfig.DeleteNamespaceSlotConfigBuilder DeleteNamespaceSlotConfigOp { get { return Operation.DeleteNamespaceSlotConfig.Builder.SetWrapperObject(this); } } public GetUserSlotConfig.GetUserSlotConfigBuilder GetUserSlotConfigOp { get { return Operation.GetUserSlotConfig.Builder.SetWrapperObject(this); } } public UpdateUserSlotConfig.UpdateUserSlotConfigBuilder UpdateUserSlotConfigOp { get { return Operation.UpdateUserSlotConfig.Builder.SetWrapperObject(this); } } public DeleteUserSlotConfig.DeleteUserSlotConfigBuilder DeleteUserSlotConfigOp { get { return Operation.DeleteUserSlotConfig.Builder.SetWrapperObject(this); } } #endregion public Model.NamespaceSlotConfigInfo? GetNamespaceSlotConfig(GetNamespaceSlotConfig input) { var response = _sdk.RunRequest(input); return input.ParseResponse( response.Code, response.ContentType, response.Payload); } public Model.NamespaceSlotConfigInfo? UpdateNamespaceSlotConfig(UpdateNamespaceSlotConfig input) { var response = _sdk.RunRequest(input); return input.ParseResponse( response.Code, response.ContentType, response.Payload); } public void DeleteNamespaceSlotConfig(DeleteNamespaceSlotConfig input) { var response = _sdk.RunRequest(input); input.ParseResponse( response.Code, response.ContentType, response.Payload); } public Model.UserSlotConfigInfo? GetUserSlotConfig(GetUserSlotConfig input) { var response = _sdk.RunRequest(input); return input.ParseResponse( response.Code, response.ContentType, response.Payload); } public Model.UserSlotConfigInfo? UpdateUserSlotConfig(UpdateUserSlotConfig input) { var response = _sdk.RunRequest(input); return input.ParseResponse( response.Code, response.ContentType, response.Payload); } public void DeleteUserSlotConfig(DeleteUserSlotConfig input) { var response = _sdk.RunRequest(input); input.ParseResponse( response.Code, response.ContentType, response.Payload); } } }
37.907216
106
0.631221
[ "MIT" ]
AccelByte/accelbyte-csharp-sdk
AccelByte.Sdk/Api/Social/Wrapper/SlotConfig.cs
3,677
C#
namespace Masodik { partial class Form1 { /// <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.BetuTipus = new System.Windows.Forms.GroupBox(); this.BetuMeret = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.Felkover = new System.Windows.Forms.CheckBox(); this.Dolt = new System.Windows.Forms.CheckBox(); this.Alahuzott = new System.Windows.Forms.CheckBox(); this.Athuzott = new System.Windows.Forms.CheckBox(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton5 = new System.Windows.Forms.RadioButton(); this.radioButton6 = new System.Windows.Forms.RadioButton(); this.panel1 = new System.Windows.Forms.Panel(); this.PirosGomb = new System.Windows.Forms.RadioButton(); this.KekGomb = new System.Windows.Forms.RadioButton(); this.FeketeGomb = new System.Windows.Forms.RadioButton(); this.hScrollBar1 = new System.Windows.Forms.HScrollBar(); this.hScrollBar2 = new System.Windows.Forms.HScrollBar(); this.hScrollBar3 = new System.Windows.Forms.HScrollBar(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.panel2 = new System.Windows.Forms.Panel(); this.BetuTipus.SuspendLayout(); this.BetuMeret.SuspendLayout(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // BetuTipus // this.BetuTipus.Controls.Add(this.Athuzott); this.BetuTipus.Controls.Add(this.Alahuzott); this.BetuTipus.Controls.Add(this.Dolt); this.BetuTipus.Controls.Add(this.Felkover); this.BetuTipus.Location = new System.Drawing.Point(421, 12); this.BetuTipus.Name = "BetuTipus"; this.BetuTipus.Size = new System.Drawing.Size(200, 175); this.BetuTipus.TabIndex = 0; this.BetuTipus.TabStop = false; this.BetuTipus.Text = "Betűtípus"; // // BetuMeret // this.BetuMeret.Controls.Add(this.radioButton6); this.BetuMeret.Controls.Add(this.radioButton5); this.BetuMeret.Controls.Add(this.radioButton4); this.BetuMeret.Controls.Add(this.radioButton3); this.BetuMeret.Controls.Add(this.radioButton2); this.BetuMeret.Controls.Add(this.radioButton1); this.BetuMeret.Location = new System.Drawing.Point(22, 75); this.BetuMeret.Name = "BetuMeret"; this.BetuMeret.Size = new System.Drawing.Size(137, 112); this.BetuMeret.TabIndex = 1; this.BetuMeret.TabStop = false; this.BetuMeret.Text = "Betűméret"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(54, 31); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(28, 13); this.label1.TabIndex = 2; this.label1.Text = "Fúró"; // // Felkover // this.Felkover.AutoSize = true; this.Felkover.Location = new System.Drawing.Point(17, 20); this.Felkover.Name = "Felkover"; this.Felkover.Size = new System.Drawing.Size(67, 17); this.Felkover.TabIndex = 0; this.Felkover.Text = "Félkövér"; this.Felkover.UseVisualStyleBackColor = true; // // Dolt // this.Dolt.AutoSize = true; this.Dolt.Location = new System.Drawing.Point(17, 56); this.Dolt.Name = "Dolt"; this.Dolt.Size = new System.Drawing.Size(45, 17); this.Dolt.TabIndex = 1; this.Dolt.Text = "Dőlt"; this.Dolt.UseVisualStyleBackColor = true; // // Alahuzott // this.Alahuzott.AutoSize = true; this.Alahuzott.Location = new System.Drawing.Point(17, 99); this.Alahuzott.Name = "Alahuzott"; this.Alahuzott.Size = new System.Drawing.Size(70, 17); this.Alahuzott.TabIndex = 2; this.Alahuzott.Text = "Aláhúzott"; this.Alahuzott.UseVisualStyleBackColor = true; // // Athuzott // this.Athuzott.AutoSize = true; this.Athuzott.Location = new System.Drawing.Point(17, 144); this.Athuzott.Name = "Athuzott"; this.Athuzott.Size = new System.Drawing.Size(65, 17); this.Athuzott.TabIndex = 3; this.Athuzott.Text = "Áthúzott"; this.Athuzott.UseVisualStyleBackColor = true; // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.Location = new System.Drawing.Point(24, 34); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(37, 17); this.radioButton1.TabIndex = 0; this.radioButton1.TabStop = true; this.radioButton1.Text = "10"; this.radioButton1.UseVisualStyleBackColor = true; // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.Location = new System.Drawing.Point(77, 34); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(37, 17); this.radioButton2.TabIndex = 1; this.radioButton2.TabStop = true; this.radioButton2.Text = "11"; this.radioButton2.UseVisualStyleBackColor = true; // // radioButton3 // this.radioButton3.AutoSize = true; this.radioButton3.Location = new System.Drawing.Point(24, 57); this.radioButton3.Name = "radioButton3"; this.radioButton3.Size = new System.Drawing.Size(37, 17); this.radioButton3.TabIndex = 2; this.radioButton3.TabStop = true; this.radioButton3.Text = "12"; this.radioButton3.UseVisualStyleBackColor = true; // // radioButton4 // this.radioButton4.AutoSize = true; this.radioButton4.Location = new System.Drawing.Point(77, 57); this.radioButton4.Name = "radioButton4"; this.radioButton4.Size = new System.Drawing.Size(37, 17); this.radioButton4.TabIndex = 3; this.radioButton4.TabStop = true; this.radioButton4.Text = "14"; this.radioButton4.UseVisualStyleBackColor = true; // // radioButton5 // this.radioButton5.AutoSize = true; this.radioButton5.Location = new System.Drawing.Point(24, 80); this.radioButton5.Name = "radioButton5"; this.radioButton5.Size = new System.Drawing.Size(37, 17); this.radioButton5.TabIndex = 4; this.radioButton5.TabStop = true; this.radioButton5.Text = "16"; this.radioButton5.UseVisualStyleBackColor = true; // // radioButton6 // this.radioButton6.AutoSize = true; this.radioButton6.Location = new System.Drawing.Point(77, 80); this.radioButton6.Name = "radioButton6"; this.radioButton6.Size = new System.Drawing.Size(37, 17); this.radioButton6.TabIndex = 5; this.radioButton6.TabStop = true; this.radioButton6.Text = "18"; this.radioButton6.UseVisualStyleBackColor = true; // // panel1 // this.panel1.Controls.Add(this.FeketeGomb); this.panel1.Controls.Add(this.KekGomb); this.panel1.Controls.Add(this.PirosGomb); this.panel1.Location = new System.Drawing.Point(165, 31); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(200, 100); this.panel1.TabIndex = 3; // // PirosGomb // this.PirosGomb.AutoSize = true; this.PirosGomb.Location = new System.Drawing.Point(22, 12); this.PirosGomb.Name = "PirosGomb"; this.PirosGomb.Size = new System.Drawing.Size(48, 17); this.PirosGomb.TabIndex = 0; this.PirosGomb.TabStop = true; this.PirosGomb.Text = "Piros"; this.PirosGomb.UseVisualStyleBackColor = true; // // KekGomb // this.KekGomb.AutoSize = true; this.KekGomb.Location = new System.Drawing.Point(22, 35); this.KekGomb.Name = "KekGomb"; this.KekGomb.Size = new System.Drawing.Size(44, 17); this.KekGomb.TabIndex = 1; this.KekGomb.TabStop = true; this.KekGomb.Text = "Kék"; this.KekGomb.UseVisualStyleBackColor = true; // // FeketeGomb // this.FeketeGomb.AutoSize = true; this.FeketeGomb.Location = new System.Drawing.Point(22, 69); this.FeketeGomb.Name = "FeketeGomb"; this.FeketeGomb.Size = new System.Drawing.Size(58, 17); this.FeketeGomb.TabIndex = 2; this.FeketeGomb.TabStop = true; this.FeketeGomb.Text = "Fekete"; this.FeketeGomb.UseVisualStyleBackColor = true; // // hScrollBar1 // this.hScrollBar1.Location = new System.Drawing.Point(130, 280); this.hScrollBar1.Maximum = 264; this.hScrollBar1.Name = "hScrollBar1"; this.hScrollBar1.Size = new System.Drawing.Size(115, 17); this.hScrollBar1.TabIndex = 4; this.hScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar1_Scroll); // // hScrollBar2 // this.hScrollBar2.Location = new System.Drawing.Point(130, 313); this.hScrollBar2.Maximum = 264; this.hScrollBar2.Name = "hScrollBar2"; this.hScrollBar2.Size = new System.Drawing.Size(115, 17); this.hScrollBar2.TabIndex = 5; this.hScrollBar2.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar2_Scroll); // // hScrollBar3 // this.hScrollBar3.Location = new System.Drawing.Point(130, 344); this.hScrollBar3.Maximum = 264; this.hScrollBar3.Name = "hScrollBar3"; this.hScrollBar3.Size = new System.Drawing.Size(115, 17); this.hScrollBar3.TabIndex = 6; this.hScrollBar3.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar3_Scroll); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(45, 280); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(18, 13); this.label2.TabIndex = 7; this.label2.Text = "R:"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(45, 313); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(18, 13); this.label3.TabIndex = 8; this.label3.Text = "G:"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(45, 348); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(17, 13); this.label4.TabIndex = 9; this.label4.Text = "B:"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(302, 280); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 10; this.textBox1.Text = "0"; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(302, 313); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(100, 20); this.textBox2.TabIndex = 11; this.textBox2.Text = "0"; this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // textBox3 // this.textBox3.Location = new System.Drawing.Point(302, 344); this.textBox3.Name = "textBox3"; this.textBox3.Size = new System.Drawing.Size(100, 20); this.textBox3.TabIndex = 12; this.textBox3.Text = "0"; this.textBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // panel2 // this.panel2.Location = new System.Drawing.Point(438, 280); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(183, 97); this.panel2.TabIndex = 13; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(642, 506); this.Controls.Add(this.panel2); this.Controls.Add(this.textBox3); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.hScrollBar3); this.Controls.Add(this.hScrollBar2); this.Controls.Add(this.hScrollBar1); this.Controls.Add(this.panel1); this.Controls.Add(this.label1); this.Controls.Add(this.BetuMeret); this.Controls.Add(this.BetuTipus); this.Name = "Form1"; this.Text = "Form1"; this.BetuTipus.ResumeLayout(false); this.BetuTipus.PerformLayout(); this.BetuMeret.ResumeLayout(false); this.BetuMeret.PerformLayout(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox BetuTipus; private System.Windows.Forms.CheckBox Athuzott; private System.Windows.Forms.CheckBox Alahuzott; private System.Windows.Forms.CheckBox Dolt; private System.Windows.Forms.CheckBox Felkover; private System.Windows.Forms.GroupBox BetuMeret; private System.Windows.Forms.RadioButton radioButton6; private System.Windows.Forms.RadioButton radioButton5; private System.Windows.Forms.RadioButton radioButton4; private System.Windows.Forms.RadioButton radioButton3; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.RadioButton FeketeGomb; private System.Windows.Forms.RadioButton KekGomb; private System.Windows.Forms.RadioButton PirosGomb; private System.Windows.Forms.HScrollBar hScrollBar1; private System.Windows.Forms.HScrollBar hScrollBar2; private System.Windows.Forms.HScrollBar hScrollBar3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Panel panel2; } }
44.481297
108
0.57263
[ "MIT" ]
viaxa23/WindowsForm
Masodik/Masodik/Form1.Designer.cs
17,854
C#
using Mods.ModsList; using System.Collections; using System.Collections.Generic; using Upgrade; namespace Ship { namespace FirstEdition.BWing { public class HeraSyndulla : BWing { public HeraSyndulla() : base() { PilotInfo = new PilotCardInfo( "Hera Syndulla", 7, 29, isLimited: true, abilityType: typeof(Abilities.FirstEdition.HeraSyndullaAbility), extraUpgradeIcon: UpgradeType.Talent ); IsHidden = true; ImageUrl = "https://i.imgur.com/L6wpW8S.png"; } } } }
24.033333
84
0.493759
[ "MIT" ]
97saundersj/FlyCasual
Assets/Scripts/Model/Content/FirstEdition/Pilots/BWing/HeraSyndulla.cs
723
C#
// This code is distributed under MIT license. // Copyright (c) 2015 George Mamaladze // See license.txt or http://opensource.org/licenses/mit-license.php using System; using System.ComponentModel; using System.Windows.Forms; using Gma.System.MouseKeyHook; using Gma.System.MouseKeyHook.Implementation; namespace Demo { public partial class Main : Form { private IKeyboardMouseEvents m_Events; public Main() { InitializeComponent(); radioGlobal.Checked = true; SubscribeGlobal(); FormClosing += Main_Closing; } private void Main_Closing(object sender, CancelEventArgs e) { Unsubscribe(); } private void SubscribeApplication() { Unsubscribe(); Subscribe(Hook.AppEvents()); } private void SubscribeGlobal() { Unsubscribe(); Subscribe(Hook.GlobalEvents()); } private void Subscribe(IKeyboardMouseEvents events) { m_Events = events; m_Events.KeyDown += OnKeyDown; m_Events.KeyUp += OnKeyUp; m_Events.KeyPress += HookManager_KeyPress; m_Events.MouseUp += OnMouseUp; m_Events.MouseClick += OnMouseClick; m_Events.MouseDoubleClick += OnMouseDoubleClick; m_Events.MouseMove += HookManager_MouseMove; m_Events.MouseDragStarted += OnMouseDragStarted; m_Events.MouseDragFinished += OnMouseDragFinished; if (checkBoxSupressMouseWheel.Checked) m_Events.MouseWheelExt += HookManager_MouseWheelExt; else m_Events.MouseWheel += HookManager_MouseWheel; if (checkBoxSuppressMouse.Checked) m_Events.MouseDownExt += HookManager_Supress; else m_Events.MouseDown += OnMouseDown; } private void Unsubscribe() { if (m_Events == null) return; m_Events.KeyDown -= OnKeyDown; m_Events.KeyUp -= OnKeyUp; m_Events.KeyPress -= HookManager_KeyPress; m_Events.MouseUp -= OnMouseUp; m_Events.MouseClick -= OnMouseClick; m_Events.MouseDoubleClick -= OnMouseDoubleClick; m_Events.MouseMove -= HookManager_MouseMove; m_Events.MouseDragStarted -= OnMouseDragStarted; m_Events.MouseDragFinished -= OnMouseDragFinished; if (checkBoxSupressMouseWheel.Checked) m_Events.MouseWheelExt -= HookManager_MouseWheelExt; else m_Events.MouseWheel -= HookManager_MouseWheel; if (checkBoxSuppressMouse.Checked) m_Events.MouseDownExt -= HookManager_Supress; else m_Events.MouseDown -= OnMouseDown; m_Events.Dispose(); m_Events = null; } private void HookManager_Supress(object sender, MouseEventExtArgs e) { if (e.Button != MouseButtons.Right) { Log(string.Format("MouseDown \t\t {0}\n", e.Button)); return; } Log(string.Format("MouseDown \t\t {0} Suppressed\n", e.Button)); e.Handled = true; } private void OnKeyDown(object sender, KeyEventArgs e) { Log(string.Format("KeyDown \t\t {0}\n", e.KeyCode)); } private void OnKeyUp(object sender, KeyEventArgs e) { Log(string.Format("KeyUp \t\t {0}\n", e.KeyCode)); } private void HookManager_KeyPress(object sender, KeyPressEventArgs e) { Log(string.Format("KeyPress \t\t {0}\n", e.KeyChar)); } private void HookManager_MouseMove(object sender, MouseEventArgs e) { labelMousePosition.Text = string.Format("x={0:0000}; y={1:0000}", e.X, e.Y); } private void OnMouseDown(object sender, MouseEventArgs e) { Log(string.Format("MouseDown \t\t {0}\n", e.Button)); } private void OnMouseUp(object sender, MouseEventArgs e) { Log(string.Format("MouseUp \t\t {0}\n", e.Button)); } private void OnMouseClick(object sender, MouseEventArgs e) { Log(string.Format("MouseClick \t\t {0}\n", e.Button)); } private void OnMouseDoubleClick(object sender, MouseEventArgs e) { Log(string.Format("MouseDoubleClick \t\t {0}\n", e.Button)); } private void OnMouseDragStarted(object sender, MouseEventArgs e) { Log("MouseDragStarted\n"); } private void OnMouseDragFinished(object sender, MouseEventArgs e) { Log("MouseDragFinished\n"); } private void HookManager_MouseWheel(object sender, MouseEventArgs e) { labelWheel.Text = string.Format("Wheel={0:000}", e.Delta); } private void HookManager_MouseWheelExt(object sender, MouseEventExtArgs e) { labelWheel.Text = string.Format("Wheel={0:000}", e.Delta); Log("Mouse Wheel Move Suppressed.\n"); e.Handled = true; } private void Log(string text) { if (IsDisposed) return; textBoxLog.AppendText(text); textBoxLog.ScrollToCaret(); } private void radioApplication_CheckedChanged(object sender, EventArgs e) { if (((RadioButton) sender).Checked) SubscribeApplication(); } private void radioGlobal_CheckedChanged(object sender, EventArgs e) { if (((RadioButton) sender).Checked) SubscribeGlobal(); } private void radioNone_CheckedChanged(object sender, EventArgs e) { if (((RadioButton) sender).Checked) Unsubscribe(); } private void checkBoxSupressMouseWheel_CheckedChanged(object sender, EventArgs e) { if (m_Events == null) return; if (((CheckBox) sender).Checked) { m_Events.MouseWheel -= HookManager_MouseWheel; m_Events.MouseWheelExt += HookManager_MouseWheelExt; } else { m_Events.MouseWheelExt -= HookManager_MouseWheelExt; m_Events.MouseWheel += HookManager_MouseWheel; } } private void checkBoxSuppressMouse_CheckedChanged(object sender, EventArgs e) { if (m_Events == null) return; if (((CheckBox)sender).Checked) { m_Events.MouseDown -= OnMouseDown; m_Events.MouseDownExt += HookManager_Supress; } else { m_Events.MouseDownExt -= HookManager_Supress; m_Events.MouseDown += OnMouseDown; } } private void clearLog_Click(object sender, EventArgs e) { textBoxLog.Clear(); } } }
30.669528
89
0.56857
[ "BSD-3-Clause" ]
williamhallatt/globalmousekeyhook
Demo/Main.cs
7,148
C#
namespace CodeHollow.FeedReader.Parser { internal static class Factory { public static AbstractXmlFeedParser GetParser(FeedType feedType) { switch (feedType) { case FeedType.Atom: return new AtomParser(); case FeedType.Rss_0_91: return new Rss091Parser(); case FeedType.Rss_0_92: return new Rss092Parser(); case FeedType.Rss_1_0: return new Rss10Parser(); default: return new Rss20Parser(); } } } }
30.666667
72
0.572464
[ "MIT" ]
nieltg/CodeHollow.FeedReader.Core
CodeHollow.FeedReader.Core/Parser/Factory.cs
554
C#
using System; using NetRuntimeSystem = System; using System.ComponentModel; using NetOffice.Attributes; namespace NetOffice.WordApi { /// <summary> /// DispatchInterface EmailOptions /// SupportByVersion Word, 9,10,11,12,14,15,16 /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff194477.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] [EntityType(EntityType.IsDispatchInterface)] [TypeId("000209DB-0000-0000-C000-000000000046")] public interface EmailOptions : ICOMObject { #region Properties /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff197525.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] NetOffice.WordApi.Application Application { get; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff191741.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] Int32 Creator { get; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get /// Unknown COM Proxy /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff840769.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16), ProxyResult] object Parent { get; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff839521.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] bool UseThemeStyle { get; set; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff840320.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] string MarkCommentsWith { get; set; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff821277.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] bool MarkComments { get; set; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff822191.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] NetOffice.WordApi.EmailSignature EmailSignature { get; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff845385.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] NetOffice.WordApi.Style ComposeStyle { get; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff836350.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] NetOffice.WordApi.Style ReplyStyle { get; } /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff840027.aspx </remarks> [SupportByVersion("Word", 9,10,11,12,14,15,16)] string ThemeName { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get /// </summary> [SupportByVersion("Word", 10,11,12,14,15,16)] [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] bool Dummy1 { get; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get /// </summary> [SupportByVersion("Word", 10,11,12,14,15,16)] [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] bool Dummy2 { get; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff840679.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool NewColorOnReply { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff839519.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] NetOffice.WordApi.Style PlainTextStyle { get; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff845433.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool UseThemeStyleOnReply { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff192628.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyHeadings { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff192399.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyBorders { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff837236.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyBulletedLists { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff193750.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyNumberedLists { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff193405.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplaceQuotes { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff838943.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplaceSymbols { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff837891.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplaceOrdinals { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff194415.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplaceFractions { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff193085.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplacePlainTextEmphasis { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff837035.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeFormatListItemBeginning { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff840029.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeDefineStyles { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff823235.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplaceHyperlinks { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff839729.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyTables { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff835434.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyFirstIndents { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff839691.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyDates { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff837002.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeApplyClosings { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff837502.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeMatchParentheses { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff845297.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeReplaceFarEastDashes { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff838514.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeDeleteAutoSpaces { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff840277.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeInsertClosings { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff193845.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeAutoLetterWizard { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff845410.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool AutoFormatAsYouTypeInsertOvers { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff195336.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool RelyOnCSS { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff195303.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] NetOffice.WordApi.Enums.WdEmailHTMLFidelity HTMLFidelity { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> [SupportByVersion("Word", 10,11,12,14,15,16)] bool EmbedSmartTag { get; set; } /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// Get/Set /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff195043.aspx </remarks> [SupportByVersion("Word", 10,11,12,14,15,16)] bool TabIndentKey { get; set; } #endregion #region Methods /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// </summary> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] [SupportByVersion("Word", 10,11,12,14,15,16)] void Dummy3(); #endregion } }
36.19337
106
0.656236
[ "MIT" ]
igoreksiz/NetOffice
Source/Word/DispatchInterfaces/EmailOptions.cs
13,104
C#
using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace TimesheetCollector.Migrations { public partial class Initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "FileUploads", columns: table => new { ID = table.Column<Guid>(type: "uuid", nullable: false), Project = table.Column<string>(type: "text", nullable: false), Bucket = table.Column<string>(type: "text", nullable: false), Object = table.Column<string>(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FileUploads", x => x.ID); }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "FileUploads"); } } }
31.294118
82
0.534774
[ "MIT" ]
Flexba/TimesheetCollector
TimesheetCollector/Migrations/20220110210312_Initial.cs
1,066
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; namespace Microsoft.Extensions.Internal { internal class InternalUsageAnalyzer { private readonly Func<ISymbol, bool> _isInternalNamespace; private readonly Func<ISymbol, bool> _hasInternalAttribute; private readonly DiagnosticDescriptor _descriptor; /// <summary> /// Creates a new instance of <see cref="InternalUsageAnalyzer" />. The creator should provide delegates to help determine whether /// a given symbol is internal or not, and a <see cref="DiagnosticDescriptor" /> to create errors. /// </summary> /// <param name="isInInternalNamespace">The delegate used to check if a symbol belongs to an internal namespace.</param> /// <param name="hasInternalAttribute">The delegate used to check if a symbol has an internal attribute.</param> /// <param name="descriptor"> /// The <see cref="DiagnosticDescriptor" /> used to create errors. The error message should expect a single parameter /// used for the display name of the member. /// </param> public InternalUsageAnalyzer(Func<ISymbol, bool> isInInternalNamespace, Func<ISymbol, bool> hasInternalAttribute, DiagnosticDescriptor descriptor) { _isInternalNamespace = isInInternalNamespace ?? new Func<ISymbol, bool>((_) => false); _hasInternalAttribute = hasInternalAttribute ?? new Func<ISymbol, bool>((_) => false); _descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor)); } public void Register(AnalysisContext context) { context.EnableConcurrentExecution(); // Analyze usage of our internal types in method bodies. context.RegisterOperationAction( AnalyzeOperation, OperationKind.ObjectCreation, OperationKind.Invocation, OperationKind.FieldReference, OperationKind.MethodReference, OperationKind.PropertyReference, OperationKind.EventReference); // Analyze declarations that use our internal types in API surface. context.RegisterSymbolAction( AnalyzeSymbol, SymbolKind.NamedType, SymbolKind.Field, SymbolKind.Method, SymbolKind.Property, SymbolKind.Event); } private void AnalyzeOperation(OperationAnalysisContext context) { var symbol = context.Operation switch { IObjectCreationOperation creation => creation.Constructor, IInvocationOperation invocation => invocation.TargetMethod, IFieldReferenceOperation field => field.Member, IMethodReferenceOperation method => method.Member, IPropertyReferenceOperation property => property.Member, IEventReferenceOperation @event => @event.Member, _ => throw new InvalidOperationException("Unexpected operation kind: " + context.Operation.Kind), }; VisitOperationSymbol(context, symbol); } private void AnalyzeSymbol(SymbolAnalysisContext context) { // Note: we don't currently try to detect second-order usage of these types // like public Task<InternalFoo> GetFooAsync() { }. // // This probably accomplishes our goals OK for now, which are focused on use of these // types in method bodies. switch (context.Symbol) { case INamedTypeSymbol type: VisitDeclarationSymbol(context, type.BaseType, type); foreach (var @interface in type.Interfaces) { VisitDeclarationSymbol(context, @interface, type); } break; case IFieldSymbol field: VisitDeclarationSymbol(context, field.Type, field); break; case IMethodSymbol method: // Ignore return types on property-getters. Those will be reported through // the property analysis. if (method.MethodKind != MethodKind.PropertyGet) { VisitDeclarationSymbol(context, method.ReturnType, method); } // Ignore parameters on property-setters. Those will be reported through // the property analysis. if (method.MethodKind != MethodKind.PropertySet) { foreach (var parameter in method.Parameters) { VisitDeclarationSymbol(context, parameter.Type, method); } } break; case IPropertySymbol property: VisitDeclarationSymbol(context, property.Type, property); break; case IEventSymbol @event: VisitDeclarationSymbol(context, @event.Type, @event); break; } } // Similar logic here to VisitDeclarationSymbol, keep these in sync. private void VisitOperationSymbol(OperationAnalysisContext context, ISymbol symbol) { if (symbol.ContainingAssembly == context.Compilation.Assembly) { // The type is being referenced within the same assembly. This is valid use of an "internal" type return; } if (HasInternalAttribute(symbol)) { context.ReportDiagnostic(Diagnostic.Create( _descriptor, context.Operation.Syntax.GetLocation(), symbol.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat))); return; } var containingType = symbol.ContainingType; if (IsInInternalNamespace(containingType) || HasInternalAttribute(containingType)) { context.ReportDiagnostic(Diagnostic.Create( _descriptor, context.Operation.Syntax.GetLocation(), containingType.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat))); return; } } // Similar logic here to VisitOperationSymbol, keep these in sync. private void VisitDeclarationSymbol(SymbolAnalysisContext context, ISymbol symbol, ISymbol symbolForDiagnostic) { if (symbol.ContainingAssembly == context.Compilation.Assembly) { // This is part of the compilation, avoid this analyzer when building from source. return; } if (HasInternalAttribute(symbol)) { context.ReportDiagnostic(Diagnostic.Create( _descriptor, symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None, symbol.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat))); return; } var containingType = symbol as INamedTypeSymbol ?? symbol.ContainingType; if (IsInInternalNamespace(containingType) || HasInternalAttribute(containingType)) { context.ReportDiagnostic(Diagnostic.Create( _descriptor, symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None, containingType.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat))); return; } } private bool HasInternalAttribute(ISymbol symbol) => _hasInternalAttribute(symbol); private bool IsInInternalNamespace(ISymbol symbol) => _isInternalNamespace(symbol); } }
44.608466
154
0.598387
[ "Apache-2.0" ]
AzureMentor/aspnetcore
src/Components/Analyzers/src/InternalUsageAnalyzer.cs
8,431
C#
using System.Runtime.InteropServices; using ZeroFormatter; namespace Voxels { [ZeroFormattable] [StructLayout(LayoutKind.Sequential)] public struct BlockData { [Index(0)] public BlockType Type; [Index(1)] public byte Subtype; [Index(2)] public byte SunLevel; [Index(3)] public byte LightLevel; [Index(4)] public ushort AddColor; [Index(5)] public ushort Metadata; [IgnoreFormat] public BlockDescription Info { get { return StaticResources.BlocksInfo.GetBlockDescription(Type); } } [IgnoreFormat] public static int StructSize { get { if ( _cachedSize == 0 ) { _cachedSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(BlockData)); } return _cachedSize; } } static int _cachedSize = 0; public BlockData(BlockType type) { Type = type; Subtype = 0; Metadata = 0; SunLevel = 0; LightLevel = 0; AddColor = 65535; } public BlockData(BlockType type, byte subtype) { Type = type; Subtype = subtype; Metadata = 0; SunLevel = 0; LightLevel = 0; AddColor = 65535; } public BlockData(BlockType type, byte subtype, byte sunLevel, byte lightLevel, ushort addColor, ushort metadata) { Type = type; Subtype = subtype; Metadata = metadata; SunLevel = sunLevel; LightLevel = lightLevel; AddColor = addColor; } public static BlockData Empty { get { return new BlockData(BlockType.Air); } } public bool IsEmpty() { return Type == BlockType.Air; } public override bool Equals(object obj) { return base.Equals(obj); } public override int GetHashCode() { return base.GetHashCode(); } public static bool operator ==(BlockData a, BlockData b) { return a.Type == b.Type && a.Subtype == b.Subtype && a.Metadata == b.Metadata && a.AddColor == b.AddColor && a.LightLevel == b.LightLevel && a.SunLevel == b.SunLevel; } public static bool operator !=(BlockData a, BlockData b) { return a.Type != b.Type || a.Subtype != b.Subtype || a.Metadata != b.Metadata || a.AddColor != b.AddColor || a.SunLevel != b.SunLevel || a.LightLevel != b.LightLevel; } } }
23.446809
169
0.641107
[ "MIT" ]
TxN/VoxelLand
Assets/Scripts/VoxelsBase/BlockData.cs
2,204
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // 制御されます。アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更します。 [assembly: AssemblyTitle("IMEChange")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IMEChange")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("3d5614ac-7498-4fdd-a222-7c34e0a63e24")] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // リビジョン // // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
29.189189
56
0.749074
[ "MIT" ]
a01sa01to/IMEChange
IMEChange/Properties/AssemblyInfo.cs
1,689
C#
using System; using System.Collections.Concurrent; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Common; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Threading; using Quantumart.QP8.CodeGeneration.Services; namespace EntityFramework6.Test.DataContext { public class MappingConfigurator : MappingConfiguratorBase { public MappingConfigurator(ContentAccess contentAccess, ISchemaProvider schemaProvider) : base(contentAccess, schemaProvider) { } public override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); #region AfiellFieldsItem mappings modelBuilder.Entity<AfiellFieldsItem>() .ToTable(GetTableName("AfiellFieldsItem")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<AfiellFieldsItem>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.String) .HasColumnName(GetFieldName("AfiellFieldsItem", "String")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Integer) .HasColumnName(GetFieldName("AfiellFieldsItem", "Integer")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Decimal) .HasColumnName(GetFieldName("AfiellFieldsItem", "Decimal")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Boolean) .HasColumnName(GetFieldName("AfiellFieldsItem", "Boolean")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Date) .HasColumnName(GetFieldName("AfiellFieldsItem", "Date")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Time) .HasColumnName(GetFieldName("AfiellFieldsItem", "Time")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.DateTime) .HasColumnName(GetFieldName("AfiellFieldsItem", "DateTime")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.File) .HasColumnName(GetFieldName("AfiellFieldsItem", "File")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Image) .HasColumnName(GetFieldName("AfiellFieldsItem", "Image")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.TextBox) .HasColumnName(GetFieldName("AfiellFieldsItem", "TextBox")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.VisualEdit) .HasColumnName(GetFieldName("AfiellFieldsItem", "VisualEdit")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.DynamicImage) .HasColumnName(GetFieldName("AfiellFieldsItem", "DynamicImage")); modelBuilder.Entity<AfiellFieldsItem>() .Property(x => x.Enum) .HasColumnName(GetFieldName("AfiellFieldsItem", "Enum")); modelBuilder.Entity<AfiellFieldsItem>().Ignore(p => p.FileUrl); modelBuilder.Entity<AfiellFieldsItem>().Ignore(p => p.ImageUrl); modelBuilder.Entity<AfiellFieldsItem>().Ignore(p => p.DynamicImageUrl); modelBuilder.Entity<AfiellFieldsItem>().Ignore(p => p.FileUploadPath); modelBuilder.Entity<AfiellFieldsItem>().Ignore(p => p.ImageUploadPath); #endregion #region Schema mappings modelBuilder.Entity<Schema>() .ToTable(GetTableName("Schema")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<Schema>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<Schema>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<Schema>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region StringItem mappings modelBuilder.Entity<StringItem>() .ToTable(GetTableName("StringItem")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<StringItem>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<StringItem>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<StringItem>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<StringItem>() .Property(x => x.StringValue) .HasColumnName(GetFieldName("StringItem", "StringValue")); #endregion #region StringItemForUpdate mappings modelBuilder.Entity<StringItemForUpdate>() .ToTable(GetTableName("StringItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<StringItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<StringItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<StringItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<StringItemForUpdate>() .Property(x => x.StringValue) .HasColumnName(GetFieldName("StringItemForUpdate", "StringValue")); #endregion #region StringItemForUnsert mappings modelBuilder.Entity<StringItemForUnsert>() .ToTable(GetTableName("StringItemForUnsert")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<StringItemForUnsert>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<StringItemForUnsert>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<StringItemForUnsert>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<StringItemForUnsert>() .Property(x => x.StringValue) .HasColumnName(GetFieldName("StringItemForUnsert", "StringValue")); #endregion #region ItemForUpdate mappings modelBuilder.Entity<ItemForUpdate>() .ToTable(GetTableName("ItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<ItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<ItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<ItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region ItemForInsert mappings modelBuilder.Entity<ItemForInsert>() .ToTable(GetTableName("ItemForInsert")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<ItemForInsert>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<ItemForInsert>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<ItemForInsert>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region PublishedNotPublishedItem mappings modelBuilder.Entity<PublishedNotPublishedItem>() .ToTable(GetTableName("PublishedNotPublishedItem")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<PublishedNotPublishedItem>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<PublishedNotPublishedItem>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<PublishedNotPublishedItem>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region ReplacingPlaceholdersItem mappings modelBuilder.Entity<ReplacingPlaceholdersItem>() .ToTable(GetTableName("ReplacingPlaceholdersItem")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<ReplacingPlaceholdersItem>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<ReplacingPlaceholdersItem>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<ReplacingPlaceholdersItem>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region FileFieldsItem mappings modelBuilder.Entity<FileFieldsItem>() .ToTable(GetTableName("FileFieldsItem")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<FileFieldsItem>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<FileFieldsItem>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<FileFieldsItem>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<FileFieldsItem>().Ignore(p => p.FileItemUrl); modelBuilder.Entity<FileFieldsItem>().Ignore(p => p.FileItemUploadPath); #endregion #region SymmetricRelationArticle mappings modelBuilder.Entity<SymmetricRelationArticle>() .ToTable(GetTableName("SymmetricRelationArticle")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<SymmetricRelationArticle>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<SymmetricRelationArticle>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<SymmetricRelationArticle>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<SymmetricRelationArticle>().HasMany<ToSymmetricRelationAtricle>(p => p.SymmetricRelation).WithMany() .Map(rp => { rp.MapLeftKey("id"); rp.MapRightKey("linked_id"); rp.ToTable(GetLinkTableName("SymmetricRelationArticle", "SymmetricRelation")); }); modelBuilder.Entity<ToSymmetricRelationAtricle>().HasMany<SymmetricRelationArticle>(p => p.BackwardForSymmetricRelation).WithMany() .Map(rp => { rp.MapLeftKey("id"); // !+ rp.MapRightKey("linked_id"); rp.ToTable(GetReversedLinkTableName("SymmetricRelationArticle", "SymmetricRelation")); }); #endregion #region ToSymmetricRelationAtricle mappings modelBuilder.Entity<ToSymmetricRelationAtricle>() .ToTable(GetTableName("ToSymmetricRelationAtricle")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<ToSymmetricRelationAtricle>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<ToSymmetricRelationAtricle>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<ToSymmetricRelationAtricle>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<ToSymmetricRelationAtricle>().HasMany<SymmetricRelationArticle>(p => p.ToSymmetricRelation).WithMany() .Map(rp => { rp.MapLeftKey("id"); rp.MapRightKey("linked_id"); rp.ToTable(GetLinkTableName("ToSymmetricRelationAtricle", "ToSymmetricRelation")); }); modelBuilder.Entity<SymmetricRelationArticle>().HasMany<ToSymmetricRelationAtricle>(p => p.BackwardForToSymmetricRelation).WithMany() .Map(rp => { rp.MapLeftKey("id"); // !+ rp.MapRightKey("linked_id"); rp.ToTable(GetReversedLinkTableName("ToSymmetricRelationAtricle", "ToSymmetricRelation")); }); #endregion #region MtMItemForUpdate mappings modelBuilder.Entity<MtMItemForUpdate>() .ToTable(GetTableName("MtMItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<MtMItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<MtMItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<MtMItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<MtMItemForUpdate>().HasMany<MtMDictionaryForUpdate>(p => p.Reference).WithMany() .Map(rp => { rp.MapLeftKey("id"); rp.MapRightKey("linked_id"); rp.ToTable(GetLinkTableName("MtMItemForUpdate", "Reference")); }); modelBuilder.Entity<MtMDictionaryForUpdate>().HasMany<MtMItemForUpdate>(p => p.BackwardForReference).WithMany() .Map(rp => { rp.MapLeftKey("id"); // !+ rp.MapRightKey("linked_id"); rp.ToTable(GetReversedLinkTableName("MtMItemForUpdate", "Reference")); }); #endregion #region MtMDictionaryForUpdate mappings modelBuilder.Entity<MtMDictionaryForUpdate>() .ToTable(GetTableName("MtMDictionaryForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<MtMDictionaryForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<MtMDictionaryForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<MtMDictionaryForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region OtMItemForUpdate mappings modelBuilder.Entity<OtMItemForUpdate>() .ToTable(GetTableName("OtMItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<OtMItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<OtMItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<OtMItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<OtMItemForUpdate>() .HasOptional<OtMDictionaryForUpdate>(mp => mp.Reference) .WithMany(mp => mp.BackReference) .HasForeignKey(fp => fp.Reference_ID); modelBuilder.Entity<OtMItemForUpdate>() .Property(x => x.Reference_ID) .HasColumnName(GetFieldName("OtMItemForUpdate", "Reference")); #endregion #region OtMDictionaryForUpdate mappings modelBuilder.Entity<OtMDictionaryForUpdate>() .ToTable(GetTableName("OtMDictionaryForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<OtMDictionaryForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<OtMDictionaryForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<OtMDictionaryForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region DateItemForUpdate mappings modelBuilder.Entity<DateItemForUpdate>() .ToTable(GetTableName("DateItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<DateItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<DateItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<DateItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region TimeItemForUpdate mappings modelBuilder.Entity<TimeItemForUpdate>() .ToTable(GetTableName("TimeItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<TimeItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<TimeItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<TimeItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region DateTimeItemForUpdate mappings modelBuilder.Entity<DateTimeItemForUpdate>() .ToTable(GetTableName("DateTimeItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<DateTimeItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<DateTimeItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<DateTimeItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region FileItemForUpdate mappings modelBuilder.Entity<FileItemForUpdate>() .ToTable(GetTableName("FileItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<FileItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<FileItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<FileItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<FileItemForUpdate>().Ignore(p => p.FileValueFieldUrl); modelBuilder.Entity<FileItemForUpdate>().Ignore(p => p.FileValueFieldUploadPath); #endregion #region ImageItemForUpdate mappings modelBuilder.Entity<ImageItemForUpdate>() .ToTable(GetTableName("ImageItemForUpdate")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<ImageItemForUpdate>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<ImageItemForUpdate>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<ImageItemForUpdate>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<ImageItemForUpdate>().Ignore(p => p.ImageValueFieldUrl); modelBuilder.Entity<ImageItemForUpdate>().Ignore(p => p.ImageValueFieldUploadPath); #endregion #region OtMItemForMapping mappings modelBuilder.Entity<OtMItemForMapping>() .ToTable(GetTableName("OtMItemForMapping")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<OtMItemForMapping>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<OtMItemForMapping>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<OtMItemForMapping>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<OtMItemForMapping>() .HasOptional<OtMRelatedItemWithMapping>(mp => mp.OtMReferenceMapping) .WithMany(mp => mp.BackOtMReferenceMapping) .HasForeignKey(fp => fp.OtMReferenceMapping_ID); modelBuilder.Entity<OtMItemForMapping>() .Property(x => x.OtMReferenceMapping_ID) .HasColumnName(GetFieldName("OtMItemForMapping", "OtMReferenceMapping")); #endregion #region OtMRelatedItemWithMapping mappings modelBuilder.Entity<OtMRelatedItemWithMapping>() .ToTable(GetTableName("OtMRelatedItemWithMapping")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<OtMRelatedItemWithMapping>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<OtMRelatedItemWithMapping>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<OtMRelatedItemWithMapping>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); #endregion #region OtMItemToContentWithoutMapping mappings modelBuilder.Entity<OtMItemToContentWithoutMapping>() .ToTable(GetTableName("OtMItemToContentWithoutMapping")) .Property(x => x.Id) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) .HasColumnName("CONTENT_ITEM_ID"); modelBuilder.Entity<OtMItemToContentWithoutMapping>() .Property(x => x.LastModifiedBy) .HasColumnName("LAST_MODIFIED_BY"); modelBuilder.Entity<OtMItemToContentWithoutMapping>() .Property(x => x.StatusTypeId) .HasColumnName("STATUS_TYPE_ID"); modelBuilder.Entity<OtMItemToContentWithoutMapping>() .HasRequired<StatusType>(x => x.StatusType) .WithMany() .HasForeignKey(x => x.StatusTypeId); modelBuilder.Entity<OtMItemToContentWithoutMapping>() .Property(x => x.OtMReferenceMapping_ID) .HasColumnName(GetFieldName("OtMItemToContentWithoutMapping", "OtMReferenceMapping_ID")); #endregion } } }
40.708628
145
0.574268
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
QuantumArt/QP.EntityFramework
EntityFramework6.Test/DataContext/MappingConfigurator.cs
28,781
C#
namespace Reinforced.Tecture.Aspects.DirectSql { /// <summary> /// SQL stroke query helper methods /// </summary> public static class StrokeJoins { /// <summary> /// Instructs nested aggregate of entity to be joined using particular join type /// </summary> /// <param name="entity">Entity table reference</param> /// <param name="joinType">Join type</param> /// <returns>Stroke</returns> public static string JoinedAs(this object entity, Join joinType) { return "what?"; } /// <summary> /// Forces table to be taken as alias, not alias declaration /// </summary> /// <param name="entity">Entity table reference</param> /// <returns>Stroke</returns> public static string Alias(this object entity) { return "what?"; } /// <summary> /// Changes nested aggregate join type /// </summary> /// <param name="type">Join type</param> /// <param name="entity">Nested aggregate (e.g. o.User)</param> /// <returns>Stroke</returns> public static string Overjoin(Join type, object entity) { return "what?"; } } }
31.75
88
0.551969
[ "MIT" ]
AxelUser/Reinforced.Tecture
Aspects/Reinforced.Tecture.Aspects.DirectSql/StrokeJoins.cs
1,272
C#
using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.ServiceModel; namespace Workday.Talent { [GeneratedCode("System.ServiceModel", "4.0.0.0"), EditorBrowsable(EditorBrowsableState.Advanced), DebuggerStepThrough, MessageContract(IsWrapped = false)] public class Manage_Job_HistoryInput { [MessageHeader(Namespace = "urn:com.workday/bsvc")] public Workday_Common_HeaderType Workday_Common_Header; [MessageBodyMember(Namespace = "urn:com.workday/bsvc", Order = 0)] public Manage_Job_History_RequestType Manage_Job_History_Request; public Manage_Job_HistoryInput() { } public Manage_Job_HistoryInput(Workday_Common_HeaderType Workday_Common_Header, Manage_Job_History_RequestType Manage_Job_History_Request) { this.Workday_Common_Header = Workday_Common_Header; this.Manage_Job_History_Request = Manage_Job_History_Request; } } }
31.758621
155
0.81759
[ "MIT" ]
matteofabbri/Workday.WebServices
Workday.Talent/Manage_Job_HistoryInput.cs
921
C#
/* This file is part of pspsharp. pspsharp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. pspsharp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with pspsharp. If not, see <http://www.gnu.org/licenses/>. */ namespace pspsharp.HLE.kernel.types { public class SceNetWlanScanInfo : pspAbstractMemoryMappedStructure { public string bssid; public int channel; public string ssid; public int mode; public int unknown44; protected internal override void read() { bssid = readStringNZ(6); // Offset 0 channel = read8(); // Offset 6 int ssidLength = read8(); // Offset 7 ssid = readStringNZ(ssidLength); // Offset 8 readUnknown(32 - ssidLength); mode = read32(); // Offset 40 unknown44 = read32(); // Offset 44 } protected internal override void write() { writeStringN(6, bssid); // Offset 0 write8((sbyte) channel); // Offset 6 if (string.ReferenceEquals(ssid, null)) { write8((sbyte) 0); // Offset 7 } else { write8((sbyte) ssid.Length); // Offset 7 } writeStringN(32, ssid); // Offset 8 write32(mode); // Offset 40 write32(unknown44); // Offset 44 writeUnknown(44); // Offset 48 } public override int @sizeof() { return 92; } public override string ToString() { return string.Format("bssid='{0}', channel={1:D}, ssid='{2}', mode=0x{3:X}, unknown44=0x{4:X}", bssid, channel, ssid, mode, unknown44); } } }
27.507463
138
0.691807
[ "MIT" ]
xXxTheDarkprogramerxXx/PSPSHARP
PSP_EMU/HLE/kernel/types/SceNetWlanScanInfo.cs
1,845
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Managed.Adb.Exceptions { /// <summary> /// An exception while installing a package on the device /// </summary> [Serializable] public class PackageInstallationException : Exception { /// <summary> /// Initializes a new instance of the <see cref="PackageInstallationException"/> class. /// </summary> public PackageInstallationException ( ) { } /// <summary> /// Initializes a new instance of the <see cref="PackageInstallationException"/> class. /// </summary> /// <param name="message">The message.</param> public PackageInstallationException ( string message ) : base ( message ) { } /// <summary> /// Initializes a new instance of the <see cref="PackageInstallationException"/> class. /// </summary> /// <param name="message">The message.</param> /// <param name="inner">The inner.</param> public PackageInstallationException ( string message, Exception inner ) : base ( message, inner ) { } /// <summary> /// Initializes a new instance of the <see cref="PackageInstallationException"/> class. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="info"/> parameter is null. /// </exception> /// /// <exception cref="T:System.Runtime.Serialization.SerializationException"> /// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). /// </exception> protected PackageInstallationException ( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context ) : base ( info, context ) { } } }
44.733333
171
0.710383
[ "Apache-2.0" ]
camalot/madb
Managed.AndroidDebugBridge/Exceptions/PackageInstallationException.cs
2,015
C#
// ReSharper disable All using System.Collections.Generic; using System.Diagnostics; using System.Dynamic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using MixERP.Net.Api.Framework; using MixERP.Net.ApplicationState.Cache; using MixERP.Net.Common.Extensions; using MixERP.Net.EntityParser; using MixERP.Net.Framework; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using MixERP.Net.Schemas.Core.Data; using MixERP.Net.Api.Core.Fakes; using Xunit; namespace MixERP.Net.Api.Core.Tests { public class UnitScrudViewTests { public static UnitScrudViewController Fixture() { UnitScrudViewController controller = new UnitScrudViewController(new UnitScrudViewRepository(), "", new LoginView()); return controller; } [Fact] [Conditional("Debug")] public void Count() { long count = Fixture().Count(); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void Get() { int count = Fixture().Get().Count(); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void GetPaginatedResult() { int count = Fixture().GetPaginatedResult().Count(); Assert.Equal(1, count); count = Fixture().GetPaginatedResult(1).Count(); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void GetDisplayFields() { int count = Fixture().GetDisplayFields().Count(); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void CountWhere() { long count = Fixture().CountWhere(new JArray()); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void GetWhere() { int count = Fixture().GetWhere(1, new JArray()).Count(); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void CountFiltered() { long count = Fixture().CountFiltered(""); Assert.Equal(1, count); } [Fact] [Conditional("Debug")] public void GetFiltered() { int count = Fixture().GetFiltered(1, "").Count(); Assert.Equal(1, count); } } }
24.50495
129
0.557172
[ "MPL-2.0" ]
asine/mixerp
src/Libraries/Web API/Core/Tests/UnitScrudViewTests.cs
2,475
C#
using System.IO; using UnityEngine; namespace UnityGLTF.Cache { public class RefCountedTextureData : RefCountedBase { public Texture2D Texture; private string id; public RefCountedTextureData(string id, Texture2D texture) { this.id = id; this.Texture = texture; } protected override void OnDestroyCachedData() { PersistentAssetCache.RemoveImage(id); Object.Destroy(Texture); } } public class RefCountedStreamData : RefCountedBase { public Stream stream; private string id; public RefCountedStreamData(string id, Stream stream) { this.id = id; this.stream = stream; } protected override void OnDestroyCachedData() { PersistentAssetCache.RemoveBuffer(id); stream.Dispose(); } } }
22.214286
66
0.578778
[ "Apache-2.0" ]
0xBlockchainx0/unity-renderer
unity-renderer/Assets/UnityGLTF/Scripts/Cache/RefCountedTextureData.cs
935
C#
using Grpc.Core; using ProtoBuf.Meta; using System; namespace ProtoBuf.Grpc.Configuration { /// <summary> /// Provides per-type serialization services /// </summary> public abstract class MarshallerFactory { /// <summary> /// Create a new instance /// </summary> protected MarshallerFactory() {} /// <summary> /// Deserializes an object from a payload /// </summary> protected virtual T Deserialize<T>(byte[] payload) => throw new NotImplementedException("You must override either CreateMarshaller or both Serialize/Deserialize"); /// <summary> /// Serializes an object to a payload /// </summary> protected virtual byte[] Serialize<T>(T value) => throw new NotImplementedException("You must override either CreateMarshaller or both Serialize/Deserialize"); /// <summary> /// Create a typed marshaller (this value is cached and reused automatically) /// </summary> protected internal virtual Marshaller<T> CreateMarshaller<T>() => new Marshaller<T>(Serialize<T>, Deserialize<T>); /// <summary> /// Indicates whether a type should be considered as a serializable data type /// </summary> protected internal abstract bool CanSerialize(Type type); } }
33.536585
124
0.624727
[ "Apache-2.0" ]
CompositionalIT/protobuf-net.Grpc
src/protobuf-net.Grpc/Configuration/MarshallerFactory.cs
1,377
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; using System.Collections.Generic; using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; using Microsoft.ML.Runtime; using Microsoft.ML.SearchSpace.Converter; namespace Microsoft.ML.SearchSpace { /// <summary> /// Parameter type. This type is used to determine the type of <see cref="Parameter"/> and is associated to corresponded Json token when serializing/deserializing. /// </summary> public enum ParameterType { /// <summary> /// Json int type. /// </summary> Integer = 0, /// <summary> /// Json number type. /// </summary> Number = 1, /// <summary> /// Json boolean type. /// </summary> Bool = 2, /// <summary> /// Json string type. /// </summary> String = 3, /// <summary> /// Json object type. /// </summary> Object = 4, /// <summary> /// Json array type. /// </summary> Array = 5, } /// <summary> /// <see cref="Parameter"/> is used to save sweeping result from tuner and is used to restore mlnet pipeline from sweepable pipline. /// </summary> [JsonConverter(typeof(ParameterConverter))] public sealed class Parameter : IDictionary<string, Parameter> { private readonly JsonSerializerOptions _settings = new JsonSerializerOptions() { WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, }; private readonly object _value; private Parameter(object value, ParameterType type) { this._value = value; this.ParameterType = type; this._settings.Converters.Add(new JsonStringEnumConverter()); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="double"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Number"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromDouble(double value) { return new Parameter(value, ParameterType.Number); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="float"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Number"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromFloat(float value) { return new Parameter(value, ParameterType.Number); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="long"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Integer"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromLong(long value) { return new Parameter(value, ParameterType.Integer); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="int"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Integer"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromInt(int value) { return new Parameter(value, ParameterType.Integer); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="string"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.String"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromString(string value) { return new Parameter(value, ParameterType.String); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="bool"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Bool"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromBool(bool value) { return new Parameter(value, ParameterType.Bool); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="Enum"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.String"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromEnum<T>(T value) where T : struct, Enum { return Parameter.FromEnum(value, typeof(T)); } /// <summary> /// Create a <see cref="Parameter"/> from a <see cref="IEnumerable"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Array"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromIEnumerable<T>(IEnumerable<T> values) { // check T return Parameter.FromIEnumerable(values as IEnumerable); } private static Parameter FromIEnumerable(IEnumerable values) { return new Parameter(values, ParameterType.Array); } private static Parameter FromEnum(Enum e, Type t) { return Parameter.FromString(Enum.GetName(t, e)); } /// <summary> /// Create a <see cref="Parameter"/> from an <see cref="object"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.Object"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter FromObject<T>(T value) where T : class { return Parameter.FromObject(value, typeof(T)); } private static Parameter FromObject(object value, Type type) { var param = value switch { int i => Parameter.FromInt(i), long l => Parameter.FromLong(l), double d => Parameter.FromDouble(d), float f => Parameter.FromFloat(f), string s => Parameter.FromString(s), bool b => Parameter.FromBool(b), IEnumerable vs => Parameter.FromIEnumerable(vs), Enum e => Parameter.FromEnum(e, e.GetType()), _ => null, }; if (param != null) { return param; } else { var parameter = Parameter.CreateNestedParameter(); var properties = type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) .Where(p => p.CanRead && p.CanWrite); foreach (var property in properties) { var name = property.Name; var pValue = property.GetValue(value); if (pValue != null) { var p = Parameter.FromObject(pValue, property.PropertyType); if (p?.Count != 0) { parameter[name] = p; } } } return parameter; } } /// <summary> /// Create a <see cref="Parameter"/> from <paramref name="parameters"/>. The <see cref="ParameterType"/> will be <see cref="ParameterType.Object"/>. /// </summary> /// <returns><see cref="Parameter"/></returns> public static Parameter CreateNestedParameter(params KeyValuePair<string, Parameter>[] parameters) { var parameter = new Parameter(new Dictionary<string, Parameter>(), ParameterType.Object); foreach (var param in parameters) { parameter[param.Key] = param.Value; } return parameter; } internal object Value { get => this._value; } /// <summary> /// <inheritdoc/> /// </summary> public int Count => this.ParameterType == ParameterType.Object ? (this._value as Dictionary<string, Parameter>).Count : 1; /// <summary> /// <inheritdoc/> /// </summary> public bool IsReadOnly { get { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>)?.IsReadOnly ?? false; } } /// <summary> /// Get <see cref="ParameterType"/> of this <see cref="ParameterType"/> /// </summary> public ParameterType ParameterType { get; } ICollection<Parameter> IDictionary<string, Parameter>.Values { get { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).Values; } } /// <summary> /// <inheritdoc/> /// </summary> public ICollection<string> Keys { get { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).Keys; } } /// <summary> /// <inheritdoc/> /// </summary> public Parameter this[string key] { get { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>)[key]; } set { this.VerifyIfParameterIsObjectType(); (this._value as IDictionary<string, Parameter>)[key] = value; } } /// <summary> /// Cast <see cref="ParameterType"/> to <typeparamref name="T"/>. This method will return immediately if the underlying value is of type <typeparamref name="T"/>, otherwise it uses <see cref="JsonSerializer"/> to /// convert its value to <typeparamref name="T"/>. /// </summary> public T AsType<T>() { if (this._value is T t) { return t; } else { var json = JsonSerializer.Serialize(this._value, this._settings); return JsonSerializer.Deserialize<T>(json, this._settings); } } /// <summary> /// <inheritdoc/> /// </summary> public void Clear() { this.VerifyIfParameterIsObjectType(); (this._value as Dictionary<string, Parameter>).Clear(); } /// <summary> /// <inheritdoc/> /// </summary> public void Add(string key, Parameter value) { this.VerifyIfParameterIsObjectType(); (this._value as Dictionary<string, Parameter>).Add(key, value); } /// <summary> /// <inheritdoc/> /// </summary> public bool TryGetValue(string key, out Parameter value) { this.VerifyIfParameterIsObjectType(); return (this._value as Dictionary<string, Parameter>).TryGetValue(key, out value); } /// <summary> /// <inheritdoc/> /// </summary> public void Add(KeyValuePair<string, Parameter> item) { this.VerifyIfParameterIsObjectType(); (this._value as Dictionary<string, Parameter>).Add(item.Key, item.Value); } /// <summary> /// <inheritdoc/> /// </summary> public bool Contains(KeyValuePair<string, Parameter> item) { this.VerifyIfParameterIsObjectType(); return (this._value as Dictionary<string, Parameter>).Contains(item); } /// <summary> /// <inheritdoc/> /// </summary> public bool Remove(KeyValuePair<string, Parameter> item) { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).Remove(item); } /// <summary> /// <inheritdoc/> /// </summary> IEnumerator<KeyValuePair<string, Parameter>> IEnumerable<KeyValuePair<string, Parameter>>.GetEnumerator() { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).GetEnumerator(); } /// <summary> /// <inheritdoc/> /// </summary> IEnumerator IEnumerable.GetEnumerator() { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).GetEnumerator(); } private void VerifyIfParameterIsObjectType() { Contracts.Check(this.ParameterType == ParameterType.Object, "parameter is not object type."); } /// <summary> /// <inheritdoc/> /// </summary> public void CopyTo(KeyValuePair<string, Parameter>[] array, int arrayIndex) { this.VerifyIfParameterIsObjectType(); (this._value as IDictionary<string, Parameter>).CopyTo(array, arrayIndex); } /// <summary> /// <inheritdoc/> /// </summary> public bool ContainsKey(string key) { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).ContainsKey(key); } /// <summary> /// <inheritdoc/> /// </summary> public bool Remove(string key) { this.VerifyIfParameterIsObjectType(); return (this._value as IDictionary<string, Parameter>).Remove(key); } } }
34.264706
220
0.541917
[ "MIT" ]
JakeRadMSFT/machinelearning
src/Microsoft.ML.SearchSpace/Parameter.cs
13,982
C#
// <auto-generated> // 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. // </auto-generated> namespace Microsoft.AzureStack.Management.AzureBridge.Admin.Models { using Newtonsoft.Json; using System.Linq; /// <summary> /// Link to a product. /// </summary> public partial class ProductLink { /// <summary> /// Initializes a new instance of the ProductLink class. /// </summary> public ProductLink() { CustomInit(); } /// <summary> /// Initializes a new instance of the ProductLink class. /// </summary> /// <param name="displayName">Displayed name of product.</param> /// <param name="uri">URI to product.</param> public ProductLink(string displayName = default(string), string uri = default(string)) { DisplayName = displayName; Uri = uri; CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); /// <summary> /// Gets or sets displayed name of product. /// </summary> [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } /// <summary> /// Gets or sets URI to product. /// </summary> [JsonProperty(PropertyName = "uri")] public string Uri { get; set; } } }
29.3
94
0.589875
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/azurestack/Microsoft.AzureStack.Management.AzureBridge.Admin/src/Generated/Models/ProductLink.cs
1,758
C#
/***************************************************************************************************** * 本代码版权归yswenli所有,All Rights Reserved (C) 2015-2016 ***************************************************************************************************** * 所属域:yswenli-PC * 登录用户:Administrator * CLR版本:4.0.30319.17929 * 唯一标识:3500e363-56e3-4429-94b3-f72166021725 * 机器名称:yswenli-PC * 联系人邮箱:wenguoli_520@qq.com ***************************************************************************************************** * 命名空间:WeiXinAPIs.Models * 类名称:TenPay * 文件名:TenPay * 创建年份:2015 * 创建时间:2015-11-17 14:15:17 * 创建人:yswenli * 创建说明: *****************************************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace WeiXinAPIs.Models { /// <summary> /// 微信订单明细实体对象 /// </summary> [Serializable] public class OrderDetail { /// <summary> /// 返回状态码,SUCCESS/FAIL 此字段是通信标识,非交易标识,交易是否成功需要查看trade_state来判断 /// </summary> public string return_code = ""; /// <summary> /// 返回信息返回信息,如非空,为错误原因 签名失败 参数格式校验错误 /// </summary> public string return_msg = ""; /// <summary> /// 公共号ID(微信分配的公众账号 ID) /// </summary> public string appid = ""; /// <summary> /// 商户号(微信支付分配的商户号) /// </summary> public string mch_id = ""; /// <summary> /// 随机字符串,不长于32位 /// </summary> public string nonce_str = ""; /// <summary> /// 签名 /// </summary> public string sign = ""; /// <summary> /// 业务结果,SUCCESS/FAIL /// </summary> public string result_code = ""; /// <summary> /// 错误代码 /// </summary> public string err_code = ""; /// <summary> /// 错误代码描述 /// </summary> public string err_code_des = ""; /// <summary> /// 交易状态 ///SUCCESS—支付成功 ///REFUND—转入退款 ///NOTPAY—未支付 ///CLOSED—已关闭 ///REVOKED—已撤销 ///USERPAYING--用户支付中 ///NOPAY--未支付(输入密码或确认支付超时) PAYERROR--支付失败(其他原因,如银行返回失败) /// </summary> public string trade_state = ""; /// <summary> /// 微信支付分配的终端设备号 /// </summary> public string device_info = ""; /// <summary> /// 用户在商户appid下的唯一标识 /// </summary> public string openid = ""; /// <summary> /// 用户是否关注公众账号,Y-关注,N-未关注,仅在公众账号类型支付有效 /// </summary> public string is_subscribe = ""; /// <summary> /// 交易类型,JSAPI、NATIVE、MICROPAY、APP /// </summary> public string trade_type = ""; /// <summary> /// 银行类型,采用字符串类型的银行标识 /// </summary> public string bank_type = ""; /// <summary> /// 订单总金额,单位为分 /// </summary> public string total_fee = ""; /// <summary> /// 现金券支付金额<=订单总金额,订单总金额-现金券金额为现金支付金额 /// </summary> public string coupon_fee = ""; /// <summary> /// 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY /// </summary> public string fee_type = ""; /// <summary> /// 微信支付订单号 /// </summary> public string transaction_id = ""; /// <summary> /// 商户系统的订单号,与请求一致。 /// </summary> public string out_trade_no = ""; /// <summary> /// 商家数据包,原样返回 /// </summary> public string attach = ""; /// <summary> /// 支付完成时间,格式为yyyyMMddhhmmss,如2009年12月27日9点10分10秒表示为20091227091010。 /// 时区为GMT+8 beijing。该时间取自微信支付服务器 /// </summary> public string time_end = ""; } /// <summary> /// 微信订单查询接口请求实体对象 /// </summary> [Serializable] public class QueryOrder { /// <summary> /// 公共号ID(微信分配的公众账号 ID) /// </summary> public string appid = ""; /// <summary> /// 商户号(微信支付分配的商户号) /// </summary> public string mch_id = ""; /// <summary> /// 微信订单号,优先使用 /// </summary> public string transaction_id = ""; /// <summary> /// 商户系统内部订单号 /// </summary> public string out_trade_no = ""; /// <summary> /// 随机字符串,不长于 32 位 /// </summary> public string nonce_str = ""; /// <summary> /// 签名,参与签名参数:appid,mch_id,transaction_id,out_trade_no,nonce_str,key /// </summary> public string sign = ""; } /// <summary> /// 微信统一接口请求实体对象 /// </summary> [Serializable] public class UnifiedOrder { /// <summary> /// 公共号ID(微信分配的公众账号 ID) /// </summary> public string appid = ""; /// <summary> /// 商户号(微信支付分配的商户号) /// </summary> public string mch_id = ""; /// <summary> /// 微信支付分配的终端设备号 /// </summary> public string device_info = ""; /// <summary> /// 随机字符串,不长于 32 位 /// </summary> public string nonce_str = ""; /// <summary> /// 签名 /// </summary> public string sign = ""; /// <summary> /// 商品描述 /// </summary> public string body = ""; /// <summary> /// 附加数据,原样返回 /// </summary> public string attach = ""; /// <summary> /// 商户系统内部的订单号,32个字符内、可包含字母,确保在商户系统唯一,详细说明 /// </summary> public string out_trade_no = ""; /// <summary> /// 订单总金额,单位为分,不能带小数点 /// </summary> public int total_fee = 0; /// <summary> /// 终端IP /// </summary> public string spbill_create_ip = ""; /// <summary> /// 订 单 生 成 时 间 , 格 式 为yyyyMMddHHmmss,如 2009 年12 月 25 日 9 点 10 分 10 秒表示为 20091225091010。时区为 GMT+8 beijing。该时间取自商户服务器 /// </summary> public string time_start = ""; /// <summary> /// 交易结束时间 /// </summary> public string time_expire = ""; /// <summary> /// 商品标记 商品标记,该字段不能随便填,不使用请填空,使用说明详见第 5 节 /// </summary> public string goods_tag = ""; /// <summary> /// 接收微信支付成功通知 /// </summary> public string notify_url = ""; /// <summary> /// JSAPI、NATIVE、APP /// </summary> public string trade_type = ""; /// <summary> /// 用户标识 trade_type 为 JSAPI时,此参数必传 /// </summary> public string openid = ""; /// <summary> /// 只在 trade_type 为 NATIVE时需要填写。 /// </summary> public string product_id = ""; } }
25.417293
124
0.450821
[ "Apache-2.0" ]
yswenli/WebBaseFrameV2
src/WeiXinAPI/Models/TenPay.cs
8,327
C#
using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace aws { #pragma warning disable CS8618 [JsiiByValue(fqn: "aws.EfsAccessPointRootDirectoryCreationInfo")] public class EfsAccessPointRootDirectoryCreationInfo : aws.IEfsAccessPointRootDirectoryCreationInfo { [JsiiProperty(name: "ownerGid", typeJson: "{\"primitive\":\"number\"}", isOverride: true)] public double OwnerGid { get; set; } [JsiiProperty(name: "ownerUid", typeJson: "{\"primitive\":\"number\"}", isOverride: true)] public double OwnerUid { get; set; } [JsiiProperty(name: "permissions", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] public string Permissions { get; set; } } }
25.911765
103
0.590238
[ "MIT" ]
scottenriquez/cdktf-alpha-csharp-testing
resources/.gen/aws/aws/EfsAccessPointRootDirectoryCreationInfo.cs
881
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace plugin_pacas00_server { class StatsHTML { public const string TemplateURL = "https://cdn.rawgit.com/pacas00/Pacas00-s-Dedicated-Server-Utils/master/plugin_pacas00_server/Stats/Template.html"; //Modified version of SetLabel from the Holobsae code, to allow for holobase like floats with units private static string prettyfloat(float count, string toStringParams = "F0") { string s = ""; if(count < 1000f) { s = count.ToString(toStringParams); return s; } else { count /= 1000f; if(count < 1000f) { s = count.ToString(toStringParams) + "k"; return s; } else { count /= 1000f; s = count.ToString(toStringParams) + "m"; return s; } } } public static void GenerateHTML(string templateName, string fileName) { string template = ""; try { template = File.ReadAllText(plugin_pacas00_server.workingDir + Path.DirectorySeparatorChar + templateName); } catch(IOException ioex) { UtilClass.WriteLine(templateName + " not found, downloading default..."); using(var client = new WebClient()) { client.DownloadFile(TemplateURL, plugin_pacas00_server.workingDir + Path.DirectorySeparatorChar + templateName); } template = File.ReadAllText(plugin_pacas00_server.workingDir + Path.DirectorySeparatorChar + templateName); } catch(Exception ex) { //Log others UtilClass.WriteLine(ex); } string AttackState = ""; if(MobSpawnManager.mbAttackUnderway) { AttackState = "Under Attack!"; } int seconds = (int)GameManager.mrTotalServerTime; int totalSeconds = (int)WorldScript.instance.mWorldData.mrWorldTimePlayed; string serverUptime = string.Format("{0}d, {1}h, {2}m, {3}s", seconds / (3600 * 24), (seconds / 3600) % 24, (seconds / 60) % 60, seconds % 60); string worldPlayTime = string.Format("{0}d, {1}h, {2}m, {3}s", totalSeconds / (3600 * 24), (totalSeconds / 3600) % 24, (totalSeconds / 60) % 60, totalSeconds % 60); string newPage = template.Replace("$ServerName", NetworkManager.instance.mServerThread.mServerName) .Replace("$WorldName", WorldScript.instance.mWorldData.mName) .Replace("$PlayerCount", GameManager.mnCurrentTotalPlayers.ToString()) .Replace("$Uptime", serverUptime) .Replace("$PlayTime", worldPlayTime) .Replace("$PowerPerSec", (GameManager.mrTotalPowerGenerated / GameManager.mrTotalTimeSimulated).ToString("F2")) .Replace("$TotalPowerPyro", prettyfloat(GameManager.mrTotalPyroPower, "F2")) .Replace("$TotalPowerSolar", prettyfloat(GameManager.mrTotalSolarPower, "F2")) .Replace("$TotalPowerJet", prettyfloat(GameManager.mrTotalJetPower, "F2")) .Replace("$TotalPower", prettyfloat(GameManager.mrTotalPowerGenerated)) .Replace("$CoalBurned", prettyfloat(GameManager.mnCoalBurned)) .Replace("$OresMin", GameManager.mnOresLastMin + " ores/min") .Replace("$BarsMin", GameManager.mnBarsLastMin + " bars/min") .Replace("$TotalOre", GameManager.mnTotalOre.ToString()) .Replace("$TotalBars", GameManager.mnTotalBars.ToString()) .Replace("$AttackState", AttackState) .Replace("$Threat", ((int)(MobSpawnManager.mrSmoothedBaseThreat * 100)).ToString()) .Replace("$Waves", ((int)MobSpawnManager.TotalWavesSeen).ToString()) .Replace("$Losses", ((int)MobSpawnManager.TotalWavesLosses).ToString()) .Replace("$Kills", ((int)MobSpawnManager.TotalKills).ToString()); string path = Settings.Instance.settings.StatsSavePath.Replace("$ModFolder$", plugin_pacas00_server.workingDir + Path.DirectorySeparatorChar); if(path.LastIndexOf("\\") != (path.Length - 1)) { path = path + Path.DirectorySeparatorChar; } using(TextWriter writer = File.CreateText(path + fileName)) try { { writer.Write(newPage); } writer.Flush(); writer.Close(); } catch(Exception ex) { UtilClass.WriteLine(ex.Message); writer.Flush(); writer.Close(); } } } }
31.171642
167
0.690687
[ "MIT" ]
pacas00/Pacas00-s-Dedicated-Server-Utils
plugin_pacas00_server/StatsHTML.cs
4,179
C#
using System; using System.Drawing; using System.Windows.Forms; using DecodeFromScannerAndWebcam; using DecodeFromScannerAndWebcam.Properties; namespace DecodeFromScannerAndWebcam { partial class DecodeFromScannerAndWebcam { private int cmbDeblurLevel_SelectedIndex = 0; private int cmbLocalizationModes_SelectedIndex = 0; private int cmbGrayscaleTransformationModes_SelectedIndex = 0; private int cmbImagePreprocessingModes_SelectedIndex = 0; private int cmbMinResultConfidence_SelectedIndex = 0; private int cmbTextureDetectionSensitivity_SelectedIndex = 0; /// <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(); this.picBoxWebCam = new System.Windows.Forms.PictureBox(); this.lbMoveBar = new System.Windows.Forms.Label(); this.picboxZoomOut = new System.Windows.Forms.PictureBox(); this.picboxZoomIn = new System.Windows.Forms.PictureBox(); this.picboxDeleteAll = new System.Windows.Forms.PictureBox(); this.picboxDelete = new System.Windows.Forms.PictureBox(); this.picboxFirst = new System.Windows.Forms.PictureBox(); this.picboxLast = new System.Windows.Forms.PictureBox(); this.picboxNext = new System.Windows.Forms.PictureBox(); this.picboxPrevious = new System.Windows.Forms.PictureBox(); this.cbxViewMode = new System.Windows.Forms.ComboBox(); this.picboxMin = new System.Windows.Forms.PictureBox(); this.picboxClose = new System.Windows.Forms.PictureBox(); this.lbDiv = new System.Windows.Forms.Label(); this.tbxCurrentImageIndex = new System.Windows.Forms.TextBox(); this.tbxTotalImageNum = new System.Windows.Forms.TextBox(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.panelNormalSettings = new System.Windows.Forms.Panel(); this.label14 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.panelRecognitionMode = new System.Windows.Forms.Panel(); this.pictureBoxCustomize = new System.Windows.Forms.PictureBox(); this.comment = new System.Windows.Forms.Label(); this.lbRecMode = new System.Windows.Forms.Label(); this.panelReadBarcode = new System.Windows.Forms.Panel(); this.picboxReadBarcode = new System.Windows.Forms.PictureBox(); this.picboxStopBarcode = new System.Windows.Forms.PictureBox(); this.rbBalance = new System.Windows.Forms.RadioButton(); this.rbBestSpeed = new System.Windows.Forms.RadioButton(); this.rbBestCoverage = new System.Windows.Forms.RadioButton(); this.panelPostalCodeDetail = new System.Windows.Forms.Panel(); this.cbPlanet = new System.Windows.Forms.CheckBox(); this.cbPostnet = new System.Windows.Forms.CheckBox(); this.cbRM4SCC = new System.Windows.Forms.CheckBox(); this.cbAustralianPost = new System.Windows.Forms.CheckBox(); this.cbUSPSIntelligentMail = new System.Windows.Forms.CheckBox(); this.panelPDFDetail = new System.Windows.Forms.Panel(); this.cbMicroPDF = new System.Windows.Forms.CheckBox(); this.cbPDF417 = new System.Windows.Forms.CheckBox(); this.panelQRDetail = new System.Windows.Forms.Panel(); this.cbMicroQR = new System.Windows.Forms.CheckBox(); this.cbQRcode = new System.Windows.Forms.CheckBox(); this.panelFormat = new System.Windows.Forms.Panel(); this.cbPostalCode = new System.Windows.Forms.CheckBox(); this.btnExportSettings = new System.Windows.Forms.Button(); this.btnShowAllOneD = new System.Windows.Forms.Button(); this.btnShowAllDatabar = new System.Windows.Forms.Button(); this.btnShowAllPDF = new System.Windows.Forms.Button(); this.btnShowAllQR = new System.Windows.Forms.Button(); this.btnShowAllPostalCode = new System.Windows.Forms.Button(); this.lableFormat = new System.Windows.Forms.Label(); this.cbOneD = new System.Windows.Forms.CheckBox(); this.cbAllPDF417 = new System.Windows.Forms.CheckBox(); this.cbAllQRCode = new System.Windows.Forms.CheckBox(); this.cbDATABAR = new System.Windows.Forms.CheckBox(); this.cbDataMatrix = new System.Windows.Forms.CheckBox(); this.cbMaxicode = new System.Windows.Forms.CheckBox(); this.cbAZTEC = new System.Windows.Forms.CheckBox(); this.cbPATCHCODE = new System.Windows.Forms.CheckBox(); this.cbGS1Composite = new System.Windows.Forms.CheckBox(); this.cbDOTCODE = new System.Windows.Forms.CheckBox(); this.panelOneDetail = new System.Windows.Forms.Panel(); this.cbINDUSTRIAL25 = new System.Windows.Forms.CheckBox(); this.cbUPCE = new System.Windows.Forms.CheckBox(); this.cbUPCA = new System.Windows.Forms.CheckBox(); this.cbEAN8 = new System.Windows.Forms.CheckBox(); this.cbCODABAR = new System.Windows.Forms.CheckBox(); this.cbITF = new System.Windows.Forms.CheckBox(); this.cbEAN13 = new System.Windows.Forms.CheckBox(); this.cbCODE93 = new System.Windows.Forms.CheckBox(); this.cbCODE128 = new System.Windows.Forms.CheckBox(); this.cbCOD39 = new System.Windows.Forms.CheckBox(); this.cbMSICODE = new System.Windows.Forms.CheckBox(); this.panelDatabarDetail = new System.Windows.Forms.Panel(); this.cbDatabarOmnidirectional = new System.Windows.Forms.CheckBox(); this.cbDatabarExpanded = new System.Windows.Forms.CheckBox(); this.cbDatabarExpanedStacked = new System.Windows.Forms.CheckBox(); this.cbDatabarLimited = new System.Windows.Forms.CheckBox(); this.cbDatabarStacked = new System.Windows.Forms.CheckBox(); this.cbDatabarStackedOmnidirectional = new System.Windows.Forms.CheckBox(); this.cbDatabarTruncated = new System.Windows.Forms.CheckBox(); this.panelCustom = new System.Windows.Forms.Panel(); this.panelCustomTop = new System.Windows.Forms.Panel(); this.panelBarcodeReaderParent = new System.Windows.Forms.Panel(); this.lbCustomPanelClose = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); this.panelCustomSettings = new System.Windows.Forms.Panel(); this.panelFormatParent = new System.Windows.Forms.Panel(); this.label17 = new System.Windows.Forms.Label(); this.panelSettings = new System.Windows.Forms.Panel(); this.label12 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.cmbTextureDetectionSensitivity = new System.Windows.Forms.ComboBox(); this.cmbMinResultConfidence = new System.Windows.Forms.ComboBox(); this.cmbImagePreprocessingModes = new System.Windows.Forms.ComboBox(); this.cmbGrayscaleTransformationModes = new System.Windows.Forms.ComboBox(); this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.tbBinarizationBlockSize = new System.Windows.Forms.TextBox(); this.tbScaleDownThreshold = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.cbRegionPredetectionMode = new System.Windows.Forms.CheckBox(); this.cbTextFilterMode = new System.Windows.Forms.CheckBox(); this.cmbLocalizationModes = new System.Windows.Forms.ComboBox(); this.label5 = new System.Windows.Forms.Label(); this.cmbDeblurLevel = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.tbExpectedBarcodesCount = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.panelLoad = new System.Windows.Forms.Panel(); this.label24 = new System.Windows.Forms.Label(); this.picboxLoadImage = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.panelWebCam = new System.Windows.Forms.Panel(); this.labelWebcamNote = new System.Windows.Forms.Label(); this.lblWebCamSrc = new System.Windows.Forms.Label(); this.cbxWebCamSrc = new System.Windows.Forms.ComboBox(); this.lblWebCamRes = new System.Windows.Forms.Label(); this.cbxWebCamRes = new System.Windows.Forms.ComboBox(); this.panelAcquire = new System.Windows.Forms.Panel(); this.rdbtnGray = new System.Windows.Forms.RadioButton(); this.cbxResolution = new System.Windows.Forms.ComboBox(); this.picboxScan = new System.Windows.Forms.PictureBox(); this.rdbtnBW = new System.Windows.Forms.RadioButton(); this.lbResolution = new System.Windows.Forms.Label(); this.rdbtnColor = new System.Windows.Forms.RadioButton(); this.lbPixelType = new System.Windows.Forms.Label(); this.lbSelectSource = new System.Windows.Forms.Label(); this.cbxSource = new System.Windows.Forms.ComboBox(); this.lbSelectRecognitionMode = new System.Windows.Forms.Label(); this.panelReadSetting = new System.Windows.Forms.Panel(); this.label6 = new System.Windows.Forms.Label(); this.panelReadMoreSetting = new System.Windows.Forms.Panel(); this.picboxFit = new System.Windows.Forms.PictureBox(); this.picboxOriginalSize = new System.Windows.Forms.PictureBox(); this.tbxResult = new System.Windows.Forms.TextBox(); this.lblCloseResult = new System.Windows.Forms.Label(); this.dsViewer = new Dynamsoft.Forms.DSViewer(); this.saveRuntimeSettingsFileDialog = new System.Windows.Forms.SaveFileDialog(); this.toolTipExport = new System.Windows.Forms.ToolTip(this.components); ((System.ComponentModel.ISupportInitialize)(this.picBoxWebCam)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxZoomOut)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxZoomIn)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxDeleteAll)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxDelete)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxFirst)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxLast)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxNext)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxPrevious)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxClose)).BeginInit(); this.flowLayoutPanel2.SuspendLayout(); this.panelNormalSettings.SuspendLayout(); this.panelRecognitionMode.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustomize)).BeginInit(); this.panelReadBarcode.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxReadBarcode)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxStopBarcode)).BeginInit(); this.panelPostalCodeDetail.SuspendLayout(); this.panelPDFDetail.SuspendLayout(); this.panelQRDetail.SuspendLayout(); this.panelFormat.SuspendLayout(); this.panelOneDetail.SuspendLayout(); this.panelDatabarDetail.SuspendLayout(); this.panelCustom.SuspendLayout(); this.panelCustomTop.SuspendLayout(); this.panelCustomSettings.SuspendLayout(); this.panelSettings.SuspendLayout(); this.panelLoad.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxLoadImage)).BeginInit(); this.panelWebCam.SuspendLayout(); this.panelAcquire.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxScan)).BeginInit(); this.panelReadSetting.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxFit)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxOriginalSize)).BeginInit(); this.SuspendLayout(); // // picBoxWebCam // this.picBoxWebCam.BackColor = System.Drawing.Color.White; this.picBoxWebCam.Location = new System.Drawing.Point(6, 48); this.picBoxWebCam.Name = "picBoxWebCam"; this.picBoxWebCam.Size = new System.Drawing.Size(563, 692); this.picBoxWebCam.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.picBoxWebCam.TabIndex = 2; this.picBoxWebCam.TabStop = false; this.picBoxWebCam.Visible = false; // // lbMoveBar // this.lbMoveBar.BackColor = System.Drawing.Color.Transparent; this.lbMoveBar.Location = new System.Drawing.Point(0, 1); this.lbMoveBar.Name = "lbMoveBar"; this.lbMoveBar.Size = new System.Drawing.Size(897, 32); this.lbMoveBar.TabIndex = 18; this.lbMoveBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbMoveBar_MouseDown); this.lbMoveBar.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbMoveBar_MouseMove); // // picboxZoomOut // this.picboxZoomOut.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxZoomOut_Leave; this.picboxZoomOut.Location = new System.Drawing.Point(12, 204); this.picboxZoomOut.Name = "picboxZoomOut"; this.picboxZoomOut.Size = new System.Drawing.Size(60, 36); this.picboxZoomOut.TabIndex = 34; this.picboxZoomOut.TabStop = false; this.picboxZoomOut.Tag = "Zoom Out"; this.picboxZoomOut.Click += new System.EventHandler(this.picboxZoomOut_Click); this.picboxZoomOut.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxZoomOut.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxZoomOut.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxZoomOut.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxZoomOut.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxZoomIn // this.picboxZoomIn.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxZoomIn_Leave; this.picboxZoomIn.Location = new System.Drawing.Point(12, 156); this.picboxZoomIn.Name = "picboxZoomIn"; this.picboxZoomIn.Size = new System.Drawing.Size(61, 36); this.picboxZoomIn.TabIndex = 32; this.picboxZoomIn.TabStop = false; this.picboxZoomIn.Tag = "Zoom In"; this.picboxZoomIn.Click += new System.EventHandler(this.picboxZoomIn_Click); this.picboxZoomIn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxZoomIn.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxZoomIn.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxZoomIn.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxZoomIn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxDeleteAll // this.picboxDeleteAll.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxDeleteAll_Leave; this.picboxDeleteAll.Location = new System.Drawing.Point(12, 252); this.picboxDeleteAll.Name = "picboxDeleteAll"; this.picboxDeleteAll.Size = new System.Drawing.Size(60, 36); this.picboxDeleteAll.TabIndex = 38; this.picboxDeleteAll.TabStop = false; this.picboxDeleteAll.Tag = "Delete All"; this.picboxDeleteAll.Click += new System.EventHandler(this.picboxDeleteAll_Click); this.picboxDeleteAll.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxDeleteAll.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxDeleteAll.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxDeleteAll.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxDeleteAll.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxDelete // this.picboxDelete.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxDelete_Leave; this.picboxDelete.Location = new System.Drawing.Point(12, 300); this.picboxDelete.Name = "picboxDelete"; this.picboxDelete.Size = new System.Drawing.Size(61, 36); this.picboxDelete.TabIndex = 36; this.picboxDelete.TabStop = false; this.picboxDelete.Tag = "Delete Current Image"; this.picboxDelete.Click += new System.EventHandler(this.picboxDelete_Click); this.picboxDelete.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxDelete.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxDelete.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxDelete.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxDelete.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxFirst // this.picboxFirst.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxFirst_Leave; this.picboxFirst.Location = new System.Drawing.Point(99, 709); this.picboxFirst.Name = "picboxFirst"; this.picboxFirst.Size = new System.Drawing.Size(50, 25); this.picboxFirst.TabIndex = 42; this.picboxFirst.TabStop = false; this.picboxFirst.Tag = "First Image"; this.picboxFirst.Click += new System.EventHandler(this.picboxFirst_Click); this.picboxFirst.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxFirst.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxFirst.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxFirst.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxFirst.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxLast // this.picboxLast.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxLast_Leave; this.picboxLast.Location = new System.Drawing.Point(418, 709); this.picboxLast.Name = "picboxLast"; this.picboxLast.Size = new System.Drawing.Size(50, 25); this.picboxLast.TabIndex = 43; this.picboxLast.TabStop = false; this.picboxLast.Tag = "Last Image"; this.picboxLast.Click += new System.EventHandler(this.picboxLast_Click); this.picboxLast.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxLast.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxLast.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxLast.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxLast.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxNext // this.picboxNext.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxNext_Leave; this.picboxNext.Location = new System.Drawing.Point(362, 709); this.picboxNext.Name = "picboxNext"; this.picboxNext.Size = new System.Drawing.Size(50, 25); this.picboxNext.TabIndex = 44; this.picboxNext.TabStop = false; this.picboxNext.Tag = "Next Image"; this.picboxNext.Click += new System.EventHandler(this.picboxNext_Click); this.picboxNext.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxNext.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxNext.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxNext.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxNext.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxPrevious // this.picboxPrevious.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxPrevious_Leave; this.picboxPrevious.Location = new System.Drawing.Point(155, 709); this.picboxPrevious.Name = "picboxPrevious"; this.picboxPrevious.Size = new System.Drawing.Size(50, 25); this.picboxPrevious.TabIndex = 47; this.picboxPrevious.TabStop = false; this.picboxPrevious.Tag = "Previous Image"; this.picboxPrevious.Click += new System.EventHandler(this.picboxPrevious_Click); this.picboxPrevious.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxPrevious.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxPrevious.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxPrevious.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxPrevious.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // cbxViewMode // this.cbxViewMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbxViewMode.FormattingEnabled = true; this.cbxViewMode.Items.AddRange(new object[] { "1 x 1", "2 x 2", "3 x 3", "4 x 4", "5 x 5"}); this.cbxViewMode.Location = new System.Drawing.Point(474, 709); this.cbxViewMode.Name = "cbxViewMode"; this.cbxViewMode.Size = new System.Drawing.Size(75, 23); this.cbxViewMode.TabIndex = 650; this.cbxViewMode.SelectedIndexChanged += new System.EventHandler(this.cbxLayout_SelectedIndexChanged); // // picboxMin // this.picboxMin.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxMin_Leave; this.picboxMin.Location = new System.Drawing.Point(840, 10); this.picboxMin.Name = "picboxMin"; this.picboxMin.Size = new System.Drawing.Size(20, 20); this.picboxMin.TabIndex = 73; this.picboxMin.TabStop = false; this.picboxMin.Click += new System.EventHandler(this.picboxMin_Click); this.picboxMin.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxMin.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxMin.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxMin.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxClose // this.picboxClose.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxClose_Leave; this.picboxClose.Location = new System.Drawing.Point(864, 10); this.picboxClose.Name = "picboxClose"; this.picboxClose.Size = new System.Drawing.Size(20, 20); this.picboxClose.TabIndex = 74; this.picboxClose.TabStop = false; this.picboxClose.MouseClick += new System.Windows.Forms.MouseEventHandler(this.picboxClose_MouseClick); this.picboxClose.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxClose.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxClose.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxClose.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // lbDiv // this.lbDiv.AutoSize = true; this.lbDiv.BackColor = System.Drawing.Color.Transparent; this.lbDiv.Location = new System.Drawing.Point(279, 714); this.lbDiv.Name = "lbDiv"; this.lbDiv.Size = new System.Drawing.Size(12, 15); this.lbDiv.TabIndex = 75; this.lbDiv.Text = "/"; // // tbxCurrentImageIndex // this.tbxCurrentImageIndex.Enabled = false; this.tbxCurrentImageIndex.Location = new System.Drawing.Point(211, 709); this.tbxCurrentImageIndex.Name = "tbxCurrentImageIndex"; this.tbxCurrentImageIndex.ReadOnly = true; this.tbxCurrentImageIndex.Size = new System.Drawing.Size(61, 23); this.tbxCurrentImageIndex.TabIndex = 76; this.tbxCurrentImageIndex.Text = "0"; this.tbxCurrentImageIndex.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // tbxTotalImageNum // this.tbxTotalImageNum.Enabled = false; this.tbxTotalImageNum.Location = new System.Drawing.Point(295, 709); this.tbxTotalImageNum.Name = "tbxTotalImageNum"; this.tbxTotalImageNum.ReadOnly = true; this.tbxTotalImageNum.Size = new System.Drawing.Size(61, 23); this.tbxTotalImageNum.TabIndex = 77; this.tbxTotalImageNum.Text = "0"; // // openFileDialog // this.openFileDialog.FileName = "openFileDialog1"; // // flowLayoutPanel2 // this.flowLayoutPanel2.BackColor = System.Drawing.Color.White; this.flowLayoutPanel2.Controls.Add(this.panelNormalSettings); this.flowLayoutPanel2.Location = new System.Drawing.Point(566, 48); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(331, 688); this.flowLayoutPanel2.TabIndex = 84; // // panelNormalSettings // this.panelNormalSettings.BackColor = System.Drawing.Color.Transparent; this.panelNormalSettings.Controls.Add(this.panelOneDetail); this.panelNormalSettings.Controls.Add(this.label14); this.panelNormalSettings.Controls.Add(this.label2); this.panelNormalSettings.Controls.Add(this.label13); this.panelNormalSettings.Controls.Add(this.panelRecognitionMode); this.panelNormalSettings.Controls.Add(this.panelDatabarDetail); this.panelNormalSettings.Controls.Add(this.panelPostalCodeDetail); this.panelNormalSettings.Controls.Add(this.panelQRDetail); this.panelNormalSettings.Controls.Add(this.panelPDFDetail); this.panelNormalSettings.Controls.Add(this.panelFormat); this.panelNormalSettings.Location = new System.Drawing.Point(3, 3); this.panelNormalSettings.Name = "panelNormalSettings"; this.panelNormalSettings.Size = new System.Drawing.Size(310, 446); this.panelNormalSettings.TabIndex = 0; // // label14 // this.label14.BackColor = System.Drawing.Color.DarkGray; this.label14.Location = new System.Drawing.Point(0, 284); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(305, 1); this.label14.TabIndex = 9; // // label2 // this.label2.BackColor = System.Drawing.Color.DarkGray; this.label2.Location = new System.Drawing.Point(0, 43); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(305, 1); this.label2.TabIndex = 8; // // label13 // this.label13.AutoSize = true; this.label13.Font = new System.Drawing.Font("Open Sans", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label13.Location = new System.Drawing.Point(11, 13); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(76, 20); this.label13.TabIndex = 8; this.label13.Text = "Settings"; // // panelRecognitionMode // this.panelRecognitionMode.Controls.Add(this.pictureBoxCustomize); this.panelRecognitionMode.Controls.Add(this.comment); this.panelRecognitionMode.Controls.Add(this.lbRecMode); this.panelRecognitionMode.Controls.Add(this.panelReadBarcode); this.panelRecognitionMode.Controls.Add(this.rbBalance); this.panelRecognitionMode.Controls.Add(this.rbBestSpeed); this.panelRecognitionMode.Controls.Add(this.rbBestCoverage); this.panelRecognitionMode.Location = new System.Drawing.Point(0, 288); this.panelRecognitionMode.Name = "panelRecognitionMode"; this.panelRecognitionMode.Size = new System.Drawing.Size(310, 155); this.panelRecognitionMode.TabIndex = 7; // // pictureBoxCustomize // this.pictureBoxCustomize.InitialImage = global::DecodeFromScannerAndWebcam.Properties.Resources.pictureBoxCustomize_hover; this.pictureBoxCustomize.Location = new System.Drawing.Point(190, 77); this.pictureBoxCustomize.Name = "pictureBoxCustomize"; this.pictureBoxCustomize.Size = new System.Drawing.Size(100, 34); this.pictureBoxCustomize.TabIndex = 8; this.pictureBoxCustomize.TabStop = false; this.pictureBoxCustomize.Click += new System.EventHandler(this.btnEditSettings_Click); this.pictureBoxCustomize.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxCustomize_MouseDown); this.pictureBoxCustomize.MouseEnter += new System.EventHandler(this.pictureBoxCustomize_MouseEnter); this.pictureBoxCustomize.MouseLeave += new System.EventHandler(this.pictureBoxCustomize_MouseLeave); this.pictureBoxCustomize.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBoxCustomize_MouseUp); // // comment // this.comment.AutoSize = true; this.comment.Font = new System.Drawing.Font("Open Sans", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.comment.Location = new System.Drawing.Point(22, 126); this.comment.Name = "comment"; this.comment.Size = new System.Drawing.Size(230, 15); this.comment.TabIndex = 7; this.comment.Text = "* \"Customize\" is only for advanced users. "; // // lbRecMode // this.lbRecMode.AutoSize = true; this.lbRecMode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lbRecMode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.lbRecMode.Location = new System.Drawing.Point(19, 11); this.lbRecMode.Name = "lbRecMode"; this.lbRecMode.Size = new System.Drawing.Size(122, 17); this.lbRecMode.TabIndex = 4; this.lbRecMode.Text = "Recognition Mode"; // // panelReadBarcode // this.panelReadBarcode.AutoSize = true; this.panelReadBarcode.BackColor = System.Drawing.Color.Transparent; this.panelReadBarcode.Controls.Add(this.picboxReadBarcode); this.panelReadBarcode.Controls.Add(this.picboxStopBarcode); this.panelReadBarcode.Location = new System.Drawing.Point(20, 77); this.panelReadBarcode.Margin = new System.Windows.Forms.Padding(0); this.panelReadBarcode.Name = "panelReadBarcode"; this.panelReadBarcode.Size = new System.Drawing.Size(160, 37); this.panelReadBarcode.TabIndex = 3; // // picboxReadBarcode // this.picboxReadBarcode.Location = new System.Drawing.Point(0, 0); this.picboxReadBarcode.Name = "picboxReadBarcode"; this.picboxReadBarcode.Size = new System.Drawing.Size(153, 34); this.picboxReadBarcode.TabIndex = 15; this.picboxReadBarcode.TabStop = false; this.picboxReadBarcode.Click += new System.EventHandler(this.picboxReadBarcode_Click); this.picboxReadBarcode.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxReadBarcode.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxReadBarcode.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxReadBarcode.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxStopBarcode // this.picboxStopBarcode.Location = new System.Drawing.Point(0, 0); this.picboxStopBarcode.Name = "picboxStopBarcode"; this.picboxStopBarcode.Size = new System.Drawing.Size(153, 34); this.picboxStopBarcode.TabIndex = 15; this.picboxStopBarcode.TabStop = false; this.picboxStopBarcode.Visible = false; this.picboxStopBarcode.Click += new System.EventHandler(this.picboxStopBarcode_Click); this.picboxStopBarcode.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxStopBarcode.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxStopBarcode.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxStopBarcode.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // rbBalance // this.rbBalance.AutoSize = true; this.rbBalance.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.rbBalance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.rbBalance.Location = new System.Drawing.Point(100, 40); this.rbBalance.Name = "rbBalance"; this.rbBalance.Size = new System.Drawing.Size(80, 21); this.rbBalance.TabIndex = 5; this.rbBalance.Text = "Balance"; this.rbBalance.UseVisualStyleBackColor = true; this.rbBalance.CheckedChanged += new System.EventHandler(this.rbMode_CheckedChanged); // // rbBestSpeed // this.rbBestSpeed.AutoSize = true; this.rbBestSpeed.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.rbBestSpeed.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.rbBestSpeed.Location = new System.Drawing.Point(19, 40); this.rbBestSpeed.Name = "rbBestSpeed"; this.rbBestSpeed.Size = new System.Drawing.Size(80, 21); this.rbBestSpeed.TabIndex = 5; this.rbBestSpeed.TabStop = true; this.rbBestSpeed.Text = "Speed"; this.rbBestSpeed.UseVisualStyleBackColor = true; this.rbBestSpeed.CheckedChanged += new System.EventHandler(this.rbMode_CheckedChanged); // // rbBestCoverage // this.rbBestCoverage.AutoSize = true; this.rbBestCoverage.Checked = true; this.rbBestCoverage.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.rbBestCoverage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.rbBestCoverage.Location = new System.Drawing.Point(180, 40); this.rbBestCoverage.Name = "rbBestCoverage"; this.rbBestCoverage.Size = new System.Drawing.Size(80, 21); this.rbBestCoverage.TabIndex = 5; this.rbBestCoverage.TabStop = true; this.rbBestCoverage.Text = "Coverage"; this.rbBestCoverage.UseVisualStyleBackColor = true; this.rbBestCoverage.CheckedChanged += new System.EventHandler(this.rbMode_CheckedChanged); // // panelPostalCodeDetail // this.panelPostalCodeDetail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(221)))), ((int)(((byte)(221)))), ((int)(((byte)(221))))); this.panelPostalCodeDetail.Controls.Add(this.cbPlanet); this.panelPostalCodeDetail.Controls.Add(this.cbPostnet); this.panelPostalCodeDetail.Controls.Add(this.cbRM4SCC); this.panelPostalCodeDetail.Controls.Add(this.cbAustralianPost); this.panelPostalCodeDetail.Controls.Add(this.cbUSPSIntelligentMail); this.panelPostalCodeDetail.Location = new System.Drawing.Point(0, 141); this.panelPostalCodeDetail.Name = "panelPostalCodeDetail"; this.panelPostalCodeDetail.Size = new System.Drawing.Size(305, 159); this.panelPostalCodeDetail.TabIndex = 9; this.panelPostalCodeDetail.Visible = false; // // cbPlanet // this.cbPlanet.AutoSize = true; this.cbPlanet.Checked = true; this.cbPlanet.CheckState = System.Windows.Forms.CheckState.Checked; this.cbPlanet.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbPlanet.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbPlanet.Location = new System.Drawing.Point(10, 122); this.cbPlanet.Margin = new System.Windows.Forms.Padding(0); this.cbPlanet.Name = "cbPlanet"; this.cbPlanet.Size = new System.Drawing.Size(67, 21); this.cbPlanet.TabIndex = 5; this.cbPlanet.Text = "Planet"; this.cbPlanet.UseVisualStyleBackColor = true; this.cbPlanet.CheckedChanged += new System.EventHandler(this.rbPostalCodeMode_CheckedChanged); // // cbPostnet // this.cbPostnet.AutoSize = true; this.cbPostnet.Checked = true; this.cbPostnet.CheckState = System.Windows.Forms.CheckState.Checked; this.cbPostnet.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbPostnet.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbPostnet.Location = new System.Drawing.Point(10, 94); this.cbPostnet.Margin = new System.Windows.Forms.Padding(0); this.cbPostnet.Name = "cbPostnet"; this.cbPostnet.Size = new System.Drawing.Size(75, 21); this.cbPostnet.TabIndex = 3; this.cbPostnet.Text = "Postnet"; this.cbPostnet.UseVisualStyleBackColor = true; this.cbPostnet.CheckedChanged += new System.EventHandler(this.rbPostalCodeMode_CheckedChanged); // // cbRM4SCC // this.cbRM4SCC.AutoSize = true; this.cbRM4SCC.Checked = true; this.cbRM4SCC.CheckState = System.Windows.Forms.CheckState.Checked; this.cbRM4SCC.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbRM4SCC.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbRM4SCC.Location = new System.Drawing.Point(10, 66); this.cbRM4SCC.Margin = new System.Windows.Forms.Padding(0); this.cbRM4SCC.Name = "cbRM4SCC"; this.cbRM4SCC.Size = new System.Drawing.Size(263, 21); this.cbRM4SCC.TabIndex = 4; this.cbRM4SCC.Text = "Royal Mail 4-State Customer Barcode"; this.cbRM4SCC.UseVisualStyleBackColor = true; this.cbRM4SCC.CheckedChanged += new System.EventHandler(this.rbPostalCodeMode_CheckedChanged); // // cbAustralianPost // this.cbAustralianPost.AutoSize = true; this.cbAustralianPost.Checked = true; this.cbAustralianPost.CheckState = System.Windows.Forms.CheckState.Checked; this.cbAustralianPost.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbAustralianPost.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbAustralianPost.Location = new System.Drawing.Point(10, 38); this.cbAustralianPost.Margin = new System.Windows.Forms.Padding(0); this.cbAustralianPost.Name = "cbAustralianPost"; this.cbAustralianPost.Size = new System.Drawing.Size(122, 21); this.cbAustralianPost.TabIndex = 2; this.cbAustralianPost.Text = "Australian Post"; this.cbAustralianPost.UseVisualStyleBackColor = true; this.cbAustralianPost.CheckedChanged += new System.EventHandler(this.rbPostalCodeMode_CheckedChanged); // // cbUSPSIntelligentMail // this.cbUSPSIntelligentMail.AutoSize = true; this.cbUSPSIntelligentMail.Checked = true; this.cbUSPSIntelligentMail.CheckState = System.Windows.Forms.CheckState.Checked; this.cbUSPSIntelligentMail.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbUSPSIntelligentMail.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbUSPSIntelligentMail.Location = new System.Drawing.Point(10, 10); this.cbUSPSIntelligentMail.Margin = new System.Windows.Forms.Padding(0); this.cbUSPSIntelligentMail.Name = "cbUSPSIntelligentMail"; this.cbUSPSIntelligentMail.Size = new System.Drawing.Size(157, 21); this.cbUSPSIntelligentMail.TabIndex = 2; this.cbUSPSIntelligentMail.Text = "USPS Intelligent Mail"; this.cbUSPSIntelligentMail.UseVisualStyleBackColor = true; this.cbUSPSIntelligentMail.CheckedChanged += new System.EventHandler(this.rbPostalCodeMode_CheckedChanged); // // panelPDFDetail // this.panelPDFDetail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(221)))), ((int)(((byte)(221)))), ((int)(((byte)(221))))); this.panelPDFDetail.Controls.Add(this.cbMicroPDF); this.panelPDFDetail.Controls.Add(this.cbPDF417); this.panelPDFDetail.Location = new System.Drawing.Point(0, 173); this.panelPDFDetail.Name = "panelPDFDetail"; this.panelPDFDetail.Size = new System.Drawing.Size(305, 76); this.panelPDFDetail.TabIndex = 8; this.panelPDFDetail.Visible = false; // // cbMicroPDF // this.cbMicroPDF.AutoSize = true; this.cbMicroPDF.Checked = true; this.cbMicroPDF.CheckState = System.Windows.Forms.CheckState.Checked; this.cbMicroPDF.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbMicroPDF.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbMicroPDF.Location = new System.Drawing.Point(10, 38); this.cbMicroPDF.Margin = new System.Windows.Forms.Padding(0); this.cbMicroPDF.Name = "cbMicroPDF"; this.cbMicroPDF.Size = new System.Drawing.Size(116, 21); this.cbMicroPDF.TabIndex = 2; this.cbMicroPDF.Text = "Micro PDF417"; this.cbMicroPDF.UseVisualStyleBackColor = true; this.cbMicroPDF.CheckedChanged += new System.EventHandler(this.rbAllPDFMode_CheckedChanged); // // cbPDF417 // this.cbPDF417.AutoSize = true; this.cbPDF417.Checked = true; this.cbPDF417.CheckState = System.Windows.Forms.CheckState.Checked; this.cbPDF417.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbPDF417.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbPDF417.Location = new System.Drawing.Point(10, 10); this.cbPDF417.Margin = new System.Windows.Forms.Padding(0); this.cbPDF417.Name = "cbPDF417"; this.cbPDF417.Size = new System.Drawing.Size(78, 21); this.cbPDF417.TabIndex = 2; this.cbPDF417.Text = "PDF417"; this.cbPDF417.UseVisualStyleBackColor = true; this.cbPDF417.CheckedChanged += new System.EventHandler(this.rbAllPDFMode_CheckedChanged); // // panelQRDetail // this.panelQRDetail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(221)))), ((int)(((byte)(221)))), ((int)(((byte)(221))))); this.panelQRDetail.Controls.Add(this.cbMicroQR); this.panelQRDetail.Controls.Add(this.cbQRcode); this.panelQRDetail.Location = new System.Drawing.Point(0, 141); this.panelQRDetail.Name = "panelQRDetail"; this.panelQRDetail.Size = new System.Drawing.Size(305, 76); this.panelQRDetail.TabIndex = 8; this.panelQRDetail.Visible = false; // // cbMicroQR // this.cbMicroQR.AutoSize = true; this.cbMicroQR.Checked = true; this.cbMicroQR.CheckState = System.Windows.Forms.CheckState.Checked; this.cbMicroQR.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbMicroQR.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbMicroQR.Location = new System.Drawing.Point(10, 38); this.cbMicroQR.Margin = new System.Windows.Forms.Padding(0); this.cbMicroQR.Name = "cbMicroQR"; this.cbMicroQR.Size = new System.Drawing.Size(86, 21); this.cbMicroQR.TabIndex = 2; this.cbMicroQR.Text = "Micro QR"; this.cbMicroQR.UseVisualStyleBackColor = true; this.cbMicroQR.CheckedChanged += new System.EventHandler(this.rbAllQRMode_CheckedChanged); // // cbQRcode // this.cbQRcode.AutoSize = true; this.cbQRcode.Checked = true; this.cbQRcode.CheckState = System.Windows.Forms.CheckState.Checked; this.cbQRcode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbQRcode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbQRcode.Location = new System.Drawing.Point(10, 10); this.cbQRcode.Name = "cbQRcode"; this.cbQRcode.Size = new System.Drawing.Size(85, 21); this.cbQRcode.TabIndex = 2; this.cbQRcode.Text = "QR Code"; this.cbQRcode.UseVisualStyleBackColor = true; this.cbQRcode.CheckedChanged += new System.EventHandler(this.rbAllQRMode_CheckedChanged); // // panelFormat // this.panelFormat.Controls.Add(this.cbPostalCode); this.panelFormat.Controls.Add(this.btnExportSettings); this.panelFormat.Controls.Add(this.btnShowAllOneD); this.panelFormat.Controls.Add(this.btnShowAllDatabar); this.panelFormat.Controls.Add(this.btnShowAllPDF); this.panelFormat.Controls.Add(this.btnShowAllQR); this.panelFormat.Controls.Add(this.btnShowAllPostalCode); this.panelFormat.Controls.Add(this.lableFormat); this.panelFormat.Controls.Add(this.cbOneD); this.panelFormat.Controls.Add(this.cbAllPDF417); this.panelFormat.Controls.Add(this.cbAllQRCode); this.panelFormat.Controls.Add(this.cbDATABAR); this.panelFormat.Controls.Add(this.cbDataMatrix); this.panelFormat.Controls.Add(this.cbMaxicode); this.panelFormat.Controls.Add(this.cbAZTEC); this.panelFormat.Controls.Add(this.cbPATCHCODE); this.panelFormat.Controls.Add(this.cbGS1Composite); this.panelFormat.Controls.Add(this.cbDOTCODE); this.panelFormat.Location = new System.Drawing.Point(0, 44); this.panelFormat.Name = "panelFormat"; this.panelFormat.Size = new System.Drawing.Size(310, 243); this.panelFormat.TabIndex = 1; // // cbPostalCode // this.cbPostalCode.AutoSize = true; this.cbPostalCode.Checked = true; this.cbPostalCode.CheckState = System.Windows.Forms.CheckState.Checked; this.cbPostalCode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbPostalCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbPostalCode.Location = new System.Drawing.Point(140, 72); this.cbPostalCode.Name = "cbPostalCode"; this.cbPostalCode.Size = new System.Drawing.Size(103, 21); this.cbPostalCode.TabIndex = 9; this.cbPostalCode.Text = "Postal Code"; this.cbPostalCode.UseVisualStyleBackColor = true; this.cbPostalCode.CheckStateChanged += new System.EventHandler(this.cbPostalCode_CheckStateChanged); // // btnExportSettings // this.btnExportSettings.FlatAppearance.BorderSize = 0; this.btnExportSettings.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnExportSettings.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.icon_output; this.btnExportSettings.Location = new System.Drawing.Point(250, 9); this.btnExportSettings.Name = "btnExportSettings"; this.btnExportSettings.Size = new System.Drawing.Size(30, 23); this.btnExportSettings.TabIndex = 8; this.btnExportSettings.UseVisualStyleBackColor = true; this.btnExportSettings.Visible = false; this.btnExportSettings.Click += new System.EventHandler(this.btnExportSettings_Click); this.btnExportSettings.DragEnter += new System.Windows.Forms.DragEventHandler(this.btnExportSettings_DragEnter); this.btnExportSettings.DragLeave += new System.EventHandler(this.btnExportSettings_DragLeave); // // btnShowAllOneD // this.btnShowAllOneD.BackColor = System.Drawing.Color.Transparent; this.btnShowAllOneD.FlatAppearance.BorderSize = 0; this.btnShowAllOneD.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnShowAllOneD.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.btnShowAllOneD.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(168)))), ((int)(((byte)(225))))); this.btnShowAllOneD.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.arrow_down; this.btnShowAllOneD.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnShowAllOneD.Location = new System.Drawing.Point(58, 40); this.btnShowAllOneD.Name = "btnShowAllOneD"; this.btnShowAllOneD.Size = new System.Drawing.Size(20, 24); this.btnShowAllOneD.TabIndex = 7; this.btnShowAllOneD.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.btnShowAllOneD.UseVisualStyleBackColor = false; this.btnShowAllOneD.Click += new System.EventHandler(this.btnShowAllOneD_Click); // // btnShowAllDatabar // this.btnShowAllDatabar.BackColor = System.Drawing.Color.Transparent; this.btnShowAllDatabar.FlatAppearance.BorderSize = 0; this.btnShowAllDatabar.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnShowAllDatabar.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.btnShowAllDatabar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(168)))), ((int)(((byte)(225))))); this.btnShowAllDatabar.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.arrow_down; this.btnShowAllDatabar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnShowAllDatabar.Location = new System.Drawing.Point(260, 40); this.btnShowAllDatabar.Name = "btnShowAllDatabar"; this.btnShowAllDatabar.Size = new System.Drawing.Size(20, 24); this.btnShowAllDatabar.TabIndex = 7; this.btnShowAllDatabar.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.btnShowAllDatabar.UseVisualStyleBackColor = false; this.btnShowAllDatabar.Click += new System.EventHandler(this.btnShowAllDatabar_Click); // // btnShowAllPDF // this.btnShowAllPDF.BackColor = System.Drawing.Color.Transparent; this.btnShowAllPDF.FlatAppearance.BorderSize = 0; this.btnShowAllPDF.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnShowAllPDF.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.btnShowAllPDF.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(168)))), ((int)(((byte)(225))))); this.btnShowAllPDF.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.arrow_down; this.btnShowAllPDF.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnShowAllPDF.Location = new System.Drawing.Point(100, 104); this.btnShowAllPDF.Name = "btnShowAllPDF"; this.btnShowAllPDF.Size = new System.Drawing.Size(20, 24); this.btnShowAllPDF.TabIndex = 7; this.btnShowAllPDF.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.btnShowAllPDF.UseVisualStyleBackColor = false; this.btnShowAllPDF.Click += new System.EventHandler(this.btnShowAllPDF_Click); // // btnShowAllQR // this.btnShowAllQR.BackColor = System.Drawing.Color.Transparent; this.btnShowAllQR.FlatAppearance.BorderSize = 0; this.btnShowAllQR.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnShowAllQR.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.btnShowAllQR.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(168)))), ((int)(((byte)(225))))); this.btnShowAllQR.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.arrow_down; this.btnShowAllQR.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnShowAllQR.Location = new System.Drawing.Point(100, 72); this.btnShowAllQR.Name = "btnShowAllQR"; this.btnShowAllQR.Size = new System.Drawing.Size(20, 24); this.btnShowAllQR.TabIndex = 7; this.btnShowAllQR.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.btnShowAllQR.UseVisualStyleBackColor = false; this.btnShowAllQR.Click += new System.EventHandler(this.btnShowAllQR_Click); // // btnShowAllPostalCode // this.btnShowAllPostalCode.BackColor = System.Drawing.Color.Transparent; this.btnShowAllPostalCode.FlatAppearance.BorderSize = 0; this.btnShowAllPostalCode.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnShowAllPostalCode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.btnShowAllPostalCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(168)))), ((int)(((byte)(225))))); this.btnShowAllPostalCode.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.arrow_down; this.btnShowAllPostalCode.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnShowAllPostalCode.Location = new System.Drawing.Point(260, 72); this.btnShowAllPostalCode.Name = "btnShowAllPostalCode"; this.btnShowAllPostalCode.Size = new System.Drawing.Size(20, 24); this.btnShowAllPostalCode.TabIndex = 7; this.btnShowAllPostalCode.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.btnShowAllPostalCode.UseVisualStyleBackColor = false; this.btnShowAllPostalCode.Click += new System.EventHandler(this.btnShowAllPostalCode_Click); // // lableFormat // this.lableFormat.AutoSize = true; this.lableFormat.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lableFormat.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.lableFormat.Location = new System.Drawing.Point(18, 11); this.lableFormat.Margin = new System.Windows.Forms.Padding(0); this.lableFormat.Name = "lableFormat"; this.lableFormat.Size = new System.Drawing.Size(109, 17); this.lableFormat.TabIndex = 0; this.lableFormat.Text = "Barcode Format"; // // cbOneD // this.cbOneD.AutoSize = true; this.cbOneD.Checked = true; this.cbOneD.CheckState = System.Windows.Forms.CheckState.Checked; this.cbOneD.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbOneD.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbOneD.Location = new System.Drawing.Point(17, 40); this.cbOneD.Name = "cbOneD"; this.cbOneD.Size = new System.Drawing.Size(45, 21); this.cbOneD.TabIndex = 1; this.cbOneD.Text = "1D"; this.cbOneD.UseVisualStyleBackColor = true; this.cbOneD.CheckStateChanged += new System.EventHandler(this.cbOneD_CheckStateChanged); // // cbAllPDF417 // this.cbAllPDF417.AutoSize = true; this.cbAllPDF417.Checked = true; this.cbAllPDF417.CheckState = System.Windows.Forms.CheckState.Checked; this.cbAllPDF417.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbAllPDF417.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbAllPDF417.Location = new System.Drawing.Point(17, 104); this.cbAllPDF417.Name = "cbAllPDF417"; this.cbAllPDF417.Size = new System.Drawing.Size(78, 21); this.cbAllPDF417.TabIndex = 2; this.cbAllPDF417.Text = "PDF417"; this.cbAllPDF417.UseVisualStyleBackColor = true; this.cbAllPDF417.CheckedChanged += new System.EventHandler(this.cbAllPDF417_CheckStateChanged); // // cbAllQRCode // this.cbAllQRCode.AutoSize = true; this.cbAllQRCode.Checked = true; this.cbAllQRCode.CheckState = System.Windows.Forms.CheckState.Checked; this.cbAllQRCode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbAllQRCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbAllQRCode.Location = new System.Drawing.Point(17, 72); this.cbAllQRCode.Name = "cbAllQRCode"; this.cbAllQRCode.Size = new System.Drawing.Size(85, 21); this.cbAllQRCode.TabIndex = 2; this.cbAllQRCode.Text = "QR Code"; this.cbAllQRCode.UseVisualStyleBackColor = true; this.cbAllQRCode.CheckedChanged += new System.EventHandler(this.cbAllQRCode_CheckStateChanged); // // cbDATABAR // this.cbDATABAR.AutoSize = true; this.cbDATABAR.Checked = true; this.cbDATABAR.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDATABAR.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDATABAR.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDATABAR.Location = new System.Drawing.Point(140, 40); this.cbDATABAR.Name = "cbDATABAR"; this.cbDATABAR.Size = new System.Drawing.Size(124, 21); this.cbDATABAR.TabIndex = 0; this.cbDATABAR.Text = "GS1 Databar"; this.cbDATABAR.UseVisualStyleBackColor = true; this.cbDATABAR.CheckedChanged += new System.EventHandler(this.cbDatabar_CheckStateChanged); // // cbDataMatrix // this.cbDataMatrix.AutoSize = true; this.cbDataMatrix.Checked = true; this.cbDataMatrix.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDataMatrix.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDataMatrix.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDataMatrix.Location = new System.Drawing.Point(140, 104); this.cbDataMatrix.Name = "cbDataMatrix"; this.cbDataMatrix.Size = new System.Drawing.Size(94, 21); this.cbDataMatrix.TabIndex = 2; this.cbDataMatrix.Text = "DataMatrix"; this.cbDataMatrix.UseVisualStyleBackColor = true; this.cbDataMatrix.CheckedChanged += new System.EventHandler(this.cbBarcodeFormat_CheckedChanged); // // cbMaxicode // this.cbMaxicode.AutoSize = true; this.cbMaxicode.Checked = true; this.cbMaxicode.CheckState = System.Windows.Forms.CheckState.Checked; this.cbMaxicode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbMaxicode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbMaxicode.Location = new System.Drawing.Point(140, 136); this.cbMaxicode.Margin = new System.Windows.Forms.Padding(0); this.cbMaxicode.Name = "cbMaxicode"; this.cbMaxicode.Size = new System.Drawing.Size(88, 21); this.cbMaxicode.TabIndex = 2; this.cbMaxicode.Text = "MaxiCode"; this.cbMaxicode.UseVisualStyleBackColor = true; this.cbMaxicode.CheckedChanged += new System.EventHandler(this.cbBarcodeFormat_CheckedChanged); // // cbAZTEC // this.cbAZTEC.AutoSize = true; this.cbAZTEC.Checked = true; this.cbAZTEC.CheckState = System.Windows.Forms.CheckState.Checked; this.cbAZTEC.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbAZTEC.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbAZTEC.Location = new System.Drawing.Point(17, 136); this.cbAZTEC.Name = "cbAZTEC"; this.cbAZTEC.Size = new System.Drawing.Size(72, 21); this.cbAZTEC.TabIndex = 2; this.cbAZTEC.Text = "AZTEC"; this.cbAZTEC.UseVisualStyleBackColor = true; this.cbAZTEC.CheckedChanged += new System.EventHandler(this.cbBarcodeFormat_CheckedChanged); // // cbPATCHCODE // this.cbPATCHCODE.AutoSize = true; this.cbPATCHCODE.Checked = true; this.cbPATCHCODE.CheckState = System.Windows.Forms.CheckState.Checked; this.cbPATCHCODE.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbPATCHCODE.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbPATCHCODE.Location = new System.Drawing.Point(17, 168); this.cbPATCHCODE.Name = "cbPATCHCODE"; this.cbPATCHCODE.Size = new System.Drawing.Size(94, 21); this.cbPATCHCODE.TabIndex = 0; this.cbPATCHCODE.Text = "Patchcode"; this.cbPATCHCODE.UseVisualStyleBackColor = true; this.cbPATCHCODE.CheckedChanged += new System.EventHandler(this.cbBarcodeFormat_CheckedChanged); // // cbGS1Composite // this.cbGS1Composite.AutoSize = true; this.cbGS1Composite.Checked = true; this.cbGS1Composite.CheckState = System.Windows.Forms.CheckState.Checked; this.cbGS1Composite.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbGS1Composite.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbGS1Composite.Location = new System.Drawing.Point(139, 168); this.cbGS1Composite.Margin = new System.Windows.Forms.Padding(0); this.cbGS1Composite.Name = "cbGS1Composite"; this.cbGS1Composite.Size = new System.Drawing.Size(125, 21); this.cbGS1Composite.TabIndex = 2; this.cbGS1Composite.Text = "GS1 Composite"; this.cbGS1Composite.UseVisualStyleBackColor = true; this.cbGS1Composite.CheckedChanged += new System.EventHandler(this.cbBarcodeFormat_CheckedChanged); // // cbDOTCODE // this.cbDOTCODE.AutoSize = true; this.cbDOTCODE.Checked = true; this.cbDOTCODE.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDOTCODE.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDOTCODE.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDOTCODE.Location = new System.Drawing.Point(17, 200); this.cbDOTCODE.Name = "cbDOTCODE"; this.cbDOTCODE.Size = new System.Drawing.Size(94, 21); this.cbDOTCODE.TabIndex = 0; this.cbDOTCODE.Text = "DotCode"; this.cbDOTCODE.UseVisualStyleBackColor = true; this.cbDOTCODE.CheckedChanged += new System.EventHandler(this.cbBarcodeFormat_CheckedChanged); // // panelOneDetail // this.panelOneDetail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(221)))), ((int)(((byte)(221)))), ((int)(((byte)(221))))); this.panelOneDetail.Controls.Add(this.cbINDUSTRIAL25); this.panelOneDetail.Controls.Add(this.cbUPCE); this.panelOneDetail.Controls.Add(this.cbUPCA); this.panelOneDetail.Controls.Add(this.cbEAN8); this.panelOneDetail.Controls.Add(this.cbCODABAR); this.panelOneDetail.Controls.Add(this.cbITF); this.panelOneDetail.Controls.Add(this.cbEAN13); this.panelOneDetail.Controls.Add(this.cbCODE93); this.panelOneDetail.Controls.Add(this.cbCODE128); this.panelOneDetail.Controls.Add(this.cbCOD39); this.panelOneDetail.Controls.Add(this.cbMSICODE); this.panelOneDetail.Location = new System.Drawing.Point(0, 109); this.panelOneDetail.Name = "panelOneDetail"; this.panelOneDetail.Size = new System.Drawing.Size(305, 188); this.panelOneDetail.TabIndex = 8; this.panelOneDetail.Visible = false; // // cbINDUSTRIAL25 // this.cbINDUSTRIAL25.AutoSize = true; this.cbINDUSTRIAL25.Checked = true; this.cbINDUSTRIAL25.CheckState = System.Windows.Forms.CheckState.Checked; this.cbINDUSTRIAL25.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbINDUSTRIAL25.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbINDUSTRIAL25.Location = new System.Drawing.Point(140, 122); this.cbINDUSTRIAL25.Name = "cbINDUSTRIAL25"; this.cbINDUSTRIAL25.Size = new System.Drawing.Size(132, 21); this.cbINDUSTRIAL25.TabIndex = 0; this.cbINDUSTRIAL25.Text = "INDUSTRIAL_25"; this.cbINDUSTRIAL25.UseVisualStyleBackColor = true; this.cbINDUSTRIAL25.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbUPCE // this.cbUPCE.AutoSize = true; this.cbUPCE.Checked = true; this.cbUPCE.CheckState = System.Windows.Forms.CheckState.Checked; this.cbUPCE.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbUPCE.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbUPCE.Location = new System.Drawing.Point(10, 122); this.cbUPCE.Name = "cbUPCE"; this.cbUPCE.Size = new System.Drawing.Size(72, 21); this.cbUPCE.TabIndex = 0; this.cbUPCE.Text = "UPC_E"; this.cbUPCE.UseVisualStyleBackColor = true; this.cbUPCE.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbUPCA // this.cbUPCA.AutoSize = true; this.cbUPCA.Checked = true; this.cbUPCA.CheckState = System.Windows.Forms.CheckState.Checked; this.cbUPCA.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbUPCA.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbUPCA.Location = new System.Drawing.Point(140, 94); this.cbUPCA.Name = "cbUPCA"; this.cbUPCA.Size = new System.Drawing.Size(72, 21); this.cbUPCA.TabIndex = 0; this.cbUPCA.Text = "UPC_A"; this.cbUPCA.UseVisualStyleBackColor = true; this.cbUPCA.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbEAN8 // this.cbEAN8.AutoSize = true; this.cbEAN8.Checked = true; this.cbEAN8.CheckState = System.Windows.Forms.CheckState.Checked; this.cbEAN8.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbEAN8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbEAN8.Location = new System.Drawing.Point(10, 94); this.cbEAN8.Name = "cbEAN8"; this.cbEAN8.Size = new System.Drawing.Size(71, 21); this.cbEAN8.TabIndex = 0; this.cbEAN8.Text = "EAN_8"; this.cbEAN8.UseVisualStyleBackColor = true; this.cbEAN8.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbCODABAR // this.cbCODABAR.AutoSize = true; this.cbCODABAR.Checked = true; this.cbCODABAR.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCODABAR.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbCODABAR.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbCODABAR.Location = new System.Drawing.Point(140, 38); this.cbCODABAR.Name = "cbCODABAR"; this.cbCODABAR.Size = new System.Drawing.Size(94, 21); this.cbCODABAR.TabIndex = 0; this.cbCODABAR.Text = "CODABAR"; this.cbCODABAR.UseVisualStyleBackColor = true; this.cbCODABAR.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbITF // this.cbITF.AutoSize = true; this.cbITF.Checked = true; this.cbITF.CheckState = System.Windows.Forms.CheckState.Checked; this.cbITF.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbITF.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbITF.Location = new System.Drawing.Point(10, 66); this.cbITF.Name = "cbITF"; this.cbITF.Size = new System.Drawing.Size(47, 21); this.cbITF.TabIndex = 0; this.cbITF.Text = "ITF"; this.cbITF.UseVisualStyleBackColor = true; this.cbITF.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbEAN13 // this.cbEAN13.AutoSize = true; this.cbEAN13.Checked = true; this.cbEAN13.CheckState = System.Windows.Forms.CheckState.Checked; this.cbEAN13.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbEAN13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbEAN13.Location = new System.Drawing.Point(140, 66); this.cbEAN13.Name = "cbEAN13"; this.cbEAN13.Size = new System.Drawing.Size(79, 21); this.cbEAN13.TabIndex = 0; this.cbEAN13.Text = "EAN_13"; this.cbEAN13.UseVisualStyleBackColor = true; this.cbEAN13.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbCODE93 // this.cbCODE93.AutoSize = true; this.cbCODE93.Checked = true; this.cbCODE93.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCODE93.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbCODE93.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbCODE93.Location = new System.Drawing.Point(140, 10); this.cbCODE93.Name = "cbCODE93"; this.cbCODE93.Size = new System.Drawing.Size(90, 21); this.cbCODE93.TabIndex = 0; this.cbCODE93.Text = "CODE_93"; this.cbCODE93.UseVisualStyleBackColor = true; this.cbCODE93.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbCODE128 // this.cbCODE128.AutoSize = true; this.cbCODE128.Checked = true; this.cbCODE128.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCODE128.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbCODE128.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbCODE128.Location = new System.Drawing.Point(10, 38); this.cbCODE128.Name = "cbCODE128"; this.cbCODE128.Size = new System.Drawing.Size(98, 21); this.cbCODE128.TabIndex = 0; this.cbCODE128.Text = "CODE_128"; this.cbCODE128.UseVisualStyleBackColor = true; this.cbCODE128.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbCOD39 // this.cbCOD39.AutoSize = true; this.cbCOD39.Checked = true; this.cbCOD39.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCOD39.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbCOD39.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbCOD39.Location = new System.Drawing.Point(10, 10); this.cbCOD39.Name = "cbCOD39"; this.cbCOD39.Size = new System.Drawing.Size(90, 21); this.cbCOD39.TabIndex = 0; this.cbCOD39.Text = "CODE_39"; this.cbCOD39.UseVisualStyleBackColor = true; this.cbCOD39.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // cbMSICODE // this.cbMSICODE.AutoSize = true; this.cbMSICODE.Checked = true; this.cbMSICODE.CheckState = System.Windows.Forms.CheckState.Checked; this.cbMSICODE.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbMSICODE.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbMSICODE.Location = new System.Drawing.Point(10, 150); this.cbMSICODE.Name = "cbMSICODE"; this.cbMSICODE.Size = new System.Drawing.Size(90, 21); this.cbMSICODE.TabIndex = 0; this.cbMSICODE.Text = "MSI CODE"; this.cbMSICODE.UseVisualStyleBackColor = true; this.cbMSICODE.CheckedChanged += new System.EventHandler(this.rbOneMode_CheckedChanged); // // panelDatabarDetail // this.panelDatabarDetail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(221)))), ((int)(((byte)(221)))), ((int)(((byte)(221))))); this.panelDatabarDetail.Controls.Add(this.cbDatabarOmnidirectional); this.panelDatabarDetail.Controls.Add(this.cbDatabarExpanded); this.panelDatabarDetail.Controls.Add(this.cbDatabarExpanedStacked); this.panelDatabarDetail.Controls.Add(this.cbDatabarLimited); this.panelDatabarDetail.Controls.Add(this.cbDatabarStacked); this.panelDatabarDetail.Controls.Add(this.cbDatabarStackedOmnidirectional); this.panelDatabarDetail.Controls.Add(this.cbDatabarTruncated); this.panelDatabarDetail.Location = new System.Drawing.Point(0, 109); this.panelDatabarDetail.Name = "panelDatabarDetail"; this.panelDatabarDetail.Size = new System.Drawing.Size(305, 224); this.panelDatabarDetail.TabIndex = 8; this.panelDatabarDetail.Visible = false; // // cbDatabarOmnidirectional // this.cbDatabarOmnidirectional.AutoSize = true; this.cbDatabarOmnidirectional.Checked = true; this.cbDatabarOmnidirectional.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarOmnidirectional.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarOmnidirectional.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarOmnidirectional.Location = new System.Drawing.Point(10, 10); this.cbDatabarOmnidirectional.Name = "cbDatabarOmnidirectional"; this.cbDatabarOmnidirectional.Size = new System.Drawing.Size(212, 21); this.cbDatabarOmnidirectional.TabIndex = 0; this.cbDatabarOmnidirectional.Text = "GS1 Databar Omnidirectional"; this.cbDatabarOmnidirectional.UseVisualStyleBackColor = true; this.cbDatabarOmnidirectional.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // cbDatabarExpanded // this.cbDatabarExpanded.AutoSize = true; this.cbDatabarExpanded.Checked = true; this.cbDatabarExpanded.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarExpanded.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarExpanded.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarExpanded.Location = new System.Drawing.Point(10, 38); this.cbDatabarExpanded.Name = "cbDatabarExpanded"; this.cbDatabarExpanded.Size = new System.Drawing.Size(177, 21); this.cbDatabarExpanded.TabIndex = 0; this.cbDatabarExpanded.Text = "GS1 Databar Expanded"; this.cbDatabarExpanded.UseVisualStyleBackColor = true; this.cbDatabarExpanded.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // cbDatabarExpanedStacked // this.cbDatabarExpanedStacked.AutoSize = true; this.cbDatabarExpanedStacked.Checked = true; this.cbDatabarExpanedStacked.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarExpanedStacked.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarExpanedStacked.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarExpanedStacked.Location = new System.Drawing.Point(10, 66); this.cbDatabarExpanedStacked.Name = "cbDatabarExpanedStacked"; this.cbDatabarExpanedStacked.Size = new System.Drawing.Size(224, 21); this.cbDatabarExpanedStacked.TabIndex = 0; this.cbDatabarExpanedStacked.Text = "GS1 Databar Expaned Stacked"; this.cbDatabarExpanedStacked.UseVisualStyleBackColor = true; this.cbDatabarExpanedStacked.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // cbDatabarLimited // this.cbDatabarLimited.AutoSize = true; this.cbDatabarLimited.Checked = true; this.cbDatabarLimited.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarLimited.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarLimited.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarLimited.Location = new System.Drawing.Point(10, 94); this.cbDatabarLimited.Name = "cbDatabarLimited"; this.cbDatabarLimited.Size = new System.Drawing.Size(159, 21); this.cbDatabarLimited.TabIndex = 0; this.cbDatabarLimited.Text = "GS1 Databar Limited"; this.cbDatabarLimited.UseVisualStyleBackColor = true; this.cbDatabarLimited.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // cbDatabarStacked // this.cbDatabarStacked.AutoSize = true; this.cbDatabarStacked.Checked = true; this.cbDatabarStacked.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarStacked.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarStacked.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarStacked.Location = new System.Drawing.Point(10, 122); this.cbDatabarStacked.Name = "cbDatabarStacked"; this.cbDatabarStacked.Size = new System.Drawing.Size(165, 21); this.cbDatabarStacked.TabIndex = 0; this.cbDatabarStacked.Text = "GS1 Databar Stacked"; this.cbDatabarStacked.UseVisualStyleBackColor = true; this.cbDatabarStacked.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // cbDatabarStackedOmnidirectional // this.cbDatabarStackedOmnidirectional.AutoSize = true; this.cbDatabarStackedOmnidirectional.Checked = true; this.cbDatabarStackedOmnidirectional.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarStackedOmnidirectional.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarStackedOmnidirectional.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarStackedOmnidirectional.Location = new System.Drawing.Point(10, 150); this.cbDatabarStackedOmnidirectional.Name = "cbDatabarStackedOmnidirectional"; this.cbDatabarStackedOmnidirectional.Size = new System.Drawing.Size(267, 21); this.cbDatabarStackedOmnidirectional.TabIndex = 0; this.cbDatabarStackedOmnidirectional.Text = "GS1 Databar Stacked Omnidirectional"; this.cbDatabarStackedOmnidirectional.UseVisualStyleBackColor = true; this.cbDatabarStackedOmnidirectional.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // cbDatabarTruncated // this.cbDatabarTruncated.AutoSize = true; this.cbDatabarTruncated.Checked = true; this.cbDatabarTruncated.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDatabarTruncated.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbDatabarTruncated.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbDatabarTruncated.Location = new System.Drawing.Point(10, 178); this.cbDatabarTruncated.Name = "cbDatabarTruncated"; this.cbDatabarTruncated.Size = new System.Drawing.Size(179, 21); this.cbDatabarTruncated.TabIndex = 0; this.cbDatabarTruncated.Text = "GS1 Databar Truncated"; this.cbDatabarTruncated.UseVisualStyleBackColor = true; this.cbDatabarTruncated.CheckedChanged += new System.EventHandler(this.rbDatabarMode_CheckedChanged); // // panelCustom // this.panelCustom.BackColor = System.Drawing.Color.Transparent; this.panelCustom.Controls.Add(this.panelCustomTop); this.panelCustom.Controls.Add(this.label18); this.panelCustom.Controls.Add(this.panelCustomSettings); this.panelCustom.Location = new System.Drawing.Point(3, 3); this.panelCustom.Name = "panelCustom"; this.panelCustom.Size = new System.Drawing.Size(310, 564); this.panelCustom.TabIndex = 652; // // panelCustomTop // this.panelCustomTop.Controls.Add(this.panelBarcodeReaderParent); this.panelCustomTop.Controls.Add(this.lbCustomPanelClose); this.panelCustomTop.Location = new System.Drawing.Point(0, 0); this.panelCustomTop.Name = "panelCustomTop"; this.panelCustomTop.Size = new System.Drawing.Size(310, 55); this.panelCustomTop.TabIndex = 6; // // panelBarcodeReaderParent // this.panelBarcodeReaderParent.Location = new System.Drawing.Point(19, 11); this.panelBarcodeReaderParent.Name = "panelBarcodeReaderParent"; this.panelBarcodeReaderParent.Size = new System.Drawing.Size(153, 34); this.panelBarcodeReaderParent.TabIndex = 6; // // lbCustomPanelClose // this.lbCustomPanelClose.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.icon_closed; this.lbCustomPanelClose.Location = new System.Drawing.Point(277, 22); this.lbCustomPanelClose.Name = "lbCustomPanelClose"; this.lbCustomPanelClose.Size = new System.Drawing.Size(14, 15); this.lbCustomPanelClose.TabIndex = 5; this.lbCustomPanelClose.Click += new System.EventHandler(this.pbCloseCustomPanel_Click); this.lbCustomPanelClose.MouseLeave += new System.EventHandler(this.lbCustomPanelClose_MouseLeave); this.lbCustomPanelClose.MouseHover += new System.EventHandler(this.lbCustomPanelClose_MouseHover); // // label18 // this.label18.BackColor = System.Drawing.SystemColors.ControlDark; this.label18.Location = new System.Drawing.Point(1, 55); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(280, 1); this.label18.TabIndex = 4; // // panelCustomSettings // this.panelCustomSettings.AutoScroll = true; this.panelCustomSettings.Controls.Add(this.panelFormatParent); this.panelCustomSettings.Controls.Add(this.label17); this.panelCustomSettings.Controls.Add(this.panelSettings); this.panelCustomSettings.Location = new System.Drawing.Point(0, 56); this.panelCustomSettings.Name = "panelCustomSettings"; this.panelCustomSettings.Size = new System.Drawing.Size(305, 374); this.panelCustomSettings.TabIndex = 0; // // panelFormatParent // this.panelFormatParent.Location = new System.Drawing.Point(0, 0); this.panelFormatParent.Name = "panelFormatParent"; this.panelFormatParent.Size = new System.Drawing.Size(285, 244); this.panelFormatParent.TabIndex = 3; // // label17 // this.label17.BackColor = System.Drawing.SystemColors.ControlDark; this.label17.Location = new System.Drawing.Point(0, 245); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(280, 1); this.label17.TabIndex = 2; // // panelSettings // this.panelSettings.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.panelSettings.Controls.Add(this.label12); this.panelSettings.Controls.Add(this.label11); this.panelSettings.Controls.Add(this.label10); this.panelSettings.Controls.Add(this.cmbTextureDetectionSensitivity); this.panelSettings.Controls.Add(this.cmbMinResultConfidence); this.panelSettings.Controls.Add(this.cmbImagePreprocessingModes); this.panelSettings.Controls.Add(this.cmbGrayscaleTransformationModes); this.panelSettings.Controls.Add(this.label9); this.panelSettings.Controls.Add(this.label8); this.panelSettings.Controls.Add(this.tbBinarizationBlockSize); this.panelSettings.Controls.Add(this.tbScaleDownThreshold); this.panelSettings.Controls.Add(this.label7); this.panelSettings.Controls.Add(this.cbRegionPredetectionMode); this.panelSettings.Controls.Add(this.cbTextFilterMode); this.panelSettings.Controls.Add(this.cmbLocalizationModes); this.panelSettings.Controls.Add(this.label5); this.panelSettings.Controls.Add(this.cmbDeblurLevel); this.panelSettings.Controls.Add(this.label4); this.panelSettings.Controls.Add(this.tbExpectedBarcodesCount); this.panelSettings.Controls.Add(this.label3); this.panelSettings.Location = new System.Drawing.Point(0, 248); this.panelSettings.Name = "panelSettings"; this.panelSettings.Size = new System.Drawing.Size(285, 683); this.panelSettings.TabIndex = 1; // // label12 // this.label12.AutoSize = true; this.label12.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label12.Location = new System.Drawing.Point(17, 619); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(159, 17); this.label12.TabIndex = 13; this.label12.Text = "Binarization Block Size: "; // // label11 // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label11.Location = new System.Drawing.Point(16, 547); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(195, 17); this.label11.TabIndex = 13; this.label11.Text = "Texture Detection Sensitivity: "; // // label10 // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label10.Location = new System.Drawing.Point(19, 478); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(157, 17); this.label10.TabIndex = 13; this.label10.Text = "Min Result Confidence: "; // // cmbTextureDetectionSensitivity // this.cmbTextureDetectionSensitivity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbTextureDetectionSensitivity.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cmbTextureDetectionSensitivity.FormattingEnabled = true; this.cmbTextureDetectionSensitivity.Items.AddRange(new object[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}); this.cmbTextureDetectionSensitivity.Location = new System.Drawing.Point(19, 572); this.cmbTextureDetectionSensitivity.Name = "cmbTextureDetectionSensitivity"; this.cmbTextureDetectionSensitivity.Size = new System.Drawing.Size(258, 25); this.cmbTextureDetectionSensitivity.TabIndex = 12; this.cmbTextureDetectionSensitivity.SelectedIndexChanged += new System.EventHandler(this.cmbTextureDetectionSensitivity_SelectedIndexChanged); // // cmbMinResultConfidence // this.cmbMinResultConfidence.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbMinResultConfidence.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cmbMinResultConfidence.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cmbMinResultConfidence.FormattingEnabled = true; this.cmbMinResultConfidence.Items.AddRange(new object[] { "0 - No limitation", "10", "20", "30", "40", "50", "60", "70", "80", "90"}); this.cmbMinResultConfidence.Location = new System.Drawing.Point(19, 501); this.cmbMinResultConfidence.Name = "cmbMinResultConfidence"; this.cmbMinResultConfidence.Size = new System.Drawing.Size(258, 25); this.cmbMinResultConfidence.TabIndex = 12; this.cmbMinResultConfidence.SelectedIndexChanged += new System.EventHandler(this.cmbMinResultConfidence_SelectedIndexChanged); // // cmbImagePreprocessingModes // this.cmbImagePreprocessingModes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbImagePreprocessingModes.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cmbImagePreprocessingModes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cmbImagePreprocessingModes.FormattingEnabled = true; this.cmbImagePreprocessingModes.Items.AddRange(new object[] { "General", "Gray Equalization", "Gray Smoothing", "Sharpening and Smoothing"}); this.cmbImagePreprocessingModes.Location = new System.Drawing.Point(19, 432); this.cmbImagePreprocessingModes.Name = "cmbImagePreprocessingModes"; this.cmbImagePreprocessingModes.Size = new System.Drawing.Size(258, 25); this.cmbImagePreprocessingModes.TabIndex = 12; this.cmbImagePreprocessingModes.SelectedIndexChanged += new System.EventHandler(this.cmbImagePreprocessingModes_SelectedIndexChanged); // // cmbGrayscaleTransformationModes // this.cmbGrayscaleTransformationModes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbGrayscaleTransformationModes.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cmbGrayscaleTransformationModes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cmbGrayscaleTransformationModes.FormattingEnabled = true; this.cmbGrayscaleTransformationModes.Items.AddRange(new object[] { "Original + Inverted", "Inverted", "Original"}); this.cmbGrayscaleTransformationModes.Location = new System.Drawing.Point(19, 366); this.cmbGrayscaleTransformationModes.Name = "cmbGrayscaleTransformationModes"; this.cmbGrayscaleTransformationModes.Size = new System.Drawing.Size(258, 25); this.cmbGrayscaleTransformationModes.TabIndex = 12; this.cmbGrayscaleTransformationModes.SelectedIndexChanged += new System.EventHandler(this.cmbGrayscaleTransformationModes_SelectedIndexChanged); // // label9 // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label9.Location = new System.Drawing.Point(19, 408); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(176, 17); this.label9.TabIndex = 11; this.label9.Text = "Image Preprocess Modes: "; // // label8 // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label8.Location = new System.Drawing.Point(19, 341); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(238, 18); this.label8.TabIndex = 11; this.label8.Text = "Grayscale Transformation Modes: "; // // tbBinarizationBlockSize // this.tbBinarizationBlockSize.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.tbBinarizationBlockSize.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.tbBinarizationBlockSize.Location = new System.Drawing.Point(21, 645); this.tbBinarizationBlockSize.MaxLength = 10; this.tbBinarizationBlockSize.Name = "tbBinarizationBlockSize"; this.tbBinarizationBlockSize.Size = new System.Drawing.Size(258, 23); this.tbBinarizationBlockSize.TabIndex = 10; this.tbBinarizationBlockSize.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxNumberOnly_KeyPress); // // tbScaleDownThreshold // this.tbScaleDownThreshold.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.tbScaleDownThreshold.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.tbScaleDownThreshold.Location = new System.Drawing.Point(19, 300); this.tbScaleDownThreshold.MaxLength = 10; this.tbScaleDownThreshold.Name = "tbScaleDownThreshold"; this.tbScaleDownThreshold.Size = new System.Drawing.Size(258, 23); this.tbScaleDownThreshold.TabIndex = 10; this.tbScaleDownThreshold.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxNumberOnly_KeyPress); this.tbScaleDownThreshold.Leave += new System.EventHandler(this.tbScaleDownThreshold_OnLeave); // // label7 // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label7.Location = new System.Drawing.Point(19, 275); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(158, 17); this.label7.TabIndex = 9; this.label7.Text = "Scale Down Threshold: "; // // cbRegionPredetectionMode // this.cbRegionPredetectionMode.AutoSize = true; this.cbRegionPredetectionMode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbRegionPredetectionMode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbRegionPredetectionMode.Location = new System.Drawing.Point(19, 243); this.cbRegionPredetectionMode.Name = "cbRegionPredetectionMode"; this.cbRegionPredetectionMode.Size = new System.Drawing.Size(224, 21); this.cbRegionPredetectionMode.TabIndex = 8; this.cbRegionPredetectionMode.Text = "Use Region Predetection Mode"; this.cbRegionPredetectionMode.UseVisualStyleBackColor = true; // // cbTextFilterMode // this.cbTextFilterMode.AutoSize = true; this.cbTextFilterMode.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(171)))), ((int)(((byte)(171))))); this.cbTextFilterMode.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbTextFilterMode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbTextFilterMode.Location = new System.Drawing.Point(19, 210); this.cbTextFilterMode.Name = "cbTextFilterMode"; this.cbTextFilterMode.Size = new System.Drawing.Size(157, 21); this.cbTextFilterMode.TabIndex = 7; this.cbTextFilterMode.Text = "Use Text Filter Mode"; this.cbTextFilterMode.UseVisualStyleBackColor = true; // // cmbLocalizationModes // this.cmbLocalizationModes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbLocalizationModes.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cmbLocalizationModes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cmbLocalizationModes.FormattingEnabled = true; this.cmbLocalizationModes.Items.AddRange(new object[] { "Default", "Connected blocks", "Statistics", "Lines", "Scan directly", "Connected blocks + Scan directly"}); this.cmbLocalizationModes.Location = new System.Drawing.Point(19, 169); this.cmbLocalizationModes.Name = "cmbLocalizationModes"; this.cmbLocalizationModes.Size = new System.Drawing.Size(258, 25); this.cmbLocalizationModes.TabIndex = 5; this.cmbLocalizationModes.SelectedIndexChanged += new System.EventHandler(this.cmbLocalizationModes_SelectedIndexChanged); // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label5.Location = new System.Drawing.Point(18, 141); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(133, 18); this.label5.TabIndex = 4; this.label5.Text = "Localization Mode:"; // // cmbDeblurLevel // this.cmbDeblurLevel.BackColor = System.Drawing.SystemColors.Window; this.cmbDeblurLevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbDeblurLevel.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cmbDeblurLevel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cmbDeblurLevel.FormattingEnabled = true; this.cmbDeblurLevel.Items.AddRange(new object[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}); this.cmbDeblurLevel.Location = new System.Drawing.Point(19, 101); this.cmbDeblurLevel.Name = "cmbDeblurLevel"; this.cmbDeblurLevel.Size = new System.Drawing.Size(258, 25); this.cmbDeblurLevel.TabIndex = 3; this.cmbDeblurLevel.SelectedIndexChanged += new System.EventHandler(this.cmbDeblurLevel_SelectedIndexChanged); // // label4 // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label4.Location = new System.Drawing.Point(18, 75); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(88, 17); this.label4.TabIndex = 2; this.label4.Text = "DeblurLevel:"; // // tbExpectedBarcodesCount // this.tbExpectedBarcodesCount.BackColor = System.Drawing.Color.White; this.tbExpectedBarcodesCount.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.tbExpectedBarcodesCount.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.tbExpectedBarcodesCount.Location = new System.Drawing.Point(19, 39); this.tbExpectedBarcodesCount.MaxLength = 10; this.tbExpectedBarcodesCount.Name = "tbExpectedBarcodesCount"; this.tbExpectedBarcodesCount.Size = new System.Drawing.Size(258, 23); this.tbExpectedBarcodesCount.TabIndex = 1; this.tbExpectedBarcodesCount.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxNumberOnly_KeyPress); // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label3.Location = new System.Drawing.Point(18, 15); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(175, 17); this.label3.TabIndex = 0; this.label3.Text = "Expected Barcodes Count:"; // // panelLoad // this.panelLoad.BackColor = System.Drawing.Color.Transparent; this.panelLoad.Controls.Add(this.label24); this.panelLoad.Controls.Add(this.picboxLoadImage); this.panelLoad.Controls.Add(this.label1); this.panelLoad.Location = new System.Drawing.Point(0, 45); this.panelLoad.Margin = new System.Windows.Forms.Padding(0); this.panelLoad.Name = "panelLoad"; this.panelLoad.Size = new System.Drawing.Size(310, 175); this.panelLoad.TabIndex = 3; this.panelLoad.Visible = false; // // label24 // this.label24.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label24.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label24.ImageAlign = System.Drawing.ContentAlignment.TopLeft; this.label24.Location = new System.Drawing.Point(4, 118); this.label24.Margin = new System.Windows.Forms.Padding(0); this.label24.Name = "label24"; this.label24.Size = new System.Drawing.Size(310, 60); this.label24.TabIndex = 0; this.label24.Text = "Note: Dynamic .NET TWAIN license is required for loading and previewing images, acquiring images from scanners and cameras."; // // picboxLoadImage // this.picboxLoadImage.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxLoadImage_Leave; this.picboxLoadImage.InitialImage = null; this.picboxLoadImage.Location = new System.Drawing.Point(78, 67); this.picboxLoadImage.Name = "picboxLoadImage"; this.picboxLoadImage.Size = new System.Drawing.Size(154, 36); this.picboxLoadImage.TabIndex = 1; this.picboxLoadImage.TabStop = false; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Open Sans", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.label1.Location = new System.Drawing.Point(38, 22); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(222, 20); this.label1.TabIndex = 0; this.label1.Text = "Load local images or PDF files"; // // panelWebCam // this.panelWebCam.BackColor = System.Drawing.Color.Transparent; this.panelWebCam.Controls.Add(this.labelWebcamNote); this.panelWebCam.Controls.Add(this.lblWebCamSrc); this.panelWebCam.Controls.Add(this.cbxWebCamSrc); this.panelWebCam.Controls.Add(this.lblWebCamRes); this.panelWebCam.Controls.Add(this.cbxWebCamRes); this.panelWebCam.Location = new System.Drawing.Point(0, 45); this.panelWebCam.Margin = new System.Windows.Forms.Padding(0); this.panelWebCam.Name = "panelWebCam"; this.panelWebCam.Size = new System.Drawing.Size(300, 175); this.panelWebCam.TabIndex = 3; this.panelWebCam.Visible = false; // // labelWebcamNote // this.labelWebcamNote.Font = new System.Drawing.Font("Open Sans", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.labelWebcamNote.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.labelWebcamNote.ImageAlign = System.Drawing.ContentAlignment.TopLeft; this.labelWebcamNote.Location = new System.Drawing.Point(16, 93); this.labelWebcamNote.Name = "labelWebcamNote"; this.labelWebcamNote.Size = new System.Drawing.Size(275, 80); this.labelWebcamNote.TabIndex = 0; this.labelWebcamNote.Text = "Note: Please place a barcode in front of \r\nyour webcam and then click “Read Barco" + "de” \r\nbutton. It will decode barcodes from camera \r\nstream directly."; this.labelWebcamNote.Click += new System.EventHandler(this.labelWebcamNote_Click); // // lblWebCamSrc // this.lblWebCamSrc.AutoSize = true; this.lblWebCamSrc.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lblWebCamSrc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.lblWebCamSrc.Location = new System.Drawing.Point(20, 21); this.lblWebCamSrc.Name = "lblWebCamSrc"; this.lblWebCamSrc.Size = new System.Drawing.Size(116, 17); this.lblWebCamSrc.TabIndex = 0; this.lblWebCamSrc.Text = "Webcam Source:"; // // cbxWebCamSrc // this.cbxWebCamSrc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbxWebCamSrc.DropDownWidth = 145; this.cbxWebCamSrc.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbxWebCamSrc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cbxWebCamSrc.FormattingEnabled = true; this.cbxWebCamSrc.Location = new System.Drawing.Point(148, 18); this.cbxWebCamSrc.Name = "cbxWebCamSrc"; this.cbxWebCamSrc.Size = new System.Drawing.Size(145, 25); this.cbxWebCamSrc.TabIndex = 13; // // lblWebCamRes // this.lblWebCamRes.AutoSize = true; this.lblWebCamRes.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lblWebCamRes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.lblWebCamRes.Location = new System.Drawing.Point(20, 60); this.lblWebCamRes.Name = "lblWebCamRes"; this.lblWebCamRes.Size = new System.Drawing.Size(138, 17); this.lblWebCamRes.TabIndex = 12; this.lblWebCamRes.Text = "Webcam Resolution:"; // // cbxWebCamRes // this.cbxWebCamRes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbxWebCamRes.DropDownWidth = 120; this.cbxWebCamRes.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbxWebCamRes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cbxWebCamRes.FormattingEnabled = true; this.cbxWebCamRes.Location = new System.Drawing.Point(173, 57); this.cbxWebCamRes.Name = "cbxWebCamRes"; this.cbxWebCamRes.Size = new System.Drawing.Size(120, 25); this.cbxWebCamRes.TabIndex = 13; // // panelAcquire // this.panelAcquire.BackColor = System.Drawing.Color.Transparent; this.panelAcquire.Controls.Add(this.rdbtnGray); this.panelAcquire.Controls.Add(this.cbxResolution); this.panelAcquire.Controls.Add(this.picboxScan); this.panelAcquire.Controls.Add(this.rdbtnBW); this.panelAcquire.Controls.Add(this.lbResolution); this.panelAcquire.Controls.Add(this.rdbtnColor); this.panelAcquire.Controls.Add(this.lbPixelType); this.panelAcquire.Controls.Add(this.lbSelectSource); this.panelAcquire.Controls.Add(this.cbxSource); this.panelAcquire.Location = new System.Drawing.Point(0, 45); this.panelAcquire.Margin = new System.Windows.Forms.Padding(0); this.panelAcquire.Name = "panelAcquire"; this.panelAcquire.Size = new System.Drawing.Size(310, 175); this.panelAcquire.TabIndex = 2; // // rdbtnGray // this.rdbtnGray.AutoSize = true; this.rdbtnGray.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.rdbtnGray.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.rdbtnGray.Location = new System.Drawing.Point(170, 52); this.rdbtnGray.Name = "rdbtnGray"; this.rdbtnGray.Size = new System.Drawing.Size(57, 21); this.rdbtnGray.TabIndex = 641; this.rdbtnGray.TabStop = true; this.rdbtnGray.Text = "Gray"; this.rdbtnGray.UseVisualStyleBackColor = true; // // cbxResolution // this.cbxResolution.BackColor = System.Drawing.SystemColors.Window; this.cbxResolution.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbxResolution.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbxResolution.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.cbxResolution.FormattingEnabled = true; this.cbxResolution.Location = new System.Drawing.Point(104, 86); this.cbxResolution.Name = "cbxResolution"; this.cbxResolution.Size = new System.Drawing.Size(168, 25); this.cbxResolution.TabIndex = 643; // // picboxScan // this.picboxScan.Enabled = false; this.picboxScan.Location = new System.Drawing.Point(78, 126); this.picboxScan.Name = "picboxScan"; this.picboxScan.Size = new System.Drawing.Size(154, 36); this.picboxScan.TabIndex = 85; this.picboxScan.TabStop = false; this.picboxScan.Tag = "Scan Image"; this.picboxScan.Click += new System.EventHandler(this.picboxScan_Click); this.picboxScan.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxScan.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxScan.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxScan.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // rdbtnBW // this.rdbtnBW.AutoSize = true; this.rdbtnBW.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.rdbtnBW.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.rdbtnBW.Location = new System.Drawing.Point(101, 52); this.rdbtnBW.Name = "rdbtnBW"; this.rdbtnBW.Size = new System.Drawing.Size(65, 21); this.rdbtnBW.TabIndex = 640; this.rdbtnBW.TabStop = true; this.rdbtnBW.Text = "B && W"; this.rdbtnBW.UseVisualStyleBackColor = true; // // lbResolution // this.lbResolution.AutoSize = true; this.lbResolution.BackColor = System.Drawing.Color.Transparent; this.lbResolution.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lbResolution.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.lbResolution.Location = new System.Drawing.Point(15, 90); this.lbResolution.Name = "lbResolution"; this.lbResolution.Size = new System.Drawing.Size(83, 17); this.lbResolution.TabIndex = 83; this.lbResolution.Text = "Resolution :"; // // rdbtnColor // this.rdbtnColor.AutoSize = true; this.rdbtnColor.BackColor = System.Drawing.Color.Transparent; this.rdbtnColor.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.rdbtnColor.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.rdbtnColor.Location = new System.Drawing.Point(232, 52); this.rdbtnColor.Name = "rdbtnColor"; this.rdbtnColor.Size = new System.Drawing.Size(59, 21); this.rdbtnColor.TabIndex = 642; this.rdbtnColor.TabStop = true; this.rdbtnColor.Text = "Color"; this.rdbtnColor.UseVisualStyleBackColor = false; // // lbPixelType // this.lbPixelType.AutoSize = true; this.lbPixelType.BackColor = System.Drawing.Color.Transparent; this.lbPixelType.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lbPixelType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.lbPixelType.Location = new System.Drawing.Point(15, 52); this.lbPixelType.Name = "lbPixelType"; this.lbPixelType.Size = new System.Drawing.Size(81, 17); this.lbPixelType.TabIndex = 87; this.lbPixelType.Text = "Pixel Type :"; // // lbSelectSource // this.lbSelectSource.AutoSize = true; this.lbSelectSource.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.lbSelectSource.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.lbSelectSource.Location = new System.Drawing.Point(15, 15); this.lbSelectSource.Name = "lbSelectSource"; this.lbSelectSource.Size = new System.Drawing.Size(118, 17); this.lbSelectSource.TabIndex = 84; this.lbSelectSource.Text = "Scanner Source :"; // // cbxSource // this.cbxSource.BackColor = System.Drawing.SystemColors.Window; this.cbxSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbxSource.DropDownWidth = 180; this.cbxSource.Font = new System.Drawing.Font("Open Sans", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); this.cbxSource.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.cbxSource.FormattingEnabled = true; this.cbxSource.Location = new System.Drawing.Point(140, 13); this.cbxSource.Name = "cbxSource"; this.cbxSource.Size = new System.Drawing.Size(158, 25); this.cbxSource.TabIndex = 639; // // lbSelectRecognitionMode // this.lbSelectRecognitionMode.AutoSize = true; this.lbSelectRecognitionMode.BackColor = System.Drawing.Color.Transparent; this.lbSelectRecognitionMode.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbSelectRecognitionMode.Location = new System.Drawing.Point(10, 50); this.lbSelectRecognitionMode.Name = "lbSelectRecognitionMode"; this.lbSelectRecognitionMode.Size = new System.Drawing.Size(111, 15); this.lbSelectRecognitionMode.TabIndex = 84; this.lbSelectRecognitionMode.Text = "Recognition Mode :"; // // panelReadSetting // this.panelReadSetting.BackColor = System.Drawing.Color.Transparent; this.panelReadSetting.Controls.Add(this.label6); this.panelReadSetting.Controls.Add(this.lbSelectRecognitionMode); this.panelReadSetting.Location = new System.Drawing.Point(1, 41); this.panelReadSetting.Margin = new System.Windows.Forms.Padding(0); this.panelReadSetting.Name = "panelReadSetting"; this.panelReadSetting.Size = new System.Drawing.Size(300, 80); this.panelReadSetting.TabIndex = 2; // // label6 // this.label6.AutoSize = true; this.label6.BackColor = System.Drawing.Color.Transparent; this.label6.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.Location = new System.Drawing.Point(10, 20); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(95, 15); this.label6.TabIndex = 2; this.label6.Text = "Barcode format :"; // // panelReadMoreSetting // this.panelReadMoreSetting.BackColor = System.Drawing.Color.Transparent; this.panelReadMoreSetting.Location = new System.Drawing.Point(1, 41); this.panelReadMoreSetting.Margin = new System.Windows.Forms.Padding(0); this.panelReadMoreSetting.Name = "panelReadMoreSetting"; this.panelReadMoreSetting.Size = new System.Drawing.Size(300, 290); this.panelReadMoreSetting.TabIndex = 3; this.panelReadMoreSetting.Visible = false; // // picboxFit // this.picboxFit.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxFit_Leave; this.picboxFit.Location = new System.Drawing.Point(12, 60); this.picboxFit.Name = "picboxFit"; this.picboxFit.Size = new System.Drawing.Size(61, 36); this.picboxFit.TabIndex = 88; this.picboxFit.TabStop = false; this.picboxFit.Tag = "Fit Window Size"; this.picboxFit.Click += new System.EventHandler(this.picboxFit_Click); this.picboxFit.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxFit.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxFit.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxFit.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxFit.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // picboxOriginalSize // this.picboxOriginalSize.Image = global::DecodeFromScannerAndWebcam.Properties.Resources.picboxOriginalSize_Leave; this.picboxOriginalSize.Location = new System.Drawing.Point(12, 108); this.picboxOriginalSize.Name = "picboxOriginalSize"; this.picboxOriginalSize.Size = new System.Drawing.Size(60, 36); this.picboxOriginalSize.TabIndex = 87; this.picboxOriginalSize.TabStop = false; this.picboxOriginalSize.Tag = "Original Size"; this.picboxOriginalSize.Click += new System.EventHandler(this.picboxOriginalSize_Click); this.picboxOriginalSize.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseDown); this.picboxOriginalSize.MouseEnter += new System.EventHandler(this.picbox_MouseEnter); this.picboxOriginalSize.MouseLeave += new System.EventHandler(this.picbox_MouseLeave); this.picboxOriginalSize.MouseHover += new System.EventHandler(this.picbox_MouseHover); this.picboxOriginalSize.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picbox_MouseUp); // // tbxResult // this.tbxResult.BackColor = System.Drawing.Color.White; this.tbxResult.Location = new System.Drawing.Point(1, 26); this.tbxResult.Margin = new System.Windows.Forms.Padding(0); this.tbxResult.Multiline = true; this.tbxResult.Name = "tbxResult"; this.tbxResult.ReadOnly = true; this.tbxResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.tbxResult.Size = new System.Drawing.Size(309, 634); this.tbxResult.TabIndex = 184; // // lblCloseResult // this.lblCloseResult.BackColor = System.Drawing.SystemColors.Control; this.lblCloseResult.Location = new System.Drawing.Point(290, 5); this.lblCloseResult.Name = "lblCloseResult"; this.lblCloseResult.Size = new System.Drawing.Size(16, 16); this.lblCloseResult.TabIndex = 0; this.lblCloseResult.Text = "X"; this.lblCloseResult.Click += new System.EventHandler(this.lblCloseResult_Click); this.lblCloseResult.MouseLeave += new System.EventHandler(this.lblCloseResult_MouseLeave); this.lblCloseResult.MouseHover += new System.EventHandler(this.lblCloseResult_MouseHover); // // dsViewer // this.dsViewer.Location = new System.Drawing.Point(86, 50); this.dsViewer.Name = "dsViewer"; this.dsViewer.RightToLeft = System.Windows.Forms.RightToLeft.No; this.dsViewer.SelectionRectAspectRatio = 0D; this.dsViewer.Size = new System.Drawing.Size(477, 650); this.dsViewer.TabIndex = 651; this.dsViewer.OnMouseClick += new Dynamsoft.Forms.Delegate.OnMouseClickHandler(this.dsViewer_OnMouseClick); // // saveRuntimeSettingsFileDialog // this.saveRuntimeSettingsFileDialog.Filter = "|*.json"; this.saveRuntimeSettingsFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.saveRuntimeSettingsFileDialog_FileOk); // // DecodeFromScannerAndWebcam // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Control; this.BackgroundImage = global::DecodeFromScannerAndWebcam.Properties.Resources.main_bg; this.ClientSize = new System.Drawing.Size(898, 762); this.Controls.Add(this.dsViewer); this.Controls.Add(this.picboxFit); this.Controls.Add(this.picboxOriginalSize); this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.tbxTotalImageNum); this.Controls.Add(this.tbxCurrentImageIndex); this.Controls.Add(this.lbDiv); this.Controls.Add(this.picboxClose); this.Controls.Add(this.picboxMin); this.Controls.Add(this.cbxViewMode); this.Controls.Add(this.picboxPrevious); this.Controls.Add(this.picboxNext); this.Controls.Add(this.picboxLast); this.Controls.Add(this.picboxFirst); this.Controls.Add(this.lbMoveBar); this.Controls.Add(this.picboxDeleteAll); this.Controls.Add(this.picboxDelete); this.Controls.Add(this.picboxZoomOut); this.Controls.Add(this.picboxZoomIn); this.Controls.Add(this.picBoxWebCam); this.DoubleBuffered = true; this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Margin = new System.Windows.Forms.Padding(4); this.Name = "DecodeFromScannerAndWebcam"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Dynamsoft Barcode Reader Demo"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DecodeFromScannerAndWebcam_FormClosing); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.DecodeFromScannerAndWebcam_FormClosed); this.Load += new System.EventHandler(this.DotNetTWAINDemo_Load); ((System.ComponentModel.ISupportInitialize)(this.picBoxWebCam)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxZoomOut)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxZoomIn)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxDeleteAll)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxDelete)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxFirst)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxLast)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxNext)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxPrevious)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxClose)).EndInit(); this.flowLayoutPanel2.ResumeLayout(false); this.panelNormalSettings.ResumeLayout(false); this.panelNormalSettings.PerformLayout(); this.panelRecognitionMode.ResumeLayout(false); this.panelRecognitionMode.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustomize)).EndInit(); this.panelReadBarcode.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picboxReadBarcode)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxStopBarcode)).EndInit(); this.panelPostalCodeDetail.ResumeLayout(false); this.panelPostalCodeDetail.PerformLayout(); this.panelPDFDetail.ResumeLayout(false); this.panelPDFDetail.PerformLayout(); this.panelQRDetail.ResumeLayout(false); this.panelQRDetail.PerformLayout(); this.panelFormat.ResumeLayout(false); this.panelFormat.PerformLayout(); this.panelOneDetail.ResumeLayout(false); this.panelOneDetail.PerformLayout(); this.panelDatabarDetail.ResumeLayout(false); this.panelDatabarDetail.PerformLayout(); this.panelCustom.ResumeLayout(false); this.panelCustomTop.ResumeLayout(false); this.panelCustomSettings.ResumeLayout(false); this.panelSettings.ResumeLayout(false); this.panelSettings.PerformLayout(); this.panelLoad.ResumeLayout(false); this.panelLoad.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxLoadImage)).EndInit(); this.panelWebCam.ResumeLayout(false); this.panelWebCam.PerformLayout(); this.panelAcquire.ResumeLayout(false); this.panelAcquire.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxScan)).EndInit(); this.panelReadSetting.ResumeLayout(false); this.panelReadSetting.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxFit)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picboxOriginalSize)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } void cmbDeblurLevel_SelectedIndexChanged(object sender, EventArgs e) { this.cmbDeblurLevel_SelectedIndex = this.cmbDeblurLevel.SelectedIndex; } void cmbLocalizationModes_SelectedIndexChanged(object sender, EventArgs e) { this.cmbLocalizationModes_SelectedIndex = this.cmbLocalizationModes.SelectedIndex; } void cmbGrayscaleTransformationModes_SelectedIndexChanged(object sender, EventArgs e) { this.cmbGrayscaleTransformationModes_SelectedIndex = this.cmbGrayscaleTransformationModes.SelectedIndex; } void cmbImagePreprocessingModes_SelectedIndexChanged(object sender, EventArgs e) { this.cmbImagePreprocessingModes_SelectedIndex = this.cmbImagePreprocessingModes.SelectedIndex; } void cmbMinResultConfidence_SelectedIndexChanged(object sender, EventArgs e) { this.cmbMinResultConfidence_SelectedIndex = this.cmbMinResultConfidence.SelectedIndex; } void cmbTextureDetectionSensitivity_SelectedIndexChanged(object sender, EventArgs e) { this.cmbTextureDetectionSensitivity_SelectedIndex = this.cmbTextureDetectionSensitivity.SelectedIndex; } void dsViewer_OnMouseClick(short sImageIndex) { if(sImageIndex>=0 && sImageIndex<mImageCore.ImageBuffer.HowManyImagesInBuffer) { CheckImageCount(); } } #endregion private System.Windows.Forms.Label lbMoveBar; private System.Windows.Forms.PictureBox picboxZoomOut; private System.Windows.Forms.PictureBox picboxZoomIn; private System.Windows.Forms.PictureBox picboxDeleteAll; private System.Windows.Forms.PictureBox picboxDelete; private System.Windows.Forms.PictureBox picboxFirst; private System.Windows.Forms.PictureBox picboxLast; private System.Windows.Forms.PictureBox picboxNext; private System.Windows.Forms.PictureBox picboxPrevious; private System.Windows.Forms.ComboBox cbxViewMode; private System.Windows.Forms.PictureBox picboxMin; private System.Windows.Forms.PictureBox picboxClose; private System.Windows.Forms.Label lbDiv; private System.Windows.Forms.TextBox tbxCurrentImageIndex; private System.Windows.Forms.TextBox tbxTotalImageNum; //private Dynamsoft.Forms.DSViewer dsViewer; private System.Windows.Forms.OpenFileDialog openFileDialog; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; private System.Windows.Forms.RadioButton rdbtnGray; private System.Windows.Forms.RadioButton rdbtnBW; private System.Windows.Forms.Label lbPixelType; private System.Windows.Forms.RadioButton rdbtnColor; private System.Windows.Forms.ComboBox cbxSource; // private System.Windows.Forms.ComboBox cbxRecognitionMode; private System.Windows.Forms.ComboBox cbxResolution; private System.Windows.Forms.PictureBox picboxScan; private System.Windows.Forms.Label lbSelectSource; private System.Windows.Forms.Label lbSelectRecognitionMode; private System.Windows.Forms.Label lbResolution; private System.Windows.Forms.Panel panelAcquire; private System.Windows.Forms.Panel panelLoad; private System.Windows.Forms.Panel panelWebCam; private System.Windows.Forms.Label lblWebCamSrc; private System.Windows.Forms.ComboBox cbxWebCamSrc; private System.Windows.Forms.Label lblWebCamRes; private System.Windows.Forms.ComboBox cbxWebCamRes; private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox picboxLoadImage; private System.Windows.Forms.Label label6; private System.Windows.Forms.Panel panelReadSetting; private System.Windows.Forms.Panel panelReadMoreSetting; private System.Windows.Forms.TextBox tbxResult; private System.Windows.Forms.Label lblCloseResult; private System.Windows.Forms.PictureBox picboxFit; private System.Windows.Forms.PictureBox picboxOriginalSize; private System.Windows.Forms.Label label24; private System.Windows.Forms.PictureBox picBoxWebCam; private Dynamsoft.Forms.DSViewer dsViewer; private Panel panelNormalSettings; private Panel panelOneDetail; private Panel panelDatabarDetail; private Panel panelPDFDetail; private Panel panelQRDetail; private CheckBox cbDatabarLimited; private CheckBox cbDatabarOmnidirectional; private CheckBox cbDatabarExpanded; private CheckBox cbDatabarExpanedStacked; private CheckBox cbDatabarStacked; private CheckBox cbDatabarStackedOmnidirectional; private CheckBox cbDatabarTruncated; private CheckBox cbINDUSTRIAL25; private CheckBox cbUPCE; private CheckBox cbUPCA; private CheckBox cbEAN8; private CheckBox cbCODABAR; private CheckBox cbITF; private CheckBox cbEAN13; private CheckBox cbCODE93; private CheckBox cbCODE128; private CheckBox cbCOD39; private CheckBox cbMSICODE; private CheckBox cbPATCHCODE; private CheckBox cbDOTCODE; private CheckBox cbDATABAR; private CheckBox cbMaxicode; private CheckBox cbAllPDF417; private CheckBox cbAllQRCode; private CheckBox cbGS1Composite; private CheckBox cbMicroPDF; private CheckBox cbMicroQR; private Button btnShowAllOneD; private Button btnShowAllDatabar; private Button btnShowAllPDF; private Button btnShowAllQR; private Button btnShowAllPostalCode; private RadioButton rbBestCoverage; private RadioButton rbBalance; private RadioButton rbBestSpeed; private Label lbRecMode; private CheckBox cbAZTEC; private CheckBox cbDataMatrix; private CheckBox cbQRcode; private CheckBox cbPDF417; private CheckBox cbOneD; private Label lableFormat; private Panel panelSettings; private Label label12; private Label label11; private Label label10; private ComboBox cmbTextureDetectionSensitivity; private ComboBox cmbMinResultConfidence; private ComboBox cmbImagePreprocessingModes; private ComboBox cmbGrayscaleTransformationModes; private Label label9; private Label label8; private TextBox tbBinarizationBlockSize; private TextBox tbScaleDownThreshold; private Label label7; private CheckBox cbRegionPredetectionMode; private CheckBox cbTextFilterMode; private ComboBox cmbLocalizationModes; private Label label5; private ComboBox cmbDeblurLevel; private Label label4; private TextBox tbExpectedBarcodesCount; private Label label3; private Panel panelCustomSettings; private Panel panelFormat; private Panel panelCustom; private Label label17; private Label label18; private Label lbCustomPanelClose; private Panel panelRecognitionMode; private Label label2; private Label label13; private Label label14; private Panel panelReadBarcode; private PictureBox picboxReadBarcode; private PictureBox picboxStopBarcode; private Label labelWebcamNote; private Panel panelCustomTop; private Panel panelBarcodeReaderParent; private Panel panelFormatParent; private Button btnExportSettings; private SaveFileDialog saveRuntimeSettingsFileDialog; private Label comment; private ToolTip toolTipExport; private PictureBox pictureBoxCustomize; private CheckBox cbPostalCode; private Panel panelPostalCodeDetail; private CheckBox cbPlanet; private CheckBox cbPostnet; private CheckBox cbRM4SCC; private CheckBox cbAustralianPost; private CheckBox cbUSPSIntelligentMail; } }
62.305533
180
0.637603
[ "Apache-2.0" ]
Dynamsoft/barcode-reader-dotnet-samples
samples/UseCases/DecodeFromScannerAndWebcam/DecodeFromScannerAndWebcam.Designer.cs
153,153
C#
using System; using System.Collections.Generic; using System.Text; using Abp.Events.Bus.Entities; namespace Recyclops.Audit.Dto { public class AuditServiceDto { public AuditServiceDto(string user, string type, DateTime time, EntityChangeType changeType) { UsersName = user; Type = type; Date = time; switch (changeType) { case EntityChangeType.Created: Reason = "Created"; break; case EntityChangeType.Updated: Reason = "Updated"; break; case EntityChangeType.Deleted: Reason = "Deleted"; break; } AuditDetails = new List<AuditDetailDto>(); } public string UsersName { get; set; } public string Type { get; set; } public DateTime Date { get; set; } public TimeSpan Time { get; set; } public string Reason { get; set; } public List<AuditDetailDto> AuditDetails { get; set; } } public class AuditDetailDto { public AuditDetailDto(string propertyChanged, string originalValue, string newValue) { PropertyChanged = propertyChanged; OriginalValue = originalValue; NewValue = newValue; } public string PropertyChanged { get; set; } public string OriginalValue { get; set; } public string NewValue { get; set; } } }
26.758621
100
0.546392
[ "MIT" ]
JoshTheGent/Recyclops
4.7.1/aspnet-core/src/Recyclops.Application/Audit/Dto/AuditServiceDto.cs
1,554
C#
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.SpaServices.AngularCli; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace College.WebApp { 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.AddControllersWithViews(); // In production, the Angular files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); if (!env.IsDevelopment()) { app.UseSpaStaticFiles(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); } } }
32.118421
143
0.565752
[ "MIT" ]
jagratimodi/speaker_series_2021
Year_2020/CSharpCorner/11Jul-2020_Building_BFF_Azure_ApiMgt/SourceCode/WebApp/College.WebApp/Startup.cs
2,441
C#
namespace Cake.Issues.EsLint.Tests { using System; using Shouldly; using Xunit; public sealed class EsLintRuleUrlResolverTests { public sealed class TheResolveRuleUrlMethod { [Fact] public void Should_Throw_If_Rule_Is_Null() { // Given / When var result = Record.Exception(() => EsLintRuleUrlResolver.Instance.ResolveRuleUrl(null)); // Then result.IsArgumentNullException("rule"); } [Fact] public void Should_Throw_If_Rule_Is_Empty() { // Given / When var result = Record.Exception(() => EsLintRuleUrlResolver.Instance.ResolveRuleUrl(string.Empty)); // Then result.IsArgumentOutOfRangeException("rule"); } [Fact] public void Should_Throw_If_Rule_Is_WhiteSpace() { // Given / When var result = Record.Exception(() => EsLintRuleUrlResolver.Instance.ResolveRuleUrl(" ")); // Then result.IsArgumentOutOfRangeException("rule"); } [Theory] [InlineData("no-unused-vars", "http://eslint.org/docs/rules/no-unused-vars")] [InlineData("no-await-in-loop", "http://eslint.org/docs/rules/no-await-in-loop")] public void Should_Resolve_Url(string rule, string expectedUrl) { // Given var urlResolver = EsLintRuleUrlResolver.Instance; // When var ruleUrl = urlResolver.ResolveRuleUrl(rule); // Then ruleUrl.ToString().ShouldBe(expectedUrl); } [Fact] public void Should_Resolve_Url_From_Custom_Resolvers() { // Given const string foo = "FOO123"; const string fooUrl = "http://foo.com/"; const string bar = "BAR123"; const string barUrl = "http://bar.com/"; var urlResolver = EsLintRuleUrlResolver.Instance; urlResolver.AddUrlResolver(x => x.Rule == foo ? new Uri(fooUrl) : null, 1); urlResolver.AddUrlResolver(x => x.Rule == bar ? new Uri(barUrl) : null, 1); // When var fooRuleUrl = urlResolver.ResolveRuleUrl(foo); var barRuleUrl = urlResolver.ResolveRuleUrl(bar); // Then fooRuleUrl.ToString().ShouldBe(fooUrl); barRuleUrl.ToString().ShouldBe(barUrl); } } } }
33.962025
113
0.522549
[ "MIT" ]
cake-contrib/Cake.Issues.EsLint
src/Cake.Issues.EsLint.Tests/EsLintRuleUrlResolverTests.cs
2,685
C#
// Copyright (c) Microsoft. All rights reserved. namespace Services.Test.helpers { /// <summary> /// Use these flags to allow running a subset of tests from the test /// explorer and the command line. /// </summary> public class Constants { public const string TYPE = "Type"; public const string UNIT_TEST = "UnitTest"; } }
26.357143
72
0.634146
[ "MIT" ]
Azure-Samples/AI-Video-Intelligence-Solution-Accelerator
pcs/services/iothub-manager/Services.Test/helpers/Constants.cs
371
C#
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace SqlSugar { public class EntityMaintenance { public SqlSugarClient Context { get; set; } public EntityInfo GetEntityInfo<T>() { return GetEntityInfo(typeof(T)); } public EntityInfo GetEntityInfo(Type type) { string cacheKey = "GetEntityInfo" + type.FullName; return this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate(cacheKey, () => { EntityInfo result = new EntityInfo(); var sugarAttributeInfo = type.GetTypeInfo().GetCustomAttributes(typeof(SugarTable), true).Where(it => it is SugarTable).SingleOrDefault(); if (sugarAttributeInfo.HasValue()) { var sugarTable = (SugarTable)sugarAttributeInfo; result.DbTableName = sugarTable.TableName; } result.Type = type; result.EntityName = result.Type.Name; result.Columns = new List<EntityColumnInfo>(); SetColumns(result); return result; }); } public string GetTableName<T>() { var typeName = typeof(T).Name; if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return typeName; else { var mappingInfo = this.Context.MappingTables.SingleOrDefault(it => it.EntityName == typeName); return mappingInfo == null ? typeName : mappingInfo.DbTableName; } } public string GetTableName(Type entityType) { var typeName = entityType.Name; if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return typeName; else { var mappingInfo = this.Context.MappingTables.SingleOrDefault(it => it.EntityName == typeName); return mappingInfo == null ? typeName : mappingInfo.DbTableName; } } public string GetTableName(string entityName) { var typeName = entityName; if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return typeName; else { var mappingInfo = this.Context.MappingTables.SingleOrDefault(it => it.EntityName == typeName); return mappingInfo == null ? typeName : mappingInfo.DbTableName; } } public string GetEntityName(string tableName) { if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return tableName; else { var mappingInfo = this.Context.MappingTables.SingleOrDefault(it => it.DbTableName == tableName); return mappingInfo == null ? tableName : mappingInfo.EntityName; } } public string GetDbColumnName<T>(string propertyName) { var isAny = this.GetEntityInfo<T>().Columns.Any(it => it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase)); Check.Exception(!isAny, "Property " + propertyName + " is Invalid"); var typeName = typeof(T).Name; if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return propertyName; else { var mappingInfo = this.Context.MappingColumns.SingleOrDefault(it => it.EntityName == typeName && it.PropertyName == propertyName); return mappingInfo == null ? propertyName : mappingInfo.DbColumnName; } } public string GetDbColumnName(string propertyName,Type entityType) { var isAny = this.GetEntityInfo(entityType).Columns.Any(it => it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase)); Check.Exception(!isAny, "Property " + propertyName + " is Invalid"); var typeName = entityType.Name; if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return propertyName; else { var mappingInfo = this.Context.MappingColumns.SingleOrDefault(it => it.EntityName == typeName && it.PropertyName == propertyName); return mappingInfo == null ? propertyName : mappingInfo.DbColumnName; } } public string GetPropertyName<T>(string dbColumnName) { var typeName = typeof(T).Name; if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return dbColumnName; else { var mappingInfo = this.Context.MappingColumns.SingleOrDefault(it => it.EntityName == typeName && it.DbColumnName.Equals(dbColumnName,StringComparison.CurrentCultureIgnoreCase)); return mappingInfo == null ? dbColumnName : mappingInfo.PropertyName; } } public string GetPropertyName(string dbColumnName,Type entityType) { var typeName = entityType.Name; if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return dbColumnName; else { var mappingInfo = this.Context.MappingColumns.SingleOrDefault(it => it.EntityName == typeName && it.DbColumnName.Equals(dbColumnName,StringComparison.CurrentCultureIgnoreCase)); return mappingInfo == null ? dbColumnName : mappingInfo.PropertyName; } } public PropertyInfo GetProperty<T>(string dbColumnName) { var propertyName = GetPropertyName<T>(dbColumnName); return typeof(T).GetProperties().First(it => it.Name == propertyName); } #region Primary key private void SetColumns(EntityInfo result) { foreach (var property in result.Type.GetProperties()) { EntityColumnInfo column = new EntityColumnInfo(); //var isVirtual = property.GetGetMethod().IsVirtual; //if (isVirtual) continue; var sugarColumn = property.GetCustomAttributes(typeof(SugarColumn), true) .Where(it => it is SugarColumn) .Select(it => (SugarColumn)it) .FirstOrDefault(); column.DbTableName = result.DbTableName; column.EntityName = result.EntityName; column.PropertyName = property.Name; column.PropertyInfo = property; if (sugarColumn.IsNullOrEmpty()) { column.DbColumnName = property.Name; } else { if (sugarColumn.IsIgnore == false) { column.DbColumnName = sugarColumn.ColumnName.IsNullOrEmpty() ? property.Name : sugarColumn.ColumnName; column.IsPrimarykey = sugarColumn.IsPrimaryKey; column.IsIdentity = sugarColumn.IsIdentity; column.ColumnDescription = sugarColumn.ColumnDescription; column.IsNullable = sugarColumn.IsNullable; column.Length = sugarColumn.Length; column.OldDbColumnName = sugarColumn.OldColumnName; column.DataType = sugarColumn.ColumnDataType; column.DecimalDigits = sugarColumn.DecimalDigits; column.OracleSequenceName = sugarColumn.OracleSequenceName; column.IsOnlyIgnoreInsert = sugarColumn.IsOnlyIgnoreInsert; } else { column.IsIgnore = true; } } if (this.Context.MappingColumns.HasValue()) { var golbalMappingInfo = this.Context.MappingColumns.FirstOrDefault(it => it.EntityName.Equals(result.EntityName, StringComparison.CurrentCultureIgnoreCase) && it.PropertyName == column.PropertyName); if (golbalMappingInfo != null) column.DbColumnName = golbalMappingInfo.DbColumnName; } if (this.Context.IgnoreColumns.HasValue()) { var golbalMappingInfo = this.Context.IgnoreColumns.FirstOrDefault(it => it.EntityName.Equals(result.EntityName, StringComparison.CurrentCultureIgnoreCase) && it.PropertyName == column.PropertyName); if (golbalMappingInfo != null) column.IsIgnore = true; } result.Columns.Add(column); } } #endregion } }
48.387097
219
0.579667
[ "Apache-2.0" ]
gitter-badger/SmartSql
src/ExternalORM/Abstract/EntityMaintenance/EntityMaintenance.cs
9,002
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace CVIS.Core.Messages { [Serializable] public class ApplicationDataMessage { [JsonProperty(PropertyName = "Id")] public Guid Id { get; set; } [JsonProperty(PropertyName = "Timestamp")] public long Timestamp { get; set; } //ms since epoch [JsonProperty(PropertyName = "AppId")] public int AppId { get; set; } [JsonProperty(PropertyName = "EventID")] public Guid? EventID { get; set; } [JsonProperty(PropertyName = "InteractionId")] public Guid? InteractionId { get; set; } [JsonProperty(PropertyName = "IntersectionId")] public int IntersectionId { get; set; } [JsonProperty(PropertyName = "DataCode")] public int DataCodeId { get; set; } [JsonProperty(PropertyName = "Data")] public string Data { get; set; } } }
32.451613
61
0.637177
[ "Apache-2.0" ]
MatrixManAtYrService/v2i-unofficial
TMX/Common/ExtractMessageTypes/CVIS.Core_Messages/ApplicationDataMessage.cs
1,008
C#
using System; using System.Collections.Generic; using System.Configuration; using System.Drawing; using System.IO; using System.Threading; using System.Windows.Forms; using AForge.Video.DirectShow; using YunZhiFaceReco.Entity; using YunZhiFaceReco.SDKModels; using YunZhiFaceReco.SDKUtil; using YunZhiFaceReco.TV_Create.MUti_Channel; using YunZhiFaceReco.TV_Create.MUti_Channel.pojo; using YunZhiFaceReco.TV_Create.MUti_Channel.repo; using YunZhiFaceReco.Utils; using YunZhiFaceRecoDataManager.TV_Create.Interface; using YunZhiFaceRecoDataManager.TV_Create.MUti_Channel.model; namespace YunZhiFaceReco { public partial class FaceForm : Form { #region 私有成员 //引擎Handle private IntPtr pImageEngine = IntPtr.Zero; //保存右侧图片路径 private string image1Path; //右侧图片人脸特征 private IntPtr image1Feature; //保存对比图片的列表 private List<string> imagePathList = new List<string>(); //左侧图库人脸特征列表 private List<IntPtr> imagesFeatureList = new List<IntPtr>(); //相似度 private float threshold = 0.8f; //用于标记是否需要清除比对结果 private bool isCompare = false; #region 视频模式下相关 //视频引擎Handle private IntPtr pVideoEngine = IntPtr.Zero; //视频引擎 FR Handle 处理 FR和图片引擎分开,减少强占引擎的问题 private IntPtr pVideoImageEngine = IntPtr.Zero; /// <summary> /// 视频输入设备信息 /// </summary> private FilterInfoCollection filterInfoCollection; private VideoCaptureDevice deviceVideo; #endregion #region 频道相关 private ChannelInfo currentChannel = null; #endregion #endregion #region FaceForm构造函数 public FaceForm() { InitializeComponent(); CheckForIllegalCrossThreadCalls = false;// 在多线程程序中,新创建的线程不能访问UI线程创建的窗口控件,如果需要访问窗口中的控件,可以在窗口构造函数中将CheckForIllegalCrossThreadCalls设置为 false //this.WindowState = FormWindowState.Maximized; // 窗体启动就最大化 InitEngines();// 初始化引擎 txtThreshold.Enabled = false;// 阈值不可编辑状态 getNowTimerAndWeek();// 获取当前时间和星期几 this.initMutiChannelComboBox(); this.initlistviewuserinfolist(); } #endregion #region 时间 public void getNowTimerAndWeek() { System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Interval = 1000;// 1秒 timer.Tick += timer_Tick; timer.Start(); } void timer_Tick(object sender, EventArgs e) { string nowTime = DateTime.Now.ToString(); this.labelNowTimeAndWeek.Text = nowTime + " " + getDayOfWeek(); } public string getDayOfWeek() { string[] weekdays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; string week = weekdays[Convert.ToInt32(DateTime.Now.DayOfWeek)];// 强制转为int return week; } #endregion #region 引擎 /// <summary> /// 初始化引擎 /// </summary> private void InitEngines() { //读取配置文件 AppSettingsReader reader = new AppSettingsReader(); string appId = (string)reader.GetValue("APP_ID", typeof(string)); string sdkKey64 = (string)reader.GetValue("SDKKEY64", typeof(string)); string sdkKey32 = (string)reader.GetValue("SDKKEY32", typeof(string)); var is64CPU = Environment.Is64BitProcess; if (is64CPU)// 64位 { if (string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(sdkKey64)) { chooseMultiImgBtn.Enabled = false; matchBtn.Enabled = false; btnClearFaceList.Enabled = false; chooseImgBtn.Enabled = false; MessageBox.Show("请在App.config配置文件中先配置APP_ID和SDKKEY64!"); return; } } else// 32位 { if (string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(sdkKey32)) { chooseMultiImgBtn.Enabled = false; matchBtn.Enabled = false; btnClearFaceList.Enabled = false; chooseImgBtn.Enabled = false; MessageBox.Show("请在App.config配置文件中先配置APP_ID和SDKKEY32!"); return; } } //激活引擎 如出现错误,1.请先确认从官网下载的sdk库已放到对应的bin中,2.当前选择的CPU为x86或者x64 int retCode = 0; try { retCode = ASFFunctions.ASFActivation(appId, is64CPU ? sdkKey64 : sdkKey32); } catch (Exception ex) { chooseMultiImgBtn.Enabled = false; matchBtn.Enabled = false; btnClearFaceList.Enabled = false; chooseImgBtn.Enabled = false; if (ex.Message.IndexOf("无法加载 DLL") > -1) { MessageBox.Show("请将sdk相关DLL放入bin对应的x86或x64下的文件夹中!"); } else { MessageBox.Show("激活引擎失败!"); } return; } Console.WriteLine("Activate Result:" + retCode); //初始化引擎 uint detectMode = DetectionMode.ASF_DETECT_MODE_IMAGE; //检测脸部的角度优先值 int detectFaceOrientPriority = ASF_OrientPriority.ASF_OP_0_HIGHER_EXT; //人脸在图片中所占比例,如果需要调整检测人脸尺寸请修改此值,有效数值为2-32 int detectFaceScaleVal = 16; //最大需要检测的人脸个数 int detectFaceMaxNum = 10; //引擎初始化时需要初始化的检测功能组合 int combinedMask = FaceEngineMask.ASF_FACE_DETECT | FaceEngineMask.ASF_FACERECOGNITION | FaceEngineMask.ASF_AGE | FaceEngineMask.ASF_GENDER | FaceEngineMask.ASF_FACE3DANGLE; //初始化引擎,正常值为0,其他返回值请参考http://ai.arcsoft.com.cn/bbs/forum.php?mod=viewthread&tid=19&_dsign=dbad527e retCode = ASFFunctions.ASFInitEngine(detectMode, detectFaceOrientPriority, detectFaceScaleVal, detectFaceMaxNum, combinedMask, ref pImageEngine); Console.WriteLine("引擎初始化结果:" + retCode); AppendText((retCode == 0) ? "引擎初始化成功!\n" : string.Format("引擎初始化失败!错误码为:{0}\n", retCode)); if (retCode != 0) { chooseMultiImgBtn.Enabled = false; matchBtn.Enabled = false; btnClearFaceList.Enabled = false; chooseImgBtn.Enabled = false; } //初始化视频模式下人脸检测引擎 uint detectModeVideo = DetectionMode.ASF_DETECT_MODE_VIDEO; int combinedMaskVideo = FaceEngineMask.ASF_FACE_DETECT | FaceEngineMask.ASF_FACERECOGNITION; retCode = ASFFunctions.ASFInitEngine(detectModeVideo, detectFaceOrientPriority, detectFaceScaleVal, detectFaceMaxNum, combinedMaskVideo, ref pVideoEngine); //视频专用FR引擎 detectFaceMaxNum = 1; combinedMask = FaceEngineMask.ASF_FACERECOGNITION | FaceEngineMask.ASF_FACE3DANGLE; retCode = ASFFunctions.ASFInitEngine(detectMode, detectFaceOrientPriority, detectFaceScaleVal, detectFaceMaxNum, combinedMask, ref pVideoImageEngine); Console.WriteLine("InitVideoEngine Result:" + retCode); // 初始化video this.initVideo(); } #endregion #region 识别图片 /// <summary> /// “选择识别图片”按钮事件 /// </summary> private void ChooseImg(object sender, EventArgs e) { lblCompareInfo.Text = ""; if (pImageEngine == IntPtr.Zero) { chooseMultiImgBtn.Enabled = false; matchBtn.Enabled = false; btnClearFaceList.Enabled = false; chooseImgBtn.Enabled = false; MessageBox.Show("请先初始化引擎!"); return; } OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "选择图片"; openFileDialog.Filter = "图片文件|*.bmp;*.jpg;*.jpeg;*.png"; openFileDialog.Multiselect = false; openFileDialog.FileName = string.Empty; if (openFileDialog.ShowDialog() == DialogResult.OK) { DateTime detectStartTime = DateTime.Now; AppendText(string.Format("------------------------------开始检测,时间:{0}------------------------------\n", detectStartTime.ToString("yyyy-MM-dd HH:mm:ss:ms"))); image1Path = openFileDialog.FileName; //获取文件,拒绝过大的图片 FileInfo fileInfo = new FileInfo(image1Path); long maxSize = 1024 * 1024 * 2; if (fileInfo.Length > maxSize) { MessageBox.Show("图像文件最大为2MB,请压缩后再导入!"); AppendText(string.Format("------------------------------检测结束,时间:{0}------------------------------\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ms"))); AppendText("\n"); return; } Image srcImage = Image.FromFile(image1Path); //调整图像宽度,需要宽度为4的倍数 if (srcImage.Width % 4 != 0) { //srcImage = ImageUtil.ScaleImage(srcImage, picImageCompare.Width, picImageCompare.Height); srcImage = ImageUtil.ScaleImage(srcImage, srcImage.Width - (srcImage.Width % 4), srcImage.Height); } //调整图片数据,非常重要 ImageInfo imageInfo = ImageUtil.ReadBMP(srcImage); //人脸检测 ASF_MultiFaceInfo multiFaceInfo = FaceUtil.DetectFace(pImageEngine, imageInfo); //年龄检测 int retCode_Age = -1; ASF_AgeInfo ageInfo = FaceUtil.AgeEstimation(pImageEngine, imageInfo, multiFaceInfo, out retCode_Age); //性别检测 int retCode_Gender = -1; ASF_GenderInfo genderInfo = FaceUtil.GenderEstimation(pImageEngine, imageInfo, multiFaceInfo, out retCode_Gender); //3DAngle检测 int retCode_3DAngle = -1; ASF_Face3DAngle face3DAngleInfo = FaceUtil.Face3DAngleDetection(pImageEngine, imageInfo, multiFaceInfo, out retCode_3DAngle); MemoryUtil.Free(imageInfo.imgData); if (multiFaceInfo.faceNum < 1) { srcImage = ImageUtil.ScaleImage(srcImage, picImageCompare.Width, picImageCompare.Height); image1Feature = IntPtr.Zero; picImageCompare.Image = srcImage; AppendText(string.Format("{0} - 未检测出人脸!\n\n", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"))); AppendText(string.Format("------------------------------检测结束,时间:{0}------------------------------\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ms"))); AppendText("\n"); return; } MRECT temp = new MRECT(); int ageTemp = 0; int genderTemp = 0; int rectTemp = 0; //标记出检测到的人脸 for (int i = 0; i < multiFaceInfo.faceNum; i++) { MRECT rect = MemoryUtil.PtrToStructure<MRECT>(multiFaceInfo.faceRects + MemoryUtil.SizeOf<MRECT>() * i); int orient = MemoryUtil.PtrToStructure<int>(multiFaceInfo.faceOrients + MemoryUtil.SizeOf<int>() * i); int age = 0; if (retCode_Age != 0) { AppendText(string.Format("年龄检测失败,返回{0}!\n\n", retCode_Age)); } else { age = MemoryUtil.PtrToStructure<int>(ageInfo.ageArray + MemoryUtil.SizeOf<int>() * i); } int gender = -1; if (retCode_Gender != 0) { AppendText(string.Format("性别检测失败,返回{0}!\n\n", retCode_Gender)); } else { gender = MemoryUtil.PtrToStructure<int>(genderInfo.genderArray + MemoryUtil.SizeOf<int>() * i); } int face3DStatus = -1; float roll = 0f; float pitch = 0f; float yaw = 0f; if (retCode_3DAngle != 0) { AppendText(string.Format("3DAngle检测失败,返回{0}!\n\n", retCode_3DAngle)); } else { //角度状态 非0表示人脸不可信 face3DStatus = MemoryUtil.PtrToStructure<int>(face3DAngleInfo.status + MemoryUtil.SizeOf<int>() * i); //roll为侧倾角,pitch为俯仰角,yaw为偏航角 roll = MemoryUtil.PtrToStructure<float>(face3DAngleInfo.roll + MemoryUtil.SizeOf<float>() * i); pitch = MemoryUtil.PtrToStructure<float>(face3DAngleInfo.pitch + MemoryUtil.SizeOf<float>() * i); yaw = MemoryUtil.PtrToStructure<float>(face3DAngleInfo.yaw + MemoryUtil.SizeOf<float>() * i); } int rectWidth = rect.right - rect.left; int rectHeight = rect.bottom - rect.top; //查找最大人脸 if (rectWidth * rectHeight > rectTemp) { rectTemp = rectWidth * rectHeight; temp = rect; ageTemp = age; genderTemp = gender; } //srcImage = ImageUtil.MarkRectAndString(srcImage, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, age, gender); AppendText(string.Format("{0} - 人脸坐标:[left:{1},top:{2},right:{3},bottom:{4},orient:{5},roll:{6},pitch:{7},yaw:{8},status:{11}] Age:{9} Gender:{10}\n", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), rect.left, rect.top, rect.right, rect.bottom, orient, roll, pitch, yaw, age, (gender >= 0 ? gender.ToString() : ""), face3DStatus)); } AppendText(string.Format("{0} - 人脸数量:{1}\n\n", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), multiFaceInfo.faceNum)); DateTime detectEndTime = DateTime.Now;// 获取当前的时间 AppendText(string.Format("------------------------------检测结束,时间:{0}------------------------------\n", detectEndTime.ToString("yyyy-MM-dd HH:mm:ss:ms"))); AppendText("\n"); ASF_SingleFaceInfo singleFaceInfo = new ASF_SingleFaceInfo();// 单人脸检测 //提取人脸特征 image1Feature = FaceUtil.ExtractFeature(pImageEngine, srcImage, out singleFaceInfo); //清空上次的匹配结果 for (int i = 0; i < imagesFeatureList.Count; i++) { imageList.Items[i].Text = string.Format("{0}号", i); } float scaleRate = ImageUtil.getWidthAndHeight(srcImage.Width, srcImage.Height, picImageCompare.Width, picImageCompare.Height); srcImage = ImageUtil.ScaleImage(srcImage, picImageCompare.Width, picImageCompare.Height); srcImage = ImageUtil.MarkRectAndString(srcImage, (int)(temp.left * scaleRate), (int)(temp.top * scaleRate), (int)(temp.right * scaleRate) - (int)(temp.left * scaleRate), (int)(temp.bottom * scaleRate) - (int)(temp.top * scaleRate), ageTemp, genderTemp, picImageCompare.Width); //显示标记后的图像 picImageCompare.Image = srcImage; } } private object locker = new object(); /// <summary> /// 人脸库图片选择按钮事件 /// </summary> private void ChooseMultiImg(object sender, EventArgs e) { lock (locker) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "选择图片"; openFileDialog.Filter = "图片文件|*.bmp;*.jpg;*.jpeg;*.png"; openFileDialog.Multiselect = true; openFileDialog.FileName = string.Empty; if (openFileDialog.ShowDialog() == DialogResult.OK)// 用户一点击“确定”按钮,那么对话框就关闭,重新回到主窗体,然后可以在主窗体中进行相应的处理,比如把数据写入数据库等 { List<string> imagePathListTemp = new List<string>(); var numStart = imagePathList.Count; int isGoodImage = 0; //保存图片路径并显示 // TODO 这边将从数据库获取人脸地址 string[] fileNames = openFileDialog.FileNames; Console.WriteLine(fileNames.ToString()); for (int i = 0; i < fileNames.Length; i++) { imagePathListTemp.Add(fileNames[i]);// 将数据库查处的地址列表存入temp } //人脸检测以及提取人脸特征 ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { //禁止点击按钮 Invoke(new Action(delegate { chooseMultiImgBtn.Enabled = false; matchBtn.Enabled = false; btnClearFaceList.Enabled = false; chooseImgBtn.Enabled = false; btnStartVideo.Enabled = false; })); //人脸检测和剪裁 for (int i = 0; i < imagePathListTemp.Count; i++) { Image image = Image.FromFile(imagePathListTemp[i]); if (image.Width % 4 != 0) { image = ImageUtil.ScaleImage(image, image.Width - (image.Width % 4), image.Height); } ASF_MultiFaceInfo multiFaceInfo = FaceUtil.DetectFace(pImageEngine, image); if (multiFaceInfo.faceNum > 0) { imagePathList.Add(imagePathListTemp[i]); MRECT rect = MemoryUtil.PtrToStructure<MRECT>(multiFaceInfo.faceRects); image = ImageUtil.CutImage(image, rect.left, rect.top, rect.right, rect.bottom); } else { continue; } this.Invoke(new Action(delegate { if (image == null) { image = Image.FromFile(imagePathListTemp[i]); } imageLists.Images.Add(imagePathListTemp[i], image); imageList.Items.Add((numStart + isGoodImage) + "号", imagePathListTemp[i]); isGoodImage += 1; image = null; })); } //提取人脸特征 for (int i = numStart; i < imagePathList.Count; i++) { ASF_SingleFaceInfo singleFaceInfo = new ASF_SingleFaceInfo(); // TODO 将feature存入数据库,byte[],这边已经在FaceUtils中处理了 IntPtr feature = FaceUtil.ExtractFeature(pImageEngine, Image.FromFile(imagePathList[i]), out singleFaceInfo);// 人脸特征 this.Invoke(new Action(delegate { if (singleFaceInfo.faceRect.left == 0 && singleFaceInfo.faceRect.right == 0) { AppendText(string.Format("{0}号未检测到人脸\r\n", i)); } else { AppendText(string.Format("已提取{0}号人脸特征值,[left:{1},right:{2},top:{3},bottom:{4},orient:{5}]\r\n", i, singleFaceInfo.faceRect.left, singleFaceInfo.faceRect.right, singleFaceInfo.faceRect.top, singleFaceInfo.faceRect.bottom, singleFaceInfo.faceOrient)); imagesFeatureList.Add(feature); // TODO 数据库中查询出feature /* IntPtr pFeatureItemFromDB; MysqlUtils mysqlUtils = new MysqlUtils(); List<byte[]> featureListFromDB = mysqlUtils.SelectUserFaceByFeature(); foreach (byte[] featureItemFromDB in featureListFromDB) { pFeatureItemFromDB = TabConvert.BytesToIntptr(featureItemFromDB); imagesFeatureList.Add(pFeatureItemFromDB); } */ } })); } //允许点击按钮 Invoke(new Action(delegate { chooseMultiImgBtn.Enabled = true; btnClearFaceList.Enabled = true; btnStartVideo.Enabled = true; if (btnStartVideo.Text == "启用摄像头") { chooseImgBtn.Enabled = true; matchBtn.Enabled = true; } else { chooseImgBtn.Enabled = false; matchBtn.Enabled = false; } })); })); } } } #endregion #region 窗体 /// <summary> /// 窗体关闭事件 /// </summary> private void Form_Closed(object sender, FormClosedEventArgs e) { //销毁引擎 int retCode = ASFFunctions.ASFUninitEngine(pImageEngine); Console.WriteLine("UninitEngine pImageEngine Result:" + retCode); //销毁引擎 retCode = ASFFunctions.ASFUninitEngine(pVideoEngine); Console.WriteLine("UninitEngine pVideoEngine Result:" + retCode); } #endregion #region 公用方法 /// <summary> /// 追加公用方法 /// </summary> /// <param name="message"></param> private void AppendText(string message) { logBox.AppendText(message); } #endregion #region 人脸匹配 /// <summary> /// 匹配事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void matchBtn_Click(object sender, EventArgs e) { if (imagesFeatureList.Count == 0) { MessageBox.Show("请注册人脸!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (image1Feature == IntPtr.Zero) { if (picImageCompare.Image == null) { MessageBox.Show("请选择识别图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("比对失败,识别图未提取到特征值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } //标记已经做了匹配比对,在开启视频的时候要清除比对结果 isCompare = true; float compareSimilarity = 0f; int compareNum = 0; AppendText(string.Format("------------------------------开始比对,时间:{0}------------------------------\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ms"))); for (int i = 0; i < imagesFeatureList.Count; i++) { IntPtr feature = imagesFeatureList[i]; float similarity = 0f; int ret = ASFFunctions.ASFFaceFeatureCompare(pImageEngine, image1Feature, feature, ref similarity); //增加异常值处理 if (similarity.ToString().IndexOf("E") > -1) { similarity = 0f; } AppendText(string.Format("与{0}号比对结果:{1}\r\n", i, similarity)); imageList.Items[i].Text = string.Format("{0}号({1})", i, similarity); if (similarity > compareSimilarity) { compareSimilarity = similarity; compareNum = i; } } if (compareSimilarity > 0) { lblCompareInfo.Text = " " + compareNum + "号," + compareSimilarity; } AppendText(string.Format("------------------------------比对结束,时间:{0}------------------------------\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ms"))); } /// <summary> /// 清除人脸库事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClearFaceList_Click(object sender, EventArgs e) { //清除数据 imageLists.Images.Clear(); imageList.Items.Clear(); imagesFeatureList.Clear(); imagePathList.Clear(); } #endregion #region 摄像头相关 /// <summary> /// 摄像头初始化 /// </summary> private void initVideo() { filterInfoCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (filterInfoCollection.Count == 0) { btnStartVideo.Enabled = false; } else { btnStartVideo.Enabled = true; } // debug MessageBox.Show("FaceForm,摄像头初始化: filterInfoCollection.Count = " + filterInfoCollection.Count + ",非0为正常"); // 摄像头加载完成之后从数据库获取整个人脸特征值库 /* tabjin 数据库操作 start*/ // 数据库中查询出feature //MysqlUtils mysqlUtils = new MysqlUtils(); //featureListFromDB = mysqlUtils.SelectUserFaceByFeature();// 数据库查询 //// debug //MessageBox.Show("FaceForm,摄像头初始化后加载数据库数据: featureListFromDB.Count = " + featureListFromDB.Count + ",非0为正常"); //for (int i = 0; i < featureListFromDB.Count; i++) { // // star // ASF_FaceFeature localFeature = new ASF_FaceFeature(); // localFeature.feature = MemoryUtil.Malloc(featureListFromDB[i].Length);// 申请本地人脸特征指针 // MemoryUtil.Copy(featureListFromDB[i], 0, localFeature.feature, featureListFromDB[i].Length);// source, startIndex, destination, length // localFeature.featureSize = featureListFromDB[i].Length;// 设置本地特征值长度 // IntPtr pLocalFeature = MemoryUtil.Malloc(MemoryUtil.SizeOf<ASF_FaceFeature>());// 申请本地特征值指针空间 // MemoryUtil.StructureToPtr(localFeature, pLocalFeature);// T t,IntPtr ptr // imagesFeatureList.Add(pLocalFeature); //} /* tabjin 数据库操作 end*/ } /// <summary> /// 摄像头按钮点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void btnStartVideo_Click(object sender, EventArgs e) { //必须保证有可用摄像头 if (filterInfoCollection.Count == 0) { MessageBox.Show("未检测到摄像头,请确保已安装摄像头或驱动!"); } if (videoSourcePlayer.IsRunning)// 摄像头未开启状态 { btnStartVideo.Text = "启用摄像头"; videoSourcePlayer.SignalToStop(); //关闭摄像头 chooseImgBtn.Enabled = true; matchBtn.Enabled = true; txtThreshold.Enabled = false; videoSourcePlayer.Hide(); } else// 摄像头开启状态 { if (isCompare) { //比对结果清除 for (int i = 0; i < imagesFeatureList.Count; i++) { imageList.Items[i].Text = string.Format("{0}号", i); } lblCompareInfo.Text = ""; isCompare = false; } txtThreshold.Enabled = true; videoSourcePlayer.Show(); chooseImgBtn.Enabled = false; matchBtn.Enabled = false; btnStartVideo.Text = "关闭摄像头"; deviceVideo = new VideoCaptureDevice(filterInfoCollection[0].MonikerString); deviceVideo.VideoResolution = deviceVideo.VideoCapabilities[0]; videoSourcePlayer.VideoSource = deviceVideo; videoSourcePlayer.Start(); } } #endregion #region 比对结果 private FaceTrackUnit trackUnit = new FaceTrackUnit(); private Font font = new Font(FontFamily.GenericSerif, 10f); private SolidBrush brush = new SolidBrush(Color.Red); private Pen pen = new Pen(Color.Red); private bool isLock = false; /// <summary> /// 图像显示到窗体上,得到每一帧图像,并进行处理(画框) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //private void videoSource_Paint(object sender, PaintEventArgs e) { // // debug // this.labelVideoSourceIsRunning.Text = "labelVideoSourceIsRunning:" + videoSource.IsRunning; // if (videoSource.IsRunning)// 摄像头运行中 // { // //得到当前摄像头下的图片 // Bitmap bitmap = videoSource.GetCurrentVideoFrame(); // if (bitmap == null) { // // debug // MessageBox.Show("FaceForm,摄像头运行中,没有获取到当期摄像头下的图片"); // return; // } // Graphics g = e.Graphics; // float offsetX = videoSource.Width * 1f / bitmap.Width; // float offsetY = videoSource.Height * 1f / bitmap.Height; // //检测人脸,得到Rect框(方框) // ASF_MultiFaceInfo multiFaceInfo = FaceUtil.DetectFace(pVideoEngine, bitmap); // //debug // this.labelMultiFaceInfo.Text = "得到的Rect框:" + "faceRects=" + multiFaceInfo.faceRects + ",faceOrients=" + multiFaceInfo.faceOrients + ",faceNum=" + multiFaceInfo.faceNum; // //得到最大人脸 // ASF_SingleFaceInfo maxFace = FaceUtil.GetMaxFace(multiFaceInfo); // //debug // this.labelMaxFace.Text = "最大人脸:" + "faceRects=" + maxFace.faceRect + ",faceOrient=" + maxFace.faceOrient; // //得到Rect // MRECT rect = maxFace.faceRect; // float x = rect.left * offsetX; // float width = rect.right * offsetX - x; // float y = rect.top * offsetY; // float height = rect.bottom * offsetY - y; // // debug // this.labelX.Text = "RectX:" + Convert.ToString(x); // this.labelY.Text = "RectY:" + Convert.ToString(y); // this.labelWidth.Text = "RectWidth:" + Convert.ToString(width); // this.labelHeight.Text = "RectHeight:" + Convert.ToString(height); // //根据Rect进行画框 // g.DrawRectangle(pen, x, y, width, height); // // debug // // MessageBox.Show("FaceForm,摄像头运行中,g \n" + g); // // 调整摄像头视频框 // if (rect.left.ToString() == "0") { // this.videoSource.Location = new System.Drawing.Point(this.Width - 1, this.Height - 1); // } // else { // int xVideoSource = (int)(0.5 * (this.Width - this.videoSource.Width)); // int yVideoSource = (int)(0.5 * (this.Height - this.videoSource.Height)); // this.videoSource.Location = new System.Drawing.Point(xVideoSource, yVideoSource); // //this.videoSource.Location = new System.Drawing.Point(0, 0); // Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this); // this.ClientSize = new System.Drawing.Size(ScreenArea.Width, ScreenArea.Height); // } // // this.logBox.AppendText(rect.left.ToString() + "\n"); // // this.videoSource.Show();// 能画框的时候显示摄像头视频框 // if (trackUnit.message != "" && x > 0 && y > 0) { // //将上一帧检测结果显示到页面上 // g.DrawString(trackUnit.message, font, brush, x, y + 5); // } // //保证只检测一帧,防止页面卡顿以及出现其他内存被占用情况 // if (isLock == false) { // isLock = true; // //异步处理提取特征值和比对,不然页面会比较卡 // ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { // if (rect.left != 0 && rect.right != 0 && rect.top != 0 && rect.bottom != 0) { // try { // if (comparedTimes == 0)// 首次比对人脸 // { // //提取人脸特征值 TODO 这是当前摄像头下的人脸的特征值 // IntPtr videoFaceFeature = FaceUtil.ExtractFeature(pVideoImageEngine, bitmap, maxFace); // float similarity = 0f; // // 比对结果 // int result = compareFeatureFromDB(videoFaceFeature, out similarity);// 调用比对函数,比对人脸, result返回的是人脸库中的序号 // if (result > -1) { // // TODO 将首次人脸库中的序号result保存至数据库表result中,数据库表主键id为机器ip,并规定时间之内不能插入新的result // comparedResults.Add(result); // firstComparedResult = result; // // 将result写入数据库表result // // 根据本机ip获取上次入库时间,如果时间大于12小时,更新时间,更新result; 否则不予入库 // //将比对结果放到显示消息中,用于最新显示 // trackUnit.message = string.Format("当前匹配到 {0}号,相似度是 {1}", result, similarity); // labelLoginUserName.Text = result.ToString(); // IntPtr imageFeatureCheck = imagesFeatureList[result]; // Console.WriteLine(result.ToString() + ":" + similarity.ToString() + "\n"); // /* tabjin */ // // 相似度不足0.8,窗口正常显示 // if (similarity < 0.8) { // this.Visible = true; // this.WindowState = FormWindowState.Normal; // this.button1.Enabled = false;// 禁用锁屏按钮 // this.TopMost = true;// 识别不通过强制界面是最顶界面 // //Hook.Hook_Start(); // 人脸识别不通过,屏蔽左"WIN"、右"Win" | 屏蔽Ctrl+Esc | 屏蔽Alt+f4 | 屏蔽Alt+Esc | 屏蔽Alt+Tab | 截获Ctrl+Shift+Esc | 截获Ctrl+Alt+Delete // //Hook.ShieldMissionTask(1);// 人脸识别未通过状态,开启屏蔽任务管理器 // // 关闭进程 // /* // try // { // //可能存在进程名相同的进程 // foreach (Process process in Process.GetProcessesByName("cmd")) // process.Kill(); // } // catch (Exception ex) // { // } // * */ // } // else// 相似度超过80,自动缩小至系统托盘 // { // this.Hide(); // this.notifyIcon.Visible = true; // this.button1.Enabled = true;// 开启锁屏按钮 // this.TopMost = false;// 识别通过允许界面不是最顶界面 // //Hook.Hook_Clear(); // 人脸识别通过,取消屏蔽左"WIN"、右"Win" | 屏蔽Ctrl+Esc | 屏蔽Alt+f4 | 屏蔽Alt+Esc | 屏蔽Alt+Tab | 截获Ctrl+Shift+Esc | 截获Ctrl+Alt+Delete // //Hook.ShieldMissionTask(0);// 人脸识别通过之后,取消屏蔽任务管理器 // // 判断进程是否存在 // Process[] ps = Process.GetProcessesByName("cmd"); // if (ps.Length > 0)// 进程存在 // { // foreach (Process p in ps) // continue; // } // else// 进程不存在 // { // // 打开外部exe // ProcessStartInfo info = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe"); // //ProcessStartInfo info = new ProcessStartInfo(@"C:\DaYang\bin\D-Cube-EditU.exe"); // info.UseShellExecute = true; // info.Verb = "runas"; // Process.Start(info); // } // // 隔段时间打开托盘 // Thread.Sleep(Tab_Config.CheckFaceTimeInterval);// 设置了30秒再次验证人脸 // } // // 打开托盘 // this.Visible = true; // this.WindowState = FormWindowState.Normal; // comparedTimes++; // }/* tabjin */ // else { // // 重置窗口消息 // trackUnit.message = ""; // } // } // else// 再次比对人脸 // { // // // float similarityCompared = 0f; // ASF_FaceFeature localResultFeature = new ASF_FaceFeature(); // localResultFeature.feature = MemoryUtil.Malloc(featureListFromDB[firstComparedResult].Length);// 申请本地人脸特征指针 // MemoryUtil.Copy(featureListFromDB[firstComparedResult], 0, localResultFeature.feature, featureListFromDB[firstComparedResult].Length);// source, startIndex, destination, length // localResultFeature.featureSize = featureListFromDB[firstComparedResult].Length;// 设置本地特征值长度 // IntPtr pLocalResultFeature = MemoryUtil.Malloc(MemoryUtil.SizeOf<ASF_FaceFeature>());// 申请本地特征值指针空间 // MemoryUtil.StructureToPtr(localResultFeature, pLocalResultFeature); // // TODO 若为30秒钱的人脸,通过;否则,提示不是当前操作人员,请离开 // // 这边直接将30秒之前的人脸和当前video中的人脸进行比对 // // 30秒之前的人俩如何获取,保留30秒之前的人脸(yes),还是新建一个记录表(no,建立人脸记录表很烦,因为不止一台机器,其实也是可以实现,万一并发怎么办) // // 如何保存30秒之前的人脸?30秒前的人脸是抓取30秒之前摄像头的通过的人脸(no)。还是30秒之前从数据库中查到的人脸特征值(yes) // // 所以还是根据30秒之前通过的数据库中人脸特征值与当前的video人俩进行比对 // // 获取30秒之前的人脸,compareFeatureFromDB中筛选出匹配到的人脸特征值,然后将特征值byte[]托管到内存 // List<IntPtr> imagesFeatureListComPared = new List<IntPtr>();// 人脸校验需要的新的list // imagesFeatureListComPared.Capacity = 1;// 设置新的list长度为1 // // TODO 根据本机ip从数据库中获取人脸,插入imagesFeatureListComPared // imagesFeatureListComPared.Add(pLocalResultFeature);// 将30秒之前与摄像头匹配的数据库中的人脸添加至新的list // Bitmap bitmapCompared = videoSource.GetCurrentVideoFrame();// 获取当前摄像头的画面 // IntPtr videoFaceFeatureCompared = FaceUtil.ExtractFeature(pVideoImageEngine, bitmapCompared, maxFace);// 当前摄像头下的人脸的特征值 // int res = ASFFunctions.ASFFaceFeatureCompare(pImageEngine, videoFaceFeatureCompared, imagesFeatureList[firstComparedResult], ref similarityCompared);// 新的摄像头画面,30秒之前比对的数据库中的那张人脸,返回匹配到的人脸序号 // // 按预期res应该返回0 // if (res > -1) { // //将比对结果放到显示消息中,用于最新显示 // trackUnit.message = string.Format("当期匹配到 {0}号,相似度是 {1}", res, similarityCompared); // Console.WriteLine(res.ToString() + ":" + res.ToString() + "\n"); // /* tabjin */ // // 相似度不足0.8,窗口正常显示 // if (similarityCompared < 0.8) { // this.Visible = true; // this.WindowState = FormWindowState.Normal; // this.button1.Enabled = false;// 禁用锁屏按钮 // this.TopMost = true;// 识别不通过强制界面是最顶界面 // //MessageBox.Show("您不是当前操作用户"); // //Hook.Hook_Start(); // 人脸识别不通过,屏蔽左"WIN"、右"Win" | 屏蔽Ctrl+Esc | 屏蔽Alt+f4 | 屏蔽Alt+Esc | 屏蔽Alt+Tab | 截获Ctrl+Shift+Esc | 截获Ctrl+Alt+Delete // //Hook.ShieldMissionTask(1);// 人脸识别未通过状态,开启屏蔽任务管理器 // /* // try // { // //可能存在进程名相同的进程 // foreach (Process process in Process.GetProcessesByName("cmd")) // process.Kill(); // } // catch (Exception ex) // { // } // * */ // } // else// 相似度超过80,自动缩小至系统托盘 // { // //this.Hide(); // //this.notifyIcon.Visible = true; // this.Hide(); // this.notifyIcon.Visible = true; // this.button1.Enabled = true;// 开启锁屏按钮 // this.TopMost = false;// 识别通过允许界面不是最顶界面 // // MessageBox.Show("您是当前操作用户"); // //Hook.Hook_Clear(); // 人脸识别通过,取消屏蔽左"WIN"、右"Win" | 屏蔽Ctrl+Esc | 屏蔽Alt+f4 | 屏蔽Alt+Esc | 屏蔽Alt+Tab | 截获Ctrl+Shift+Esc | 截获Ctrl+Alt+Delete // //Hook.ShieldMissionTask(0);// 人脸识别通过之后,取消屏蔽任务管理器 // // 判断进程是否存在 // Process[] ps = Process.GetProcessesByName("cmd"); // if (ps.Length > 0)// 进程存在 // { // foreach (Process p in ps) // continue; // } // else// 进程不存在 // { // // 打开外部exe // ProcessStartInfo info = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe"); // //ProcessStartInfo info = new ProcessStartInfo(@"C:\DaYang\bin\D-Cube-EditU.exe"); // info.UseShellExecute = true; // info.Verb = "runas"; // Process.Start(info); // } // // 隔段时间打开托盘 // Thread.Sleep(Tab_Config.CheckFaceTimeInterval);// 设置了30秒再次验证人脸 // } // // 打开托盘 // this.Visible = true; // this.WindowState = FormWindowState.Normal; // }/* tabjin */ // else { // // 重置窗口消息 // trackUnit.message = ""; // } // } // } // catch (Exception ex) { // Console.WriteLine(ex.Message); // } // finally { // isLock = false; // } // } // isLock = false; // })); // } // } //} /// <summary> /// 得到feature比较结果 /// </summary> /// <param name="feature"></param> /// <returns></returns> private int compareFeature(IntPtr feature, out float similarity) { int result = -1; similarity = 0f; //如果人脸库不为空,则进行人脸匹配 if (imagesFeatureList != null && imagesFeatureList.Count > 0) { for (int i = 0; i < imagesFeatureList.Count; i++) { //调用人脸匹配方法,进行人脸特征匹配 ASFFunctions.ASFFaceFeatureCompare(pVideoImageEngine, feature, imagesFeatureList[i], ref similarity); if (similarity >= threshold)// 相似度大于阈值,输出人脸序号,暂时默认阈值为0.8 { result = i; break; } } } return result; } /// <summary> /// 得到feature比较结果 /// </summary> /// <param name="pVideoFaceFeature"></param> /// <returns></returns> private int compareFeatureFromDB(IntPtr pVideoFaceFeature, out float similarity) { int result = -1; similarity = 0f; //如果人脸库不为空,则进行人脸匹配 if (imagesFeatureList != null && imagesFeatureList.Count > 0) { for (int i = 0; i < imagesFeatureList.Count; i++) { //调用人脸匹配方法,进行人脸特征匹配 ASFFunctions.ASFFaceFeatureCompare(pVideoImageEngine, pVideoFaceFeature, imagesFeatureList[i], ref similarity); if (similarity >= threshold)// 相似度大于阈值,输出人脸序号,暂时默认阈值为0.8 { result = i; break; } } } return result; } #endregion #region 阈值 /// <summary> /// 阈值文本框键按下事件,检测输入内容是否正确,不正确不能输入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtThreshold_KeyPress(object sender, KeyPressEventArgs e) { //阻止从键盘输入键 e.Handled = true; //是数值键,回退键,.能输入,其他不能输入 if (char.IsDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == '.') { //渠道当前文本框的内容 string thresholdStr = txtThreshold.Text.Trim(); int countStr = 0; int startIndex = 0; //如果当前输入的内容是否是“.” if (e.KeyChar == '.') { countStr = 1; } //检测当前内容是否含有.的个数 if (thresholdStr.IndexOf('.', startIndex) > -1) { countStr += 1; } //如果输入的内容已经超过12个字符, if (e.KeyChar != 8 && (thresholdStr.Length > 12 || countStr > 1)) { return; } e.Handled = false; } } /// <summary> /// 阈值文本框键抬起事件,检测阈值是否正确,不正确改为0.8f /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtThreshold_KeyUp(object sender, KeyEventArgs e) { //如果输入的内容不正确改为默认值 if (!float.TryParse(txtThreshold.Text.Trim(), out threshold)) { threshold = 0.8f; } } #endregion #region 多频道信息 private void button1_Click(object sender, EventArgs e) { ChannelInfo channelInfo = new ChannelInfo(); channelInfo.Id = SidUtils.sid(); channelInfo.DatabaseName = "dycommondatabase30"; channelInfo.DatabaseType = 1; channelInfo.DatabasePassword = "1100110"; channelInfo.ServerName = "192.168.138.45"; channelInfo.UserName = "sa"; channelInfo.Name = "城市高清网"; Channel initChannel = new Channel(); //initChannel.AddChannel(channelInfo); //initChannel.QueryChannels(); List<ChannelInfo> lsit = Channel.QueryChannels(); Console.WriteLine("124"); } /// <summary> /// 初始化多频道信息 /// </summary> private void initMutiChannelComboBox() { List<ChannelInfo> channelInfoList = Channel.QueryChannels(); foreach (var item in channelInfoList) { comboBox1.Items.Add(item.Name); } } /// <summary> /// 选择多频道数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { var a = comboBox1.SelectedItem; currentChannel = Channel.QueryChannel(comboBox1.SelectedItem.ToString()); Console.WriteLine(a); } private void button_MutiChannelInfo_Sync_Click(object sender, EventArgs e) { // 数据迁移 MessageBox.Show("测试数据迁移"); Console.WriteLine("currentChannel" + currentChannel); //2.清洗sqlserver数据 //3.新的数据注入到mysql中的face表 if (currentChannel != null) { //1.选择指定的sqlserver数据表加载 // 初始化sqlserver数据库连接 string _connectString = "server='" + currentChannel.ServerName + "';database='" + currentChannel.DatabaseName + "';uid='" + currentChannel.UserName + "';pwd='" + currentChannel.DatabasePassword + "'"; IUser user = new UserInfo(); List<UserInfos> userInfoList = user.QueryUserInfos(_connectString); Console.WriteLine(_connectString); } } #endregion #region 用户信息相关 private void buttonSearchUser_Click(object sender, EventArgs e) { // 获取用户名 var userName = this.textBoxSearchUserName.Text; // 根据用户名查询用户 IUser userInfo = new UserInfo(); var c = userInfo.FuzzyFindUserByName("张进"); Console.WriteLine(c); } #region 用户列表listView public void initlistviewuserinfolist() { this.listViewUserList.View = View.Details; this.listViewUserList.FullRowSelect = true; //this.listViewUserList.SmallImageList = this.imageList1; this.listViewUserList.Columns.Add("姓名", 100, HorizontalAlignment.Left); this.listViewUserList.Columns.Add("频道", 100, HorizontalAlignment.Left); this.listViewUserList.Columns.Add("电话", 100, HorizontalAlignment.Left); this.listViewUserList.Columns.Add("用户状态", 100, HorizontalAlignment.Left); this.listViewUserList.Columns.Add("备注", 100, HorizontalAlignment.Left); this.listViewUserList.BeginUpdate(); for (int i = 0; i < 10; i++) { ListViewItem lvi = new ListViewItem(); lvi.Text = "item" + i; lvi.SubItems.Add("第2列,第" + i + "行"); lvi.SubItems.Add("第3列,第" + i + "行"); lvi.SubItems.Add("666"); lvi.SubItems.Add("这是备注"); this.listViewUserList.Items.Add(lvi); } this.listViewUserList.EndUpdate(); //结束数据处理,UI界面一次性绘制 } private void listViewUserList_SelectedIndexChanged(object sender, EventArgs e) { var selectCount = this.listViewUserList.SelectedItems.Count; if (selectCount == 0) return; var indexArr = this.listViewUserList.SelectedIndices; Console.WriteLine(); var index = indexArr[0]; var name = this.listViewUserList.Items[index].SubItems[0].Text; MessageBox.Show("你选中的的是:" + name); } #endregion #endregion } }
47.060739
349
0.468865
[ "MIT" ]
jinboy/Face-Reco
FaceReco/FaceRecoDataManager/FaceForm.cs
59,243
C#
// Copyright (c) 2016, SolidCP // SolidCP is distributed under the Creative Commons Share-alike license // // SolidCP is a fork of WebsitePanel: // Copyright (c) 2015, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // - Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // - Neither the name of the Outercurve Foundation nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace SolidCP.Portal.UserControls { public partial class EditVLANControl : SolidCPControlBase { public bool Required { get { return requireVLANValidator.Enabled; } set { requireVLANValidator.Enabled = value; } } public string ValidationGroup { get { return requireVLANValidator.ValidationGroup; } set { requireVLANValidator.ValidationGroup = value; vlanValidator.ValidationGroup = value; } } public Unit Width { get { return txtVLAN.Width; } set { txtVLAN.Width = value; } } public string Text { get { return txtVLAN.Text.Trim(); } set { txtVLAN.Text = value; } } public string RequiredErrorMessage { get { return requireVLANValidator.ErrorMessage; } set { requireVLANValidator.ErrorMessage = value; } } public string FormatErrorMessage { get { return vlanValidator.ErrorMessage; } set { vlanValidator.ErrorMessage = value; } } protected void Page_Load(object sender, EventArgs e) { } public void Validate(object source, ServerValidateEventArgs args) { try { var vlanStr = args.Value; int vlan = -1; if (string.IsNullOrEmpty(vlanStr)) { args.IsValid = false; return; } args.IsValid = int.TryParse(vlanStr, out vlan) && vlan >= 0 && vlan <= 4094; } catch (Exception) { args.IsValid = false; } } } }
34.898148
92
0.623508
[ "BSD-3-Clause" ]
Alirexaa/SolidCP
SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/UserControls/EditVLANControl.ascx.cs
3,771
C#
using System.Text.RegularExpressions; namespace IceShopLib.Validation { public class IsTwoWordsCondition : IInputCondition { public bool ValidateInput(string input) { if (Regex.IsMatch(input, "^\\w+\\s{1}\\w+$")) // TODO: Make this not return true if the input takes a number (replace \w) { return true; } return false; } } }
23.833333
133
0.559441
[ "MIT" ]
201019-UiPath/WeisVincent-P0
IceShop/IceShopLib/Validation/IsTwoWordsCondition.cs
431
C#
using System.Runtime.Serialization; namespace com.xxl.job.core.biz.model { public class ReturnT { public const int SUCCESS_CODE = 200; public const int FAIL_CODE = 500; public static readonly ReturnT SUCCESS = new ReturnT(SUCCESS_CODE, null); public static readonly ReturnT FAIL = new ReturnT(FAIL_CODE, null); public static readonly ReturnT FAIL_TIMEOUT = new ReturnT(502, null); public ReturnT() { } public ReturnT(int code, string msg) { this.code = code; this.msg = msg; } public int code; public string msg; public object content; public static ReturnT Failed(string msg) { return new ReturnT(FAIL_CODE, msg); } public static ReturnT Success(string msg) { return new ReturnT(SUCCESS_CODE, msg); } } }
22.44186
81
0.562694
[ "MIT" ]
yang-dw/DotXxlJob
src/DotXxlJob.Core/Model/ReturnT.cs
965
C#
using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Abp.Authorization; using Abp.Authorization.Users; using Abp.MultiTenancy; using Abp.Runtime.Security; using Abp.UI; using MetroDev.Boilerplate.Authentication.External; using MetroDev.Boilerplate.Authentication.JwtBearer; using MetroDev.Boilerplate.Authorization; using MetroDev.Boilerplate.Authorization.Users; using MetroDev.Boilerplate.Models.TokenAuth; using MetroDev.Boilerplate.MultiTenancy; namespace MetroDev.Boilerplate.Controllers { [Route("api/[controller]/[action]")] public class TokenAuthController : BoilerplateControllerBase { private readonly LogInManager _logInManager; private readonly ITenantCache _tenantCache; private readonly AbpLoginResultTypeHelper _abpLoginResultTypeHelper; private readonly TokenAuthConfiguration _configuration; private readonly IExternalAuthConfiguration _externalAuthConfiguration; private readonly IExternalAuthManager _externalAuthManager; private readonly UserRegistrationManager _userRegistrationManager; public TokenAuthController( LogInManager logInManager, ITenantCache tenantCache, AbpLoginResultTypeHelper abpLoginResultTypeHelper, TokenAuthConfiguration configuration, IExternalAuthConfiguration externalAuthConfiguration, IExternalAuthManager externalAuthManager, UserRegistrationManager userRegistrationManager) { _logInManager = logInManager; _tenantCache = tenantCache; _abpLoginResultTypeHelper = abpLoginResultTypeHelper; _configuration = configuration; _externalAuthConfiguration = externalAuthConfiguration; _externalAuthManager = externalAuthManager; _userRegistrationManager = userRegistrationManager; } [HttpPost] public async Task<AuthenticateResultModel> Authenticate([FromBody] AuthenticateModel model) { var loginResult = await GetLoginResultAsync( model.UserNameOrEmailAddress, model.Password, GetTenancyNameOrNull() ); var accessToken = CreateAccessToken(CreateJwtClaims(loginResult.Identity)); return new AuthenticateResultModel { AccessToken = accessToken, EncryptedAccessToken = GetEncryptedAccessToken(accessToken), ExpireInSeconds = (int)_configuration.Expiration.TotalSeconds, UserId = loginResult.User.Id }; } [HttpGet] public List<ExternalLoginProviderInfoModel> GetExternalAuthenticationProviders() { return ObjectMapper.Map<List<ExternalLoginProviderInfoModel>>(_externalAuthConfiguration.Providers); } [HttpPost] public async Task<ExternalAuthenticateResultModel> ExternalAuthenticate([FromBody] ExternalAuthenticateModel model) { var externalUser = await GetExternalUserInfo(model); var loginResult = await _logInManager.LoginAsync(new UserLoginInfo(model.AuthProvider, model.ProviderKey, model.AuthProvider), GetTenancyNameOrNull()); switch (loginResult.Result) { case AbpLoginResultType.Success: { var accessToken = CreateAccessToken(CreateJwtClaims(loginResult.Identity)); return new ExternalAuthenticateResultModel { AccessToken = accessToken, EncryptedAccessToken = GetEncryptedAccessToken(accessToken), ExpireInSeconds = (int)_configuration.Expiration.TotalSeconds }; } case AbpLoginResultType.UnknownExternalLogin: { var newUser = await RegisterExternalUserAsync(externalUser); if (!newUser.IsActive) { return new ExternalAuthenticateResultModel { WaitingForActivation = true }; } // Try to login again with newly registered user! loginResult = await _logInManager.LoginAsync(new UserLoginInfo(model.AuthProvider, model.ProviderKey, model.AuthProvider), GetTenancyNameOrNull()); if (loginResult.Result != AbpLoginResultType.Success) { throw _abpLoginResultTypeHelper.CreateExceptionForFailedLoginAttempt( loginResult.Result, model.ProviderKey, GetTenancyNameOrNull() ); } return new ExternalAuthenticateResultModel { AccessToken = CreateAccessToken(CreateJwtClaims(loginResult.Identity)), ExpireInSeconds = (int)_configuration.Expiration.TotalSeconds }; } default: { throw _abpLoginResultTypeHelper.CreateExceptionForFailedLoginAttempt( loginResult.Result, model.ProviderKey, GetTenancyNameOrNull() ); } } } private async Task<User> RegisterExternalUserAsync(ExternalAuthUserInfo externalUser) { var user = await _userRegistrationManager.RegisterAsync( externalUser.Name, externalUser.Surname, externalUser.EmailAddress, externalUser.EmailAddress, Authorization.Users.User.CreateRandomPassword(), true ); user.Logins = new List<UserLogin> { new UserLogin { LoginProvider = externalUser.Provider, ProviderKey = externalUser.ProviderKey, TenantId = user.TenantId } }; await CurrentUnitOfWork.SaveChangesAsync(); return user; } private async Task<ExternalAuthUserInfo> GetExternalUserInfo(ExternalAuthenticateModel model) { var userInfo = await _externalAuthManager.GetUserInfo(model.AuthProvider, model.ProviderAccessCode); if (userInfo.ProviderKey != model.ProviderKey) { throw new UserFriendlyException(L("CouldNotValidateExternalUser")); } return userInfo; } private string GetTenancyNameOrNull() { if (!AbpSession.TenantId.HasValue) { return null; } return _tenantCache.GetOrNull(AbpSession.TenantId.Value)?.TenancyName; } private async Task<AbpLoginResult<Tenant, User>> GetLoginResultAsync(string usernameOrEmailAddress, string password, string tenancyName) { var loginResult = await _logInManager.LoginAsync(usernameOrEmailAddress, password, tenancyName); switch (loginResult.Result) { case AbpLoginResultType.Success: return loginResult; default: throw _abpLoginResultTypeHelper.CreateExceptionForFailedLoginAttempt(loginResult.Result, usernameOrEmailAddress, tenancyName); } } private string CreateAccessToken(IEnumerable<Claim> claims, TimeSpan? expiration = null) { var now = DateTime.UtcNow; var jwtSecurityToken = new JwtSecurityToken( issuer: _configuration.Issuer, audience: _configuration.Audience, claims: claims, notBefore: now, expires: now.Add(expiration ?? _configuration.Expiration), signingCredentials: _configuration.SigningCredentials ); return new JwtSecurityTokenHandler().WriteToken(jwtSecurityToken); } private static List<Claim> CreateJwtClaims(ClaimsIdentity identity) { var claims = identity.Claims.ToList(); var nameIdClaim = claims.First(c => c.Type == ClaimTypes.NameIdentifier); // Specifically add the jti (random nonce), iat (issued timestamp), and sub (subject/user) claims. claims.AddRange(new[] { new Claim(JwtRegisteredClaimNames.Sub, nameIdClaim.Value), new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), new Claim(JwtRegisteredClaimNames.Iat, DateTimeOffset.Now.ToUnixTimeSeconds().ToString(), ClaimValueTypes.Integer64) }); return claims; } private string GetEncryptedAccessToken(string accessToken) { return SimpleStringCipher.Instance.Encrypt(accessToken, AppConsts.DefaultPassPhrase); } } }
40.713675
171
0.601553
[ "MIT" ]
juanwfer/MetroDev-AbpTest
src/MetroDev.Boilerplate.Web.Core/Controllers/TokenAuthController.cs
9,529
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; using Cake.Core.IO.Globbing.Nodes; using Cake.Core.IO.Globbing.Nodes.Segments; namespace Cake.Core.IO.Globbing { internal static class GlobNodeRewriter { public static GlobNode Rewrite(GlobPattern pattern, IEnumerable<GlobNode> nodes) { return RewriteUncRoot(pattern, CreateLinkedList( RewriteSingleWildcards(nodes))); } private static GlobNode RewriteUncRoot(GlobPattern pattern, GlobNode root) { if (root is UncRootNode unc && unc.Server == null) { var next = unc.Next; if (next == null) { throw new CakeException($"The pattern '{pattern}' has no server part specified."); } else if (next is PathNode path && path.IsIdentifier) { // Rewrite the root node. return new UncRootNode(path.GetPath()) { Next = next.Next }; } else { throw new CakeException($"The pattern '{pattern}' has an invalid server part specified."); } } return root; } private static GlobNode CreateLinkedList(IEnumerable<GlobNode> nodes) { var result = new Stack<GlobNode>(); var stack = new Stack<GlobNode>(nodes); var previous = stack.Pop(); result.Push(previous); while (stack.Count > 0) { var current = stack.Pop(); current.Next = previous; previous = current; result.Push(previous); } return result.Pop(); } private static IEnumerable<GlobNode> RewriteSingleWildcards(IEnumerable<GlobNode> nodes) { foreach (var node in nodes) { var segmentNode = node as PathNode; if (segmentNode?.Segments.Count == 1) { if (segmentNode.Segments[0] is WildcardSegment) { yield return new WildcardNode(); continue; } } yield return node; } } } }
34.051948
110
0.501526
[ "MIT" ]
Acidburn0zzz/cake
src/Cake.Core/IO/Globbing/GlobNodeRewriter.cs
2,624
C#
#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange // // Copyright (c) 2005-2016 empira Software GmbH, Cologne Area (Germany) // // http://www.PdfSharpCore.com // http://sourceforge.net/projects/pdfsharp // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #endregion using System; namespace PdfSharpCore.Pdf.Filters { /// <summary> /// Implements the ASCII85Decode filter. /// </summary> public class Ascii85Decode : Filter { // Reference: 3.3.2 ASCII85Decode Filter / Page 69 /// <summary> /// Encodes the specified data. /// </summary> public override byte[] Encode(byte[] data) { if (data == null) throw new ArgumentNullException("data"); int length = data.Length; // length == 0 is must not be treated as a special case. int words = length / 4; int rest = length - (words * 4); byte[] result = new byte[words * 5 + (rest == 0 ? 0 : rest + 1) + 2]; int idxIn = 0, idxOut = 0; int wCount = 0; while (wCount < words) { uint val = ((uint)data[idxIn++] << 24) + ((uint)data[idxIn++] << 16) + ((uint)data[idxIn++] << 8) + data[idxIn++]; if (val == 0) { result[idxOut++] = (byte)'z'; } else { byte c5 = (byte)(val % 85 + '!'); val /= 85; byte c4 = (byte)(val % 85 + '!'); val /= 85; byte c3 = (byte)(val % 85 + '!'); val /= 85; byte c2 = (byte)(val % 85 + '!'); val /= 85; byte c1 = (byte)(val + '!'); result[idxOut++] = c1; result[idxOut++] = c2; result[idxOut++] = c3; result[idxOut++] = c4; result[idxOut++] = c5; } wCount++; } if (rest == 1) { uint val = (uint)data[idxIn] << 24; val /= 85 * 85 * 85; byte c2 = (byte)(val % 85 + '!'); val /= 85; byte c1 = (byte)(val + '!'); result[idxOut++] = c1; result[idxOut++] = c2; } else if (rest == 2) { uint val = ((uint)data[idxIn++] << 24) + ((uint)data[idxIn] << 16); val /= 85 * 85; byte c3 = (byte)(val % 85 + '!'); val /= 85; byte c2 = (byte)(val % 85 + '!'); val /= 85; byte c1 = (byte)(val + '!'); result[idxOut++] = c1; result[idxOut++] = c2; result[idxOut++] = c3; } else if (rest == 3) { uint val = ((uint)data[idxIn++] << 24) + ((uint)data[idxIn++] << 16) + ((uint)data[idxIn] << 8); val /= 85; byte c4 = (byte)(val % 85 + '!'); val /= 85; byte c3 = (byte)(val % 85 + '!'); val /= 85; byte c2 = (byte)(val % 85 + '!'); val /= 85; byte c1 = (byte)(val + '!'); result[idxOut++] = c1; result[idxOut++] = c2; result[idxOut++] = c3; result[idxOut++] = c4; } result[idxOut++] = (byte)'~'; result[idxOut++] = (byte)'>'; if (idxOut < result.Length) Array.Resize(ref result, idxOut); return result; } /// <summary> /// Decodes the specified data. /// </summary> public override byte[] Decode(byte[] data, FilterParms parms) { if (data == null) throw new ArgumentNullException("data"); int idx; int length = data.Length; int zCount = 0; int idxOut = 0; for (idx = 0; idx < length; idx++) { char ch = (char)data[idx]; if (ch >= '!' && ch <= 'u') data[idxOut++] = (byte)ch; else if (ch == 'z') { data[idxOut++] = (byte)ch; zCount++; } else if (ch == '~') { if ((char)data[idx + 1] != '>') throw new ArgumentException("Illegal character.", "data"); break; } // ingnore unknown character } // Loop not ended with break? if (idx == length) throw new ArgumentException("Illegal character.", "data"); length = idxOut; int nonZero = length - zCount; int byteCount = 4 * (zCount + (nonZero / 5)); // full 4 byte blocks int remainder = nonZero % 5; if (remainder == 1) throw new InvalidOperationException("Illegal character."); if (remainder != 0) byteCount += remainder - 1; byte[] output = new byte[byteCount]; idxOut = 0; idx = 0; while (idx + 4 < length) { char ch = (char)data[idx]; if (ch == 'z') { idx++; idxOut += 4; } else { // TODO: check long value = (long)(data[idx++] - '!') * (85 * 85 * 85 * 85) + (uint)(data[idx++] - '!') * (85 * 85 * 85) + (uint)(data[idx++] - '!') * (85 * 85) + (uint)(data[idx++] - '!') * 85 + (uint)(data[idx++] - '!'); if (value > UInt32.MaxValue) throw new InvalidOperationException("Value of group greater than 2 power 32 - 1."); output[idxOut++] = (byte)(value >> 24); output[idxOut++] = (byte)(value >> 16); output[idxOut++] = (byte)(value >> 8); output[idxOut++] = (byte)value; } } // I have found no appropriate algorithm, so I write my own. In some rare cases the value must not // increased by one, but I cannot found a general formula or a proof. // All possible cases are tested programmatically. if (remainder == 2) // one byte { uint value = (uint)(data[idx++] - '!') * (85 * 85 * 85 * 85) + (uint)(data[idx] - '!') * (85 * 85 * 85); // Always increase if not zero (tried out). if (value != 0) value += 0x01000000; output[idxOut] = (byte)(value >> 24); } else if (remainder == 3) // two bytes { int idxIn = idx; uint value = (uint)(data[idx++] - '!') * (85 * 85 * 85 * 85) + (uint)(data[idx++] - '!') * (85 * 85 * 85) + (uint)(data[idx] - '!') * (85 * 85); if (value != 0) { value &= 0xFFFF0000; uint val = value / (85 * 85); byte c3 = (byte)(val % 85 + '!'); val /= 85; byte c2 = (byte)(val % 85 + '!'); val /= 85; byte c1 = (byte)(val + '!'); if (c1 != data[idxIn] || c2 != data[idxIn + 1] || c3 != data[idxIn + 2]) { value += 0x00010000; //Count2++; } } output[idxOut++] = (byte)(value >> 24); output[idxOut] = (byte)(value >> 16); } else if (remainder == 4) // three bytes { int idxIn = idx; uint value = (uint)(data[idx++] - '!') * (85 * 85 * 85 * 85) + (uint)(data[idx++] - '!') * (85 * 85 * 85) + (uint)(data[idx++] - '!') * (85 * 85) + (uint)(data[idx] - '!') * 85; if (value != 0) { value &= 0xFFFFFF00; uint val = value / 85; byte c4 = (byte)(val % 85 + '!'); val /= 85; byte c3 = (byte)(val % 85 + '!'); val /= 85; byte c2 = (byte)(val % 85 + '!'); val /= 85; byte c1 = (byte)(val + '!'); if (c1 != data[idxIn] || c2 != data[idxIn + 1] || c3 != data[idxIn + 2] || c4 != data[idxIn + 3]) { value += 0x00000100; //Count3++; } } output[idxOut++] = (byte)(value >> 24); output[idxOut++] = (byte)(value >> 16); output[idxOut] = (byte)(value >> 8); } return output; } } }
36.688811
130
0.398361
[ "MIT" ]
929496959/PdfSharpCore
PdfSharpCore/Pdf.Filters/Ascii85Decode.cs
10,493
C#
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Collections.Generic; using System.Reflection; using System.Text; using log4net; using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; using OpenSim.Region.OptionalModules.World.NPC; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api; using OpenSim.Region.ScriptEngine.Shared.Instance; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; namespace OpenSim.Region.ScriptEngine.Shared.Tests { /// <summary> /// Tests for OSSL NPC API /// </summary> [TestFixture] public class OSSL_NpcApiAppearanceTest : OpenSimTestCase { protected Scene m_scene; protected XEngine.XEngine m_engine; [SetUp] public override void SetUp() { base.SetUp(); IConfigSource initConfigSource = new IniConfigSource(); IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); config.Set("AllowOSFunctions", "true"); config.Set("OSFunctionThreatLevel", "Severe"); config = initConfigSource.AddConfig("NPC"); config.Set("Enabled", "true"); m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules( m_scene, initConfigSource, new AvatarFactoryModule(), new AttachmentsModule(), new NPCModule()); m_engine = new XEngine.XEngine(); m_engine.Initialise(initConfigSource); m_engine.AddRegion(m_scene); } /// <summary> /// Test creation of an NPC where the appearance data comes from a notecard /// </summary> [Test] public void TestOsNpcCreateUsingAppearanceFromNotecard() { TestHelpers.InMethod(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); float newHeight = 1.9f; ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = newHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); SceneObjectPart part = so.RootPart; m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, part, null, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); // Try creating a bot using the appearance in the notecard. string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName); Assert.That(npcRaw, Is.Not.Null); UUID npcId = new UUID(npcRaw); ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); } [Test] public void TestOsNpcCreateNotExistingNotecard() { TestHelpers.InMethod(); UUID userId = TestHelpers.ParseTail(0x1); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, so.RootPart, null, null); bool gotExpectedException = false; try { osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name"); } catch (ScriptException) { gotExpectedException = true; } Assert.That(gotExpectedException, Is.True); } /// <summary> /// Test creation of an NPC where the appearance data comes from an avatar already in the region. /// </summary> [Test] public void TestOsNpcCreateUsingAppearanceFromAvatar() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); float newHeight = 1.9f; ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = newHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); SceneObjectPart part = so.RootPart; m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, part, null, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); // Try creating a bot using the existing avatar's appearance string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString()); Assert.That(npcRaw, Is.Not.Null); UUID npcId = new UUID(npcRaw); ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); } [Test] public void TestOsNpcLoadAppearance() { TestHelpers.InMethod(); //TestHelpers.EnableLogging(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); float firstHeight = 1.9f; float secondHeight = 2.1f; string firstAppearanceNcName = "appearanceNc1"; string secondAppearanceNcName = "appearanceNc2"; ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = firstHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); SceneObjectPart part = so.RootPart; m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, part, null, null); osslApi.osOwnerSaveAppearance(firstAppearanceNcName); string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName); // Create a second appearance notecard with a different height sp.Appearance.AvatarHeight = secondHeight; osslApi.osOwnerSaveAppearance(secondAppearanceNcName); osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName); UUID npcId = new UUID(npcRaw); ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(secondHeight)); } [Test] public void TestOsNpcLoadAppearanceNotExistingNotecard() { TestHelpers.InMethod(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); float firstHeight = 1.9f; // float secondHeight = 2.1f; string firstAppearanceNcName = "appearanceNc1"; string secondAppearanceNcName = "appearanceNc2"; ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = firstHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); SceneObjectPart part = so.RootPart; m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, part, null, null); osslApi.osOwnerSaveAppearance(firstAppearanceNcName); string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName); bool gotExpectedException = false; try { osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName); } catch (ScriptException) { gotExpectedException = true; } Assert.That(gotExpectedException, Is.True); UUID npcId = new UUID(npcRaw); ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(firstHeight)); } /// <summary> /// Test removal of an owned NPC. /// </summary> [Test] public void TestOsNpcRemoveOwned() { TestHelpers.InMethod(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); UUID otherUserId = TestHelpers.ParseTail(0x2); float newHeight = 1.9f; SceneHelpers.AddScenePresence(m_scene, otherUserId); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = newHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); SceneObjectPart part = so.RootPart; m_scene.AddSceneObject(so); SceneObjectGroup otherSo = SceneHelpers.CreateSceneObject(1, otherUserId, 0x20); SceneObjectPart otherPart = otherSo.RootPart; m_scene.AddSceneObject(otherSo); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, part, null, null); OSSL_Api otherOsslApi = new OSSL_Api(); otherOsslApi.Initialize(m_engine, otherPart, null, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); string npcRaw = osslApi.osNpcCreate( "Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName, ScriptBaseClass.OS_NPC_CREATOR_OWNED); otherOsslApi.osNpcRemove(npcRaw); // Should still be around UUID npcId = new UUID(npcRaw); ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); osslApi.osNpcRemove(npcRaw); npc = m_scene.GetScenePresence(npcId); // Now the owner deleted it and it's gone Assert.That(npc, Is.Null); } /// <summary> /// Test removal of an unowned NPC. /// </summary> [Test] public void TestOsNpcRemoveUnowned() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); float newHeight = 1.9f; ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = newHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); SceneObjectPart part = so.RootPart; m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, part, null, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); string npcRaw = osslApi.osNpcCreate( "Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName, ScriptBaseClass.OS_NPC_NOT_OWNED); osslApi.osNpcRemove(npcRaw); UUID npcId = new UUID(npcRaw); ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Null); } } }
39.244318
125
0.632474
[ "BSD-3-Clause" ]
AlericInglewood/opensimulator
OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
13,814
C#
using System; using System.Net.Http; using System.Collections.Generic; using System.Threading.Tasks; using System.Text; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; // other usings using Blazorise; using Blazorise.Bootstrap; using Blazorise.Icons.FontAwesome; namespace Blazorise_Ex { public class Program { public static async Task Main( string[] args ) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add<App>("#app"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); await builder.Build().RunAsync(); } } }
28.166667
125
0.71716
[ "MIT" ]
bpbpublications/Cross-Platform-Modern-Apps-with-VS-Code
Chapter 3 Code Samples/Blazorise_Ex/Blazorise_Ex/Program.cs
845
C#
using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; using System.Collections.Generic; using System.Dynamic; using System.Linq; using System.Threading.Tasks; namespace SignalRest { public class ClientProxy : DynamicObject, IClientProxy { public ClientProxy(string hubName, IList<string> exclude) { HubName = hubName; Exclude = exclude; } private string HubName { get; } private IList<string> Exclude { get; } public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { result = Invoke(binder.Name, args); return true; } public async Task Invoke(string method, params object[] args) { ApiController.ClientProxyInvoke(Exclude, HubName, method, args); await ((IClientProxy)GlobalHost.ConnectionManager.GetHubContext(HubName).Clients.AllExcept(Exclude.ToArray())).Invoke(method, args); } } }
30.029412
144
0.65524
[ "Apache-2.0" ]
BigBadBleuCheese/SignalREST
SignalRest/ClientProxy.cs
1,023
C#
//////////////////////////////////////////////////////////////////////////// // // Copyright 2016 Realm Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////// using System; using Android.App; using Android.Content.PM; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; namespace ThreeLayerRealmXF.Droid { [Activity(Label = "ThreeLayerRealmXF", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); } } }
34.439024
166
0.643768
[ "Apache-2.0" ]
datasprings/Realm
Tests/ThreeLayerRealmXF/ThreeLayerRealmXF/ThreeLayerRealmXF.Droid/MainActivity.cs
1,414
C#
namespace OnlineBookStoreDemo.Web.Areas.Identity.Pages { using System.Diagnostics; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; [AllowAnonymous] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] #pragma warning disable SA1649 // File name should match first type name public class ErrorModel : PageModel #pragma warning restore SA1649 // File name should match first type name { public string RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); public void OnGet() { this.RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier; } } }
31.52
88
0.704315
[ "MIT" ]
Pivchev/OnlineBookStoreDemo
src/Web/OnlineBookStoreDemo.Web/Areas/Identity/Pages/Error.cshtml.cs
790
C#
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGame.Extended; using MonoGame.Extended.Sprites; using MonoGame.Extended.TextureAtlases; namespace SpaceGame.Entities { public class Laser : Entity { private readonly Sprite _sprite; private readonly Transform2 _transform; private float _timeToLive; public Vector2 Position { get { return _transform.Position; } set { _transform.Position = value; } } public float Rotation { get { return _transform.Rotation; } set { _transform.Rotation = value; } } public Vector2 Velocity { get; set; } public Laser(TextureRegion2D textureRegion, Vector2 velocity) { _timeToLive = 1.0f; _sprite = new Sprite(textureRegion); _transform = new Transform2 { Scale = Vector2.One * 0.5f }; Velocity = velocity; } public override void Update(GameTime gameTime) { var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; Position += Velocity * deltaTime; _timeToLive -= deltaTime; if (_timeToLive <= 0) { Destroy(); } } public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(_sprite, _transform); } } }
25.237288
73
0.563465
[ "MIT" ]
Acidburn0zzz/MonoGame.Extended
Source/Demos/SpaceGame/Entities/Laser.cs
1,489
C#
using System; using System.Collections.Generic; using Content.Server.AI.Operators.Sequences; using Content.Server.AI.Utility.Considerations; using Content.Server.AI.Utility.Considerations.Combat.Melee; using Content.Server.AI.Utility.Considerations.Containers; using Content.Server.AI.Utility.Considerations.Movement; using Content.Server.AI.WorldState; using Content.Server.AI.WorldState.States; using Content.Server.AI.WorldState.States.Combat; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; namespace Content.Server.AI.Utility.Actions.Combat.Melee { public sealed class PickUpMeleeWeapon : UtilityAction { private readonly IEntity _entity; public PickUpMeleeWeapon(IEntity owner, IEntity entity, float weight) : base(owner) { _entity = entity; Bonus = weight; } public override void SetupOperators(Blackboard context) { ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence; } protected override void UpdateBlackboard(Blackboard context) { base.UpdateBlackboard(context); context.GetState<TargetEntityState>().SetValue(_entity); context.GetState<WeaponEntityState>().SetValue(_entity); } protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve<ConsiderationsManager>(); return new[] { considerationsManager.Get<TargetDistanceCon>() .PresetCurve(context, PresetCurve.Distance), considerationsManager.Get<MeleeWeaponDamageCon>() .QuadraticCurve(context, 1.0f, 0.25f, 0.0f, 0.0f), considerationsManager.Get<MeleeWeaponSpeedCon>() .QuadraticCurve(context, -1.0f, 0.5f, 1.0f, 0.0f), considerationsManager.Get<TargetAccessibleCon>() .BoolCurve(context), }; } } }
36.910714
97
0.66715
[ "MIT" ]
BananaFlambe/space-station-14
Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs
2,067
C#
/* * Pixel Framework * * This framework allows you to develop games for mobile devices even faster than you normally do. * It includes a lot of useful classes, resources, and examples to get your project started. * The framework will be especially useful for developers of hyper-casual games. * * This framework was developed specifically for Pixel Incubator members with the support of TinyPlay. * You can read more about Incubator at the official website: * https://pixinc.club/ * * @developer Ilya Rastorguev * @autor TinyPlay, Inc. * @version 1.0 * @url https://pixinc.club/ * @support https://github.com/TinyPlay/PixelFramework/issues * @discord https://discord.gg/wE67T7Vm */ namespace PixelFramework.UI.Components { using UnityEngine; using UnityEngine.UI; using PixelFramework.Core.Networking; using PixelFramework.Managers; /// <summary> /// Web Image Class /// </summary> [RequireComponent(typeof(Image))] [AddComponentMenu("Pixel Framework/UI/Web Image")] internal class WebImage : MonoBehaviour { // Image Params [Header("Image Configs")] [SerializeField] private string Url = ""; [SerializeField] private bool IsCaching = true; [SerializeField] private int CacheLifetime = 300; [Header("Image Placeholder")] [SerializeField] private Sprite ImagePlaceholder; // Image Container private Image _image; /// <summary> /// On Awake /// </summary> private void Awake() { _image = gameObject.GetComponent<Image>(); } /// <summary> /// On Start /// </summary> private void Start() { _image.sprite = ImagePlaceholder; NetworkManager.Instance().Download(new SpriteRequest(new SpriteRequestConfig() { Url = Url, CacheRequest = IsCaching, CacheLifetime = CacheLifetime, OnComplete = sprite => { _image.sprite = sprite; }, OnError = error =>{ _image.sprite = ImagePlaceholder; Debug.Log($"Failed to Download Image: {Url}"); } })); } } }
31.853333
102
0.575555
[ "MIT" ]
TinyPlay/PixelFramework
Pixel Framework/Assets/PixelFramework/UI/Components/WebImage.cs
2,391
C#
using Quartz; using Quartz.Impl; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.IO; using System.Linq; using System.Xml.Linq; using System.Xml.XPath; using Wexflow.Core.Db; namespace Wexflow.Core { /// <summary> /// Wexflow engine. /// </summary> public class WexflowEngine { /// <summary> /// Settings file path. /// </summary> public string SettingsFile { get; private set; } /// <summary> /// Workflows folder path. /// </summary> public string WorkflowsFolder { get; private set; } /// <summary> /// Trash folder path. /// </summary> public string TrashFolder { get; private set; } /// <summary> /// Temp folder path. /// </summary> public string TempFolder { get; private set; } /// <summary> /// Tasks folder path. /// </summary> public string TasksFolder { get; private set; } /// <summary> /// Workflows temp folder used for global variables parsing. /// </summary> public string WorkflowsTempFolder { get; private set; } /// <summary> /// XSD path. /// </summary> public string XsdPath { get; private set; } /// <summary> /// Tasks names file path. /// </summary> public string TasksNamesFile { get; private set; } /// <summary> /// Tasks settings file path. /// </summary> public string TasksSettingsFile { get; private set; } /// <summary> /// List of the Workflows loaded by Wexflow engine. /// </summary> public IList<Workflow> Workflows { get; private set; } /// <summary> /// Database connection string. /// </summary> public string ConnectionString { get; private set; } /// <summary> /// Global variables file. /// </summary> public string GlobalVariablesFile { get; private set; } /// <summary> /// Global variables. /// </summary> public Variable[] GlobalVariables { get; private set; } /// <summary> /// Database /// </summary> public Db.Db Database { get; private set; } // // Quartz scheduler // private static readonly NameValueCollection QuartzProperties = new NameValueCollection { // JSON serialization is the one supported under .NET Core (binary isn't) ["quartz.serializer.type"] = "json" }; private static readonly ISchedulerFactory SchedulerFactory = new StdSchedulerFactory(QuartzProperties); private static readonly IScheduler QuartzScheduler = SchedulerFactory.GetScheduler().Result; /// <summary> /// Creates a new instance of Wexflow engine. /// </summary> /// <param name="settingsFile">Settings file path.</param> public WexflowEngine(string settingsFile) { SettingsFile = settingsFile; Workflows = new List<Workflow>(); Logger.Info(""); Logger.Info("Starting Wexflow Engine"); LoadSettings(); Database = new Db.Db(ConnectionString); Database.Init(); LoadGlobalVariables(); LoadWorkflows(); //Task<IScheduler> ischeduler = SchedulerFactory.GetScheduler(); //ischeduler.Wait(); //QuartzScheduler = ischeduler.Result; } /// <summary> /// Checks whether a cron expression is valid or not. /// </summary> /// <param name="expression">Cron expression</param> /// <returns></returns> public static bool IsCronExpressionValid(string expression) { bool res = CronExpression.IsValidExpression(expression); return res; } private void LoadSettings() { var xdoc = XDocument.Load(SettingsFile); WorkflowsFolder = GetWexflowSetting(xdoc, "workflowsFolder"); TrashFolder = GetWexflowSetting(xdoc, "trashFolder"); TempFolder = GetWexflowSetting(xdoc, "tempFolder"); TasksFolder = GetWexflowSetting(xdoc, "tasksFolder"); if (!Directory.Exists(TempFolder)) Directory.CreateDirectory(TempFolder); WorkflowsTempFolder = Path.Combine(TempFolder, "Workflows"); if (!Directory.Exists(WorkflowsTempFolder)) Directory.CreateDirectory(WorkflowsTempFolder); XsdPath = GetWexflowSetting(xdoc, "xsd"); TasksNamesFile = GetWexflowSetting(xdoc, "tasksNamesFile"); TasksSettingsFile = GetWexflowSetting(xdoc, "tasksSettingsFile"); ConnectionString = GetWexflowSetting(xdoc, "connectionString"); GlobalVariablesFile = GetWexflowSetting(xdoc, "globalVariablesFile"); } private void LoadGlobalVariables() { List<Variable> variables = new List<Variable>(); XDocument xdoc = XDocument.Load(GlobalVariablesFile); foreach (var xvariable in xdoc.Descendants("Variable")) { Variable variable = new Variable { Key = xvariable.Attribute("name").Value, Value = xvariable.Attribute("value").Value }; variables.Add(variable); } GlobalVariables = variables.ToArray(); } private string GetWexflowSetting(XDocument xdoc, string name) { try { var xValue = xdoc.XPathSelectElement(string.Format("/Wexflow/Setting[@name='{0}']", name)).Attribute("value"); if (xValue == null) throw new Exception("Wexflow Setting Value attribute not found."); return xValue.Value; } catch (Exception e) { Logger.ErrorFormat("An error occured when reading Wexflow settings: Setting[@name='{0}']", e, name); return string.Empty; } } private void LoadWorkflows() { foreach (string file in Directory.GetFiles(WorkflowsFolder)) { var workflow = LoadWorkflowFromFile(file); if (workflow != null) { Workflows.Add(workflow); } } } public void StopCronJobs(int workflowId) { string jobIdentity = "Workflow Job " + workflowId; var jobKey = new JobKey(jobIdentity); if (QuartzScheduler.CheckExists(jobKey).Result) { QuartzScheduler.DeleteJob(jobKey); } } public Workflow LoadWorkflowFromFile(string file) { try { var wf = new Workflow(file, TempFolder, WorkflowsTempFolder, TasksFolder, XsdPath, Database, GlobalVariables); Logger.InfoFormat("Workflow loaded: {0} ({1})", wf, file); return wf; } catch (Exception e) { Logger.ErrorFormat("An error occured while loading the workflow : {0} Please check the workflow configuration. Error: {1}", file, e.Message); return null; } } /// <summary> /// Starts Wexflow engine. /// </summary> public void Run() { foreach (Workflow workflow in Workflows) { ScheduleWorkflow(workflow); } if (!QuartzScheduler.IsStarted) { QuartzScheduler.Start().Wait(); } } public void ScheduleWorkflow(Workflow wf) { if (wf.IsEnabled) { if (wf.LaunchType == LaunchType.Startup) { wf.Start(); } else if (wf.LaunchType == LaunchType.Periodic) { IDictionary<string, object> map = new Dictionary<string, object>(); map.Add("workflow", wf); string jobIdentity = "Workflow Job " + wf.Id; IJobDetail jobDetail = JobBuilder.Create<WorkflowJob>() .WithIdentity(jobIdentity) .SetJobData(new JobDataMap(map)) .Build(); ITrigger trigger = TriggerBuilder.Create() .ForJob(jobDetail) .WithSimpleSchedule( x => x.WithInterval(wf.Period).RepeatForever()) .WithIdentity("Workflow Trigger " + wf.Id) .StartNow() .Build(); var jobKey = new JobKey(jobIdentity); if (QuartzScheduler.CheckExists(jobKey).Result) { QuartzScheduler.DeleteJob(jobKey); } QuartzScheduler.ScheduleJob(jobDetail, trigger).Wait(); } else if (wf.LaunchType == LaunchType.Cron) { IDictionary<string, object> map = new Dictionary<string, object>(); map.Add("workflow", wf); string jobIdentity = "Workflow Job " + wf.Id; IJobDetail jobDetail = JobBuilder.Create<WorkflowJob>() .WithIdentity(jobIdentity) .SetJobData(new JobDataMap(map)) .Build(); ITrigger trigger = TriggerBuilder.Create() .ForJob(jobDetail) .WithCronSchedule(wf.CronExpression) .WithIdentity("Workflow Trigger " + wf.Id) .StartNow() .Build(); var jobKey = new JobKey(jobIdentity); if (QuartzScheduler.CheckExists(jobKey).Result) { QuartzScheduler.DeleteJob(jobKey); } QuartzScheduler.ScheduleJob(jobDetail, trigger).Wait(); } } } /// <summary> /// Stops Wexflow engine. /// </summary> /// <param name="stopQuartzScheduler">Tells if Quartz scheduler should be stopped or not.</param> /// <param name="clearStatusCountAndEntries">Indicates whether to clear statusCount and entries.</param> public void Stop(bool stopQuartzScheduler, bool clearStatusCountAndEntries) { if (stopQuartzScheduler) { QuartzScheduler.Shutdown().Wait(); } foreach (var wf in Workflows) { if (wf.IsRunning) { wf.Stop(); } } if (clearStatusCountAndEntries) { Database.ClearStatusCount(); Database.ClearEntries(); } } /// <summary> /// Gets a workflow. /// </summary> /// <param name="workflowId">Workflow Id.</param> /// <returns></returns> public Workflow GetWorkflow(int workflowId) { return Workflows.FirstOrDefault(wf => wf.Id == workflowId); } /// <summary> /// Starts a workflow. /// </summary> /// <param name="workflowId">Workflow Id.</param> public void StartWorkflow(int workflowId) { var wf = GetWorkflow(workflowId); if (wf == null) { Logger.ErrorFormat("Workflow {0} not found.", workflowId); } else { if (wf.IsEnabled) wf.Start(); } } /// <summary> /// Stops a workflow. /// </summary> /// <param name="workflowId">Workflow Id.</param> public bool StopWorkflow(int workflowId) { var wf = GetWorkflow(workflowId); if (wf == null) { Logger.ErrorFormat("Workflow {0} not found.", workflowId); } else { if (wf.IsEnabled) return wf.Stop(); } return false; } /// <summary> /// Suspends a workflow. /// </summary> /// <param name="workflowId">Workflow Id.</param> public bool SuspendWorkflow(int workflowId) { var wf = GetWorkflow(workflowId); if (wf == null) { Logger.ErrorFormat("Workflow {0} not found.", workflowId); } else { if (wf.IsEnabled) return wf.Suspend(); } return false; } /// <summary> /// Resumes a workflow. /// </summary> /// <param name="workflowId">Workflow Id.</param> public void ResumeWorkflow(int workflowId) { var wf = GetWorkflow(workflowId); if (wf == null) { Logger.ErrorFormat("Workflow {0} not found.", workflowId); } else { if (wf.IsEnabled) wf.Resume(); } } /// <summary> /// Returns status count /// </summary> /// <returns>Returns status count</returns> public StatusCount GetStatusCount() { return Database.GetStatusCount(); } /// <summary> /// Returns all the entries /// </summary> /// <returns>Returns all the entries</returns> public Entry[] GetEntries() { return Database.GetEntries().ToArray(); } /// <summary> /// Inserts a user. /// </summary> /// <param name="username">Username.</param> /// <param name="password">Password.</param> /// <param name="userProfile">User profile.</param> /// <param name="email">Email.</param> public void InsertUser(string username, string password, UserProfile userProfile, string email) { Database.InsertUser(new User { Username = username, Password = password, UserProfile = userProfile, Email = email }); } /// <summary> /// Updates a user. /// </summary> /// <param name="userId">User's id.</param> /// <param name="username">Username.</param> /// <param name="password">Password.</param> /// <param name="userProfile">User's profile.</param> /// <param name="email">User's email.</param> public void UpdateUser(int userId, string username, string password, UserProfile userProfile, string email) { Database.UpdateUser(new User { Id = userId, Username = username, Password = password, UserProfile = userProfile, Email = email }); } /// <summary> /// Updates username and email. /// </summary> /// <param name="userId">User Id.</param> /// <param name="username">New username.</param> /// <param name="email">New email.</param> /// <param name="up">User profile.</param> public void UpdateUsernameAndEmailAndUserProfile(int userId, string username, string email, int up) { Database.UpdateUsernameAndEmailAndUserProfile(userId, username, email,(UserProfile)up); } /// <summary> /// Deletes a user. /// </summary> /// <param name="username">Username.</param> /// <param name="password">Password.</param> public void DeleteUser(string username, string password) { Database.DeleteUser(username, password); } /// <summary> /// Gets a user. /// </summary> /// <param name="username">Username.</param> /// <returns></returns> public User GetUser(string username) { return Database.GetUser(username); } /// <summary> /// Gets a password. /// </summary> /// <param name="username">Username.</param> /// <returns></returns> public string GetPassword(string username) { return Database.GetPassword(username); } /// <summary> /// Returns all the users. /// </summary> /// <returns>All the users.</returns> public User[] GetUsers() { var q = Database.GetUsers(); if (q.Any()) { return q.ToArray(); } return new User[]{}; } /// <summary> /// Search for users. /// </summary> /// <returns>All the users.</returns> public User[] GetUsers(string keyword, UserOrderBy uo) { var q = Database.GetUsers(keyword, uo); if (q.Any()) { return q.ToArray(); } return new User[] { }; } /// <summary> /// Updates user password. /// </summary> /// <param name="username">Username.</param> /// <param name="password">Password.</param> public void UpdatePassword(string username, string password) { Database.UpdatePassword(username, password); } /// <summary> /// Returns all the entries. /// </summary> /// <returns>Returns all the entries</returns> public HistoryEntry[] GetHistoryEntries() { return Database.GetHistoryEntries().ToArray(); } /// <summary> /// Returns the entries by a keyword. /// </summary> /// <param name="keyword">Search keyword.</param> /// <returns>Returns all the entries</returns> public HistoryEntry[] GetHistoryEntries(string keyword) { return Database.GetHistoryEntries(keyword).ToArray(); } /// <summary> /// Returns the entries by a keyword. /// </summary> /// <param name="keyword">Search keyword.</param> /// <param name="page">Page number.</param> /// <param name="entriesCount">Number of entries.</param> /// <returns>Returns all the entries</returns> public HistoryEntry[] GetHistoryEntries(string keyword, int page, int entriesCount) { return Database.GetHistoryEntries(keyword, page, entriesCount).ToArray(); } /// <summary> /// Returns the entries by a keyword. /// </summary> /// <param name="keyword">Search keyword.</param> /// <param name="from">Date From.</param> /// <param name="to">Date To.</param> /// <param name="page">Page number.</param> /// <param name="entriesCount">Number of entries.</param> /// <param name="heo">EntryOrderBy</param> /// <returns>Returns all the entries</returns> public HistoryEntry[] GetHistoryEntries(string keyword, DateTime from, DateTime to, int page, int entriesCount, EntryOrderBy heo) { var col = Database.GetHistoryEntries(keyword, from, to, page, entriesCount, heo); if (!col.Any()) { return new HistoryEntry[] { }; } else { return col.ToArray(); } } /// <summary> /// Returns the entries by a keyword. /// </summary> /// <param name="keyword">Search keyword.</param> /// <param name="from">Date From.</param> /// <param name="to">Date To.</param> /// <param name="page">Page number.</param> /// <param name="entriesCount">Number of entries.</param> /// <param name="heo">EntryOrderBy</param> /// <returns>Returns all the entries</returns> public Entry[] GetEntries(string keyword, DateTime from, DateTime to, int page, int entriesCount, EntryOrderBy heo) { var col = Database.GetEntries(keyword, from, to, page, entriesCount, heo); if (!col.Any()) { return new Entry[] { }; } else { return col.ToArray(); } } /// <summary> /// Gets the number of history entries by search keyword. /// </summary> /// <param name="keyword">Search keyword.</param> /// <returns>The number of history entries by search keyword.</returns> public long GetHistoryEntriesCount(string keyword) { return Database.GetHistoryEntriesCount(keyword); } /// <summary> /// Gets the number of history entries by search keyword and date filter. /// </summary> /// <param name="keyword">Search keyword.</param> /// <param name="from">Date from.</param> /// <param name="to">Date to.</param> /// <returns></returns> public long GetHistoryEntriesCount(string keyword, DateTime from, DateTime to) { return Database.GetHistoryEntriesCount(keyword, from, to); } /// <summary> /// Gets the number of entries by search keyword and date filter. /// </summary> /// <param name="keyword">Search keyword.</param> /// <param name="from">Date from.</param> /// <param name="to">Date to.</param> /// <returns></returns> public long GetEntriesCount(string keyword, DateTime from, DateTime to) { return Database.GetEntriesCount(keyword, from, to); } /// <summary> /// Returns Status Date Min value. /// </summary> /// <returns>Status Date Min value.</returns> public DateTime GetHistoryEntryStatusDateMin() { return Database.GetHistoryEntryStatusDateMin(); } /// <summary> /// Returns Status Date Max value. /// </summary> /// <returns>Status Date Max value.</returns> public DateTime GetHistoryEntryStatusDateMax() { return Database.GetHistoryEntryStatusDateMax(); } /// <summary> /// Returns Status Date Min value. /// </summary> /// <returns>Status Date Min value.</returns> public DateTime GetEntryStatusDateMin() { return Database.GetEntryStatusDateMin(); } /// <summary> /// Returns Status Date Max value. /// </summary> /// <returns>Status Date Max value.</returns> public DateTime GetEntryStatusDateMax() { return Database.GetEntryStatusDateMax(); } } }
33.424023
157
0.516366
[ "MIT" ]
alexhiggins732/Wexflow
src/dotnet-core/Wexflow.Core/WexflowEngine.cs
23,098
C#
using MTSEntBlocks.DataBlock; using System.Data; namespace MTS.EmailManager.EmailDataAccess { public class EmailDAL { public DataSet GetEmailSchedule() { return DataAccess.ExecuteDataset("MTS_GetEmailSchedule", (object[])null); } public DataSet GetEmailScheduleForTimeScheduler() { return DataAccess.ExecuteDataset("MTS_GetEmailScheduleForTimeScheduler", (object[])null); } public DataSet GetWaitingEmailTobeSent() { return DataAccess.ExecuteDataset("MTS_GetEmailsWaitingToBeSend", (object[])null); } public DataSet GetEmailTemplates() { return DataAccess.ExecuteDataset("MTS_GetEmailTemplate", (object[])null); } public void UpdateEmailStatus(int Id, int Status) { DataAccess.ExecuteNonQuery("MTS_UpdateEmailStatus", new object[2] { (object) Id, (object) Status }); } public int LogProjectDatails(object[] data) { return DataAccess.ExecuteNonQuery("MTS_EMAILLOGGERSP", data); } public DataSet GetImapDetails() { return DataAccess.ExecuteDataset("MTS_GETIMAPDETAILS", (object[])null); } public DataSet GetSTMPDetails() { return DataAccess.ExecuteDataset("MTS_GetSTMPDetails", (object[])null); } public object GetTemplateIDFromSchedule(long ScheduleID) { return DataAccess.ExecuteScalar("MTS_GETTEMPLATEIDFROMSCHEDULEID", new object[1] { (object) ScheduleID }); } public DataSet GetEmailDataFromSP(string SPName, object[] Parameters) { return DataAccess.ExecuteDataset(SPName, Parameters); } } }
28.875
101
0.606061
[ "MIT" ]
senthilsb-mtsin/ProjectTimeManagment
NewService/MTS.EmailManager/EmailDataAccess/EmailDAL.cs
1,850
C#
using System.Collections.Generic; using System.Threading.Tasks; namespace FuckMTP.DeviceConnector.Contracts { public interface IDeviceSource { Task<IEnumerable<IDevice>> GetAvailableDevices(); } }
19.909091
57
0.744292
[ "MIT" ]
scorchedSun/FuckMTP
FuckMTP.DeviceConnector.Contracts/IDeviceSource.cs
221
C#
using System; using System.Data; using System.Data.OleDb; namespace OMeta.Sql { #if ENTERPRISE using System.Runtime.InteropServices; [ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual), ComDefaultInterface(typeof(IIndex))] #endif public class SqlIndex : Index { public SqlIndex() { } } }
16.473684
101
0.753994
[ "MIT" ]
kiler398/OMeta
src/OpenMeta/Sql/Index.cs
313
C#
using System; namespace KoreanNewsDownloader.Exceptions { public class UnsupportedHostException : Exception { public UnsupportedHostException(string message) : base(message) { } } }
20.4
75
0.72549
[ "MIT" ]
GodsWithin/KDownloader
KoreanNewsDownloader/Exceptions/UnsupportedHostException.cs
206
C#
namespace Lol.Database.Entites.Schema { public class RuneDetail { public int Seq { get; set; } public string Rune { get; set; } public string Keystone { get; set; } public string Paths { get; set; } public string RuneType { get; set; } public string Name { get; set; } public string Infor1 { get; set; } public string Infor2 { get; set; } public string Infor3 { get; set; } public string Infor4 { get; set; } public string Infor5 { get; set; } public string Infor6 { get; set; } public string Infor7 { get; set; } public string Infor8 { get; set; } } }
32.619048
44
0.559124
[ "MIT" ]
devncore-james/wpf-leagueoflegends
src/Lol.Database/Entites/Schema/RuneDetail.cs
687
C#
/* Copyright (c) Citrix Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Windows.Forms; using XenAdmin.Commands; using XenAdmin.Controls; using XenAdmin.Core; using XenAdmin.Mappings; using XenAdmin.Network; using XenAPI; namespace XenAdmin.Wizards.GenericPages { /// <summary> /// Class representing the page of the ImportAppliance wizard where the user specifies /// the targets where the VMs of the appliance will be imported /// </summary> internal abstract partial class SelectMultipleVMDestinationPage : XenTabPage { private Dictionary<string, VmMapping> m_vmMappings; private IXenObject m_selectedObject; private bool updatingDestinationCombobox; private bool m_buttonNextEnabled; protected List<IXenConnection> ignoredConnections = new List<IXenConnection>(); private readonly CollectionChangeEventHandler Host_CollectionChangedWithInvoke; /// <summary> /// Combobox item that can executes a command but also be an IEnableableComboBoxItem /// </summary> private class AddHostExecutingComboBoxItem : IEnableableComboBoxItem { public override string ToString() { return Messages.ADD_POOL_OR_SERVER; } public void ExecuteCommand(Control parent) { new AddHostCommand(Program.MainWindow, parent).Execute(); } public bool Enabled { get { return true; } } } protected SelectMultipleVMDestinationPage() { InitializeComponent(); InitializeText(); Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(CollectionChanged); ConnectionsManager.XenConnections.CollectionChanged += CollectionChanged; ShowWarning(null); } public override void PageCancelled() { CancelFilters(); Program.Invoke(Program.MainWindow, ClearComboBox); Program.Invoke(Program.MainWindow, ClearDataGridView); ChosenItem = null; } protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) { SetDefaultTarget(ChosenItem); Program.Invoke(Program.MainWindow, ClearComboBox); } protected void InitializeText() { m_labelIntro.Text = InstructionText; label1.Text = TargetServerText; label2.Text = TargetServerSelectionIntroText; m_colVmName.HeaderText = VmColumnHeaderText; m_colTarget.HeaderText = TargetColumnHeaderText; } private IXenObject _chosenItem; public IXenObject ChosenItem { get { return _chosenItem; } protected set { _chosenItem = value; OnChosenItemChanged(); } } /// <summary> /// Text containing instructions for use - at the top of the page /// </summary> protected abstract string InstructionText { get; } /// <summary> /// Text demarking what the label for the target server drop down should be /// </summary> protected abstract string TargetServerText { get; } protected virtual string VmColumnHeaderText { get { return m_colVmName.HeaderText; } } protected virtual string TargetColumnHeaderText { get { return m_colTarget.HeaderText; } } /// <summary> /// Text above the table containing a list of VMs and concomitant home server /// </summary> protected abstract string TargetServerSelectionIntroText { get; } protected virtual void OnChosenItemChanged() {} protected void ShowWarning(string warningText) { if (string.IsNullOrEmpty(warningText)) tableLayoutPanelWarning.Visible = false; else { labelWarning.Text = warningText; tableLayoutPanelWarning.Visible = true; } } #region Base class (XenTabPage) overrides protected override void PageLoadedCore(PageLoadedDirection direction) { ChosenItem = null; restoreGridHomeServerSelection = (direction == PageLoadedDirection.Back); } public override void SelectDefaultControl() { m_comboBoxConnection.Select(); } public override bool EnableNext() { return m_buttonNextEnabled; } #endregion #region Accessors public Dictionary<string, VmMapping> VmMappings { get { foreach (DataGridViewRow row in m_dataGridView.Rows) { string sysId = (string)row.Cells[0].Tag; if (m_vmMappings.ContainsKey(sysId)) { var mapping = m_vmMappings[sysId]; DataGridViewEnableableComboBoxCell cbCell = row.Cells[m_colTarget.Index] as DataGridViewEnableableComboBoxCell; System.Diagnostics.Debug.Assert(cbCell != null, "ComboBox cell was not found"); IEnableableXenObjectComboBoxItem selectedItem = cbCell.Value as IEnableableXenObjectComboBoxItem; System.Diagnostics.Debug.Assert(selectedItem != null, "Vm has no target mapped"); var type = selectedItem.Item.GetType(); if (type == typeof(Pool)) mapping.XenRef = new XenRef<Pool>(selectedItem.Item.opaque_ref); else if (type == typeof(Host)) mapping.XenRef = new XenRef<Host>(selectedItem.Item.opaque_ref); mapping.TargetName = selectedItem.Item.Name(); } } return m_vmMappings; } set { m_vmMappings = value; } } #endregion public void SetDefaultTarget(IXenObject xenObject) { m_selectedObject = xenObject; } protected abstract DelayLoadingOptionComboBoxItem CreateDelayLoadingOptionComboBoxItem(IXenObject xenItem); #region Private methods protected void SetButtonNextEnabled(bool enabled) { m_buttonNextEnabled = enabled; OnPageUpdated(); } private void ClearComboBox() { Program.AssertOnEventThread(); foreach (var item in m_comboBoxConnection.Items) { DelayLoadingOptionComboBoxItem tempItem = item as DelayLoadingOptionComboBoxItem; if (tempItem != null) tempItem.ReasonUpdated -= DelayLoadedComboBoxItem_ReasonChanged; } m_comboBoxConnection.Items.Clear(); } private void ClearDataGridView() { //Clear up comboboxes foreach (DataGridViewRow row in m_dataGridView.Rows) { row.Cells[m_colTarget.Index].Dispose(); } m_dataGridView.Rows.Clear(); m_dataGridView.Refresh(); } protected void PopulateComboBox() { Program.AssertOnEventThread(); Program.Invoke(Program.MainWindow, ClearDataGridView); updatingDestinationCombobox = true; Program.Invoke(Program.MainWindow, ClearComboBox); foreach (var xenConnection in ConnectionsManager.XenConnectionsCopy.Where(con => con.IsConnected).Except(ignoredConnections)) { DelayLoadingOptionComboBoxItem item = null; Pool pool = Helpers.GetPool(xenConnection); if (pool == null) { Host host = Helpers.GetMaster(xenConnection); if (host != null) { item = CreateDelayLoadingOptionComboBoxItem(host); m_comboBoxConnection.Items.Add(item); item.ReasonUpdated += DelayLoadedComboBoxItem_ReasonChanged; item.Load(); host.PropertyChanged -= PropertyChanged; host.PropertyChanged += PropertyChanged; } } else { item = CreateDelayLoadingOptionComboBoxItem(pool); m_comboBoxConnection.Items.Add(item); item.ReasonUpdated += DelayLoadedComboBoxItem_ReasonChanged; item.Load(); pool.PropertyChanged -= PropertyChanged; pool.PropertyChanged += PropertyChanged; } if (item != null && m_selectedObject != null && item.Item.Connection == m_selectedObject.Connection) item.PreferAsSelectedItem = true; xenConnection.ConnectionStateChanged -= xenConnection_ConnectionStateChanged; xenConnection.ConnectionStateChanged += xenConnection_ConnectionStateChanged; xenConnection.CachePopulated -= xenConnection_CachePopulated; xenConnection.CachePopulated += xenConnection_CachePopulated; xenConnection.Cache.RegisterCollectionChanged<Host>(Host_CollectionChangedWithInvoke); } m_comboBoxConnection.Items.Add(new AddHostExecutingComboBoxItem()); updatingDestinationCombobox = false; } protected bool DestinationHasBeenSelected() { return m_comboBoxConnection.SelectedItem != null; } private bool MatchingWithXenRefObject(IEnableableXenObjectComboBoxItem item, object xenRef) { XenRef<Host> hostRef = xenRef as XenRef<Host>; if (hostRef != null) return hostRef.opaque_ref == item.Item.opaque_ref; XenRef<Pool> poolRef = xenRef as XenRef<Pool>; if (poolRef != null) return poolRef.opaque_ref == item.Item.opaque_ref; return false; } private bool restoreGridHomeServerSelection; private void RestoreGridHomeServerSelectionFromMapping() { foreach (DataGridViewRow row in m_dataGridView.Rows) { string sysId = (string)row.Cells[0].Tag; if (m_vmMappings.ContainsKey(sysId)) { var mapping = m_vmMappings[sysId]; DataGridViewEnableableComboBoxCell cbCell = row.Cells[m_colTarget.Index] as DataGridViewEnableableComboBoxCell; if (cbCell == null) return; List<IEnableableXenObjectComboBoxItem> list = cbCell.Items.OfType<IEnableableXenObjectComboBoxItem>().ToList(); IEnableableXenObjectComboBoxItem item = list.FirstOrDefault(cbi => MatchingWithXenRefObject(cbi, mapping.XenRef)); if (item != null) cbCell.Value = item; } } } private bool updatingHomeServerList; private void PopulateDataGridView(IEnableableXenObjectComboBoxItem selectedItem) { Program.AssertOnEventThread(); updatingHomeServerList = true; try { Connection = null; var target = m_comboBoxConnection.SelectedItem as DelayLoadingOptionComboBoxItem; if (target != null) Connection = target.Item.Connection; ClearDataGridView(); SetButtonNextEnabled(true); var hasPoolSharedStorage = HasPoolSharedStorage(); foreach (var kvp in m_vmMappings) { var tb = new DataGridViewTextBoxCell {Value = kvp.Value.VmNameLabel, Tag = kvp.Key}; var cb = new DataGridViewEnableableComboBoxCell{FlatStyle = FlatStyle.Flat}; List<ReasoningFilter> homeserverFilters = CreateTargetServerFilterList( selectedItem, new List<String> { kvp.Key }); if (Connection != null) { if (hasPoolSharedStorage) { foreach (var pool in Connection.Cache.Pools) { var item = new NoTargetServerPoolItem(pool); cb.Items.Add(item); if ((m_selectedObject != null && m_selectedObject.opaque_ref == pool.opaque_ref) || (target != null && target.Item.opaque_ref == pool.opaque_ref)) cb.Value = item; break; //there exists one pool per connection } } var sortedHosts = new List<Host>(Connection.Cache.Hosts); sortedHosts.Sort(); var items = new List<DelayLoadingOptionComboBoxItem>(); foreach (var host in sortedHosts) { var item = new DelayLoadingOptionComboBoxItem(host, homeserverFilters); item.LoadAndWait(); cb.Items.Add(item); if (item.Enabled && ((m_selectedObject != null && m_selectedObject.opaque_ref == host.opaque_ref) || (target != null && target.Item.opaque_ref == host.opaque_ref))) cb.Value = item; } } SetComboBoxPreSelection(cb); var row = new DataGridViewRow(); row.Cells.AddRange(tb, cb); m_dataGridView.Rows.Add(row); } HelpersGUI.ResizeLastGridViewColumn(m_colTarget); //set properly the width of the last column if (restoreGridHomeServerSelection) { RestoreGridHomeServerSelectionFromMapping(); restoreGridHomeServerSelection = false; } } finally { updatingHomeServerList = false; } } private void SetComboBoxPreSelection(DataGridViewEnableableComboBoxCell cb) { if (cb.Value == null) { if (cb.Items.Count > 0) { if (cb.Items.OfType<IEnableableComboBoxItem>().All(i => !i.Enabled)) { cb.Value = null; SetButtonNextEnabled(false); } else cb.Value = cb.Items.OfType<IEnableableComboBoxItem>().First(i => i.Enabled); } else SetButtonNextEnabled(false); //do not allow to leave the page if a vm has no target } } private bool HasPoolSharedStorage() { if (Connection == null) return false; foreach (var pbd in Connection.Cache.PBDs.Where(thePbd => thePbd.SR != null)) { var sr = Connection.Resolve(pbd.SR); if (sr != null && sr.SupportsVdiCreate() && sr.shared) return true; } return false; } #endregion #region Event Handlers private void DelayLoadedComboBoxItem_ReasonChanged(object sender, EventArgs e) { DelayLoadingOptionComboBoxItem item = sender as DelayLoadingOptionComboBoxItem; if (item == null) throw new NullReferenceException("Trying to update delay loaded reason but failed to extract reason"); int index = m_comboBoxConnection.Items.IndexOf(item); if (index > -1) { Program.Invoke( Program.MainWindow, delegate() { int selectedIndex = m_comboBoxConnection.SelectedIndex; if (index > m_comboBoxConnection.Items.Count) return; if(updatingDestinationCombobox || updatingHomeServerList) return; DelayLoadingOptionComboBoxItem tempItem = m_comboBoxConnection.Items[index] as DelayLoadingOptionComboBoxItem; if(tempItem == null) throw new NullReferenceException("Trying to update delay loaded reason but failed to extract reason"); tempItem.CopyFrom(item); m_comboBoxConnection.BeginUpdate(); m_comboBoxConnection.Items.RemoveAt(index); if (updatingDestinationCombobox || updatingHomeServerList) { m_comboBoxConnection.EndUpdate(); return; } m_comboBoxConnection.Items.Insert(index, tempItem); m_comboBoxConnection.SelectedIndex = selectedIndex; m_comboBoxConnection.EndUpdate(); if (tempItem.PreferAsSelectedItem) m_comboBoxConnection.SelectedItem = tempItem; item.ReasonUpdated -= DelayLoadedComboBoxItem_ReasonChanged; }); } } private void PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "name_label" || e.PropertyName == "metrics" || e.PropertyName == "enabled" || e.PropertyName == "live" || e.PropertyName == "patches") Program.Invoke(this, PopulateComboBox); } private void CollectionChanged(object sender, CollectionChangeEventArgs e) { Program.BeginInvoke(this, PopulateComboBox); } private void xenConnection_CachePopulated(object sender, EventArgs e) { Program.Invoke(this, PopulateComboBox); } private void xenConnection_ConnectionStateChanged(object sender, EventArgs e) { Program.Invoke(this, PopulateComboBox); } #endregion #region Control event handlers private void m_comboBoxConnection_SelectedIndexChanged(object sender, EventArgs e) { if (updatingHomeServerList) return; //If the item is delay loading and them item is disabled, null the selection made //and clear the table containing server data IEnableableXenObjectComboBoxItem item = m_comboBoxConnection.SelectedItem as IEnableableXenObjectComboBoxItem; if(item != null && !item.Enabled) { m_comboBoxConnection.SelectedIndex = -1; m_dataGridView.Rows.Clear(); ChosenItem = null; return; } AddHostExecutingComboBoxItem exeItem = m_comboBoxConnection.SelectedItem as AddHostExecutingComboBoxItem; if (exeItem != null && !updatingDestinationCombobox) exeItem.ExecuteCommand(this); else if(!updatingDestinationCombobox) { try { Cursor.Current = Cursors.WaitCursor; ChosenItem = item == null ? null : item.Item; Program.Invoke(Program.MainWindow, ()=> PopulateDataGridView(item)); } finally { Cursor.Current = Cursors.Default; } } IsDirty = true; } /// <summary> /// Create a set of filters for the homeserver combo box selection /// </summary> /// <param name="item">selected item from the host combobox</param> /// <param name="vmOpaqueRefs">OpaqRefs of VMs which need to apply those filters</param> /// <returns></returns> protected virtual List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem item, List<string> vmOpaqueRefs) { return new List<ReasoningFilter>(); } private void m_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != m_colTarget.Index || e.RowIndex < 0 || e.RowIndex >= m_dataGridView.RowCount) return; m_dataGridView.BeginEdit(false); if (m_dataGridView.EditingControl != null && m_dataGridView.EditingControl is ComboBox) (m_dataGridView.EditingControl as ComboBox).DroppedDown = true; } private void m_dataGridView_CurrentCellDirtyStateChanged(object sender, EventArgs e) { m_dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit); IsDirty = true; } #endregion private void UnregisterHandlers() { ConnectionsManager.XenConnections.CollectionChanged -= CollectionChanged; foreach (var xenConnection in ConnectionsManager.XenConnectionsCopy) { var pool = Helpers.GetPool(xenConnection); if (pool == null) { var host = Helpers.GetMaster(xenConnection); if (host != null) host.PropertyChanged -= PropertyChanged; } else { pool.PropertyChanged -= PropertyChanged; } xenConnection.ConnectionStateChanged -= xenConnection_ConnectionStateChanged; xenConnection.CachePopulated -= xenConnection_CachePopulated; xenConnection.Cache.DeregisterCollectionChanged<Host>(Host_CollectionChangedWithInvoke); } } private void CancelFilters() { foreach (var item in m_comboBoxConnection.Items) { DelayLoadingOptionComboBoxItem comboBoxItem = item as DelayLoadingOptionComboBoxItem; if (comboBoxItem != null) comboBoxItem.CancelFilters(); } } } }
37.737805
167
0.553442
[ "BSD-2-Clause" ]
borzel/xenadmin
XenAdmin/Wizards/GenericPages/SelectMultipleVMDestinationPage.cs
24,758
C#
using System.Collections; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; namespace Mirror.Tests.Runtime { public class NetworkIdentityTests : MirrorPlayModeTest { GameObject gameObject; NetworkIdentity identity; [UnitySetUp] public override IEnumerator UnitySetUp() { yield return base.UnitySetUp(); CreateNetworked(out gameObject, out identity); yield return null; } // prevents https://github.com/vis2k/Mirror/issues/1484 [UnityTest] public IEnumerator OnDestroyIsServerTrue() { // call OnStartServer so that isServer is true identity.OnStartServer(); Assert.That(identity.isServer, Is.True); // destroy it // note: we need runtime .Destroy instead of edit mode .DestroyImmediate // because we can't check isServer after DestroyImmediate GameObject.Destroy(gameObject); // make sure that isServer is still true so we can save players etc. Assert.That(identity.isServer, Is.True); yield return null; // Confirm it has been destroyed Assert.That(identity == null, Is.True); } [UnityTest] public IEnumerator OnDestroyIsServerTrueWhenNetworkServerDestroyIsCalled() { // call OnStartServer so that isServer is true identity.OnStartServer(); Assert.That(identity.isServer, Is.True); // destroy it NetworkServer.Destroy(gameObject); // make sure that isServer is still true so we can save players etc. Assert.That(identity.isServer, Is.True); yield return null; // Confirm it has been destroyed Assert.That(identity == null, Is.True); } } }
31.278689
84
0.606394
[ "MIT" ]
BigBoxVR/Mirror
Assets/Mirror/Tests/Runtime/NetworkIdentityTests.cs
1,908
C#
using System.Text.RegularExpressions; using Microsoft.AspNetCore.Components; namespace HostedApp { public static class Extensions { public static string Format(this string format, object arg0) => format == null ? "" : string.Format(format, arg0); public static MarkupString AsMarkdownToHtml(this string value) { value = Regex.Replace( value, @"\[(?<TXT>[^\]]+)\]\((?<URL>[^\)]+)\)", m => { return "<a target=\"_blank\" href=\"" + m.Groups["URL"].Value + "\">" + m.Groups["TXT"].Value + "</a>"; }); return new MarkupString(value); } } }
31.238095
130
0.545732
[ "MPL-2.0" ]
SeppPenner/Toolbelt.Blazor.I18nText
Tests/HostedApp/HostedApp.Client/Extensions.cs
658
C#
using System; using Azure.Storage.Blobs; using Azure.Storage.Sas; using AzureSpeed.WebApp.Common; namespace AzureSpeed.WebApp.Storage { public class BlobProvider { private readonly string connectionString; public BlobProvider(StorageAccount account) { connectionString = $"DefaultEndpointsProtocol=https;AccountName={account.Name};AccountKey={account.Key}"; } public string GetSasUrl(string blobName, string operation) { string containerName = string.Empty; var blobSasPermissions = BlobSasPermissions.List; switch (operation.ToLower()) { case "upload": blobSasPermissions |= BlobSasPermissions.Write; containerName = AzureSpeedConstants.UploadContainerName; break; case "download": blobSasPermissions |= BlobSasPermissions.Read; containerName = AzureSpeedConstants.PrivateContainerName; break; } var blobContainerClient = new BlobContainerClient(connectionString, containerName); var blobClient = blobContainerClient.GetBlobClient(blobName); var uri = blobClient.GenerateSasUri(blobSasPermissions, DateTimeOffset.UtcNow.AddMinutes(5)); return uri.ToString(); } } }
36.153846
117
0.624823
[ "MIT" ]
blrchen/AzureSpeed
src/AzureSpeed.WebApp/Storage/BlobProvider.cs
1,412
C#
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; using dto = aspet.Models; namespace aspet.Daos { public class InMemoryTasks : ITasks { private ConcurrentDictionary<int, dto.Task> dict; private int nextId; public InMemoryTasks() { this.dict = new ConcurrentDictionary<int, dto.Task>(); this.nextId = 0; // Add fake data. this.Create("shou3301@gmail.com", "My first todo"); this.Create("shou3301@gmail.com", "Buy milk"); } public void Archive(string email, int id) { this.dict.TryRemove(id, out _); } public void Complete(string email, int id) { this.dict[id].Completed = DateTime.Now; } public void Create(string email, string text) { var id = Interlocked.Increment(ref this.nextId); var t = new dto.Task() { Email = email, TaskId = id, Text = text }; this.dict[id] = t; } public void Incomplete(string email, int id) { this.dict[id].Completed = null; } public List<dto.Task> List(string email) { List<dto.Task> result = new List<dto.Task>(); foreach (KeyValuePair<int, dto.Task> entry in this.dict) { if (entry.Value.Email == email) { result.Add(entry.Value); } } return result; } } }
26.492308
69
0.48374
[ "Apache-2.0" ]
yolocs/aspet
Daos/InMemoryTasks.cs
1,722
C#
/* * Copyright 2018 JDCLOUD.COM * * 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. * * 账户 * httpdns OpenAPI账户接口 * * OpenAPI spec version: v1 * Contact: * * NOTE: This class is auto generated by the jdcloud code generator program. */ using System; using System.Collections.Generic; using System.Text; using JDCloudSDK.Core.Service; namespace JDCloudSDK.Httpdns.Apis { /// <summary> /// 查询用户名下httpdns的账户ID /// </summary> public class GetAccountIdResponse : JdcloudResponse<GetAccountIdResult> { } }
25.439024
76
0.721956
[ "Apache-2.0" ]
jdcloud-api/jdcloud-sdk-net
sdk/src/Service/Httpdns/Apis/GetAccountIdResponse.cs
1,073
C#
// This is an open source non-commercial project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com // ReSharper disable ArrangeAccessorOwnerBody // ReSharper disable CheckNamespace // ReSharper disable CommentTypo // ReSharper disable IdentifierTypo // ReSharper disable StringLiteralTypo // ReSharper disable UseNameofExpression /* Kladovka.cs -- * Ars Magna project, http://arsmagna.ru * ------------------------------------------------------- * Status: poor */ #region Using directives using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using AM.Configuration; using AM.Data; using AM.Logging; using AM.Text; using AM.Text.Output; using BLToolkit.Data; using BLToolkit.Data.Linq; using BLToolkit.DataAccess; using BLToolkit.Linq; using BLToolkit.Mapping; using CodeJam; using JetBrains.Annotations; using ManagedIrbis; using ManagedIrbis.Batch; using ManagedIrbis.Fields; using MoonSharp.Interpreter; #endregion namespace AM.Istu.OldModel { /// <summary> /// /// </summary> [PublicAPI] [MoonSharpUserData] public class Kladovka : IDisposable { #region Properties /// <summary> /// Table "attendances" /// </summary> [JetBrains.Annotations.NotNull] public Table<AttendanceRecord> Attendances { get { return DB.GetTable<AttendanceRecord>(); } } /// <summary> /// Connection. /// </summary> [JetBrains.Annotations.NotNull] public IrbisConnection Connection { get; private set; } /// <summary> /// Database connection. /// </summary> [JetBrains.Annotations.NotNull] public DbManager DB { get; private set; } /// <summary> /// Abstract output. /// </summary> [CanBeNull] public AbstractOutput Output { get; private set; } /// <summary> /// Научный фонд. /// </summary> [JetBrains.Annotations.NotNull] public Table<PodsobRecord> Podsob { get { return DB.GetTable<PodsobRecord>(); } } /// <summary> /// Читатели. /// </summary> [JetBrains.Annotations.NotNull] public Table<ReaderRecord> Readers { get { return DB.GetTable<ReaderRecord>(); } } /// <summary> /// Транслятор штрих-кодов. /// </summary> [JetBrains.Annotations.NotNull] public Table<TranslatorRecord> Translator { get { return DB.GetTable<TranslatorRecord>(); } } /// <summary> /// Художественная литература. /// </summary> [JetBrains.Annotations.NotNull] public Table<HudRecord> Hudo { get { return DB.GetTable<HudRecord>(); } } /// <summary> /// Штрафы. /// </summary> [JetBrains.Annotations.NotNull] public Table<SanctionRecord> Sanctions { get { return DB.GetTable<SanctionRecord>(); } } /// <summary> /// Учебный фонд. /// </summary> public Table<UchRecord> Ucheb { get { return DB.GetTable<UchRecord>(); } } /// <summary> /// Журналы. /// </summary> public Table<MagazineRecord> Perio { get { return DB.GetTable<MagazineRecord>(); } } #endregion #region Construction /// <summary> /// Constructor. /// </summary> public Kladovka() { DB = new DbManager(); Connection = IrbisConnectionUtility.GetClientFromConfig(); } /// <summary> /// Constructor. /// </summary> public Kladovka ( [CanBeNull] AbstractOutput output ) : this() { Output = output; } /// <summary> /// Constructor. /// </summary> public Kladovka ( [JetBrains.Annotations.NotNull] DbManager db, [JetBrains.Annotations.NotNull] IrbisConnection connection ) { Code.NotNull(db, "db"); Code.NotNull(connection, "connection"); DB = db; Connection = connection; } /// <summary> /// Constructor. /// </summary> public Kladovka ( [JetBrains.Annotations.NotNull] DbManager db, [JetBrains.Annotations.NotNull] IrbisConnection connection, [CanBeNull] AbstractOutput output ) : this(db, connection) { Output = output; } /// <summary> /// Constructor. /// </summary> public Kladovka ( [JetBrains.Annotations.NotNull] string suffix, [JetBrains.Annotations.NotNull] string irbisConnectionString ) { Code.NotNullNorEmpty(suffix, "suffix"); Code.NotNullNorEmpty(irbisConnectionString, "irbisConnectionString"); DB = new DbManager(suffix); Connection = new IrbisConnection(irbisConnectionString); } #endregion #region Private members #endregion #region Public methods /// <summary> /// Create attendance. /// </summary> [JetBrains.Annotations.NotNull] public Kladovka CreateAttendance ( [JetBrains.Annotations.NotNull] AttendanceRecord attendance ) { Code.NotNull(attendance, "attendance"); Query<AttendanceRecord>.Insert ( Attendances.DataContextInfo, attendance ); return this; } /// <summary> /// Create podsob record. /// </summary> [JetBrains.Annotations.NotNull] public Kladovka CreatePodsob ( [JetBrains.Annotations.NotNull] PodsobRecord podsob ) { Code.NotNull(podsob, "podsob"); Query<PodsobRecord>.Insert ( Podsob.DataContextInfo, podsob ); return this; } /// <summary> /// Create reader. /// </summary> [JetBrains.Annotations.NotNull] public Kladovka CreateReader ( [JetBrains.Annotations.NotNull] ReaderRecord reader ) { Code.NotNull(reader, "reader"); Query<ReaderRecord>.Insert ( Readers.DataContextInfo, reader ); return this; } /// <summary> /// Find reader by the barcode. /// </summary> [CanBeNull] public ReaderRecord FindReaderByBarcode ( [JetBrains.Annotations.NotNull] string barcode ) { Code.NotNullNorEmpty(barcode, "barcode"); return Readers .FirstOrDefault(reader => reader.Barcode == barcode); } /// <summary> /// Find reader by the name. /// </summary> [CanBeNull] public ReaderRecord FindReaderByName ( [JetBrains.Annotations.NotNull] string name ) { Code.NotNullNorEmpty(name, "name"); return Readers .FirstOrDefault(reader => reader.Name.StartsWith(name)); } /// <summary> /// Find reader by the ticket. /// </summary> [CanBeNull] public ReaderRecord FindReaderByTicket ( [JetBrains.Annotations.NotNull] string ticket ) { Code.NotNullNorEmpty(ticket, "ticket"); return Readers .FirstOrDefault(reader => reader.Ticket == ticket); } /// <summary> /// Find reader by the RFID. /// </summary> public ReaderRecord FindReaderByRfid ( [JetBrains.Annotations.NotNull] string rfid ) { Code.NotNullNorEmpty(rfid, "rfid"); return Readers .FirstOrDefault(reader => reader.Rfid == rfid); } /// <summary> /// Find records using specified expression. /// </summary> [JetBrains.Annotations.NotNull] public int[] FindRecords ( [JetBrains.Annotations.NotNull] string format, params object[] args ) { Code.NotNullNorEmpty(format, "format"); int[] result = Connection.Search(format, args); return result; } /// <summary> /// Find podsob record by barcode or RFID. /// </summary> [CanBeNull] public PodsobRecord FindPodsobByBarcode ( [JetBrains.Annotations.NotNull] string barcode ) { Code.NotNullNorEmpty(barcode, "barcode"); long inventory; PodsobRecord result = null; TranslatorRecord translator = GetTranslatorRecord(barcode); if (ReferenceEquals(translator, null)) { if (NumericUtility.TryParseInt64(barcode, out inventory)) { result = GetPodsobRecord(inventory); } } else { inventory = translator.Inventory; result = GetPodsobRecord(inventory); } int[] found; if (ReferenceEquals(result, null)) { found = FindRecords ( "\"BAR={0}\" + \"RFID={0}\"", barcode ); if (found.Length == 0) { found = FindRecords ( "\"IN={0}\"", barcode ); } } else { found = FindRecords ( "\"IN={0}\"", inventory.ToInvariantString() ); } if (found.Length == 0) { return null; } MarcRecord record = ReadMarcRecord(found[0]); RecordField field = record.Fields .GetField(910) .FirstOrDefault ( f => barcode.SameString(f.GetFirstSubFieldValue('b')) || barcode.SameString(f.GetFirstSubFieldValue('h')) || barcode.SameString(f.GetFirstSubFieldValue('t')) ); if (!ReferenceEquals(field, null)) { NumericUtility.TryParseInt64 ( field.GetFirstSubFieldValue('b'), out inventory ); } if (ReferenceEquals(result, null)) { result = GetPodsobRecord(inventory); if (ReferenceEquals(result, null)) { result = new PodsobRecord(); } } result.Record = record; result.Inventory = inventory; return result; } /// <summary> /// Get all marked exemplars. /// </summary> [JetBrains.Annotations.NotNull] public long[] GetAllMarked ( [JetBrains.Annotations.NotNull] string place ) { Code.NotNullNorEmpty(place, "place"); Write("Marked: "); List<long> result = new List<long>(); string expression = string.Format ( "\"INP={0}\"", place ); var batch = BatchRecordReader.Search ( Connection, Connection.Database, expression, 1000 ); foreach (MarcRecord record in batch) { Write("."); var exemplars = ExemplarInfo .Parse(record) .Where ( ex => !string.IsNullOrEmpty(ex.CheckedDate) && ex.RealPlace.SameString(place) ); foreach (ExemplarInfo exemplar in exemplars) { long inventory; if (NumericUtility.TryParseInt64 ( exemplar.Number, out inventory )) { result.Add(inventory); } } } WriteLine("DONE"); return result.ToArray(); } /// <summary> /// Get all inventories from podsob table. /// </summary> [JetBrains.Annotations.NotNull] public long[] GetAllPodsob ( [JetBrains.Annotations.NotNull] string place ) { Code.NotNullNorEmpty(place, "place"); long[] result = Podsob.Where ( rec => rec.Ticket == place ) .Select ( rec => rec.Inventory ) .ToArray(); return result; } /// <summary> /// Get podsob record for the inventory number. /// </summary> [JetBrains.Annotations.CanBeNull] public PodsobRecord GetPodsobRecord ( long inventory ) { PodsobRecord result = Podsob.FirstOrDefault ( rec => rec.Inventory == inventory ); return result; } /// <summary> /// Get translator record for the barcode or RFID. /// </summary> [JetBrains.Annotations.CanBeNull] public TranslatorRecord GetTranslatorRecord ( [JetBrains.Annotations.CanBeNull] string barcode ) { if (string.IsNullOrEmpty(barcode)) { return null; } TranslatorRecord result = Translator.FirstOrDefault ( rec => rec.Inventory.ToString() == barcode || rec.Barcode == barcode || rec.Rfid == barcode ); return result; } /// <summary> /// Read <see cref="MarcRecord"/> for given MFN. /// </summary> [JetBrains.Annotations.NotNull] public MarcRecord ReadMarcRecord ( int mfn ) { Code.Positive(mfn, "mfn"); MarcRecord result = Connection.ReadRecord(mfn); result.Description = Connection.FormatRecord("@brief", mfn); return result; } /// <summary> /// Write some text. /// </summary> public void Write ( [CanBeNull] string text ) { if (!ReferenceEquals(Output, null) && !string.IsNullOrEmpty(text)) { Output.Write(text); } } /// <summary> /// Write one line of text. /// </summary> public void WriteLine ( [CanBeNull] string text ) { if (!ReferenceEquals(Output, null)) { if (string.IsNullOrEmpty(text)) { Output.WriteLine(string.Empty); } else { Output.WriteLine(text); } } } #endregion #region IDisposable members /// <inheritdoc cref="IDisposable.Dispose"/> public void Dispose() { DB.Dispose(); } #endregion } }
26.269891
84
0.459647
[ "MIT" ]
amironov73/ManagedClient.45
Source/Classic/Libs/AM.Istu/AM/Istu/OldModel/Kladovka.cs
16,928
C#
using EyesGuard.AppManagers; using EyesGuard.Views.Pages; using EyesGuard.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace EyesGuard.Views.Menus { public partial class EyesGuardTaskbarIcon { private void TaskbarIcon_TrayMouseDoubleClick(object sender, System.Windows.RoutedEventArgs e) { if(!App.GetMainWindow().IsVisible) ChromeManager.Show(); } private void FiveMinutesPause_Click(object sender, RoutedEventArgs e) { App.PauseProtection(TimeSpan.FromMinutes(5)); } private void TenMinutesPause_Click(object sender, RoutedEventArgs e) { App.PauseProtection(TimeSpan.FromMinutes(10)); } private void ThirtyMinutesPause_Click(object sender, RoutedEventArgs e) { App.PauseProtection(TimeSpan.FromMinutes(30)); } private void OneHourPause_Click(object sender, RoutedEventArgs e) { App.PauseProtection(TimeSpan.FromHours(1)); } private void TwoHourPause_Click(object sender, RoutedEventArgs e) { App.PauseProtection(TimeSpan.FromHours(2)); } private void CustomPause_Click(object sender, RoutedEventArgs e) { App.GetMainWindow().MainFrame.Navigate(new CustomPause()); if (!App.GetMainWindow().IsVisible) ChromeManager.Show(); } private void Exit_Click(object sender, RoutedEventArgs e) { App.Current.Shutdown(); } private void TaskbarIcon_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e) { } private void Grid_Loaded(object sender, RoutedEventArgs e) { App.UpdateTaskbarIcon(); } private void StartProtect_Click(object sender, RoutedEventArgs e) { if (App.CheckIfResting()) return; if (App.Configuration.ProtectionState == App.GuardStates.PausedProtecting) App.ResumeProtection(); else App.CurrentMainPage.ProtectionState = App.GuardStates.Protecting; } private void StopProtect_Click(object sender, RoutedEventArgs e) { if (App.CheckIfResting()) return; if (App.Configuration.SaveStats) App.UpdateIntruptOfStats(App.GuardStates.NotProtecting); App.CurrentMainPage.ProtectionState = App.GuardStates.NotProtecting; } private void Settings_Click(object sender, RoutedEventArgs e) { App.GetMainWindow().MainFrame.Navigate(new Settings()); if (!App.GetMainWindow().IsVisible) ChromeManager.Show(); } } }
30.252632
114
0.636395
[ "MIT" ]
0xaryan/EyesGuard
Source/EyesGuard/Views/Menus/EyesGuardTaskbarIcon.xaml.cs
2,876
C#
using System; using System.Collections; using System.Collections.Generic; using StrawberryShake; namespace BerryClient { public interface IGetHero { ICharacter Hero { get; } } }
15.384615
33
0.71
[ "MIT" ]
Coldplayer1995/GraphQLTest
BerryClient/StarWars/Generated/IGetHero.cs
202
C#
namespace Tarrahaan.DAL.Entities { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.Spatial; [Table("Currency")] public class Currency { public byte CurrencyId { get; set; } [Required] [StringLength(5)] public string CurrencySign { get; set; } [Required] [StringLength(10)] public string IsoCode { get; set; } public bool Visible { get; set; } } }
21.296296
55
0.629565
[ "Unlicense" ]
babakjahangiri/Tarrahaan
Tarrahaan/DAL/Entities/Currency.cs
575
C#
namespace ValidationHelperUnitTests.ValidationInfoTests; [TestClass] public class InfoTests { [TestMethod] public void AddInfoToValid() { var info = ValidationInfo.CreateSuccess; info.AddInfo("info"); Assert.IsTrue(info.IsValid); Assert.IsNotNull(info.Infos); Assert.AreEqual(1, info.Infos.Count); Assert.AreEqual("info", info.Infos.ElementAt(0)); } [TestMethod] public void AddInfoToInvalid() { var info = ValidationInfo.CreateFailure("error"); info.AddInfo("info"); Assert.IsFalse(info.IsValid); Assert.IsNotNull(info.Infos); Assert.AreEqual(1, info.Infos.Count); Assert.AreEqual("info", info.Infos.ElementAt(0)); } [TestMethod] public void AddMultipleInfoToValid() { var info = ValidationInfo.CreateSuccess; string[] infos = new string[] { "info1", "info2" }; info.AddInfo(infos); Assert.IsTrue(info.IsValid); Assert.IsNotNull(info.Infos); Assert.AreEqual(2, info.Infos.Count); Assert.AreEqual("info1", info.Infos.ElementAt(0)); Assert.AreEqual("info2", info.Infos.ElementAt(1)); } [TestMethod] public void AddMultipleInfoToInvalid() { var info = ValidationInfo.CreateFailure("error"); string[] infos = new string[] { "info1", "info2" }; info.AddInfo(infos); Assert.IsFalse(info.IsValid); Assert.IsNotNull(info.Infos); Assert.AreEqual(2, info.Infos.Count); Assert.AreEqual("info1", info.Infos.ElementAt(0)); Assert.AreEqual("info2", info.Infos.ElementAt(1)); } }
28.306452
58
0.591453
[ "MIT" ]
jasdefer/ValidationHelper
ValidationHelper/UnitTests/ValidationHelperUnitTests/ValidationInfoTests/InfoTests.cs
1,757
C#
using EntregaFutura.Domain.Models; namespace EntregaFutura.Repository.Repository { public interface IObservacaoRepository : IRepository<ObservacaoModel> { } }
17.4
73
0.770115
[ "MIT" ]
AdsHan/core-template-webapi
src/EntregaFutura.Repository/Repository/Interfaces/IObservacaoRepository.cs
176
C#
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Model { public class ItemProduct { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public virtual Product Product { get; set; } public decimal UnitaryValue { get; set; } public int Amount { get; set; } = 1; public decimal TotalValue { get; set; } } }
20.608696
61
0.64346
[ "MIT" ]
Irwiing/Mubak
Mubak/Model/ItemProduct.cs
476
C#
/* * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the dms-2016-01-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net; using System.Text; using System.Xml.Serialization; using Amazon.DatabaseMigrationService.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.DatabaseMigrationService.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for InvalidSubnetException Object /// </summary> public class InvalidSubnetExceptionUnmarshaller : IErrorResponseUnmarshaller<InvalidSubnetException, JsonUnmarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public InvalidSubnetException Unmarshall(JsonUnmarshallerContext context) { return this.Unmarshall(context, new ErrorResponse()); } /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <param name="errorResponse"></param> /// <returns></returns> public InvalidSubnetException Unmarshall(JsonUnmarshallerContext context, ErrorResponse errorResponse) { context.Read(); InvalidSubnetException unmarshalledObject = new InvalidSubnetException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { } return unmarshalledObject; } private static InvalidSubnetExceptionUnmarshaller _instance = new InvalidSubnetExceptionUnmarshaller(); /// <summary> /// Gets the singleton. /// </summary> public static InvalidSubnetExceptionUnmarshaller Instance { get { return _instance; } } } }
34.952941
135
0.671491
[ "Apache-2.0" ]
DetlefGolze/aws-sdk-net
sdk/src/Services/DatabaseMigrationService/Generated/Model/Internal/MarshallTransformations/InvalidSubnetExceptionUnmarshaller.cs
2,971
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CoreCSharpPrograming.chap11.indexermethod { class MyConsoleClass : IStringContainer { private List<string> myStrings = new List<string>(); public string this[int index] { get => myStrings[index]; set => myStrings.Insert(index, value); } } }
21.473684
60
0.639706
[ "MIT" ]
arishu/cn.org.aris
csharp/study/ProCSharp/CSharpConstructsPartOne/chap11/indexermethod/MyConsoleClass.cs
410
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; [Serializable] public class EnfeebleEnemiesWait : Skill { public override void RouteBehavior(Actions action, UnitProxy u1, UnitProxy u2, List<TileProxy> path) { switch(action){ case Actions.DidWait: DidWait(u1); break; default: return; } } public override void BeginningGame(UnitProxy unit) { } public override void DidAttack(UnitProxy attacker, UnitProxy defender) { } public override void DidKill(UnitProxy attacker, UnitProxy defender) { } public override void DidMove(UnitProxy unit, List<TileProxy> path){ } public override void DidWait(UnitProxy unit) { TileProxy uTile = BoardProxy.instance.GetTileAtPosition(unit.GetPosition()); foreach(TileProxy tl in BoardProxy.instance.GetAllVisitableNodes(unit, value + 1, true)){ bool isAttacker = tl == uTile; if (!isAttacker) { tl.FloatUp(Skill.Actions.DidAttack, "enfeeble", Color.grey, "Player enfeebled from atk"); if (tl.HasUnit() && tl.GetUnit().GetData().GetTeam() != unit.GetData().GetTeam()) { tl.GetUnit().SetEnfeebled(value); } } } } public override void EndTurn(UnitProxy unit) { } public override SkillTypes[] GetSkillTypes() { return new SkillTypes[]{ SkillTypes.Utility }; } public override string PrintDetails(){ return "Enfeeble enemies on wait. " + ReturnBlurbByString(GetSkillGen()) + " " + ReturnBlurbByString(SkillGen.Wait); } public override string PrintStackDetails() { return ReturnStackTypeByString(Skill.SkillStack.rng); } public override SkillGen GetSkillGen() { return SkillGen.Enfeeble; } }
25.121622
123
0.649812
[ "MIT" ]
BradZzz/EldersQuest
Assets/Scripts/Skills/SubSkills/EnfeebleEnemiesWait.cs
1,861
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the compute-optimizer-2019-11-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.ComputeOptimizer.Model { /// <summary> /// Describes a filter that returns a more specific list of Amazon Elastic Block Store /// (Amazon EBS) volume recommendations. Use this filter with the <code>GetEBSVolumeRecommendations</code> /// action. /// /// /// <para> /// You can use <code>LambdaFunctionRecommendationFilter</code> with the <code>GetLambdaFunctionRecommendations</code> /// action, <code>JobFilter</code> with the <code>DescribeRecommendationExportJobs</code> /// action, and <code>Filter</code> with the <code>GetAutoScalingGroupRecommendations</code> /// and <code>GetEC2InstanceRecommendations</code> actions. /// </para> /// </summary> public partial class EBSFilter { private EBSFilterName _name; private List<string> _values = new List<string>(); /// <summary> /// Gets and sets the property Name. /// <para> /// The name of the filter. /// </para> /// /// <para> /// Specify <code>Finding</code> to return recommendations with a specific finding classification /// (e.g., <code>NotOptimized</code>). /// </para> /// </summary> public EBSFilterName Name { get { return this._name; } set { this._name = value; } } // Check to see if Name property is set internal bool IsSetName() { return this._name != null; } /// <summary> /// Gets and sets the property Values. /// <para> /// The value of the filter. /// </para> /// /// <para> /// The valid values are <code>Optimized</code>, or <code>NotOptimized</code>. /// </para> /// </summary> public List<string> Values { get { return this._values; } set { this._values = value; } } // Check to see if Values property is set internal bool IsSetValues() { return this._values != null && this._values.Count > 0; } } }
31.915789
122
0.609169
[ "Apache-2.0" ]
ChristopherButtars/aws-sdk-net
sdk/src/Services/ComputeOptimizer/Generated/Model/EBSFilter.cs
3,032
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Runtime.Versioning; namespace Microsoft.Dnx.Tooling { public class BuildOptions { public string OutputDir { get; set; } public IList<string> ProjectPatterns { get; set; } public IList<string> Configurations { get; set; } public IList<string> TargetFrameworks { get;set; } public bool GeneratePackages { get; set; } public Reports Reports { get; set; } public BuildOptions() { Configurations = new List<string>(); TargetFrameworks = new List<string>(); ProjectPatterns = new List<string>(); } } }
27.032258
111
0.640811
[ "Apache-2.0" ]
cemoses/aspnet
dnx-dev/src/Microsoft.Dnx.Tooling/Building/BuildOptions.cs
838
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Pomelo.EntityFrameworkCore.MySql.IntegrationTests.Models; using Microsoft.EntityFrameworkCore; using MySqlConnector; using Pomelo.EntityFrameworkCore.MySql.Infrastructure; using Pomelo.EntityFrameworkCore.MySql.Tests.TestUtilities.Attributes; using Pomelo.EntityFrameworkCore.MySql.Storage; using Xunit; namespace Pomelo.EntityFrameworkCore.MySql.IntegrationTests.Tests.Models { public class GeneratedTypesTest { [SupportedServerVersionCondition(nameof(ServerVersionSupport.Json), Skip = "Version of MySQL/MariaDB does not support JSON")] public async Task TestGeneratedContact() { const string email = "bob@example.com"; const string address = "123 Entity Framework Ln"; const string city = "Redmond"; const string state = "WA"; const string zip = "99999"; var addressFormatted = string.Join(", ", address, city, state, zip); using (var scope = new AppDbScope()) { var db = scope.AppDb; void TestContact(GeneratedContact contact) { var csb = new MySqlConnectionStringBuilder(db.Database.GetDbConnection().ConnectionString); var guidHexStr = csb.OldGuids ? BitConverter.ToString(contact.Id.ToByteArray().Take(8).ToArray()).Replace("-", "") : contact.Id.ToString().Replace("-", "").Substring(0, 16); var guidTicks = Convert.ToInt64("0x" + guidHexStr, 16); var guidDateTime = new DateTime(guidTicks); Assert.InRange(guidDateTime - DateTime.UtcNow, TimeSpan.FromSeconds(-5), TimeSpan.FromSeconds(5)); Assert.Equal(email, contact.Email); Assert.Equal(addressFormatted, contact.Address); } var gen = new GeneratedContact { Names = new List<string> {"Bob", "Bobby"}, ContactInfo = new ContactInfo { Email = email, Address = address, City = city, State = state, Zip = zip, }, }; // test the entity after saving to the db db.GeneratedContacts.Add(gen); await db.SaveChangesAsync(); TestContact(gen); // test the entity after fresh retreival from the database var genDb = await db.GeneratedContacts.FirstOrDefaultAsync(m => m.Id == gen.Id); TestContact(genDb); } } [Fact] public async Task TestGeneratedTime() { var gt = new GeneratedTime {Name = "test"}; using (var scope = new AppDbScope()) { var db = scope.AppDb; db.GeneratedTime.Add(gt); await db.SaveChangesAsync(); Assert.Equal(gt.CreatedDateTime, gt.UpdatedDateTime); Assert.Equal(gt.CreatedDateTime3, gt.UpdatedDateTime3); Assert.Equal(gt.CreatedDateTime6, gt.UpdatedDateTime6); Assert.Equal(gt.CreatedTimestamp, gt.UpdatedTimetamp); Assert.Equal(gt.CreatedTimestamp3, gt.UpdatedTimetamp3); Assert.Equal(gt.CreatedTimestamp6, gt.UpdatedTimetamp6); Assert.InRange(gt.CreatedDateTime3 - gt.CreatedDateTime, TimeSpan.Zero, TimeSpan.FromMilliseconds(999)); Assert.InRange(gt.CreatedDateTime6 - gt.CreatedDateTime3, TimeSpan.Zero, TimeSpan.FromMilliseconds(0.999)); Assert.InRange(gt.CreatedTimestamp3 - gt.CreatedTimestamp, TimeSpan.Zero, TimeSpan.FromMilliseconds(999)); Assert.InRange(gt.CreatedTimestamp6 - gt.CreatedTimestamp3, TimeSpan.Zero, TimeSpan.FromMilliseconds(0.999)); await Task.Delay(TimeSpan.FromSeconds(1)); gt.Name = "test2"; await db.SaveChangesAsync(); Assert.NotEqual(gt.CreatedDateTime, gt.UpdatedDateTime); Assert.NotEqual(gt.CreatedDateTime3, gt.UpdatedDateTime3); Assert.NotEqual(gt.CreatedDateTime6, gt.UpdatedDateTime6); Assert.NotEqual(gt.CreatedTimestamp, gt.UpdatedTimetamp); Assert.NotEqual(gt.CreatedTimestamp3, gt.UpdatedTimetamp3); Assert.NotEqual(gt.CreatedTimestamp6, gt.UpdatedTimetamp6); } } [Fact] public async Task TestGeneratedConcurrencyToken() { var gct = new GeneratedConcurrencyCheck { Gen = 1 }; using (var scope = new AppDbScope()) { var db = scope.AppDb; db.GeneratedConcurrencyCheck.Add(gct); await db.SaveChangesAsync(); using (var scope2 = new AppDbScope()) { var db2 = scope2.AppDb; var gct2 = await db2.GeneratedConcurrencyCheck.FindAsync(gct.Id); gct2.Gen++; await db2.SaveChangesAsync(); } gct.Gen++; await Assert.ThrowsAsync<DbUpdateConcurrencyException>(() => db.SaveChangesAsync()); } } [Fact] public async Task TestGeneratedRowVersion() { var gct = new GeneratedRowVersion { Gen = 1 }; using (var scope = new AppDbScope()) { var db = scope.AppDb; db.GeneratedRowVersion.Add(gct); await db.SaveChangesAsync(); using (var scope2 = new AppDbScope()) { var db2 = scope2.AppDb; var gct2 = await db2.GeneratedRowVersion.FindAsync(gct.Id); gct2.Gen++; await db2.SaveChangesAsync(); } gct.Gen++; await Assert.ThrowsAsync<DbUpdateConcurrencyException>(() => db.SaveChangesAsync()); } } } }
34.118421
133
0.675087
[ "MIT" ]
Artrilogic/Pomelo.EntityFrameworkCore.MySql
test/EFCore.MySql.IntegrationTests/Tests/Models/GeneratedTypesTest.cs
5,188
C#
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; namespace AsyncDolls.AsyncDollsPartial { public class PushMessages : IPushMessages { Func<TransportMessage, Task> onMessageAsync; private readonly ConcurrentQueue<TransportMessage> messages; private ConcurrentDictionary<Task, Task> runningTasks; private SemaphoreSlim semaphore; private CancellationTokenSource tokenSource; private Task pumpTask; private readonly int maxConcurrency; public PushMessages(ConcurrentQueue<TransportMessage> messages, int maxConcurrency = 100) { this.maxConcurrency = maxConcurrency; this.messages = messages; } public Task StartAsync(Func<TransportMessage, Task> onMessage) { onMessageAsync = onMessage; runningTasks = new ConcurrentDictionary<Task, Task>(); semaphore = new SemaphoreSlim(maxConcurrency); tokenSource = new CancellationTokenSource(); var token = tokenSource.Token; pumpTask = Task.Run(async () => { while (!token.IsCancellationRequested) { await semaphore.WaitAsync(token).ConfigureAwait(false); TransportMessage message; if (messages.TryDequeue(out message)) { var task = onMessageAsync(message); runningTasks.TryAdd(task, task); task.ContinueWith(t => { semaphore.Release(); Task taskToBeRemoved; runningTasks.TryRemove(t, out taskToBeRemoved); }, TaskContinuationOptions.ExecuteSynchronously) .Ignore(); } else { await Task.Delay(TimeSpan.FromMilliseconds(20), token).ConfigureAwait(false); } } }, token); return Task.CompletedTask; } public async Task StopAsync() { tokenSource.Cancel(); await pumpTask.IgnoreCancellation().ConfigureAwait(false); await Task.WhenAll(runningTasks.Values).ConfigureAwait(false); runningTasks.Clear(); semaphore.Dispose(); tokenSource.Dispose(); } } }
33.233766
101
0.549824
[ "Apache-2.0" ]
danielmarbach/async-dolls
async-dolls/7-AsyncDollsPartial/PushMessages.cs
2,559
C#
using DragonSpark.Extensions; using DragonSpark.Sources.Parameterized; using System; using System.Collections.Immutable; using System.ComponentModel; using System.Reflection; namespace DragonSpark.ComponentModel { public sealed class DefaultPropertyValueFactory : ParameterizedSourceBase<DefaultValueParameter, object> { public static DefaultPropertyValueFactory Default { get; } = new DefaultPropertyValueFactory(); DefaultPropertyValueFactory() : this( HostedValueLocator<IDefaultValueProvider>.Default.ToSourceDelegate() ) {} readonly Func<MemberInfo, ImmutableArray<IDefaultValueProvider>> factory; public DefaultPropertyValueFactory( Func<MemberInfo, ImmutableArray<IDefaultValueProvider>> factory ) { this.factory = factory; } public override object Get( DefaultValueParameter parameter ) => factory( parameter.Metadata ).Introduce( parameter, tuple => tuple.Item1.Get( tuple.Item2 ) ).FirstAssigned() ?? parameter.Metadata.From<DefaultValueAttribute, object>( attribute => attribute.Value ); } }
42.75
267
0.807018
[ "MIT" ]
DragonSpark/VoteReporter
Framework/DragonSpark/ComponentModel/DefaultPropertyValueFactory.cs
1,026
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.EntityFrameworkCore.TestUtilities; public class SqlServerAdventureWorksTestStoreFactory : SqlServerTestStoreFactory { public static new SqlServerAdventureWorksTestStoreFactory Instance { get; } = new(); protected SqlServerAdventureWorksTestStoreFactory() { } public override TestStore GetOrCreate(string storeName) => SqlServerTestStore.GetOrCreate( "adventureworks", Path.Combine("SqlAzure", "adventureworks.sql")); }
33.315789
88
0.748815
[ "MIT" ]
Applesauce314/efcore
test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerAdventureWorksTestStoreFactory.cs
635
C#
 // This file was automatically generated by the code gen tool - do not modify. using System ; using scg = System.Collections.Generic ; using sd = System.Data ; using sds = System.Data.SqlClient ; using sr = System.Reflection ; using mst = Microsoft.SqlServer.Types ; using mss = Microsoft.SqlServer.Server ; using acr = alby.codegen.runtime ; using ns = alby.pantheon.codegen; namespace alby.pantheon.codegen.storedProcedure { public partial class StoredProcedureFactory : acr.StoredProcedureFactoryBase< ns.database.pantheonDatabaseSingletonHelper, ns.database.pantheonDatabase > { public int SectorGet ( sds.SqlConnection connˡ, int? SectorID, string UpdateUserCode, DateTime? UpdateDateTime, out scg.List<SectorGet٠rs1> rsˡ1, sds.SqlTransaction tranˡ = null ) { const string schemaˡ = "dbo" ; const string spˡ = "SectorGet" ; scg.List<sds.SqlParameter> parametersˡ = new scg.List<sds.SqlParameter>() ; sds.SqlParameter paramˡSectorID = base.AddParameterˡ( parametersˡ, "@SectorID", SectorID, sd.SqlDbType.Int, true, null, 10, 0 ) ; sds.SqlParameter paramˡUpdateUserCode = base.AddParameterˡ( parametersˡ, "@UpdateUserCode", UpdateUserCode, sd.SqlDbType.VarChar, true, 50, null, null ) ; sds.SqlParameter paramˡUpdateDateTime = base.AddParameterˡ( parametersˡ, "@UpdateDateTime", UpdateDateTime, sd.SqlDbType.DateTime, true, null, null, null ) ; sds.SqlParameter paramˡrcˡ = base.AddParameterReturnValueˡ( parametersˡ, "@rcˡ" ) ; sd.DataSet dsˡ = base.Executeˡ( connˡ, tranˡ, schemaˡ, spˡ, parametersˡ ) ; rsˡ1 = base.ToRecordsetˡ<SectorGet٠rs1>( dsˡ, 1 ) ; return base.GetParameterValueˡ<int>( paramˡrcˡ ) ; } } }
37.468085
162
0.713231
[ "MIT" ]
casaletto/alby.pantheon.2015
alby.pantheon.codegen/storedProcedure/SectorGet.cs
1,798
C#
namespace EasyCaching.LiteDB { using EasyCaching.Core; using EasyCaching.Core.Configurations; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; /// <summary> /// LiteDB options extension. /// </summary> internal sealed class LiteDBOptionsExtension : IEasyCachingOptionsExtension { /// <summary> /// The name. /// </summary> private readonly string _name; /// <summary> /// The configure. /// </summary> private readonly Action<LiteDBOptions> configure; /// <summary> /// Initializes a new instance of the <see cref="T:EasyCaching.LiteDB.LiteDBOptionsExtension"/> class. /// </summary> /// <param name="name">Name.</param> /// <param name="configure">Configure.</param> public LiteDBOptionsExtension(string name, Action<LiteDBOptions> configure) { this._name = name; this.configure = configure; } /// <summary> /// Adds the services. /// </summary> /// <param name="services">Services.</param> public void AddServices(IServiceCollection services) { services.AddOptions(); services.Configure(_name, configure); services.TryAddSingleton<IEasyCachingProviderFactory, DefaultEasyCachingProviderFactory>(); services.AddSingleton<ILiteDBDatabaseProvider, LiteDBDatabaseProvider>(x => { var optionsMon = x.GetRequiredService<IOptionsMonitor<LiteDBOptions>>(); var options = optionsMon.Get(_name); return new LiteDBDatabaseProvider(_name, options); }); services.AddSingleton<IEasyCachingProvider, DefaultLiteDBCachingProvider>(x => { var dbProviders = x.GetServices<ILiteDBDatabaseProvider>(); var optionsMon = x.GetRequiredService<IOptionsMonitor<LiteDBOptions>>(); var options = optionsMon.Get(_name); var factory = x.GetService<ILoggerFactory>(); return new DefaultLiteDBCachingProvider(_name, dbProviders, options, factory); }); } } }
36.015152
110
0.615061
[ "MIT" ]
861191244/EasyCaching
src/EasyCaching.LiteDB/Configurations/LiteDBOptionsExtension.cs
2,379
C#
// c:\program files (x86)\windows kits\10\include\10.0.22000.0\um\mmeapi.h(101,9) using System; using System.Runtime.InteropServices; namespace DirectN { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public partial struct tagWAVEOUTCAPSA { public ushort wMid; public ushort wPid; public uint vDriverVersion; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szPname; public uint dwFormats; public ushort wChannels; public ushort wReserved1; public uint dwSupport; } }
29.142857
83
0.653595
[ "MIT" ]
Steph55/DirectN
DirectN/DirectN/Generated/tagWAVEOUTCAPSA.cs
614
C#
using System; using Mono.Unix; using Nancy.Hosting.Self; using Mono.Unix.Native; using log4net; using Com.Bekijkhet.Logger; using log4net.Config; namespace Com.Bekijkhet.MyBroker.Console { class MainClass { private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public static void Main(string[] args) { BasicConfigurator.Configure(); var now = DateTime.UtcNow; var uri = "http://localhost:8888"; Log.Info(log, "Starting MyRouter on " + uri, DateTime.UtcNow); // initialize an instance of NancyHost var host = new NancyHost(new Uri(uri)); host.Start(); // start hosting // check if we're running on mono if (Type.GetType("Mono.Runtime") != null) { // on mono, processes will usually run as daemons - this allows you to listen // for termination signals (ctrl+c, shutdown, etc) and finalize correctly UnixSignal.WaitAny(new[] { new UnixSignal(Signum.SIGINT), new UnixSignal(Signum.SIGTERM), new UnixSignal(Signum.SIGQUIT), new UnixSignal(Signum.SIGHUP) }); } else { System.Console.ReadLine(); } Log.Info(log, "Stopping Nancy", DateTime.UtcNow); host.Stop(); // stop hosting } } }
30.98
127
0.557779
[ "MIT" ]
broersa/mylorawan
Com.Bekijkhet.MyBroker.Console/Program.cs
1,551
C#
using System.Linq; using System.Collections.Generic; using System; namespace RobotWars { public class MoveCommand : ICommand { private readonly IDictionary<char, Motion> moveCommandMapping = new Dictionary<char, Motion> { {'L', Motion.Left}, {'R', Motion.Right}, {'M', Motion.Forward} }; private readonly IRobot robot; public MoveCommand(IRobot robot) { if (robot == null) { throw new ArgumentNullException("robot"); } this.robot = robot; } #region ICommand implementation public void Perform(string command) { var args = GuardValidCommands(command); foreach (var arg in args) { if (!moveCommandMapping.ContainsKey(arg)) { throw new ArgumentException("Argument: 'command' is invalid"); } robot.Move(moveCommandMapping[arg]); } } #endregion private char[] GuardValidCommands(string command) { if (string.IsNullOrWhiteSpace(command)) { throw new ArgumentNullException("command"); } return command.ToCharArray(); } } }
23
100
0.512896
[ "Apache-2.0" ]
chriscartlidge/CodeKata.RobotWars
src/RobotWars/Commands/MoveCommand.cs
1,359
C#
using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.Data; using System.Text; namespace YesSql.Provider.MySql { public class MySqlDialect : BaseDialect { private static Dictionary<DbType, string> ColumnTypes = new Dictionary<DbType, string> { {DbType.Guid, "char(36)"}, {DbType.Binary, "varbinary(8000)"}, {DbType.Time, "time"}, {DbType.Date, "datetime"}, {DbType.DateTime, "datetime" }, {DbType.DateTime2, "datetime" }, {DbType.DateTimeOffset, "datetime" }, {DbType.Boolean, "bit"}, {DbType.Byte, "tinyint unsigned"}, {DbType.Decimal, "decimal(65, 30)"}, {DbType.Double, "double"}, {DbType.Int16, "smallint"}, {DbType.UInt16, "smallint unsigned"}, {DbType.Int32, "int"}, {DbType.UInt32, "int unsigned"}, {DbType.Int64, "bigint"}, {DbType.UInt64, "bigint unsigned"}, {DbType.AnsiStringFixedLength, "char"}, {DbType.AnsiString, "varchar(127)"}, {DbType.StringFixedLength, "varchar"}, {DbType.String, "varchar(255)"}, }; public override string Name => "MySql"; public override string IdentitySelectString => "; select LAST_INSERT_ID()"; public override string IdentityColumnString => "int AUTO_INCREMENT primary key"; public override string RandomOrderByClause => "rand()"; public override bool SupportsIfExistsBeforeTableName => true; public override string GetTypeName(DbType dbType, int? length, byte precision, byte scale) { if (length.HasValue) { if (dbType == DbType.Binary) { if (length < 256) { return "TINYBLOB"; } if (length < 65536) { return "BLOB"; } if (length < 16777216) { return "MEDIUMBLOB"; } return "LONGBLOB"; } if (length.Value > 4000) { if (dbType == DbType.String) { // Mysql uses up to 4 bytes per Unicode char depends on Encoding, so 65536/4 and 16MB/4 make sense return length.Value > 16384 ? length.Value > 4194304 ? "LONGTEXT" : "MEDIUMTEXT" : "TEXT"; } if (dbType == DbType.AnsiString) { // Mysql uses up to 4 bytes per Unicode char depends on Encoding, so 65536/4 and 16MB/4 make sense return length.Value > 16384 ? length.Value > 4194304 ? "LONGTEXT" : "MEDIUMTEXT" : "TEXT"; } } else { if (dbType == DbType.String) { return "varchar(" + length + ")"; } if (dbType == DbType.AnsiString) { return "varchar(" + length + ")"; } } } if (ColumnTypes.TryGetValue(dbType, out string value)) { return value; } throw new Exception("DbType not found for: " + dbType); } public override string GetDropForeignKeyConstraintString(string name) { return " drop foreign key " + name; } public override string GetAddForeignKeyConstraintString(string name, string[] srcColumns, string destTable, string[] destColumns, bool primaryKey) { string sql = base.GetAddForeignKeyConstraintString(name, srcColumns, destTable, destColumns, primaryKey); var res = new StringBuilder(sql); res.Append(" on delete cascade ") .Append(" on update cascade "); return res.ToString(); } public override string DefaultValuesInsert => "VALUES()"; public override void Page(ISqlBuilder sqlBuilder, string offset, string limit) { if (offset != null && limit == null) { limit = "-1"; } if (limit != null) { sqlBuilder.Trail(" LIMIT "); // c.f. https://stackoverflow.com/questions/255517/mysql-offset-infinite-rows sqlBuilder.Trail(limit == "-1" ? "18446744073709551610" : limit); if (offset != null) { sqlBuilder.Trail(" OFFSET "); sqlBuilder.Trail(offset); } } } public override string GetDropIndexString(string indexName, string tableName) { // This is dependent on version of MySql < v10.1.4 does not support IF EXISTS return "drop index " + QuoteForColumnName(indexName) + " on " + QuoteForTableName(tableName); } public override string QuoteForColumnName(string columnName) { return "`" + columnName + "`"; } public override string QuoteForTableName(string tableName) { return "`" + tableName + "`"; } public override void Concat(StringBuilder builder, params Action<StringBuilder>[] generators) { builder.Append("concat("); for (var i = 0; i < generators.Length; i++) { if (i > 0) { builder.Append(", "); } generators[i](builder); } builder.Append(")"); } } }
33.49162
154
0.481568
[ "MIT" ]
ArieGato/yessql
src/YesSql.Provider.MySql/MySqlDialect.cs
5,995
C#
using System; using System.Threading.Tasks; using Coravel; using Coravel.Events; using Coravel.Events.Interfaces; using Microsoft.Extensions.DependencyInjection; using UnitTests.Events.EventsAndListeners; using Xunit; namespace UnitTests.Events { public class EventTests { [Fact] public async Task TestRegisterOneListener() { int listenersExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient<Action>(p => () => listenersExecutedCount++); // This is injected into the listeners via DI services.AddEvents(); services.AddTransient<TestListener1ForEvent1>(); services.AddTransient<TestListener2ForEvent1>(); services.AddTransient<TestListenerForEvent2>(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>(); await dispatcher.Broadcast(new TestEvent1()); Assert.Equal(1, listenersExecutedCount); } [Fact] public async Task TestRegisterTwoListenerWithDifferentRegisterCallSameCounter() { int listenersExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient<Action>(p => () => listenersExecutedCount++); services.AddTransient<TestListener1ForEvent1>(); services.AddTransient<TestListener2ForEvent1>(); services.AddEvents(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>(); dispatcher.Register<TestEvent1>() .Subscribe<TestListener2ForEvent1>(); await dispatcher.Broadcast(new TestEvent1()); Assert.Equal(2, listenersExecutedCount); } [Fact] public async Task TestRegisterTwoListenerWithDifferentRegisterCallDifferentCounters() { int listener1ExecutedCount = 0; int listener2ExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient(s => new TestListener1ForEvent1(() => listener1ExecutedCount++)); services.AddTransient(s => new TestListener2ForEvent1(() => listener2ExecutedCount++)); services.AddEvents(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>(); dispatcher.Register<TestEvent1>() .Subscribe<TestListener2ForEvent1>(); await dispatcher.Broadcast(new TestEvent1()); Assert.Equal(1, listener1ExecutedCount); Assert.Equal(1, listener2ExecutedCount); } [Fact] public async Task TestRegisterAllListeners() { int listenersExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient<Action>(p => () => listenersExecutedCount++); services.AddEvents(); services.AddTransient<TestListener1ForEvent1>(); services.AddTransient<TestListener2ForEvent1>(); services.AddTransient<TestListenerForEvent2>(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>() .Subscribe<TestListener2ForEvent1>(); dispatcher.Register<TestEvent2>() .Subscribe<TestListenerForEvent2>(); await dispatcher.Broadcast(new TestEvent1()); Assert.Equal(2, listenersExecutedCount); await dispatcher.Broadcast(new TestEvent2()); Assert.Equal(3, listenersExecutedCount); } [Fact] public async Task TestDuplicateSubscriptionsJustBypasses() { int listenersExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient<Action>(p => () => listenersExecutedCount++); services.AddEvents(); services.AddTransient<TestListener1ForEvent1>(); services.AddTransient<TestListener2ForEvent1>(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; // We are testing this one. dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>() .Subscribe<TestListener2ForEvent1>() .Subscribe<TestListener1ForEvent1>() .Subscribe<TestListener2ForEvent1>(); await dispatcher.Broadcast(new TestEvent1()); Assert.Equal(2, listenersExecutedCount); } [Fact] public async Task TestEventListenerThatDispatchesEvent1And2() { int listenersExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient<Action>(p => () => listenersExecutedCount++); services.AddEvents(); services.AddTransient<TestListener1ForEvent1>(); services.AddTransient<TestListener2ForEvent1>(); services.AddTransient<TestListenerForEvent2>(); services.AddTransient<TestListenerThatFiresEvent1And2>(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>() .Subscribe<TestListener2ForEvent1>(); dispatcher.Register<TestEvent2>() .Subscribe<TestListenerForEvent2>(); dispatcher.Register<TestEventWithDispatcher>() .Subscribe<TestListenerThatFiresEvent1And2>(); await dispatcher.Broadcast(new TestEventWithDispatcher(dispatcher)); Assert.Equal(3, listenersExecutedCount); } [Fact] public async Task TestRegisterSameTypeTwiceDoesntThrow() { int listenersExecutedCount = 0; var services = new ServiceCollection(); services.AddTransient<Action>(p => () => listenersExecutedCount++); services.AddEvents(); services.AddTransient<TestListener1ForEvent1>(); var provider = services.BuildServiceProvider(); var dispatcher = provider.GetRequiredService<IDispatcher>() as Dispatcher; dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>(); dispatcher.Register<TestEvent1>() .Subscribe<TestListener1ForEvent1>(); await dispatcher.Broadcast(new TestEvent1()); Assert.Equal(1, listenersExecutedCount); } } }
37.06599
125
0.628184
[ "MIT" ]
alandecastros/coravel
Src/UnitTests/CoravelUnitTests/Events/EventTests.cs
7,302
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // 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("ColorBlocks.Droid")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ColorBlocks.Droid")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // 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")] // Add some common permissions, these can be removed if not needed [assembly: UsesPermission(Android.Manifest.Permission.Internet)] [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
36.6
84
0.75644
[ "Apache-2.0" ]
NoleHealth/xamarin-forms-book-preview-2
Chapter04/ColorBlocks/ColorBlocks/ColorBlocks.Droid/Properties/AssemblyInfo.cs
1,284
C#
using System; using System.Threading.Tasks; using FakeRabbitMQ; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Moq; using NUnit.Framework; using Nybus; using Nybus.Configuration; using static Tests.TestUtils; namespace Tests { [TestFixture] public class NoNamespaceMessageTests { [Test, AutoMoqData] public async Task Host_can_loopback_commands(FakeServer server, NoNamespaceCommand testCommand, CommandReceivedAsync<NoNamespaceCommand> commandReceived) { var host = CreateNybusHost(nybus => { nybus.UseRabbitMqBusEngine(rabbitMq => { rabbitMq.Configure(configuration => configuration.ConnectionFactory = server.CreateConnectionFactory()); }); nybus.SubscribeToCommand(commandReceived); }); await host.StartAsync(); await host.Bus.InvokeCommandAsync(testCommand); await host.StopAsync(); Mock.Get(commandReceived).Verify(p => p(It.IsAny<IDispatcher>(), It.IsAny<ICommandContext<NoNamespaceCommand>>())); } [Test, AutoMoqData] public async Task Host_can_loopback_events(FakeServer server, NoNamespaceEvent testEvent, EventReceivedAsync<NoNamespaceEvent> eventReceived) { var host = CreateNybusHost(nybus => { nybus.UseRabbitMqBusEngine(rabbitMq => { rabbitMq.Configure(configuration => configuration.ConnectionFactory = server.CreateConnectionFactory()); }); nybus.SubscribeToEvent(eventReceived); }); await host.StartAsync(); await host.Bus.RaiseEventAsync(testEvent); await host.StopAsync(); Mock.Get(eventReceived).Verify(p => p(It.IsAny<IDispatcher>(), It.IsAny<IEventContext<NoNamespaceEvent>>())); } [Test, AutoMoqData] public async Task Hosts_can_exchange_commands(FakeServer server, NoNamespaceCommand testCommand, CommandReceivedAsync<NoNamespaceCommand> commandReceived) { var sender = CreateNybusHost(nybus => { nybus.UseRabbitMqBusEngine(rabbitMq => { rabbitMq.Configure(configuration => configuration.ConnectionFactory = server.CreateConnectionFactory()); }); }); var receiver = CreateNybusHost(nybus => { nybus.UseRabbitMqBusEngine(rabbitMq => { rabbitMq.Configure(configuration => configuration.ConnectionFactory = server.CreateConnectionFactory()); }); nybus.SubscribeToCommand(commandReceived); }); await sender.StartAsync(); await receiver.StartAsync(); await sender.Bus.InvokeCommandAsync(testCommand); await receiver.StopAsync(); await sender.StopAsync(); Mock.Get(commandReceived).Verify(p => p(It.IsAny<IDispatcher>(), It.IsAny<ICommandContext<NoNamespaceCommand>>())); } [Test, AutoMoqData] public async Task Hosts_can_exchange_events(FakeServer server, NoNamespaceEvent testEvent, EventReceivedAsync<NoNamespaceEvent> eventReceived) { var sender = CreateNybusHost(nybus => { nybus.UseRabbitMqBusEngine(rabbitMq => { rabbitMq.Configure(configuration => configuration.ConnectionFactory = server.CreateConnectionFactory()); }); }); var receiver = CreateNybusHost(nybus => { nybus.UseRabbitMqBusEngine(rabbitMq => { rabbitMq.Configure(configuration => configuration.ConnectionFactory = server.CreateConnectionFactory()); }); nybus.SubscribeToEvent(eventReceived); }); await sender.StartAsync(); await receiver.StartAsync(); await sender.Bus.RaiseEventAsync(testEvent); await receiver.StopAsync(); await sender.StopAsync(); Mock.Get(eventReceived).Verify(p => p(It.IsAny<IDispatcher>(), It.IsAny<IEventContext<NoNamespaceEvent>>())); } } }
33.876923
162
0.603769
[ "MIT" ]
Kralizek/Nybus
tests/integration/Tests.Integration.Nybus.Engine.RabbitMq/NoNamespaceMessageTests.cs
4,406
C#
using System.Reflection; using System.Runtime.CompilerServices; using Android.App; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("FloatingSearchView")] [assembly: AssemblyDescription ("")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("")] [assembly: AssemblyCopyright ("Copyright (c) Xamarin Inc 2017")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("2.0.0.0")] [assembly: AssemblyFileVersion ("2.1.1.0")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
36.233333
81
0.73965
[ "MIT" ]
4brunu/XamarinComponents
Android/FloatingSearchView/source/FloatingSearchView/Properties/AssemblyInfo.cs
1,089
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Valve.VR.InteractionSystem { public class HandCollider : MonoBehaviour { private new Rigidbody rigidbody; [HideInInspector] public HandPhysics hand; public LayerMask collisionMask; Collider[] colliders; public FingerColliders fingerColliders; [System.Serializable] public class FingerColliders { [Tooltip("Starting at tip and going down. Max 2.")] public Transform[] thumbColliders = new Transform[1]; [Tooltip("Starting at tip and going down. Max 3.")] public Transform[] indexColliders = new Transform[2]; [Tooltip("Starting at tip and going down. Max 3.")] public Transform[] middleColliders = new Transform[2]; [Tooltip("Starting at tip and going down. Max 3.")] public Transform[] ringColliders = new Transform[2]; [Tooltip("Starting at tip and going down. Max 3.")] public Transform[] pinkyColliders = new Transform[2]; public Transform[] this[int finger] { get { switch (finger) { case 0: return thumbColliders; case 1: return indexColliders; case 2: return middleColliders; case 3: return ringColliders; case 4: return pinkyColliders; default: return null; } } set { switch (finger) { case 0: thumbColliders = value; break; case 1: indexColliders = value; break; case 2: middleColliders = value; break; case 3: ringColliders = value; break; case 4: pinkyColliders = value; break; } } } } private static PhysicMaterial physicMaterial_lowfriction; private static PhysicMaterial physicMaterial_highfriction; private void Awake() { rigidbody = GetComponent<Rigidbody>(); rigidbody.maxAngularVelocity = 50; } private void Start() { colliders = GetComponentsInChildren<Collider>(); if (physicMaterial_lowfriction == null) { physicMaterial_lowfriction = new PhysicMaterial("hand_lowFriction"); physicMaterial_lowfriction.dynamicFriction = 0; physicMaterial_lowfriction.staticFriction = 0; physicMaterial_lowfriction.bounciness = 0; physicMaterial_lowfriction.bounceCombine = PhysicMaterialCombine.Minimum; physicMaterial_lowfriction.frictionCombine = PhysicMaterialCombine.Minimum; } if (physicMaterial_highfriction == null) { physicMaterial_highfriction = new PhysicMaterial("hand_highFriction"); physicMaterial_highfriction.dynamicFriction = 1f; physicMaterial_highfriction.staticFriction = 1f; physicMaterial_highfriction.bounciness = 0; physicMaterial_highfriction.bounceCombine = PhysicMaterialCombine.Minimum; physicMaterial_highfriction.frictionCombine = PhysicMaterialCombine.Average; } SetPhysicMaterial(physicMaterial_lowfriction); scale = SteamVR_Utils.GetLossyScale(hand.transform); } void SetPhysicMaterial(PhysicMaterial mat) { if (colliders == null) colliders = GetComponentsInChildren<Collider>(); for (int i = 0; i < colliders.Length; i++) { colliders[i].sharedMaterial = mat; } } float scale; public void SetCollisionDetectionEnabled(bool value) { rigidbody.detectCollisions = value; } public void MoveTo(Vector3 position, Quaternion rotation) { targetPosition = position; targetRotation = rotation; //rigidbody.MovePosition(position); //rigidbody.MoveRotation(rotation); ExecuteFixedUpdate(); } public void TeleportTo(Vector3 position, Quaternion rotation) { targetPosition = position; targetRotation = rotation; MoveTo(position, rotation); rigidbody.position = position; if (rotation.x != 0 || rotation.y != 0 || rotation.z != 0 || rotation.w != 0) rigidbody.rotation = rotation; //also update transform in case physics is disabled transform.position = position; transform.rotation = rotation; } public void Reset() { TeleportTo(targetPosition, targetRotation); } public void SetCenterPoint(Vector3 newCenter) { center = newCenter; } private Vector3 center; private Vector3 targetPosition = Vector3.zero; private Quaternion targetRotation = Quaternion.identity; protected const float MaxVelocityChange = 10f; protected const float VelocityMagic = 6000f; protected const float AngularVelocityMagic = 50f; protected const float MaxAngularVelocityChange = 20f; public bool collidersInRadius; protected void ExecuteFixedUpdate() { collidersInRadius = Physics.CheckSphere(center, 0.2f, collisionMask); if (collidersInRadius == false) { //keep updating velocity, just in case. Otherwise you get jitter rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; /* rigidbody.velocity = (targetPosition - rigidbody.position) / Time.fixedDeltaTime; float angle; Vector3 axis; (targetRotation * Quaternion.Inverse(rigidbody.rotation)).ToAngleAxis(out angle, out axis); rigidbody.angularVelocity = axis.normalized * angle / Time.fixedDeltaTime; */ rigidbody.MovePosition(targetPosition); rigidbody.MoveRotation(targetRotation); } else { Vector3 velocityTarget, angularTarget; bool success = GetTargetVelocities(out velocityTarget, out angularTarget); if (success) { float maxAngularVelocityChange = MaxAngularVelocityChange * scale; float maxVelocityChange = MaxVelocityChange * scale; rigidbody.velocity = Vector3.MoveTowards(rigidbody.velocity, velocityTarget, maxVelocityChange); rigidbody.angularVelocity = Vector3.MoveTowards(rigidbody.angularVelocity, angularTarget, maxAngularVelocityChange); } } } protected bool GetTargetVelocities(out Vector3 velocityTarget, out Vector3 angularTarget) { bool realNumbers = false; float velocityMagic = VelocityMagic; float angularVelocityMagic = AngularVelocityMagic; Vector3 positionDelta = (targetPosition - rigidbody.position); velocityTarget = (positionDelta * velocityMagic * Time.deltaTime); if (float.IsNaN(velocityTarget.x) == false && float.IsInfinity(velocityTarget.x) == false) { realNumbers = true; } else velocityTarget = Vector3.zero; Quaternion rotationDelta = targetRotation * Quaternion.Inverse(rigidbody.rotation); float angle; Vector3 axis; rotationDelta.ToAngleAxis(out angle, out axis); if (angle > 180) angle -= 360; if (angle != 0 && float.IsNaN(axis.x) == false && float.IsInfinity(axis.x) == false) { angularTarget = angle * axis * angularVelocityMagic * Time.deltaTime; realNumbers &= true; } else angularTarget = Vector3.zero; return realNumbers; } const float minCollisionEnergy = 0.1f; const float maxCollisionEnergy = 1.0f; const float minCollisionHapticsTime = 0.2f; private float lastCollisionHapticsTime; private void OnCollisionEnter(Collision collision) { bool touchingDynamic = false; if (collision.rigidbody != null) { if (collision.rigidbody.isKinematic == false) touchingDynamic = true; } // low friction if touching static object, high friction if touching dynamic SetPhysicMaterial(touchingDynamic ? physicMaterial_highfriction : physicMaterial_lowfriction); float energy = collision.relativeVelocity.magnitude; if(energy > minCollisionEnergy && Time.time - lastCollisionHapticsTime > minCollisionHapticsTime) { lastCollisionHapticsTime = Time.time; float intensity = Util.RemapNumber(energy, minCollisionEnergy, maxCollisionEnergy, 0.3f, 1.0f); float length = Util.RemapNumber(energy, minCollisionEnergy, maxCollisionEnergy, 0.0f, 0.06f); hand.hand.TriggerHapticPulse(length, 100, intensity); } } private void OnCollisionStay() { hand.OnHandColliderStay(); } } }
36.135417
137
0.543288
[ "BSD-3-Clause" ]
Bazzagibbs/steamvr_unity_plugin
Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs
10,409
C#
namespace Sudoku_3 { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.SuspendLayout(); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(35)))), ((int)(((byte)(18))))); this.ClientSize = new System.Drawing.Size(300, 300); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp); this.ResumeLayout(false); } #endregion } }
39.103448
137
0.592593
[ "MIT" ]
swift502/Sudoku
Sudoku 3/Okna/Form1/Form1.Designer.cs
2,270
C#
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // <auto-generated/> // Template Source: ComplexType.cs.tt namespace Microsoft.Graph { using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using Newtonsoft.Json; /// <summary> /// The type TeleconferenceDeviceScreenSharingQuality. /// </summary> [JsonObject(MemberSerialization = MemberSerialization.OptIn)] public partial class TeleconferenceDeviceScreenSharingQuality : TeleconferenceDeviceVideoQuality { /// <summary> /// Initializes a new instance of the <see cref="TeleconferenceDeviceScreenSharingQuality"/> class. /// </summary> public TeleconferenceDeviceScreenSharingQuality() { this.ODataType = "microsoft.graph.teleconferenceDeviceScreenSharingQuality"; } } }
36.294118
153
0.615883
[ "MIT" ]
DamienTehDemon/msgraph-sdk-dotnet
src/Microsoft.Graph/Generated/model/TeleconferenceDeviceScreenSharingQuality.cs
1,234
C#
// Copyright (c) Microsoft Corporation // The Microsoft Corporation 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 FancyZonesEditor.Models { // GridLayoutModel // Grid-styled Layout Model, which specifies rows, columns, percentage sizes, and row/column spans public class GridLayoutModel : LayoutModel { // Non-localizable strings public const string ModelTypeID = "grid"; public const int GridMultiplier = 10000; // hard coded data for all the "Priority Grid" configurations that are unique to "Grid" private static readonly byte[][] _priorityData = new byte[][] { new byte[] { 0, 0, 0, 0, 0, 1, 1, 39, 16, 39, 16, 0 }, new byte[] { 0, 0, 0, 0, 0, 1, 2, 39, 16, 26, 11, 13, 5, 0, 1 }, new byte[] { 0, 0, 0, 0, 0, 1, 3, 39, 16, 9, 196, 19, 136, 9, 196, 0, 1, 2 }, new byte[] { 0, 0, 0, 0, 0, 2, 3, 19, 136, 19, 136, 9, 196, 19, 136, 9, 196, 0, 1, 2, 0, 1, 3 }, new byte[] { 0, 0, 0, 0, 0, 2, 3, 19, 136, 19, 136, 9, 196, 19, 136, 9, 196, 0, 1, 2, 3, 1, 4 }, new byte[] { 0, 0, 0, 0, 0, 3, 3, 13, 5, 13, 6, 13, 5, 9, 196, 19, 136, 9, 196, 0, 1, 2, 0, 1, 3, 4, 1, 5 }, new byte[] { 0, 0, 0, 0, 0, 3, 3, 13, 5, 13, 6, 13, 5, 9, 196, 19, 136, 9, 196, 0, 1, 2, 3, 1, 4, 5, 1, 6 }, new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 2, 7 }, new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8 }, new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 1, 8, 9 }, new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 8, 9, 10 }, }; // Rows - number of rows in the Grid public int Rows { get { return _rows; } set { if (_rows != value) { _rows = value; } } } private int _rows = 1; // Columns - number of columns in the Grid public int Columns { get { return _cols; } set { if (_cols != value) { _cols = value; } } } private int _cols = 1; // CellChildMap - represents which "children" belong in which grid cells; // shows spanning children by the same index appearing in adjacent cells // TODO: ideally no setter here - this means moving logic like "split" over to model public int[,] CellChildMap { get; set; } // RowPercents - represents the %age height of each row in the grid public List<int> RowPercents { get; set; } = new List<int>(); // ColumnPercents - represents the %age width of each column in the grid public List<int> ColumnPercents { get; set; } = new List<int>(); // ShowSpacing - flag if free space between cells should be presented public bool ShowSpacing { get { return _showSpacing; } set { if (value != _showSpacing) { _showSpacing = value; FirePropertyChanged(nameof(ShowSpacing)); } } } private bool _showSpacing = LayoutSettings.DefaultShowSpacing; // Spacing - free space between cells public int Spacing { get { return _spacing; } set { if (value != _spacing) { _spacing = value; FirePropertyChanged(nameof(Spacing)); } } } private int _spacing = LayoutSettings.DefaultSpacing; // FreeZones (not persisted) - used to keep track of child indices that are no longer in use in the CellChildMap, // making them candidates for re-use when it's needed to add another child // TODO: do I need FreeZones on the data model? - I think I do public IList<int> FreeZones { get; } = new List<int>(); public GridLayoutModel() : base() { } public GridLayoutModel(string name) : base(name) { } public GridLayoutModel(string name, LayoutType type) : base(name, type) { } public GridLayoutModel(string uuid, string name, LayoutType type, int rows, int cols, List<int> rowPercents, List<int> colsPercents, int[,] cellChildMap) : base(uuid, name, type) { _rows = rows; _cols = cols; RowPercents = rowPercents; ColumnPercents = colsPercents; CellChildMap = cellChildMap; } public GridLayoutModel(GridLayoutModel other) : base(other) { _rows = other._rows; _cols = other._cols; _showSpacing = other._showSpacing; _spacing = other._spacing; CellChildMap = new int[_rows, _cols]; for (int row = 0; row < _rows; row++) { for (int col = 0; col < _cols; col++) { CellChildMap[row, col] = other.CellChildMap[row, col]; } } for (int row = 0; row < _rows; row++) { RowPercents.Add(other.RowPercents[row]); } for (int col = 0; col < _cols; col++) { ColumnPercents.Add(other.ColumnPercents[col]); } } public void UpdatePreview() { FirePropertyChanged(); } public void Reload(byte[] data) { // Skip version (2 bytes), id (2 bytes), and type (1 bytes) int i = 5; _rows = data[i++]; _cols = data[i++]; RowPercents = new List<int>(Rows); for (int row = 0; row < Rows; row++) { RowPercents.Add((data[i++] * 256) + data[i++]); } ColumnPercents = new List<int>(Columns); for (int col = 0; col < Columns; col++) { ColumnPercents.Add((data[i++] * 256) + data[i++]); } CellChildMap = new int[Rows, Columns]; for (int row = 0; row < Rows; row++) { for (int col = 0; col < Columns; col++) { CellChildMap[row, col] = data[i++]; } } FirePropertyChanged(); } // Clone // Implements the LayoutModel.Clone abstract method // Clones the data from this GridLayoutModel to a new GridLayoutModel public override LayoutModel Clone() { GridLayoutModel layout = new GridLayoutModel(Name); RestoreTo(layout); return layout; } public void RestoreTo(GridLayoutModel layout) { int rows = Rows; int cols = Columns; layout.Rows = rows; layout.Columns = cols; int[,] cellChildMap = new int[rows, cols]; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { cellChildMap[row, col] = CellChildMap[row, col]; } } layout.CellChildMap = cellChildMap; List<int> rowPercents = new List<int>(rows); for (int row = 0; row < rows; row++) { rowPercents.Add(RowPercents[row]); } layout.RowPercents = rowPercents; List<int> colPercents = new List<int>(cols); for (int col = 0; col < cols; col++) { colPercents.Add(ColumnPercents[col]); } layout.ColumnPercents = colPercents; layout.ShowSpacing = ShowSpacing; layout.Spacing = Spacing; layout.SensitivityRadius = SensitivityRadius; layout.FirePropertyChanged(); } // InitTemplateZones // Creates zones based on template zones count public override void InitTemplateZones() { switch (Type) { case LayoutType.Rows: InitRows(); break; case LayoutType.Columns: InitColumns(); break; case LayoutType.Grid: InitGrid(); break; case LayoutType.PriorityGrid: InitPriorityGrid(); break; case LayoutType.Custom: InitColumns(); // Custom is initialized with columns break; } FirePropertyChanged(); } // PersistData // Implements the LayoutModel.PersistData abstract method protected override void PersistData() { AddCustomLayout(this); } private void InitRows() { CellChildMap = new int[TemplateZoneCount, 1]; RowPercents = new List<int>(TemplateZoneCount); for (int i = 0; i < TemplateZoneCount; i++) { CellChildMap[i, 0] = i; // Note: This is NOT equal to _multiplier / ZoneCount and is done like this to make // the sum of all RowPercents exactly (_multiplier). RowPercents.Add(((GridMultiplier * (i + 1)) / TemplateZoneCount) - ((GridMultiplier * i) / TemplateZoneCount)); } _rows = TemplateZoneCount; } private void InitColumns() { CellChildMap = new int[1, TemplateZoneCount]; ColumnPercents = new List<int>(TemplateZoneCount); for (int i = 0; i < TemplateZoneCount; i++) { CellChildMap[0, i] = i; // Note: This is NOT equal to _multiplier / ZoneCount and is done like this to make // the sum of all RowPercents exactly (_multiplier). ColumnPercents.Add(((GridMultiplier * (i + 1)) / TemplateZoneCount) - ((GridMultiplier * i) / TemplateZoneCount)); } _cols = TemplateZoneCount; } private void InitGrid() { int rows = 1; while (TemplateZoneCount / rows >= rows) { rows++; } rows--; int cols = TemplateZoneCount / rows; if (TemplateZoneCount % rows == 0) { // even grid } else { cols++; } RowPercents = new List<int>(rows); ColumnPercents = new List<int>(cols); CellChildMap = new int[rows, cols]; // Note: The following are NOT equal to _multiplier divided by rows or columns and is // done like this to make the sum of all RowPercents exactly (_multiplier). for (int row = 0; row < rows; row++) { RowPercents.Add(((GridMultiplier * (row + 1)) / rows) - ((GridMultiplier * row) / rows)); } for (int col = 0; col < cols; col++) { ColumnPercents.Add(((GridMultiplier * (col + 1)) / cols) - ((GridMultiplier * col) / cols)); } int index = 0; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { CellChildMap[row, col] = index++; if (index == TemplateZoneCount) { index--; } } } _rows = rows; _cols = cols; } private void InitPriorityGrid() { if (TemplateZoneCount <= _priorityData.Length) { Reload(_priorityData[TemplateZoneCount - 1]); } else { // same as grid; InitGrid(); } } } }
32.823821
162
0.449501
[ "MIT" ]
DongKyoungPark/PowerToys
src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
12,826
C#