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
namespace Twilio.AspNet.Common { /// <summary> /// Base class for mapping incoming request parameters into a strongly typed object /// </summary> public abstract class TwilioRequest { /// <summary> /// Your Twilio account id. It is 34 characters long, and always starts with the letters AC /// </summary> public string AccountSid { get; set; } /// <summary> /// The phone number or client identifier of the party that initiated the call /// </summary> /// <remarks> /// Phone numbers are formatted with a '+' and country code, e.g. +16175551212 (E.164 format). Client identifiers begin with the client: URI scheme; for example, for a call from a client named 'tommy', the From parameter will be client:tommy. /// </remarks> public string From { get; set; } /// <summary> /// The phone number or client identifier of the called party /// </summary> /// <remarks> /// Phone numbers are formatted with a '+' and country code, e.g. +16175551212 (E.164 format). Client identifiers begin with the client: URI scheme; for example, for a call to a client named 'jenny', the To parameter will be client:jenny. /// </remarks> public string To { get; set; } /// <summary> /// The city of the caller /// </summary> public string FromCity { get; set; } /// <summary> /// The state or province of the caller /// </summary> public string FromState { get; set; } /// <summary> /// The postal code of the caller /// </summary> public string FromZip { get; set; } /// <summary> /// The country of the caller /// </summary> public string FromCountry { get; set; } /// <summary> /// The city of the called party /// </summary> public string ToCity { get; set; } /// <summary> /// The state or province of the called party /// </summary> public string ToState { get; set; } /// <summary> /// The postal code of the called party /// </summary> public string ToZip { get; set; } /// <summary> /// The country of the called party /// </summary> public string ToCountry { get; set; } } }
34.971831
250
0.540878
[ "Apache-2.0" ]
MattHartz/twilio-aspnet
src/Twilio.AspNet.Common/TwilioRequest.cs
2,485
C#
using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Components; using Umbraco.Core.Services; using Umbraco.Core.Strings; using Umbraco.Core.Logging; using Umbraco.Core.Scoping; using Umbraco.Web.HealthCheck.Checks.DataIntegrity; using LightInject; using Umbraco.Core.Configuration; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Persistence.Repositories; using Umbraco.Web.Routing; namespace Umbraco.Web.PublishedCache.XmlPublishedCache { [DisableComponent] // is not enabled by default public class XmlCacheComponent : UmbracoComponentBase, IUmbracoCoreComponent { public override void Compose(Composition composition) { base.Compose(composition); // register the XML facade service composition.SetPublishedSnapshotService(factory => new PublishedSnapshotService( factory.GetInstance<ServiceContext>(), factory.GetInstance<IPublishedContentTypeFactory>(), factory.GetInstance<IScopeProvider>(), factory.GetInstance<CacheHelper>().RequestCache, factory.GetInstance<UrlSegmentProviderCollection>(), factory.GetInstance<IPublishedSnapshotAccessor>(), factory.GetInstance<IVariationContextAccessor>(), factory.GetInstance<IDocumentRepository>(), factory.GetInstance<IMediaRepository>(), factory.GetInstance<IMemberRepository>(), factory.GetInstance<IDefaultCultureAccessor>(), factory.GetInstance<ILogger>(), factory.GetInstance<IGlobalSettings>(), factory.GetInstance<ISiteDomainHelper>(), factory.GetInstance<MainDom>())); // add the Xml cache health check (hidden from type finder) composition.HealthChecks().Add<XmlDataIntegrityHealthCheck>(); } public void Initialize(IPublishedSnapshotService service) { // nothing - this just ensures that the service is created at boot time } } }
40.288462
92
0.679236
[ "MIT" ]
ismailmayat/Umbraco-CMS
src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs
2,097
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace FirstLook.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } }
20.166667
68
0.535537
[ "Apache-2.0" ]
silkspinner/itc172W18-firstlook
Controllers/HomeController.cs
607
C#
//--------------------------------------------------------------------- // <copyright file="IconManager.cs" company="Microsoft"> // Copyright © ALM | DevOps Ranger Contributors. All rights reserved. // This code is licensed under the MIT License. // 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. // </copyright> // <summary>The IconManager type.</summary> //--------------------------------------------------------------------- namespace Microsoft.Word4Tfs.WordAddIn { using System; using System.ComponentModel; using System.Drawing; using System.Reflection; using System.Runtime.InteropServices; using Microsoft.Word4Tfs.Library; /// <summary> /// Manages access to the icons and bitmaps in a resource DLL. /// </summary> public static class IconManager { /// <summary> /// Gets an image from an embedded resource. /// </summary> /// <param name="name">The name of the embedded resource containing the image.</param> /// <returns>The image.</returns> public static Image GetImage(string name) { Image ans = Bitmap.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("Microsoft.Word4Tfs.WordAddIn.Images." + name)); return ans; } } }
37.846154
148
0.601626
[ "MIT" ]
ALM-Rangers/Sample-Code
src/TFS-Word-Add-In/WordAddIn/IconManager.cs
1,479
C#
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace Csla.Analyzers.Tests { [TestClass] public sealed class DoesChildOperationHaveRunLocalRemoveAttributeCodeFixTests { [TestMethod] public void VerifyGetFixableDiagnosticIds() { var fix = new DoesChildOperationHaveRunLocalRemoveAttributeCodeFix(); var ids = fix.FixableDiagnosticIds.ToList(); Assert.AreEqual(1, ids.Count, nameof(ids.Count)); Assert.AreEqual(ids[0], Constants.AnalyzerIdentifiers.DoesChildOperationHaveRunLocal, nameof(Constants.AnalyzerIdentifiers.DoesChildOperationHaveRunLocal)); } [TestMethod] public async Task VerifyGetFixesWhenRunLocalIsStandalone() { var code = @"using Csla; public class A : BusinessBase<A> { [RunLocal] [FetchChild] private void FetchChild() { } }"; var document = TestHelpers.Create(code); var tree = await document.GetSyntaxTreeAsync(); var diagnostics = await TestHelpers.GetDiagnosticsAsync(code, new DoesChildOperationHaveRunLocalAnalyzer()); var sourceSpan = diagnostics[0].Location.SourceSpan; var actions = new List<CodeAction>(); var codeActionRegistration = new Action<CodeAction, ImmutableArray<Diagnostic>>( (a, _) => { actions.Add(a); }); var fix = new DoesChildOperationHaveRunLocalRemoveAttributeCodeFix(); var codeFixContext = new CodeFixContext(document, diagnostics[0], codeActionRegistration, new CancellationToken(false)); await fix.RegisterCodeFixesAsync(codeFixContext); Assert.AreEqual(1, actions.Count, nameof(actions.Count)); await TestHelpers.VerifyChangesAsync(actions, DoesChildOperationHaveRunLocalRemoveAttributeCodeFixConstants.RemoveRunLocalDescription, document, (model, newRoot) => { Assert.IsFalse(newRoot.DescendantNodes(_ => true).OfType<AttributeSyntax>().Any(_ => _.Name.ToString() == "RunLocal")); }); } [TestMethod] public async Task VerifyGetFixesWhenRunLocalIsEmbeddedInList() { var code = @"using Csla; using System; public sealed class FooAttribute : Attribute { } public class A : BusinessBase<A> { [RunLocal, Foo, FetchChild] private void FetchChild() { } }"; var document = TestHelpers.Create(code); var tree = await document.GetSyntaxTreeAsync(); var diagnostics = await TestHelpers.GetDiagnosticsAsync(code, new DoesChildOperationHaveRunLocalAnalyzer()); var sourceSpan = diagnostics[0].Location.SourceSpan; var actions = new List<CodeAction>(); var codeActionRegistration = new Action<CodeAction, ImmutableArray<Diagnostic>>( (a, _) => { actions.Add(a); }); var fix = new DoesChildOperationHaveRunLocalRemoveAttributeCodeFix(); var codeFixContext = new CodeFixContext(document, diagnostics[0], codeActionRegistration, new CancellationToken(false)); await fix.RegisterCodeFixesAsync(codeFixContext); Assert.AreEqual(1, actions.Count, nameof(actions.Count)); await TestHelpers.VerifyChangesAsync(actions, DoesChildOperationHaveRunLocalRemoveAttributeCodeFixConstants.RemoveRunLocalDescription, document, (model, newRoot) => { Assert.IsFalse(newRoot.DescendantNodes(_ => true).OfType<AttributeSyntax>().Any(_ => _.Name.ToString() == "RunLocal")); }); } } }
35.854369
129
0.727051
[ "MIT" ]
Alstig/csla
Source/Csla.Analyzers/Csla.Analyzers.Tests/DoesChildOperationHaveRunLocalRemoveAttributeCodeFixTests.cs
3,695
C#
using System.Collections.Generic; using UnityEngine; using VitrivrVR.Query; using VitrivrVR.Query.Display; namespace VitrivrVR.UI { public class QuerySettingsView : MonoBehaviour { public UITableController statisticsTable; public List<QueryDisplay> queryDisplayPrefabs; private void Awake() { QueryController.Instance.queryFocusEvent.AddListener(OnQueryFocus); var currentQuery = QueryController.Instance.CurrentQuery; var results = currentQuery == -1 ? "-----" : QueryController.Instance.queries[currentQuery].display.NumberOfResults.ToString(); statisticsTable.table = new[,] { {"Results", results} }; } public void SetQueryDisplay(int displayPrefabIndex) { QueryController.Instance.queryDisplay = queryDisplayPrefabs[displayPrefabIndex]; } public void NewDisplayFromActive() { QueryController.Instance.NewDisplayFromActive(); } private void OnQueryFocus(int oldIndex, int newIndex) { UpdateQueryStatistics(newIndex); } private void UpdateQueryStatistics(int queryIndex) { var results = queryIndex == -1 ? "-----" : QueryController.Instance.queries[queryIndex].display.NumberOfResults.ToString(); statisticsTable.SetCell(0, 1, results); } } }
25.634615
92
0.690923
[ "MIT" ]
N4karin/vitrivr-vr
Assets/Scripts/VitrivrVR/UI/QuerySettingsView.cs
1,333
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(".NET Micro Framework Toolbox - SOMO-14D driver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NETMFToolbox.com")] [assembly: AssemblyProduct(".NET Micro Framework Toolbox - SOMO-14D driver")] [assembly: AssemblyCopyright("Copyright © NETMFToolbox.com 2011-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("4.2.0.0")] [assembly: AssemblyFileVersion("4.2.0.0")]
36.730769
77
0.753927
[ "Apache-2.0" ]
JakeLardinois/NetMF.Toolbox
Framework/Hardware.Somo/Properties/AssemblyInfo (4.2).cs
956
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("ICOPlatform.UI")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.1")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("ICOPlatform.UI")] [assembly: System.Reflection.AssemblyTitleAttribute("ICOPlatform.UI")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.1")] [assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")] [assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")] // Generated by the MSBuild WriteCodeFragment class.
44.038462
80
0.674236
[ "MIT" ]
maftooh/ICO-Platform-Client
Src/IOCPlatform/IOCPlatform.UI/obj/Debug/net6.0-windows/ICOPlatform.UI.AssemblyInfo.cs
1,145
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace SolentimTest.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } }
34.419355
151
0.582006
[ "MIT" ]
DegaOne/PathFinding_Demo
SolentimTest/Properties/Settings.Designer.cs
1,069
C#
using System; /* * Copyright 2007 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace iTextSharp.text.pdf.qrcode { /** * <p>See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which * data can be encoded to bits in the QR code standard.</p> * * @author Sean Owen */ public sealed class Mode { // No, we can't use an enum here. J2ME doesn't support it. public static readonly Mode TERMINATOR = new Mode(new int[] { 0, 0, 0 }, 0x00, "TERMINATOR"); // Not really a mode... public static readonly Mode NUMERIC = new Mode(new int[] { 10, 12, 14 }, 0x01, "NUMERIC"); public static readonly Mode ALPHANUMERIC = new Mode(new int[] { 9, 11, 13 }, 0x02, "ALPHANUMERIC"); public static readonly Mode STRUCTURED_APPEND = new Mode(new int[] { 0, 0, 0 }, 0x03, "STRUCTURED_APPEND"); // Not supported public static readonly Mode BYTE = new Mode(new int[] { 8, 16, 16 }, 0x04, "BYTE"); public static readonly Mode ECI = new Mode(null, 0x07, "ECI"); // character counts don't apply public static readonly Mode KANJI = new Mode(new int[] { 8, 10, 12 }, 0x08, "KANJI"); public static readonly Mode FNC1_FIRST_POSITION = new Mode(null, 0x05, "FNC1_FIRST_POSITION"); public static readonly Mode FNC1_SECOND_POSITION = new Mode(null, 0x09, "FNC1_SECOND_POSITION"); private int[] characterCountBitsForVersions; private int bits; private String name; private Mode(int[] characterCountBitsForVersions, int bits, String name) { this.characterCountBitsForVersions = characterCountBitsForVersions; this.bits = bits; this.name = name; } /** * @param bits four bits encoding a QR Code data mode * @return {@link Mode} encoded by these bits * @throws IllegalArgumentException if bits do not correspond to a known mode */ public static Mode ForBits(int bits) { switch (bits) { case 0x0: return TERMINATOR; case 0x1: return NUMERIC; case 0x2: return ALPHANUMERIC; case 0x3: return STRUCTURED_APPEND; case 0x4: return BYTE; case 0x5: return FNC1_FIRST_POSITION; case 0x7: return ECI; case 0x8: return KANJI; case 0x9: return FNC1_SECOND_POSITION; default: throw new ArgumentException(); } } /** * @param version version in question * @return number of bits used, in this QR Code symbol {@link Version}, to encode the * count of characters that will follow encoded in this {@link Mode} */ public int GetCharacterCountBits(Version version) { if (characterCountBitsForVersions == null) { throw new ArgumentException("Character count doesn't apply to this mode"); } int number = version.GetVersionNumber(); int offset; if (number <= 9) { offset = 0; } else if (number <= 26) { offset = 1; } else { offset = 2; } return characterCountBitsForVersions[offset]; } public int GetBits() { return bits; } public String GetName() { return name; } public override String ToString() { return name; } } }
37.267241
132
0.566505
[ "MIT" ]
krolpiotr/PHOENIX.Fakturering
itextsharp-core/iTextSharp/text/pdf/qrcode/Mode.cs
4,323
C#
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using NGitLab.Models; namespace NGitLab.Impl { /// <summary> /// https://docs.gitlab.com/ce/api/groups.html /// </summary> public class GroupsClient : IGroupsClient { private readonly API _api; public const string Url = "/groups"; public GroupsClient(API api) { _api = api; } public IEnumerable<Group> Accessible => _api.Get().GetAll<Group>(Utils.AddOrderBy(Url)); public IEnumerable<Group> Get(GroupQuery query) { var url = CreateGetUrl(query); return _api.Get().GetAll<Group>(url); } public GitLabCollectionResponse<Group> GetAsync(GroupQuery query) { var url = CreateGetUrl(query); return _api.Get().GetAllAsync<Group>(url); } private static string CreateGetUrl(GroupQuery query) { var url = Group.Url; if (query.SkipGroups != null && query.SkipGroups.Any()) { foreach (var skipGroup in query.SkipGroups) { url = Utils.AddParameter(url, "skip_groups[]", skipGroup); } } if (query.AllAvailable != null) { url = Utils.AddParameter(url, "all_available", query.AllAvailable); } if (!string.IsNullOrEmpty(query.Search)) { url = Utils.AddParameter(url, "search", query.Search); } url = Utils.AddOrderBy(url, query.OrderBy); if (query.Sort != null) { url = Utils.AddParameter(url, "sort", query.Sort); } if (query.Statistics != null) { url = Utils.AddParameter(url, "statistics", query.Statistics); } if (query.WithCustomAttributes != null) { url = Utils.AddParameter(url, "with_custom_attributes", query.WithCustomAttributes); } if (query.Owned != null) { url = Utils.AddParameter(url, "owned", query.Owned); } if (query.MinAccessLevel != null) { url = Utils.AddParameter(url, "min_access_level", (int)query.MinAccessLevel); } return url; } public IEnumerable<Group> Search(string search) { return _api.Get().GetAll<Group>(Utils.AddOrderBy(Url + $"?search={Uri.EscapeDataString(search)}")); } public GitLabCollectionResponse<Group> SearchAsync(string search) { return _api.Get().GetAllAsync<Group>(Utils.AddOrderBy(Url + $"?search={Uri.EscapeDataString(search)}")); } public Group this[int id] => _api.Get().To<Group>(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture))); public Task<Group> GetByIdAsync(int id, CancellationToken cancellationToken = default) { return _api.Get().ToAsync<Group>(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture)), cancellationToken); } public Group this[string fullPath] => _api.Get().To<Group>(Url + "/" + Uri.EscapeDataString(fullPath)); public Task<Group> GetByFullPathAsync(string fullPath, CancellationToken cancellationToken = default) { return _api.Get().ToAsync<Group>(Url + "/" + Uri.EscapeDataString(fullPath), cancellationToken); } public IEnumerable<Project> SearchProjects(int groupId, string search) { var url = Url + "/" + Uri.EscapeDataString(groupId.ToString(CultureInfo.InvariantCulture)) + "/projects"; url = Utils.AddParameter(url, "search", search); url = Utils.AddOrderBy(url); return _api.Get().GetAll<Project>(url); } public Group Create(GroupCreate group) => _api.Post().With(group).To<Group>(Url); public Task<Group> CreateAsync(GroupCreate group, CancellationToken cancellationToken = default) { return _api.Post().With(group).ToAsync<Group>(Url, cancellationToken); } public void Delete(int id) { _api.Delete().Execute(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture))); } public Task DeleteAsync(int id, CancellationToken cancellationToken = default) { return _api.Delete().ExecuteAsync(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture)), cancellationToken); } public Group Update(int id, GroupUpdate groupUpdate) => _api.Put().With(groupUpdate).To<Group>(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture))); public Task<Group> UpdateAsync(int id, GroupUpdate groupUpdate, CancellationToken cancellationToken = default) { return _api.Put().With(groupUpdate).ToAsync<Group>(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture)), cancellationToken); } public void Restore(int id) => _api.Post().Execute(Url + "/" + Uri.EscapeDataString(id.ToString(CultureInfo.InvariantCulture)) + "/restore"); } }
35.933333
180
0.594991
[ "MIT" ]
Maximetinu/NGitLab
NGitLab/Impl/GroupsClient.cs
5,392
C#
//------------------------------------------------------------------------------- // <copyright file="IBindingWhenSyntax.cs" company="Ninject Project Contributors"> // Copyright (c) 2007-2009, Enkari, Ltd. // Copyright (c) 2009-2011 Ninject Project Contributors // Authors: Nate Kohari (nate@enkari.com) // Remo Gloor (remo.gloor@gmail.com) // // Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL). // you may not use this file except in compliance with one of the Licenses. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // or // http://www.microsoft.com/opensource/licenses.mspx // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> //------------------------------------------------------------------------------- namespace Telerik.JustMock.AutoMock.Ninject.Syntax { using System; using Telerik.JustMock.AutoMock.Ninject.Activation; /// <summary> /// Used to define the conditions under which a binding should be used. /// </summary> /// <typeparam name="T">The service being bound.</typeparam> public interface IBindingWhenSyntax<T> : IBindingSyntax { /// <summary> /// Indicates that the binding should be used only for requests that support the specified condition. /// </summary> /// <param name="condition">The condition.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> When(Func<IRequest, bool> condition); /// <summary> /// Indicates that the binding should be used only for injections on the specified type. /// Types that derive from the specified type are considered as valid targets. /// </summary> /// <typeparam name="TParent">The type.</typeparam> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto<TParent>(); /// <summary> /// Indicates that the binding should be used only for injections on the specified type. /// Types that derive from the specified type are considered as valid targets. /// </summary> /// <param name="parent">The type.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto(Type parent); /// <summary> /// Indicates that the binding should be used only for injections on the specified types. /// Types that derive from one of the specified types are considered as valid targets. /// Should match at lease one of the targets. /// </summary> /// <param name="parents">The types to match.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto(params Type[] parents); /// <summary> /// Indicates that the binding should be used only for injections on the specified type. /// The type must match exactly the specified type. Types that derive from the specified type /// will not be considered as valid target. /// </summary> /// <typeparam name="TParent">The type.</typeparam> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenInjectedExactlyInto<TParent>(); /// <summary> /// Indicates that the binding should be used only for injections on the specified type. /// The type must match exactly the specified type. Types that derive from the specified type /// will not be considered as valid target. /// </summary> /// <param name="parent">The type.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenInjectedExactlyInto(Type parent); /// <summary> /// Indicates that the binding should be used only for injections on the specified type. /// The type must match one of the specified types exactly. Types that derive from one of the specified types /// will not be considered as valid target. /// Should match at least one of the specified targets /// </summary> /// <param name="parents">The types.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenInjectedExactlyInto(params Type[] parents); /// <summary> /// Indicates that the binding should be used only when the class being injected has /// an attribute of the specified type. /// </summary> /// <typeparam name="TAttribute">The type of attribute.</typeparam> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenClassHas<TAttribute>() where TAttribute : Attribute; /// <summary> /// Indicates that the binding should be used only when the member being injected has /// an attribute of the specified type. /// </summary> /// <typeparam name="TAttribute">The type of attribute.</typeparam> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenMemberHas<TAttribute>() where TAttribute : Attribute; /// <summary> /// Indicates that the binding should be used only when the target being injected has /// an attribute of the specified type. /// </summary> /// <typeparam name="TAttribute">The type of attribute.</typeparam> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenTargetHas<TAttribute>() where TAttribute : Attribute; /// <summary> /// Indicates that the binding should be used only when the class being injected has /// an attribute of the specified type. /// </summary> /// <param name="attributeType">The type of attribute.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenClassHas(Type attributeType); /// <summary> /// Indicates that the binding should be used only when the member being injected has /// an attribute of the specified type. /// </summary> /// <param name="attributeType">The type of attribute.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenMemberHas(Type attributeType); /// <summary> /// Indicates that the binding should be used only when the target being injected has /// an attribute of the specified type. /// </summary> /// <param name="attributeType">The type of attribute.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenTargetHas(Type attributeType); /// <summary> /// Indicates that the binding should be used only when the service is being requested /// by a service bound with the specified name. /// </summary> /// <param name="name">The name to expect.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenParentNamed(string name); /// <summary> /// Indicates that the binding should be used only when any ancestor is bound with the specified name. /// </summary> /// <param name="name">The name to expect.</param> /// <returns>The fluent syntax.</returns> [Obsolete("Use WhenAnyAncestorNamed(string name)")] IBindingInNamedWithOrOnSyntax<T> WhenAnyAnchestorNamed(string name); /// <summary> /// Indicates that the binding should be used only when any ancestor is bound with the specified name. /// </summary> /// <param name="name">The name to expect.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenAnyAncestorNamed(string name); /// <summary> /// Indicates that the binding should be used only when no ancestor is bound with the specified name. /// </summary> /// <param name="name">The name to expect.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenNoAncestorNamed(string name); /// <summary> /// Indicates that the binding should be used only when any ancestor matches the specified predicate. /// </summary> /// <param name="predicate">The predicate to match.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenAnyAncestorMatches(Predicate<IContext> predicate); /// <summary> /// Indicates that the binding should be used only when no ancestor matches the specified predicate. /// </summary> /// <param name="predicate">The predicate to match.</param> /// <returns>The fluent syntax.</returns> IBindingInNamedWithOrOnSyntax<T> WhenNoAncestorMatches(Predicate<IContext> predicate); } }
49.478723
117
0.639755
[ "Apache-2.0" ]
tailsu/JustMockLite
Telerik.JustMock/AutoMock/Ninject/Syntax/IBindingWhenSyntax.cs
9,302
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("MP.XmlConfigComparer.Core.Unit.Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MP.XmlConfigComparer.Core.Unit.Tests")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("716c508f-05b8-40c4-93f2-3e98a65ca87c")] // 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")]
39.891892
85
0.732385
[ "MIT" ]
jivygroup/XmlConfigComparer
MP.XmlConfigComparer.Core.Unit.Tests/Properties/AssemblyInfo.cs
1,479
C#
// <auto-generated /> using System; using CBEDL; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CBEDL.Migrations { [DbContext(typeof(CBEDbContext))] [Migration("20210630220346_lCSMigration")] partial class lCSMigration { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("ProductVersion", "5.0.7") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("CBEModels.Category", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<int>("Name") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("Name") .IsUnique(); b.ToTable("Categories"); }); modelBuilder.Entity("CBEModels.Competition", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<int>("CategoryId") .HasColumnType("int"); b.Property<string>("CompetitionName") .HasColumnType("nvarchar(max)"); b.Property<DateTime>("EndDate") .HasColumnType("datetime2"); b.Property<DateTime>("StartDate") .HasColumnType("datetime2"); b.Property<string>("TestAuthor") .HasColumnType("nvarchar(max)"); b.Property<string>("TestString") .HasColumnType("nvarchar(max)"); b.Property<int?>("UserCreatedId") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("CategoryId"); b.HasIndex("UserCreatedId"); b.ToTable("Competitions"); }); modelBuilder.Entity("CBEModels.CompetitionStat", b => { b.Property<int>("UserId") .HasColumnType("int"); b.Property<int>("CompetitionId") .HasColumnType("int"); b.Property<double>("Accuracy") .HasColumnType("float"); b.Property<double>("WPM") .HasColumnType("float"); b.Property<int>("rank") .HasColumnType("int"); b.HasKey("UserId", "CompetitionId"); b.HasIndex("CompetitionId"); b.ToTable("CompetitionStats"); }); modelBuilder.Entity("CBEModels.LiveCompStat", b => { b.Property<int>("UserId") .HasColumnType("int"); b.Property<int>("LiveCompetitionId") .HasColumnType("int"); b.Property<int>("Losses") .HasColumnType("int"); b.Property<double>("WLRatio") .HasColumnType("float"); b.Property<int>("Wins") .HasColumnType("int"); b.HasKey("UserId", "LiveCompetitionId"); b.HasIndex("LiveCompetitionId"); b.ToTable("LiveCompStats"); }); modelBuilder.Entity("CBEModels.LiveCompetition", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<string>("Name") .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("LiveCompetitions"); }); modelBuilder.Entity("CBEModels.LiveCompetitionTest", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<int>("CategoryId") .HasColumnType("int"); b.Property<int>("LiveCompetitionId") .HasColumnType("int"); b.Property<string>("TestAuthor") .HasColumnType("nvarchar(max)"); b.Property<string>("TestString") .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.HasIndex("CategoryId"); b.HasIndex("LiveCompetitionId"); b.ToTable("LiveCompetitionTests"); }); modelBuilder.Entity("CBEModels.User", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<string>("Auth0Id") .HasColumnType("nvarchar(450)"); b.Property<int>("Revapoints") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("Auth0Id") .IsUnique() .HasFilter("[Auth0Id] IS NOT NULL"); b.ToTable("Users"); }); modelBuilder.Entity("CBEModels.UserQueue", b => { b.Property<int>("UserId") .HasColumnType("int"); b.Property<int>("LiveCompetitionId") .HasColumnType("int"); b.Property<DateTime>("EnterTime") .HasColumnType("datetime2"); b.HasKey("UserId", "LiveCompetitionId"); b.HasIndex("LiveCompetitionId"); b.ToTable("UserQueues"); }); modelBuilder.Entity("CBEModels.Competition", b => { b.HasOne("CBEModels.Category", "Category") .WithMany() .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CBEModels.User", "User") .WithMany() .HasForeignKey("UserCreatedId"); b.Navigation("Category"); b.Navigation("User"); }); modelBuilder.Entity("CBEModels.CompetitionStat", b => { b.HasOne("CBEModels.Competition", "Competition") .WithMany() .HasForeignKey("CompetitionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CBEModels.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Competition"); b.Navigation("User"); }); modelBuilder.Entity("CBEModels.LiveCompStat", b => { b.HasOne("CBEModels.LiveCompetition", "LiveCompetition") .WithMany() .HasForeignKey("LiveCompetitionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CBEModels.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("LiveCompetition"); b.Navigation("User"); }); modelBuilder.Entity("CBEModels.LiveCompetitionTest", b => { b.HasOne("CBEModels.Category", "Category") .WithMany() .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CBEModels.LiveCompetition", "LiveCompetition") .WithMany("LiveCompetitionTests") .HasForeignKey("LiveCompetitionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Category"); b.Navigation("LiveCompetition"); }); modelBuilder.Entity("CBEModels.UserQueue", b => { b.HasOne("CBEModels.LiveCompetition", "LiveCompetition") .WithMany() .HasForeignKey("LiveCompetitionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CBEModels.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("LiveCompetition"); b.Navigation("User"); }); modelBuilder.Entity("CBEModels.LiveCompetition", b => { b.Navigation("LiveCompetitionTests"); }); #pragma warning restore 612, 618 } } }
34.717042
125
0.451051
[ "MIT" ]
210503-Reston-KwikKoder/Back-End-Competitions
CBE/CBEDL/Migrations/20210630220346_lCSMigration.Designer.cs
10,799
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.Azure.Management.DataFactory.Models { using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// <summary> /// A copy activity source for SAP Cloud for Customer source. /// </summary> public partial class SapCloudForCustomerSource : TabularSource { /// <summary> /// Initializes a new instance of the SapCloudForCustomerSource class. /// </summary> public SapCloudForCustomerSource() { CustomInit(); } /// <summary> /// Initializes a new instance of the SapCloudForCustomerSource class. /// </summary> /// <param name="additionalProperties">Unmatched properties from the /// message are deserialized this collection</param> /// <param name="sourceRetryCount">Source retry count. Type: integer /// (or Expression with resultType integer).</param> /// <param name="sourceRetryWait">Source retry wait. Type: string (or /// Expression with resultType string), pattern: /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])).</param> /// <param name="maxConcurrentConnections">The maximum concurrent /// connection count for the source data store. Type: integer (or /// Expression with resultType integer).</param> /// <param name="disableMetricsCollection">If true, disable data store /// metrics collection. Default is false. Type: boolean (or Expression /// with resultType boolean).</param> /// <param name="queryTimeout">Query timeout. Type: string (or /// Expression with resultType string), pattern: /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])).</param> /// <param name="additionalColumns">Specifies the additional columns to /// be added to source data. Type: array of objects(AdditionalColumns) /// (or Expression with resultType array of objects).</param> /// <param name="query">SAP Cloud for Customer OData query. For /// example, "$top=1". Type: string (or Expression with resultType /// string).</param> /// <param name="httpRequestTimeout">The timeout (TimeSpan) to get an /// HTTP response. It is the timeout to get a response, not the timeout /// to read response data. Default value: 00:05:00. Type: string (or /// Expression with resultType string), pattern: /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])).</param> public SapCloudForCustomerSource(IDictionary<string, object> additionalProperties = default(IDictionary<string, object>), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object disableMetricsCollection = default(object), object queryTimeout = default(object), object additionalColumns = default(object), object query = default(object), object httpRequestTimeout = default(object)) : base(additionalProperties, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, disableMetricsCollection, queryTimeout, additionalColumns) { Query = query; HttpRequestTimeout = httpRequestTimeout; CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); /// <summary> /// Gets or sets SAP Cloud for Customer OData query. For example, /// "$top=1". Type: string (or Expression with resultType string). /// </summary> [JsonProperty(PropertyName = "query")] public object Query { get; set; } /// <summary> /// Gets or sets the timeout (TimeSpan) to get an HTTP response. It is /// the timeout to get a response, not the timeout to read response /// data. Default value: 00:05:00. Type: string (or Expression with /// resultType string), pattern: /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). /// </summary> [JsonProperty(PropertyName = "httpRequestTimeout")] public object HttpRequestTimeout { get; set; } } }
49.88172
476
0.637637
[ "MIT" ]
93mishra/azure-sdk-for-net
sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SapCloudForCustomerSource.cs
4,639
C#
using UnityEditor; using System.Reflection; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace NaughtyAttributes.Editor { public static class PropertyUtility { public static T GetAttribute<T>(SerializedProperty property) where T : class { T[] attributes = GetAttributes<T>(property); return (attributes.Length > 0) ? attributes[0] : null; } public static T[] GetAttributes<T>(SerializedProperty property) where T : class { FieldInfo fieldInfo = ReflectionUtility.GetField(GetTargetObjectWithProperty(property), property.name); if (fieldInfo == null) { return new T[] { }; } return (T[])fieldInfo.GetCustomAttributes(typeof(T), true); } public static GUIContent GetLabel(SerializedProperty property) { LabelAttribute labelAttribute = GetAttribute<LabelAttribute>(property); string labelText = (labelAttribute == null) ? property.displayName : labelAttribute.Label; GUIContent label = new GUIContent(labelText); return label; } public static void CallOnValueChangedCallbacks(SerializedProperty property) { OnValueChangedAttribute[] onValueChangedAttributes = GetAttributes<OnValueChangedAttribute>(property); if (onValueChangedAttributes.Length == 0) { return; } object target = GetTargetObjectWithProperty(property); property.serializedObject.ApplyModifiedProperties(); // We must apply modifications so that the new value is updated in the serialized object foreach (var onValueChangedAttribute in onValueChangedAttributes) { MethodInfo callbackMethod = ReflectionUtility.GetMethod(target, onValueChangedAttribute.CallbackName); if (callbackMethod != null && callbackMethod.ReturnType == typeof(void) && callbackMethod.GetParameters().Length == 0) { callbackMethod.Invoke(target, new object[] { }); } else { string warning = string.Format( "{0} can invoke only methods with 'void' return type and 0 parameters", onValueChangedAttribute.GetType().Name); Debug.LogWarning(warning, property.serializedObject.targetObject); } } } public static bool IsEnabled(SerializedProperty property) { ReadOnlyAttribute readOnlyAttribute = GetAttribute<ReadOnlyAttribute>(property); if (readOnlyAttribute != null) { return false; } EnableIfAttributeBase enableIfAttribute = GetAttribute<EnableIfAttributeBase>(property); if (enableIfAttribute == null) { return true; } object target = GetTargetObjectWithProperty(property); // deal with enum conditions if (enableIfAttribute.EnumValue != null) { Enum value = GetEnumValue(target, enableIfAttribute.Conditions[0]); if (value != null) { bool matched = value.GetType().GetCustomAttribute<FlagsAttribute>() == null ? enableIfAttribute.EnumValue.Equals(value) : value.HasFlag(enableIfAttribute.EnumValue); return matched != enableIfAttribute.Inverted; } string message = enableIfAttribute.GetType().Name + " needs a valid enum field, property or method name to work"; Debug.LogWarning(message, property.serializedObject.targetObject); return false; } // deal with normal conditions List<bool> conditionValues = GetConditionValues(target, enableIfAttribute.Conditions); if (conditionValues.Count > 0) { bool enabled = GetConditionsFlag(conditionValues, enableIfAttribute.ConditionOperator, enableIfAttribute.Inverted); return enabled; } else { string message = enableIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; Debug.LogWarning(message, property.serializedObject.targetObject); return false; } } public static bool IsVisible(SerializedProperty property) { ShowIfAttributeBase showIfAttribute = GetAttribute<ShowIfAttributeBase>(property); if (showIfAttribute == null) { return true; } object target = GetTargetObjectWithProperty(property); // deal with enum conditions if (showIfAttribute.EnumValue != null) { Enum value = GetEnumValue(target, showIfAttribute.Conditions[0]); if (value != null) { bool matched = value.GetType().GetCustomAttribute<FlagsAttribute>() == null ? showIfAttribute.EnumValue.Equals(value) : value.HasFlag(showIfAttribute.EnumValue); return matched != showIfAttribute.Inverted; } string message = showIfAttribute.GetType().Name + " needs a valid enum field, property or method name to work"; Debug.LogWarning(message, property.serializedObject.targetObject); return false; } // deal with normal conditions List<bool> conditionValues = GetConditionValues(target, showIfAttribute.Conditions); if (conditionValues.Count > 0) { bool enabled = GetConditionsFlag(conditionValues, showIfAttribute.ConditionOperator, showIfAttribute.Inverted); return enabled; } else { if (target != null) return true; string message = showIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; Debug.LogWarning(message, property.serializedObject.targetObject); return false; } } /// <summary> /// Gets an enum value from reflection. /// </summary> /// <param name="target">The target object.</param> /// <param name="enumName">Name of a field, property, or method that returns an enum.</param> /// <returns>Null if can't find an enum value.</returns> internal static Enum GetEnumValue(object target, string enumName) { FieldInfo enumField = ReflectionUtility.GetField(target, enumName); if (enumField != null && enumField.FieldType.IsSubclassOf(typeof(Enum))) { return (Enum)enumField.GetValue(target); } PropertyInfo enumProperty = ReflectionUtility.GetProperty(target, enumName); if (enumProperty != null && enumProperty.PropertyType.IsSubclassOf(typeof(Enum))) { return (Enum)enumProperty.GetValue(target); } MethodInfo enumMethod = ReflectionUtility.GetMethod(target, enumName); if (enumMethod != null && enumMethod.ReturnType.IsSubclassOf(typeof(Enum))) { return (Enum)enumMethod.Invoke(target, null); } return null; } internal static List<bool> GetConditionValues(object target, string[] conditions) { List<bool> conditionValues = new List<bool>(); foreach (var condition in conditions) { FieldInfo conditionField = ReflectionUtility.GetField(target, condition); if (conditionField != null && conditionField.FieldType == typeof(bool)) { conditionValues.Add((bool)conditionField.GetValue(target)); } PropertyInfo conditionProperty = ReflectionUtility.GetProperty(target, condition); if (conditionProperty != null && conditionProperty.PropertyType == typeof(bool)) { conditionValues.Add((bool)conditionProperty.GetValue(target)); } MethodInfo conditionMethod = ReflectionUtility.GetMethod(target, condition); if (conditionMethod != null && conditionMethod.ReturnType == typeof(bool) && conditionMethod.GetParameters().Length == 0) { conditionValues.Add((bool)conditionMethod.Invoke(target, null)); } } return conditionValues; } internal static bool GetConditionsFlag(List<bool> conditionValues, EConditionOperator conditionOperator, bool invert) { bool flag; if (conditionOperator == EConditionOperator.And) { flag = true; foreach (var value in conditionValues) { flag = flag && value; } } else { flag = false; foreach (var value in conditionValues) { flag = flag || value; } } if (invert) { flag = !flag; } return flag; } public static Type GetPropertyType(SerializedProperty property) { object obj = GetTargetObjectOfProperty(property); Type objType = obj.GetType(); return objType; } /// <summary> /// Gets the object the property represents. /// </summary> /// <param name="property"></param> /// <returns></returns> public static object GetTargetObjectOfProperty(SerializedProperty property) { if (property == null) { return null; } string path = property.propertyPath.Replace(".Array.data[", "["); object obj = property.serializedObject.targetObject; string[] elements = path.Split('.'); foreach (var element in elements) { if (element.Contains("[")) { string elementName = element.Substring(0, element.IndexOf("[")); int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); obj = GetValue_Imp(obj, elementName, index); } else { obj = GetValue_Imp(obj, element); } } return obj; } /// <summary> /// Gets the object that the property is a member of /// </summary> /// <param name="property"></param> /// <returns></returns> public static object GetTargetObjectWithProperty(SerializedProperty property) { string path = property.propertyPath.Replace(".Array.data[", "["); object obj = property.serializedObject.targetObject; string[] elements = path.Split('.'); for (int i = 0; i < elements.Length - 1; i++) { string element = elements[i]; if (element.Contains("[")) { string elementName = element.Substring(0, element.IndexOf("[")); int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); obj = GetValue_Imp(obj, elementName, index); } else { obj = GetValue_Imp(obj, element); } } return obj; } private static object GetValue_Imp(object source, string name) { if (source == null) { return null; } Type type = source.GetType(); while (type != null) { FieldInfo field = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); if (field != null) { return field.GetValue(source); } PropertyInfo property = type.GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); if (property != null) { return property.GetValue(source, null); } type = type.BaseType; } return null; } private static object GetValue_Imp(object source, string name, int index) { IEnumerable enumerable = GetValue_Imp(source, name) as IEnumerable; if (enumerable == null) { return null; } IEnumerator enumerator = enumerable.GetEnumerator(); for (int i = 0; i <= index; i++) { if (!enumerator.MoveNext()) { return null; } } return enumerator.Current; } } }
29.395225
148
0.667389
[ "MIT" ]
omar92/NaughtyAttributes
Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs
11,084
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Ogólne informacje o zestawie są kontrolowane poprzez następujący // zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje // powiązane z zestawem. [assembly: AssemblyTitle("Monolitycznie")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Monolitycznie")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne // dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z // COM, ustaw wartość true dla atrybutu ComVisible tego typu. [assembly: ComVisible(false)] // Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM [assembly: Guid("a98cef33-ef93-4cf8-ab72-28eb8ba4b044")] // Informacje o wersji zestawu zawierają następujące cztery wartości: // // Wersja główna // Wersja pomocnicza // Numer kompilacji // Rewizja // // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki // przy użyciu symbolu „*”, tak jak pokazano poniżej: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
39.702703
124
0.767869
[ "MIT" ]
loginprojects/Gra
GraZaDuzoZaMalo/Monolitycznie/Properties/AssemblyInfo.cs
1,516
C#
namespace FaraMedia.FrontEnd.Administration.GridModels.Miscellaneous { using System.Web.Mvc; using FaraMedia.Data.Schemas.Systematic; using FaraMedia.FrontEnd.Administration.GridModels.Common; using FaraMedia.FrontEnd.Administration.Models.Systematic; using FaraMedia.Web.Framework.Mvc.Extensions; public sealed class NewsletterSubscriptionModelGrid : EntityModelGridBase<NewsletterSubscriptionModel> { public NewsletterSubscriptionModelGrid(HtmlHelper htmlHelper, bool isSelected = true, bool id = true, bool isPublished = true, bool isDeleted = true, bool displayOrder = true, bool createdOn = true, bool lastModifiedOn = true, bool email = true) : base(htmlHelper, isSelected, false, null, id, isPublished, isDeleted, displayOrder, createdOn, lastModifiedOn) { if (email) Column.For(nsm => nsm.Email).Named(htmlHelper.T(NewsletterSubscriptionConstants.Fields.Email.Label)); } } }
60.5
253
0.748967
[ "MIT" ]
m-sadegh-sh/FaraMedia
src/Presentation/FaraMedia.FrontEnd.Administration/GridModels/System/NewsletterSubscriptionModelGrid.cs
968
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Obi { public class ObiRopeSection : ScriptableObject { [HideInInspector] public List<Vector2> vertices; public int snapX = 0; public int snapY = 0; public int Segments{ get{return vertices.Count-1;} } public void OnEnable(){ if (vertices == null){ vertices = new List<Vector2>(); CirclePreset(8); } } public void CirclePreset(int segments){ vertices.Clear(); for (int j = 0; j <= segments; ++j){ float angle = 2 * Mathf.PI / segments * j; vertices.Add(Mathf.Cos(angle)*Vector2.right + Mathf.Sin(angle)*Vector2.up); } } /** * Snaps a float value to the nearest multiple of snapInterval. */ public static int SnapTo(float val, int snapInterval, int threshold){ int intVal = (int) val; if (snapInterval <= 0) return intVal; int under = Mathf.FloorToInt(val / snapInterval) * snapInterval; int over = under + snapInterval; if (intVal - under < threshold) return under; if (over - intVal < threshold) return over; return intVal; } } }
22.12963
80
0.631799
[ "MIT" ]
usernameHed/BackHome
Assets/Obi/Scripts/DataStructures/ObiRopeSection.cs
1,197
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.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NuGet.Services.Metadata.Catalog { public static class Schema { public static class Prefixes { public static readonly string NuGet = "http://schema.nuget.org/schema#"; public static readonly string Catalog = "http://schema.nuget.org/catalog#"; public static readonly string Record = "http://schema.nuget.org/record#"; public static readonly string Xsd = "http://www.w3.org/2001/XMLSchema#"; public static readonly string Rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; } public static class DataTypes { public static readonly Uri CatalogInfastructure = new Uri(Prefixes.Catalog + "CatalogInfastructure"); public static readonly Uri Package = new Uri(Prefixes.NuGet + "Package"); public static readonly Uri PackageRegistration = new Uri(Prefixes.NuGet + "PackageRegistration"); public static readonly Uri PackageDetails = new Uri(Prefixes.NuGet + "PackageDetails"); public static readonly Uri PackageDelete = new Uri(Prefixes.NuGet + "PackageDelete"); public static readonly Uri PackageDependencyGroup = new Uri(Prefixes.NuGet + "PackageDependencyGroup"); public static readonly Uri PackageDependency = new Uri(Prefixes.NuGet + "PackageDependency"); public static readonly Uri NuGetClassicPackage = new Uri(Prefixes.NuGet + "NuGetClassicPackage"); public static readonly Uri PackageEntry = new Uri(Prefixes.NuGet + "PackageEntry"); public static readonly Uri CatalogRoot = new Uri(Prefixes.Catalog + "CatalogRoot"); public static readonly Uri CatalogPage = new Uri(Prefixes.Catalog + "CatalogPage"); public static readonly Uri Permalink = new Uri(Prefixes.Catalog + "Permalink"); public static readonly Uri AppendOnlyCatalog = new Uri(Prefixes.Catalog + "AppendOnlyCatalog"); public static readonly Uri CatalogDelete = new Uri(Prefixes.Catalog + "CatalogDelete"); public static readonly Uri Integer = new Uri(Prefixes.Xsd + "integer"); public static readonly Uri DateTime = new Uri(Prefixes.Xsd + "dateTime"); public static readonly Uri Boolean = new Uri(Prefixes.Xsd + "boolean"); public static readonly Uri Icon = new Uri(Prefixes.NuGet + "Icon"); public static readonly Uri Screenshot = new Uri(Prefixes.NuGet + "Screenshot"); public static readonly Uri ZipArchive = new Uri(Prefixes.NuGet + "ZipArchive"); public static readonly Uri HeroIcon = new Uri(Prefixes.NuGet + "HeroIcon"); public static readonly Uri LargeIcon = new Uri(Prefixes.NuGet + "LargeIcon"); public static readonly Uri MediumIcon = new Uri(Prefixes.NuGet + "MediumIcon"); public static readonly Uri SmallIcon = new Uri(Prefixes.NuGet + "SmallIcon"); public static readonly Uri WideIcon = new Uri(Prefixes.NuGet + "WideIcon"); public static readonly Uri CsmTemplate = new Uri(Prefixes.NuGet + "CsmTemplate"); public static readonly Uri Record = new Uri(Prefixes.Record + "Record"); public static readonly Uri RecordRegistration = new Uri(Prefixes.Record + "Registration"); public static readonly Uri RecordOwner = new Uri(Prefixes.Record + "Owner"); } public static class Predicates { public static readonly Uri Type = new Uri(Prefixes.Rdf + "type"); public static readonly Uri CatalogCommitId = new Uri(Prefixes.Catalog + "commitId"); public static readonly Uri CatalogTimeStamp = new Uri(Prefixes.Catalog + "commitTimeStamp"); public static readonly Uri CatalogItem = new Uri(Prefixes.Catalog + "item"); public static readonly Uri CatalogCount = new Uri(Prefixes.Catalog + "count"); public static readonly Uri CatalogParent = new Uri(Prefixes.Catalog + "parent"); public static readonly Uri GalleryKey = new Uri(Prefixes.Catalog + "galleryKey"); public static readonly Uri GalleryChecksum = new Uri(Prefixes.Catalog + "galleryChecksum"); public static readonly Uri Prefix = new Uri(Prefixes.NuGet + "prefix"); public static readonly Uri Id = new Uri(Prefixes.NuGet + "id"); public static readonly Uri Version = new Uri(Prefixes.NuGet + "version"); public static readonly Uri VerbatimVersion = new Uri(Prefixes.NuGet + "verbatimVersion"); public static readonly Uri OriginalId = new Uri(Prefixes.NuGet + "originalId"); public static readonly Uri Upper = new Uri(Prefixes.NuGet + "upper"); public static readonly Uri Lower = new Uri(Prefixes.NuGet + "lower"); public static readonly Uri CatalogEntry = new Uri(Prefixes.NuGet + "catalogEntry"); public static readonly Uri PackageContent = new Uri(Prefixes.NuGet + "packageContent"); public static readonly Uri PackageEntry = new Uri(Prefixes.NuGet + "packageEntry"); public static readonly Uri FullName = new Uri(Prefixes.NuGet + "fullName"); public static readonly Uri Name = new Uri(Prefixes.NuGet + "name"); public static readonly Uri Length = new Uri(Prefixes.NuGet + "length"); public static readonly Uri CompressedLength = new Uri(Prefixes.NuGet + "compressedLength"); public static readonly Uri FileName = new Uri(Prefixes.Catalog + "fileName"); public static readonly Uri Details = new Uri(Prefixes.Catalog + "details"); public static readonly Uri Domain = new Uri(Prefixes.Record + "domain"); public static readonly Uri RecordDomain = new Uri(Prefixes.Record + "recordDomain"); public static readonly Uri RecordRegistration = new Uri(Prefixes.Record + "recordRegistration"); public static readonly Uri ObjectId = new Uri(Prefixes.Record + "objectId"); public static readonly Uri Visibility = new Uri(Prefixes.NuGet + "visibility"); public static readonly Uri Organization = new Uri(Prefixes.NuGet + "organization"); public static readonly Uri Subscription = new Uri(Prefixes.NuGet + "subscription"); // General-purpose fields public static readonly Uri Author = new Uri(Prefixes.NuGet + "author"); public static readonly Uri Copyright = new Uri(Prefixes.NuGet + "copyright"); public static readonly Uri Created = new Uri(Prefixes.NuGet + "created"); public static readonly Uri Description = new Uri(Prefixes.NuGet + "description"); public static readonly Uri IconUrl = new Uri(Prefixes.NuGet + "iconUrl"); public static readonly Uri Package = new Uri(Prefixes.NuGet + "package"); public static readonly Uri Registration = new Uri(Prefixes.NuGet + "registration"); public static readonly Uri LastCreated = new Uri(Prefixes.NuGet + "lastCreated"); public static readonly Uri LastEdited = new Uri(Prefixes.NuGet + "lastEdited"); public static readonly Uri LastDeleted = new Uri(Prefixes.NuGet + "lastDeleted"); public static readonly Uri Listed = new Uri(Prefixes.NuGet + "listed"); public static readonly Uri Language = new Uri(Prefixes.NuGet + "language"); public static readonly Uri Published = new Uri(Prefixes.NuGet + "published"); public static readonly Uri Publisher = new Uri(Prefixes.NuGet + "publisher"); public static readonly Uri UserName = new Uri(Prefixes.NuGet + "userName"); public static readonly Uri Tenant = new Uri(Prefixes.NuGet + "tenant"); public static readonly Uri UserId = new Uri(Prefixes.NuGet + "userId"); public static readonly Uri TenantId = new Uri(Prefixes.NuGet + "tenantId"); public static readonly Uri PackageHash = new Uri(Prefixes.NuGet + "packageHash"); public static readonly Uri PackageHashAlgorithm = new Uri(Prefixes.NuGet + "packageHashAlgorithm"); public static readonly Uri PackageSize = new Uri(Prefixes.NuGet + "packageSize"); public static readonly Uri ProjectUrl = new Uri(Prefixes.NuGet + "projectUrl"); public static readonly Uri GalleryDetailsUrl = new Uri(Prefixes.NuGet + "galleryDetailsUrl"); public static readonly Uri ReleaseNotes = new Uri(Prefixes.NuGet + "releaseNotes"); public static readonly Uri RequireLicenseAcceptance = new Uri(Prefixes.NuGet + "requireLicenseAcceptance"); public static readonly Uri Summary = new Uri(Prefixes.NuGet + "summary"); public static readonly Uri Title = new Uri(Prefixes.NuGet + "title"); public static readonly Uri LicenseUrl = new Uri(Prefixes.NuGet + "licenseUrl"); public static readonly Uri LicenseNames = new Uri(Prefixes.NuGet + "licenseNames"); public static readonly Uri LicenseReportUrl = new Uri(Prefixes.NuGet + "licenseReportUrl"); public static readonly Uri MinimumClientVersion = new Uri(Prefixes.NuGet + "minimumClientVersion"); public static readonly Uri Tag = new Uri(Prefixes.NuGet + "tag"); public static readonly Uri LicenseName = new Uri(Prefixes.NuGet + "licenseName"); public static readonly Uri SupportedFramework = new Uri(Prefixes.NuGet + "supportedFramework"); public static readonly Uri Owner = new Uri(Prefixes.NuGet + "owner"); public static readonly Uri Namespace = new Uri(Prefixes.NuGet + "namespace"); public static readonly Uri DependencyGroup = new Uri(Prefixes.NuGet + "dependencyGroup"); public static readonly Uri Dependency = new Uri(Prefixes.NuGet + "dependency"); public static readonly Uri Range = new Uri(Prefixes.NuGet + "range"); public static readonly Uri NameIdentifier = new Uri(Prefixes.NuGet + "nameIdentifier"); public static readonly Uri GivenName = new Uri(Prefixes.NuGet + "givenName"); public static readonly Uri Surname = new Uri(Prefixes.NuGet + "surname"); public static readonly Uri Email = new Uri(Prefixes.NuGet + "email"); public static readonly Uri Iss = new Uri(Prefixes.NuGet + "iss"); } } }
68.267516
119
0.671954
[ "Apache-2.0" ]
zhhyu/NuGet.Services.Metadata
src/Catalog/Schema.cs
10,720
C#
using System; using System.IO; using Microsoft.Net.Http.Headers; namespace Quantumart.QP8.WebMvc.Extensions.Helpers { public static class MultipartRequestHelper { // Content-Type: multipart/form-data; boundary="----WebKitFormBoundarymx2fSWqWSd0OxQqq" // The spec says 70 characters is a reasonable limit. public static string GetBoundary(MediaTypeHeaderValue contentType, int lengthLimit) { var boundary = HeaderUtilities.RemoveQuotes(contentType.Boundary); if (string.IsNullOrWhiteSpace(boundary.ToString())) { throw new InvalidDataException("Missing content-type boundary."); } if (boundary.Length > lengthLimit) { throw new InvalidDataException( $"Multipart boundary length limit {lengthLimit} exceeded."); } return boundary.ToString(); } public static bool IsMultipartContentType(string contentType) { return !string.IsNullOrEmpty(contentType) && contentType.IndexOf("multipart/", StringComparison.OrdinalIgnoreCase) >= 0; } public static bool HasFormDataContentDisposition(ContentDispositionHeaderValue contentDisposition) { // Content-Disposition: form-data; name="key"; return contentDisposition != null && contentDisposition.DispositionType.Equals("form-data") && string.IsNullOrEmpty(contentDisposition.FileName.ToString()) && string.IsNullOrEmpty(contentDisposition.FileNameStar.ToString()); } public static bool HasFileContentDisposition(ContentDispositionHeaderValue contentDisposition) { // Content-Disposition: form-data; name="myfile1"; filename="Misc 002.jpg" return contentDisposition != null && contentDisposition.DispositionType.Equals("form-data") && (!string.IsNullOrEmpty(contentDisposition.FileName.ToString()) || !string.IsNullOrEmpty(contentDisposition.FileNameStar.ToString())); } } }
40.849057
106
0.641109
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
QuantumArt/QP
siteMvc/Extensions/Helpers/MultipartRequestHelper.cs
2,165
C#
namespace FortnoxNET.Models.Order { public class EmailInformation { /// <summary> /// Reply to adress. Must be a valid e-mail address /// </summary> public string EmailAddressFrom { get; set; } /// <summary> /// Customer e-mail address /// </summary> public string EmailAddressTo { get; set; } /// <summary> /// Customer e-mail address copy /// </summary> public string EmailAddressCC { get; set; } /// <summary> /// Customer e-mail address blind carbon copy /// </summary> public string EmailAddressBCC { get; set; } /// <summary> /// Subject of e-mail /// </summary> public string EmailSubject { get; set; } /// <summary> /// Body of e-mail. /// </summary> public string EmailBody { get; set; } } }
25.361111
59
0.514786
[ "MIT" ]
sucrose0413/fortnox.NET
Fortnox.NET/Models/Order/EmailInformation.cs
915
C#
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; namespace Sys.Workflow.Engine.Impl.Persistence.Entity.Data.Impl.Cachematcher { /// public class JobsByExecutionIdMatcher : CachedEntityMatcherAdapter<IJobEntity> { public override bool IsRetained(IJobEntity jobEntity, object parameter) { if (jobEntity is null || jobEntity.ExecutionId is null || parameter is null) { return false; } string value; if (parameter is KeyValuePair<string, object> p) { value = p.Value?.ToString(); } else { value = parameter.ToString(); } return jobEntity.ExecutionId.Equals(value, StringComparison.OrdinalIgnoreCase); } } }
32.325581
91
0.639568
[ "Apache-2.0" ]
zhangzihan/nactivity
NActiviti/Sys.Bpm.Engine/Engine/impl/persistence/entity/data/impl/cachematcher/JobsByExecutionIdMatcher.cs
1,392
C#
using System; using System.Threading.Tasks; using RabbitMQ.Client; using RabbitMQ.Client.Events; namespace LinFx.Extensions.RabbitMq { /// <summary> /// 消费者 /// </summary> public interface IRabbitMqConsumer { Task BindAsync(string routingKey); Task UnbindAsync(string routingKey); void OnMessageReceived(Func<IModel, BasicDeliverEventArgs, Task> callback); } }
21.684211
83
0.691748
[ "MIT" ]
ailuozhu/LinFx
src/LinFx/Extensions/RabbitMQ/IRabbitMqConsumer.cs
420
C#
using Microsoft.Extensions.Logging; using RapidCore.DependencyInjection; using RapidCore.Migration; namespace RapidCore.Redis.Migration { public class RedisMigrationContext : IMigrationContext { public ILogger Logger { get; set; } public IRapidContainerAdapter Container { get; set; } public IMigrationEnvironment Environment { get; set; } public IMigrationStorage Storage { get; set; } } }
31.142857
62
0.724771
[ "MIT" ]
rapidcore/rapidcore
src/redis/main/Migration/RedisMigrationContext.cs
438
C#
using Atc.Math.Geometry.CoordinateSystem; using Atc.Structs; using Xunit; namespace Atc.Tests.Math.Geometry.CoordinateSystem { public class CartesianHelperTests { [Theory] [InlineData(0.0, 0.0, 0.0, 0.0)] public void ComputeCoordinateFromPolar(double expectedX, double expectedY, double angle, double radius) { // Act var actual = CartesianHelper.ComputeCoordinateFromPolar(angle, radius); // Assert Assert.Equal(new Point2D(expectedX, expectedY), actual); } [Theory] [InlineData(0.0, 0.0, 0.0, 0.0, 0.0)] public void DistanceBetweenTwoPoints_Point2D(double expected, double x1, double y1, double x2, double y2) { // Arrange Point2D pointA = new Point2D(x1, y1); Point2D pointB = new Point2D(x2, y2); // Act var actual = CartesianHelper.DistanceBetweenTwoPoints(pointA, pointB); // Assert Assert.Equal(expected, actual); } [Theory] [InlineData(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)] public void DistanceBetweenTwoPoints_Point3D(double expected, double x1, double y1, double z1, double x2, double y2, double z2) { // Arrange Point3D pointA = new Point3D(x1, y1, z1); Point3D pointB = new Point3D(x2, y2, z2); // Act var actual = CartesianHelper.DistanceBetweenTwoPoints(pointA, pointB); // Assert Assert.Equal(expected, actual); } [Theory] [InlineData(0.0, 0.0, 0.0, 0.0, 0.0)] public void DistanceBetweenTwoPoints_CartesianCoordinate(double expected, double x1, double y1, double x2, double y2) { // Arrange CartesianCoordinate coordinate1 = new CartesianCoordinate(x1, y1); CartesianCoordinate coordinate2 = new CartesianCoordinate(x2, y2); // Act var actual = CartesianHelper.DistanceBetweenTwoPoints(coordinate1, coordinate2); // Assert Assert.Equal(expected, actual); } [Theory] [InlineData(0.0, 0.0, 0.0, 0.0, 0.0)] public void DistanceBetweenTwoPoints_2(double expected, double x1, double y1, double x2, double y2) { // Act var actual = CartesianHelper.DistanceBetweenTwoPoints(x1, y1, x2, y2); // Assert Assert.Equal(expected, actual); } [Theory] [InlineData(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)] public void DistanceBetweenTwoPoints_3(double expected, double x1, double y1, double z1, double x2, double y2, double z2) { // Act var actual = CartesianHelper.DistanceBetweenTwoPoints(x1, y1, z1, x2, y2, z2); // Assert Assert.Equal(expected, actual); } } }
33.551724
135
0.581021
[ "MIT" ]
atc-net/atc
test/Atc.Tests/Math/Geometry/CoordinateSystem/CartesianHelperTests.cs
2,919
C#
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) // Distributed under the MIT license. See the LICENSE.md file in the project root for more information. using Stride.Core.Assets.Compiler; using Stride.Core.IO; using Stride.Assets.Models; using Stride.Assets.Presentation.Preview.Views; using Stride.Editor.Preview; using Stride.Engine; using Stride.Rendering; namespace Stride.Assets.Presentation.Preview { /// <summary> /// An implementation of the <see cref="AssetPreview"/> that can preview models. /// </summary> [AssetPreview(typeof(ModelAsset), typeof(ModelPreviewView))] public class ModelPreview : PreviewFromEntity<ModelAsset> { /// <inheritdoc/> protected override PreviewEntity CreatePreviewEntity() { UFile modelLocation = AssetItem.Location; // load the created material and the model from the data base var model = LoadAsset<Model>(modelLocation); // create the entity, create and set the model component var entity = new Entity { Name = "Preview Entity of model: " + modelLocation }; entity.Add(new ModelComponent { Model = model }); var previewEntity = new PreviewEntity(entity); previewEntity.Disposed += () => UnloadAsset(model); return previewEntity; } } }
37.342105
118
0.677942
[ "MIT" ]
Aggror/Stride
sources/editor/Stride.Assets.Presentation/Preview/ModelPreview.cs
1,419
C#
// Copyright (c) Aksio Insurtech. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Aksio.Cratis.Types.for_ImplementationsOf; public class OneImplementation : IAmAnInterface { }
29.222222
101
0.798479
[ "MIT" ]
aksio-insurtech/Cratis
Specifications/Fundamentals/Types/for_ImplementationsOf/OneImplementation.cs
263
C#
using UnityEngine; using System.Collections.Generic; //As taken from: http://wiki.unity3d.com/index.php?title=Triangulator /// <summary> /// A simple triangulator class /// As taken from: http://wiki.unity3d.com/index.php?title=Triangulator /// </summary> public class TriangulatorSimple { private List<Vector2> m_points = new List<Vector2>(); public TriangulatorSimple(Vector2[] points) { m_points = new List<Vector2>(points); } public int[] Triangulate() { List<int> indices = new List<int>(); int n = m_points.Count; if (n < 3) return indices.ToArray(); int[] V = new int[n]; if (Area() > 0) { for (int v = 0; v < n; v++) V[v] = v; } else { for (int v = 0; v < n; v++) V[v] = (n - 1) - v; } int nv = n; int count = 2 * nv; for (int m = 0, v = nv - 1; nv > 2;) { if ((count--) <= 0) return indices.ToArray(); int u = v; if (nv <= u) u = 0; v = u + 1; if (nv <= v) v = 0; int w = v + 1; if (nv <= w) w = 0; if (Snip(u, v, w, nv, V)) { int a, b, c, s, t; a = V[u]; b = V[v]; c = V[w]; indices.Add(a); indices.Add(b); indices.Add(c); m++; for (s = v, t = v + 1; t < nv; s++, t++) V[s] = V[t]; nv--; count = 2 * nv; } } indices.Reverse(); return indices.ToArray(); } private float Area() { int n = m_points.Count; float A = 0.0f; for (int p = n - 1, q = 0; q < n; p = q++) { Vector2 pval = m_points[p]; Vector2 qval = m_points[q]; A += pval.x * qval.y - qval.x * pval.y; } return (A * 0.5f); } private bool Snip(int u, int v, int w, int n, int[] V) { int p; Vector2 A = m_points[V[u]]; Vector2 B = m_points[V[v]]; Vector2 C = m_points[V[w]]; if (Mathf.Epsilon > (((B.x - A.x) * (C.y - A.y)) - ((B.y - A.y) * (C.x - A.x)))) return false; for (p = 0; p < n; p++) { if ((p == u) || (p == v) || (p == w)) continue; Vector2 P = m_points[V[p]]; if (InsideTriangle(A, B, C, P)) return false; } return true; } private bool InsideTriangle(Vector2 A, Vector2 B, Vector2 C, Vector2 P) { float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy; float cCROSSap, bCROSScp, aCROSSbp; ax = C.x - B.x; ay = C.y - B.y; bx = A.x - C.x; by = A.y - C.y; cx = B.x - A.x; cy = B.y - A.y; apx = P.x - A.x; apy = P.y - A.y; bpx = P.x - B.x; bpy = P.y - B.y; cpx = P.x - C.x; cpy = P.y - C.y; aCROSSbp = ax * bpy - ay * bpx; cCROSSap = cx * apy - cy * apx; bCROSScp = bx * cpy - by * cpx; return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f)); } }
26.338583
88
0.394021
[ "MIT" ]
annakampvr/PostGISinUnity
PostGISinUnity/Assets/Scripts/TriangulatorSimple.cs
3,347
C#
using Project0.Library.Models; namespace Project0.Library.Interfaces { public interface IUserPrompts { IStoreRepository Store { get; } void WelcomeMessage(); IUser StartupPrompt(IUserInputInterpreter interpreter); IUser RegisterPrompt(IUserInputInterpreter interpreter, out bool exit); void ReturningCustomerPrompt(IUser customer); void EnterStoreLocationPrompt(IUserInputInterpreter interpreter, Customer customer); void StoreEntryPrompt(IUserInputInterpreter interpreter, Customer customer, out bool exit); void AdminPrompt(IUserInputInterpreter interpreter, out bool exit); void OrderHistoryPrompt(IUserInputInterpreter interpreter); void NewStoreLocation(IUserInputInterpreter interpreter); void RestockPrompt(IUserInputInterpreter interpreter); decimal ProductPricePrompt(IUserInputInterpreter interpreter, out bool exit); void NewProductPrompt(IUserInputInterpreter interpreter); void UserLookupPrompt(IUserInputInterpreter interpreter); Customer CustomerEmailEntry(IUserInputInterpreter interpreter); Location LocationEntry(IUserInputInterpreter interpreter); void PrintOrderHistory(); void PrintOrderHistory(Customer customer); void PrintOrderHistory(Location location); void LocationInventoryPrompt(IUserInputInterpreter interpreter, Customer customer, out bool exit); void CheckoutPrompt(Order order); void CartPrompt(IUserInputInterpreter interpreter, Customer customer, out bool checkout); void RemoveProductFromCartPrompt(IUserInputInterpreter interpreter, Customer customer); } }
32.884615
106
0.75848
[ "MIT" ]
2011-nov02-net/matthewg-project0
Project0/Project0.Library/Interfaces/IUserPrompts.cs
1,712
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.Imaging; using Microsoft.VisualStudio.TaskRunnerExplorer; using YarnTaskRunner.Helpers; namespace YarnTaskRunner { [TaskRunnerExport(Constants.FILENAME)] class TaskRunnerProvider : ITaskRunner { private ImageSource _icon; private List<ITaskRunnerOption> _options = null; public TaskRunnerProvider() { _icon = new BitmapImage(new Uri(@"pack://application:,,,/YarnTaskRunner;component/Resources/yarn.png")); } private void InitializeYarnTaskRunnerOptions() { _options = new List<ITaskRunnerOption>(); _options.Add(new TaskRunnerOption("Verbose", PackageIds.cmdVerbose, PackageGuids.guidVSPackageCmdSet, false, "-d")); } public List<ITaskRunnerOption> Options { get { if (_options == null) { InitializeYarnTaskRunnerOptions(); } return _options; } } public async Task<ITaskRunnerConfig> ParseConfig(ITaskRunnerCommandContext context, string configPath) { ITaskRunnerNode hierarchy = LoadHierarchy(configPath); if (!hierarchy.Children.Any() || !hierarchy.Children.First().Children.Any()) return null; return await Task.Run(() => { return new TaskRunnerConfig(context, hierarchy, _icon); }); } private ITaskRunnerNode LoadHierarchy(string configPath) { ITaskRunnerNode root = new TaskRunnerNode(Vsix.Name); var scripts = TaskParser.LoadTasks(configPath); var hierarchy = GetHierarchy(scripts.Keys); var defaults = hierarchy.Where(h => Constants.ALL_DEFAULT_TASKS.Contains(h.Key)); TaskRunnerNode defaultTasks = new TaskRunnerNode("Defaults"); defaultTasks.Description = "Default predefined yarn commands."; root.Children.Add(defaultTasks); AddCommands(configPath, scripts, defaults, defaultTasks); if (hierarchy.Count != defaults.Count()) { var customs = hierarchy.Except(defaults); TaskRunnerNode customTasks = new TaskRunnerNode("Custom"); customTasks.Description = "Custom yarn commands."; root.Children.Add(customTasks); AddCommands(configPath, scripts, customs, customTasks); } return root; } private void AddCommands(string configPath, SortedList<string, string> scripts, IEnumerable<KeyValuePair<string, IEnumerable<string>>> commands, TaskRunnerNode tasks) { string cwd = Path.GetDirectoryName(configPath); foreach (var parent in commands) { TaskRunnerNode parentTask = CreateTask(cwd, parent.Key, scripts[parent.Key]); foreach (var child in parent.Value) { TaskRunnerNode childTask = CreateTask(cwd, child, scripts[child]); parentTask.Children.Add(childTask); } tasks.Children.Add(parentTask); } } private static TaskRunnerNode CreateTask(string cwd, string name, string cmd) { //for some commands --color=always alters the commands meaninf and does not work . Currently using a white list string color = Constants.COLORED_OUTPUT_TASKS.Contains(name) ? " --color=always" : String.Empty; return new TaskRunnerNode(name, !string.IsNullOrEmpty(cmd)) { Command = new TaskRunnerCommand(cwd, "cmd.exe", $"/c {cmd}{color}"), Description = $"Runs the '{name}' command", }; } private SortedList<string, IEnumerable<string>> GetHierarchy(IEnumerable<string> alltasks) { if (alltasks == null || !alltasks.Any()) return null; var events = alltasks.Where(t => t.StartsWith(Constants.PRE_SCRIPT_PREFIX) || t.StartsWith(Constants.POST_SCRIPT_PREFIX)); var parents = alltasks.Except(events).ToList(); var hierarchy = new SortedList<string, IEnumerable<string>>(); foreach (var parent in parents) { var children = GetChildScripts(parent, events).OrderByDescending(child => child); hierarchy.Add(parent, children); events = events.Except(children).ToList(); } foreach (var child in events) { hierarchy.Add(child, Enumerable.Empty<string>()); } return hierarchy; } private static IEnumerable<string> GetChildScripts(string parent, IEnumerable<string> events) { var candidates = events.Where(e => e.EndsWith(parent, StringComparison.OrdinalIgnoreCase)); foreach (var candidate in candidates) { if (candidate.StartsWith(Constants.POST_SCRIPT_PREFIX) && Constants.POST_SCRIPT_PREFIX + parent == candidate) yield return candidate; if (candidate.StartsWith(Constants.PRE_SCRIPT_PREFIX) && Constants.PRE_SCRIPT_PREFIX + parent == candidate) yield return candidate; } } } }
36.136364
174
0.596586
[ "Apache-2.0" ]
MiguelAlho/YarnTaskRunner
src/TaskRunner/TaskRunnerProvider.cs
5,567
C#
using Microsoft.VisualStudio.TestTools.UnitTesting; using bll; namespace unittest { [TestClass] public class UnitTest1 { private readonly Operacao operacao = new Operacao(); [TestMethod] public void TestMethod1() { operacao.Somar(a:1, b:2); operacao.Subtrair(a:1,b:2); operacao.Multiplicar(a:1,b:2); operacao.Dividir(a:1,b:2); } } }
20
60
0.572727
[ "MIT" ]
albertozaranza/lp220172vacation
alberto_zaranza_dotnet/unittest/UnitTest1.cs
440
C#
// Copyright 2019 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. // [START translate_v3_delete_glossary] using Google.Cloud.Translate.V3; using System; namespace GoogleCloudSamples { public static class DeleteGlossary { /// <summary> /// Deletes a Glossary. /// </summary> /// <param name="projectId">Your Google Cloud Project ID.</param> /// <param name="glossaryId">Glossary ID.</param> public static void DeleteGlossarySample(string projectId = "[Google Cloud Project ID]", string glossaryId = "[YOUR_GLOSSARY_ID]") { TranslationServiceClient translationServiceClient = TranslationServiceClient.Create(); DeleteGlossaryRequest request = new DeleteGlossaryRequest { GlossaryName = new GlossaryName(projectId, "us-central1", glossaryId), }; // Poll until the returned long-running operation is complete DeleteGlossaryResponse response = translationServiceClient.DeleteGlossary(request).PollUntilCompleted().Result; Console.WriteLine("Deleted Glossary."); } } // [END translate_v3_delete_glossary] }
38.2
123
0.685864
[ "ECL-2.0", "Apache-2.0" ]
AdrianaDJ/dotnet-docs-samples
translate/api/TranslateV3Samples/DeleteGlossary.cs
1,719
C#
using AdventOfCode.Common; var lines = Resources.GetResourceFileLines("input.txt"); int numOfBits = lines.First().Length; static bool OneIsMostFrequent(IEnumerable<string> numbers, int position) { var numWithOne = numbers.Count(n => n[position] == '1'); var half = (float)numbers.Count() / 2; if (numWithOne == half) { throw new InvalidOperationException("Equal frequencies of 0 and 1"); } return numWithOne > half; } // Part 1 int gammaRate = 0; int epsilonRate = 0; for (int i = 0; i < numOfBits; i++) { if (OneIsMostFrequent(lines, numOfBits - i - 1)) { gammaRate |= 1 << i; } else { epsilonRate |= 1 << i; } } Console.WriteLine($"Part 1: {gammaRate * epsilonRate}"); // Part 2 static string[] FilterByBit(IEnumerable<string> numbers, int position, bool keepWithOne) { return numbers.Where(x => x[position] == (keepWithOne ? '1' : '0')).ToArray(); } int BinToDec(string binary) { int dec = 0; for (int i = 0; i < numOfBits; i++) { dec |= (binary[numOfBits - i - 1] - '0') << i; } return dec; } string FindLifeSupportRating(IEnumerable<string> numbers, bool keepMostCommon, bool keepWithOneWhenEqual) { for (int position = 0; position < numOfBits; position++) { try { bool more1s = OneIsMostFrequent(numbers, position); // More 1s // + most common => keep 1s // + least common => keep 0s // More 0s // + most common => keep 0s // + least common => keep 1s numbers = FilterByBit(numbers, position, keepWithOne: more1s == keepMostCommon); } catch (InvalidOperationException) { numbers = FilterByBit(numbers, position, keepWithOne: keepWithOneWhenEqual); } if (numbers.Count() == 1) { return numbers.Single(); } } return numbers.Single(); } var oxygenRate = BinToDec(FindLifeSupportRating(lines, true, true)); var co2Rate = BinToDec(FindLifeSupportRating(lines, false, false)); Console.WriteLine($"Part 1: {oxygenRate * co2Rate}");
24.460674
105
0.591181
[ "MIT" ]
premun/advent-of-code
src/2021/03/Program.cs
2,179
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { // Start is called before the first frame update static float spaceShipY = -3.5f; [Range (1f, 10f)] [SerializeField] float spaceShipSpeed = 10f; [SerializeField] private float leftBorder = -4f; [SerializeField] private float rightBorder = 4f; private Vector3 sceneMousePosition; private float currentDisplacement; private float lastMousePos = 0f; private float currentHorizontalVelocity { get { return gameObject.GetComponent<Rigidbody2D>().velocity.x; } } void setCurrentPosition(float x) { gameObject.GetComponent<Transform>().position = new Vector2(x, spaceShipY); } // Gets the ship's current position. private float getCurrentPosition { get { return gameObject.transform.position.x; } } void setCurrentVelocity(float x, float y) { gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(x, y); } void Start() { } // Update is called once per frame void Update() { currentDisplacement = spaceShipSpeed / Application.targetFrameRate; sceneMousePosition = Camera.main.ScreenToWorldPoint(new Vector3 (Input.mousePosition.x, Input.mousePosition.y)); //Arrow Keys Movement if (PlayerPrefs.GetInt("Input Option") == 0) { if (Input.GetKeyDown(KeyCode.LeftArrow) && getCurrentPosition > leftBorder) { setCurrentVelocity(spaceShipSpeed * -1, 0); } if (Input.GetKeyDown(KeyCode.RightArrow) && getCurrentPosition < rightBorder) { setCurrentVelocity(spaceShipSpeed, 0); } //Save Code: || getCurrentPosition() >= rightBorder || getCurrentPosition() <= leftBorder if (((Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow)) && !Input.GetKey(KeyCode.LeftArrow) && !Input.GetKey(KeyCode.RightArrow))) { setCurrentVelocity(0, 0); } } //AWSD Movement if (PlayerPrefs.GetInt("Input Option") == 1) { if (Input.GetKeyDown(KeyCode.A) && getCurrentPosition > leftBorder) { setCurrentVelocity(spaceShipSpeed * -1, 0); } if (Input.GetKeyDown(KeyCode.D) && getCurrentPosition < rightBorder) { setCurrentVelocity(spaceShipSpeed, 0); } //Save Code: || getCurrentPosition() >= rightBorder || getCurrentPosition() <= leftBorder if (((Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.D)) && !Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))) { setCurrentVelocity(0, 0); } } //Mouse Movement if (PlayerPrefs.GetInt("Input Option") == 2) { if (sceneMousePosition.x != lastMousePos) { if (sceneMousePosition.x < getCurrentPosition && getCurrentPosition > leftBorder) { setCurrentVelocity(spaceShipSpeed * -1, 0); } if (sceneMousePosition.x > getCurrentPosition && getCurrentPosition < rightBorder) { setCurrentVelocity(spaceShipSpeed, 0); } lastMousePos = sceneMousePosition.x; } if (sceneMousePosition.x + currentDisplacement > getCurrentPosition && sceneMousePosition.x - currentDisplacement < getCurrentPosition) { setCurrentPosition(sceneMousePosition.x); setCurrentVelocity(0, 0); } } //Controller Movement if (PlayerPrefs.GetInt("Input Option") == 3) { if (Input.GetAxis("Horizontal Controller") < -0.5 && getCurrentPosition > leftBorder) { setCurrentVelocity(spaceShipSpeed * -1, 0); } if (Input.GetAxis("Horizontal Controller") > 0.5 && getCurrentPosition < rightBorder) { setCurrentVelocity(spaceShipSpeed, 0); } if (Input.GetAxis("Horizontal Controller") > -0.5 && Input.GetAxis("Horizontal Controller") < 0.5) { setCurrentVelocity(0, 0); } } if (getCurrentPosition >= rightBorder && currentHorizontalVelocity > 0) { setCurrentVelocity(0, 0); } if (getCurrentPosition <= leftBorder && currentHorizontalVelocity < 0) { setCurrentVelocity(0, 0); } } }
37.283465
165
0.574657
[ "MIT" ]
EligerGaming/Asteroids2D
Assets/Scripts/Space Ship/Movement.cs
4,735
C#
using System; using UnityEngine; using UnityEngine.EventSystems; public class YJoyStick_ImgTouch : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler { public event Action<Vector2> OnPointerDownEvent; public event Action<Vector2> OnDragEvent; public event Action<Vector2> OnPointerUpEvent; public void OnPointerDown(PointerEventData eventData) { OnPointerDownEvent?.Invoke(eventData.position); } public void OnDrag(PointerEventData eventData) { OnDragEvent?.Invoke(eventData.position); } public void OnPointerUp(PointerEventData eventData) { OnPointerUpEvent?.Invoke(eventData.position); } }
27.4
101
0.745985
[ "MIT" ]
yscode001/YGame
YGame/Assets/Plugins/YJoyStick/Scripts/YJoyStick_ImgTouch.cs
687
C#
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AWSSDK.DynamoDBv2")] [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - Amazon DynamoDB. Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Amazon Web Services SDK for .NET")] [assembly: AssemblyCompany("Amazon.com, Inc")] [assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // 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("3.3")] [assembly: AssemblyFileVersion("3.5.4.8")]
47.21875
248
0.753144
[ "Apache-2.0" ]
pranavmishra7/awssdks
sdk/code-analysis/ServiceAnalysis/DynamoDBv2/Properties/AssemblyInfo.cs
1,511
C#
// Copyright (c) zhenlei520 All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using System.Diagnostics; using System.Linq; using System.Reflection; namespace EInfrastructure.Core.Tools.Systems { /// <summary> /// 应用程序集扩展类 /// </summary> public static class AssemblyCommon { private static readonly FileVersionInfo AssemblyFileVersion = FileVersionInfo.GetVersionInfo(fileName: Assembly.GetExecutingAssembly().Location); #region 获得Assembly版本号 /// <summary> /// 获得Assembly版本号 /// </summary> /// <returns></returns> public static string GetAssemblyVersion() { return $"{AssemblyFileVersion.FileMajorPart}.{AssemblyFileVersion.FileMinorPart}"; } #endregion #region 获得Assembly产品版权 /// <summary> /// 获得Assembly产品版权 /// </summary> /// <returns></returns> public static string GetAssemblyCopyright() { return AssemblyFileVersion.LegalCopyright; } #endregion #region 得到当前应用的程序集 private static Assembly[] _assemblys; /// <summary> /// 得到当前应用的程序集 /// </summary> /// <returns></returns> public static Assembly[] GetAssemblies() { if (_assemblys == null) { _assemblys = AppDomain.CurrentDomain.GetAssemblies().ToArray(); } return _assemblys; } #endregion #region 根据类型实例化当前类 /// <summary> /// 根据类型实例化当前类 /// </summary> /// <param name="type"></param> /// <param name="noPublic">是否不公开的</param> /// <returns></returns> public static object CreateInstance(this Type type, bool noPublic = false) { return Assembly.GetAssembly(type).CreateInstance(type.ToString(), noPublic); } #endregion #region 获取类型信息 /// <summary> /// 获取类型信息 /// </summary> /// <param name="fullName">完整的类名地址:命名空间.类名</param> /// <param name="package">包名</param> /// <returns></returns> public static Type GetType(string fullName, string package) { Check.True(!string.IsNullOrEmpty(fullName), "fullName is not empty"); Check.True(!string.IsNullOrEmpty(package), "package is not empty"); return Type.GetType($"{fullName},{package}"); } #endregion #region 得到调用者信息 /// <summary> /// 得到调用者信息 /// </summary> /// <returns></returns> public static Type GetReflectedInfo() { MethodBase method = new StackTrace().GetFrame(1).GetMethod(); return method.ReflectedType; } #endregion } }
25.9375
95
0.56179
[ "MIT" ]
Hunfnfmvkvllv26/System.Extension.Core
src/Infrastructure/src/EInfrastructure.Core.Tools/Systems/AssemblyCommon.cs
3,143
C#
using System; namespace T05.DateAfter5Days { class Program { static void Main(string[] args) { int day = int.Parse(Console.ReadLine()); int month = int.Parse(Console.ReadLine()); day += 5; switch (month) { case 2: if (day > 28) { day -= 28; month++; } break; case 4: case 6: case 9: case 11: if (day > 30) { day -= 30; month++; } break; case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (day > 31) { day -= 31; month++; } break; } if (month > 12) { month -= 12; } Console.WriteLine($"{day}.{month:d2}"); } } }
22.66
73
0.281553
[ "MIT" ]
akdimitrov/CSharp-Basics
_CSharpBasics-Book-Nakov-v2019/8.1.ExamPreparation-PartI/T05.DateAfter5Days/Program.cs
1,135
C#
using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; namespace UnityEssentials.Extensions.Editor { /// <summary> /// exemple usage: /// /// Open scene view: /// ExtEditorWindow.OpenEditorWindow(ExtEditorWindow.AllNameAssemblyKnown.SceneView, out Type animationWindowType); /// /// Open animationWindow: /// EditorWindow animationWindowEditor = ExtEditorWindow.OpenEditorWindow(nameEditorWindow, out System.Type animationWindowType); /// /// </summary> public static class ExtEditorWindow { /// <summary> /// Open of focus an editor Window /// if canDuplicate = true, duplicate the window if it existe /// </summary> public static T OpenEditorWindow<T>(bool canDuplicate = false) where T : EditorWindow { T editorWindow; if (canDuplicate) { editorWindow = ScriptableObject.CreateInstance<T>(); editorWindow.Show(); return (editorWindow); } // create a new instance editorWindow = EditorWindow.GetWindow<T>(); // show the window editorWindow.Show(); return (editorWindow); } public static EditorWindow FocusedWindow() { return (EditorWindow.focusedWindow); } public static void CloseEditorWindow<T>() where T : EditorWindow { T raceTrackNavigator = EditorWindow.GetWindow<T>(); raceTrackNavigator.Close(); } /// <summary> /// from a given name, Open an EditorWindow. /// you can also do: /// EditorApplication.ExecuteMenuItem("Window/General/Hierarchy"); /// to open an known EditorWindow /// /// To get the type of a known script, like UnityEditor.SceneHierarchyWindow, you can do also: /// System.Type type = typeof(EditorWindow).Assembly.GetType("UnityEditor.SceneHierarchyWindow"); /// </summary> /// <param name="editorWindowName">name of the editorWindow to open</param> /// <param name="animationWindowType">type of the editorWindow (useful for others functions)</param> /// <returns></returns> public static EditorWindow OpenEditorWindow(AllNameAssemblyKnown editorWindowName, out System.Type animationWindowType) { animationWindowType = GetEditorWindowTypeByName(editorWindowName.ToString()); EditorWindow animatorWindow = EditorWindow.GetWindow(animationWindowType); return (animatorWindow); } #region reflection /// <summary> /// for adding, do a GetAllEditorWindowTypes(true); /// </summary> public enum AllNameAssemblyKnown { BuildPlayerWindow, ConsoleWindow, IconSelector, ObjectSelector, ProjectBrowser, ProjectTemplateWindow, RagdollBuilder, SceneHierarchySortingWindow, SceneHierarchyWindow, ScriptableWizard, AddCurvesPopup, AnimationWindow, CurveEditorWindow, MinMaxCurveEditorWindow, AnnotationWindow, LayerVisibilityWindow, AssetStoreInstaBuyWindow, AssetStoreLoginWindow, AssetStoreWindow, AudioMixerWindow, CollabPublishDialog, CollabCannotPublishDialog, GameView, AboutWindow, AssetSaveDialog, BumpMapSettingsFixingWindow, ColorPicker, EditorUpdateWindow, FallbackEditorWindow, GradientPicker, PackageExport, PackageImport, PopupWindow, PopupWindowWithoutFocus, PragmaFixingWindow, SaveWindowLayout, DeleteWindowLayout, EditorToolWindow, SnapSettings, TreeViewTestWindow, GUIViewDebuggerWindow, InspectorWindow, PreviewWindow, AddShaderVariantWindow, AddComponentWindow, AdvancedDropdownWindow, LookDevView, AttachToPlayerPlayerIPWindow, HolographicEmulationWindow, FrameDebuggerWindow, SearchableEditorWindow, LightingExplorerWindow, LightingWindow, LightmapPreviewWindow, NavMeshEditorWindow, OcclusionCullingWindow, PhysicsDebugWindow, TierSettingsWindow, SceneView, SettingsWindow, ProjectSettingsWindow, PreferenceSettingsWindow, PackerWindow, SpriteUtilityWindow, TroubleshooterWindow, UIElementsEditorWindowCreator, UndoWindow, UnityConnectConsentView, UnityConnectEditorWindow, MetroCertificatePasswordWindow, MetroCreateTestCertificateWindow, WindowChange, WindowCheckoutFailure, WindowPending, WindowResolve, WindowRevert, WebViewEditorStaticWindow, WebViewEditorWindow, WebViewEditorWindowTabs, SearchWindow, LicenseManagementWindow, PackageManagerWindow, ParticleSystemWindow, PresetSelector, ProfilerWindow, UISystemPreviewWindow, ConflictResolverWindow, DeleteShortcutProfileWindow, PromptWindow, ShortcutManagerWindow, SketchUpImportDlg, TerrainWizard, ImportRawHeightmap, ExportRawHeightmap, TreeWizard, DetailMeshWizard, DetailTextureWizard, PlaceTreeWizard, FlattenHeightmap, TestEditorWindow, PanelDebugger, UIElementsDebugger, PainterSwitcherWindow, AllocatorDebugger, UIRDebugger, UIElementsSamples, AnimatorControllerTool, LayerSettingsWindow, ParameterControllerEditor, AddStateMachineBehaviourComponentWindow, AndroidKeystoreWindow, TimelineWindow, TMP_ProjectConversionUtility, TMP_SpriteAssetImporter, TMPro_FontAssetCreatorWindow, CollabHistoryWindow, CollabToolbarWindow, TestRunnerWindow, TMP_PackageResourceImporterWindow, ConsoleE_Window, } public static System.Type GetEditorWindowTypeByName(string editorToFind, bool showDebug = false) { var result = new System.Collections.Generic.List<System.Type>(); System.Reflection.Assembly[] AS = System.AppDomain.CurrentDomain.GetAssemblies(); System.Type editorWindow = typeof(EditorWindow); foreach (var A in AS) { System.Type[] types = A.GetTypes(); foreach (var T in types) { if (T.IsSubclassOf(editorWindow)) { if (showDebug) { Debug.Log(T.Name); } if (T.Name.Equals(editorToFind)) { return (T); } } } } return (null); } #endregion } }
33.63913
133
0.565982
[ "MIT" ]
usernameHed/Philae-Lander
Assets/Plugins/Unity Essentials - Extensions/Editor/ExtEditorWindow.cs
7,739
C#
using System.Web; using System.Web.Optimization; namespace Mediator.Net.Sample.Web { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); // Use the development version of Modernizr to develop with and learn from. Then, when you're // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css")); } } }
38.689655
112
0.580214
[ "Apache-2.0" ]
JiaZhenLin/Mediator.Net
src/Mediator.Net.Sample.Web/App_Start/BundleConfig.cs
1,124
C#
// *********************************************************************** // Assembly : PureActive.Core // Author : SteveBu // Created : 11-02-2018 // License : Licensed under MIT License, see https://github.com/PureActive/PureActive/blob/master/LICENSE // // Last Modified By : SteveBu // Last Modified On : 11-02-2018 // *********************************************************************** // <copyright file="BaseClassJsonConverter.cs" company="BushChang Corporation"> // © 2018 BushChang Corporation. All rights reserved. // </copyright> // <summary></summary> // *********************************************************************** using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace PureActive.Core.Serialization { /// <summary> /// A converter that reads and writes a custom type. /// Implements the <see cref="JsonConverter" /> /// </summary> /// <seealso cref="JsonConverter" /> public class BaseClassJsonConverter : JsonConverter { /// <summary> /// The type property name. /// </summary> private const string TypePropertyName = "type"; /// <summary> /// Whether or not to bypass this converter on the next read or write. /// This is an unfortunate hack that is necessary to work around the /// infinite recursion caused by JSON.NET when attempting to convert /// to and from JObjects with the same converter. /// </summary> [ThreadStatic] private static bool _bypassOnNextOperation; /// <summary> /// The base class type. /// </summary> private readonly Type _baseClassType; /// <summary> /// The mapping from type value to object type. /// </summary> private readonly IReadOnlyDictionary<string, Type> _typeMap; /// <summary> /// Constructor. /// </summary> /// <param name="baseClassType">The base class type.</param> /// <param name="typeMap">The map from type string to subclass type.</param> public BaseClassJsonConverter(Type baseClassType, IReadOnlyDictionary<string, Type> typeMap) { _baseClassType = baseClassType; _typeMap = typeMap; } /// <summary> /// Returns whether or not this converter should be used for reading. /// </summary> /// <value><c>true</c> if this <see cref="T:Newtonsoft.Json.JsonConverter" /> can read JSON; otherwise, <c>false</c>.</value> public override bool CanRead { get { if (_bypassOnNextOperation) { _bypassOnNextOperation = false; return false; } return true; } } /// <summary> /// Returns whether or not this converter should be used for writing. /// </summary> /// <value><c>true</c> if this <see cref="T:Newtonsoft.Json.JsonConverter" /> can write JSON; otherwise, <c>false</c>.</value> public override bool CanWrite { get { if (_bypassOnNextOperation) { _bypassOnNextOperation = false; return false; } return true; } } /// <summary> /// Returns whether or not this converter can be used for the given type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns><c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.</returns> public override bool CanConvert(Type objectType) { return _baseClassType == objectType || objectType.GetTypeInfo().IsSubclassOf(_baseClassType); } /// <summary> /// Reads the json value. /// </summary> /// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader" /> to read from.</param> /// <param name="objectType">Type of the object.</param> /// <param name="existingValue">The existing value of object being read.</param> /// <param name="serializer">The calling serializer.</param> /// <returns>The object value.</returns> /// <exception cref="InvalidOperationException"> /// Object does not have required type property. /// or /// Object has unknown type. /// </exception> public override object ReadJson( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) return null; var obj = JObject.Load(reader); var type = (string) obj[TypePropertyName]; if (string.IsNullOrEmpty(type)) throw new InvalidOperationException("Object does not have required type property."); if (!_typeMap.ContainsKey(type)) throw new InvalidOperationException("Object has unknown type."); try { _bypassOnNextOperation = true; return obj.ToObject(_typeMap[type], serializer); } finally { _bypassOnNextOperation = false; } } /// <summary> /// Writes the json value. /// </summary> /// <param name="writer">The writer.</param> /// <param name="value">The value.</param> /// <param name="serializer">The serializer.</param> /// <exception cref="InvalidOperationException">The object type is not registered in the type map.</exception> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { JObject obj; try { _bypassOnNextOperation = true; obj = JObject.FromObject(value, serializer); } finally { _bypassOnNextOperation = false; } var type = _typeMap .Where(kvp => kvp.Value == value.GetType()) .Select(kvp => kvp.Key) .FirstOrDefault(); if (type == null) throw new InvalidOperationException("The object type is not registered in the type map."); obj.AddFirst(new JProperty(TypePropertyName, type)); obj.WriteTo(writer); } } }
35.787234
134
0.539685
[ "MIT" ]
JXQJ/PureActive
src/PureActive.Core/Serialization/BaseClassJsonConverter.cs
6,731
C#
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; namespace SimplePaletteQuantizer.Quantizers.Octree { internal class OctreeNode { #region | Fields | private static readonly Byte[] Mask = new Byte[] { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; private Int32 red; private Int32 green; private Int32 blue; private Int32 pixelCount; private Int32 paletteIndex; private readonly OctreeNode[] nodes; #endregion #region | Constructors | /// <summary> /// Initializes a new instance of the <see cref="OctreeNode"/> class. /// </summary> public OctreeNode(Int32 level, OctreeQuantizer parent) { nodes = new OctreeNode[8]; if (level < 7) { parent.AddLevelNode(level, this); } } #endregion #region | Calculated properties | /// <summary> /// Gets a value indicating whether this node is a leaf. /// </summary> /// <value><c>true</c> if this node is a leaf; otherwise, <c>false</c>.</value> public Boolean IsLeaf { get { return pixelCount > 0; } } /// <summary> /// Gets the averaged leaf color. /// </summary> /// <value>The leaf color.</value> public Color Color { get { Color result; // determines a color of the leaf if (IsLeaf) { result = pixelCount == 1 ? Color.FromArgb(255, red, green, blue) : Color.FromArgb(255, red/pixelCount, green/pixelCount, blue/pixelCount); } else { throw new InvalidOperationException("Cannot retrieve a color for other node than leaf."); } return result; } } /// <summary> /// Gets the active nodes pixel count. /// </summary> /// <value>The active nodes pixel count.</value> public Int32 ActiveNodesPixelCount { get { Int32 result = pixelCount; // sums up all the pixel presence for all the active nodes for (Int32 index = 0; index < 8; index++) { OctreeNode node = nodes[index]; if (node != null) { result += node.pixelCount; } } return result; } } /// <summary> /// Enumerates only the leaf nodes. /// </summary> /// <value>The enumerated leaf nodes.</value> public IEnumerable<OctreeNode> ActiveNodes { get { List<OctreeNode> result = new List<OctreeNode>(); // adds all the active sub-nodes to a list for (Int32 index = 0; index < 8; index++) { OctreeNode node = nodes[index]; if (node != null) { if (node.IsLeaf) { result.Add(node); } else { result.AddRange(node.ActiveNodes); } } } return result; } } #endregion #region | Methods | /// <summary> /// Adds the color. /// </summary> /// <param name="color">The color.</param> /// <param name="level">The level.</param> /// <param name="parent">The parent.</param> public void AddColor(Color color, Int32 level, OctreeQuantizer parent) { // if this node is a leaf, then increase a color amount, and pixel presence if (level == 8) { red += color.R; green += color.G; blue += color.B; pixelCount++; } else if (level < 8) // otherwise goes one level deeper { // calculates an index for the next sub-branch Int32 index = GetColorIndexAtLevel(color, level); // if that branch doesn't exist, grows it if (nodes[index] == null) { nodes[index] = new OctreeNode(level, parent); } // adds a color to that branch nodes[index].AddColor(color, level + 1, parent); } } /// <summary> /// Gets the index of the palette. /// </summary> /// <param name="color">The color.</param> /// <param name="level">The level.</param> /// <returns></returns> public Int32 GetPaletteIndex(Color color, Int32 level) { Int32 result; // if a node is leaf, then we've found are best match already if (IsLeaf) { result = paletteIndex; } else // otherwise continue in to the lower depths { Int32 index = GetColorIndexAtLevel(color, level); result = nodes[index] != null ? nodes[index].GetPaletteIndex(color, level + 1) : nodes. Where(node => node != null). First(). GetPaletteIndex(color, level + 1); } return result; } /// <summary> /// Removes the leaves by summing all it's color components and pixel presence. /// </summary> /// <returns></returns> public Int32 RemoveLeaves(Int32 level, Int32 activeColorCount, Int32 targetColorCount, OctreeQuantizer parent) { Int32 result = 0; // scans thru all the active nodes for (Int32 index = 0; index < 8; index++) { OctreeNode node = nodes[index]; if (node != null) { // sums up their color components red += node.red; green += node.green; blue += node.blue; // and pixel presence pixelCount += node.pixelCount; // increases the count of reduced nodes result++; } } // returns a number of reduced sub-nodes, minus one because this node becomes a leaf return result - 1; } #endregion #region | Helper methods | /// <summary> /// Calculates the color component bit (level) index. /// </summary> /// <param name="color">The color for which the index will be calculated.</param> /// <param name="level">The bit index to be used for index calculation.</param> /// <returns>The color index at a certain depth level.</returns> private static Int32 GetColorIndexAtLevel(Color color, Int32 level) { return ((color.R & Mask[level]) == Mask[level] ? 4 : 0) | ((color.G & Mask[level]) == Mask[level] ? 2 : 0) | ((color.B & Mask[level]) == Mask[level] ? 1 : 0); } /// <summary> /// Sets a palette index to this node. /// </summary> /// <param name="index">The palette index.</param> internal void SetPaletteIndex(Int32 index) { paletteIndex = index; } #endregion } }
30.215385
118
0.46054
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
Blayer98/FreeSO
Other/libs/ColorQuantizer/SimplePaletteQuantizer/Quantizers/Octree/OctreeNode.cs
7,858
C#
namespace MC_Debug_Monitor.Controls { partial class ScoreboardMonitor { /// <summary> /// 必要なデザイナー変数です。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 使用中のリソースをすべてクリーンアップします。 /// </summary> /// <param name="disposing">マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region コンポーネント デザイナーで生成されたコード /// <summary> /// デザイナー サポートに必要なメソッドです。このメソッドの内容を /// コード エディターで変更しないでください。 /// </summary> private void InitializeComponent() { this.scoreboardGroup = new System.Windows.Forms.GroupBox(); this.controlGroup = new System.Windows.Forms.GroupBox(); this.updateButton = new System.Windows.Forms.Button(); this.exportButton = new System.Windows.Forms.Button(); this.autoUpdateGroup = new System.Windows.Forms.GroupBox(); this.autoUpdateIntervalBox = new System.Windows.Forms.NumericUpDown(); this.useAutoUpdate = new System.Windows.Forms.CheckBox(); this.label3 = new System.Windows.Forms.Label(); this.filterGroupBox = new System.Windows.Forms.GroupBox(); this.plyComboBox = new System.Windows.Forms.ComboBox(); this.objComboBox = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.scoreboardView = new System.Windows.Forms.DataGridView(); this.scoreboardGroup.SuspendLayout(); this.controlGroup.SuspendLayout(); this.autoUpdateGroup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.autoUpdateIntervalBox)).BeginInit(); this.filterGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.scoreboardView)).BeginInit(); this.SuspendLayout(); // // scoreboardGroup // this.scoreboardGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.scoreboardGroup.BackColor = System.Drawing.Color.Transparent; this.scoreboardGroup.Controls.Add(this.controlGroup); this.scoreboardGroup.Controls.Add(this.autoUpdateGroup); this.scoreboardGroup.Controls.Add(this.filterGroupBox); this.scoreboardGroup.Controls.Add(this.scoreboardView); this.scoreboardGroup.Location = new System.Drawing.Point(0, 0); this.scoreboardGroup.Name = "scoreboardGroup"; this.scoreboardGroup.Size = new System.Drawing.Size(550, 330); this.scoreboardGroup.TabIndex = 0; this.scoreboardGroup.TabStop = false; this.scoreboardGroup.Text = "スコアボード"; // // controlGroup // this.controlGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.controlGroup.Controls.Add(this.updateButton); this.controlGroup.Controls.Add(this.exportButton); this.controlGroup.Location = new System.Drawing.Point(403, 234); this.controlGroup.Name = "controlGroup"; this.controlGroup.Size = new System.Drawing.Size(141, 90); this.controlGroup.TabIndex = 3; this.controlGroup.TabStop = false; this.controlGroup.Text = "操作"; // // updateButton // this.updateButton.Location = new System.Drawing.Point(6, 52); this.updateButton.Name = "updateButton"; this.updateButton.Size = new System.Drawing.Size(129, 23); this.updateButton.TabIndex = 0; this.updateButton.Text = "更新"; this.updateButton.UseVisualStyleBackColor = true; this.updateButton.Click += new System.EventHandler(this.updateButton_Click); // // exportButton // this.exportButton.Location = new System.Drawing.Point(6, 23); this.exportButton.Name = "exportButton"; this.exportButton.Size = new System.Drawing.Size(129, 23); this.exportButton.TabIndex = 0; this.exportButton.Text = "エクスポート"; this.exportButton.UseVisualStyleBackColor = true; this.exportButton.Click += new System.EventHandler(this.exportButton_Click); // // autoUpdateGroup // this.autoUpdateGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.autoUpdateGroup.Controls.Add(this.autoUpdateIntervalBox); this.autoUpdateGroup.Controls.Add(this.useAutoUpdate); this.autoUpdateGroup.Controls.Add(this.label3); this.autoUpdateGroup.Location = new System.Drawing.Point(403, 151); this.autoUpdateGroup.Name = "autoUpdateGroup"; this.autoUpdateGroup.Size = new System.Drawing.Size(141, 77); this.autoUpdateGroup.TabIndex = 2; this.autoUpdateGroup.TabStop = false; this.autoUpdateGroup.Text = "自動更新"; // // autoUpdateIntervalBox // this.autoUpdateIntervalBox.Location = new System.Drawing.Point(66, 43); this.autoUpdateIntervalBox.Maximum = new decimal(new int[] { 100000, 0, 0, 0}); this.autoUpdateIntervalBox.Minimum = new decimal(new int[] { 100, 0, 0, 0}); this.autoUpdateIntervalBox.Name = "autoUpdateIntervalBox"; this.autoUpdateIntervalBox.Size = new System.Drawing.Size(69, 23); this.autoUpdateIntervalBox.TabIndex = 2; this.autoUpdateIntervalBox.Value = new decimal(new int[] { 100, 0, 0, 0}); this.autoUpdateIntervalBox.ValueChanged += new System.EventHandler(this.autoUpdateIntervalBox_ValueChanged); // // useAutoUpdate // this.useAutoUpdate.AutoSize = true; this.useAutoUpdate.Location = new System.Drawing.Point(6, 23); this.useAutoUpdate.Name = "useAutoUpdate"; this.useAutoUpdate.Size = new System.Drawing.Size(69, 19); this.useAutoUpdate.TabIndex = 1; this.useAutoUpdate.Text = "使用する"; this.useAutoUpdate.UseVisualStyleBackColor = true; this.useAutoUpdate.CheckedChanged += new System.EventHandler(this.useAutoUpdate_CheckedChanged); // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(6, 45); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(54, 15); this.label3.TabIndex = 0; this.label3.Text = "間隔(ms)"; // // filterGroupBox // this.filterGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.filterGroupBox.Controls.Add(this.plyComboBox); this.filterGroupBox.Controls.Add(this.objComboBox); this.filterGroupBox.Controls.Add(this.label2); this.filterGroupBox.Controls.Add(this.label1); this.filterGroupBox.Location = new System.Drawing.Point(403, 23); this.filterGroupBox.Name = "filterGroupBox"; this.filterGroupBox.Size = new System.Drawing.Size(141, 122); this.filterGroupBox.TabIndex = 1; this.filterGroupBox.TabStop = false; this.filterGroupBox.Text = "フィルタ"; this.filterGroupBox.Enter += new System.EventHandler(this.filterGroupBox_Enter); // // plyComboBox // this.plyComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.plyComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.plyComboBox.FormattingEnabled = true; this.plyComboBox.Location = new System.Drawing.Point(14, 82); this.plyComboBox.Name = "plyComboBox"; this.plyComboBox.Size = new System.Drawing.Size(121, 23); this.plyComboBox.TabIndex = 3; this.plyComboBox.DataSourceChanged += new System.EventHandler(this.plyComboBox_DataSourceChanged); this.plyComboBox.TextChanged += new System.EventHandler(this.plyComboBox_TextChanged); this.plyComboBox.Leave += new System.EventHandler(this.plyComboBox_Leave); // // objComboBox // this.objComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.objComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.objComboBox.FormattingEnabled = true; this.objComboBox.Location = new System.Drawing.Point(14, 38); this.objComboBox.Name = "objComboBox"; this.objComboBox.Size = new System.Drawing.Size(121, 23); this.objComboBox.TabIndex = 2; this.objComboBox.DataSourceChanged += new System.EventHandler(this.objComboBox_DataSourceChanged); this.objComboBox.TextChanged += new System.EventHandler(this.objComboBox_TextChanged); this.objComboBox.Leave += new System.EventHandler(this.objComboBox_Leave); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 64); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(39, 15); this.label2.TabIndex = 1; this.label2.Text = "Player"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 19); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(57, 15); this.label1.TabIndex = 0; this.label1.Text = "Objective"; // // scoreboardView // this.scoreboardView.AllowUserToAddRows = false; this.scoreboardView.AllowUserToDeleteRows = false; this.scoreboardView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.scoreboardView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.scoreboardView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; this.scoreboardView.BorderStyle = System.Windows.Forms.BorderStyle.None; this.scoreboardView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; this.scoreboardView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.scoreboardView.Location = new System.Drawing.Point(7, 23); this.scoreboardView.Name = "scoreboardView"; this.scoreboardView.ReadOnly = true; this.scoreboardView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; this.scoreboardView.RowHeadersVisible = false; this.scoreboardView.Size = new System.Drawing.Size(390, 301); this.scoreboardView.TabIndex = 0; this.scoreboardView.Text = "dataGridView1"; this.scoreboardView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.scoreboardView_CellContentClick); // // ScoreboardMonitor // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.scoreboardGroup); this.Name = "ScoreboardMonitor"; this.Size = new System.Drawing.Size(550, 330); this.Load += new System.EventHandler(this.ScoreboardMonitor_Load); this.scoreboardGroup.ResumeLayout(false); this.controlGroup.ResumeLayout(false); this.autoUpdateGroup.ResumeLayout(false); this.autoUpdateGroup.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.autoUpdateIntervalBox)).EndInit(); this.filterGroupBox.ResumeLayout(false); this.filterGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.scoreboardView)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.GroupBox scoreboardGroup; private System.Windows.Forms.GroupBox controlGroup; private System.Windows.Forms.GroupBox autoUpdateGroup; private System.Windows.Forms.Label label3; private System.Windows.Forms.GroupBox filterGroupBox; private System.Windows.Forms.ComboBox plyComboBox; private System.Windows.Forms.ComboBox objComboBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.DataGridView scoreboardView; private System.Windows.Forms.Button updateButton; private System.Windows.Forms.Button exportButton; private System.Windows.Forms.NumericUpDown autoUpdateIntervalBox; private System.Windows.Forms.CheckBox useAutoUpdate; } }
52.146953
166
0.630353
[ "MIT" ]
kemo14331/MC-Debug-Monitor
MC Debug Monitor/Controls/ScoreboardMonitor.Designer.cs
14,897
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using Microsoft.Omex.System.Logging; namespace Microsoft.Omex.System.TimedScopes { /// <summary> /// Extensions for TimedScopeResult enum /// </summary> public static class TimedScopeResultExtensions { /// <summary> /// Decides whether the result is success /// </summary> /// <param name="result">The result</param> /// <returns>Success flag (null if we don't know)</returns> public static bool? IsSuccessful(this TimedScopeResult result) { switch (result) { case default(TimedScopeResult): return null; case TimedScopeResult.Success: return true; case TimedScopeResult.ExpectedError: case TimedScopeResult.SystemError: return false; default: ULSLogging.LogTraceTag(0x23817701 /* tag_96x2b */, Categories.TimingGeneral, Levels.Error, "IsSuccessful status unknown for timed scope result {0}", result); return false; } } /// <summary> /// Decides whether we should replay events for scopes with given result /// </summary> /// <param name="result">The result</param> /// <returns>true if we should replay events for this result; false otherwise</returns> public static bool ShouldReplayEvents(this TimedScopeResult result) { switch (result) { case TimedScopeResult.SystemError: return true; default: return false; } } } }
25.803571
162
0.696194
[ "MIT" ]
dan-hanlon/Omex
src/System/TimedScopes/TimedScopeResultExtensions.cs
1,447
C#
// Copyright © 2018, Meta Company. All rights reserved. // // Redistribution and use of this software (the "Software") in binary form, without modification, is // permitted provided that the following conditions are met: // // 1. Redistributions of the unmodified Software 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. // 2. The name of Meta Company (“Meta”) may not be used to endorse or promote products derived // from this Software without specific prior written permission from Meta. // 3. LIMITATION TO META PLATFORM: Use of the Software is limited to use on or in connection // with Meta-branded devices or Meta-branded software development kits. For example, a bona // fide recipient of the Software may incorporate an unmodified binary version of the // Software into an application limited to use on or in connection with a Meta-branded // device, while he or she may not incorporate an unmodified binary version of the Software // into an application designed or offered for use on a non-Meta-branded device. // // For the sake of clarity, the Software may not be redistributed under any circumstances in source // code form, or in the form of modified binary code – and nothing in this License shall be construed // to permit such redistribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 META COMPANY 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 UnityEngine; namespace Meta.Utility { public class ToggleMaterialColor : MonoBehaviour { public string PropertyName = "_Color"; private float _interpAmount; private float _targetInterpAmount; private float _interpAmountVelocity; private Material _material; [ColorUsage(false, true, 0f, 5f, 0f, 5f)] public Color Active = new Color(1f, 2f, 3f); [ColorUsage(false, true, 0f, 5f, 0f, 5f)] public Color Idle = new Color(0.75f, 0.75f, 0.75f); void Awake() { _material = Instantiate(GetComponent<Renderer>().material); GetComponent<Renderer>().material = _material; } void Update() { _interpAmount = Mathf.SmoothDamp(_interpAmount, _targetInterpAmount, ref _interpAmountVelocity, .2f); _material.SetColor(PropertyName, Color.Lerp(Idle, Active, _interpAmount)); } public void ToggleColor(bool active) { _targetInterpAmount = active ? 1f : 0f; } } }
49.686567
113
0.700811
[ "MIT" ]
JDZ-3/MXRManipulation
Assets/MetaSDK/Meta/Hands/HandInput/Scripts/Utility/ToggleMaterialColor.cs
3,346
C#
using System.Collections.Generic; // 非线程安全 public class Pool<T> where T : new() { private int _defaultSize = 0; private List<T> _allGroup = new List<T>(); private List<T> _freeGroup = new List<T>(); public Pool(int defaultSize) { _defaultSize = defaultSize; for (int i = 0; i < defaultSize; ++i) { T obj = new T(); _freeGroup.Add(obj); _allGroup.Add(obj); } } public T Spawn() { if (_freeGroup.Count == 0) { T nobj = new T(); _allGroup.Add(nobj); return nobj; } T obj = _freeGroup[0]; _freeGroup.RemoveAt(0); return obj; } public void Recycle(T obj) { _freeGroup.Add(obj); } // public int Count // { // get { return _allGroup.Count; } // } public void ClearAll() { for (int i = 0; i < _freeGroup.Count; ++i) _freeGroup[i] = default(T); _freeGroup.Clear(); for (int i = 0; i < _allGroup.Count; ++i) _allGroup[i] = default(T); _allGroup.Clear(); } }
16.909091
44
0.605376
[ "MIT" ]
twenty0ne/unity-x
client/Assets/Unity-X/Pool.cs
940
C#
// Dynamics 365 svcutil extension tool by Kipon ApS, Kjeld Poulsen // This file is autogenerated. Do not touch the code manually namespace Kipon.Dynamics.Plugin.Entities { public partial class CrmUnitOfWork { private IRepository<Account> _accounts; public IRepository<Account> Accounts { get { if (_accounts == null) { _accounts = new CrmRepository<Account>(this.context); } return _accounts; } } private IRepository<Contact> _contacts; public IRepository<Contact> Contacts { get { if (_contacts == null) { _contacts = new CrmRepository<Contact>(this.context); } return _contacts; } } private IRepository<Opportunity> _opportunities; public IRepository<Opportunity> Opportunities { get { if (_opportunities == null) { _opportunities = new CrmRepository<Opportunity>(this.context); } return _opportunities; } } private IRepository<SalesOrder> _salesorders; public IRepository<SalesOrder> Salesorders { get { if (_salesorders == null) { _salesorders = new CrmRepository<SalesOrder>(this.context); } return _salesorders; } } private IRepository<Quote> _quotes; public IRepository<Quote> Quotes { get { if (_quotes == null) { _quotes = new CrmRepository<Quote>(this.context); } return _quotes; } } private IRepository<SystemUser> _systemusers; public IRepository<SystemUser> Systemusers { get { if (_systemusers == null) { _systemusers = new CrmRepository<SystemUser>(this.context); } return _systemusers; } } } }
20.317073
68
0.653661
[ "MIT" ]
kip-dk/dynamics-plugin
Kipon.Dynamics.Plugin/Entities/CrmUnitOfWork.Design.cs
1,666
C#
using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; namespace LivingDocumentation.RenderExtensions.Tests { public partial class TypeDescriptionListExtensions { [TestMethod] public void PopulateInheritedMembers_NullTypes_Should_Throw() { // Assign var types = (List<TypeDescription>)null; // Act Action action = () => types.PopulateInheritedMembers(); // Assert action.Should().Throw<ArgumentNullException>() .And.ParamName.Should().Be("types"); } [TestMethod] public void PopulateInheritedMembers_NoBaseTypes_Should_NotThrow() { // Assign var types = new[] { new TypeDescription(TypeType.Class, "Test") }; // Act Action action = () => types.PopulateInheritedMembers(); // Assert action.Should().NotThrow(); } [TestMethod] public void PopulateInheritedMembers_UnknownBaseTypes_Should_NotThrow() { // Assign var types = new[] { new TypeDescription(TypeType.Class, "Test") { BaseTypes = { "XXX" } }, }; // Act Action action = () => types.PopulateInheritedMembers(); // Assert action.Should().NotThrow(); } [TestMethod] public void PopulateInheritedMembers_BaseTypeMembers_Should_BeCopiedToImplementingType() { // Assign var baseType = new TypeDescription(TypeType.Class, "BaseTest"); baseType.AddMember(new FieldDescription("int", "number")); var types = new[] { new TypeDescription(TypeType.Class, "Test") { BaseTypes = { "BaseTest" } }, baseType }; // Act types.PopulateInheritedMembers(); // Assert types[0].Fields.Should().HaveCount(1); types[0].Fields[0].Should().NotBeNull(); types[0].Fields[0].Name.Should().Be("number"); } [TestMethod] public void PopulateInheritedMembers_PrivateFields_Should_NotBeCopiedToImplementingType() { // Assign var baseType = new TypeDescription(TypeType.Class, "BaseTest"); baseType.AddMember(new FieldDescription("int", "number")); baseType.AddMember(new FieldDescription("int", "number2") { Modifiers = Modifier.Private }); var types = new[] { new TypeDescription(TypeType.Class, "Test") { BaseTypes = { "BaseTest" } }, baseType }; // Act types.PopulateInheritedMembers(); // Assert types[0].Fields.Should().HaveCount(1); types[0].Fields[0].Name.Should().Be("number"); } } }
29.017391
104
0.494456
[ "MIT" ]
eNeRGy164/LivingDocumentation
tests/LivingDocumentation.RenderExtensions.Tests/TypeDescriptionListExtensionsTests.PopulateInheritedMembers.cs
3,339
C#
namespace FinancialPortalAPI.Areas.HelpPage.ModelDescriptions { public class KeyValuePairModelDescription : ModelDescription { public ModelDescription KeyModelDescription { get; set; } public ModelDescription ValueModelDescription { get; set; } } }
30.777778
67
0.750903
[ "MIT" ]
drrky-g/FinancialPortalAPI
FinancialPortalAPI/Areas/HelpPage/ModelDescriptions/KeyValuePairModelDescription.cs
277
C#
namespace VeterinaryClinic.Web.ViewModels { public class ErrorViewModel { public string RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); } }
21.4
75
0.67757
[ "MIT" ]
Megi223/VeterinaryClinic
Web/VeterinaryClinic.Web.ViewModels/ErrorViewModel.cs
216
C#
using System.Collections.Generic; using Essensoft.AspNetCore.Payment.Alipay.Response; namespace Essensoft.AspNetCore.Payment.Alipay.Request { /// <summary> /// alipay.eco.medicalcare.common.tpcard.notify /// </summary> public class AlipayEcoMedicalcareCommonTpcardNotifyRequest : IAlipayRequest<AlipayEcoMedicalcareCommonTpcardNotifyResponse> { /// <summary> /// 医疗行业通用消息通知 /// </summary> public string BizContent { get; set; } #region IAlipayRequest Members private bool needEncrypt = false; private string apiVersion = "1.0"; private string terminalType; private string terminalInfo; private string prodCode; private string notifyUrl; private string returnUrl; private AlipayObject bizModel; public void SetNeedEncrypt(bool needEncrypt) { this.needEncrypt = needEncrypt; } public bool GetNeedEncrypt() { return needEncrypt; } public void SetNotifyUrl(string notifyUrl) { this.notifyUrl = notifyUrl; } public string GetNotifyUrl() { return notifyUrl; } public void SetReturnUrl(string returnUrl) { this.returnUrl = returnUrl; } public string GetReturnUrl() { return returnUrl; } public void SetTerminalType(string terminalType) { this.terminalType = terminalType; } public string GetTerminalType() { return terminalType; } public void SetTerminalInfo(string terminalInfo) { this.terminalInfo = terminalInfo; } public string GetTerminalInfo() { return terminalInfo; } public void SetProdCode(string prodCode) { this.prodCode = prodCode; } public string GetProdCode() { return prodCode; } public string GetApiName() { return "alipay.eco.medicalcare.common.tpcard.notify"; } public void SetApiVersion(string apiVersion) { this.apiVersion = apiVersion; } public string GetApiVersion() { return apiVersion; } public IDictionary<string, string> GetParameters() { var parameters = new AlipayDictionary { { "biz_content", BizContent } }; return parameters; } public AlipayObject GetBizModel() { return bizModel; } public void SetBizModel(AlipayObject bizModel) { this.bizModel = bizModel; } #endregion } }
23.227642
127
0.554078
[ "MIT" ]
LuohuaRain/payment
src/Essensoft.AspNetCore.Payment.Alipay/Request/AlipayEcoMedicalcareCommonTpcardNotifyRequest.cs
2,879
C#
using System.Collections.Generic; using System.ComponentModel; using backend.Models; namespace backend.ViewModels.Common { public abstract class BaseSearchCondition { // [DisplayName("ページネーション")] // public Pagination Pagination {get; set; } public int Rows { get; set; } = 0; public int PerPage { get; set; } = 5; public int CurrentPage { get; set; } = 1; //URLのユニーク化のため public string Timestamp {get; set;} //Pagepath public string PageId {get; set;} } }
22.666667
52
0.613971
[ "MIT" ]
satohhd/aeframe
backend/ViewModels/Common/BaseSearchCondition.cs
578
C#
using System; using System.Reflection; namespace TheSocialNetwork.ProfileWebAPI.Areas.HelpPage.ModelDescriptions { public interface IModelDocumentationProvider { string GetDocumentation(MemberInfo member); string GetDocumentation(Type type); } }
22.916667
73
0.763636
[ "MIT" ]
thiagocruzrj/FatLife-SocialNetwork
TheSocialNetwork.ProfileWebAPI/Areas/HelpPage/ModelDescriptions/IModelDocumentationProvider.cs
275
C#
using System; using System.IO; using System.Text; using QuantConnect.Algorithm; using QuantConnect.Data.Consolidators; using QuantConnect.Data.Market; using QuantConnect.Indicators; namespace QuantConnect.Algorithm.CSharp { /* * John Ehlers' MAMA and FAMA * (programmed by Jean-Paul van Brakel) */ public class FamaMamaAlgorithm : QCAlgorithm { public string _ticker = "AAPL"; // which stock ticker public static int _consolidated_minutes = 10; // number of minutes public static double MAMA_FastLimit = 0.10; // fast parameter public static double MAMA_SlowLimit = 0.001; // slow parameter private TradeBarConsolidator consolidator; private readonly RollingWindow<double> Prices = new RollingWindow<double>(9); private readonly RollingWindow<double> Smooths = new RollingWindow<double>(9); private readonly RollingWindow<double> Periods = new RollingWindow<double>(9); private readonly RollingWindow<double> Detrenders = new RollingWindow<double>(9); private readonly RollingWindow<double> Q1s = new RollingWindow<double>(9); private readonly RollingWindow<double> I1s = new RollingWindow<double>(9); private readonly RollingWindow<double> Q2s = new RollingWindow<double>(9); private readonly RollingWindow<double> I2s = new RollingWindow<double>(9); private readonly RollingWindow<double> Res = new RollingWindow<double>(9); private readonly RollingWindow<double> Ims = new RollingWindow<double>(9); private readonly RollingWindow<double> SmoothPeriods = new RollingWindow<double>(9); private readonly RollingWindow<double> Phases = new RollingWindow<double>(9); private readonly RollingWindow<double> MAMAs = new RollingWindow<double>(9); private readonly RollingWindow<double> FAMAs = new RollingWindow<double>(9); private Chart plotter; decimal _oldprice = 100000; decimal _price; int _old_dir = 0; int _mama_dir = 0; int _trend_dir = 0; private DateTime startTime; public override void Initialize() { //Start and End Date range for the backtest: startTime = DateTime.Now; SetStartDate(2016, 1, 02); SetEndDate(2016, 1, 07); SetCash(26000); AddSecurity(SecurityType.Equity, _ticker, Resolution.Minute); consolidator = new TradeBarConsolidator(TimeSpan.FromMinutes(_consolidated_minutes)); consolidator.DataConsolidated += ConsolidatedHandler; SubscriptionManager.AddConsolidator(_ticker, consolidator); //plotter = new Chart("MAMA", ChartType.Overlay); //plotter.AddSeries(new Series("Price", SeriesType.Line)); //plotter.AddSeries(new Series("MAMA", SeriesType.Line)); //plotter.AddSeries(new Series("FAMA", SeriesType.Line)); //AddChart(plotter); //Warm up the variables for (int i = 0; i < 7; i++) { Periods.Add(0.0); Smooths.Add(0.0); Detrenders.Add(0.0); Q1s.Add(0.0); I1s.Add(0.0); Q2s.Add(0.0); I2s.Add(0.0); Res.Add(0.0); Ims.Add(0.0); SmoothPeriods.Add(0.0); Phases.Add(0.0); MAMAs.Add(0.0); FAMAs.Add(0.0); } } public void OnData(TradeBars data) { // ignore this for now } public void ConsolidatedHandler(object sender, TradeBar data) { Prices.Add((double)(data.High + data.Low) / 2); _price = data.Close; if (!Prices.IsReady) return; // MAMA and FAMA // ********************************************************************************************************* double Smooth = (double)((4 * Prices[0] + 3 * Prices[1] + 2 * Prices[2] + Prices[3]) / 10); Smooths.Add(Smooth); double Detrender = (.0962 * Smooths[0] + .5769 * Smooths[2] - .5769 * Smooths[4] - .0962 * Smooths[6]) * (.075 * Periods[1] + .54); Detrenders.Add(Detrender); // Compute InPhase and Quadrature components Q1s.Add((.0962 * Detrenders[0] + .5769 * Detrenders[2] - .5769 * Detrenders[4] - .0962 * Detrenders[6]) * (.075 * Periods[1] + .54)); I1s.Add(Detrenders[3]); // Advance the phase of I1 and Q1 by 90 degrees double jI = (.0962 * I1s[0] + .5769 * I1s[2] - .5769 * I1s[4] - .0962 * I1s[6]) * (.075 * Periods[1] + .54); double jQ = (.0962 * Q1s[0] + .5769 * Q1s[2] - .5769 * Q1s[4] - .0962 * Q1s[6]) * (.075 * Periods[1] + .54); // Phasor addition for 3 bar averaging double I2 = I1s[0] - jQ; double Q2 = Q1s[0] + jI; // Smooth the I and Q components before applying the discriminator I2s.Add(.2 * I2 + .8 * I2s[0]); Q2s.Add(.2 * Q2 + .8 * Q2s[0]); // Homodyne Discriminator double Re = I2s[0] * I2s[1] + Q2s[0] * Q2s[1]; double Im = I2s[0] * Q2s[1] - Q2s[0] * I2s[1]; Res.Add(.2 * Re + .8 * Res[0]); Ims.Add(.2 * Im + .8 * Ims[0]); double Period = 0; if (Im != 0 && Re != 0) Period = (2 * Math.PI) / Math.Atan(Im / Re); if (Period > 1.5 * Periods[0]) Period = 1.5 * Periods[0]; if (Period < .67 * Periods[0]) Period = .67 * Periods[0]; if (Period < 6) Period = 6; if (Period > 50) Period = 50; Periods.Add(.2 * Period + .8 * Periods[0]); SmoothPeriods.Add(33 * Periods[0] + .67 * SmoothPeriods[0]); if (I1s[0] != 0) Phases.Add(Math.Atan(Q1s[0] / I1s[0])); double DeltaPhase = Phases[1] - Phases[0]; if (DeltaPhase < 1) DeltaPhase = 1; double alpha = MAMA_FastLimit / DeltaPhase; if (alpha < MAMA_SlowLimit) alpha = MAMA_SlowLimit; MAMAs.Add(alpha * Prices[0] + (1 - alpha) * MAMAs[0]); FAMAs.Add(.5 * alpha * MAMAs[0] + (1 - .5 * alpha) * FAMAs[0]); if (MAMAs[0] > FAMAs[0]) { _trend_dir = 1; } else if (MAMAs[0] < FAMAs[0]) { _trend_dir = -1; } if (MAMAs[0] > MAMAs[1]) { _mama_dir = 1; } else if (MAMAs[0] < MAMAs[1]) { _mama_dir = -1; } // ********************************************************************************************************* // Update chart if (Math.Abs(FAMAs[0] - Prices[0]) < 5) { Plot("MAMA", "price", Prices[0]); Plot("MAMA", "MAMA", MAMAs[0]); Plot("MAMA", "FAMA", FAMAs[0]); } // Order logic / (simple) risk management decimal pps = ((_price - _oldprice) / _oldprice) * 100; if (pps <= -2.5M || _trend_dir != _old_dir) { // if direction is wrong // End position Liquidate(_ticker); } if (!Portfolio.HoldStock) { int quantity = (int)Math.Floor(Portfolio.Cash / data.Close); if (_trend_dir != _old_dir) { if (quantity > 0) Order(_ticker, _trend_dir * quantity); _oldprice = _price; _old_dir = _trend_dir; } } } /// <summary> /// Handles the On end of algorithm /// </summary> public override void OnEndOfAlgorithm() { StringBuilder sb = new StringBuilder(); //sb.Append(" Symbols: "); //foreach (var s in Symbols) //{ // sb.Append(s.ToString()); // sb.Append(","); //} string symbolsstring = _ticker; //symbolsstring = symbolsstring.Substring(0, symbolsstring.LastIndexOf(",", System.StringComparison.Ordinal)); string debugstring = string.Format( "\nAlgorithm Name: {0}\n Symbol: {1}\n Ending Portfolio Value: {2} \n lossThreshhold = {3}\n Start Time: {4}\n End Time: {5}", this.GetType().Name, symbolsstring, Portfolio.TotalPortfolioValue, 0, startTime, DateTime.Now); Logging.Log.Trace(debugstring); #region logging // string filepath = @"I:\MyQuantConnect\Logs\" + symbol + "dailyreturns" + sd + ".csv"; #endregion } } }
40.315556
146
0.50248
[ "Apache-2.0" ]
bizcad/LeanJJN
Algorithm.CSharp/BizcadAlgorithms/FamaMama/FamaMamaAlgorithm.cs
9,073
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 Microsoft.EntityFrameworkCore.TestUtilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.EntityFrameworkCore.Query { public class SimpleQuerySqliteTest : SimpleQueryTestBase<NorthwindQuerySqliteFixture<NoopModelCustomizer>> { // ReSharper disable once UnusedParameter.Local public SimpleQuerySqliteTest(NorthwindQuerySqliteFixture<NoopModelCustomizer> fixture, ITestOutputHelper testOutputHelper) : base(fixture) { Fixture.TestSqlLoggerFactory.Clear(); //Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } public override void Take_Skip() { base.Take_Skip(); Assert.Contains( @"SELECT ""t"".*" + EOL + @"FROM (" + EOL + @" SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @" FROM ""Customers"" AS ""c""" + EOL + @" ORDER BY ""c"".""ContactName""" + EOL + @" LIMIT @__p_0" + EOL + @") AS ""t""" + EOL + @"ORDER BY ""t"".""ContactName""" + EOL + @"LIMIT -1 OFFSET @__p_1", Sql); } public override void IsNullOrWhiteSpace_in_predicate() { base.IsNullOrWhiteSpace_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE ""c"".""Region"" IS NULL OR (trim(""c"".""Region"") = '')", Sql); } public override void TrimStart_without_arguments_in_predicate() { base.TrimStart_without_arguments_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE ltrim(""c"".""ContactTitle"") = 'Owner'", Sql); } public override void TrimStart_with_char_argument_in_predicate() { base.TrimStart_with_char_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE ltrim(""c"".""ContactTitle"", 'O') = 'wner'", Sql); } public override void TrimStart_with_char_array_argument_in_predicate() { base.TrimStart_with_char_array_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE ltrim(""c"".""ContactTitle"", 'Ow') = 'ner'", Sql); } public override void TrimEnd_without_arguments_in_predicate() { base.TrimEnd_without_arguments_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE rtrim(""c"".""ContactTitle"") = 'Owner'", Sql); } public override void TrimEnd_with_char_argument_in_predicate() { base.TrimEnd_with_char_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE rtrim(""c"".""ContactTitle"", 'r') = 'Owne'", Sql); } public override void TrimEnd_with_char_array_argument_in_predicate() { base.TrimEnd_with_char_array_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE rtrim(""c"".""ContactTitle"", 'er') = 'Own'", Sql); } public override void Trim_without_argument_in_predicate() { base.Trim_without_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE trim(""c"".""ContactTitle"") = 'Owner'", Sql); } public override void Trim_with_char_argument_in_predicate() { base.Trim_with_char_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE trim(""c"".""ContactTitle"", 'O') = 'wner'", Sql); } public override void Trim_with_char_array_argument_in_predicate() { base.Trim_with_char_array_argument_in_predicate(); Assert.Contains( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""" + EOL + @"FROM ""Customers"" AS ""c""" + EOL + @"WHERE trim(""c"".""ContactTitle"", 'Or') = 'wne'", Sql); } public override void Sum_with_coalesce() { base.Sum_with_coalesce(); Assert.Contains( @"SELECT SUM(COALESCE(""p"".""UnitPrice"", 0.0))" + EOL + @"FROM ""Products"" AS ""p""" + EOL + @"WHERE ""p"".""ProductID"" < 40", Sql); } private static readonly string EOL = Environment.NewLine; private string Sql => Fixture.TestSqlLoggerFactory.Sql; } }
47.981707
254
0.487101
[ "Apache-2.0" ]
h0wXD/EntityFrameworkCore
test/EFCore.Sqlite.FunctionalTests/Query/SimpleQuerySqliteTest.cs
7,871
C#
// MIT License // // Copyright(c) 2018 Alexander Popelyuk // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System; using System.Xml.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace Task_2 { // // Summary: // Class to represent finance operation. [XmlRoot("operation")] public class Operation { // // Summary: // Operation type. public enum Type { [XmlEnum(Name = "income")] Debit, [XmlEnum(Name = "expense")] Credit, } // Operation class members. [XmlAttribute("type")] [JsonConverter(typeof(StringEnumConverter))] public Type OperationType; public Decimal Amount; public DateTime Date; // // Summary: // Convert operation to sane string representation. public override string ToString() { return string.Format("Date: {0}, Type: {1}, Amount: {2}", Date, Enum.GetName(typeof(Operation.Type), OperationType), Amount); } } }
34.578125
84
0.643019
[ "MIT" ]
alexander-popelyuk/DataArt-.NET-School-2018-Lesson-2
Task_2/Sources/Operation.cs
2,215
C#
using System.Linq; using System.Threading.Tasks; using FirstOneTo.ReadModel.Infrastructure; using FirstOneTo.ReadModel.Infrastructure.InMemory; using FluentAssertions; using Nancy; using Nancy.Authentication.Token; using NUnit.Framework; namespace FirstOneTo.Authentication.Service.Tests { [TestFixture] public class BCryptTests { [SetUp] public void SetUp() { _userDatabase = new InMemoryUserDatabase(); _authenticationService = new AuthenticationService(_userDatabase); } private IReadModelUserDatabase _userDatabase; private IAuthenticationService _authenticationService; [Test] public async Task can_hash_password() { string password = "LittleBalls"; password = BCrypt.Net.BCrypt.HashPassword(password); password.Should().NotBe("LittleBalls"); } [Test] public async Task can_unhash_password() { const string password = "LittleBalls"; var hash = BCrypt.Net.BCrypt.HashPassword(password); BCrypt.Net.BCrypt.Verify(password, hash).Should().BeTrue(); } } }
27.604651
78
0.655434
[ "MIT" ]
TomPallister/cqrs-event-sourcing
FirstOneTo.Authentication.Service.Tests/BCryptTests.cs
1,189
C#
using System.Windows.Controls; namespace RINGS.Views { /// <summary> /// AppSettingsView.xaml の相互作用ロジック /// </summary> public partial class HelpView : UserControl { public HelpView() { this.InitializeComponent(); } } }
17.5625
47
0.572954
[ "MIT" ]
anoyetta/RINGS
source/RINGS/Views/HelpView.xaml.cs
299
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.Security.Claims; namespace Microsoft.AspNetCore.Http.Features.Authentication { public interface IHttpAuthenticationFeature { ClaimsPrincipal User { get; set; } } }
27.142857
111
0.747368
[ "Apache-2.0" ]
06b/AspNetCore
src/Http/Http.Features/src/Authentication/IHttpAuthenticationFeature.cs
380
C#
using System; using System.Collections.Generic; using LazyStorage.Interfaces; namespace LazyStorage.InMemory { internal class InMemoryStorage : IStorage { private readonly Dictionary<string, IRepository> _repos; public InMemoryStorage() { _repos = new Dictionary<string, IRepository>(); } public IRepository<T> GetRepository<T>(IConverter<T> converter) { var typeAsString = typeof(T).ToString(); if (!_repos.ContainsKey(typeAsString)) { var inMemoryRepositoryWithConverter = new InMemoryRepository<T>(converter); inMemoryRepositoryWithConverter.Load(); _repos.Add(typeAsString, inMemoryRepositoryWithConverter); } if (!(_repos[typeAsString] is IRepository<T> repository)) { throw new InvalidOperationException($"Unable to retrieve Repository for type {typeAsString}"); } return repository; } public void Save() { foreach(var repo in _repos) { repo.Value.Save(); } } public void Discard() { foreach(var repo in _repos) { repo.Value.Load(); } } } }
26.411765
110
0.548627
[ "MIT" ]
TheEadie/LazyStorage
src/LazyStorage/InMemory/InMemoryStorage.cs
1,349
C#
namespace ESchool.Web.ViewModels.Assignment { using System; using System.Collections.Generic; using System.Text; using ESchool.Data.Models; using ESchool.Services.Mapping; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; public class AssignmentPageViewModel : IMapFrom<Assignment> { public string Id { get; set; } public string Description { get; set; } public Lesson Lesson { get; set; } public ICollection<Material> Materials { get; set; } public ApplicationUser Teacher { get; set; } public DateTime Deadline { get; set; } public string StudentReplyText { get; set; } [BindProperty] public IEnumerable<IFormFile> StudentReplyFiles { get; set; } } }
24.6875
69
0.658228
[ "MIT" ]
llukanov/eSchool
Web/ESchool.Web.ViewModels/Assignment/AssignmentPageViewModel.cs
792
C#
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Diagnostics.HealthChecks; using SFA.DAS.LevyTransferMatching.Domain.Interfaces; namespace SFA.DAS.LevyTransferMatching.Web.HealthChecks { public class ApiHealthCheck : IHealthCheck { private readonly IApiClient _apiClient; public ApiHealthCheck(IApiClient apiClient) { _apiClient = apiClient; } public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = new CancellationToken()) { var description = "Ping of Levy Transfer Matching APIM inner API"; try { await _apiClient.Ping(); } catch (Exception ex) { return HealthCheckResult.Unhealthy(description, ex); } return HealthCheckResult.Healthy(description, new Dictionary<string, object>()); } } }
28.702703
92
0.646893
[ "MIT" ]
SkillsFundingAgency/das-levy-transfer-matching-web
src/SFA.DAS.LevyTransferMatching.Web/HealthChecks/ApiHealthCheck.cs
1,064
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ public partial class CMSModules_ContactManagement_Pages_Contact_Details { }
31.285714
81
0.452055
[ "MIT" ]
BryanSoltis/KenticoMVCWidgetShowcase
CMS/CMSModules/ContactManagement/Pages/Contact/Details.aspx.designer.cs
440
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.Linq; using System.Text; using System.Text.RegularExpressions; using System.IO; using XenAdmin.Network; using XenAPI; using System.Globalization; using System.Reflection; using System.Xml; using XenCenterLib; namespace XenAdmin.Core { public static class Helpers { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private const long XLVHD_DEF_ALLOCATION_QUANTUM_DIVISOR = 10000; public const long XLVHD_MIN_ALLOCATION_QUANTUM_DIVISOR = 50000; public const long XLVHD_MAX_ALLOCATION_QUANTUM_DIVISOR = 4000; public const long XLVHD_MIN_ALLOCATION_QUANTUM = 16777216; // 16 MB public const int DEFAULT_NAME_TRIM_LENGTH = 50; public const string GuiTempObjectPrefix = "__gui__"; public static NumberFormatInfo _nfi = new CultureInfo("en-US", false).NumberFormat; public static readonly Regex SessionRefRegex = new Regex(@"OpaqueRef:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"); /// <summary> /// Return the given host's product version, or the pool master's product version if /// the host does not have one, or null if none can be found. /// </summary> /// <param name="Host">May be null.</param> public static string HostProductVersion(Host host) { return FromHostOrMaster(host, h => h.ProductVersion()); } public static string HostProductVersionText(Host host) { return FromHostOrMaster(host, h => h.ProductVersionText()); } public static string HostProductVersionTextShort(Host host) { return FromHostOrMaster(host, h => h.ProductVersionTextShort()); } public static string HostPlatformVersion(Host host) { if (host == null) return null; return host.PlatformVersion(); } private delegate string HostToStr(Host host); private static string FromHostOrMaster(Host host, HostToStr fn) { if (host == null) return null; string output = fn(host); if (output == null) { Host master = GetMaster(host.Connection); return master == null ? null : fn(master); } return output; } /// <summary> /// Only log the unrecognised version message once (CA-11201). /// </summary> private static bool _unrecognisedVersionWarned = false; /// <summary> /// Numbers should have three parts, i.e. be in the form a.b.c, otherwise they won't be parsed. /// </summary> /// <param name="version1">May be null.</param> /// <param name="version2">May be null.</param> /// <returns></returns> public static int productVersionCompare(string version1, string version2) { // Assume version numbers are of form 'a.b.c' int a1 = 99, b1 = 99, c1 = 99, a2 = 99, b2 = 99, c2 = 99; string[] tokens = null; if (version1 != null) tokens = version1.Split('.'); if (tokens != null && tokens.Length == 3) { a1 = int.Parse(tokens[0]); b1 = int.Parse(tokens[1]); c1 = int.Parse(tokens[2]); } else { if (!_unrecognisedVersionWarned) { log.DebugFormat("Unrecognised version format {0} - treating as developer version", version1); _unrecognisedVersionWarned = true; } } tokens = null; if (version2 != null) tokens = version2.Split('.'); if (tokens != null && tokens.Length == 3) { a2 = int.Parse(tokens[0]); b2 = int.Parse(tokens[1]); c2 = int.Parse(tokens[2]); } else { if (!_unrecognisedVersionWarned) { log.DebugFormat("Unrecognised version format {0} - treating as developer version", version2); _unrecognisedVersionWarned = true; } } if (a2 > a1) { return -1; } else if (a2 == a1) { if (b2 > b1) { return -1; } else if (b2 == b1) { if (c2 > c1) { return -1; } else if (c1 == c2) { return 0; } } } return 1; } /// <summary> /// Gets the pool for the provided connection. Returns null if we have /// a standalone host (or the provided connection is null). /// </summary> /// <remarks> To obtain the pool object for the case of a standalone host /// use GetPoolOfOne.</remarks> public static Pool GetPool(IXenConnection connection) { if (connection == null) return null; foreach (Pool thePool in connection.Cache.Pools) { if (thePool != null && thePool.IsVisible()) return thePool; } return null; } /// <summary> /// Get the unique Pool object corresponding to the given connection. /// Returns the pool object even in the case of a standalone host. May /// return null if the cache is still being populated or the given /// connection is null. /// </summary> public static Pool GetPoolOfOne(IXenConnection connection) { if (connection == null) return null; foreach (Pool pool in connection.Cache.Pools) return pool; return null; } /// <summary> /// Return the host object representing the master of the given connection, or null if the /// cache is being populated. /// </summary> /// <param name="connection">May not be null.</param> /// <returns></returns> public static Host GetMaster(IXenConnection connection) { Pool pool = GetPoolOfOne(connection); return pool == null ? null : connection.Resolve(pool.master); } /// <summary> /// Return the host object representing the master of the given pool. /// (If pool is null, returns null). /// </summary> public static Host GetMaster(Pool pool) { return pool == null ? null : pool.Connection.Resolve(pool.master); } public static bool HostIsMaster(Host host) { Pool pool = Helpers.GetPoolOfOne(host.Connection); if (pool == null) //Cache is being populated... what do we do? return false; return host.opaque_ref == pool.master.opaque_ref; } public static bool IsPool(IXenConnection connection) { return (GetPool(connection) != null); } /// <param name="pool">May be null, in which case the empty string is returned.</param> public static string GetName(Pool pool) { return pool == null ? "" : pool.Name(); } /// <param name="connection">May be null, in which case the empty string is returned.</param> public static string GetName(IXenConnection connection) { return connection == null ? "" : connection.Name; } /// <param name="o">May be null, in which case the empty string is returned.</param> public static string GetName(IXenObject o) { return o == null ? "" : o.Name(); } public static bool IsConnected(IXenConnection connection) { return (connection != null && connection.IsConnected); } public static bool IsConnected(Pool pool) { return (pool != null && IsConnected(pool.Connection)); } public static bool IsConnected(Host host) { return (host != null && IsConnected(host.Connection)); } public static bool HasFullyConnectedSharedStorage(IXenConnection connection) { foreach (SR sr in connection.Cache.SRs) { if (sr.content_type != XenAPI.SR.Content_Type_ISO && sr.shared && sr.CanCreateVmOn()) return true; } return false; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool DundeeOrGreater(IXenConnection conn) { return conn == null || DundeeOrGreater(Helpers.GetMaster(conn)); } /// Dundee is ver. 2.0.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool DundeeOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.0.0") >= 0; } public static bool DundeePlusOrGreater(IXenConnection conn) { return conn == null || conn.Session == null || conn.Session.APIVersion >= API_Version.API_2_6; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool ElyOrGreater(IXenConnection conn) { return conn == null || ElyOrGreater(Helpers.GetMaster(conn)); } /// Ely is ver. 2.1.1 /// <param name="host">May be null, in which case true is returned.</param> public static bool ElyOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.1.1") >= 0; } public static bool HavanaOrGreater(IXenConnection conn) { return conn == null || HavanaOrGreater(Helpers.GetMaster(conn)); } /// As Havana platform version is same with Ely and Honolulu, so use product version here /// <param name="host">May be null, in which case true is returned.</param> public static bool HavanaOrGreater(Host host) { if (host == null) return true; string product_version = HostProductVersion(host); return product_version != null && ElyOrGreater(host) && !FalconOrGreater(host) && productVersionCompare(product_version, BrandManager.ProductVersion712) >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool FalconOrGreater(IXenConnection conn) { return conn == null || FalconOrGreater(Helpers.GetMaster(conn)); } /// Falcon is ver. 2.3.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool FalconOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.2.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool InvernessOrGreater(IXenConnection conn) { return conn == null || InvernessOrGreater(Helpers.GetMaster(conn)); } /// Inverness is ver. 2.4.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool InvernessOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.3.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool JuraOrGreater(IXenConnection conn) { return conn == null || JuraOrGreater(Helpers.GetMaster(conn)); } /// Jura is ver. 2.5.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool JuraOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.4.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool KolkataOrGreater(IXenConnection conn) { return conn == null || KolkataOrGreater(Helpers.GetMaster(conn)); } /// Kolkata platform version is 2.6.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool KolkataOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.5.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool LimaOrGreater(IXenConnection conn) { return conn == null || LimaOrGreater(Helpers.GetMaster(conn)); } /// Lima platform version is 2.7.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool LimaOrGreater(Host host) { if (host == null) return true; string platform_version = HostPlatformVersion(host); return platform_version != null && productVersionCompare(platform_version, "2.6.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool NaplesOrGreater(IXenConnection conn) { return conn == null || NaplesOrGreater(GetMaster(conn)); } /// Naples is ver. 3.0.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool NaplesOrGreater(Host host) { return host == null || NaplesOrGreater(HostPlatformVersion(host)); } public static bool NaplesOrGreater(string platformVersion) { return platformVersion != null && productVersionCompare(platformVersion, "2.9.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool QuebecOrGreater(IXenConnection conn) { return conn == null || QuebecOrGreater(GetMaster(conn)); } /// Quebec platform version is 3.1.0 /// <param name="host">May be null, in which case true is returned.</param> public static bool QuebecOrGreater(Host host) { return host == null || QuebecOrGreater(HostPlatformVersion(host)); } public static bool QuebecOrGreater(string platformVersion) { return platformVersion != null && productVersionCompare(platformVersion, "3.0.50") >= 0; } /// <param name="conn">May be null, in which case true is returned.</param> public static bool StockholmOrGreater(IXenConnection conn) { return conn == null || StockholmOrGreater(Helpers.GetMaster(conn)); } /// <param name="host">May be null, in which case true is returned.</param> public static bool StockholmOrGreater(Host host) { return host == null || StockholmOrGreater(HostPlatformVersion(host)); } /// Stockholm is ver. 3.2.0 public static bool StockholmOrGreater(string platformVersion) { return platformVersion != null && productVersionCompare(platformVersion, "3.1.50") >= 0; } // CP-3435: Disable Check for Updates in Common Criteria Certification project public static bool CommonCriteriaCertificationRelease { get { return false; } } public static bool WlbEnabled(IXenConnection connection) { Pool pool = GetPoolOfOne(connection); return pool != null && pool.wlb_enabled; } public static bool WlbEnabledAndConfigured(IXenConnection conn) { return WlbEnabled(conn)&& WlbConfigured(conn); } public static bool WlbConfigured(IXenConnection conn) { Pool p = GetPoolOfOne(conn); return p != null && !string.IsNullOrEmpty(p.wlb_url); } public static bool CrossPoolMigrationRestrictedWithWlb(IXenConnection conn) { return WlbEnabledAndConfigured(conn) && !DundeeOrGreater(conn); } /// <summary> /// Determines whether two lists contain the same elements (but not necessarily in the same order). /// Compares list elements using reference equality. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="lst1">Must not be null.</param> /// <param name="lst2">Must not be null.</param> /// <returns></returns> public static bool ListsContentsEqual<T>(List<T> lst1, List<T> lst2) { if (lst1.Count != lst2.Count) return false; foreach (T item1 in lst1) if (!lst2.Contains(item1)) return false; return true; } /// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="lst1">Must not be null.</param> /// <param name="lst2">Must not be null.</param> /// <returns></returns> public static List<T> ListsCommonItems<T>(List<T> lst1, List<T> lst2) { List<T> common = new List<T>(); foreach (T item1 in lst1) if (lst2.Contains(item1) && !common.Contains(item1)) common.Add(item1); foreach (T item2 in lst2) if (lst1.Contains(item2) && !common.Contains(item2)) common.Add(item2); return common; } /// <summary> /// Determines if two arrays have the same elements in the same order. /// Elements may be null. /// Uses Object.Equals() when comparing (pairs of non-null) elements. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="a">Must not be null.</param> /// <param name="b">Must not be null.</param> /// <returns></returns> public static bool ArrayElementsEqual<T>(T[] a, T[] b) { if (a.Length != b.Length) return false; for (int i = 0; i < a.Length; i++) { if (a[i] == null && b[i] == null) continue; if (a[i] == null) return false; if (!a[i].Equals(b[i])) return false; } return true; } internal static bool OrderOfMagnitudeDifference(long MinSize, long MaxSize) { if (MinSize < Util.BINARY_KILO && MaxSize < Util.BINARY_KILO) return false; else if (MinSize < Util.BINARY_KILO && MaxSize > Util.BINARY_KILO) return true; else if (MinSize > Util.BINARY_KILO && MaxSize < Util.BINARY_KILO) return true; if (MinSize < Util.BINARY_MEGA && MaxSize < Util.BINARY_MEGA) return false; else if (MinSize < Util.BINARY_MEGA && MaxSize > Util.BINARY_MEGA) return true; else if (MinSize > Util.BINARY_MEGA && MaxSize < Util.BINARY_MEGA) return true; if (MinSize < Util.BINARY_GIGA && MaxSize < Util.BINARY_GIGA) return false; else if (MinSize < Util.BINARY_GIGA && MaxSize > Util.BINARY_GIGA) return true; else if (MinSize > Util.BINARY_GIGA && MaxSize < Util.BINARY_GIGA) return true; return false; } public static string StringFromMaxMinSize(long min, long max) { if (min == -1 && max == -1) return Messages.SIZE_NEGLIGIBLE; else if (min == -1) return Util.LThanSize(max); else if (max == -1) return Util.GThanSize(min); else if (min == max) return Util.DiskSizeString(max); else if (Helpers.OrderOfMagnitudeDifference(min, max)) return string.Format("{0} - {1}", Util.DiskSizeString(min), Util.DiskSizeString(max)); else return string.Format("{0} - {1}", Util.DiskSizeStringWithoutUnits(min), Util.DiskSizeString(max)); } public static string StringFromMaxMinSizeList(List<long> minList, List<long> maxList) { bool lessFlag = false; bool moreFlag = false; bool negligFlag = false; long minSum = 0; long maxSum = 0; for (int i = 0; i < minList.Count; i++) { if (minList[i] < 0 && maxList[i] < 0) { negligFlag = true; } else if (minList[i] < 0) { maxSum += maxList[i]; lessFlag = true; } else if (maxList[i] < 0) { minSum += minList[i]; moreFlag = true; } else { minSum += minList[i]; maxSum += maxList[i]; } } if (moreFlag) return Util.GThanSize(minSum); if (lessFlag) return Util.LThanSize(maxSum); if (negligFlag && maxSum <= 0) return Util.DiskSizeString(maxSum); return StringFromMaxMinSize(minSum, maxSum); } public static string GetCPUProperties(Host_cpu cpu) { return string.Format("{0}\n{1}\n{2}", string.Format(Messages.GENERAL_CPU_VENDOR, cpu.vendor), string.Format(Messages.GENERAL_CPU_MODEL, cpu.modelname), string.Format(Messages.GENERAL_CPU_SPEED, cpu.speed)); } public static string GetAllocationProperties(string initial_allocation, string quantum_allocation) { return string.Format(Messages.SR_DISK_SPACE_ALLOCATION, Util.MemorySizeStringSuitableUnits(Convert.ToDouble(initial_allocation), true, Messages.VAL_MB), Util.MemorySizeStringSuitableUnits(Convert.ToDouble(quantum_allocation), true, Messages.VAL_MB)); } public static string GetHostRestrictions(Host host) { string output = ""; List<string> restrictions = new List<string>(); // Build license details info box foreach (String key in host.license_params.Keys) { if (host.license_params[key] == "true") { restrictions.Add(key); } } bool first = true; restrictions.Sort(); foreach (String restriction in restrictions) { string restrictionText = Messages.ResourceManager.GetString(restriction); if (restrictionText == null) continue; if (first) { output += restrictionText; first = false; continue; } output += "\n" + restrictionText; } return output; } private static readonly Regex IqnRegex = new Regex(@"^iqn\.\d{4}-\d{2}\.([a-zA-Z0-9][-_a-zA-Z0-9]*(\.[a-zA-Z0-9][-_a-zA-Z0-9]*)*)(:.+)?$", RegexOptions.ECMAScript); public static bool ValidateIscsiIQN(string iqn) { return IqnRegex.IsMatch(iqn); } public static bool IsOlderThanMaster(Host host) { Host master = Helpers.GetMaster(host.Connection); if (master == null || master.opaque_ref == host.opaque_ref) return false; else if (Helpers.productVersionCompare(Helpers.HostProductVersion(host), Helpers.HostProductVersion(master)) >= 0) return false; else return true; } private static readonly Regex MacRegex = new Regex(@"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"); public static bool IsValidMAC(string macString) { return MacRegex.IsMatch(macString); } /// <summary> /// Recursively sums the total size of all files in the directory tree rooted at the given dir. /// </summary> public static long GetDirSize(DirectoryInfo dir) { long size = 0; FileInfo[] files = dir.GetFiles(); foreach (FileInfo file in files) { size += file.Length; } DirectoryInfo[] subdirs = dir.GetDirectories(); foreach (DirectoryInfo subdir in subdirs) { size += GetDirSize(subdir); } return size; } public static string ToWindowsLineEndings(string input) { return Regex.Replace(input, "\r?\n", "\r\n"); } public static bool PoolHasEnabledHosts(Pool pool) { foreach (Host host in pool.Connection.Cache.Hosts) { if (host.enabled) { return true; } } return false; } public static string MakeUniqueName(string stub, List<string> compareAgainst) { string pre = stub; int i = 1; while (compareAgainst.Contains(stub)) { stub = string.Format(Messages.NEWVM_DEFAULTNAME, pre, i); i++; } return stub; } public static string MakeUniqueNameFromPattern(string pattern, List<string> compareAgainst, int startAt) { int i = startAt; string val; do { val = string.Format(pattern, i++); } while (compareAgainst.Contains(val)); return val; } public static string MakeHiddenName(string name) { return string.Format("{0}{1}", GuiTempObjectPrefix, name); } public static string GetFriendlyLicenseName(Pool pool) { var hosts = new List<Host>(pool.Connection.Cache.Hosts); if (hosts.Count > 0) { var editions = Enum.GetValues(typeof(Host.Edition)); foreach (Host.Edition edition in editions) { Host.Edition edition1 = edition; Host host = hosts.Find(h => Host.GetEdition(h.edition) == edition1); if (host != null) return GetFriendlyLicenseName(host); } } return Messages.UNKNOWN; } public static string GetFriendlyLicenseName(Host host) { if (string.IsNullOrEmpty(host.edition)) return Messages.UNKNOWN; string legacy = NaplesOrGreater(host) ? "" : "legacy-"; string name = FriendlyNameManager.GetFriendlyName("Label-host.edition-" + legacy + host.edition); return name ?? Messages.UNKNOWN; } /// <summary> /// Used for determining which features are available on the current license. /// Note that all the features are per-pool: e.g., even if iXenObject is a Host, /// we return whether *any* the hosts in that pool are forbidden that feature. /// </summary> public static bool FeatureForbidden(IXenObject iXenObject, Predicate<Host> restrictionTest) { IXenConnection connection = (iXenObject == null ? null : iXenObject.Connection); return FeatureForbidden(connection, restrictionTest); } public static bool FeatureForbidden(IXenConnection xenConnection, Predicate<Host> restrictionTest) { if (xenConnection == null) return false; foreach (Host host in xenConnection.Cache.Hosts) { if (restrictionTest(host)) return true; } return false; } /// <summary> /// Parse string represented double to a double with en-US number format /// </summary> /// <param name="toParse">String represented double</param> /// <param name="defaultValue">Default value to use if the string can't be parsed</param> /// <returns>The parsed double.</returns> public static double ParseStringToDouble(string toParse, double defaultValue) { if (double.TryParse(toParse, NumberStyles.Any, _nfi, out var doubleValue)) return doubleValue; return defaultValue; } /// <summary> /// Return the UUID of the given XenObject, or the empty string if that can't be found. /// </summary> public static string GetUuid(IXenObject iXenObject) { if (iXenObject == null) return ""; Type t = iXenObject.GetType(); PropertyInfo p = t.GetProperty("uuid", BindingFlags.Public | BindingFlags.Instance); if (p == null) return ""; return (string)p.GetValue(iXenObject, null); } #region Reflexive other_config and gui_config functions public static Dictionary<String, String> GetOtherConfig(IXenObject o) { return o.Get("other_config") as Dictionary<String, String>; } public static void SetOtherConfig(Session session, IXenObject o, String key, String value) { //Program.AssertOffEventThread(); o.Do("remove_from_other_config", session, o.opaque_ref, key); o.Do("add_to_other_config", session, o.opaque_ref, key, value); } public static void RemoveFromOtherConfig(Session session, IXenObject o, string key) { //Program.AssertOffEventThread(); o.Do("remove_from_other_config", session, o.opaque_ref, key); } public static Dictionary<String, String> GetGuiConfig(IXenObject o) { return o.Get("gui_config") as Dictionary<String, String>; } public static void SetGuiConfig(Session session, IXenObject o, String key, String value) { //Program.AssertOffEventThread(); o.Do("remove_from_gui_config", session, o.opaque_ref, key); o.Do("add_to_gui_config", session, o.opaque_ref, key, value); } public static void RemoveFromGuiConfig(Session session, IXenObject o, string key) { //Program.AssertOffEventThread(); o.Do("remove_from_gui_config", session, o.opaque_ref, key); } #endregion public static Regex CpuRegex = new Regex("^cpu([0-9]+)$"); public static Regex CpuAvgFreqRegex = new Regex("^CPU([0-9]+)-avg-freq$"); public static Regex CpuStateRegex = new Regex("^cpu([0-9]+)-(C|P)([0-9]+)$"); static Regex VifRegex = new Regex("^vif_([0-9]+)_(tx|rx)((_errors)?)$"); static Regex PifEthRegex = new Regex("^pif_eth([0-9]+)_(tx|rx)((_errors)?)$"); static Regex PifVlanRegex = new Regex("^pif_eth([0-9]+).([0-9]+)_(tx|rx)((_errors)?)$"); static Regex PifBrRegex = new Regex("^pif_xenbr([0-9]+)_(tx|rx)((_errors)?)$"); static Regex PifXapiRegex = new Regex("^pif_xapi([0-9]+)_(tx|rx)((_errors)?)$"); static Regex PifTapRegex = new Regex("^pif_tap([0-9]+)_(tx|rx)((_errors)?)$"); static Regex PifLoRegex = new Regex("^pif_lo_(tx|rx)((_errors)?)$"); static Regex PifBondRegex = new Regex("^pif_(bond[0-9]+)_(tx|rx)((_errors)?)$"); static Regex DiskRegex = new Regex("^vbd_((xvd|hd)[a-z]+)_(read|write)((_latency)?)$"); static Regex DiskIopsRegex = new Regex("^vbd_((xvd|hd)[a-z]+)_iops_(read|write|total)$"); static Regex DiskThroughputRegex = new Regex("^vbd_((xvd|hd)[a-z]+)_io_throughput_(read|write|total)$"); static Regex DiskOtherRegex = new Regex("^vbd_((xvd|hd)[a-z]+)_(avgqu_sz|inflight|iowait)$"); static Regex NetworkLatencyRegex = new Regex("^network/latency$"); static Regex XapiLatencyRegex = new Regex("^xapi_healthcheck/latency$"); static Regex StatefileLatencyRegex = new Regex("^statefile/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/latency$"); static Regex LoadAvgRegex = new Regex("loadavg"); static Regex SrRegex = new Regex("^sr_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}_cache_(size|hits|misses)"); static Regex SrIORegex = new Regex("^(io_throughput|iops)_(read|write|total)_([a-f0-9]{8})$"); static Regex SrOtherRegex = new Regex("^(latency|avgqu_sz|inflight|iowait)_([a-f0-9]{8})$"); static Regex SrReadWriteRegex = new Regex("^((read|write)(_latency)?)_([a-f0-9]{8})$"); static Regex GpuRegex = new Regex(@"^gpu_((memory_(free|used))|power_usage|temperature|(utilisation_(compute|memory_io)))_((([a-fA-F0-9]{4}\/)|([a-fA-F0-9]{8}\/))?[a-fA-F0-9]{2}\/[0-1][a-fA-F0-9].[0-7])$"); public static string GetFriendlyDataSourceName(string name, IXenObject iXenObject) { if (iXenObject == null) return name; string s = GetFriendlyDataSourceName_(name, iXenObject); return string.IsNullOrEmpty(s) ? name : s; } private static string GetFriendlyDataSourceName_(string name, IXenObject iXenObject) { Match m; m = CpuRegex.Match(name); if (m.Success) return FormatFriendly("Label-performance.cpu", m.Groups[1].Value); m = CpuAvgFreqRegex.Match(name); if (m.Success) return FormatFriendly("Label-performance.cpu-avg-freq", m.Groups[1].Value); m = VifRegex.Match(name); if (m.Success) { string device = m.Groups[1].Value; XenAPI.Network network = FindNetworkOfVIF(iXenObject, device); return network == null ? null //don't try to retrieve it in the FriendlyNames. : FormatFriendly(string.Format("Label-performance.vif_{0}{1}", m.Groups[2].Value, m.Groups[3].Value), network.Name()); } m = PifEthRegex.Match(name); if (m.Success) return FormatFriendly(string.Format("Label-performance.nic_{0}{1}", m.Groups[2].Value, m.Groups[3].Value), m.Groups[1].Value); m = PifVlanRegex.Match(name); if (m.Success) { string device = string.Format("eth{0}", m.Groups[1].Value); XenAPI.Network network = FindVlan(iXenObject, device, m.Groups[2].Value); return network == null ? null //don't try to retrieve it in the FriendlyNames. : FormatFriendly(string.Format("Label-performance.vlan_{0}{1}", m.Groups[3].Value, m.Groups[4].Value), network.Name()); } m = PifBrRegex.Match(name); if (m.Success) { string device = string.Format("eth{0}", m.Groups[1].Value); XenAPI.Network network = FindNetworkOfPIF(iXenObject, device); return network == null ? null //don't try to retrieve it in the FriendlyNames. : FormatFriendly(string.Format("Label-performance.xenbr_{0}{1}", m.Groups[2].Value, m.Groups[3].Value), network.Name()); } m = PifXapiRegex.Match(name); if (m.Success) return FormatFriendly(string.Format("Label-performance.xapi_{0}{1}", m.Groups[2].Value, m.Groups[3].Value), m.Groups[1].Value); m = PifBondRegex.Match(name); if (m.Success) { PIF pif = FindPIF(iXenObject, m.Groups[1].Value, false); return pif == null ? null //pif doesn't exist anymore so don't try to retrieve it in the FriendlyNames. : FormatFriendly(string.Format("Label-performance.bond_{0}{1}", m.Groups[2].Value, m.Groups[3].Value), pif.Name()); } m = PifLoRegex.Match(name); if (m.Success) return FormatFriendly(string.Format("Label-performance.lo_{0}{1}", m.Groups[1].Value, m.Groups[2].Value)); m = PifTapRegex.Match(name); if (m.Success) return FormatFriendly(string.Format("Label-performance.tap_{0}{1}", m.Groups[2].Value, m.Groups[3].Value), m.Groups[1].Value); m = DiskRegex.Match(name); if (m.Success) { VBD vbd = FindVBD(iXenObject, m.Groups[1].Value); return vbd == null ? null : FormatFriendly(string.Format("Label-performance.vbd_{0}{1}", m.Groups[3].Value, m.Groups[4].Value), vbd.userdevice); } m = DiskIopsRegex.Match(name); if (m.Success) { VBD vbd = FindVBD(iXenObject, m.Groups[1].Value); return vbd == null ? null : FormatFriendly(string.Format("Label-performance.vbd_iops_{0}", m.Groups[3].Value), vbd.userdevice); } m = DiskThroughputRegex.Match(name); if (m.Success) { VBD vbd = FindVBD(iXenObject, m.Groups[1].Value); return vbd == null ? null : FormatFriendly(string.Format("Label-performance.vbd_io_throughput_{0}", m.Groups[3].Value), vbd.userdevice); } m = DiskOtherRegex.Match(name); if (m.Success) { VBD vbd = FindVBD(iXenObject, m.Groups[1].Value); return vbd == null ? null : FormatFriendly(string.Format("Label-performance.vbd_{0}", m.Groups[3].Value), vbd.userdevice); } m = SrRegex.Match(name); if (m.Success) return FormatFriendly(string.Format("Label-performance.sr_cache_{0}", m.Groups[1].Value)); m = CpuStateRegex.Match(name); if (m.Success) return FormatFriendly("Label-performance.cpu-state", m.Groups[1].Value, m.Groups[2].Value, m.Groups[3].Value); m = SrIORegex.Match(name); if (m.Success) { SR sr = FindSr(iXenObject, m.Groups[3].Value); return sr == null ? null : FormatFriendly(string.Format("Label-performance.sr_{0}_{1}", m.Groups[1].Value, m.Groups[2].Value), sr.Name().Ellipsise(30)); } m = SrOtherRegex.Match(name); if (m.Success) { SR sr = FindSr(iXenObject, m.Groups[2].Value); return sr == null ? null : FormatFriendly(string.Format("Label-performance.sr_{0}", m.Groups[1].Value), sr.Name().Ellipsise(30)); } m = SrReadWriteRegex.Match(name); if (m.Success) { SR sr = FindSr(iXenObject, m.Groups[4].Value); return sr == null ? null : FormatFriendly(string.Format("Label-performance.sr_rw_{0}", m.Groups[1].Value), sr.Name().Ellipsise(30)); } m = GpuRegex.Match(name); if (m.Success) { string pciId = m.Groups[6].Value.Replace(@"/", ":"); PGPU gpu = FindGpu(iXenObject, pciId); if (gpu == null && string.IsNullOrEmpty(m.Groups[8].Value)) { pciId = pciId.Substring(4); gpu = FindGpu(iXenObject, pciId); } return gpu == null ? null : FormatFriendly(string.Format("Label-performance.gpu_{0}", m.Groups[1].Value), gpu.Name(), pciId); } if (NetworkLatencyRegex.IsMatch(name)) return FriendlyNameManager.GetFriendlyName("Label-performance.network_latency"); if (XapiLatencyRegex.IsMatch(name)) return FriendlyNameManager.GetFriendlyName("Label-performance.xapi_latency"); if (StatefileLatencyRegex.IsMatch(name)) return FriendlyNameManager.GetFriendlyName("Label-performance.statefile_latency"); if (LoadAvgRegex.IsMatch(name)) return FriendlyNameManager.GetFriendlyName("Label-performance.loadavg"); return FriendlyNameManager.GetFriendlyName(string.Format("Label-performance.{0}", name)); } /// <summary> /// Lookup key using PropertyManager.GetFriendlyName, and then apply that as a format pattern to the given args. /// </summary> private static string FormatFriendly(string key, params string[] args) { return string.Format(FriendlyNameManager.GetFriendlyName(key), args); } private static PGPU FindGpu(IXenObject iXenObject, string pciId) { foreach (PCI pci in iXenObject.Connection.Cache.PCIs) { if (pci.pci_id != pciId) continue; foreach (PGPU gpu in iXenObject.Connection.Cache.PGPUs) { if (gpu.PCI.opaque_ref == pci.opaque_ref) return gpu; } } return null; } private static XenAPI.Network FindNetworkOfVIF(IXenObject iXenObject, string device) { foreach (VIF vif in iXenObject.Connection.Cache.VIFs) { if (vif.device == device && (iXenObject is Host && ((Host)iXenObject).resident_VMs.Contains(vif.VM) || iXenObject is VM && vif.VM.opaque_ref == iXenObject.opaque_ref)) { XenAPI.Network network = iXenObject.Connection.Resolve(vif.network); if (network != null) return network; } } return null; } private static XenAPI.Network FindNetworkOfPIF(IXenObject iXenObject, string device) { PIF pif = FindPIF(iXenObject, device, true); if (pif != null) { XenAPI.Network network = iXenObject.Connection.Resolve(pif.network); if (network != null) return network; } return null; } private static XenAPI.Network FindVlan(IXenObject iXenObject, string device, string tag) { foreach (PIF pif in iXenObject.Connection.Cache.PIFs) { if (pif.device == device && (iXenObject is Host && pif.host.opaque_ref == iXenObject.opaque_ref || iXenObject is VM && pif.host.opaque_ref == ((VM)iXenObject).resident_on.opaque_ref) && pif.VLAN == long.Parse(tag)) { return iXenObject.Connection.Resolve(pif.network); } } return null; } private static PIF FindPIF(IXenObject iXenObject, string device, bool physical) { foreach (PIF pif in iXenObject.Connection.Cache.PIFs) { if ((!physical || pif.IsPhysical()) && pif.device == device && (iXenObject is Host && pif.host.opaque_ref == iXenObject.opaque_ref || iXenObject is VM && pif.host.opaque_ref == ((VM)iXenObject).resident_on.opaque_ref)) return pif; } return null; } private static VBD FindVBD(IXenObject iXenObject, string device) { if (iXenObject is VM) { VM vm = (VM)iXenObject; foreach (VBD vbd in vm.Connection.ResolveAll(vm.VBDs)) { if (vbd.device == device) return vbd; } } return null; } private static SR FindSr(IXenObject iXenObject, string srUuid) { foreach (var sr in iXenObject.Connection.Cache.SRs) { if (sr.uuid.StartsWith(srUuid)) return sr; } return null; } /// <summary> /// Returns the first line of the given string, or the empty string if null was passed in. Will take the first occurence of \r or \n /// as the end of a line. /// </summary> /// <param name="s"></param> /// <returns></returns> public static string FirstLine(string s) { if (string.IsNullOrEmpty(s)) return string.Empty; s = s.Split('\n')[0]; return s.Split('\r')[0]; } public static double StringToDouble(string str) { if (str == "NaN") return Double.NaN; else if (str == "Infinity") return Double.PositiveInfinity; else if (str == "-Infinity") return Double.NegativeInfinity; else return Convert.ToDouble(str, CultureInfo.InvariantCulture); } public static bool HAEnabled(IXenConnection connection) { Pool pool = Helpers.GetPoolOfOne(connection); if (pool == null) return false; return pool.ha_enabled; } /// <summary> /// Returns "type 'name'" for the specified object, e.g. "pool 'foo'". /// </summary> /// <param name="XenObject"></param> /// <returns></returns> public static string GetNameAndObject(IXenObject XenObject) { if (XenObject is Pool) return string.Format(Messages.POOL_X, GetName(XenObject)); if (XenObject is Host) return string.Format(Messages.SERVER_X, GetName(XenObject)); VM vm = XenObject as VM; if (vm != null) { if (vm.IsControlDomainZero()) return string.Format(Messages.SERVER_X, GetName(XenObject.Connection.Resolve(vm.resident_on))); else return string.Format(Messages.VM_X, GetName(XenObject)); } if (XenObject is SR) return string.Format(Messages.STORAGE_REPOSITORY_X, GetName(XenObject)); return Messages.UNKNOWN_OBJECT; } /// <summary> /// Gets the i18n'd name for a HA restart priority according to FriendlyNames. /// </summary> /// <param name="priority"></param> /// <returns></returns> public static string RestartPriorityI18n(VM.HA_Restart_Priority? priority) { if (priority == null) { return ""; } else { return FriendlyNameManager.GetFriendlyName("Label-VM.ha_restart_priority." + priority.ToString()) ?? priority.ToString(); } } public static string RestartPriorityDescription(VM.HA_Restart_Priority? priority) { if (priority == null) { return ""; } else { return FriendlyNameManager.GetFriendlyName("Description-VM.ha_restart_priority." + priority.ToString()) ?? priority.ToString(); } } /// <summary> /// Builds up a dictionary of the current restart priorities for all the VMs in the given IXenConnection. /// </summary> /// <param name="connection">Must not be null.</param> /// <returns></returns> public static Dictionary<VM, VM.HA_Restart_Priority> GetVmHaRestartPriorities(IXenConnection connection,bool showHiddenVMs) { Dictionary<VM, VM.HA_Restart_Priority> result = new Dictionary<VM, VM.HA_Restart_Priority>(); foreach (VM vm in connection.Cache.VMs) { if (vm.HaCanProtect(showHiddenVMs)) { result[vm] = vm.HARestartPriority(); } } return result; } /// <summary> /// Converts Dictionary<XenObject<VM>, VM.HA_Restart_Priority> -> Dictionary<XenRef<VM>, string>. /// The former is useful in the GUI, the latter is suitable for sending into compute_hypothetical_max. /// </summary> /// <param name="settings">Must not be null.</param> /// <returns></returns> public static Dictionary<XenRef<VM>, string> GetVmHaRestartPrioritiesForApi(Dictionary<VM, VM.HA_Restart_Priority> settings) { Dictionary<XenRef<VM>, string> result = new Dictionary<XenRef<VM>, string>(); foreach (VM vm in settings.Keys) { if (settings[vm] == VM.HA_Restart_Priority.BestEffort || settings[vm] == VM.HA_Restart_Priority.DoNotRestart) { // The server doesn't want to know about best-effort/do not restart VMs. // (They don't influence the plan, and sending in the dictionary gives an error). continue; } result[new XenRef<VM>(vm.opaque_ref)] = VM.PriorityToString(settings[vm]); } return result; } /// <summary> /// Builds up a dictionary of the current startup options for all the VMs in the given IXenConnection. /// </summary> /// <param name="connection">Must not be null.</param> /// <returns></returns> public static Dictionary<VM, VMStartupOptions> GetVmStartupOptions(IXenConnection connection, bool showHiddenVMs) { Dictionary<VM, VMStartupOptions> result = new Dictionary<VM, VMStartupOptions>(); foreach (VM vm in connection.Cache.VMs) { if (vm.HaCanProtect(showHiddenVMs)) { result[vm] = new VMStartupOptions(vm.order, vm.start_delay, vm.HARestartPriority()); } } return result; } /// <summary> /// Retrieves a IXenObject from a message. May return null if type not recognised. /// </summary> /// <param name="message"></param> /// <returns></returns> public static IXenObject XenObjectFromMessage(XenAPI.Message message) { switch (message.cls) { case cls.Pool: Pool pool = message.Connection.Cache.Find_By_Uuid<Pool>(message.obj_uuid); if (pool != null) return pool; break; case cls.Host: Host host = message.Connection.Cache.Find_By_Uuid<Host>(message.obj_uuid); if (host != null) return host; break; case cls.VM: VM vm = message.Connection.Cache.Find_By_Uuid<VM>(message.obj_uuid); if (vm != null) return vm; break; case cls.SR: SR sr = message.Connection.Cache.Find_By_Uuid<SR>(message.obj_uuid); if (sr != null) return sr; break; case cls.VMSS: VMSS vmss = message.Connection.Cache.Find_By_Uuid<VMSS>(message.obj_uuid); if (vmss != null) return vmss; break; case cls.PVS_proxy: PVS_proxy proxy = message.Connection.Cache.Find_By_Uuid<PVS_proxy>(message.obj_uuid); if (proxy != null) return proxy; break; } return null; } /// <summary> /// Load an xml stream and ignore comments and whitespace /// </summary> /// <param name="xmlStream"></param> /// <returns></returns> public static XmlDocument LoadXmlDocument(Stream xmlStream) { XmlDocument doc = new XmlDocument(); XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; settings.IgnoreWhitespace = true; settings.IgnoreProcessingInstructions = true; doc.Load(XmlReader.Create(xmlStream, settings)); return doc; } public static Regex HostnameOrIpRegex = new Regex(@"[\w.]+"); public static string HostnameFromLocation(string p) { foreach (Match m in HostnameOrIpRegex.Matches(p)) { return m.Value; // we only want the hostname or ip which should be the first match } return ""; } /// <summary> /// Retrieves a float value from an XML attribute. /// Returns defaultValue if the attribute doesn't exist. /// </summary> public static string GetStringXmlAttribute(XmlNode node, string attributeName, string defaultValue = null) { if (node == null || node.Attributes == null || node.Attributes[attributeName] == null) return defaultValue; return node.Attributes[attributeName].Value; } /// <summary> /// Retrieves a true of false value from an XML attribute. /// Returns defaultValue if the attribute doesn't exist or the value is malformed. /// </summary> public static bool GetBoolXmlAttribute(XmlNode node, string attributeName, bool defaultValue = false) { if (node == null || node.Attributes == null || node.Attributes[attributeName] == null) return defaultValue; if (bool.TryParse(node.Attributes[attributeName].Value, out bool b)) return b; return defaultValue; } /// <summary> /// Retrieves a float value from an XML attribute. /// Returns defaultValue if the attribute doesn't exist or the value is malformed. /// </summary> public static float GetFloatXmlAttribute(XmlNode node, string attributeName, float defaultValue) { if (node == null || node.Attributes == null || node.Attributes[attributeName] == null) return defaultValue; if (float.TryParse(node.Attributes[attributeName].Value, out float f)) return f; return defaultValue; } /// <summary> /// Retrieves an int value from an XML attribute. /// Returns defaultValue if the attribute doesn't exist or the value is malformed. /// </summary> public static int GetIntXmlAttribute(XmlNode node, string attributeName, int defaultValue) { if (node == null || node.Attributes == null || node.Attributes[attributeName] == null) return defaultValue; if (int.TryParse(node.Attributes[attributeName].Value, out int i)) return i; return defaultValue; } /// <summary> /// Retrieves the string content of an XmlNode attribute. /// </summary> /// <exception cref="I18NException">Thrown if the attribute is missing</exception> public static string GetXmlAttribute(XmlNode node, string attributeName) { if (node == null) throw new I18NException(I18NExceptionType.XmlAttributeMissing, attributeName); if (node.Attributes == null || node.Attributes[attributeName] == null) throw new I18NException(I18NExceptionType.XmlAttributeMissing, attributeName, node.Name); return node.Attributes[attributeName].Value; } /// <summary> /// Retrieves the enum content of an XmlNode attribute or defaultValue if it is missing. /// </summary> public static T GetEnumXmlAttribute<T>(XmlNode node, string attributeName, T defaultValue) { if (node == null || node.Attributes == null || node.Attributes[attributeName] == null) return defaultValue; if (!typeof(T).IsEnum) return defaultValue; try { return (T)Enum.Parse(typeof(T), node.Attributes[attributeName].Value); } catch { return defaultValue; } } public static string PrettyFingerprint(string p) { List<string> pairs = new List<string>(); for (int i = 0; i < p.Length; i += 2) { pairs.Add(p.Substring(i, 2)); } return string.Join(":", pairs.ToArray()); } public static string GetUrl(IXenConnection connection) { UriBuilder uriBuilder = new UriBuilder(connection.UriScheme, connection.Hostname); uriBuilder.Port = connection.Port; return uriBuilder.ToString(); } public static string DefaultVMName(string p, IXenConnection connection) { int i = 0; do { string name = string.Format(Messages.NEWVM_DEFAULTNAME, p, ++i); string hiddenName = MakeHiddenName(name); if (connection.Cache.VMs.Any(v => v.name_label == name || v.name_label == hiddenName)) continue; return name; } while (true); } public static bool CDsExist(IXenConnection connection) { if (connection == null) return false; foreach (SR sr in connection.Cache.SRs) { if (sr.content_type != SR.Content_Type_ISO) continue; if (sr.VDIs.Count > 0) return true; } return false; } public static bool CompareLists<T>(List<T> l1, List<T> l2) { if (l1 == l2) return true; else if (l1 == null || l2 == null) return false; bool same = l1.Count == l2.Count; foreach (T item in l1) { if (!l2.Contains(item)) { same = false; break; } } return same; } public static bool ListsIntersect<T>(List<T> l1, List<T> l2) { foreach (T item in l1) { if (l2.Contains(item)) return true; } return false; } public static bool CustomWithNoDVD(VM template) { return template != null && !template.DefaultTemplate() && template.FindVMCDROM() == null; } public static string GetMacString(string mac) { return mac == "" ? Messages.MAC_AUTOGENERATE : mac; } public static PIF FindPIF(XenAPI.Network network, Host owner) { foreach (PIF pif in network.Connection.ResolveAll(network.PIFs)) { if (owner == null || pif.host == owner.opaque_ref) return pif; } return null; } public static string VlanString(PIF pif) { if (pif == null || pif.VLAN == -1) return Messages.SPACED_HYPHEN; return pif.VLAN.ToString(); } /// <summary> /// Return a string version of a list, in the form "L1, L2, L3 and L4" /// </summary> public static string StringifyList<T>(List<T> list) { if (list == null) return String.Empty; StringBuilder ans = new StringBuilder(); for (int i = 0; i < list.Count; ++i) { ans.Append(list[i].ToString()); if (i < list.Count - 2) ans.Append(Messages.STRINGIFY_LIST_INNERSEP); else if (i == list.Count - 2) ans.Append(Messages.STRINGIFY_LIST_LASTSEP); } return ans.ToString(); } /// <summary> /// Does the connection support Link aggregation (LACP) bonds (i.e. on the vSwitch backend)? /// </summary> public static bool SupportsLinkAggregationBond(IXenConnection connection) { Host master = GetMaster(connection); return master != null && master.vSwitchNetworkBackend(); } /// <summary> /// Number of alloowed NICs per bond /// </summary> public static int BondSizeLimit(IXenConnection connection) { Host master = GetMaster(connection); // For hosts on the vSwitch backend, we allow 4 NICs per bond; otherwise, 2 return master != null && master.vSwitchNetworkBackend() ? 4 : 2; } public static Host GetHostAncestor(IXenObject xenObject) { if (xenObject == null || xenObject.Connection == null) return null; var h = xenObject as Host; if (h != null) return h; var sr = xenObject as SR; if (sr != null) return sr.Home(); var vm = xenObject as VM; if (vm != null) return vm.Home(); return null; } public static bool SameServerVersion(Host host, string longProductVersion) { return host != null && host.LongProductVersion() == longProductVersion; } public static bool EnabledTargetExists(Host host, IXenConnection connection) { if (host != null) return host.enabled; return connection.Cache.Hosts.Any(h => h.enabled); } public static bool GpuCapability(IXenConnection connection) { if (FeatureForbidden(connection, Host.RestrictGpu)) return false; var pool = GetPoolOfOne(connection); return pool != null && pool.HasGpu(); } public static bool VGpuCapability(IXenConnection connection) { if (FeatureForbidden(connection, Host.RestrictVgpu)) return false; var pool = GetPoolOfOne(connection); return pool != null && pool.HasVGpu(); } /// <summary> /// Whether creation of VLAN 0 is allowed. /// </summary> public static bool VLAN0Allowed(IXenConnection connection) { Host master = GetMaster(connection); // For Creedence or later on the vSwitch backend, we allow creation of VLAN 0 return master != null && master.vSwitchNetworkBackend(); } public static bool ContainerCapability(IXenConnection connection) { var master = GetMaster(connection); if (master == null) return false; if (ElyOrGreater(connection)) return master.AppliedUpdates().Any(update => update.Name().ToLower().StartsWith("xscontainer")); return master.SuppPacks().Any(suppPack => suppPack.Name.ToLower().StartsWith("xscontainer")); } public static bool PvsCacheCapability(IXenConnection connection) { var master = GetMaster(connection); return master != null && master.AppliedUpdates().Any(update => update.Name().ToLower().StartsWith("pvsaccelerator")); } public static string UrlEncode(this string str) { if (string.IsNullOrEmpty(str)) return str; return System.Net.WebUtility.UrlEncode(str); } public static string UpdatesFriendlyName(string propertyName) { return FriendlyNameManager.FriendlyNames.GetString(string.Format("Label-{0}", propertyName)) ?? propertyName; } public static string UpdatesFriendlyNameAndVersion(Pool_update update) { var friendlyName = UpdatesFriendlyName(update.Name()); if (string.IsNullOrEmpty(update.version)) return friendlyName; return string.Format(Messages.SUPP_PACK_DESCRIPTION, friendlyName, update.version); } public static List<string> HostAppliedPatchesList(Host host) { List<string> result = new List<string>(); if (ElyOrGreater(host)) { foreach (var update in host.AppliedUpdates()) result.Add(UpdatesFriendlyNameAndVersion(update)); } else { foreach (Pool_patch patch in host.AppliedPatches()) result.Add(patch.Name()); } result.Sort(StringUtility.NaturalCompare); return result; } public static List<string> FindIpAddresses(Dictionary<string, string> networks, string device) { if (networks == null || string.IsNullOrWhiteSpace(device)) return new List<string>(); // PR-1373 - VM_guest_metrics.networks is a dictionary of IP addresses in the format: // [["0/ip", <IPv4 address>], // ["0/ipv4/0", <IPv4 address>], ["0/ipv4/1", <IPv4 address>], // ["0/ipv6/0", <IPv6 address>], ["0/ipv6/1", <IPv6 address>]] return (from network in networks where network.Key.StartsWith(string.Format("{0}/ip", device)) orderby network.Key select network.Value.Split(new[] { "\n", "%n" }, StringSplitOptions.RemoveEmptyEntries)).SelectMany(x => x).Distinct().ToList(); } } }
38.394168
235
0.529857
[ "BSD-2-Clause" ]
minli1/xenadmin
XenModel/Utils/Helpers.cs
71,108
C#
///////////////////////////////////////////////////////////////////////////// // Copyright (c) 2011-2017 by Rob Jellinghaus. // // Licensed under MIT license, http://github.com/RobJellinghaus/Touchofunk // ///////////////////////////////////////////////////////////////////////////// using Holofunk.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Holofunk.World { /// <summary> /// The core constant data values needed by the World. /// </summary> public static class Constants { /// <summary> /// Latency compensation, in sample duration. /// </summary> /// <remarks> /// This is very much input-modality-dependent so eventually we will make this part of some UI /// reification, but not in initial Touchofunk. /// </remarks> public readonly static Duration<Sample> LatencyCompensationDuration = 100; /// <summary> /// Quarter second duration over which volume is averaged. /// </summary> public readonly static Duration<Sample> VolumeAveragerDuration = SampleRateHz / 4; /// <summary> /// We hardcode to 48Khz sample rate as this seems to be AudioGraph default. /// </summary> public const int SampleRateHz = 48000; // 4/4 time (actually, 4/_ time, we don't care about the note duration) public const int BeatsPerMeasure = 4; // what tempo do we start at? // turnado sync: 130.612f (120bpm x 48000/44100) public readonly static float InitialBpm = 90; } }
34.081633
102
0.569461
[ "MIT" ]
RobJellinghaus/touchofunk
World/Constants.cs
1,672
C#
/* * Copyright (c) 2018 THL A29 Limited, a Tencent company. 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ namespace TencentCloud.Cdn.V20180606.Models { using Newtonsoft.Json; using System.Collections.Generic; using TencentCloud.Common; public class DescribeDomainsConfigRequest : AbstractModel { /// <summary> /// Offset for paginated queries. Default value: 0 /// </summary> [JsonProperty("Offset")] public long? Offset{ get; set; } /// <summary> /// Limit on paginated queries. Default value: 100. Maximum value: 1000. /// </summary> [JsonProperty("Limit")] public long? Limit{ get; set; } /// <summary> /// Query condition filter, complex type. /// </summary> [JsonProperty("Filters")] public DomainFilter[] Filters{ get; set; } /// <summary> /// Sorting rules /// </summary> [JsonProperty("Sort")] public Sort Sort{ get; set; } /// <summary> /// For internal usage only. DO NOT USE IT. /// </summary> public override void ToMap(Dictionary<string, string> map, string prefix) { this.SetParamSimple(map, prefix + "Offset", this.Offset); this.SetParamSimple(map, prefix + "Limit", this.Limit); this.SetParamArrayObj(map, prefix + "Filters.", this.Filters); this.SetParamObj(map, prefix + "Sort.", this.Sort); } } }
31.615385
81
0.614599
[ "Apache-2.0" ]
TencentCloud/tencentcloud-sdk-dotnet-intl-en
TencentCloud/Cdn/V20180606/Models/DescribeDomainsConfigRequest.cs
2,055
C#
namespace BetterAPI.Paging { public sealed class TopOptions : IQueryOptions { public bool HasDefaultBehaviorWhenMissing { get; set; } = true; public bool EmptyClauseIsValid => false; public string Operator { get; set; } = "$top"; } }
30
71
0.648148
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
danielcrenna/BetterAPI
src/BetterAPI/Paging/TopOptions.cs
272
C#
// SPDX-License-Identifier: MIT // Copyright (C) 2018-present iced project and contributors using System; using Generator.IO; namespace Generator.Formatters.Rust { struct RustStringsTableSerializer { readonly StringsTable stringsTable; public RustStringsTableSerializer(StringsTable stringsTable) => this.stringsTable = stringsTable; public void Serialize(FileWriter writer) { if (!stringsTable.IsFrozen) throw new InvalidOperationException(); var sortedInfos = stringsTable.Infos; int maxStringLength = 0; foreach (var info in sortedInfos) maxStringLength = Math.Max(maxStringLength, info.String.Length); const int FastStringMnemonicSize = 20; if (maxStringLength > FastStringMnemonicSize) { // Requires updating fast.rs `FastStringMnemonic` to match the new aligned size // eg. FastString24/etc depending on perf throw new InvalidOperationException(); } var last = sortedInfos[^1]; int extraPadding = FastStringMnemonicSize - last.String.Length; if (extraPadding < 0) throw new InvalidOperationException(); writer.WriteFileHeader(); writer.WriteLine($"pub(super) const STRINGS_COUNT: usize = {sortedInfos.Length};"); writer.WriteLine(RustConstants.AttributeAllowDeadCode); writer.WriteLine($"pub(super) const MAX_STRING_LEN: usize = {maxStringLength};"); writer.WriteLine(RustConstants.AttributeAllowDeadCode); writer.WriteLine($"pub(super) const VALID_STRING_LENGTH: usize = {FastStringMnemonicSize};"); writer.WriteLine($"pub(super) const PADDING_SIZE: usize = {extraPadding};"); writer.WriteLine(); writer.WriteLine(RustConstants.AttributeNoRustFmt); writer.WriteLine($"pub(super) static STRINGS_TBL_DATA: [u8; {StringsTableSerializerUtils.GetByteCount(sortedInfos) + extraPadding}] = ["); using (writer.Indent()) StringsTableSerializerUtils.SerializeTable(writer, sortedInfos, extraPadding, "Padding so it's possible to read FastStringMnemonic::SIZE bytes from the last value"); writer.WriteLine("];"); } } }
39.803922
169
0.75665
[ "MIT" ]
0xd4d/iced
src/csharp/Intel/Generator/Formatters/Rust/RustStringsTableSerializer.cs
2,030
C#
// Copyright (c) Josef Pihrt. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Roslynator.CSharp; using Roslynator.CSharp.Refactorings; namespace Roslynator.CSharp.DiagnosticAnalyzers { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class UseExpressionBodiedMemberDiagnosticAnalyzer : BaseDiagnosticAnalyzer { public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create( DiagnosticDescriptors.UseExpressionBodiedMember, DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut); } } public override void Initialize(AnalysisContext context) { if (context == null) throw new ArgumentNullException(nameof(context)); base.Initialize(context); context.EnableConcurrentExecution(); context.RegisterSyntaxNodeAction(AnalyzeMethodDeclaration, SyntaxKind.MethodDeclaration); context.RegisterSyntaxNodeAction(AnalyzeOperatorDeclaration, SyntaxKind.OperatorDeclaration); context.RegisterSyntaxNodeAction(AnalyzeConversionOperatorDeclaration, SyntaxKind.ConversionOperatorDeclaration); context.RegisterSyntaxNodeAction(AnalyzeConstructorDeclaration, SyntaxKind.ConstructorDeclaration); context.RegisterSyntaxNodeAction(AnalyzeDestructorDeclaration, SyntaxKind.DestructorDeclaration); context.RegisterSyntaxNodeAction(AnalyzeLocalFunctionStatement, SyntaxKind.LocalFunctionStatement); context.RegisterSyntaxNodeAction(AnalyzeAccessorDeclaration, SyntaxKind.GetAccessorDeclaration); context.RegisterSyntaxNodeAction(AnalyzeAccessorDeclaration, SyntaxKind.SetAccessorDeclaration); } private void AnalyzeMethodDeclaration(SyntaxNodeAnalysisContext context) { var method = (MethodDeclarationSyntax)context.Node; if (method.ExpressionBody == null) { BlockSyntax body = method.Body; ExpressionSyntax expression = UseExpressionBodiedMemberRefactoring.GetExpression(body); if (expression != null) AnalyzeExpression(context, body, expression); } } private void AnalyzeOperatorDeclaration(SyntaxNodeAnalysisContext context) { var declaration = (OperatorDeclarationSyntax)context.Node; if (declaration.ExpressionBody == null) AnalyzeBody(context, declaration.Body); } private void AnalyzeConversionOperatorDeclaration(SyntaxNodeAnalysisContext context) { var declaration = (ConversionOperatorDeclarationSyntax)context.Node; if (declaration.ExpressionBody == null) AnalyzeBody(context, declaration.Body); } private void AnalyzeConstructorDeclaration(SyntaxNodeAnalysisContext context) { var declaration = (ConstructorDeclarationSyntax)context.Node; if (declaration.ExpressionBody == null) { BlockSyntax body = declaration.Body; ExpressionSyntax expression = UseExpressionBodiedMemberRefactoring.GetExpression(body); if (expression != null) AnalyzeExpression(context, body, expression); } } private void AnalyzeDestructorDeclaration(SyntaxNodeAnalysisContext context) { var declaration = (DestructorDeclarationSyntax)context.Node; if (declaration.ExpressionBody == null) { BlockSyntax body = declaration.Body; ExpressionSyntax expression = UseExpressionBodiedMemberRefactoring.GetExpression(body); if (expression != null) AnalyzeExpression(context, body, expression); } } private void AnalyzeLocalFunctionStatement(SyntaxNodeAnalysisContext context) { var localFunctionStatement = (LocalFunctionStatementSyntax)context.Node; if (localFunctionStatement.ExpressionBody == null) { BlockSyntax body = localFunctionStatement.Body; ExpressionSyntax expression = UseExpressionBodiedMemberRefactoring.GetExpression(body); if (expression != null) AnalyzeExpression(context, body, expression); } } private void AnalyzeAccessorDeclaration(SyntaxNodeAnalysisContext context) { var accessor = (AccessorDeclarationSyntax)context.Node; if (accessor.ExpressionBody == null && !accessor.AttributeLists.Any()) { BlockSyntax body = accessor.Body; ExpressionSyntax expression = UseExpressionBodiedMemberRefactoring.GetExpression(body); if (expression?.IsSingleLine() == true) { var accessorList = accessor.Parent as AccessorListSyntax; if (accessorList != null) { SyntaxList<AccessorDeclarationSyntax> accessors = accessorList.Accessors; if (accessors.Count == 1 && accessors.First().IsKind(SyntaxKind.GetAccessorDeclaration)) { if (accessorList.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia())) { ReportDiagnostic(context, accessorList, expression); context.ReportToken(DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut, accessor.Keyword); context.ReportBraces(DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut, body); } return; } } if (accessor.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia())) ReportDiagnostic(context, body, expression); } } } private static void AnalyzeBody(SyntaxNodeAnalysisContext context, BlockSyntax body) { ExpressionSyntax expression = UseExpressionBodiedMemberRefactoring.GetReturnExpression(body); if (expression != null) AnalyzeExpression(context, body, expression); } private static void AnalyzeExpression(SyntaxNodeAnalysisContext context, BlockSyntax block, ExpressionSyntax expression) { if (block.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()) && expression.IsSingleLine()) { ReportDiagnostic(context, block, expression); } } private static void ReportDiagnostic(SyntaxNodeAnalysisContext context, BlockSyntax block, ExpressionSyntax expression) { context.ReportDiagnostic( DiagnosticDescriptors.UseExpressionBodiedMember, block); SyntaxNode parent = expression.Parent; if (parent.IsKind(SyntaxKind.ReturnStatement)) context.ReportToken(DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut, ((ReturnStatementSyntax)parent).ReturnKeyword); context.ReportBraces(DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut, block); } private static void ReportDiagnostic(SyntaxNodeAnalysisContext context, AccessorListSyntax accessorList, ExpressionSyntax expression) { context.ReportDiagnostic( DiagnosticDescriptors.UseExpressionBodiedMember, accessorList); SyntaxNode parent = expression.Parent; if (parent.IsKind(SyntaxKind.ReturnStatement)) context.ReportToken(DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut, ((ReturnStatementSyntax)parent).ReturnKeyword); context.ReportBraces(DiagnosticDescriptors.UseExpressionBodiedMemberFadeOut, accessorList); } } }
41.183575
160
0.645044
[ "Apache-2.0" ]
TechnoridersForks/Roslynator
source/Analyzers/DiagnosticAnalyzers/UseExpressionBodiedMemberDiagnosticAnalyzer.cs
8,527
C#
// ----------------------------------------------------------------------- // <copyright file="DjvuPage.cs" company=""> // TODO: Update copyright text. // </copyright> // ----------------------------------------------------------------------- using DjvuNet.DataChunks; using DjvuNet.DataChunks.Directory; using DjvuNet.DataChunks.Text; using DjvuNet.Graphics; using DjvuNet.JB2; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Forms; using DjvuNet.Wavelet; using Bitmap = System.Drawing.Bitmap; using ColorPalette = DjvuNet.DataChunks.Graphics.ColorPalette; using Image = System.Drawing.Image; using Rectangle = System.Drawing.Rectangle; namespace DjvuNet { using System; using System.Collections.Generic; using System.Linq; using System.Text; using GBitmap = DjvuNet.Graphics.Bitmap; using GMap = DjvuNet.Graphics.Map; using GPixel = DjvuNet.Graphics.Pixel; using GPixelReference = DjvuNet.Graphics.PixelReference; using GPixmap = DjvuNet.Graphics.PixelMap; using GRect = DjvuNet.Graphics.Rectangle; /// <summary> /// TODO: Update summary. /// </summary> public class DjvuPage : INotifyPropertyChanged { #region Private Variables /// <summary> /// True if the page has been previously loaded, false otherwise /// </summary> private bool _hasLoaded = false; private object _loadingLock = new object(); private bool _isBackgroundDecoded = false; #endregion Private Variables #region Public Events public event PropertyChangedEventHandler PropertyChanged; #endregion Public Events #region Public Properties #region Thumbnail private TH44Chunk _thumbnail; /// <summary> /// Gets the thumbnail for the page /// </summary> public TH44Chunk Thumbnail { get { return _thumbnail; } private set { if (Thumbnail != value) { _thumbnail = value; } } } #endregion Thumbnail #region Document private DjvuDocument _document; /// <summary> /// Gets the document the page belongs to /// </summary> public DjvuDocument Document { get { return _document; } private set { if (Document != value) { _document = value; } } } #endregion Document #region IncludedItems private DjviChunk[] _includedItems; /// <summary> /// Gets the included items /// </summary> public DjviChunk[] IncludedItems { get { return _includedItems; } private set { if (IncludedItems != value) { _includedItems = value; } } } #endregion IncludedItems #region PageForm private FormChunk _pageForm; /// <summary> /// Gets the form chunk for the page /// </summary> public FormChunk PageForm { get { return _pageForm; } private set { if (PageForm != value) { _pageForm = value; } } } #endregion PageForm #region Info private InfoChunk _info; /// <summary> /// Gets the info chunk for the page /// </summary> public InfoChunk Info { get { if (_info == null) { _info = (InfoChunk)PageForm.Children.FirstOrDefault(x => x is InfoChunk); } return _info; } } #endregion Info #region Width /// <summary> /// Gets the width of the page /// </summary> public int Width { get { if (Info != null) { return Info.Width; } return 0; } } #endregion Width #region Height /// <summary> /// Gets the height of the page /// </summary> public int Height { get { if (Info != null) { return Info.Height; } return 0; } } #endregion Height #region Header private DirmComponent _header; /// <summary> /// Gets directory header for the page /// </summary> public DirmComponent Header { get { return _header; } private set { if (Header != value) { _header = value; } } } #endregion Header #region Text private DataChunks.Text.TextChunk _text; /// <summary> /// Gets the info chunk for the page /// </summary> public DataChunks.Text.TextChunk Text { get { if (_text == null) { _text = (DataChunks.Text.TextChunk)PageForm.Children.FirstOrDefault(x => x is DataChunks.Text.TextChunk); } return _text; } } #endregion Text #region ForegroundJB2Image private JB2.JB2Image _foregroundJB2Image; /// <summary> /// Gets the forground image /// </summary> public JB2.JB2Image ForegroundJB2Image { get { if (_foregroundJB2Image == null) { // Get the first chunk if present var chunk = (SjbzChunk)PageForm.Children.FirstOrDefault(x => x is SjbzChunk); if (chunk != null) { _foregroundJB2Image = chunk.Image; } } return _foregroundJB2Image; } } #endregion ForegroundJB2Image #region ForegroundIWPixelMap private Wavelet.IWPixelMap _foregroundIWPixelMap; /// <summary> /// Gets the Foreground pixel map /// </summary> public Wavelet.IWPixelMap ForegroundIWPixelMap { get { if (_foregroundIWPixelMap == null) { var chunk = (FG44Chunk)PageForm.Children.FirstOrDefault(x => x is FG44Chunk); if (chunk != null) { _foregroundIWPixelMap = chunk.ForegroundImage; } } return _foregroundIWPixelMap; } } #endregion ForegroundIWPixelMap #region BackgroundIWPixelMap private Wavelet.IWPixelMap _backgroundIWPixelMap; /// <summary> /// Gets the background pixel map /// </summary> public Wavelet.IWPixelMap BackgroundIWPixelMap { get { if (_backgroundIWPixelMap == null) { var chunk = (BG44Chunk)PageForm.Children.FirstOrDefault(x => x is BG44Chunk); if (chunk != null) { _backgroundIWPixelMap = chunk.BackgroundImage; } } return _backgroundIWPixelMap; } } #endregion BackgroundIWPixelMap #region ForegroundPalette private ColorPalette _foregroundPalette; /// <summary> /// Gets the palette for the foreground /// </summary> public ColorPalette ForegroundPalette { get { if (_foregroundPalette == null) { //_foregroundPalette = PageForm.Children.FirstOrDefault(x => x is XYZ); } return _foregroundPalette; } } #endregion ForegroundPalette #region ForegroundPixelMap private GPixmap _foregroundPixelMap; /// <summary> /// Gets the pixel map for the foreground /// </summary> public GPixmap ForegroundPixelMap { get { if (_foregroundPixelMap == null) { _foregroundPixelMap = ForegroundIWPixelMap.GetPixmap(); } return _foregroundPixelMap; } } #endregion ForegroundPixelMap #region IsPageImageCached private bool _isPageImageCached; /// <summary> /// True if the page image is cached, false otherwise /// </summary> public bool IsPageImageCached { get { return _isPageImageCached; } set { if (IsPageImageCached != value) { _isPageImageCached = value; _image = null; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("IsPageImageCached")); //OnPropertyChanged("IsPageImageCached"); } } } #endregion IsPageImageCached #region Image private System.Drawing.Bitmap _image; /// <summary> /// Gets the image for the page /// </summary> public System.Drawing.Bitmap Image { get { if (_image == null) { _image = BuildImage(); } return _image; } private set { _image = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Image")); } } #endregion Image #region IsInverted private bool _isInverted; /// <summary> /// True if the image is inverted, false otherwise /// </summary> public bool IsInverted { get { return _isInverted; } set { if (IsInverted != value) { _isInverted = value; ClearImage(); ThumbnailImage = InvertImage(ThumbnailImage); } } } #endregion IsInverted #region ThumbnailImage private System.Drawing.Bitmap _thumbnailImage; /// <summary> /// Gets or sets the thumbnail image for the page /// </summary> public System.Drawing.Bitmap ThumbnailImage { get { return _thumbnailImage; } set { if (ThumbnailImage != value) { _thumbnailImage = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("ThumbnailImage")); //OnPropertyChanged("ThumbnailImage"); } } } #endregion ThumbnailImage #region PageNumber private int _pageNumber; /// <summary> /// Gets the number of the page /// </summary> public int PageNumber { get { return _pageNumber; } private set { if (PageNumber != value) { _pageNumber = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("PageNumber")); //OnPropertyChanged("PageNumber"); } } } #endregion PageNumber #region IsColor /// <summary> /// True if this is photo or compound /// </summary> public bool IsColor { get { return IsLegalCompound() || IsLegalBilevel(); } } #endregion IsColor #endregion Public Properties #region Constructors public DjvuPage(int pageNumber, DjvuDocument document, DirmComponent header, TH44Chunk thumbnail, DjviChunk[] includedItems, FormChunk form) { PageNumber = pageNumber; Document = document; Header = header; Thumbnail = thumbnail; IncludedItems = includedItems; PageForm = form; } #endregion Constructors #region Public Methods /// <summary> /// Preloads the page /// </summary> public void Preload() { lock (_loadingLock) { if (_hasLoaded == false) { // Build all the images GetBackgroundImage(1, true); GetForegroundImage(1, true); GetTextImage(1, true); _hasLoaded = true; } } } /// <summary> /// Gets the text for the rectangle location /// </summary> /// <param name="rect"></param> /// <returns></returns> public string GetTextForLocation(Rectangle rect) { if (Text == null || Text.Zone == null) return ""; StringBuilder text = new StringBuilder(); TextZone[] textItems = Text.Zone.OrientedSearchForText(rect, Height); TextZone currentParent = null; foreach (TextZone item in textItems) { if (currentParent != item.Parent) { text.AppendLine(); currentParent = item.Parent; } if (item.Parent == currentParent) { text.Append(item.Text + " "); } } return text.ToString().Trim(); } /// <summary> /// Clears the stored image from memory /// </summary> public void ClearImage() { IsPageImageCached = false; if (_image != null) { _image.Dispose(); _image = null; } } /// <summary> /// Resizes the image to the new dimensions /// </summary> /// <param name="srcImage"></param> /// <param name="newWidth"></param> /// <param name="newHeight"></param> /// <returns></returns> public System.Drawing.Bitmap ResizeImage(System.Drawing.Bitmap srcImage, int newWidth, int newHeight) { // Check if the image needs resizing if (srcImage.Width == newWidth && srcImage.Height == newHeight) { return srcImage; } // Resize the image System.Drawing.Bitmap newImage = new System.Drawing.Bitmap(newWidth, newHeight); using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(newImage)) { gr.SmoothingMode = SmoothingMode.HighQuality; gr.InterpolationMode = InterpolationMode.HighQualityBicubic; gr.PixelOffsetMode = PixelOffsetMode.HighQuality; gr.DrawImage(srcImage, new System.Drawing.Rectangle(0, 0, newWidth, newHeight)); } srcImage.Dispose(); return newImage; } /// <summary> /// Resizes the pages image to the new dimensions /// </summary> /// <param name="srcImage"></param> /// <param name="newWidth"></param> /// <param name="newHeight"></param> /// <returns></returns> public System.Drawing.Bitmap ResizeImage(int newWidth, int newHeight) { return ResizeImage(Image, newWidth, newHeight); } /// <summary> /// Extracts a thumbnail image for the page /// </summary> /// <returns></returns> public System.Drawing.Bitmap ExtractThumbnailImage() { if (Thumbnail != null) { return Thumbnail.Image; } var result = BuildImage(); var scaleAmount = (double)128 / result.Width; result = ResizeImage(result, (int)(result.Width * scaleAmount), (int)(result.Height * scaleAmount)); return result; } /// <summary> /// Gets the background pixmap /// </summary> /// <param name="rect"></param> /// <param name="subSample"></param> /// <param name="gamma"></param> /// <param name="retval"></param> /// <returns></returns> public GPixmap GetBgPixmap(GRect rect, int subsample, double gamma, GPixmap retval) { GPixmap pm = null; int width = (Info == null) ? 0 : Info.Width; int height = (Info == null) ? 0 : Info.Height; if ((width <= 0) || (height <= 0) || (Info == null)) { return null; } double gamma_correction = 1.0D; if ((gamma > 0.0D) && (Info != null)) { gamma_correction = gamma / Info.Gamma; } if (gamma_correction < 0.10000000000000001D) { gamma_correction = 0.10000000000000001D; } else if (gamma_correction > 10D) { gamma_correction = 10D; } IWPixelMap bgIWPixmap = BackgroundIWPixelMap; if (bgIWPixmap != null) { int w = bgIWPixmap.Width; int h = bgIWPixmap.Height; if ((w == 0) || (h == 0) || (width == 0) || (height == 0)) { return null; } int red = ComputeRed(width, height, w, h); if ((red < 1) || (red > 12)) { return null; } if (subsample == red) { pm = bgIWPixmap.GetPixmap(1, rect, retval); } else if (subsample == (2 * red)) { pm = bgIWPixmap.GetPixmap(2, rect, retval); } else if (subsample == (4 * red)) { pm = bgIWPixmap.GetPixmap(4, rect, retval); } else if (subsample == (8 * red)) { pm = bgIWPixmap.GetPixmap(8, rect, retval); } else if ((red * 4) == (subsample * 3)) { GRect xrect = new GRect(); xrect.Right = (int)Math.Floor(rect.Right * 4D / 3D); xrect.Bottom = (int)Math.Floor(rect.Bottom * 4D / 3D); xrect.Left = (int)Math.Ceiling((double)rect.Left * 4D / 3D); xrect.Top = (int)Math.Ceiling((double)rect.Top * 4D / 3D); GRect nrect = new GRect(0, 0, rect.Width, rect.Height); if (xrect.Left > w) { xrect.Left = w; } if (xrect.Top > h) { xrect.Top = h; } GPixmap ipm = bgIWPixmap.GetPixmap(1, xrect, null); pm = (retval != null) ? retval : new GPixmap(); pm.Downsample43(ipm, nrect); } else { int po2 = 16; while ((po2 > 1) && (subsample < (po2 * red))) { po2 >>= 1; } int inw = ((w + po2) - 1) / po2; int inh = ((h + po2) - 1) / po2; int outw = ((width + subsample) - 1) / subsample; int outh = ((height + subsample) - 1) / subsample; PixelMapScaler ps = new PixelMapScaler(inw, inh, outw, outh); ps.SetHorzRatio(red * po2, subsample); ps.SetVertRatio(red * po2, subsample); GRect xrect = ps.GetRequiredRect(rect); GPixmap ipm = bgIWPixmap.GetPixmap(po2, xrect, null); pm = (retval != null) ? retval : new GPixmap(); ps.Scale(xrect, ipm, rect, pm); } if ((pm != null) && (gamma_correction != 1.0D)) { pm.ApplyGammaCorrection(gamma_correction); for (int i = 0; i < 9; i++) { pm.ApplyGammaCorrection(gamma_correction); } } return pm; } else { return null; } } public Graphics.Bitmap BuildBitmap(Graphics.Rectangle rect, int subsample, int align, Bitmap retVal) { return GetBitmap(rect, subsample, align, null); } public GPixmap GetPixelMap(GRect rect, int subsample, double gamma, PixelMap retval) { if (rect.Empty) { return (retval == null) ? (new PixelMap()) : retval.Init(0, 0, null); } GPixmap bg = GetBgPixmap(rect, subsample, gamma, retval); if (ForegroundJB2Image != null) { if (bg == null) { bg = (retval == null) ? new PixelMap() : retval; bg.Init( rect.Height, rect.Width, GPixel.WhitePixel); } if (Stencil(bg, rect, subsample, gamma)) { retval = bg; } } else { retval = bg; } return retval; } /// <summary> /// Gets a complete image for the page /// </summary> /// <returns></returns> public System.Drawing.Bitmap BuildPageImage() { throw new NotImplementedException(); /*int subsample = 1; if (this.Info == null && Document.FormChunk.Children[0].ChunkID == "DJVU" && Document.FormChunk.Children[1] is InfoChunk) this._info = (InfoChunk)Document.FormChunk.Children[1]; int width = Info.Width / subsample; int height = Info.Height / subsample; var map = GetMap(new GRect(0, 0, width, height), subsample, null); if (map == null) return new Bitmap(Info.Width, Info.Height); int[] pixels = new int[width * height]; map.FillRgbPixels(0, 0, width, height, pixels, 0, width); var image = ConvertDataToImage(pixels); if (IsInverted == true) { image = InvertImage(image); } return image;*/ } /// <summary> /// Gets the image for the page /// </summary> /// <returns></returns> public System.Drawing.Bitmap BuildImage(int subsample = 1) { lock (_loadingLock) { DateTime start = DateTime.Now; System.Drawing.Bitmap background = GetBackgroundImage(subsample, false); Console.WriteLine("Background: " + DateTime.Now.Subtract(start).TotalMilliseconds); start = DateTime.Now; using (System.Drawing.Bitmap _foreground = GetForegroundImage(subsample, false)) { Console.WriteLine("Foreground: " + DateTime.Now.Subtract(start).TotalMilliseconds); start = DateTime.Now; using (System.Drawing.Bitmap mask = GetTextImage(subsample, false)) { Console.WriteLine("Mask: " + DateTime.Now.Subtract(start).TotalMilliseconds); start = DateTime.Now; _hasLoaded = true; BitmapData backgroundData = background.LockBits(new System.Drawing.Rectangle(0, 0, background.Width, background.Height), ImageLockMode.ReadWrite, background.PixelFormat); int backgroundPixelSize = GetPixelSize(backgroundData); Bitmap foreground = null; if (_foreground.Height != background.Height || _foreground.Width!= background.Width) { foreground = new Bitmap(background.Width, background.Height); System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(foreground); gr.DrawImage(_foreground, new Rectangle(0, 0, background.Width, background.Height), new Rectangle(0, 0, _foreground.Width, _foreground.Height), GraphicsUnit.Pixel); } else { foreground = _foreground; } BitmapData foregroundData = foreground.LockBits(new System.Drawing.Rectangle(0, 0, foreground.Width, foreground.Height), ImageLockMode.ReadOnly, foreground.PixelFormat); int foregroundPixelSize = GetPixelSize(foregroundData); BitmapData maskData = mask.LockBits(new System.Drawing.Rectangle(0, 0, mask.Width, mask.Height), ImageLockMode.ReadOnly, mask.PixelFormat); if (backgroundData.Height != foregroundData.Height) { throw new ArgumentException("foreground height!=background height"); } int size = backgroundData.Stride * backgroundData.Height; byte[] data = new byte[size]; int fsize = foregroundData.Stride * foregroundData.Height; byte[] fdata = new byte[fsize]; System.Runtime.InteropServices.Marshal.Copy(foregroundData.Scan0, fdata, 0, fsize); int msize = maskData.Stride * maskData.Height; byte[] mdata = new byte[msize]; System.Runtime.InteropServices.Marshal.Copy(maskData.Scan0, mdata, 0, msize); //int maskPixelSize = GetPixelSize(maskData); int height = background.Height; int width = background.Width; var bpxsz = Bitmap.GetPixelFormatSize(background.PixelFormat) / 8; var frsz = Bitmap.GetPixelFormatSize(foreground.PixelFormat) / 8; var msksz = Bitmap.GetPixelFormatSize(mask.PixelFormat) / 8; for (int y = 0; y < height; y++) { byte maskRow = mdata[y * maskData.Stride]; int mult = y * backgroundData.Stride; int fmult = y * foregroundData.Stride; for (int x = 0; x < width; x++) { // Check if the mask byte is set maskRow = mdata[y * maskData.Stride + x * msksz]; if (maskRow > 0) { var flag = _isInverted == true; var b1 = BitConverter.ToUInt32(fdata, fmult + x * frsz); var b2 = InvertColor(b1); var b3 = flag ? b2 : b1; for (int i = 0; i < frsz; i++) { data[mult + x * bpxsz + i] = (byte)((b3 & (0xff << (i * 8))) >> (i * 8)); } var res = BitConverter.ToUInt32(data, mult + x * bpxsz); } else if (_isInverted == true) { var b2 = InvertColor(BitConverter.ToInt32(data, mult + x * bpxsz)); for (int i = 0; i < frsz; i++) { data[mult + x * bpxsz + i] = (byte)((b2 & (0xff << (i * 8))) >> (i * 8)); } } } } System.Runtime.InteropServices.Marshal.Copy(data, 0, backgroundData.Scan0, data.Length); mask.UnlockBits(maskData); foreground.UnlockBits(foregroundData); background.UnlockBits(backgroundData); return background; } } } } public GBitmap GetBitmap(GRect rect, int subsample, int align, GBitmap retval) { return GetBitmapList(rect, 1, 1, null); } public GBitmap GetBitmapList(GRect rect, int subsample, int align, List<int> components) { if (rect.Empty) { return new Graphics.Bitmap(); } if (Info != null) { int width = Info.Width; int height = Info.Height; JB2Image fgJb2 = ForegroundJB2Image; if ( (width != 0) && (height != 0) && (fgJb2 != null) && (fgJb2.Width == width) && (fgJb2.Height == height)) { return fgJb2.GetBitmap(rect, subsample, align, 0, components); } } return null; } public Map GetMap(GRect segment, int subsample, GMap retval) { retval = IsColor ? (GMap)GetPixelMap( segment, subsample, 0.0D, (retval is GPixmap) ? (GPixmap)retval : null) : (GMap)GetBitmap( segment, subsample, 1, ((retval is GBitmap) ? (GBitmap)retval : null)); return retval; } #endregion Public Methods #region Private Methods /// <summary> /// Converts the pixel data to a bitmap image /// </summary> /// <param name="pixels"></param> /// <returns></returns> private System.Drawing.Bitmap ConvertDataToImage(int[] pixels) { throw new NotImplementedException(); /*// create a bitmap and manipulate it System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Info.Width, Info.Height, PixelFormat.Format32bppArgb); BitmapData bits = bmp.LockBits(new System.Drawing.Rectangle(0, 0, Info.Width, Info.Height), ImageLockMode.ReadWrite, bmp.PixelFormat); for (int y = 0; y < Info.Height; y++) { var row = (int*)((byte*)bits.Scan0 + (y * bits.Stride)); for (int x = 0; x < Info.Width; x++) { row[x] = pixels[y * Info.Width + x]; } } bmp.UnlockBits(bits); return bmp;*/ } private bool IsLegalBilevel() { if (Info == null) { return false; } int width = Info.Width; int height = Info.Height; if ((width <= 0) || (height <= 0)) { return false; } JB2Image fgJb2 = ForegroundJB2Image; if ((fgJb2 == null) || (fgJb2.Width != width) || (fgJb2.Height != height)) { return false; } return !(BackgroundIWPixelMap != null || ForegroundIWPixelMap != null || ForegroundPalette != null); } private bool IsLegalCompound() { if (Info == null) { return false; } int width = Info.Width; int height = Info.Height; if ((width <= 0) || (height <= 0)) { return false; } JB2Image fgJb2 = ForegroundJB2Image; if ((fgJb2 == null) || (fgJb2.Width != width) || (fgJb2.Height != height)) { return false; } // There is no need to synchronize since we won't access data which could be updated. IWPixelMap bgIWPixmap = (IWPixelMap)BackgroundIWPixelMap; int bgred = 0; if (bgIWPixmap != null) { bgred = ComputeRed( width, height, bgIWPixmap.Width, bgIWPixmap.Height); } if ((bgred < 1) || (bgred > 12)) { return false; } int fgred = 0; if (ForegroundIWPixelMap != null) { GPixmap fgPixmap = ForegroundPixelMap; fgred = ComputeRed( width, height, fgPixmap.ImageWidth, fgPixmap.ImageHeight); } return ((fgred >= 1) && (fgred <= 12)); } private bool Stencil(PixelMap pm, Graphics.Rectangle rect, int subsample, double gamma) { if (Info == null) { return false; } int width = Info.Width; int height = Info.Height; if ((width <= 0) || (height <= 0)) { return false; } double gamma_correction = 1.0D; if (gamma > 0.0D) { gamma_correction = gamma / Info.Gamma; } if (gamma_correction < 0.10000000000000001D) { gamma_correction = 0.10000000000000001D; } else if (gamma_correction > 10D) { gamma_correction = 10D; } JB2Image fgJb2 = ForegroundJB2Image; if (fgJb2 != null) { ColorPalette fgPalette = ForegroundPalette; if (fgPalette != null) { List<int> components = new List<int>(); GBitmap bm = GetBitmapList(rect, subsample, 1, components); if (fgJb2.Blits.Count != fgPalette.BlitColors.Length) { pm.Attenuate(bm, 0, 0); return false; } GPixmap colors = new GPixmap().Init( 1, fgPalette.PaletteColors.Length, null); GPixelReference color = colors.CreateGPixelReference(0); for (int i = 0; i < colors.ImageWidth; color.IncOffset()) { fgPalette.index_to_color(i++, color); } colors.ApplyGammaCorrection(gamma_correction); List<int> compset = new List<int>(); while (components.Count > 0) { int lastx = 0; int colorindex = fgPalette.BlitColors[((int)components[0])]; GRect comprect = new GRect(); compset = new List<int>(); for (int pos = 0; pos < components.Count;) { int blitno = ((int)components[pos]); JB2Blit pblit = fgJb2.Blits[blitno]; if (pblit.Left < lastx) { break; } lastx = pblit.Left; if (fgPalette.BlitColors[blitno] == colorindex) { JB2Shape pshape = fgJb2.GetShape(pblit.ShapeNumber); GRect xrect = new GRect( pblit.Left, pblit.Bottom, pshape.Bitmap.ImageWidth, pshape.Bitmap.ImageHeight); comprect.Recthull(comprect, xrect); compset.Add(components[pos]); components.Remove(pos); } else { pos++; } } comprect.XMin /= subsample; comprect.YMin /= subsample; comprect.XMax = ((comprect.XMax + subsample) - 1) / subsample; comprect.YMax = ((comprect.YMax + subsample) - 1) / subsample; comprect.Intersect(comprect, rect); if (comprect.Empty) { continue; } // bm = getBitmap(comprect, subsample, 1); bm = new GBitmap(); bm.Init( comprect.Height, comprect.Width, 0); bm.Grays = 1 + (subsample * subsample); int rxmin = comprect.XMin * subsample; int rymin = comprect.YMin * subsample; for (int pos = 0; pos < compset.Count; ++pos) { int blitno = ((int)compset[pos]); JB2Blit pblit = fgJb2.Blits[blitno]; JB2Shape pshape = fgJb2.GetShape(pblit.ShapeNumber); bm.Blit( pshape.Bitmap, pblit.Left - rxmin, pblit.Bottom - rymin, subsample); } color.SetOffset(colorindex); pm.Blit( bm, comprect.XMin - rect.XMin, comprect.YMin - rect.YMin, color); } return true; } // Three layer model. IWPixelMap fgIWPixmap = ForegroundIWPixelMap; if (fgIWPixmap != null) { GBitmap bm = GetBitmap(rect, subsample, 1, null); if ((bm != null) && (pm != null)) { GPixmap fgPixmap = ForegroundPixelMap; int w = fgPixmap.ImageWidth; int h = fgPixmap.ImageHeight; int red = ComputeRed(width, height, w, h); // if((red < 1) || (red > 12)) if ((red < 1) || (red > 16)) { return false; } // // int supersample = (red <= subsample) // ? 1 // : (red / subsample); // int wantedred = supersample * subsample; // // if(red == wantedred) // { // pm.stencil(bm, fgPixmap, supersample, rect, gamma_correction); // // return 1; // } pm.Stencil(bm, fgPixmap, red, subsample, rect, gamma_correction); return true; } } } return false; } private int ComputeRed(int w, int h, int rw, int rh) { for (int red = 1; red < 16; red++) { if (((((w + red) - 1) / red) == rw) && ((((h + red) - 1) / red) == rh)) { return red; } } return 16; } private System.Drawing.Bitmap InvertImage(System.Drawing.Bitmap invertImage) { return null; //if (invertImage == null) //{ // return null; //} //var image = (System.Drawing.Bitmap)invertImage.Clone(); //BitmapData imageData = image.LockBits(new System.Drawing.Rectangle(0, 0, image.Width, image.Height), // ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); //int height = image.Height; //int width = image.Width; //Parallel.For( // 0, // height, // y => // { // uint* imageRow = (uint*)(imageData.Scan0 + (y * imageData.Stride)); // for (int x = 0; x < width; x++) // { // // Check if the mask byte is set // imageRow[x] = InvertColor(imageRow[x]); // } // }); //image.UnlockBits(imageData); //return image; } /// <summary> /// Inverts the color value /// </summary> /// <param name="color"></param> /// <returns></returns> private uint InvertColor(uint color) { return 0x00FFFFFFu ^ color; } /// <summary> /// Inverts the color value /// </summary> /// <param name="color"></param> /// <returns></returns> private int InvertColor(int color) { return 0x00FFFFFF ^ color; } /// <summary> /// Gets the pixel size for the pixel data /// </summary> /// <param name="data"></param> /// <returns></returns> private int GetPixelSize(BitmapData data) { if (data.PixelFormat == PixelFormat.Format8bppIndexed) { return 1; } if (data.PixelFormat == PixelFormat.Format16bppGrayScale || data.PixelFormat == PixelFormat.Format16bppRgb555 || data.PixelFormat == PixelFormat.Format16bppRgb565 || data.PixelFormat == PixelFormat.Format16bppArgb1555) { return 2; } if (data.PixelFormat == PixelFormat.Format24bppRgb) { return 3; } if (data.PixelFormat == PixelFormat.Format32bppArgb || data.PixelFormat == PixelFormat.Format32bppArgb || data.PixelFormat == PixelFormat.Format32bppPArgb || data.PixelFormat == PixelFormat.Format32bppRgb) { return 4; } throw new Exception("Unknown image format: " + data.PixelFormat); } /// <summary> /// Gets the foreground image for the page /// </summary> /// <param name="resizeToPage"></param> /// <returns></returns> private System.Drawing.Bitmap GetForegroundImage(int subsample, bool resizeImage = false) { lock (_loadingLock) { var result = ForegroundIWPixelMap == null ? CreateBlankImage(Brushes.Black, Info.Width / subsample, Info.Height / subsample) : ForegroundIWPixelMap.GetPixmap().ToImage(); return resizeImage == true ? ResizeImage(result, Info.Width / subsample, Info.Height / subsample) : result; } } private System.Drawing.Bitmap GetTextImage(int subsample, bool resizeImage = false) { if (ForegroundJB2Image == null) { return new System.Drawing.Bitmap(Info.Width / subsample, Info.Height / subsample); } lock (_loadingLock) { var result = ForegroundJB2Image.GetBitmap(subsample, 4).ToImage(); return resizeImage == true ? ResizeImage(result, Info.Width / subsample, Info.Height / subsample) : result; } } /// <summary> /// Gets the background image for the page /// </summary> /// <returns></returns> private System.Drawing.Bitmap GetBackgroundImage(int subsample, bool resizeImage = false) { BG44Chunk[] backgrounds = PageForm.GetChildrenItems<BG44Chunk>(); if (backgrounds == null || backgrounds.Count() == 0) { return CreateBlankImage(Brushes.White, Info.Width, Info.Height); } // Get the composite background image Wavelet.IWPixelMap backgroundMap = null; lock (_loadingLock) { foreach (var background in backgrounds) { if (backgroundMap == null) { // Get the initial image backgroundMap = background.BackgroundImage; } else { if (_isBackgroundDecoded == false) { background.ProgressiveDecodeBackground(backgroundMap); } } } _isBackgroundDecoded = true; } Bitmap result = backgroundMap.GetPixmap().ToImage(); return resizeImage == true ? ResizeImage(result, Info.Width / subsample, Info.Height / subsample) : result; } /// <summary> /// Creates a blank image with the given color /// </summary> /// <param name="imageColor"></param> /// <returns></returns> private System.Drawing.Bitmap CreateBlankImage(Brush imageColor, int width, int height) { System.Drawing.Bitmap newBackground = new System.Drawing.Bitmap(Info.Width, Info.Height); // Fill the whole image with white using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(newBackground)) { g.FillRegion(imageColor, new Region(new System.Drawing.Rectangle(0, 0, width, height))); } return newBackground; } #endregion Private Methods } }
30.775394
217
0.43572
[ "MIT" ]
fel88/CommonLibs
DjvuNet/DjvuPage.cs
48,781
C#
//------------------------------------------------------------------------------ // This code was generated by a tool. // // Tool : Bond Compiler 0.4.1.0 // File : EventData_types.cs // // Changes to this file may cause incorrect behavior and will be lost when // the code is regenerated. // <auto-generated /> //------------------------------------------------------------------------------ // suppress "Missing XML comment for publicly visible type or member" #pragma warning disable 1591 #region ReSharper warnings // ReSharper disable PartialTypeWithSinglePart // ReSharper disable RedundantNameQualifier // ReSharper disable InconsistentNaming // ReSharper disable CheckNamespace // ReSharper disable UnusedParameter.Local // ReSharper disable RedundantUsingDirective #endregion namespace Microsoft.ApplicationInsights.Extensibility.Implementation.External { using System.Collections.Concurrent; using System.Collections.Generic; [System.CodeDom.Compiler.GeneratedCode("gbc", "0.4.1.0")] internal partial class EventData : Domain { public int ver { get; set; } public string name { get; set; } public IDictionary<string, string> properties { get; set; } public EventData() : this("AI.EventData", "EventData") {} protected EventData(string fullName, string name) { ver = 2; this.name = ""; properties = new ConcurrentDictionary<string, string>(); } } } // AI
23.222222
80
0.552033
[ "MIT" ]
304NotModified/ApplicationInsights-dotnet
BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/External/EventData_types.cs
1,672
C#
// Copyright (c) 2021 - for information on the respective copyright owner // see the NOTICE file and/or the repository github.com/boschresearch/assets2036net. // // SPDX-License-Identifier: Apache-2.0 using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; using Xunit; namespace assets2036net.unittests { public class Events: UnitTestBase { [Fact] public void EventWithComplexParameters() { string location = this.GetType().Assembly.Location; location = Path.GetDirectoryName(location); location = Path.Combine(location, "resources/events.json"); Uri uri = new Uri(location); AssetMgr mgrOwner = new AssetMgr(Settings.BrokerHost, Settings.BrokerPort, Settings.RootTopic, Settings.EndpointName); AssetMgr mgrConsumer = new AssetMgr(Settings.BrokerHost, Settings.BrokerPort, Settings.RootTopic, Settings.EndpointName); Asset assetOwner = mgrOwner.CreateAsset(Settings.RootTopic, "EventWithComplexParameters", uri); Asset assetConsumer = mgrConsumer.CreateAssetProxy(Settings.RootTopic, "EventWithComplexParameters", uri); // bind local eventlistener to event assetConsumer.Submodel("events").Event("anevent").Emission += this.handleEvent; this.a = null; this.b = null; this.c = null; object a = "Parameter_a"; object b = "Parameter_b"; object c = new Newtonsoft.Json.Linq.JObject() { {"eins", 1 }, {"zwei", 2 }, {"drei", 3 }, {"vier", "4" } }; Thread.Sleep(1000); assetOwner.Submodel("events").Event("anevent").Emit(new Dictionary<string, object>() { {"aaa", a }, {"bbb", b }, {"objectparameter", c } }); //Thread.Sleep(Settings.WaitTime); Assert.True(waitForCondition(() => { return a.Equals(this.a); }, Settings.WaitTime)); Assert.True(waitForCondition(() => { return b.Equals(this.b); }, Settings.WaitTime)); Assert.True(waitForCondition(() => { if (this.c == null) { return false; } return c.ToString().Equals(this.c.ToString()); }, Settings.WaitTime)); } object a = null; object b = null; object c = null; private void handleEvent(SubmodelEventMessage emission) { this.a = emission.Parameters["aaa"]; this.b = emission.Parameters["bbb"]; this.c = emission.Parameters["objectparameter"]; } } }
31.301075
133
0.549983
[ "Apache-2.0" ]
boschresearch/assets2036net
assets2036net.unittests/Events.cs
2,913
C#
/* * Influx API Service * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * OpenAPI spec version: 0.1.0 * * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Linq; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using OpenAPIDateConverter = InfluxDB.Client.Api.Client.OpenAPIDateConverter; namespace InfluxDB.Client.Api.Domain { /// <summary> /// ConstantVariableProperties /// </summary> [DataContract] public partial class ConstantVariableProperties : VariableProperties, IEquatable<ConstantVariableProperties> { /// <summary> /// Defines Type /// </summary> [JsonConverter(typeof(StringEnumConverter))] public enum TypeEnum { /// <summary> /// Enum Constant for value: constant /// </summary> [EnumMember(Value = "constant")] Constant = 1 } /// <summary> /// Gets or Sets Type /// </summary> [DataMember(Name="type", EmitDefaultValue=false)] public TypeEnum? Type { get; set; } /// <summary> /// Initializes a new instance of the <see cref="ConstantVariableProperties" /> class. /// </summary> /// <param name="type">type.</param> /// <param name="values">values.</param> public ConstantVariableProperties(TypeEnum? type = default(TypeEnum?), List<string> values = default(List<string>)) : base() { this.Type = type; this.Values = values; } /// <summary> /// Gets or Sets Values /// </summary> [DataMember(Name="values", EmitDefaultValue=false)] public List<string> Values { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class ConstantVariableProperties {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Type: ").Append(Type).Append("\n"); sb.Append(" Values: ").Append(Values).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public override string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="input">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object input) { return this.Equals(input as ConstantVariableProperties); } /// <summary> /// Returns true if ConstantVariableProperties instances are equal /// </summary> /// <param name="input">Instance of ConstantVariableProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ConstantVariableProperties input) { if (input == null) return false; return base.Equals(input) && ( this.Type == input.Type || (this.Type != null && this.Type.Equals(input.Type)) ) && base.Equals(input) && ( this.Values == input.Values || this.Values != null && this.Values.SequenceEqual(input.Values) ); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); if (this.Type != null) hashCode = hashCode * 59 + this.Type.GetHashCode(); if (this.Values != null) hashCode = hashCode * 59 + this.Values.GetHashCode(); return hashCode; } } } }
32.294521
132
0.551856
[ "MIT" ]
BigHam/influxdb-client-csharp
Client/InfluxDB.Client.Api/Domain/ConstantVariableProperties.cs
4,715
C#
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net; using System.Net.Http; using System.Threading; using Newtonsoft.Json; using System.Threading.Tasks; using System.Net.Http.Headers; using System.Linq; using System.Security.Cryptography.X509Certificates; #if !(CORECLR || PORTABLE || PORTABLE40) using System.Security.Permissions; using System.Runtime.Serialization; #endif namespace Consul { /// <summary> /// Represents errors that occur while sending data to or fetching data from the Consul agent. /// </summary> #if !(CORECLR || PORTABLE || PORTABLE40) [Serializable] #endif public class ConsulRequestException : Exception { public HttpStatusCode StatusCode { get; set; } public ConsulRequestException() { } public ConsulRequestException(string message, HttpStatusCode statusCode) : base(message) { StatusCode = statusCode; } public ConsulRequestException(string message, HttpStatusCode statusCode, Exception inner) : base(message, inner) { StatusCode = statusCode; } #if !(CORECLR || PORTABLE || PORTABLE40) protected ConsulRequestException( SerializationInfo info, StreamingContext context) : base(info, context) { } [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("StatusCode", StatusCode); } #endif } /// <summary> /// Represents errors that occur during initalization of the Consul client's configuration. /// </summary> #if !(CORECLR || PORTABLE || PORTABLE40) [Serializable] #endif public class ConsulConfigurationException : Exception { public ConsulConfigurationException() { } public ConsulConfigurationException(string message) : base(message) { } public ConsulConfigurationException(string message, Exception inner) : base(message, inner) { } #if !(CORECLR || PORTABLE || PORTABLE40) protected ConsulConfigurationException( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } #endif } /// <summary> /// Represents the configuration options for a Consul client. /// </summary> public class ConsulClientConfiguration { private NetworkCredential _httpauth; private bool _disableServerCertificateValidation; private X509Certificate2 _clientCertificate; internal event EventHandler Updated; internal static Lazy<bool> _clientCertSupport = new Lazy<bool>(() => { return Type.GetType("Mono.Runtime") == null; }); internal bool ClientCertificateSupported { get { return _clientCertSupport.Value; } } #if CORECLR [Obsolete("Use of DisableServerCertificateValidation should be converted to setting the HttpHandler's ServerCertificateCustomValidationCallback in the ConsulClient constructor" + "This property will be removed when 0.8.0 is released.", false)] #else [Obsolete("Use of DisableServerCertificateValidation should be converted to setting the WebRequestHandler's ServerCertificateValidationCallback in the ConsulClient constructor" + "This property will be removed when 0.8.0 is released.", false)] #endif internal bool DisableServerCertificateValidation { get { return _disableServerCertificateValidation; } set { _disableServerCertificateValidation = value; OnUpdated(new EventArgs()); } } /// <summary> /// The Uri to connect to the Consul agent. /// </summary> public Uri Address { get; set; } /// <summary> /// Datacenter to provide with each request. If not provided, the default agent datacenter is used. /// </summary> public string Datacenter { get; set; } /// <summary> /// Credentials to use for access to the HTTP API. /// This is only needed if an authenticating service exists in front of Consul; Token is used for ACL authentication by Consul. /// </summary> #if CORECLR [Obsolete("Use of HttpAuth should be converted to setting the HttpHandler's Credential property in the ConsulClient constructor" + "This property will be removed when 0.8.0 is released.", false)] #else [Obsolete("Use of HttpAuth should be converted to setting the WebRequestHandler's Credential property in the ConsulClient constructor" + "This property will be removed when 0.8.0 is released.", false)] #endif public NetworkCredential HttpAuth { internal get { return _httpauth; } set { _httpauth = value; OnUpdated(new EventArgs()); } } /// <summary> /// TLS Client Certificate used to secure a connection to a Consul agent. Not supported on Mono. /// This is only needed if an authenticating service exists in front of Consul; Token is used for ACL authentication by Consul. This is not the same as RPC Encryption with TLS certificates. /// </summary> /// <exception cref="PlatformNotSupportedException">Setting this property will throw a PlatformNotSupportedException on Mono</exception> #if __MonoCS__ [Obsolete("Client Certificates are not implemented in Mono", true)] #elif CORECLR [Obsolete("Use of ClientCertificate should be converted to adding to the HttpHandler's ClientCertificates list in the ConsulClient constructor." + "This property will be removed when 0.8.0 is released.", false)] #else [Obsolete("Use of ClientCertificate should be converted to adding to the WebRequestHandler's ClientCertificates list in the ConsulClient constructor." + "This property will be removed when 0.8.0 is released.", false)] #endif public X509Certificate2 ClientCertificate { internal get { return _clientCertificate; } set { if (!ClientCertificateSupported) { throw new PlatformNotSupportedException("Client certificates are not supported on this platform"); } _clientCertificate = value; OnUpdated(new EventArgs()); } } /// <summary> /// Token is used to provide an ACL token which overrides the agent's default token. This ACL token is used for every request by /// clients created using this configuration. /// </summary> public string Token { get; set; } /// <summary> /// WaitTime limits how long a Watch will block. If not provided, the agent default values will be used. /// </summary> public TimeSpan? WaitTime { get; set; } /// <summary> /// Creates a new instance of a Consul client configuration. /// </summary> /// <exception cref="ConsulConfigurationException">An error that occured while building the configuration.</exception> public ConsulClientConfiguration() { UriBuilder consulAddress = new UriBuilder("http://127.0.0.1:8500"); ConfigureFromEnvironment(consulAddress); Address = consulAddress.Uri; } /// <summary> /// Builds configuration based on environment variables. /// </summary> /// <exception cref="ConsulConfigurationException">An environment variable could not be parsed</exception> private void ConfigureFromEnvironment(UriBuilder consulAddress) { var envAddr = (Environment.GetEnvironmentVariable("CONSUL_HTTP_ADDR") ?? string.Empty).Trim().ToLowerInvariant(); if (!string.IsNullOrEmpty(envAddr)) { var addrParts = envAddr.Split(':'); for (int i = 0; i < addrParts.Length; i++) { addrParts[i] = addrParts[i].Trim(); } if (!string.IsNullOrEmpty(addrParts[0])) { consulAddress.Host = addrParts[0]; } if (addrParts.Length > 1 && !string.IsNullOrEmpty(addrParts[1])) { try { consulAddress.Port = ushort.Parse(addrParts[1]); } catch (Exception ex) { throw new ConsulConfigurationException("Failed parsing port from environment variable CONSUL_HTTP_ADDR", ex); } } } var useSsl = (Environment.GetEnvironmentVariable("CONSUL_HTTP_SSL") ?? string.Empty).Trim().ToLowerInvariant(); if (!string.IsNullOrEmpty(useSsl)) { try { if (useSsl == "1" || bool.Parse(useSsl)) { consulAddress.Scheme = "https"; } } catch (Exception ex) { throw new ConsulConfigurationException("Could not parse environment variable CONSUL_HTTP_SSL", ex); } } var verifySsl = (Environment.GetEnvironmentVariable("CONSUL_HTTP_SSL_VERIFY") ?? string.Empty).Trim().ToLowerInvariant(); if (!string.IsNullOrEmpty(verifySsl)) { try { if (verifySsl == "0" || bool.Parse(verifySsl)) { #pragma warning disable CS0618 // Type or member is obsolete DisableServerCertificateValidation = true; #pragma warning restore CS0618 // Type or member is obsolete } } catch (Exception ex) { throw new ConsulConfigurationException("Could not parse environment variable CONSUL_HTTP_SSL_VERIFY", ex); } } var auth = Environment.GetEnvironmentVariable("CONSUL_HTTP_AUTH"); if (!string.IsNullOrEmpty(auth)) { var credential = new NetworkCredential(); if (auth.Contains(":")) { var split = auth.Split(':'); credential.UserName = split[0]; credential.Password = split[1]; } else { credential.UserName = auth; } #pragma warning disable CS0618 // Type or member is obsolete HttpAuth = credential; #pragma warning restore CS0618 // Type or member is obsolete } if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CONSUL_HTTP_TOKEN"))) { Token = Environment.GetEnvironmentVariable("CONSUL_HTTP_TOKEN"); } } internal virtual void OnUpdated(EventArgs e) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. EventHandler handler = Updated; // Event will be null if there are no subscribers handler?.Invoke(this, e); } } /// <summary> /// The consistency mode of a request. /// </summary> /// <see cref="http://www.consul.io/docs/agent/http.html"/> public enum ConsistencyMode { /// <summary> /// Default is strongly consistent in almost all cases. However, there is a small window in which a new leader may be elected during which the old leader may service stale values. The trade-off is fast reads but potentially stale values. The condition resulting in stale reads is hard to trigger, and most clients should not need to worry about this case. Also, note that this race condition only applies to reads, not writes. /// </summary> Default, /// <summary> /// Consistent forces the read to be fully consistent. This mode is strongly consistent without caveats. It requires that a leader verify with a quorum of peers that it is still leader. This introduces an additional round-trip to all server nodes. The trade-off is increased latency due to an extra round trip. Most clients should not use this unless they cannot tolerate a stale read. /// </summary> Consistent, /// <summary> /// Stale allows any Consul server (non-leader) to service a read. This mode allows any server to service the read regardless of whether it is the leader. This means reads can be arbitrarily stale; however, results are generally consistent to within 50 milliseconds of the leader. The trade-off is very fast and scalable reads with a higher likelihood of stale values. Since this mode allows reads without a leader, a cluster that is unavailable will still be able to respond to queries. /// </summary> Stale } /// <summary> /// QueryOptions are used to parameterize a query /// </summary> public class QueryOptions { public static QueryOptions GetDefault(ConsulClientConfiguration config) { return new QueryOptions() { Consistency = ConsistencyMode.Default, Datacenter = config.Datacenter, Token = config.Token, WaitIndex = 0, WaitTime = config.WaitTime, Near = null }; } /// <summary> /// Providing a datacenter overwrites the DC provided by the Config /// </summary> public string Datacenter { get; set; } /// <summary> /// The consistency level required for the operation /// </summary> public ConsistencyMode Consistency { get; set; } /// <summary> /// WaitIndex is used to enable a blocking query. Waits until the timeout or the next index is reached /// </summary> public ulong WaitIndex { get; set; } /// <summary> /// WaitTime is used to bound the duration of a wait. Defaults to that of the Config, but can be overridden. /// </summary> public TimeSpan? WaitTime { get; set; } /// <summary> /// Token is used to provide a per-request ACL token which overrides the agent's default token. /// </summary> public string Token { get; set; } /// <summary> /// Near is used to provide a node name that will sort the results /// in ascending order based on the estimated round trip time from /// that node. Setting this to "_agent" will use the agent's node /// for the sort. /// </summary> public string Near { get; set; } } /// <summary> /// WriteOptions are used to parameterize a write /// </summary> public class WriteOptions { public static WriteOptions GetDefault(ConsulClientConfiguration config) { return new WriteOptions() { Datacenter = config.Datacenter, Token = config.Token }; } /// <summary> /// Providing a datacenter overwrites the DC provided by the Config /// </summary> public string Datacenter { get; set; } /// <summary> /// Token is used to provide a per-request ACL token which overrides the agent's default token. /// </summary> public string Token { get; set; } } public abstract class ConsulResult { /// <summary> /// How long the request took /// </summary> public TimeSpan RequestTime { get; set; } /// <summary> /// Exposed so that the consumer can to check for a specific status code /// </summary> public HttpStatusCode StatusCode { get; set; } public ConsulResult() { } public ConsulResult(ConsulResult other) { RequestTime = other.RequestTime; StatusCode = other.StatusCode; } } /// <summary> /// The result of a Consul API query /// </summary> public class QueryResult : ConsulResult { /// <summary> /// The index number when the query was serviced. This can be used as a WaitIndex to perform a blocking query /// </summary> public ulong LastIndex { get; set; } /// <summary> /// Time of last contact from the leader for the server servicing the request /// </summary> public TimeSpan LastContact { get; set; } /// <summary> /// Is there a known leader /// </summary> public bool KnownLeader { get; set; } /// <summary> /// Is address translation enabled for HTTP responses on this agent /// </summary> public bool AddressTranslationEnabled { get; set; } public QueryResult() { } public QueryResult(QueryResult other) : base(other) { LastIndex = other.LastIndex; LastContact = other.LastContact; KnownLeader = other.KnownLeader; } } /// <summary> /// The result of a Consul API query /// </summary> /// <typeparam name="T">Must be able to be deserialized from JSON</typeparam> public class QueryResult<T> : QueryResult { /// <summary> /// The result of the query /// </summary> public T Response { get; set; } public QueryResult() { } public QueryResult(QueryResult other) : base(other) { } public QueryResult(QueryResult other, T value) : base(other) { Response = value; } } /// <summary> /// The result of a Consul API write /// </summary> public class WriteResult : ConsulResult { public WriteResult() { } public WriteResult(WriteResult other) : base(other) { } } /// <summary> /// The result of a Consul API write /// </summary> /// <typeparam name="T">Must be able to be deserialized from JSON. Some writes return nothing, in which case this should be an empty Object</typeparam> public class WriteResult<T> : WriteResult { /// <summary> /// The result of the write /// </summary> public T Response { get; set; } public WriteResult() { } public WriteResult(WriteResult other) : base(other) { } public WriteResult(WriteResult other, T value) : base(other) { Response = value; } } /// <summary> /// Represents a persistant connection to a Consul agent. Instances of this class should be created rarely and reused often. /// </summary> public partial class ConsulClient : IDisposable { /// <summary> /// This class is used to group all the configurable bits of a ConsulClient into a single pointer reference /// which is great for implementing reconfiguration later. /// </summary> private class ConsulClientConfigurationContainer { internal readonly bool skipClientDispose; internal readonly HttpClient HttpClient; #if CORECLR internal readonly HttpClientHandler HttpHandler; #else internal readonly WebRequestHandler HttpHandler; #endif public readonly ConsulClientConfiguration Config; public ConsulClientConfigurationContainer() { Config = new ConsulClientConfiguration(); #if CORECLR HttpHandler = new HttpClientHandler(); #else HttpHandler = new WebRequestHandler(); #endif HttpClient = new HttpClient(HttpHandler); HttpClient.Timeout = TimeSpan.FromMinutes(15); HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpClient.DefaultRequestHeaders.Add("Keep-Alive", "true"); } #region Old style config handling public ConsulClientConfigurationContainer(ConsulClientConfiguration config, HttpClient client) { skipClientDispose = true; Config = config; HttpClient = client; } public ConsulClientConfigurationContainer(ConsulClientConfiguration config) { Config = config; #if CORECLR HttpHandler = new HttpClientHandler(); #else HttpHandler = new WebRequestHandler(); #endif HttpClient = new HttpClient(HttpHandler); HttpClient.Timeout = TimeSpan.FromMinutes(15); HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpClient.DefaultRequestHeaders.Add("Keep-Alive", "true"); } #endregion #region IDisposable Support private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (HttpClient != null && !skipClientDispose) { HttpClient.Dispose(); } if (HttpHandler != null) { HttpHandler.Dispose(); } } disposedValue = true; } } //~ConsulClient() //{ // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. // Dispose(false); //} // This code added to correctly implement the disposable pattern. public void Dispose() { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); GC.SuppressFinalize(this); } public void CheckDisposed() { if (disposedValue) { throw new ObjectDisposedException(typeof(ConsulClientConfigurationContainer).FullName.ToString()); } } #endregion } private ConsulClientConfigurationContainer ConfigContainer; internal HttpClient HttpClient { get { return ConfigContainer.HttpClient; } } #if CORECLR internal HttpClientHandler HttpHandler { get { return ConfigContainer.HttpHandler; } } #else internal WebRequestHandler HttpHandler { get { return ConfigContainer.HttpHandler; } } #endif public ConsulClientConfiguration Config { get { return ConfigContainer.Config; } } internal readonly JsonSerializer serializer = new JsonSerializer(); #region New style config with Actions /// <summary> /// Initializes a new Consul client with a default configuration that connects to 127.0.0.1:8500. /// </summary> public ConsulClient() : this(null, null, null) { } /// <summary> /// Initializes a new Consul client with the ability to set portions of the configuration. /// </summary> /// <param name="configOverride">The Action to modify the default configuration with</param> public ConsulClient(Action<ConsulClientConfiguration> configOverride) : this(configOverride, null, null) { } /// <summary> /// Initializes a new Consul client with the ability to set portions of the configuration and access the underlying HttpClient for modification. /// The HttpClient is modified to set options like the request timeout and headers. /// The Timeout property also applies to all long-poll requests and should be set to a value that will encompass all successful requests. /// </summary> /// <param name="configOverride">The Action to modify the default configuration with</param> /// <param name="clientOverride">The Action to modify the HttpClient with</param> public ConsulClient(Action<ConsulClientConfiguration> configOverride, Action<HttpClient> clientOverride) : this(configOverride, clientOverride, null) { } /// <summary> /// Initializes a new Consul client with the ability to set portions of the configuration and access the underlying HttpClient and WebRequestHandler for modification. /// The HttpClient is modified to set options like the request timeout and headers. /// The WebRequestHandler is modified to set options like Proxy and Credentials. /// The Timeout property also applies to all long-poll requests and should be set to a value that will encompass all successful requests. /// </summary> /// <param name="configOverride">The Action to modify the default configuration with</param> /// <param name="clientOverride">The Action to modify the HttpClient with</param> /// <param name="handlerOverride">The Action to modify the WebRequestHandler with</param> #if !CORECLR public ConsulClient(Action<ConsulClientConfiguration> configOverride, Action<HttpClient> clientOverride, Action<WebRequestHandler> handlerOverride) #else public ConsulClient(Action<ConsulClientConfiguration> configOverride, Action<HttpClient> clientOverride, Action<HttpClientHandler> handlerOverride) #endif { var ctr = new ConsulClientConfigurationContainer(); configOverride?.Invoke(ctr.Config); ApplyConfig(ctr.Config, ctr.HttpHandler, ctr.HttpClient); handlerOverride?.Invoke(ctr.HttpHandler); clientOverride?.Invoke(ctr.HttpClient); ConfigContainer = ctr; InitializeEndpoints(); } #endregion #region Old style config /// <summary> /// Initializes a new Consul client with the configuration specified. /// </summary> /// <param name="config">A Consul client configuration</param> [Obsolete("This constructor is no longer necessary due to the new Action based constructors and will be removed when 0.8.0 is released." + "Please use the ConsulClient(Action<ConsulClientConfiguration>) constructor to set configuration options.", false)] public ConsulClient(ConsulClientConfiguration config) { config.Updated += HandleConfigUpdateEvent; var ctr = new ConsulClientConfigurationContainer(config); ApplyConfig(ctr.Config, ctr.HttpHandler, ctr.HttpClient); ConfigContainer = ctr; InitializeEndpoints(); } /// <summary> /// Initializes a new Consul client with the configuration specified and a custom HttpClient, which is useful for setting proxies/custom timeouts. /// The HttpClient must accept the "application/json" content type and the Timeout property should be set to at least 15 minutes to allow for blocking queries. /// </summary> /// <param name="config">A Consul client configuration</param> /// <param name="client">A custom HttpClient</param> [Obsolete("This constructor is no longer necessary due to the new Action based constructors and will be removed when 0.8.0 is released." + "Please use one of the ConsulClient(Action<>) constructors instead to set internal options on the HttpClient/WebRequestHandler.", false)] public ConsulClient(ConsulClientConfiguration config, HttpClient client) { var ctr = new ConsulClientConfigurationContainer(config, client); if (!ctr.HttpClient.DefaultRequestHeaders.Accept.Contains(new MediaTypeWithQualityHeaderValue("application/json"))) { throw new ArgumentException("HttpClient must accept the application/json content type", nameof(client)); } ConfigContainer = ctr; InitializeEndpoints(); } #endregion private void InitializeEndpoints() { _acl = new Lazy<ACL>(() => new ACL(this)); _agent = new Lazy<Agent>(() => new Agent(this)); _catalog = new Lazy<Catalog>(() => new Catalog(this)); _coordinate = new Lazy<Coordinate>(() => new Coordinate(this)); _event = new Lazy<Event>(() => new Event(this)); _health = new Lazy<Health>(() => new Health(this)); _kv = new Lazy<KV>(() => new KV(this)); _operator = new Lazy<Operator>(() => new Operator(this)); _preparedquery = new Lazy<PreparedQuery>(() => new PreparedQuery(this)); _raw = new Lazy<Raw>(() => new Raw(this)); _session = new Lazy<Session>(() => new Session(this)); _snapshot = new Lazy<Snapshot>(() => new Snapshot(this)); _status = new Lazy<Status>(() => new Status(this)); } #region IDisposable Support private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { Config.Updated -= HandleConfigUpdateEvent; if (ConfigContainer != null) { ConfigContainer.Dispose(); } } disposedValue = true; } } //~ConsulClient() //{ // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. // Dispose(false); //} // This code added to correctly implement the disposable pattern. public void Dispose() { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); GC.SuppressFinalize(this); } public void CheckDisposed() { if (disposedValue) { throw new ObjectDisposedException(typeof(ConsulClient).FullName.ToString()); } } #endregion void HandleConfigUpdateEvent(object sender, EventArgs e) { ApplyConfig(sender as ConsulClientConfiguration, HttpHandler, HttpClient); } #if !CORECLR void ApplyConfig(ConsulClientConfiguration config, WebRequestHandler handler, HttpClient client) #else void ApplyConfig(ConsulClientConfiguration config, HttpClientHandler handler, HttpClient client) #endif { #pragma warning disable CS0618 // Type or member is obsolete if (config.HttpAuth != null) #pragma warning restore CS0618 // Type or member is obsolete { #pragma warning disable CS0618 // Type or member is obsolete handler.Credentials = config.HttpAuth; #pragma warning restore CS0618 // Type or member is obsolete } #if !__MonoCS__ if (config.ClientCertificateSupported) { #pragma warning disable CS0618 // Type or member is obsolete if (config.ClientCertificate != null) #pragma warning restore CS0618 // Type or member is obsolete { handler.ClientCertificateOptions = ClientCertificateOption.Manual; #pragma warning disable CS0618 // Type or member is obsolete handler.ClientCertificates.Add(config.ClientCertificate); #pragma warning restore CS0618 // Type or member is obsolete } else { handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.ClientCertificates.Clear(); } } #endif #if !CORECLR #pragma warning disable CS0618 // Type or member is obsolete if (config.DisableServerCertificateValidation) #pragma warning restore CS0618 // Type or member is obsolete { handler.ServerCertificateValidationCallback += (certSender, cert, chain, sslPolicyErrors) => { return true; }; } else { handler.ServerCertificateValidationCallback = null; } #else #pragma warning disable CS0618 // Type or member is obsolete if (config.DisableServerCertificateValidation) #pragma warning restore CS0618 // Type or member is obsolete { handler.ServerCertificateCustomValidationCallback += (certSender, cert, chain, sslPolicyErrors) => { return true; }; } else { handler.ServerCertificateCustomValidationCallback = null; } #endif if (!string.IsNullOrEmpty(config.Token)) { if (client.DefaultRequestHeaders.Contains("X-Consul-Token")) { client.DefaultRequestHeaders.Remove("X-Consul-Token"); } client.DefaultRequestHeaders.Add("X-Consul-Token", config.Token); } } internal GetRequest<TOut> Get<TOut>(string path, QueryOptions opts = null) { return new GetRequest<TOut>(this, path, opts ?? QueryOptions.GetDefault(Config)); } internal DeleteReturnRequest<TOut> DeleteReturning<TOut>(string path, WriteOptions opts = null) { return new DeleteReturnRequest<TOut>(this, path, opts ?? WriteOptions.GetDefault(Config)); } internal DeleteRequest Delete(string path, WriteOptions opts = null) { return new DeleteRequest(this, path, opts ?? WriteOptions.GetDefault(Config)); } internal DeleteAcceptingRequest<TIn> DeleteAccepting<TIn>(string path, TIn body, WriteOptions opts = null) { return new DeleteAcceptingRequest<TIn>(this, path, body, opts ?? WriteOptions.GetDefault(Config)); } internal PutReturningRequest<TOut> PutReturning<TOut>(string path, WriteOptions opts = null) { return new PutReturningRequest<TOut>(this, path, opts ?? WriteOptions.GetDefault(Config)); } internal PutRequest<TIn> Put<TIn>(string path, TIn body, WriteOptions opts = null) { return new PutRequest<TIn>(this, path, body, opts ?? WriteOptions.GetDefault(Config)); } internal PutNothingRequest PutNothing(string path, WriteOptions opts = null) { return new PutNothingRequest(this, path, opts ?? WriteOptions.GetDefault(Config)); } internal PutRequest<TIn, TOut> Put<TIn, TOut>(string path, TIn body, WriteOptions opts = null) { return new PutRequest<TIn, TOut>(this, path, body, opts ?? WriteOptions.GetDefault(Config)); } internal PostRequest<TIn> Post<TIn>(string path, TIn body, WriteOptions opts = null) { return new PostRequest<TIn>(this, path, body, opts ?? WriteOptions.GetDefault(Config)); } internal PostRequest<TIn, TOut> Post<TIn, TOut>(string path, TIn body, WriteOptions opts = null) { return new PostRequest<TIn, TOut>(this, path, body, opts ?? WriteOptions.GetDefault(Config)); } } public abstract class ConsulRequest { internal ConsulClient Client { get; set; } internal HttpMethod Method { get; set; } internal Dictionary<string, string> Params { get; set; } internal Stream ResponseStream { get; set; } internal string Endpoint { get; set; } protected Stopwatch timer = new Stopwatch(); internal ConsulRequest(ConsulClient client, string url, HttpMethod method) { Client = client; Method = method; Endpoint = url; Params = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(client.Config.Datacenter)) { Params["dc"] = client.Config.Datacenter; } if (client.Config.WaitTime.HasValue) { Params["wait"] = client.Config.WaitTime.Value.ToGoDuration(); } } protected abstract void ApplyOptions(ConsulClientConfiguration clientConfig); protected abstract void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig); protected Uri BuildConsulUri(string url, Dictionary<string, string> p) { var builder = new UriBuilder(Client.Config.Address); builder.Path = url; ApplyOptions(Client.Config); var queryParams = new List<string>(Params.Count / 2); foreach (var queryParam in Params) { if (!string.IsNullOrEmpty(queryParam.Value)) { queryParams.Add(string.Format("{0}={1}", Uri.EscapeDataString(queryParam.Key), Uri.EscapeDataString(queryParam.Value))); } else { queryParams.Add(string.Format("{0}", Uri.EscapeDataString(queryParam.Key))); } } builder.Query = string.Join("&", queryParams); return builder.Uri; } protected TOut Deserialize<TOut>(Stream stream) { using (var reader = new StreamReader(stream)) { using (var jsonReader = new JsonTextReader(reader)) { return Client.serializer.Deserialize<TOut>(jsonReader); } } } protected byte[] Serialize(object value) { return System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)); } } public class GetRequest<TOut> : ConsulRequest { public QueryOptions Options { get; set; } public GetRequest(ConsulClient client, string url, QueryOptions options = null) : base(client, url, HttpMethod.Get) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } Options = options ?? QueryOptions.GetDefault(client.Config); } public async Task<QueryResult<TOut>> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new QueryResult<TOut>(); var message = new HttpRequestMessage(HttpMethod.Get, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); ParseQueryHeaders(response, result); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } if (response.IsSuccessStatusCode) { result.Response = Deserialize<TOut>(ResponseStream); } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } public async Task<QueryResult<Stream>> ExecuteStreaming(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new QueryResult<Stream>(); var message = new HttpRequestMessage(HttpMethod.Get, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); var response = await Client.HttpClient.SendAsync(message, HttpCompletionOption.ResponseHeadersRead, ct).ConfigureAwait(false); ParseQueryHeaders(response, (result as QueryResult<TOut>)); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); result.Response = ResponseStream; if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(QueryOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } switch (Options.Consistency) { case ConsistencyMode.Consistent: Params["consistent"] = string.Empty; break; case ConsistencyMode.Stale: Params["stale"] = string.Empty; break; case ConsistencyMode.Default: break; } if (Options.WaitIndex != 0) { Params["index"] = Options.WaitIndex.ToString(); } if (Options.WaitTime.HasValue) { Params["wait"] = Options.WaitTime.Value.ToGoDuration(); } if (!string.IsNullOrEmpty(Options.Near)) { Params["near"] = Options.Near; } } protected void ParseQueryHeaders(HttpResponseMessage res, QueryResult<TOut> meta) { var headers = res.Headers; if (headers.Contains("X-Consul-Index")) { try { meta.LastIndex = ulong.Parse(headers.GetValues("X-Consul-Index").First()); } catch (Exception ex) { throw new ConsulRequestException("Failed to parse X-Consul-Index", res.StatusCode, ex); } } if (headers.Contains("X-Consul-LastContact")) { try { meta.LastContact = TimeSpan.FromMilliseconds(ulong.Parse(headers.GetValues("X-Consul-LastContact").First())); } catch (Exception ex) { throw new ConsulRequestException("Failed to parse X-Consul-LastContact", res.StatusCode, ex); } } if (headers.Contains("X-Consul-KnownLeader")) { try { meta.KnownLeader = bool.Parse(headers.GetValues("X-Consul-KnownLeader").First()); } catch (Exception ex) { throw new ConsulRequestException("Failed to parse X-Consul-KnownLeader", res.StatusCode, ex); } } if (headers.Contains("X-Consul-Translate-Addresses")) { try { meta.AddressTranslationEnabled = bool.Parse(headers.GetValues("X-Consul-Translate-Addresses").First()); } catch (Exception ex) { throw new ConsulRequestException("Failed to parse X-Consul-Translate-Addresses", res.StatusCode, ex); } } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class DeleteReturnRequest<TOut> : ConsulRequest { public WriteOptions Options { get; set; } public DeleteReturnRequest(ConsulClient client, string url, WriteOptions options = null) : base(client, url, HttpMethod.Delete) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult<TOut>> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult<TOut>(); var message = new HttpRequestMessage(HttpMethod.Delete, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } if (response.IsSuccessStatusCode) { result.Response = Deserialize<TOut>(ResponseStream); } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class DeleteRequest : ConsulRequest { public WriteOptions Options { get; set; } public DeleteRequest(ConsulClient client, string url, WriteOptions options = null) : base(client, url, HttpMethod.Delete) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult(); var message = new HttpRequestMessage(HttpMethod.Delete, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class DeleteAcceptingRequest<TIn> : ConsulRequest { public WriteOptions Options { get; set; } private TIn _body; public DeleteAcceptingRequest(ConsulClient client, string url, TIn body, WriteOptions options = null) : base(client, url, HttpMethod.Delete) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } _body = body; Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult> Execute(CancellationToken ct) { Client.CheckDisposed(); var result = new WriteResult(); HttpContent content; if (typeof(TIn) == typeof(byte[])) { content = new ByteArrayContent((_body as byte[]) ?? new byte[0]); } else if (typeof(TIn) == typeof(Stream)) { content = new StreamContent((_body as Stream) ?? new MemoryStream()); } else { content = new ByteArrayContent(Serialize(_body)); } var message = new HttpRequestMessage(HttpMethod.Delete, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); message.Content = content; var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class PutReturningRequest<TOut> : ConsulRequest { public WriteOptions Options { get; set; } public PutReturningRequest(ConsulClient client, string url, WriteOptions options = null) : base(client, url, HttpMethod.Put) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult<TOut>> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult<TOut>(); var message = new HttpRequestMessage(HttpMethod.Put, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } if (response.IsSuccessStatusCode) { result.Response = Deserialize<TOut>(ResponseStream); } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class PutNothingRequest : ConsulRequest { public WriteOptions Options { get; set; } public PutNothingRequest(ConsulClient client, string url, WriteOptions options = null) : base(client, url, HttpMethod.Put) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult(); var message = new HttpRequestMessage(HttpMethod.Put, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class PutRequest<TIn> : ConsulRequest { public WriteOptions Options { get; set; } private TIn _body; public PutRequest(ConsulClient client, string url, TIn body, WriteOptions options = null) : base(client, url, HttpMethod.Put) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } _body = body; Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult(); HttpContent content; if (typeof(TIn) == typeof(byte[])) { content = new ByteArrayContent((_body as byte[]) ?? new byte[0]); } else if (typeof(TIn) == typeof(Stream)) { content = new StreamContent((_body as Stream) ?? new MemoryStream()); } else { content = new ByteArrayContent(Serialize(_body)); } var message = new HttpRequestMessage(HttpMethod.Put, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); message.Content = content; var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class PutRequest<TIn, TOut> : ConsulRequest { public WriteOptions Options { get; set; } private TIn _body; public PutRequest(ConsulClient client, string url, TIn body, WriteOptions options = null) : base(client, url, HttpMethod.Put) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } _body = body; Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult<TOut>> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult<TOut>(); HttpContent content = null; if (typeof(TIn) == typeof(byte[])) { var bodyBytes = (_body as byte[]); if (bodyBytes != null) { content = new ByteArrayContent(bodyBytes); } // If body is null and should be a byte array, then just don't send anything. } else { content = new ByteArrayContent(Serialize(_body)); } var message = new HttpRequestMessage(HttpMethod.Put, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); message.Content = content; var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (!response.IsSuccessStatusCode && ( (response.StatusCode != HttpStatusCode.NotFound && typeof(TOut) != typeof(TxnResponse)) || (response.StatusCode != HttpStatusCode.Conflict && typeof(TOut) == typeof(TxnResponse)))) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } if (response.IsSuccessStatusCode || // Special case for KV txn operations (response.StatusCode == HttpStatusCode.Conflict && typeof(TOut) == typeof(TxnResponse))) { result.Response = Deserialize<TOut>(ResponseStream); } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class PostRequest<TIn> : ConsulRequest { public WriteOptions Options { get; set; } private TIn _body; public PostRequest(ConsulClient client, string url, TIn body, WriteOptions options = null) : base(client, url, HttpMethod.Post) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } _body = body; Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult(); HttpContent content = null; if (typeof(TIn) == typeof(byte[])) { var bodyBytes = (_body as byte[]); if (bodyBytes != null) { content = new ByteArrayContent(bodyBytes); } // If body is null and should be a byte array, then just don't send anything. } else { content = new ByteArrayContent(Serialize(_body)); } var message = new HttpRequestMessage(HttpMethod.Post, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); message.Content = content; var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } public class PostRequest<TIn, TOut> : ConsulRequest { public WriteOptions Options { get; set; } private TIn _body; public PostRequest(ConsulClient client, string url, TIn body, WriteOptions options = null) : base(client, url, HttpMethod.Post) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException(nameof(url)); } _body = body; Options = options ?? WriteOptions.GetDefault(client.Config); } public async Task<WriteResult<TOut>> Execute(CancellationToken ct) { Client.CheckDisposed(); timer.Start(); var result = new WriteResult<TOut>(); HttpContent content = null; if (typeof(TIn) == typeof(byte[])) { var bodyBytes = (_body as byte[]); if (bodyBytes != null) { content = new ByteArrayContent(bodyBytes); } // If body is null and should be a byte array, then just don't send anything. } else { content = new ByteArrayContent(Serialize(_body)); } var message = new HttpRequestMessage(HttpMethod.Post, BuildConsulUri(Endpoint, Params)); ApplyHeaders(message, Client.Config); message.Content = content; var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { if (ResponseStream == null) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}", response.StatusCode), response.StatusCode); } using (var sr = new StreamReader(ResponseStream)) { throw new ConsulRequestException(string.Format("Unexpected response, status code {0}: {1}", response.StatusCode, sr.ReadToEnd()), response.StatusCode); } } if (response.IsSuccessStatusCode) { result.Response = Deserialize<TOut>(ResponseStream); } result.RequestTime = timer.Elapsed; timer.Stop(); return result; } protected override void ApplyOptions(ConsulClientConfiguration clientConfig) { if (Options.Equals(WriteOptions.GetDefault(clientConfig))) { return; } if (!string.IsNullOrEmpty(Options.Datacenter)) { Params["dc"] = Options.Datacenter; } } protected override void ApplyHeaders(HttpRequestMessage message, ConsulClientConfiguration clientConfig) { if (!string.IsNullOrEmpty(Options.Token)) { message.Headers.Add("X-Consul-Token", Options.Token); } } } }
38.428725
495
0.577136
[ "Apache-2.0" ]
JotunShard/consuldotnet
Consul/Client.cs
71,441
C#
/* * ORY Hydra * * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. * * The version of the OpenAPI document: v1.10.4-alpha.1 * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Ory.Hydra.Client.Client.OpenAPIDateConverter; namespace Ory.Hydra.Client.Model { /// <summary> /// HydraPluginSettings /// </summary> [DataContract(Name = "PluginSettings")] public partial class HydraPluginSettings : IEquatable<HydraPluginSettings>, IValidatableObject { /// <summary> /// Initializes a new instance of the <see cref="HydraPluginSettings" /> class. /// </summary> [JsonConstructorAttribute] protected HydraPluginSettings() { this.AdditionalProperties = new Dictionary<string, object>(); } /// <summary> /// Initializes a new instance of the <see cref="HydraPluginSettings" /> class. /// </summary> /// <param name="args">args (required).</param> /// <param name="devices">devices (required).</param> /// <param name="env">env (required).</param> /// <param name="mounts">mounts (required).</param> public HydraPluginSettings(List<string> args = default(List<string>), List<HydraPluginDevice> devices = default(List<HydraPluginDevice>), List<string> env = default(List<string>), List<HydraPluginMount> mounts = default(List<HydraPluginMount>)) { // to ensure "args" is required (not null) this.Args = args ?? throw new ArgumentNullException("args is a required property for HydraPluginSettings and cannot be null"); // to ensure "devices" is required (not null) this.Devices = devices ?? throw new ArgumentNullException("devices is a required property for HydraPluginSettings and cannot be null"); // to ensure "env" is required (not null) this.Env = env ?? throw new ArgumentNullException("env is a required property for HydraPluginSettings and cannot be null"); // to ensure "mounts" is required (not null) this.Mounts = mounts ?? throw new ArgumentNullException("mounts is a required property for HydraPluginSettings and cannot be null"); this.AdditionalProperties = new Dictionary<string, object>(); } /// <summary> /// args /// </summary> /// <value>args</value> [DataMember(Name = "Args", IsRequired = true, EmitDefaultValue = false)] public List<string> Args { get; set; } /// <summary> /// devices /// </summary> /// <value>devices</value> [DataMember(Name = "Devices", IsRequired = true, EmitDefaultValue = false)] public List<HydraPluginDevice> Devices { get; set; } /// <summary> /// env /// </summary> /// <value>env</value> [DataMember(Name = "Env", IsRequired = true, EmitDefaultValue = false)] public List<string> Env { get; set; } /// <summary> /// mounts /// </summary> /// <value>mounts</value> [DataMember(Name = "Mounts", IsRequired = true, EmitDefaultValue = false)] public List<HydraPluginMount> Mounts { get; set; } /// <summary> /// Gets or Sets additional properties /// </summary> [JsonExtensionData] public IDictionary<string, object> AdditionalProperties { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class HydraPluginSettings {\n"); sb.Append(" Args: ").Append(Args).Append("\n"); sb.Append(" Devices: ").Append(Devices).Append("\n"); sb.Append(" Env: ").Append(Env).Append("\n"); sb.Append(" Mounts: ").Append(Mounts).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="input">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object input) { return this.Equals(input as HydraPluginSettings); } /// <summary> /// Returns true if HydraPluginSettings instances are equal /// </summary> /// <param name="input">Instance of HydraPluginSettings to be compared</param> /// <returns>Boolean</returns> public bool Equals(HydraPluginSettings input) { if (input == null) return false; return ( this.Args == input.Args || this.Args != null && input.Args != null && this.Args.SequenceEqual(input.Args) ) && ( this.Devices == input.Devices || this.Devices != null && input.Devices != null && this.Devices.SequenceEqual(input.Devices) ) && ( this.Env == input.Env || this.Env != null && input.Env != null && this.Env.SequenceEqual(input.Env) ) && ( this.Mounts == input.Mounts || this.Mounts != null && input.Mounts != null && this.Mounts.SequenceEqual(input.Mounts) ) && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.Args != null) hashCode = hashCode * 59 + this.Args.GetHashCode(); if (this.Devices != null) hashCode = hashCode * 59 + this.Devices.GetHashCode(); if (this.Env != null) hashCode = hashCode * 59 + this.Env.GetHashCode(); if (this.Mounts != null) hashCode = hashCode * 59 + this.Mounts.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } /// <summary> /// To validate all properties of the instance /// </summary> /// <param name="validationContext">Validation context</param> /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { yield break; } } }
39.6
252
0.566765
[ "Apache-2.0" ]
Stackwalkerllc/sdk
clients/hydra/dotnet/src/Ory.Hydra.Client/Model/HydraPluginSettings.cs
8,118
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/Uxtheme.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. using System; using System.Runtime.InteropServices; using static TerraFX.Interop.BP_BUFFERFORMAT; namespace TerraFX.Interop { public static unsafe partial class Windows { [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int BeginPanningFeedback([NativeTypeName("HWND")] IntPtr hwnd); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int UpdatePanningFeedback([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("LONG")] int lTotalOverpanOffsetX, [NativeTypeName("LONG")] int lTotalOverpanOffsetY, [NativeTypeName("BOOL")] int fInInertia); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int EndPanningFeedback([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("BOOL")] int fAnimateBack); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeAnimationProperty([NativeTypeName("HTHEME")] IntPtr hTheme, int iStoryboardId, int iTargetId, TA_PROPERTY eProperty, void* pvProperty, [NativeTypeName("DWORD")] uint cbSize, [NativeTypeName("DWORD *")] uint* pcbSizeOut); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeAnimationTransform([NativeTypeName("HTHEME")] IntPtr hTheme, int iStoryboardId, int iTargetId, [NativeTypeName("DWORD")] uint dwTransformIndex, TA_TRANSFORM* pTransform, [NativeTypeName("DWORD")] uint cbSize, [NativeTypeName("DWORD *")] uint* pcbSizeOut); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeTimingFunction([NativeTypeName("HTHEME")] IntPtr hTheme, int iTimingFunctionId, TA_TIMINGFUNCTION* pTimingFunction, [NativeTypeName("DWORD")] uint cbSize, [NativeTypeName("DWORD *")] uint* pcbSizeOut); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HTHEME")] public static extern IntPtr OpenThemeData([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("LPCWSTR")] ushort* pszClassList); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HTHEME")] public static extern IntPtr OpenThemeDataForDpi([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("LPCWSTR")] ushort* pszClassList, [NativeTypeName("UINT")] uint dpi); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HTHEME")] public static extern IntPtr OpenThemeDataEx([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("LPCWSTR")] ushort* pszClassList, [NativeTypeName("DWORD")] uint dwFlags); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int CloseThemeData([NativeTypeName("HTHEME")] IntPtr hTheme); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeBackground([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pRect, [NativeTypeName("LPCRECT")] RECT* pClipRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeBackgroundEx([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pRect, [NativeTypeName("const DTBGOPTS *")] DTBGOPTS* pOptions); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeText([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCWSTR")] ushort* pszText, int cchText, [NativeTypeName("DWORD")] uint dwTextFlags, [NativeTypeName("DWORD")] uint dwTextFlags2, [NativeTypeName("LPCRECT")] RECT* pRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeBackgroundContentRect([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pBoundingRect, [NativeTypeName("LPRECT")] RECT* pContentRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeBackgroundExtent([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pContentRect, [NativeTypeName("LPRECT")] RECT* pExtentRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeBackgroundRegion([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pRect, [NativeTypeName("HRGN *")] IntPtr* pRegion); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemePartSize([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* prc, [NativeTypeName("enum THEMESIZE")] THEMESIZE eSize, SIZE* psz); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeTextExtent([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCWSTR")] ushort* pszText, int cchCharCount, [NativeTypeName("DWORD")] uint dwTextFlags, [NativeTypeName("LPCRECT")] RECT* pBoundingRect, [NativeTypeName("LPRECT")] RECT* pExtentRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeTextMetrics([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, TEXTMETRICW* ptm); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int HitTestThemeBackground([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("DWORD")] uint dwOptions, [NativeTypeName("LPCRECT")] RECT* pRect, [NativeTypeName("HRGN")] IntPtr hrgn, POINT ptTest, [NativeTypeName("WORD *")] ushort* pwHitTestCode); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeEdge([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pDestRect, [NativeTypeName("UINT")] uint uEdge, [NativeTypeName("UINT")] uint uFlags, [NativeTypeName("LPRECT")] RECT* pContentRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeIcon([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT* pRect, [NativeTypeName("HIMAGELIST")] IntPtr himl, int iImageIndex); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int IsThemePartDefined([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int IsThemeBackgroundPartiallyTransparent([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeColor([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("COLORREF *")] uint* pColor); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeMetric([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, int iPropId, int* piVal); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeString([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("LPWSTR")] ushort* pszBuff, int cchMaxBuffChars); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeBool([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("BOOL *")] int* pfVal); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeInt([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, int* piVal); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeEnumValue([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, int* piVal); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemePosition([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, POINT* pPoint); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeFont([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, int iPropId, LOGFONTW* pFont); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeRect([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("LPRECT")] RECT* pRect); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeMargins([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, int iPropId, [NativeTypeName("LPCRECT")] RECT* prc, MARGINS* pMargins); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeIntList([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, INTLIST* pIntList); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemePropertyOrigin([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("enum PROPERTYORIGIN *")] PROPERTYORIGIN* pOrigin); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int SetWindowTheme([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("LPCWSTR")] ushort* pszSubAppName, [NativeTypeName("LPCWSTR")] ushort* pszSubIdList); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeFilename([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("LPWSTR")] ushort* pszThemeFileName, int cchMaxBuffChars); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("COLORREF")] public static extern uint GetThemeSysColor([NativeTypeName("HTHEME")] IntPtr hTheme, int iColorId); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HBRUSH")] public static extern IntPtr GetThemeSysColorBrush([NativeTypeName("HTHEME")] IntPtr hTheme, int iColorId); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int GetThemeSysBool([NativeTypeName("HTHEME")] IntPtr hTheme, int iBoolId); [DllImport("uxtheme", ExactSpelling = true)] public static extern int GetThemeSysSize([NativeTypeName("HTHEME")] IntPtr hTheme, int iSizeId); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeSysFont([NativeTypeName("HTHEME")] IntPtr hTheme, int iFontId, LOGFONTW* plf); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeSysString([NativeTypeName("HTHEME")] IntPtr hTheme, int iStringId, [NativeTypeName("LPWSTR")] ushort* pszStringBuff, int cchMaxStringChars); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeSysInt([NativeTypeName("HTHEME")] IntPtr hTheme, int iIntId, int* piValue); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int IsThemeActive(); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int IsAppThemed(); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HTHEME")] public static extern IntPtr GetWindowTheme([NativeTypeName("HWND")] IntPtr hwnd); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int EnableThemeDialogTexture([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("DWORD")] uint dwFlags); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int IsThemeDialogTextureEnabled([NativeTypeName("HWND")] IntPtr hwnd); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("DWORD")] public static extern uint GetThemeAppProperties(); [DllImport("uxtheme", ExactSpelling = true)] public static extern void SetThemeAppProperties([NativeTypeName("DWORD")] uint dwFlags); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetCurrentThemeName([NativeTypeName("LPWSTR")] ushort* pszThemeFileName, int cchMaxNameChars, [NativeTypeName("LPWSTR")] ushort* pszColorBuff, int cchMaxColorChars, [NativeTypeName("LPWSTR")] ushort* pszSizeBuff, int cchMaxSizeChars); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeDocumentationProperty([NativeTypeName("LPCWSTR")] ushort* pszThemeName, [NativeTypeName("LPCWSTR")] ushort* pszPropertyName, [NativeTypeName("LPWSTR")] ushort* pszValueBuff, int cchMaxValChars); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeParentBackground([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("HDC")] IntPtr hdc, [NativeTypeName("const RECT *")] RECT* prc); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int EnableTheming([NativeTypeName("BOOL")] int fEnable); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeParentBackgroundEx([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("HDC")] IntPtr hdc, [NativeTypeName("DWORD")] uint dwFlags, [NativeTypeName("const RECT *")] RECT* prc); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int SetWindowThemeAttribute([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("enum WINDOWTHEMEATTRIBUTETYPE")] WINDOWTHEMEATTRIBUTETYPE eAttribute, [NativeTypeName("PVOID")] void* pvAttribute, [NativeTypeName("DWORD")] uint cbAttribute); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int DrawThemeTextEx([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCWSTR")] ushort* pszText, int cchText, [NativeTypeName("DWORD")] uint dwTextFlags, [NativeTypeName("LPRECT")] RECT* pRect, [NativeTypeName("const DTTOPTS *")] DTTOPTS* pOptions); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeBitmap([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, [NativeTypeName("ULONG")] uint dwFlags, [NativeTypeName("HBITMAP *")] IntPtr* phBitmap); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeStream([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateId, int iPropId, void** ppvStream, [NativeTypeName("DWORD *")] uint* pcbStream, [NativeTypeName("HINSTANCE")] IntPtr hInst); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int BufferedPaintInit(); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int BufferedPaintUnInit(); [DllImport("uxtheme", ExactSpelling = true, SetLastError = true)] [return: NativeTypeName("HPAINTBUFFER")] public static extern IntPtr BeginBufferedPaint([NativeTypeName("HDC")] IntPtr hdcTarget, [NativeTypeName("const RECT *")] RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, [NativeTypeName("HDC *")] IntPtr* phdc); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int EndBufferedPaint([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint, [NativeTypeName("BOOL")] int fUpdateTarget); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetBufferedPaintTargetRect([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint, RECT* prc); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HDC")] public static extern IntPtr GetBufferedPaintTargetDC([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HDC")] public static extern IntPtr GetBufferedPaintDC([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetBufferedPaintBits([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint, RGBQUAD** ppbBuffer, int* pcxRow); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int BufferedPaintClear([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint, [NativeTypeName("const RECT *")] RECT* prc); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int BufferedPaintSetAlpha([NativeTypeName("HPAINTBUFFER")] IntPtr hBufferedPaint, [NativeTypeName("const RECT *")] RECT* prc, [NativeTypeName("BYTE")] byte alpha); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int BufferedPaintStopAllAnimations([NativeTypeName("HWND")] IntPtr hwnd); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HANIMATIONBUFFER")] public static extern IntPtr BeginBufferedAnimation([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("HDC")] IntPtr hdcTarget, [NativeTypeName("const RECT *")] RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, BP_ANIMATIONPARAMS* pAnimationParams, [NativeTypeName("HDC *")] IntPtr* phdcFrom, [NativeTypeName("HDC *")] IntPtr* phdcTo); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int EndBufferedAnimation([NativeTypeName("HANIMATIONBUFFER")] IntPtr hbpAnimation, [NativeTypeName("BOOL")] int fUpdateTarget); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int BufferedPaintRenderAnimation([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("HDC")] IntPtr hdcTarget); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int IsCompositionActive(); [DllImport("uxtheme", ExactSpelling = true)] [return: NativeTypeName("HRESULT")] public static extern int GetThemeTransitionDuration([NativeTypeName("HTHEME")] IntPtr hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, [NativeTypeName("DWORD *")] uint* pdwDuration); [NativeTypeName("#define MAX_THEMECOLOR 64")] public const int MAX_THEMECOLOR = 64; [NativeTypeName("#define MAX_THEMESIZE 64")] public const int MAX_THEMESIZE = 64; [NativeTypeName("#define OTD_FORCE_RECT_SIZING 0x00000001")] public const int OTD_FORCE_RECT_SIZING = 0x00000001; [NativeTypeName("#define OTD_NONCLIENT 0x00000002")] public const int OTD_NONCLIENT = 0x00000002; [NativeTypeName("#define OTD_VALIDBITS (OTD_FORCE_RECT_SIZING | \\\r\n OTD_NONCLIENT)")] public const int OTD_VALIDBITS = (0x00000001 | 0x00000002); [NativeTypeName("#define DTBG_CLIPRECT 0x00000001")] public const int DTBG_CLIPRECT = 0x00000001; [NativeTypeName("#define DTBG_DRAWSOLID 0x00000002")] public const int DTBG_DRAWSOLID = 0x00000002; [NativeTypeName("#define DTBG_OMITBORDER 0x00000004")] public const int DTBG_OMITBORDER = 0x00000004; [NativeTypeName("#define DTBG_OMITCONTENT 0x00000008")] public const int DTBG_OMITCONTENT = 0x00000008; [NativeTypeName("#define DTBG_COMPUTINGREGION 0x00000010")] public const int DTBG_COMPUTINGREGION = 0x00000010; [NativeTypeName("#define DTBG_MIRRORDC 0x00000020")] public const int DTBG_MIRRORDC = 0x00000020; [NativeTypeName("#define DTBG_NOMIRROR 0x00000040")] public const int DTBG_NOMIRROR = 0x00000040; [NativeTypeName("#define DTBG_VALIDBITS (DTBG_CLIPRECT | \\\r\n DTBG_DRAWSOLID | \\\r\n DTBG_OMITBORDER | \\\r\n DTBG_OMITCONTENT | \\\r\n DTBG_COMPUTINGREGION | \\\r\n DTBG_MIRRORDC | \\\r\n DTBG_NOMIRROR)")] public const int DTBG_VALIDBITS = (0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000040); [NativeTypeName("#define DTT_GRAYED 0x00000001")] public const int DTT_GRAYED = 0x00000001; [NativeTypeName("#define DTT_FLAGS2VALIDBITS (DTT_GRAYED)")] public const int DTT_FLAGS2VALIDBITS = (0x00000001); [NativeTypeName("#define HTTB_BACKGROUNDSEG 0x00000000")] public const int HTTB_BACKGROUNDSEG = 0x00000000; [NativeTypeName("#define HTTB_FIXEDBORDER 0x00000002")] public const int HTTB_FIXEDBORDER = 0x00000002; [NativeTypeName("#define HTTB_CAPTION 0x00000004")] public const int HTTB_CAPTION = 0x00000004; [NativeTypeName("#define HTTB_RESIZINGBORDER_LEFT 0x00000010")] public const int HTTB_RESIZINGBORDER_LEFT = 0x00000010; [NativeTypeName("#define HTTB_RESIZINGBORDER_TOP 0x00000020")] public const int HTTB_RESIZINGBORDER_TOP = 0x00000020; [NativeTypeName("#define HTTB_RESIZINGBORDER_RIGHT 0x00000040")] public const int HTTB_RESIZINGBORDER_RIGHT = 0x00000040; [NativeTypeName("#define HTTB_RESIZINGBORDER_BOTTOM 0x00000080")] public const int HTTB_RESIZINGBORDER_BOTTOM = 0x00000080; [NativeTypeName("#define HTTB_RESIZINGBORDER (HTTB_RESIZINGBORDER_LEFT | \\\r\n HTTB_RESIZINGBORDER_TOP | \\\r\n HTTB_RESIZINGBORDER_RIGHT | \\\r\n HTTB_RESIZINGBORDER_BOTTOM)")] public const int HTTB_RESIZINGBORDER = (0x00000010 | 0x00000020 | 0x00000040 | 0x00000080); [NativeTypeName("#define HTTB_SIZINGTEMPLATE 0x00000100")] public const int HTTB_SIZINGTEMPLATE = 0x00000100; [NativeTypeName("#define HTTB_SYSTEMSIZINGMARGINS 0x00000200")] public const int HTTB_SYSTEMSIZINGMARGINS = 0x00000200; [NativeTypeName("#define MAX_INTLIST_COUNT 402")] public const int MAX_INTLIST_COUNT = 402; [NativeTypeName("#define ETDT_DISABLE 0x00000001")] public const int ETDT_DISABLE = 0x00000001; [NativeTypeName("#define ETDT_ENABLE 0x00000002")] public const int ETDT_ENABLE = 0x00000002; [NativeTypeName("#define ETDT_USETABTEXTURE 0x00000004")] public const int ETDT_USETABTEXTURE = 0x00000004; [NativeTypeName("#define ETDT_ENABLETAB (ETDT_ENABLE | \\\r\n ETDT_USETABTEXTURE)")] public const int ETDT_ENABLETAB = (0x00000002 | 0x00000004); [NativeTypeName("#define ETDT_USEAEROWIZARDTABTEXTURE 0x00000008")] public const int ETDT_USEAEROWIZARDTABTEXTURE = 0x00000008; [NativeTypeName("#define ETDT_ENABLEAEROWIZARDTAB (ETDT_ENABLE | \\\r\n ETDT_USEAEROWIZARDTABTEXTURE)")] public const int ETDT_ENABLEAEROWIZARDTAB = (0x00000002 | 0x00000008); [NativeTypeName("#define ETDT_VALIDBITS (ETDT_DISABLE | \\\r\n ETDT_ENABLE | \\\r\n ETDT_USETABTEXTURE | \\\r\n ETDT_USEAEROWIZARDTABTEXTURE)")] public const int ETDT_VALIDBITS = (0x00000001 | 0x00000002 | 0x00000004 | 0x00000008); [NativeTypeName("#define STAP_ALLOW_NONCLIENT (1UL << 0)")] public const uint STAP_ALLOW_NONCLIENT = (1U << 0); [NativeTypeName("#define STAP_ALLOW_CONTROLS (1UL << 1)")] public const uint STAP_ALLOW_CONTROLS = (1U << 1); [NativeTypeName("#define STAP_ALLOW_WEBCONTENT (1UL << 2)")] public const uint STAP_ALLOW_WEBCONTENT = (1U << 2); [NativeTypeName("#define STAP_VALIDBITS (STAP_ALLOW_NONCLIENT | \\\r\n STAP_ALLOW_CONTROLS | \\\r\n STAP_ALLOW_WEBCONTENT)")] public const uint STAP_VALIDBITS = ((1U << 0) | (1U << 1) | (1U << 2)); [NativeTypeName("#define SZ_THDOCPROP_DISPLAYNAME L\"DisplayName\"")] public const string SZ_THDOCPROP_DISPLAYNAME = "DisplayName"; [NativeTypeName("#define SZ_THDOCPROP_CANONICALNAME L\"ThemeName\"")] public const string SZ_THDOCPROP_CANONICALNAME = "ThemeName"; [NativeTypeName("#define SZ_THDOCPROP_TOOLTIP L\"ToolTip\"")] public const string SZ_THDOCPROP_TOOLTIP = "ToolTip"; [NativeTypeName("#define SZ_THDOCPROP_AUTHOR L\"author\"")] public const string SZ_THDOCPROP_AUTHOR = "author"; [NativeTypeName("#define GBF_DIRECT 0x00000001")] public const int GBF_DIRECT = 0x00000001; [NativeTypeName("#define GBF_COPY 0x00000002")] public const int GBF_COPY = 0x00000002; [NativeTypeName("#define GBF_VALIDBITS (GBF_DIRECT | \\\r\n GBF_COPY)")] public const int GBF_VALIDBITS = (0x00000001 | 0x00000002); [NativeTypeName("#define DTPB_WINDOWDC 0x00000001")] public const int DTPB_WINDOWDC = 0x00000001; [NativeTypeName("#define DTPB_USECTLCOLORSTATIC 0x00000002")] public const int DTPB_USECTLCOLORSTATIC = 0x00000002; [NativeTypeName("#define DTPB_USEERASEBKGND 0x00000004")] public const int DTPB_USEERASEBKGND = 0x00000004; [NativeTypeName("#define WTNCA_NODRAWCAPTION 0x00000001")] public const int WTNCA_NODRAWCAPTION = 0x00000001; [NativeTypeName("#define WTNCA_NODRAWICON 0x00000002")] public const int WTNCA_NODRAWICON = 0x00000002; [NativeTypeName("#define WTNCA_NOSYSMENU 0x00000004")] public const int WTNCA_NOSYSMENU = 0x00000004; [NativeTypeName("#define WTNCA_NOMIRRORHELP 0x00000008")] public const int WTNCA_NOMIRRORHELP = 0x00000008; [NativeTypeName("#define WTNCA_VALIDBITS (WTNCA_NODRAWCAPTION | \\\r\n WTNCA_NODRAWICON | \\\r\n WTNCA_NOSYSMENU | \\\r\n WTNCA_NOMIRRORHELP)")] public const int WTNCA_VALIDBITS = (0x00000001 | 0x00000002 | 0x00000004 | 0x00000008); [NativeTypeName("#define DTT_TEXTCOLOR (1UL << 0)")] public const uint DTT_TEXTCOLOR = (1U << 0); [NativeTypeName("#define DTT_BORDERCOLOR (1UL << 1)")] public const uint DTT_BORDERCOLOR = (1U << 1); [NativeTypeName("#define DTT_SHADOWCOLOR (1UL << 2)")] public const uint DTT_SHADOWCOLOR = (1U << 2); [NativeTypeName("#define DTT_SHADOWTYPE (1UL << 3)")] public const uint DTT_SHADOWTYPE = (1U << 3); [NativeTypeName("#define DTT_SHADOWOFFSET (1UL << 4)")] public const uint DTT_SHADOWOFFSET = (1U << 4); [NativeTypeName("#define DTT_BORDERSIZE (1UL << 5)")] public const uint DTT_BORDERSIZE = (1U << 5); [NativeTypeName("#define DTT_FONTPROP (1UL << 6)")] public const uint DTT_FONTPROP = (1U << 6); [NativeTypeName("#define DTT_COLORPROP (1UL << 7)")] public const uint DTT_COLORPROP = (1U << 7); [NativeTypeName("#define DTT_STATEID (1UL << 8)")] public const uint DTT_STATEID = (1U << 8); [NativeTypeName("#define DTT_CALCRECT (1UL << 9)")] public const uint DTT_CALCRECT = (1U << 9); [NativeTypeName("#define DTT_APPLYOVERLAY (1UL << 10)")] public const uint DTT_APPLYOVERLAY = (1U << 10); [NativeTypeName("#define DTT_GLOWSIZE (1UL << 11)")] public const uint DTT_GLOWSIZE = (1U << 11); [NativeTypeName("#define DTT_CALLBACK (1UL << 12)")] public const uint DTT_CALLBACK = (1U << 12); [NativeTypeName("#define DTT_COMPOSITED (1UL << 13)")] public const uint DTT_COMPOSITED = (1U << 13); [NativeTypeName("#define DTT_VALIDBITS (DTT_TEXTCOLOR | \\\r\n DTT_BORDERCOLOR | \\\r\n DTT_SHADOWCOLOR | \\\r\n DTT_SHADOWTYPE | \\\r\n DTT_SHADOWOFFSET | \\\r\n DTT_BORDERSIZE | \\\r\n DTT_FONTPROP | \\\r\n DTT_COLORPROP | \\\r\n DTT_STATEID | \\\r\n DTT_CALCRECT | \\\r\n DTT_APPLYOVERLAY | \\\r\n DTT_GLOWSIZE | \\\r\n DTT_COMPOSITED)")] public const uint DTT_VALIDBITS = ((1U << 0) | (1U << 1) | (1U << 2) | (1U << 3) | (1U << 4) | (1U << 5) | (1U << 6) | (1U << 7) | (1U << 8) | (1U << 9) | (1U << 10) | (1U << 11) | (1U << 13)); [NativeTypeName("#define BPBF_COMPOSITED BPBF_TOPDOWNDIB")] public const BP_BUFFERFORMAT BPBF_COMPOSITED = BPBF_TOPDOWNDIB; [NativeTypeName("#define BPPF_ERASE 0x0001")] public const int BPPF_ERASE = 0x0001; [NativeTypeName("#define BPPF_NOCLIP 0x0002")] public const int BPPF_NOCLIP = 0x0002; [NativeTypeName("#define BPPF_NONCLIENT 0x0004")] public const int BPPF_NONCLIENT = 0x0004; } }
61.374532
685
0.675413
[ "MIT" ]
DaZombieKiller/terrafx.interop.windows
sources/Interop/Windows/um/Uxtheme/Windows.cs
32,776
C#
//this source code was auto-generated by tolua#, do not modify it using System; using LuaInterface; public class Nova_RestorableMaterialWrap { public static void Register(LuaState L) { L.BeginClass(typeof(Nova.RestorableMaterial), typeof(UnityEngine.Material)); L.RegFunction("SetTexture", SetTexture); L.RegFunction("SetTexturePath", SetTexturePath); L.RegFunction("GetRestoreData", GetRestoreData); L.RegFunction("RestoreMaterialFromData", RestoreMaterialFromData); L.RegFunction("New", _CreateNova_RestorableMaterial); L.RegFunction("__eq", op_Equality); L.RegFunction("__tostring", ToLua.op_ToString); L.EndClass(); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _CreateNova_RestorableMaterial(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes<UnityEngine.Shader>(L, 1)) { UnityEngine.Shader arg0 = (UnityEngine.Shader)ToLua.ToObject(L, 1); Nova.RestorableMaterial obj = new Nova.RestorableMaterial(arg0); ToLua.Push(L, obj); return 1; } else if (count == 1 && TypeChecker.CheckTypes<UnityEngine.Material>(L, 1)) { UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.ToObject(L, 1); Nova.RestorableMaterial obj = new Nova.RestorableMaterial(arg0); ToLua.Push(L, obj); return 1; } else if (count == 1 && TypeChecker.CheckTypes<Nova.RestorableMaterial>(L, 1)) { Nova.RestorableMaterial arg0 = (Nova.RestorableMaterial)ToLua.ToObject(L, 1); Nova.RestorableMaterial obj = new Nova.RestorableMaterial(arg0); ToLua.Push(L, obj); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Nova.RestorableMaterial.New"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int SetTexture(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3 && TypeChecker.CheckTypes<string, UnityEngine.Texture>(L, 2)) { Nova.RestorableMaterial obj = (Nova.RestorableMaterial)ToLua.CheckObject<Nova.RestorableMaterial>(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Texture arg1 = (UnityEngine.Texture)ToLua.ToObject(L, 3); obj.SetTexture(arg0, arg1); return 0; } else if (count == 3 && TypeChecker.CheckTypes<int, UnityEngine.Texture>(L, 2)) { Nova.RestorableMaterial obj = (Nova.RestorableMaterial)ToLua.CheckObject<Nova.RestorableMaterial>(L, 1); int arg0 = (int)LuaDLL.lua_tonumber(L, 2); UnityEngine.Texture arg1 = (UnityEngine.Texture)ToLua.ToObject(L, 3); obj.SetTexture(arg0, arg1); return 0; } else if (count == 4 && TypeChecker.CheckTypes<string, UnityEngine.RenderTexture, UnityEngine.Rendering.RenderTextureSubElement>(L, 2)) { Nova.RestorableMaterial obj = (Nova.RestorableMaterial)ToLua.CheckObject<Nova.RestorableMaterial>(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.RenderTexture arg1 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 3); UnityEngine.Rendering.RenderTextureSubElement arg2 = (UnityEngine.Rendering.RenderTextureSubElement)ToLua.ToObject(L, 4); obj.SetTexture(arg0, arg1, arg2); return 0; } else if (count == 4 && TypeChecker.CheckTypes<int, UnityEngine.RenderTexture, UnityEngine.Rendering.RenderTextureSubElement>(L, 2)) { Nova.RestorableMaterial obj = (Nova.RestorableMaterial)ToLua.CheckObject<Nova.RestorableMaterial>(L, 1); int arg0 = (int)LuaDLL.lua_tonumber(L, 2); UnityEngine.RenderTexture arg1 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 3); UnityEngine.Rendering.RenderTextureSubElement arg2 = (UnityEngine.Rendering.RenderTextureSubElement)ToLua.ToObject(L, 4); obj.SetTexture(arg0, arg1, arg2); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: Nova.RestorableMaterial.SetTexture"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int SetTexturePath(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); Nova.RestorableMaterial obj = (Nova.RestorableMaterial)ToLua.CheckObject<Nova.RestorableMaterial>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); obj.SetTexturePath(arg0, arg1); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetRestoreData(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject<UnityEngine.Material>(L, 1); Nova.MaterialRestoreData o = Nova.RestorableMaterial.GetRestoreData(arg0); ToLua.PushObject(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int RestoreMaterialFromData(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Nova.MaterialRestoreData arg0 = (Nova.MaterialRestoreData)ToLua.CheckObject<Nova.MaterialRestoreData>(L, 1); Nova.MaterialFactory arg1 = (Nova.MaterialFactory)ToLua.CheckObject(L, 2, typeof(Nova.MaterialFactory)); UnityEngine.Material o = Nova.RestorableMaterial.RestoreMaterialFromData(arg0, arg1); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int op_Equality(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); bool o = arg0 == arg1; LuaDLL.lua_pushboolean(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } }
32.147541
137
0.719871
[ "MIT" ]
Orangexx/NovaForStudy
Assets/Nova/Sources/ThirdParty/ToLua/Source/Generate/Nova_RestorableMaterialWrap.cs
5,885
C#
using System.Data; using System.Linq; using System.Text; using YJC.Toolkit.Cache; using YJC.Toolkit.MetaData; using YJC.Toolkit.Sys; namespace YJC.Toolkit.Data { [CacheInstance] [AlwaysCache] [SqlProvider(RegName = REG_NAME, Author = "YJC", CreateDate = "2009-04-10", Description = DESCRIPTION)] internal sealed class YukonSqlProvider : SqlServerSqlProvider { internal new const string REG_NAME = "SQL Server2005"; internal new const string DESCRIPTION = "SQL Server2005及后续版本的数据库SQL生成器"; private static void ProcessOrderBy(IFieldInfo[] keyFields, ref string orderBy) { if (string.IsNullOrEmpty(orderBy)) { if (keyFields.Length == 1) orderBy = "ORDER BY " + keyFields[0].FieldName; else orderBy = "ORDER BY " + string.Join(", ", from item in keyFields select item.FieldName); } } protected override IListSqlContext GetListSql(string selectFields, string tableName, IFieldInfo[] keyFields, string whereClause, string orderBy, int startNum, int endNum) { if (keyFields == null || keyFields.Length == 0) { IListSqlContext context = base.GetListSql(selectFields, tableName, keyFields, whereClause, orderBy, startNum, endNum); return new YukonListSqlContext(context); } string sql; if (endNum == 0) sql = string.Format(ObjectUtil.SysCulture, "SELECT {0} FROM {1} {2} {3}", selectFields, tableName, whereClause, orderBy); else { ProcessOrderBy(keyFields, ref orderBy); sql = string.Format(ObjectUtil.SysCulture, "SELECT * FROM (SELECT {0}, ROW_NUMBER() OVER ({3}) ROWNUMBER_ FROM {1} {2})" + " _TOOLKIT WHERE ROWNUMBER_ > {4} AND ROWNUMBER_ <= {5}", selectFields, tableName, whereClause, orderBy, startNum, endNum); } return new YukonListSqlContext(sql); } protected override void SetListData(IListSqlContext context, ISimpleAdapter adapter, DataSet dataSet, int startRecord, int maxRecords, string srcTable) { TkDebug.AssertArgumentNull(context, "context", this); YukonListSqlContext sqlContext = context.Convert<YukonListSqlContext>(); if (sqlContext.UseTopSql) base.SetListData(context, adapter, dataSet, startRecord, maxRecords, srcTable); else DbUtil.FillDataSet(adapter, dataSet, srcTable); } protected override string GetRowNumSql(string tableName, IFieldInfo[] keyFields, string whereClause, string rowNumFilter, string orderBy, int startNum, int endNum) { TkDebug.AssertArgumentNullOrEmpty(tableName, "tableName", this); TkDebug.AssertArgument(!string.IsNullOrEmpty(orderBy) || (keyFields != null && keyFields.Length > 0), "keyFields", "在参数orderBy为空时,keyFields不能为空或者是空数组", this); TkDebug.AssertArgument(startNum >= 0, "startNum", string.Format(ObjectUtil.SysCulture, "参数startNum不能为负数,现在的值为{0}", startNum), this); TkDebug.AssertArgument(endNum >= 0, "endNum", string.Format(ObjectUtil.SysCulture, "参数endNum不能为负数,现在的值为{0}", endNum), this); ProcessOrderBy(keyFields, ref orderBy); StringBuilder sql = new StringBuilder(); sql.Append("SELECT ROWNUMBER_ FROM (SELECT ROW_NUMBER() OVER (").Append(orderBy); sql.Append(") ROWNUMBER_, * FROM ").Append(tableName).Append(" ").Append(whereClause); sql.Append(") _TOOLKIT"); if (startNum >= 0 || endNum >= 0 || !string.IsNullOrEmpty(rowNumFilter)) { int index = 0; sql.Append(" WHERE "); if (startNum >= 0) SqlBuilder.JoinStringItem(sql, index++, "ROWNUMBER_ > " + startNum, " AND "); if (endNum >= 0) SqlBuilder.JoinStringItem(sql, index++, "ROWNUMBER_ <= " + endNum, " AND "); if (!string.IsNullOrEmpty(rowNumFilter)) SqlBuilder.JoinStringItem(sql, index++, rowNumFilter, " AND "); } return sql.ToString(); } public override string ToString() { return DESCRIPTION; } } }
43.932692
117
0.584592
[ "BSD-3-Clause" ]
madiantech/tkcore
Data/YJC.Toolkit.AdoData/Data/_Provider/YukonSqlProvider.cs
4,681
C#
using System; using UnityEngine; using UniRx; namespace SocialGame.Internal.Loading { internal interface ILoadingModel { IObservable<GameObject> OnAddAsObservable(); IObservable<Unit> OnShowAsObservable(); IObservable<Unit> OnHideAsObservable(); } }
18.125
52
0.706897
[ "MIT" ]
hiyorin/TemplateProject-for-Unity
Assets/Plugins/SocialGameTemplate/Scripts/Internal/Loading/ILoadingModel.cs
292
C#
using System; using System.Linq.Expressions; using ReactiveUI; using ReactiveUI.Validation.Abstractions; using ReactiveUI.Validation.Extensions; using ReactiveUI.Validation.Helpers; namespace MovieList { public static class ValidationExtensions { public static bool IsUrl(this string? str) => String.IsNullOrEmpty(str) || str.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || str.StartsWith("https://", StringComparison.OrdinalIgnoreCase) || str.StartsWith("ftp://", StringComparison.OrdinalIgnoreCase); public static ValidationHelper ValidationRule<TViewModel>( this TViewModel viewModel, Expression<Func<TViewModel, string>> viewModelProperty, int minValue, int maxValue, string propertyName) where TViewModel : ReactiveObject, IValidatableViewModel => viewModel.ValidationRule( viewModelProperty, value => !String.IsNullOrWhiteSpace(value) && Int32.TryParse(value, out int number) && number >= minValue && number <= maxValue, value => String.IsNullOrWhiteSpace(value) ? $"{propertyName}Empty" : $"{propertyName}Invalid"); } }
38.142857
111
0.622472
[ "MIT" ]
op07n/test20
MovieList.Core/ValidationExtensions.cs
1,335
C#
namespace Bamboo.Attendance.Blazor.Menus { public class AttendanceMenus { private const string Prefix = "Attendance"; //Add your menu items here... //public const string Home = Prefix + ".MyNewMenuItem"; } }
22.363636
63
0.634146
[ "MIT" ]
BlazorHub/bamboomodules
Bamboo.Attendance/src/Bamboo.Attendance.Blazor/Menus/AttendanceMenus.cs
248
C#
using AutoMapper; using MediatR; using SiteWatcher.Application.Common.Commands; using SiteWatcher.Application.Common.Constants; using SiteWatcher.Application.Common.Validation; using SiteWatcher.Application.Interfaces; using SiteWatcher.Domain.DTOs.User; using SiteWatcher.Domain.Enums; namespace SiteWatcher.Application.Users.Commands.UpdateUser; public class UpdateUserCommand : Validable<UpdateUserCommand>, IRequest<ICommandResult<UpdateUserResult>> { public string? Name { get; set; } public string? Email { get; set; } public ELanguage Language { get; set; } public ETheme Theme { get; set; } } public class UpdateUserCommandHandler : IRequestHandler<UpdateUserCommand, ICommandResult<UpdateUserResult>> { private readonly IUserRepository _userRepository; private readonly IUnitOfWork _uow; private readonly IAuthService _authService; private readonly IMapper _mapper; private readonly ISession _session; public UpdateUserCommandHandler( IUserRepository userRepository, IUnitOfWork uow, IAuthService authService, IMapper mapper, ISession session) { _userRepository = userRepository; _uow = uow; _authService = authService; _mapper = mapper; _session = session; } public async Task<ICommandResult<UpdateUserResult>> Handle(UpdateUserCommand request, CancellationToken cancellationToken) { var appResult = new CommandResult<UpdateUserResult>(); var user = await _userRepository .GetAsync(u => u.Id == _session.UserId && u.Active, cancellationToken); if (user is null) return appResult.WithError(ApplicationErrors.USER_DO_NOT_EXIST); user.Update(_mapper.Map<UpdateUserInput>(request), _session.Now); await _uow.SaveChangesAsync(cancellationToken); var newToken = _authService.GenerateLoginToken(user); await _authService.WhiteListTokenForCurrentUser(newToken); return appResult.WithValue(new UpdateUserResult(newToken, !user.EmailConfirmed)); } }
35.965517
126
0.735379
[ "MIT" ]
xilapa/SiteWatcher
src/Application/Users/Commands/UpdateUser/UpdateUserCommand.cs
2,088
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting { using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.TestPlatform.TestHostProvider.Hosting; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Host; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; using Microsoft.VisualStudio.TestPlatform.Utilities; /// <summary> /// The default test host launcher for the engine. /// This works for Desktop local scenarios /// </summary> [ExtensionUri(DefaultTestHostUri)] [FriendlyName(DefaultTestHostFriendltName)] public class DefaultTestHostManager : ITestRuntimeProvider { private const string X64TestHostProcessName = "testhost.exe"; private const string X86TestHostProcessName = "testhost.x86.exe"; private const string DefaultTestHostUri = "HostProvider://DefaultTestHost"; private const string DefaultTestHostFriendltName = "DefaultTestHost"; private Architecture architecture; private IProcessHelper processHelper; private ITestHostLauncher customTestHostLauncher; private Process testHostProcess; private CancellationTokenSource hostLaunchCts; private StringBuilder testHostProcessStdError; private IMessageLogger messageLogger; private bool hostExitedEventRaised; /// <summary> /// Initializes a new instance of the <see cref="DefaultTestHostManager"/> class. /// </summary> public DefaultTestHostManager() : this(new ProcessHelper()) { } /// <summary> /// Initializes a new instance of the <see cref="DefaultTestHostManager"/> class. /// </summary> /// <param name="processHelper">Process helper instance.</param> internal DefaultTestHostManager(IProcessHelper processHelper) { this.processHelper = processHelper; } /// <inheritdoc/> public event EventHandler<HostProviderEventArgs> HostLaunched; /// <inheritdoc/> public event EventHandler<HostProviderEventArgs> HostExited; /// <inheritdoc/> public bool Shared { get; private set; } /// <summary> /// Gets the properties of the test executor launcher. These could be the targetID for emulator/phone specific scenarios. /// </summary> public IDictionary<string, string> Properties => new Dictionary<string, string>(); /// <summary> /// Gets or sets the error length for runtime error stream. /// </summary> protected int ErrorLength { get; set; } = 4096; /// <summary> /// Gets or sets the Timeout for runtime to initialize. /// </summary> protected int TimeOut { get; set; } = 10000; /// <summary> /// Gets callback on process exit /// </summary> private Action<object> ExitCallBack => (process) => { TestHostManagerCallbacks.ExitCallBack(this.processHelper, this.messageLogger, process, this.testHostProcessStdError, this.OnHostExited); }; /// <summary> /// Gets callback to read from process error stream /// </summary> private Action<object, string> ErrorReceivedCallback => (process, data) => { TestHostManagerCallbacks.ErrorReceivedCallback(this.testHostProcessStdError, data); }; /// <inheritdoc/> public void SetCustomLauncher(ITestHostLauncher customLauncher) { this.customTestHostLauncher = customLauncher; } /// <inheritdoc/> public async Task<int> LaunchTestHostAsync(TestProcessStartInfo testHostStartInfo) { return await Task.Run(() => this.LaunchHost(testHostStartInfo), this.GetCancellationTokenSource().Token); } /// <inheritdoc/> public virtual TestProcessStartInfo GetTestHostProcessStartInfo( IEnumerable<string> sources, IDictionary<string, string> environmentVariables, TestRunnerConnectionInfo connectionInfo) { // Default test host manager supports shared test sources var testHostProcessName = (this.architecture == Architecture.X86) ? X86TestHostProcessName : X64TestHostProcessName; var currentWorkingDirectory = Path.Combine(Path.GetDirectoryName(typeof(DefaultTestHostManager).GetTypeInfo().Assembly.Location), "..//"); var argumentsString = " " + connectionInfo.ToCommandLineOptions(); // "TestHost" is the name of the folder which contain Full CLR built testhost package assemblies. testHostProcessName = Path.Combine("TestHost", testHostProcessName); if (!this.Shared) { // Not sharing the host which means we need to pass the test assembly path as argument // so that the test host can create an appdomain on startup (Main method) and set appbase argumentsString += " " + "--testsourcepath " + "\"" + sources.FirstOrDefault() + "\""; } var testhostProcessPath = Path.Combine(currentWorkingDirectory, testHostProcessName); EqtTrace.Verbose("DefaultTestHostmanager: Full path of {0} is {1}", testHostProcessName, testhostProcessPath); // For IDEs and other scenario, current directory should be the // working directory (not the vstest.console.exe location). // For VS - this becomes the solution directory for example // "TestResults" directory will be created at "current directory" of test host var processWorkingDirectory = Directory.GetCurrentDirectory(); return new TestProcessStartInfo { FileName = testhostProcessPath, Arguments = argumentsString, EnvironmentVariables = environmentVariables ?? new Dictionary<string, string>(), WorkingDirectory = processWorkingDirectory }; } /// <inheritdoc/> public IEnumerable<string> GetTestPlatformExtensions(IEnumerable<string> sources, IEnumerable<string> extensions) { return extensions; } /// <inheritdoc/> public bool CanExecuteCurrentRunConfiguration(string runsettingsXml) { var config = XmlRunSettingsUtilities.GetRunConfigurationNode(runsettingsXml); var framework = config.TargetFrameworkVersion; // This is expected to be called once every run so returning a new instance every time. if (framework.Name.IndexOf("netstandard", StringComparison.OrdinalIgnoreCase) >= 0 || framework.Name.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } return true; } /// <summary> /// Raises HostLaunched event /// </summary> /// <param name="e">hostprovider event args</param> public void OnHostLaunched(HostProviderEventArgs e) { this.HostLaunched.SafeInvoke(this, e, "HostProviderEvents.OnHostLaunched"); } /// <summary> /// Raises HostExited event /// </summary> /// <param name="e">hostprovider event args</param> public void OnHostExited(HostProviderEventArgs e) { if (!this.hostExitedEventRaised) { this.hostExitedEventRaised = true; this.HostExited.SafeInvoke(this, e, "HostProviderEvents.OnHostError"); } } /// <inheritdoc/> public void Initialize(IMessageLogger logger, string runsettingsXml) { var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runsettingsXml); this.messageLogger = logger; this.architecture = runConfiguration.TargetPlatform; this.testHostProcess = null; this.Shared = !runConfiguration.DisableAppDomain; this.hostExitedEventRaised = false; } private CancellationTokenSource GetCancellationTokenSource() { this.hostLaunchCts = new CancellationTokenSource(this.TimeOut); return this.hostLaunchCts; } private int LaunchHost(TestProcessStartInfo testHostStartInfo) { try { this.testHostProcessStdError = new StringBuilder(this.ErrorLength, this.ErrorLength); EqtTrace.Verbose("Launching default test Host Process {0} with arguments {1}", testHostStartInfo.FileName, testHostStartInfo.Arguments); if (this.customTestHostLauncher == null) { EqtTrace.Verbose("DefaultTestHostManager: Starting process '{0}' with command line '{1}'", testHostStartInfo.FileName, testHostStartInfo.Arguments); this.testHostProcess = this.processHelper.LaunchProcess(testHostStartInfo.FileName, testHostStartInfo.Arguments, testHostStartInfo.WorkingDirectory, testHostStartInfo.EnvironmentVariables, this.ErrorReceivedCallback, this.ExitCallBack) as Process; } else { int processId = this.customTestHostLauncher.LaunchTestHost(testHostStartInfo); this.testHostProcess = Process.GetProcessById(processId); } } catch (OperationCanceledException ex) { this.OnHostExited(new HostProviderEventArgs(ex.Message, -1, 0)); return -1; } var pId = this.testHostProcess != null ? this.testHostProcess.Id : 0; this.OnHostLaunched(new HostProviderEventArgs("Test Runtime launched with Pid: " + pId)); return pId; } } }
42.326693
267
0.647308
[ "MIT" ]
tmds/vstest
src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs
10,624
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SysAnalytics.Model.Commands; using SysAnalytics.Data.Repositories; using SysAnalytics.Data.Infrastructure; using SysAnalytics.CommandProcessor.Command; namespace SysAnalytics.Domain.Handlers { public class DeleteExpenseHandler : ICommandHandler<DeleteExpenseCommand> { private readonly IExpenseRepository expenseRepository; private readonly IUnitOfWork unitOfWork; public DeleteExpenseHandler(IExpenseRepository expenseRepository, IUnitOfWork unitOfWork) { this.expenseRepository = expenseRepository; this.unitOfWork = unitOfWork; } public ICommandResult Execute(DeleteExpenseCommand command) { var expense = expenseRepository.GetById(command.ExpenseId); expenseRepository.Delete(expense); unitOfWork.Commit(); return new CommandResult(true); } } }
31.03125
97
0.72004
[ "MIT" ]
kostyrin/SysAnalytics
SysAnalytics.Domain/Handlers/Expense/DeleteExpenseHandler.cs
995
C#
/******************************************************************************* * Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.SageMaker; using Amazon.SageMaker.Model; namespace Amazon.PowerShell.Cmdlets.SM { /// <summary> /// Updates a context. /// </summary> [Cmdlet("Update", "SMContext", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("System.String")] [AWSCmdlet("Calls the Amazon SageMaker Service UpdateContext API operation.", Operation = new[] {"UpdateContext"}, SelectReturnType = typeof(Amazon.SageMaker.Model.UpdateContextResponse))] [AWSCmdletOutput("System.String or Amazon.SageMaker.Model.UpdateContextResponse", "This cmdlet returns a System.String object.", "The service call response (type Amazon.SageMaker.Model.UpdateContextResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class UpdateSMContextCmdlet : AmazonSageMakerClientCmdlet, IExecutor { #region Parameter ContextName /// <summary> /// <para> /// <para>The name of the context to update.</para> /// </para> /// </summary> #if !MODULAR [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] #else [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String ContextName { get; set; } #endregion #region Parameter Description /// <summary> /// <para> /// <para>The new description for the context.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Description { get; set; } #endregion #region Parameter Property /// <summary> /// <para> /// <para>The new list of properties. Overwrites the current property list.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Properties")] public System.Collections.Hashtable Property { get; set; } #endregion #region Parameter PropertiesToRemove /// <summary> /// <para> /// <para>A list of properties to remove.</para> /// </para> /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String[] PropertiesToRemove { get; set; } #endregion #region Parameter Select /// <summary> /// Use the -Select parameter to control the cmdlet output. The default value is 'ContextArn'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.SageMaker.Model.UpdateContextResponse). /// Specifying the name of a property of type Amazon.SageMaker.Model.UpdateContextResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "ContextArn"; #endregion #region Parameter PassThru /// <summary> /// Changes the cmdlet behavior to return the value passed to the ContextName parameter. /// The -PassThru parameter is deprecated, use -Select '^ContextName' instead. This parameter will be removed in a future version. /// </summary> [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^ContextName' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter Force /// <summary> /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ContextName), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-SMContext (UpdateContext)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate<Amazon.SageMaker.Model.UpdateContextResponse, UpdateSMContextCmdlet>(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); if (this.PassThru.IsPresent) { throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select)); } } else if (this.PassThru.IsPresent) { context.Select = (response, cmdlet) => this.ContextName; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.ContextName = this.ContextName; #if MODULAR if (this.ContextName == null && ParameterWasBound(nameof(this.ContextName))) { WriteWarning("You are passing $null as a value for parameter ContextName which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.Description = this.Description; if (this.Property != null) { context.Property = new Dictionary<System.String, System.String>(StringComparer.Ordinal); foreach (var hashKey in this.Property.Keys) { context.Property.Add((String)hashKey, (String)(this.Property[hashKey])); } } if (this.PropertiesToRemove != null) { context.PropertiesToRemove = new List<System.String>(this.PropertiesToRemove); } // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.SageMaker.Model.UpdateContextRequest(); if (cmdletContext.ContextName != null) { request.ContextName = cmdletContext.ContextName; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Property != null) { request.Properties = cmdletContext.Property; } if (cmdletContext.PropertiesToRemove != null) { request.PropertiesToRemove = cmdletContext.PropertiesToRemove; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return output; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.SageMaker.Model.UpdateContextResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.UpdateContextRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "UpdateContext"); try { #if DESKTOP return client.UpdateContext(request); #elif CORECLR return client.UpdateContextAsync(request).GetAwaiter().GetResult(); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.String ContextName { get; set; } public System.String Description { get; set; } public Dictionary<System.String, System.String> Property { get; set; } public List<System.String> PropertiesToRemove { get; set; } public System.Func<Amazon.SageMaker.Model.UpdateContextResponse, UpdateSMContextCmdlet, object> Select { get; set; } = (response, cmdlet) => response.ContextArn; } } }
43.654545
282
0.599667
[ "Apache-2.0" ]
QPC-database/aws-tools-for-powershell
modules/AWSPowerShell/Cmdlets/SageMaker/Basic/Update-SMContext-Cmdlet.cs
12,005
C#
using System; using System.Collections; namespace NSW.StarCitizen.Tools.Helpers { public static class DisposableUtils { public static void Dispose<T>(T obj) { if (obj != null) { if (obj is IDisposable disposableObj) { disposableObj.Dispose(); } else if (obj is IEnumerable enumerableObj) { foreach (var elementObj in enumerableObj) { Dispose(elementObj); } } } } } public class DynamicDisposable<T> : IDisposable { public T Object { get; } public static DynamicDisposable<T> CreateNonNull(T obj) => new DynamicDisposable<T>(obj); public static DynamicDisposable<T>? CreateNullable(T obj) => (obj != null) ? new DynamicDisposable<T>(obj) : null; public DynamicDisposable(T obj) { Object = obj; } public void Dispose() => DisposableUtils.Dispose(Object); } }
27.146341
122
0.508535
[ "MIT" ]
Laeng/StarCitizen
SCTools/SCTools/Helpers/DisposableUtils.cs
1,113
C#
using NUnit.Framework; namespace RequestifyTF2.Tests { [TestFixture] public static class RequestifyTest { public static void TestKill() { var sut = ReaderThread.TextChecker("BoyPussi killed dat boi 28 with sniperrifle. (crit)"); Assert.That(sut, Is.EqualTo(ReaderThread.Result.KillCrit)); sut = ReaderThread.TextChecker( "[NCC] DllMain killed $20 users with tf_projectile_rocket."); Assert.That(sut, Is.EqualTo(ReaderThread.Result.Kill)); } [Test] public static void TestCommandExecute() { var sut = ReaderThread.TextChecker( "nickname test lyl:) : !request https://www.youtube.com/watch?v=DZV3Xtp-BK0"); Assert.That(sut, Is.EqualTo(ReaderThread.Result.CommandExecute)); } [Test] public static void TestChat() { var sut = ReaderThread.TextChecker( "*DEAD* Hey : ImJust a test lul"); Assert.That(sut, Is.EqualTo(ReaderThread.Result.Chatted)); } [Test] public static void TestConnect() { var sut = ReaderThread.TextChecker("[NCC]Effie connected"); Assert.That(sut, Is.EqualTo(ReaderThread.Result.Connected)); } [Test] public static void TestKillCrit() { var sut = ReaderThread.TextChecker( "[RLS]V952 killed Tom with sniperrifle. (crit)"); Assert.That(sut, Is.EqualTo(ReaderThread.Result.KillCrit)); } [Test] public static void TestSuicide() { var sut = ReaderThread.TextChecker("DurRud suicided."); Assert.That(sut, Is.EqualTo(ReaderThread.Result.Suicide)); } } }
32.745455
102
0.577457
[ "MIT" ]
LewdDeveloper/RequestifyTF2
src/Tests/RequestifyTests/Tests.cs
1,803
C#
using System; class A { static void Main() { var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse); int n = h[0], m = h[1]; Console.WriteLine((n * (n - 1) + m * (m - 1)) / 2); } }
17.666667
67
0.518868
[ "MIT" ]
sakapon/AtCoder-Contests
CSharp/Contests2020/ABC159/A.cs
214
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.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; namespace System.Drawing { internal partial class SafeNativeMethods { internal unsafe partial class Gdip { private static IntPtr LoadNativeLibrary() { // Various Unix package managers have chosen different names for the "libgdiplus" shared library. // The mono project, where libgdiplus originated, allowed both of the names below to be used, via // a global configuration setting. We prefer the "unversioned" shared object name, and fallback to // the name suffixed with ".0". IntPtr lib = Interop.Libdl.dlopen("libgdiplus.so", Interop.Libdl.RTLD_NOW); if (lib == IntPtr.Zero) { lib = Interop.Libdl.dlopen("libgdiplus.so.0", Interop.Libdl.RTLD_NOW); if (lib == IntPtr.Zero) { throw new DllNotFoundException(SR.LibgdiplusNotFound); } } return lib; } private static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName) => Interop.Libdl.dlsym(nativeLibraryHandle, functionName); internal static void CheckStatus(Status status) => GDIPlus.CheckStatus(status); private static void LoadPlatformFunctionPointers() { GdiplusStartup_ptr = LoadFunction<GdiplusStartup_delegate>("GdiplusStartup"); GdiplusShutdown_ptr = LoadFunction<GdiplusShutdown_delegate>("GdiplusShutdown"); GdipAlloc_ptr = LoadFunction<GdipAlloc_delegate>("GdipAlloc"); GdipFree_ptr = LoadFunction<GdipFree_delegate>("GdipFree"); GdipDeleteBrush_ptr = LoadFunction<GdipDeleteBrush_delegate>("GdipDeleteBrush"); GdipGetBrushType_ptr = LoadFunction<GdipGetBrushType_delegate>("GdipGetBrushType"); GdipCreateRegion_ptr = LoadFunction<GdipCreateRegion_delegate>("GdipCreateRegion"); GdipCreateRegionRgnData_ptr = LoadFunction<GdipCreateRegionRgnData_delegate>("GdipCreateRegionRgnData"); GdipDeleteRegion_ptr = LoadFunction<GdipDeleteRegion_delegate>("GdipDeleteRegion"); GdipCloneRegion_ptr = LoadFunction<GdipCloneRegion_delegate>("GdipCloneRegion"); GdipCreateRegionRect_ptr = LoadFunction<GdipCreateRegionRect_delegate>("GdipCreateRegionRect"); GdipCreateRegionRectI_ptr = LoadFunction<GdipCreateRegionRectI_delegate>("GdipCreateRegionRectI"); GdipCreateRegionPath_ptr = LoadFunction<GdipCreateRegionPath_delegate>("GdipCreateRegionPath"); GdipTranslateRegion_ptr = LoadFunction<GdipTranslateRegion_delegate>("GdipTranslateRegion"); GdipTranslateRegionI_ptr = LoadFunction<GdipTranslateRegionI_delegate>("GdipTranslateRegionI"); GdipIsVisibleRegionPoint_ptr = LoadFunction<GdipIsVisibleRegionPoint_delegate>("GdipIsVisibleRegionPoint"); GdipIsVisibleRegionPointI_ptr = LoadFunction<GdipIsVisibleRegionPointI_delegate>("GdipIsVisibleRegionPointI"); GdipIsVisibleRegionRect_ptr = LoadFunction<GdipIsVisibleRegionRect_delegate>("GdipIsVisibleRegionRect"); GdipIsVisibleRegionRectI_ptr = LoadFunction<GdipIsVisibleRegionRectI_delegate>("GdipIsVisibleRegionRectI"); GdipCombineRegionRect_ptr = LoadFunction<GdipCombineRegionRect_delegate>("GdipCombineRegionRect"); GdipCombineRegionRectI_ptr = LoadFunction<GdipCombineRegionRectI_delegate>("GdipCombineRegionRectI"); GdipCombineRegionPath_ptr = LoadFunction<GdipCombineRegionPath_delegate>("GdipCombineRegionPath"); GdipGetRegionBounds_ptr = LoadFunction<GdipGetRegionBounds_delegate>("GdipGetRegionBounds"); GdipSetInfinite_ptr = LoadFunction<GdipSetInfinite_delegate>("GdipSetInfinite"); GdipSetEmpty_ptr = LoadFunction<GdipSetEmpty_delegate>("GdipSetEmpty"); GdipIsEmptyRegion_ptr = LoadFunction<GdipIsEmptyRegion_delegate>("GdipIsEmptyRegion"); GdipIsInfiniteRegion_ptr = LoadFunction<GdipIsInfiniteRegion_delegate>("GdipIsInfiniteRegion"); GdipCombineRegionRegion_ptr = LoadFunction<GdipCombineRegionRegion_delegate>("GdipCombineRegionRegion"); GdipIsEqualRegion_ptr = LoadFunction<GdipIsEqualRegion_delegate>("GdipIsEqualRegion"); GdipGetRegionDataSize_ptr = LoadFunction<GdipGetRegionDataSize_delegate>("GdipGetRegionDataSize"); GdipGetRegionData_ptr = LoadFunction<GdipGetRegionData_delegate>("GdipGetRegionData"); GdipGetRegionScansCount_ptr = LoadFunction<GdipGetRegionScansCount_delegate>("GdipGetRegionScansCount"); GdipGetRegionScans_ptr = LoadFunction<GdipGetRegionScans_delegate>("GdipGetRegionScans"); GdipTransformRegion_ptr = LoadFunction<GdipTransformRegion_delegate>("GdipTransformRegion"); GdipFillRegion_ptr = LoadFunction<GdipFillRegion_delegate>("GdipFillRegion"); GdipGetRegionHRgn_ptr = LoadFunction<GdipGetRegionHRgn_delegate>("GdipGetRegionHRgn"); GdipCreateRegionHrgn_ptr = LoadFunction<GdipCreateRegionHrgn_delegate>("GdipCreateRegionHrgn"); GdipCreatePathGradientFromPath_ptr = LoadFunction<GdipCreatePathGradientFromPath_delegate>("GdipCreatePathGradientFromPath"); GdipCreatePathGradientI_ptr = LoadFunction<GdipCreatePathGradientI_delegate>("GdipCreatePathGradientI"); GdipCreatePathGradient_ptr = LoadFunction<GdipCreatePathGradient_delegate>("GdipCreatePathGradient"); GdipGetPathGradientBlendCount_ptr = LoadFunction<GdipGetPathGradientBlendCount_delegate>("GdipGetPathGradientBlendCount"); GdipGetPathGradientBlend_ptr = LoadFunction<GdipGetPathGradientBlend_delegate>("GdipGetPathGradientBlend"); GdipSetPathGradientBlend_ptr = LoadFunction<GdipSetPathGradientBlend_delegate>("GdipSetPathGradientBlend"); GdipGetPathGradientCenterColor_ptr = LoadFunction<GdipGetPathGradientCenterColor_delegate>("GdipGetPathGradientCenterColor"); GdipSetPathGradientCenterColor_ptr = LoadFunction<GdipSetPathGradientCenterColor_delegate>("GdipSetPathGradientCenterColor"); GdipGetPathGradientCenterPoint_ptr = LoadFunction<GdipGetPathGradientCenterPoint_delegate>("GdipGetPathGradientCenterPoint"); GdipSetPathGradientCenterPoint_ptr = LoadFunction<GdipSetPathGradientCenterPoint_delegate>("GdipSetPathGradientCenterPoint"); GdipGetPathGradientFocusScales_ptr = LoadFunction<GdipGetPathGradientFocusScales_delegate>("GdipGetPathGradientFocusScales"); GdipSetPathGradientFocusScales_ptr = LoadFunction<GdipSetPathGradientFocusScales_delegate>("GdipSetPathGradientFocusScales"); GdipGetPathGradientPresetBlendCount_ptr = LoadFunction<GdipGetPathGradientPresetBlendCount_delegate>("GdipGetPathGradientPresetBlendCount"); GdipGetPathGradientPresetBlend_ptr = LoadFunction<GdipGetPathGradientPresetBlend_delegate>("GdipGetPathGradientPresetBlend"); GdipSetPathGradientPresetBlend_ptr = LoadFunction<GdipSetPathGradientPresetBlend_delegate>("GdipSetPathGradientPresetBlend"); GdipGetPathGradientRect_ptr = LoadFunction<GdipGetPathGradientRect_delegate>("GdipGetPathGradientRect"); GdipGetPathGradientSurroundColorCount_ptr = LoadFunction<GdipGetPathGradientSurroundColorCount_delegate>("GdipGetPathGradientSurroundColorCount"); GdipGetPathGradientSurroundColorsWithCount_ptr = LoadFunction<GdipGetPathGradientSurroundColorsWithCount_delegate>("GdipGetPathGradientSurroundColorsWithCount"); GdipSetPathGradientSurroundColorsWithCount_ptr = LoadFunction<GdipSetPathGradientSurroundColorsWithCount_delegate>("GdipSetPathGradientSurroundColorsWithCount"); GdipGetPathGradientTransform_ptr = LoadFunction<GdipGetPathGradientTransform_delegate>("GdipGetPathGradientTransform"); GdipSetPathGradientTransform_ptr = LoadFunction<GdipSetPathGradientTransform_delegate>("GdipSetPathGradientTransform"); GdipGetPathGradientWrapMode_ptr = LoadFunction<GdipGetPathGradientWrapMode_delegate>("GdipGetPathGradientWrapMode"); GdipSetPathGradientWrapMode_ptr = LoadFunction<GdipSetPathGradientWrapMode_delegate>("GdipSetPathGradientWrapMode"); GdipSetPathGradientLinearBlend_ptr = LoadFunction<GdipSetPathGradientLinearBlend_delegate>("GdipSetPathGradientLinearBlend"); GdipSetPathGradientSigmaBlend_ptr = LoadFunction<GdipSetPathGradientSigmaBlend_delegate>("GdipSetPathGradientSigmaBlend"); GdipMultiplyPathGradientTransform_ptr = LoadFunction<GdipMultiplyPathGradientTransform_delegate>("GdipMultiplyPathGradientTransform"); GdipResetPathGradientTransform_ptr = LoadFunction<GdipResetPathGradientTransform_delegate>("GdipResetPathGradientTransform"); GdipRotatePathGradientTransform_ptr = LoadFunction<GdipRotatePathGradientTransform_delegate>("GdipRotatePathGradientTransform"); GdipScalePathGradientTransform_ptr = LoadFunction<GdipScalePathGradientTransform_delegate>("GdipScalePathGradientTransform"); GdipTranslatePathGradientTransform_ptr = LoadFunction<GdipTranslatePathGradientTransform_delegate>("GdipTranslatePathGradientTransform"); GdipCreateLineBrushI_ptr = LoadFunction<GdipCreateLineBrushI_delegate>("GdipCreateLineBrushI"); GdipCreateLineBrush_ptr = LoadFunction<GdipCreateLineBrush_delegate>("GdipCreateLineBrush"); GdipCreateLineBrushFromRectI_ptr = LoadFunction<GdipCreateLineBrushFromRectI_delegate>("GdipCreateLineBrushFromRectI"); GdipCreateLineBrushFromRect_ptr = LoadFunction<GdipCreateLineBrushFromRect_delegate>("GdipCreateLineBrushFromRect"); GdipCreateLineBrushFromRectWithAngleI_ptr = LoadFunction<GdipCreateLineBrushFromRectWithAngleI_delegate>("GdipCreateLineBrushFromRectWithAngleI"); GdipCreateLineBrushFromRectWithAngle_ptr = LoadFunction<GdipCreateLineBrushFromRectWithAngle_delegate>("GdipCreateLineBrushFromRectWithAngle"); GdipGetLineBlendCount_ptr = LoadFunction<GdipGetLineBlendCount_delegate>("GdipGetLineBlendCount"); GdipSetLineBlend_ptr = LoadFunction<GdipSetLineBlend_delegate>("GdipSetLineBlend"); GdipGetLineBlend_ptr = LoadFunction<GdipGetLineBlend_delegate>("GdipGetLineBlend"); GdipSetLineGammaCorrection_ptr = LoadFunction<GdipSetLineGammaCorrection_delegate>("GdipSetLineGammaCorrection"); GdipGetLineGammaCorrection_ptr = LoadFunction<GdipGetLineGammaCorrection_delegate>("GdipGetLineGammaCorrection"); GdipGetLinePresetBlendCount_ptr = LoadFunction<GdipGetLinePresetBlendCount_delegate>("GdipGetLinePresetBlendCount"); GdipSetLinePresetBlend_ptr = LoadFunction<GdipSetLinePresetBlend_delegate>("GdipSetLinePresetBlend"); GdipGetLinePresetBlend_ptr = LoadFunction<GdipGetLinePresetBlend_delegate>("GdipGetLinePresetBlend"); GdipSetLineColors_ptr = LoadFunction<GdipSetLineColors_delegate>("GdipSetLineColors"); GdipGetLineColors_ptr = LoadFunction<GdipGetLineColors_delegate>("GdipGetLineColors"); GdipGetLineRectI_ptr = LoadFunction<GdipGetLineRectI_delegate>("GdipGetLineRectI"); GdipGetLineRect_ptr = LoadFunction<GdipGetLineRect_delegate>("GdipGetLineRect"); GdipSetLineTransform_ptr = LoadFunction<GdipSetLineTransform_delegate>("GdipSetLineTransform"); GdipGetLineTransform_ptr = LoadFunction<GdipGetLineTransform_delegate>("GdipGetLineTransform"); GdipSetLineWrapMode_ptr = LoadFunction<GdipSetLineWrapMode_delegate>("GdipSetLineWrapMode"); GdipGetLineWrapMode_ptr = LoadFunction<GdipGetLineWrapMode_delegate>("GdipGetLineWrapMode"); GdipSetLineLinearBlend_ptr = LoadFunction<GdipSetLineLinearBlend_delegate>("GdipSetLineLinearBlend"); GdipSetLineSigmaBlend_ptr = LoadFunction<GdipSetLineSigmaBlend_delegate>("GdipSetLineSigmaBlend"); GdipMultiplyLineTransform_ptr = LoadFunction<GdipMultiplyLineTransform_delegate>("GdipMultiplyLineTransform"); GdipResetLineTransform_ptr = LoadFunction<GdipResetLineTransform_delegate>("GdipResetLineTransform"); GdipRotateLineTransform_ptr = LoadFunction<GdipRotateLineTransform_delegate>("GdipRotateLineTransform"); GdipScaleLineTransform_ptr = LoadFunction<GdipScaleLineTransform_delegate>("GdipScaleLineTransform"); GdipTranslateLineTransform_ptr = LoadFunction<GdipTranslateLineTransform_delegate>("GdipTranslateLineTransform"); GdipCreateFromHDC_ptr = LoadFunction<GdipCreateFromHDC_delegate>("GdipCreateFromHDC"); GdipDeleteGraphics_ptr = LoadFunction<GdipDeleteGraphics_delegate>("GdipDeleteGraphics"); GdipRestoreGraphics_ptr = LoadFunction<GdipRestoreGraphics_delegate>("GdipRestoreGraphics"); GdipSaveGraphics_ptr = LoadFunction<GdipSaveGraphics_delegate>("GdipSaveGraphics"); GdipMultiplyWorldTransform_ptr = LoadFunction<GdipMultiplyWorldTransform_delegate>("GdipMultiplyWorldTransform"); GdipRotateWorldTransform_ptr = LoadFunction<GdipRotateWorldTransform_delegate>("GdipRotateWorldTransform"); GdipTranslateWorldTransform_ptr = LoadFunction<GdipTranslateWorldTransform_delegate>("GdipTranslateWorldTransform"); GdipDrawArc_ptr = LoadFunction<GdipDrawArc_delegate>("GdipDrawArc"); GdipDrawArcI_ptr = LoadFunction<GdipDrawArcI_delegate>("GdipDrawArcI"); GdipDrawBezier_ptr = LoadFunction<GdipDrawBezier_delegate>("GdipDrawBezier"); GdipDrawBezierI_ptr = LoadFunction<GdipDrawBezierI_delegate>("GdipDrawBezierI"); GdipDrawEllipseI_ptr = LoadFunction<GdipDrawEllipseI_delegate>("GdipDrawEllipseI"); GdipDrawEllipse_ptr = LoadFunction<GdipDrawEllipse_delegate>("GdipDrawEllipse"); GdipDrawLine_ptr = LoadFunction<GdipDrawLine_delegate>("GdipDrawLine"); GdipDrawLineI_ptr = LoadFunction<GdipDrawLineI_delegate>("GdipDrawLineI"); GdipDrawLines_ptr = LoadFunction<GdipDrawLines_delegate>("GdipDrawLines"); GdipDrawLinesI_ptr = LoadFunction<GdipDrawLinesI_delegate>("GdipDrawLinesI"); GdipDrawPath_ptr = LoadFunction<GdipDrawPath_delegate>("GdipDrawPath"); GdipDrawPie_ptr = LoadFunction<GdipDrawPie_delegate>("GdipDrawPie"); GdipDrawPieI_ptr = LoadFunction<GdipDrawPieI_delegate>("GdipDrawPieI"); GdipDrawPolygon_ptr = LoadFunction<GdipDrawPolygon_delegate>("GdipDrawPolygon"); GdipDrawPolygonI_ptr = LoadFunction<GdipDrawPolygonI_delegate>("GdipDrawPolygonI"); GdipDrawRectangle_ptr = LoadFunction<GdipDrawRectangle_delegate>("GdipDrawRectangle"); GdipDrawRectangleI_ptr = LoadFunction<GdipDrawRectangleI_delegate>("GdipDrawRectangleI"); GdipDrawRectangles_ptr = LoadFunction<GdipDrawRectangles_delegate>("GdipDrawRectangles"); GdipDrawRectanglesI_ptr = LoadFunction<GdipDrawRectanglesI_delegate>("GdipDrawRectanglesI"); GdipFillEllipseI_ptr = LoadFunction<GdipFillEllipseI_delegate>("GdipFillEllipseI"); GdipFillEllipse_ptr = LoadFunction<GdipFillEllipse_delegate>("GdipFillEllipse"); GdipFillPolygon_ptr = LoadFunction<GdipFillPolygon_delegate>("GdipFillPolygon"); GdipFillPolygonI_ptr = LoadFunction<GdipFillPolygonI_delegate>("GdipFillPolygonI"); GdipFillPolygon2_ptr = LoadFunction<GdipFillPolygon2_delegate>("GdipFillPolygon2"); GdipFillPolygon2I_ptr = LoadFunction<GdipFillPolygon2I_delegate>("GdipFillPolygon2I"); GdipFillRectangle_ptr = LoadFunction<GdipFillRectangle_delegate>("GdipFillRectangle"); GdipFillRectangleI_ptr = LoadFunction<GdipFillRectangleI_delegate>("GdipFillRectangleI"); GdipFillRectangles_ptr = LoadFunction<GdipFillRectangles_delegate>("GdipFillRectangles"); GdipFillRectanglesI_ptr = LoadFunction<GdipFillRectanglesI_delegate>("GdipFillRectanglesI"); GdipDrawString_ptr = LoadFunction<GdipDrawString_delegate>("GdipDrawString"); GdipGetDC_ptr = LoadFunction<GdipGetDC_delegate>("GdipGetDC"); GdipReleaseDC_ptr = LoadFunction<GdipReleaseDC_delegate>("GdipReleaseDC"); GdipDrawImageRectI_ptr = LoadFunction<GdipDrawImageRectI_delegate>("GdipDrawImageRectI"); GdipGetRenderingOrigin_ptr = LoadFunction<GdipGetRenderingOrigin_delegate>("GdipGetRenderingOrigin"); GdipSetRenderingOrigin_ptr = LoadFunction<GdipSetRenderingOrigin_delegate>("GdipSetRenderingOrigin"); GdipCloneBitmapArea_ptr = LoadFunction<GdipCloneBitmapArea_delegate>("GdipCloneBitmapArea"); GdipCloneBitmapAreaI_ptr = LoadFunction<GdipCloneBitmapAreaI_delegate>("GdipCloneBitmapAreaI"); GdipResetWorldTransform_ptr = LoadFunction<GdipResetWorldTransform_delegate>("GdipResetWorldTransform"); GdipSetWorldTransform_ptr = LoadFunction<GdipSetWorldTransform_delegate>("GdipSetWorldTransform"); GdipGetWorldTransform_ptr = LoadFunction<GdipGetWorldTransform_delegate>("GdipGetWorldTransform"); GdipScaleWorldTransform_ptr = LoadFunction<GdipScaleWorldTransform_delegate>("GdipScaleWorldTransform"); GdipGraphicsClear_ptr = LoadFunction<GdipGraphicsClear_delegate>("GdipGraphicsClear"); GdipDrawClosedCurve_ptr = LoadFunction<GdipDrawClosedCurve_delegate>("GdipDrawClosedCurve"); GdipDrawClosedCurveI_ptr = LoadFunction<GdipDrawClosedCurveI_delegate>("GdipDrawClosedCurveI"); GdipDrawClosedCurve2_ptr = LoadFunction<GdipDrawClosedCurve2_delegate>("GdipDrawClosedCurve2"); GdipDrawClosedCurve2I_ptr = LoadFunction<GdipDrawClosedCurve2I_delegate>("GdipDrawClosedCurve2I"); GdipDrawCurve_ptr = LoadFunction<GdipDrawCurve_delegate>("GdipDrawCurve"); GdipDrawCurveI_ptr = LoadFunction<GdipDrawCurveI_delegate>("GdipDrawCurveI"); GdipDrawCurve2_ptr = LoadFunction<GdipDrawCurve2_delegate>("GdipDrawCurve2"); GdipDrawCurve2I_ptr = LoadFunction<GdipDrawCurve2I_delegate>("GdipDrawCurve2I"); GdipDrawCurve3_ptr = LoadFunction<GdipDrawCurve3_delegate>("GdipDrawCurve3"); GdipDrawCurve3I_ptr = LoadFunction<GdipDrawCurve3I_delegate>("GdipDrawCurve3I"); GdipSetClipRect_ptr = LoadFunction<GdipSetClipRect_delegate>("GdipSetClipRect"); GdipSetClipRectI_ptr = LoadFunction<GdipSetClipRectI_delegate>("GdipSetClipRectI"); GdipSetClipPath_ptr = LoadFunction<GdipSetClipPath_delegate>("GdipSetClipPath"); GdipSetClipRegion_ptr = LoadFunction<GdipSetClipRegion_delegate>("GdipSetClipRegion"); GdipSetClipGraphics_ptr = LoadFunction<GdipSetClipGraphics_delegate>("GdipSetClipGraphics"); GdipResetClip_ptr = LoadFunction<GdipResetClip_delegate>("GdipResetClip"); GdipEndContainer_ptr = LoadFunction<GdipEndContainer_delegate>("GdipEndContainer"); GdipGetClip_ptr = LoadFunction<GdipGetClip_delegate>("GdipGetClip"); GdipFillClosedCurve_ptr = LoadFunction<GdipFillClosedCurve_delegate>("GdipFillClosedCurve"); GdipFillClosedCurveI_ptr = LoadFunction<GdipFillClosedCurveI_delegate>("GdipFillClosedCurveI"); GdipFillClosedCurve2_ptr = LoadFunction<GdipFillClosedCurve2_delegate>("GdipFillClosedCurve2"); GdipFillClosedCurve2I_ptr = LoadFunction<GdipFillClosedCurve2I_delegate>("GdipFillClosedCurve2I"); GdipFillPie_ptr = LoadFunction<GdipFillPie_delegate>("GdipFillPie"); GdipFillPieI_ptr = LoadFunction<GdipFillPieI_delegate>("GdipFillPieI"); GdipFillPath_ptr = LoadFunction<GdipFillPath_delegate>("GdipFillPath"); GdipGetNearestColor_ptr = LoadFunction<GdipGetNearestColor_delegate>("GdipGetNearestColor"); GdipIsVisiblePoint_ptr = LoadFunction<GdipIsVisiblePoint_delegate>("GdipIsVisiblePoint"); GdipIsVisiblePointI_ptr = LoadFunction<GdipIsVisiblePointI_delegate>("GdipIsVisiblePointI"); GdipIsVisibleRect_ptr = LoadFunction<GdipIsVisibleRect_delegate>("GdipIsVisibleRect"); GdipIsVisibleRectI_ptr = LoadFunction<GdipIsVisibleRectI_delegate>("GdipIsVisibleRectI"); GdipTransformPoints_ptr = LoadFunction<GdipTransformPoints_delegate>("GdipTransformPoints"); GdipTransformPointsI_ptr = LoadFunction<GdipTransformPointsI_delegate>("GdipTransformPointsI"); GdipTranslateClip_ptr = LoadFunction<GdipTranslateClip_delegate>("GdipTranslateClip"); GdipTranslateClipI_ptr = LoadFunction<GdipTranslateClipI_delegate>("GdipTranslateClipI"); GdipGetClipBounds_ptr = LoadFunction<GdipGetClipBounds_delegate>("GdipGetClipBounds"); GdipSetCompositingMode_ptr = LoadFunction<GdipSetCompositingMode_delegate>("GdipSetCompositingMode"); GdipGetCompositingMode_ptr = LoadFunction<GdipGetCompositingMode_delegate>("GdipGetCompositingMode"); GdipSetCompositingQuality_ptr = LoadFunction<GdipSetCompositingQuality_delegate>("GdipSetCompositingQuality"); GdipGetCompositingQuality_ptr = LoadFunction<GdipGetCompositingQuality_delegate>("GdipGetCompositingQuality"); GdipSetInterpolationMode_ptr = LoadFunction<GdipSetInterpolationMode_delegate>("GdipSetInterpolationMode"); GdipGetInterpolationMode_ptr = LoadFunction<GdipGetInterpolationMode_delegate>("GdipGetInterpolationMode"); GdipGetDpiX_ptr = LoadFunction<GdipGetDpiX_delegate>("GdipGetDpiX"); GdipGetDpiY_ptr = LoadFunction<GdipGetDpiY_delegate>("GdipGetDpiY"); GdipIsClipEmpty_ptr = LoadFunction<GdipIsClipEmpty_delegate>("GdipIsClipEmpty"); GdipIsVisibleClipEmpty_ptr = LoadFunction<GdipIsVisibleClipEmpty_delegate>("GdipIsVisibleClipEmpty"); GdipGetPageUnit_ptr = LoadFunction<GdipGetPageUnit_delegate>("GdipGetPageUnit"); GdipGetPageScale_ptr = LoadFunction<GdipGetPageScale_delegate>("GdipGetPageScale"); GdipSetPageUnit_ptr = LoadFunction<GdipSetPageUnit_delegate>("GdipSetPageUnit"); GdipSetPageScale_ptr = LoadFunction<GdipSetPageScale_delegate>("GdipSetPageScale"); GdipSetPixelOffsetMode_ptr = LoadFunction<GdipSetPixelOffsetMode_delegate>("GdipSetPixelOffsetMode"); GdipGetPixelOffsetMode_ptr = LoadFunction<GdipGetPixelOffsetMode_delegate>("GdipGetPixelOffsetMode"); GdipSetSmoothingMode_ptr = LoadFunction<GdipSetSmoothingMode_delegate>("GdipSetSmoothingMode"); GdipGetSmoothingMode_ptr = LoadFunction<GdipGetSmoothingMode_delegate>("GdipGetSmoothingMode"); GdipSetTextContrast_ptr = LoadFunction<GdipSetTextContrast_delegate>("GdipSetTextContrast"); GdipGetTextContrast_ptr = LoadFunction<GdipGetTextContrast_delegate>("GdipGetTextContrast"); GdipSetTextRenderingHint_ptr = LoadFunction<GdipSetTextRenderingHint_delegate>("GdipSetTextRenderingHint"); GdipGetTextRenderingHint_ptr = LoadFunction<GdipGetTextRenderingHint_delegate>("GdipGetTextRenderingHint"); GdipGetVisibleClipBounds_ptr = LoadFunction<GdipGetVisibleClipBounds_delegate>("GdipGetVisibleClipBounds"); GdipFlush_ptr = LoadFunction<GdipFlush_delegate>("GdipFlush"); GdipAddPathString_ptr = LoadFunction<GdipAddPathString_delegate>("GdipAddPathString"); GdipAddPathStringI_ptr = LoadFunction<GdipAddPathStringI_delegate>("GdipAddPathStringI"); GdipCreatePen1_ptr = LoadFunction<GdipCreatePen1_delegate>("GdipCreatePen1"); GdipCreatePen2_ptr = LoadFunction<GdipCreatePen2_delegate>("GdipCreatePen2"); GdipClonePen_ptr = LoadFunction<GdipClonePen_delegate>("GdipClonePen"); GdipDeletePen_ptr = LoadFunction<GdipDeletePen_delegate>("GdipDeletePen"); GdipSetPenBrushFill_ptr = LoadFunction<GdipSetPenBrushFill_delegate>("GdipSetPenBrushFill"); GdipGetPenBrushFill_ptr = LoadFunction<GdipGetPenBrushFill_delegate>("GdipGetPenBrushFill"); GdipGetPenFillType_ptr = LoadFunction<GdipGetPenFillType_delegate>("GdipGetPenFillType"); GdipSetPenColor_ptr = LoadFunction<GdipSetPenColor_delegate>("GdipSetPenColor"); GdipGetPenColor_ptr = LoadFunction<GdipGetPenColor_delegate>("GdipGetPenColor"); GdipSetPenCompoundArray_ptr = LoadFunction<GdipSetPenCompoundArray_delegate>("GdipSetPenCompoundArray"); GdipGetPenCompoundArray_ptr = LoadFunction<GdipGetPenCompoundArray_delegate>("GdipGetPenCompoundArray"); GdipGetPenCompoundCount_ptr = LoadFunction<GdipGetPenCompoundCount_delegate>("GdipGetPenCompoundCount"); GdipSetPenDashCap197819_ptr = LoadFunction<GdipSetPenDashCap197819_delegate>("GdipSetPenDashCap197819"); GdipGetPenDashCap197819_ptr = LoadFunction<GdipGetPenDashCap197819_delegate>("GdipGetPenDashCap197819"); GdipSetPenDashStyle_ptr = LoadFunction<GdipSetPenDashStyle_delegate>("GdipSetPenDashStyle"); GdipGetPenDashStyle_ptr = LoadFunction<GdipGetPenDashStyle_delegate>("GdipGetPenDashStyle"); GdipSetPenDashOffset_ptr = LoadFunction<GdipSetPenDashOffset_delegate>("GdipSetPenDashOffset"); GdipGetPenDashOffset_ptr = LoadFunction<GdipGetPenDashOffset_delegate>("GdipGetPenDashOffset"); GdipGetPenDashCount_ptr = LoadFunction<GdipGetPenDashCount_delegate>("GdipGetPenDashCount"); GdipSetPenDashArray_ptr = LoadFunction<GdipSetPenDashArray_delegate>("GdipSetPenDashArray"); GdipGetPenDashArray_ptr = LoadFunction<GdipGetPenDashArray_delegate>("GdipGetPenDashArray"); GdipSetPenMiterLimit_ptr = LoadFunction<GdipSetPenMiterLimit_delegate>("GdipSetPenMiterLimit"); GdipGetPenMiterLimit_ptr = LoadFunction<GdipGetPenMiterLimit_delegate>("GdipGetPenMiterLimit"); GdipSetPenLineJoin_ptr = LoadFunction<GdipSetPenLineJoin_delegate>("GdipSetPenLineJoin"); GdipGetPenLineJoin_ptr = LoadFunction<GdipGetPenLineJoin_delegate>("GdipGetPenLineJoin"); GdipSetPenLineCap197819_ptr = LoadFunction<GdipSetPenLineCap197819_delegate>("GdipSetPenLineCap197819"); GdipSetPenMode_ptr = LoadFunction<GdipSetPenMode_delegate>("GdipSetPenMode"); GdipGetPenMode_ptr = LoadFunction<GdipGetPenMode_delegate>("GdipGetPenMode"); GdipSetPenStartCap_ptr = LoadFunction<GdipSetPenStartCap_delegate>("GdipSetPenStartCap"); GdipGetPenStartCap_ptr = LoadFunction<GdipGetPenStartCap_delegate>("GdipGetPenStartCap"); GdipSetPenEndCap_ptr = LoadFunction<GdipSetPenEndCap_delegate>("GdipSetPenEndCap"); GdipGetPenEndCap_ptr = LoadFunction<GdipGetPenEndCap_delegate>("GdipGetPenEndCap"); GdipSetPenCustomStartCap_ptr = LoadFunction<GdipSetPenCustomStartCap_delegate>("GdipSetPenCustomStartCap"); GdipGetPenCustomStartCap_ptr = LoadFunction<GdipGetPenCustomStartCap_delegate>("GdipGetPenCustomStartCap"); GdipSetPenCustomEndCap_ptr = LoadFunction<GdipSetPenCustomEndCap_delegate>("GdipSetPenCustomEndCap"); GdipGetPenCustomEndCap_ptr = LoadFunction<GdipGetPenCustomEndCap_delegate>("GdipGetPenCustomEndCap"); GdipSetPenTransform_ptr = LoadFunction<GdipSetPenTransform_delegate>("GdipSetPenTransform"); GdipGetPenTransform_ptr = LoadFunction<GdipGetPenTransform_delegate>("GdipGetPenTransform"); GdipSetPenWidth_ptr = LoadFunction<GdipSetPenWidth_delegate>("GdipSetPenWidth"); GdipGetPenWidth_ptr = LoadFunction<GdipGetPenWidth_delegate>("GdipGetPenWidth"); GdipResetPenTransform_ptr = LoadFunction<GdipResetPenTransform_delegate>("GdipResetPenTransform"); GdipMultiplyPenTransform_ptr = LoadFunction<GdipMultiplyPenTransform_delegate>("GdipMultiplyPenTransform"); GdipRotatePenTransform_ptr = LoadFunction<GdipRotatePenTransform_delegate>("GdipRotatePenTransform"); GdipScalePenTransform_ptr = LoadFunction<GdipScalePenTransform_delegate>("GdipScalePenTransform"); GdipTranslatePenTransform_ptr = LoadFunction<GdipTranslatePenTransform_delegate>("GdipTranslatePenTransform"); GdipCreateFromHWND_ptr = LoadFunction<GdipCreateFromHWND_delegate>("GdipCreateFromHWND"); GdipMeasureString_ptr = LoadFunction<GdipMeasureString_delegate>("GdipMeasureString"); GdipMeasureCharacterRanges_ptr = LoadFunction<GdipMeasureCharacterRanges_delegate>("GdipMeasureCharacterRanges"); GdipSetStringFormatMeasurableCharacterRanges_ptr = LoadFunction<GdipSetStringFormatMeasurableCharacterRanges_delegate>("GdipSetStringFormatMeasurableCharacterRanges"); GdipGetStringFormatMeasurableCharacterRangeCount_ptr = LoadFunction<GdipGetStringFormatMeasurableCharacterRangeCount_delegate>("GdipGetStringFormatMeasurableCharacterRangeCount"); GdipCreateBitmapFromScan0_ptr = LoadFunction<GdipCreateBitmapFromScan0_delegate>("GdipCreateBitmapFromScan0"); GdipCreateBitmapFromGraphics_ptr = LoadFunction<GdipCreateBitmapFromGraphics_delegate>("GdipCreateBitmapFromGraphics"); GdipBitmapLockBits_ptr = LoadFunction<GdipBitmapLockBits_delegate>("GdipBitmapLockBits"); GdipBitmapSetResolution_ptr = LoadFunction<GdipBitmapSetResolution_delegate>("GdipBitmapSetResolution"); GdipBitmapUnlockBits_ptr = LoadFunction<GdipBitmapUnlockBits_delegate>("GdipBitmapUnlockBits"); GdipBitmapGetPixel_ptr = LoadFunction<GdipBitmapGetPixel_delegate>("GdipBitmapGetPixel"); GdipBitmapSetPixel_ptr = LoadFunction<GdipBitmapSetPixel_delegate>("GdipBitmapSetPixel"); GdipLoadImageFromFile_ptr = LoadFunction<GdipLoadImageFromFile_delegate>("GdipLoadImageFromFile"); GdipLoadImageFromStream_ptr = LoadFunction<GdipLoadImageFromStream_delegate>("GdipLoadImageFromStream"); GdipSaveImageToStream_ptr = LoadFunction<GdipSaveImageToStream_delegate>("GdipSaveImageToStream"); GdipCloneImage_ptr = LoadFunction<GdipCloneImage_delegate>("GdipCloneImage"); GdipLoadImageFromFileICM_ptr = LoadFunction<GdipLoadImageFromFileICM_delegate>("GdipLoadImageFromFileICM"); GdipCreateBitmapFromHBITMAP_ptr = LoadFunction<GdipCreateBitmapFromHBITMAP_delegate>("GdipCreateBitmapFromHBITMAP"); GdipDisposeImage_ptr = LoadFunction<GdipDisposeImage_delegate>("GdipDisposeImage"); GdipGetImageFlags_ptr = LoadFunction<GdipGetImageFlags_delegate>("GdipGetImageFlags"); GdipGetImageType_ptr = LoadFunction<GdipGetImageType_delegate>("GdipGetImageType"); GdipImageGetFrameDimensionsCount_ptr = LoadFunction<GdipImageGetFrameDimensionsCount_delegate>("GdipImageGetFrameDimensionsCount"); GdipImageGetFrameDimensionsList_ptr = LoadFunction<GdipImageGetFrameDimensionsList_delegate>("GdipImageGetFrameDimensionsList"); GdipGetImageHeight_ptr = LoadFunction<GdipGetImageHeight_delegate>("GdipGetImageHeight"); GdipGetImageHorizontalResolution_ptr = LoadFunction<GdipGetImageHorizontalResolution_delegate>("GdipGetImageHorizontalResolution"); GdipGetImagePaletteSize_ptr = LoadFunction<GdipGetImagePaletteSize_delegate>("GdipGetImagePaletteSize"); GdipGetImagePalette_ptr = LoadFunction<GdipGetImagePalette_delegate>("GdipGetImagePalette"); GdipSetImagePalette_ptr = LoadFunction<GdipSetImagePalette_delegate>("GdipSetImagePalette"); GdipGetImageDimension_ptr = LoadFunction<GdipGetImageDimension_delegate>("GdipGetImageDimension"); GdipGetImagePixelFormat_ptr = LoadFunction<GdipGetImagePixelFormat_delegate>("GdipGetImagePixelFormat"); GdipGetPropertyCount_ptr = LoadFunction<GdipGetPropertyCount_delegate>("GdipGetPropertyCount"); GdipGetPropertyIdList_ptr = LoadFunction<GdipGetPropertyIdList_delegate>("GdipGetPropertyIdList"); GdipGetPropertySize_ptr = LoadFunction<GdipGetPropertySize_delegate>("GdipGetPropertySize"); GdipGetAllPropertyItems_ptr = LoadFunction<GdipGetAllPropertyItems_delegate>("GdipGetAllPropertyItems"); GdipGetImageRawFormat_ptr = LoadFunction<GdipGetImageRawFormat_delegate>("GdipGetImageRawFormat"); GdipGetImageVerticalResolution_ptr = LoadFunction<GdipGetImageVerticalResolution_delegate>("GdipGetImageVerticalResolution"); GdipGetImageWidth_ptr = LoadFunction<GdipGetImageWidth_delegate>("GdipGetImageWidth"); GdipGetImageBounds_ptr = LoadFunction<GdipGetImageBounds_delegate>("GdipGetImageBounds"); GdipGetEncoderParameterListSize_ptr = LoadFunction<GdipGetEncoderParameterListSize_delegate>("GdipGetEncoderParameterListSize"); GdipGetEncoderParameterList_ptr = LoadFunction<GdipGetEncoderParameterList_delegate>("GdipGetEncoderParameterList"); GdipImageGetFrameCount_ptr = LoadFunction<GdipImageGetFrameCount_delegate>("GdipImageGetFrameCount"); GdipImageSelectActiveFrame_ptr = LoadFunction<GdipImageSelectActiveFrame_delegate>("GdipImageSelectActiveFrame"); GdipGetPropertyItemSize_ptr = LoadFunction<GdipGetPropertyItemSize_delegate>("GdipGetPropertyItemSize"); GdipGetPropertyItem_ptr = LoadFunction<GdipGetPropertyItem_delegate>("GdipGetPropertyItem"); GdipRemovePropertyItem_ptr = LoadFunction<GdipRemovePropertyItem_delegate>("GdipRemovePropertyItem"); GdipSetPropertyItem_ptr = LoadFunction<GdipSetPropertyItem_delegate>("GdipSetPropertyItem"); GdipGetImageThumbnail_ptr = LoadFunction<GdipGetImageThumbnail_delegate>("GdipGetImageThumbnail"); GdipImageRotateFlip_ptr = LoadFunction<GdipImageRotateFlip_delegate>("GdipImageRotateFlip"); GdipSaveImageToFile_ptr = LoadFunction<GdipSaveImageToFile_delegate>("GdipSaveImageToFile"); GdipSaveAdd_ptr = LoadFunction<GdipSaveAdd_delegate>("GdipSaveAdd"); GdipSaveAddImage_ptr = LoadFunction<GdipSaveAddImage_delegate>("GdipSaveAddImage"); GdipDrawImageI_ptr = LoadFunction<GdipDrawImageI_delegate>("GdipDrawImageI"); GdipGetImageGraphicsContext_ptr = LoadFunction<GdipGetImageGraphicsContext_delegate>("GdipGetImageGraphicsContext"); GdipDrawImage_ptr = LoadFunction<GdipDrawImage_delegate>("GdipDrawImage"); GdipBeginContainer_ptr = LoadFunction<GdipBeginContainer_delegate>("GdipBeginContainer"); GdipBeginContainerI_ptr = LoadFunction<GdipBeginContainerI_delegate>("GdipBeginContainerI"); GdipBeginContainer2_ptr = LoadFunction<GdipBeginContainer2_delegate>("GdipBeginContainer2"); GdipDrawImagePoints_ptr = LoadFunction<GdipDrawImagePoints_delegate>("GdipDrawImagePoints"); GdipDrawImagePointsI_ptr = LoadFunction<GdipDrawImagePointsI_delegate>("GdipDrawImagePointsI"); GdipDrawImageRectRectI_ptr = LoadFunction<GdipDrawImageRectRectI_delegate>("GdipDrawImageRectRectI"); GdipDrawImageRectRect_ptr = LoadFunction<GdipDrawImageRectRect_delegate>("GdipDrawImageRectRect"); GdipDrawImagePointsRectI_ptr = LoadFunction<GdipDrawImagePointsRectI_delegate>("GdipDrawImagePointsRectI"); GdipDrawImagePointsRect_ptr = LoadFunction<GdipDrawImagePointsRect_delegate>("GdipDrawImagePointsRect"); GdipDrawImageRect_ptr = LoadFunction<GdipDrawImageRect_delegate>("GdipDrawImageRect"); GdipDrawImagePointRect_ptr = LoadFunction<GdipDrawImagePointRect_delegate>("GdipDrawImagePointRect"); GdipDrawImagePointRectI_ptr = LoadFunction<GdipDrawImagePointRectI_delegate>("GdipDrawImagePointRectI"); GdipCreateStringFormat_ptr = LoadFunction<GdipCreateStringFormat_delegate>("GdipCreateStringFormat"); GdipCreateHBITMAPFromBitmap_ptr = LoadFunction<GdipCreateHBITMAPFromBitmap_delegate>("GdipCreateHBITMAPFromBitmap"); GdipCreateBitmapFromFile_ptr = LoadFunction<GdipCreateBitmapFromFile_delegate>("GdipCreateBitmapFromFile"); GdipCreateBitmapFromFileICM_ptr = LoadFunction<GdipCreateBitmapFromFileICM_delegate>("GdipCreateBitmapFromFileICM"); GdipCreateHICONFromBitmap_ptr = LoadFunction<GdipCreateHICONFromBitmap_delegate>("GdipCreateHICONFromBitmap"); GdipCreateBitmapFromHICON_ptr = LoadFunction<GdipCreateBitmapFromHICON_delegate>("GdipCreateBitmapFromHICON"); GdipCreateBitmapFromResource_ptr = LoadFunction<GdipCreateBitmapFromResource_delegate>("GdipCreateBitmapFromResource"); GdipCreateMatrix_ptr = LoadFunction<GdipCreateMatrix_delegate>("GdipCreateMatrix"); GdipCreateMatrix2_ptr = LoadFunction<GdipCreateMatrix2_delegate>("GdipCreateMatrix2"); GdipCreateMatrix3_ptr = LoadFunction<GdipCreateMatrix3_delegate>("GdipCreateMatrix3"); GdipCreateMatrix3I_ptr = LoadFunction<GdipCreateMatrix3I_delegate>("GdipCreateMatrix3I"); GdipDeleteMatrix_ptr = LoadFunction<GdipDeleteMatrix_delegate>("GdipDeleteMatrix"); GdipCloneMatrix_ptr = LoadFunction<GdipCloneMatrix_delegate>("GdipCloneMatrix"); GdipSetMatrixElements_ptr = LoadFunction<GdipSetMatrixElements_delegate>("GdipSetMatrixElements"); GdipGetMatrixElements_ptr = LoadFunction<GdipGetMatrixElements_delegate>("GdipGetMatrixElements"); GdipMultiplyMatrix_ptr = LoadFunction<GdipMultiplyMatrix_delegate>("GdipMultiplyMatrix"); GdipTranslateMatrix_ptr = LoadFunction<GdipTranslateMatrix_delegate>("GdipTranslateMatrix"); GdipScaleMatrix_ptr = LoadFunction<GdipScaleMatrix_delegate>("GdipScaleMatrix"); GdipRotateMatrix_ptr = LoadFunction<GdipRotateMatrix_delegate>("GdipRotateMatrix"); GdipShearMatrix_ptr = LoadFunction<GdipShearMatrix_delegate>("GdipShearMatrix"); GdipInvertMatrix_ptr = LoadFunction<GdipInvertMatrix_delegate>("GdipInvertMatrix"); GdipTransformMatrixPoints_ptr = LoadFunction<GdipTransformMatrixPoints_delegate>("GdipTransformMatrixPoints"); GdipTransformMatrixPointsI_ptr = LoadFunction<GdipTransformMatrixPointsI_delegate>("GdipTransformMatrixPointsI"); GdipVectorTransformMatrixPoints_ptr = LoadFunction<GdipVectorTransformMatrixPoints_delegate>("GdipVectorTransformMatrixPoints"); GdipVectorTransformMatrixPointsI_ptr = LoadFunction<GdipVectorTransformMatrixPointsI_delegate>("GdipVectorTransformMatrixPointsI"); GdipIsMatrixInvertible_ptr = LoadFunction<GdipIsMatrixInvertible_delegate>("GdipIsMatrixInvertible"); GdipIsMatrixIdentity_ptr = LoadFunction<GdipIsMatrixIdentity_delegate>("GdipIsMatrixIdentity"); GdipIsMatrixEqual_ptr = LoadFunction<GdipIsMatrixEqual_delegate>("GdipIsMatrixEqual"); GdipCreatePath_ptr = LoadFunction<GdipCreatePath_delegate>("GdipCreatePath"); GdipCreatePath2_ptr = LoadFunction<GdipCreatePath2_delegate>("GdipCreatePath2"); GdipCreatePath2I_ptr = LoadFunction<GdipCreatePath2I_delegate>("GdipCreatePath2I"); GdipClonePath_ptr = LoadFunction<GdipClonePath_delegate>("GdipClonePath"); GdipDeletePath_ptr = LoadFunction<GdipDeletePath_delegate>("GdipDeletePath"); GdipResetPath_ptr = LoadFunction<GdipResetPath_delegate>("GdipResetPath"); GdipGetPointCount_ptr = LoadFunction<GdipGetPointCount_delegate>("GdipGetPointCount"); GdipGetPathTypes_ptr = LoadFunction<GdipGetPathTypes_delegate>("GdipGetPathTypes"); GdipGetPathPoints_ptr = LoadFunction<GdipGetPathPoints_delegate>("GdipGetPathPoints"); GdipGetPathPointsI_ptr = LoadFunction<GdipGetPathPointsI_delegate>("GdipGetPathPointsI"); GdipGetPathFillMode_ptr = LoadFunction<GdipGetPathFillMode_delegate>("GdipGetPathFillMode"); GdipSetPathFillMode_ptr = LoadFunction<GdipSetPathFillMode_delegate>("GdipSetPathFillMode"); GdipStartPathFigure_ptr = LoadFunction<GdipStartPathFigure_delegate>("GdipStartPathFigure"); GdipClosePathFigure_ptr = LoadFunction<GdipClosePathFigure_delegate>("GdipClosePathFigure"); GdipClosePathFigures_ptr = LoadFunction<GdipClosePathFigures_delegate>("GdipClosePathFigures"); GdipSetPathMarker_ptr = LoadFunction<GdipSetPathMarker_delegate>("GdipSetPathMarker"); GdipClearPathMarkers_ptr = LoadFunction<GdipClearPathMarkers_delegate>("GdipClearPathMarkers"); GdipReversePath_ptr = LoadFunction<GdipReversePath_delegate>("GdipReversePath"); GdipGetPathLastPoint_ptr = LoadFunction<GdipGetPathLastPoint_delegate>("GdipGetPathLastPoint"); GdipAddPathLine_ptr = LoadFunction<GdipAddPathLine_delegate>("GdipAddPathLine"); GdipAddPathLine2_ptr = LoadFunction<GdipAddPathLine2_delegate>("GdipAddPathLine2"); GdipAddPathLine2I_ptr = LoadFunction<GdipAddPathLine2I_delegate>("GdipAddPathLine2I"); GdipAddPathArc_ptr = LoadFunction<GdipAddPathArc_delegate>("GdipAddPathArc"); GdipAddPathBezier_ptr = LoadFunction<GdipAddPathBezier_delegate>("GdipAddPathBezier"); GdipAddPathBeziers_ptr = LoadFunction<GdipAddPathBeziers_delegate>("GdipAddPathBeziers"); GdipAddPathCurve_ptr = LoadFunction<GdipAddPathCurve_delegate>("GdipAddPathCurve"); GdipAddPathCurveI_ptr = LoadFunction<GdipAddPathCurveI_delegate>("GdipAddPathCurveI"); GdipAddPathCurve2_ptr = LoadFunction<GdipAddPathCurve2_delegate>("GdipAddPathCurve2"); GdipAddPathCurve2I_ptr = LoadFunction<GdipAddPathCurve2I_delegate>("GdipAddPathCurve2I"); GdipAddPathCurve3_ptr = LoadFunction<GdipAddPathCurve3_delegate>("GdipAddPathCurve3"); GdipAddPathCurve3I_ptr = LoadFunction<GdipAddPathCurve3I_delegate>("GdipAddPathCurve3I"); GdipAddPathClosedCurve_ptr = LoadFunction<GdipAddPathClosedCurve_delegate>("GdipAddPathClosedCurve"); GdipAddPathClosedCurveI_ptr = LoadFunction<GdipAddPathClosedCurveI_delegate>("GdipAddPathClosedCurveI"); GdipAddPathClosedCurve2_ptr = LoadFunction<GdipAddPathClosedCurve2_delegate>("GdipAddPathClosedCurve2"); GdipAddPathClosedCurve2I_ptr = LoadFunction<GdipAddPathClosedCurve2I_delegate>("GdipAddPathClosedCurve2I"); GdipAddPathRectangle_ptr = LoadFunction<GdipAddPathRectangle_delegate>("GdipAddPathRectangle"); GdipAddPathRectangles_ptr = LoadFunction<GdipAddPathRectangles_delegate>("GdipAddPathRectangles"); GdipAddPathEllipse_ptr = LoadFunction<GdipAddPathEllipse_delegate>("GdipAddPathEllipse"); GdipAddPathEllipseI_ptr = LoadFunction<GdipAddPathEllipseI_delegate>("GdipAddPathEllipseI"); GdipAddPathPie_ptr = LoadFunction<GdipAddPathPie_delegate>("GdipAddPathPie"); GdipAddPathPieI_ptr = LoadFunction<GdipAddPathPieI_delegate>("GdipAddPathPieI"); GdipAddPathPolygon_ptr = LoadFunction<GdipAddPathPolygon_delegate>("GdipAddPathPolygon"); GdipAddPathPath_ptr = LoadFunction<GdipAddPathPath_delegate>("GdipAddPathPath"); GdipAddPathLineI_ptr = LoadFunction<GdipAddPathLineI_delegate>("GdipAddPathLineI"); GdipAddPathArcI_ptr = LoadFunction<GdipAddPathArcI_delegate>("GdipAddPathArcI"); GdipAddPathBezierI_ptr = LoadFunction<GdipAddPathBezierI_delegate>("GdipAddPathBezierI"); GdipAddPathBeziersI_ptr = LoadFunction<GdipAddPathBeziersI_delegate>("GdipAddPathBeziersI"); GdipAddPathPolygonI_ptr = LoadFunction<GdipAddPathPolygonI_delegate>("GdipAddPathPolygonI"); GdipAddPathRectangleI_ptr = LoadFunction<GdipAddPathRectangleI_delegate>("GdipAddPathRectangleI"); GdipAddPathRectanglesI_ptr = LoadFunction<GdipAddPathRectanglesI_delegate>("GdipAddPathRectanglesI"); GdipFlattenPath_ptr = LoadFunction<GdipFlattenPath_delegate>("GdipFlattenPath"); GdipTransformPath_ptr = LoadFunction<GdipTransformPath_delegate>("GdipTransformPath"); GdipWarpPath_ptr = LoadFunction<GdipWarpPath_delegate>("GdipWarpPath"); GdipWidenPath_ptr = LoadFunction<GdipWidenPath_delegate>("GdipWidenPath"); GdipGetPathWorldBounds_ptr = LoadFunction<GdipGetPathWorldBounds_delegate>("GdipGetPathWorldBounds"); GdipGetPathWorldBoundsI_ptr = LoadFunction<GdipGetPathWorldBoundsI_delegate>("GdipGetPathWorldBoundsI"); GdipIsVisiblePathPoint_ptr = LoadFunction<GdipIsVisiblePathPoint_delegate>("GdipIsVisiblePathPoint"); GdipIsVisiblePathPointI_ptr = LoadFunction<GdipIsVisiblePathPointI_delegate>("GdipIsVisiblePathPointI"); GdipIsOutlineVisiblePathPoint_ptr = LoadFunction<GdipIsOutlineVisiblePathPoint_delegate>("GdipIsOutlineVisiblePathPoint"); GdipIsOutlineVisiblePathPointI_ptr = LoadFunction<GdipIsOutlineVisiblePathPointI_delegate>("GdipIsOutlineVisiblePathPointI"); GdipCreateFont_ptr = LoadFunction<GdipCreateFont_delegate>("GdipCreateFont"); GdipDeleteFont_ptr = LoadFunction<GdipDeleteFont_delegate>("GdipDeleteFont"); GdipGetLogFont_ptr = LoadFunction<GdipGetLogFont_delegate>("GdipGetLogFontW"); GdipCreateFontFromDC_ptr = LoadFunction<GdipCreateFontFromDC_delegate>("GdipCreateFontFromDC"); GdipCreateFontFromLogfont_ptr = LoadFunction<GdipCreateFontFromLogfont_delegate>("GdipCreateFontFromLogfontW"); GdipCreateFontFromHfont_ptr = LoadFunction<GdipCreateFontFromHfont_delegate>("GdipCreateFontFromHfontA"); GdipNewPrivateFontCollection_ptr = LoadFunction<GdipNewPrivateFontCollection_delegate>("GdipNewPrivateFontCollection"); GdipDeletePrivateFontCollection_ptr = LoadFunction<GdipDeletePrivateFontCollection_delegate>("GdipDeletePrivateFontCollection"); GdipPrivateAddFontFile_ptr = LoadFunction<GdipPrivateAddFontFile_delegate>("GdipPrivateAddFontFile"); GdipPrivateAddMemoryFont_ptr = LoadFunction<GdipPrivateAddMemoryFont_delegate>("GdipPrivateAddMemoryFont"); GdipCreateFontFamilyFromName_ptr = LoadFunction<GdipCreateFontFamilyFromName_delegate>("GdipCreateFontFamilyFromName"); GdipGetFamilyName_ptr = LoadFunction<GdipGetFamilyName_delegate>("GdipGetFamilyName"); GdipGetGenericFontFamilySansSerif_ptr = LoadFunction<GdipGetGenericFontFamilySansSerif_delegate>("GdipGetGenericFontFamilySansSerif"); GdipGetGenericFontFamilySerif_ptr = LoadFunction<GdipGetGenericFontFamilySerif_delegate>("GdipGetGenericFontFamilySerif"); GdipGetGenericFontFamilyMonospace_ptr = LoadFunction<GdipGetGenericFontFamilyMonospace_delegate>("GdipGetGenericFontFamilyMonospace"); GdipGetCellAscent_ptr = LoadFunction<GdipGetCellAscent_delegate>("GdipGetCellAscent"); GdipGetCellDescent_ptr = LoadFunction<GdipGetCellDescent_delegate>("GdipGetCellDescent"); GdipGetLineSpacing_ptr = LoadFunction<GdipGetLineSpacing_delegate>("GdipGetLineSpacing"); GdipGetEmHeight_ptr = LoadFunction<GdipGetEmHeight_delegate>("GdipGetEmHeight"); GdipIsStyleAvailable_ptr = LoadFunction<GdipIsStyleAvailable_delegate>("GdipIsStyleAvailable"); GdipDeleteFontFamily_ptr = LoadFunction<GdipDeleteFontFamily_delegate>("GdipDeleteFontFamily"); GdipGetFontSize_ptr = LoadFunction<GdipGetFontSize_delegate>("GdipGetFontSize"); GdipGetFontHeight_ptr = LoadFunction<GdipGetFontHeight_delegate>("GdipGetFontHeight"); GdipGetFontHeightGivenDPI_ptr = LoadFunction<GdipGetFontHeightGivenDPI_delegate>("GdipGetFontHeightGivenDPI"); GdipCreateStringFormat2_ptr = LoadFunction<GdipCreateStringFormat2_delegate>("GdipCreateStringFormat"); GdipStringFormatGetGenericDefault_ptr = LoadFunction<GdipStringFormatGetGenericDefault_delegate>("GdipStringFormatGetGenericDefault"); GdipStringFormatGetGenericTypographic_ptr = LoadFunction<GdipStringFormatGetGenericTypographic_delegate>("GdipStringFormatGetGenericTypographic"); GdipDeleteStringFormat_ptr = LoadFunction<GdipDeleteStringFormat_delegate>("GdipDeleteStringFormat"); GdipCloneStringFormat_ptr = LoadFunction<GdipCloneStringFormat_delegate>("GdipCloneStringFormat"); GdipSetStringFormatFlags_ptr = LoadFunction<GdipSetStringFormatFlags_delegate>("GdipSetStringFormatFlags"); GdipGetStringFormatFlags_ptr = LoadFunction<GdipGetStringFormatFlags_delegate>("GdipGetStringFormatFlags"); GdipSetStringFormatAlign_ptr = LoadFunction<GdipSetStringFormatAlign_delegate>("GdipSetStringFormatAlign"); GdipGetStringFormatAlign_ptr = LoadFunction<GdipGetStringFormatAlign_delegate>("GdipGetStringFormatAlign"); GdipSetStringFormatLineAlign_ptr = LoadFunction<GdipSetStringFormatLineAlign_delegate>("GdipSetStringFormatLineAlign"); GdipGetStringFormatLineAlign_ptr = LoadFunction<GdipGetStringFormatLineAlign_delegate>("GdipGetStringFormatLineAlign"); GdipSetStringFormatTrimming_ptr = LoadFunction<GdipSetStringFormatTrimming_delegate>("GdipSetStringFormatTrimming"); GdipGetStringFormatTrimming_ptr = LoadFunction<GdipGetStringFormatTrimming_delegate>("GdipGetStringFormatTrimming"); GdipSetStringFormatHotkeyPrefix_ptr = LoadFunction<GdipSetStringFormatHotkeyPrefix_delegate>("GdipSetStringFormatHotkeyPrefix"); GdipGetStringFormatHotkeyPrefix_ptr = LoadFunction<GdipGetStringFormatHotkeyPrefix_delegate>("GdipGetStringFormatHotkeyPrefix"); GdipSetStringFormatTabStops_ptr = LoadFunction<GdipSetStringFormatTabStops_delegate>("GdipSetStringFormatTabStops"); GdipGetStringFormatDigitSubstitution_ptr = LoadFunction<GdipGetStringFormatDigitSubstitution_delegate>("GdipGetStringFormatDigitSubstitution"); GdipSetStringFormatDigitSubstitution_ptr = LoadFunction<GdipSetStringFormatDigitSubstitution_delegate>("GdipSetStringFormatDigitSubstitution"); GdipGetStringFormatTabStopCount_ptr = LoadFunction<GdipGetStringFormatTabStopCount_delegate>("GdipGetStringFormatTabStopCount"); GdipGetStringFormatTabStops_ptr = LoadFunction<GdipGetStringFormatTabStops_delegate>("GdipGetStringFormatTabStops"); GdipCreateMetafileFromFile_ptr = LoadFunction<GdipCreateMetafileFromFile_delegate>("GdipCreateMetafileFromFile"); GdipCreateMetafileFromEmf_ptr = LoadFunction<GdipCreateMetafileFromEmf_delegate>("GdipCreateMetafileFromEmf"); GdipCreateMetafileFromWmf_ptr = LoadFunction<GdipCreateMetafileFromWmf_delegate>("GdipCreateMetafileFromWmf"); GdipGetMetafileHeaderFromFile_ptr = LoadFunction<GdipGetMetafileHeaderFromFile_delegate>("GdipGetMetafileHeaderFromFile"); GdipGetMetafileHeaderFromMetafile_ptr = LoadFunction<GdipGetMetafileHeaderFromMetafile_delegate>("GdipGetMetafileHeaderFromMetafile"); GdipGetMetafileHeaderFromEmf_ptr = LoadFunction<GdipGetMetafileHeaderFromEmf_delegate>("GdipGetMetafileHeaderFromEmf"); GdipGetMetafileHeaderFromWmf_ptr = LoadFunction<GdipGetMetafileHeaderFromWmf_delegate>("GdipGetMetafileHeaderFromWmf"); GdipGetHemfFromMetafile_ptr = LoadFunction<GdipGetHemfFromMetafile_delegate>("GdipGetHemfFromMetafile"); GdipGetMetafileDownLevelRasterizationLimit_ptr = LoadFunction<GdipGetMetafileDownLevelRasterizationLimit_delegate>("GdipGetMetafileDownLevelRasterizationLimit"); GdipSetMetafileDownLevelRasterizationLimit_ptr = LoadFunction<GdipSetMetafileDownLevelRasterizationLimit_delegate>("GdipSetMetafileDownLevelRasterizationLimit"); GdipPlayMetafileRecord_ptr = LoadFunction<GdipPlayMetafileRecord_delegate>("GdipPlayMetafileRecord"); GdipRecordMetafile_ptr = LoadFunction<GdipRecordMetafile_delegate>("GdipRecordMetafile"); GdipRecordMetafileI_ptr = LoadFunction<GdipRecordMetafileI_delegate>("GdipRecordMetafileI"); GdipRecordMetafileFileName_ptr = LoadFunction<GdipRecordMetafileFileName_delegate>("GdipRecordMetafileFileName"); GdipRecordMetafileFileNameI_ptr = LoadFunction<GdipRecordMetafileFileNameI_delegate>("GdipRecordMetafileFileNameI"); GdipCreateMetafileFromStream_ptr = LoadFunction<GdipCreateMetafileFromStream_delegate>("GdipCreateMetafileFromStream"); GdipGetMetafileHeaderFromStream_ptr = LoadFunction<GdipGetMetafileHeaderFromStream_delegate>("GdipGetMetafileHeaderFromStream"); GdipRecordMetafileStream_ptr = LoadFunction<GdipRecordMetafileStream_delegate>("GdipRecordMetafileStream"); GdipRecordMetafileStreamI_ptr = LoadFunction<GdipRecordMetafileStreamI_delegate>("GdipRecordMetafileStreamI"); GdipCreateFromContext_macosx_ptr = LoadFunction<GdipCreateFromContext_macosx_delegate>("GdipCreateFromContext_macosx"); GdipSetVisibleClip_linux_ptr = LoadFunction<GdipSetVisibleClip_linux_delegate>("GdipSetVisibleClip_linux"); GdipCreateFromXDrawable_linux_ptr = LoadFunction<GdipCreateFromXDrawable_linux_delegate>("GdipCreateFromXDrawable_linux"); GdipLoadImageFromDelegate_linux_ptr = LoadFunction<GdipLoadImageFromDelegate_linux_delegate>("GdipLoadImageFromDelegate_linux"); GdipSaveImageToDelegate_linux_ptr = LoadFunction<GdipSaveImageToDelegate_linux_delegate>("GdipSaveImageToDelegate_linux"); GdipCreateMetafileFromDelegate_linux_ptr = LoadFunction<GdipCreateMetafileFromDelegate_linux_delegate>("GdipCreateMetafileFromDelegate_linux"); GdipGetMetafileHeaderFromDelegate_linux_ptr = LoadFunction<GdipGetMetafileHeaderFromDelegate_linux_delegate>("GdipGetMetafileHeaderFromDelegate_linux"); GdipRecordMetafileFromDelegate_linux_ptr = LoadFunction<GdipRecordMetafileFromDelegate_linux_delegate>("GdipRecordMetafileFromDelegate_linux"); GdipRecordMetafileFromDelegateI_linux_ptr = LoadFunction<GdipRecordMetafileFromDelegateI_linux_delegate>("GdipRecordMetafileFromDelegateI_linux"); } // Imported functions private delegate Status GdiplusStartup_delegate(out IntPtr token, ref StartupInput input, out StartupOutput output); private static FunctionWrapper<GdiplusStartup_delegate> GdiplusStartup_ptr; internal static int GdiplusStartup(out IntPtr token, ref StartupInput input, out StartupOutput output) => (int)GdiplusStartup_ptr.Delegate(out token, ref input, out output); private delegate void GdiplusShutdown_delegate(ref ulong token); private static FunctionWrapper<GdiplusShutdown_delegate> GdiplusShutdown_ptr; internal static void GdiplusShutdown(ref ulong token) => GdiplusShutdown_ptr.Delegate(ref token); private delegate IntPtr GdipAlloc_delegate(int size); private static FunctionWrapper<GdipAlloc_delegate> GdipAlloc_ptr; internal static IntPtr GdipAlloc(int size) => GdipAlloc_ptr.Delegate(size); private delegate void GdipFree_delegate(IntPtr ptr); private static FunctionWrapper<GdipFree_delegate> GdipFree_ptr; internal static void GdipFree(IntPtr ptr) => GdipFree_ptr.Delegate(ptr); private delegate Status GdipDeleteBrush_delegate(IntPtr brush); private static FunctionWrapper<GdipDeleteBrush_delegate> GdipDeleteBrush_ptr; internal static Status GdipDeleteBrush(IntPtr brush) => GdipDeleteBrush_ptr.Delegate(brush); internal static int IntGdipDeleteBrush(HandleRef brush) => (int)GdipDeleteBrush_ptr.Delegate(brush.Handle); private delegate Status GdipGetBrushType_delegate(IntPtr brush, out BrushType type); private static FunctionWrapper<GdipGetBrushType_delegate> GdipGetBrushType_ptr; internal static Status GdipGetBrushType(IntPtr brush, out BrushType type) => GdipGetBrushType_ptr.Delegate(brush, out type); private delegate Status GdipCreateRegion_delegate(out IntPtr region); private static FunctionWrapper<GdipCreateRegion_delegate> GdipCreateRegion_ptr; internal static Status GdipCreateRegion(out IntPtr region) => GdipCreateRegion_ptr.Delegate(out region); private delegate Status GdipCreateRegionRgnData_delegate(byte[] data, int size, out IntPtr region); private static FunctionWrapper<GdipCreateRegionRgnData_delegate> GdipCreateRegionRgnData_ptr; internal static Status GdipCreateRegionRgnData(byte[] data, int size, out IntPtr region) => GdipCreateRegionRgnData_ptr.Delegate(data, size, out region); private delegate Status GdipDeleteRegion_delegate(IntPtr region); private static FunctionWrapper<GdipDeleteRegion_delegate> GdipDeleteRegion_ptr; internal static Status GdipDeleteRegion(IntPtr region) => GdipDeleteRegion_ptr.Delegate(region); internal static int IntGdipDeleteRegion(HandleRef region) => (int)GdipDeleteRegion_ptr.Delegate(region.Handle); private delegate Status GdipCloneRegion_delegate(IntPtr region, out IntPtr cloned); private static FunctionWrapper<GdipCloneRegion_delegate> GdipCloneRegion_ptr; internal static Status GdipCloneRegion(IntPtr region, out IntPtr cloned) => GdipCloneRegion_ptr.Delegate(region, out cloned); private delegate Status GdipCreateRegionRect_delegate(ref RectangleF rect, out IntPtr region); private static FunctionWrapper<GdipCreateRegionRect_delegate> GdipCreateRegionRect_ptr; internal static Status GdipCreateRegionRect(ref RectangleF rect, out IntPtr region) => GdipCreateRegionRect_ptr.Delegate(ref rect, out region); private delegate Status GdipCreateRegionRectI_delegate(ref Rectangle rect, out IntPtr region); private static FunctionWrapper<GdipCreateRegionRectI_delegate> GdipCreateRegionRectI_ptr; internal static Status GdipCreateRegionRectI(ref Rectangle rect, out IntPtr region) => GdipCreateRegionRectI_ptr.Delegate(ref rect, out region); private delegate Status GdipCreateRegionPath_delegate(IntPtr path, out IntPtr region); private static FunctionWrapper<GdipCreateRegionPath_delegate> GdipCreateRegionPath_ptr; internal static Status GdipCreateRegionPath(IntPtr path, out IntPtr region) => GdipCreateRegionPath_ptr.Delegate(path, out region); private delegate Status GdipTranslateRegion_delegate(IntPtr region, float dx, float dy); private static FunctionWrapper<GdipTranslateRegion_delegate> GdipTranslateRegion_ptr; internal static Status GdipTranslateRegion(IntPtr region, float dx, float dy) => GdipTranslateRegion_ptr.Delegate(region, dx, dy); private delegate Status GdipTranslateRegionI_delegate(IntPtr region, int dx, int dy); private static FunctionWrapper<GdipTranslateRegionI_delegate> GdipTranslateRegionI_ptr; internal static Status GdipTranslateRegionI(IntPtr region, int dx, int dy) => GdipTranslateRegionI_ptr.Delegate(region, dx, dy); private delegate Status GdipIsVisibleRegionPoint_delegate(IntPtr region, float x, float y, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisibleRegionPoint_delegate> GdipIsVisibleRegionPoint_ptr; internal static Status GdipIsVisibleRegionPoint(IntPtr region, float x, float y, IntPtr graphics, out bool result) => GdipIsVisibleRegionPoint_ptr.Delegate(region, x, y, graphics, out result); private delegate Status GdipIsVisibleRegionPointI_delegate(IntPtr region, int x, int y, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisibleRegionPointI_delegate> GdipIsVisibleRegionPointI_ptr; internal static Status GdipIsVisibleRegionPointI(IntPtr region, int x, int y, IntPtr graphics, out bool result) => GdipIsVisibleRegionPointI_ptr.Delegate(region, x, y, graphics, out result); private delegate Status GdipIsVisibleRegionRect_delegate(IntPtr region, float x, float y, float width, float height, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisibleRegionRect_delegate> GdipIsVisibleRegionRect_ptr; internal static Status GdipIsVisibleRegionRect(IntPtr region, float x, float y, float width, float height, IntPtr graphics, out bool result) => GdipIsVisibleRegionRect_ptr.Delegate(region, x, y, width, height, graphics, out result); private delegate Status GdipIsVisibleRegionRectI_delegate(IntPtr region, int x, int y, int width, int height, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisibleRegionRectI_delegate> GdipIsVisibleRegionRectI_ptr; internal static Status GdipIsVisibleRegionRectI(IntPtr region, int x, int y, int width, int height, IntPtr graphics, out bool result) => GdipIsVisibleRegionRectI_ptr.Delegate(region, x, y, width, height, graphics, out result); private delegate Status GdipCombineRegionRect_delegate(IntPtr region, ref RectangleF rect, CombineMode combineMode); private static FunctionWrapper<GdipCombineRegionRect_delegate> GdipCombineRegionRect_ptr; internal static Status GdipCombineRegionRect(IntPtr region, ref RectangleF rect, CombineMode combineMode) => GdipCombineRegionRect_ptr.Delegate(region, ref rect, combineMode); private delegate Status GdipCombineRegionRectI_delegate(IntPtr region, ref Rectangle rect, CombineMode combineMode); private static FunctionWrapper<GdipCombineRegionRectI_delegate> GdipCombineRegionRectI_ptr; internal static Status GdipCombineRegionRectI(IntPtr region, ref Rectangle rect, CombineMode combineMode) => GdipCombineRegionRectI_ptr.Delegate(region, ref rect, combineMode); private delegate Status GdipCombineRegionPath_delegate(IntPtr region, IntPtr path, CombineMode combineMode); private static FunctionWrapper<GdipCombineRegionPath_delegate> GdipCombineRegionPath_ptr; internal static Status GdipCombineRegionPath(IntPtr region, IntPtr path, CombineMode combineMode) => GdipCombineRegionPath_ptr.Delegate(region, path, combineMode); private delegate Status GdipGetRegionBounds_delegate(IntPtr region, IntPtr graphics, ref RectangleF rect); private static FunctionWrapper<GdipGetRegionBounds_delegate> GdipGetRegionBounds_ptr; internal static Status GdipGetRegionBounds(IntPtr region, IntPtr graphics, ref RectangleF rect) => GdipGetRegionBounds_ptr.Delegate(region, graphics, ref rect); private delegate Status GdipSetInfinite_delegate(IntPtr region); private static FunctionWrapper<GdipSetInfinite_delegate> GdipSetInfinite_ptr; internal static Status GdipSetInfinite(IntPtr region) => GdipSetInfinite_ptr.Delegate(region); private delegate Status GdipSetEmpty_delegate(IntPtr region); private static FunctionWrapper<GdipSetEmpty_delegate> GdipSetEmpty_ptr; internal static Status GdipSetEmpty(IntPtr region) => GdipSetEmpty_ptr.Delegate(region); private delegate Status GdipIsEmptyRegion_delegate(IntPtr region, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsEmptyRegion_delegate> GdipIsEmptyRegion_ptr; internal static Status GdipIsEmptyRegion(IntPtr region, IntPtr graphics, out bool result) => GdipIsEmptyRegion_ptr.Delegate(region, graphics, out result); private delegate Status GdipIsInfiniteRegion_delegate(IntPtr region, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsInfiniteRegion_delegate> GdipIsInfiniteRegion_ptr; internal static Status GdipIsInfiniteRegion(IntPtr region, IntPtr graphics, out bool result) => GdipIsInfiniteRegion_ptr.Delegate(region, graphics, out result); private delegate Status GdipCombineRegionRegion_delegate(IntPtr region, IntPtr region2, CombineMode combineMode); private static FunctionWrapper<GdipCombineRegionRegion_delegate> GdipCombineRegionRegion_ptr; internal static Status GdipCombineRegionRegion(IntPtr region, IntPtr region2, CombineMode combineMode) => GdipCombineRegionRegion_ptr.Delegate(region, region2, combineMode); private delegate Status GdipIsEqualRegion_delegate(IntPtr region, IntPtr region2, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsEqualRegion_delegate> GdipIsEqualRegion_ptr; internal static Status GdipIsEqualRegion(IntPtr region, IntPtr region2, IntPtr graphics, out bool result) => GdipIsEqualRegion_ptr.Delegate(region, region2, graphics, out result); private delegate Status GdipGetRegionDataSize_delegate(IntPtr region, out int bufferSize); private static FunctionWrapper<GdipGetRegionDataSize_delegate> GdipGetRegionDataSize_ptr; internal static Status GdipGetRegionDataSize(IntPtr region, out int bufferSize) => GdipGetRegionDataSize_ptr.Delegate(region, out bufferSize); private delegate Status GdipGetRegionData_delegate(IntPtr region, byte[] buffer, int bufferSize, out int sizeFilled); private static FunctionWrapper<GdipGetRegionData_delegate> GdipGetRegionData_ptr; internal static Status GdipGetRegionData(IntPtr region, byte[] buffer, int bufferSize, out int sizeFilled) => GdipGetRegionData_ptr.Delegate(region, buffer, bufferSize, out sizeFilled); private delegate Status GdipGetRegionScansCount_delegate(IntPtr region, out int count, IntPtr matrix); private static FunctionWrapper<GdipGetRegionScansCount_delegate> GdipGetRegionScansCount_ptr; internal static Status GdipGetRegionScansCount(IntPtr region, out int count, IntPtr matrix) => GdipGetRegionScansCount_ptr.Delegate(region, out count, matrix); private delegate Status GdipGetRegionScans_delegate(IntPtr region, IntPtr rects, out int count, IntPtr matrix); private static FunctionWrapper<GdipGetRegionScans_delegate> GdipGetRegionScans_ptr; internal static Status GdipGetRegionScans(IntPtr region, IntPtr rects, out int count, IntPtr matrix) => GdipGetRegionScans_ptr.Delegate(region, rects, out count, matrix); private delegate Status GdipTransformRegion_delegate(IntPtr region, IntPtr matrix); private static FunctionWrapper<GdipTransformRegion_delegate> GdipTransformRegion_ptr; internal static Status GdipTransformRegion(IntPtr region, IntPtr matrix) => GdipTransformRegion_ptr.Delegate(region, matrix); private delegate Status GdipFillRegion_delegate(IntPtr graphics, IntPtr brush, IntPtr region); private static FunctionWrapper<GdipFillRegion_delegate> GdipFillRegion_ptr; internal static Status GdipFillRegion(IntPtr graphics, IntPtr brush, IntPtr region) => GdipFillRegion_ptr.Delegate(graphics, brush, region); private delegate Status GdipGetRegionHRgn_delegate(IntPtr region, IntPtr graphics, ref IntPtr hRgn); private static FunctionWrapper<GdipGetRegionHRgn_delegate> GdipGetRegionHRgn_ptr; internal static Status GdipGetRegionHRgn(IntPtr region, IntPtr graphics, ref IntPtr hRgn) => GdipGetRegionHRgn_ptr.Delegate(region, graphics, ref hRgn); private delegate Status GdipCreateRegionHrgn_delegate(IntPtr hRgn, out IntPtr region); private static FunctionWrapper<GdipCreateRegionHrgn_delegate> GdipCreateRegionHrgn_ptr; internal static Status GdipCreateRegionHrgn(IntPtr hRgn, out IntPtr region) => GdipCreateRegionHrgn_ptr.Delegate(hRgn, out region); private delegate Status GdipCreatePathGradientFromPath_delegate(IntPtr path, out IntPtr brush); private static FunctionWrapper<GdipCreatePathGradientFromPath_delegate> GdipCreatePathGradientFromPath_ptr; internal static Status GdipCreatePathGradientFromPath(IntPtr path, out IntPtr brush) => GdipCreatePathGradientFromPath_ptr.Delegate(path, out brush); private delegate Status GdipCreatePathGradientI_delegate(Point[] points, int count, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreatePathGradientI_delegate> GdipCreatePathGradientI_ptr; internal static Status GdipCreatePathGradientI(Point[] points, int count, WrapMode wrapMode, out IntPtr brush) => GdipCreatePathGradientI_ptr.Delegate(points, count, wrapMode, out brush); private delegate Status GdipCreatePathGradient_delegate(PointF[] points, int count, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreatePathGradient_delegate> GdipCreatePathGradient_ptr; internal static Status GdipCreatePathGradient(PointF[] points, int count, WrapMode wrapMode, out IntPtr brush) => GdipCreatePathGradient_ptr.Delegate(points, count, wrapMode, out brush); private delegate Status GdipGetPathGradientBlendCount_delegate(IntPtr brush, out int count); private static FunctionWrapper<GdipGetPathGradientBlendCount_delegate> GdipGetPathGradientBlendCount_ptr; internal static Status GdipGetPathGradientBlendCount(IntPtr brush, out int count) => GdipGetPathGradientBlendCount_ptr.Delegate(brush, out count); private delegate Status GdipGetPathGradientBlend_delegate(IntPtr brush, float[] blend, float[] positions, int count); private static FunctionWrapper<GdipGetPathGradientBlend_delegate> GdipGetPathGradientBlend_ptr; internal static Status GdipGetPathGradientBlend(IntPtr brush, float[] blend, float[] positions, int count) => GdipGetPathGradientBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipSetPathGradientBlend_delegate(IntPtr brush, float[] blend, float[] positions, int count); private static FunctionWrapper<GdipSetPathGradientBlend_delegate> GdipSetPathGradientBlend_ptr; internal static Status GdipSetPathGradientBlend(IntPtr brush, float[] blend, float[] positions, int count) => GdipSetPathGradientBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipGetPathGradientCenterColor_delegate(IntPtr brush, out int color); private static FunctionWrapper<GdipGetPathGradientCenterColor_delegate> GdipGetPathGradientCenterColor_ptr; internal static Status GdipGetPathGradientCenterColor(IntPtr brush, out int color) => GdipGetPathGradientCenterColor_ptr.Delegate(brush, out color); private delegate Status GdipSetPathGradientCenterColor_delegate(IntPtr brush, int color); private static FunctionWrapper<GdipSetPathGradientCenterColor_delegate> GdipSetPathGradientCenterColor_ptr; internal static Status GdipSetPathGradientCenterColor(IntPtr brush, int color) => GdipSetPathGradientCenterColor_ptr.Delegate(brush, color); private delegate Status GdipGetPathGradientCenterPoint_delegate(IntPtr brush, out PointF point); private static FunctionWrapper<GdipGetPathGradientCenterPoint_delegate> GdipGetPathGradientCenterPoint_ptr; internal static Status GdipGetPathGradientCenterPoint(IntPtr brush, out PointF point) => GdipGetPathGradientCenterPoint_ptr.Delegate(brush, out point); private delegate Status GdipSetPathGradientCenterPoint_delegate(IntPtr brush, ref PointF point); private static FunctionWrapper<GdipSetPathGradientCenterPoint_delegate> GdipSetPathGradientCenterPoint_ptr; internal static Status GdipSetPathGradientCenterPoint(IntPtr brush, ref PointF point) => GdipSetPathGradientCenterPoint_ptr.Delegate(brush, ref point); private delegate Status GdipGetPathGradientFocusScales_delegate(IntPtr brush, out float xScale, out float yScale); private static FunctionWrapper<GdipGetPathGradientFocusScales_delegate> GdipGetPathGradientFocusScales_ptr; internal static Status GdipGetPathGradientFocusScales(IntPtr brush, out float xScale, out float yScale) => GdipGetPathGradientFocusScales_ptr.Delegate(brush, out xScale, out yScale); private delegate Status GdipSetPathGradientFocusScales_delegate(IntPtr brush, float xScale, float yScale); private static FunctionWrapper<GdipSetPathGradientFocusScales_delegate> GdipSetPathGradientFocusScales_ptr; internal static Status GdipSetPathGradientFocusScales(IntPtr brush, float xScale, float yScale) => GdipSetPathGradientFocusScales_ptr.Delegate(brush, xScale, yScale); private delegate Status GdipGetPathGradientPresetBlendCount_delegate(IntPtr brush, out int count); private static FunctionWrapper<GdipGetPathGradientPresetBlendCount_delegate> GdipGetPathGradientPresetBlendCount_ptr; internal static Status GdipGetPathGradientPresetBlendCount(IntPtr brush, out int count) => GdipGetPathGradientPresetBlendCount_ptr.Delegate(brush, out count); private delegate Status GdipGetPathGradientPresetBlend_delegate(IntPtr brush, int[] blend, float[] positions, int count); private static FunctionWrapper<GdipGetPathGradientPresetBlend_delegate> GdipGetPathGradientPresetBlend_ptr; internal static Status GdipGetPathGradientPresetBlend(IntPtr brush, int[] blend, float[] positions, int count) => GdipGetPathGradientPresetBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipSetPathGradientPresetBlend_delegate(IntPtr brush, int[] blend, float[] positions, int count); private static FunctionWrapper<GdipSetPathGradientPresetBlend_delegate> GdipSetPathGradientPresetBlend_ptr; internal static Status GdipSetPathGradientPresetBlend(IntPtr brush, int[] blend, float[] positions, int count) => GdipSetPathGradientPresetBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipGetPathGradientRect_delegate(IntPtr brush, out RectangleF rect); private static FunctionWrapper<GdipGetPathGradientRect_delegate> GdipGetPathGradientRect_ptr; internal static Status GdipGetPathGradientRect(IntPtr brush, out RectangleF rect) => GdipGetPathGradientRect_ptr.Delegate(brush, out rect); private delegate Status GdipGetPathGradientSurroundColorCount_delegate(IntPtr brush, out int count); private static FunctionWrapper<GdipGetPathGradientSurroundColorCount_delegate> GdipGetPathGradientSurroundColorCount_ptr; internal static Status GdipGetPathGradientSurroundColorCount(IntPtr brush, out int count) => GdipGetPathGradientSurroundColorCount_ptr.Delegate(brush, out count); private delegate Status GdipGetPathGradientSurroundColorsWithCount_delegate(IntPtr brush, int[] color, ref int count); private static FunctionWrapper<GdipGetPathGradientSurroundColorsWithCount_delegate> GdipGetPathGradientSurroundColorsWithCount_ptr; internal static Status GdipGetPathGradientSurroundColorsWithCount(IntPtr brush, int[] color, ref int count) => GdipGetPathGradientSurroundColorsWithCount_ptr.Delegate(brush, color, ref count); private delegate Status GdipSetPathGradientSurroundColorsWithCount_delegate(IntPtr brush, int[] color, ref int count); private static FunctionWrapper<GdipSetPathGradientSurroundColorsWithCount_delegate> GdipSetPathGradientSurroundColorsWithCount_ptr; internal static Status GdipSetPathGradientSurroundColorsWithCount(IntPtr brush, int[] color, ref int count) => GdipSetPathGradientSurroundColorsWithCount_ptr.Delegate(brush, color, ref count); private delegate Status GdipGetPathGradientTransform_delegate(IntPtr brush, IntPtr matrix); private static FunctionWrapper<GdipGetPathGradientTransform_delegate> GdipGetPathGradientTransform_ptr; internal static Status GdipGetPathGradientTransform(IntPtr brush, IntPtr matrix) => GdipGetPathGradientTransform_ptr.Delegate(brush, matrix); private delegate Status GdipSetPathGradientTransform_delegate(IntPtr brush, IntPtr matrix); private static FunctionWrapper<GdipSetPathGradientTransform_delegate> GdipSetPathGradientTransform_ptr; internal static Status GdipSetPathGradientTransform(IntPtr brush, IntPtr matrix) => GdipSetPathGradientTransform_ptr.Delegate(brush, matrix); private delegate Status GdipGetPathGradientWrapMode_delegate(IntPtr brush, out WrapMode wrapMode); private static FunctionWrapper<GdipGetPathGradientWrapMode_delegate> GdipGetPathGradientWrapMode_ptr; internal static Status GdipGetPathGradientWrapMode(IntPtr brush, out WrapMode wrapMode) => GdipGetPathGradientWrapMode_ptr.Delegate(brush, out wrapMode); private delegate Status GdipSetPathGradientWrapMode_delegate(IntPtr brush, WrapMode wrapMode); private static FunctionWrapper<GdipSetPathGradientWrapMode_delegate> GdipSetPathGradientWrapMode_ptr; internal static Status GdipSetPathGradientWrapMode(IntPtr brush, WrapMode wrapMode) => GdipSetPathGradientWrapMode_ptr.Delegate(brush, wrapMode); private delegate Status GdipSetPathGradientLinearBlend_delegate(IntPtr brush, float focus, float scale); private static FunctionWrapper<GdipSetPathGradientLinearBlend_delegate> GdipSetPathGradientLinearBlend_ptr; internal static Status GdipSetPathGradientLinearBlend(IntPtr brush, float focus, float scale) => GdipSetPathGradientLinearBlend_ptr.Delegate(brush, focus, scale); private delegate Status GdipSetPathGradientSigmaBlend_delegate(IntPtr brush, float focus, float scale); private static FunctionWrapper<GdipSetPathGradientSigmaBlend_delegate> GdipSetPathGradientSigmaBlend_ptr; internal static Status GdipSetPathGradientSigmaBlend(IntPtr brush, float focus, float scale) => GdipSetPathGradientSigmaBlend_ptr.Delegate(brush, focus, scale); private delegate Status GdipMultiplyPathGradientTransform_delegate(IntPtr texture, IntPtr matrix, MatrixOrder order); private static FunctionWrapper<GdipMultiplyPathGradientTransform_delegate> GdipMultiplyPathGradientTransform_ptr; internal static Status GdipMultiplyPathGradientTransform(IntPtr texture, IntPtr matrix, MatrixOrder order) => GdipMultiplyPathGradientTransform_ptr.Delegate(texture, matrix, order); private delegate Status GdipResetPathGradientTransform_delegate(IntPtr brush); private static FunctionWrapper<GdipResetPathGradientTransform_delegate> GdipResetPathGradientTransform_ptr; internal static Status GdipResetPathGradientTransform(IntPtr brush) => GdipResetPathGradientTransform_ptr.Delegate(brush); private delegate Status GdipRotatePathGradientTransform_delegate(IntPtr brush, float angle, MatrixOrder order); private static FunctionWrapper<GdipRotatePathGradientTransform_delegate> GdipRotatePathGradientTransform_ptr; internal static Status GdipRotatePathGradientTransform(IntPtr brush, float angle, MatrixOrder order) => GdipRotatePathGradientTransform_ptr.Delegate(brush, angle, order); private delegate Status GdipScalePathGradientTransform_delegate(IntPtr brush, float sx, float sy, MatrixOrder order); private static FunctionWrapper<GdipScalePathGradientTransform_delegate> GdipScalePathGradientTransform_ptr; internal static Status GdipScalePathGradientTransform(IntPtr brush, float sx, float sy, MatrixOrder order) => GdipScalePathGradientTransform_ptr.Delegate(brush, sx, sy, order); private delegate Status GdipTranslatePathGradientTransform_delegate(IntPtr brush, float dx, float dy, MatrixOrder order); private static FunctionWrapper<GdipTranslatePathGradientTransform_delegate> GdipTranslatePathGradientTransform_ptr; internal static Status GdipTranslatePathGradientTransform(IntPtr brush, float dx, float dy, MatrixOrder order) => GdipTranslatePathGradientTransform_ptr.Delegate(brush, dx, dy, order); private delegate Status GdipCreateLineBrushI_delegate(ref Point point1, ref Point point2, int color1, int color2, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreateLineBrushI_delegate> GdipCreateLineBrushI_ptr; internal static Status GdipCreateLineBrushI(ref Point point1, ref Point point2, int color1, int color2, WrapMode wrapMode, out IntPtr brush) => GdipCreateLineBrushI_ptr.Delegate(ref point1, ref point2, color1, color2, wrapMode, out brush); private delegate Status GdipCreateLineBrush_delegate(ref PointF point1, ref PointF point2, int color1, int color2, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreateLineBrush_delegate> GdipCreateLineBrush_ptr; internal static Status GdipCreateLineBrush(ref PointF point1, ref PointF point2, int color1, int color2, WrapMode wrapMode, out IntPtr brush) => GdipCreateLineBrush_ptr.Delegate(ref point1, ref point2, color1, color2, wrapMode, out brush); private delegate Status GdipCreateLineBrushFromRectI_delegate(ref Rectangle rect, int color1, int color2, LinearGradientMode linearGradientMode, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreateLineBrushFromRectI_delegate> GdipCreateLineBrushFromRectI_ptr; internal static Status GdipCreateLineBrushFromRectI(ref Rectangle rect, int color1, int color2, LinearGradientMode linearGradientMode, WrapMode wrapMode, out IntPtr brush) => GdipCreateLineBrushFromRectI_ptr.Delegate(ref rect, color1, color2, linearGradientMode, wrapMode, out brush); private delegate Status GdipCreateLineBrushFromRect_delegate(ref RectangleF rect, int color1, int color2, LinearGradientMode linearGradientMode, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreateLineBrushFromRect_delegate> GdipCreateLineBrushFromRect_ptr; internal static Status GdipCreateLineBrushFromRect(ref RectangleF rect, int color1, int color2, LinearGradientMode linearGradientMode, WrapMode wrapMode, out IntPtr brush) => GdipCreateLineBrushFromRect_ptr.Delegate(ref rect, color1, color2, linearGradientMode, wrapMode, out brush); private delegate Status GdipCreateLineBrushFromRectWithAngleI_delegate(ref Rectangle rect, int color1, int color2, float angle, bool isAngleScaleable, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreateLineBrushFromRectWithAngleI_delegate> GdipCreateLineBrushFromRectWithAngleI_ptr; internal static Status GdipCreateLineBrushFromRectWithAngleI(ref Rectangle rect, int color1, int color2, float angle, bool isAngleScaleable, WrapMode wrapMode, out IntPtr brush) => GdipCreateLineBrushFromRectWithAngleI_ptr.Delegate(ref rect, color1, color2, angle, isAngleScaleable, wrapMode, out brush); private delegate Status GdipCreateLineBrushFromRectWithAngle_delegate(ref RectangleF rect, int color1, int color2, float angle, bool isAngleScaleable, WrapMode wrapMode, out IntPtr brush); private static FunctionWrapper<GdipCreateLineBrushFromRectWithAngle_delegate> GdipCreateLineBrushFromRectWithAngle_ptr; internal static Status GdipCreateLineBrushFromRectWithAngle(ref RectangleF rect, int color1, int color2, float angle, bool isAngleScaleable, WrapMode wrapMode, out IntPtr brush) => GdipCreateLineBrushFromRectWithAngle_ptr.Delegate(ref rect, color1, color2, angle, isAngleScaleable, wrapMode, out brush); private delegate Status GdipGetLineBlendCount_delegate(IntPtr brush, out int count); private static FunctionWrapper<GdipGetLineBlendCount_delegate> GdipGetLineBlendCount_ptr; internal static Status GdipGetLineBlendCount(IntPtr brush, out int count) => GdipGetLineBlendCount_ptr.Delegate(brush, out count); private delegate Status GdipSetLineBlend_delegate(IntPtr brush, float[] blend, float[] positions, int count); private static FunctionWrapper<GdipSetLineBlend_delegate> GdipSetLineBlend_ptr; internal static Status GdipSetLineBlend(IntPtr brush, float[] blend, float[] positions, int count) => GdipSetLineBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipGetLineBlend_delegate(IntPtr brush, float[] blend, float[] positions, int count); private static FunctionWrapper<GdipGetLineBlend_delegate> GdipGetLineBlend_ptr; internal static Status GdipGetLineBlend(IntPtr brush, float[] blend, float[] positions, int count) => GdipGetLineBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipSetLineGammaCorrection_delegate(IntPtr brush, bool useGammaCorrection); private static FunctionWrapper<GdipSetLineGammaCorrection_delegate> GdipSetLineGammaCorrection_ptr; internal static Status GdipSetLineGammaCorrection(IntPtr brush, bool useGammaCorrection) => GdipSetLineGammaCorrection_ptr.Delegate(brush, useGammaCorrection); private delegate Status GdipGetLineGammaCorrection_delegate(IntPtr brush, out bool useGammaCorrection); private static FunctionWrapper<GdipGetLineGammaCorrection_delegate> GdipGetLineGammaCorrection_ptr; internal static Status GdipGetLineGammaCorrection(IntPtr brush, out bool useGammaCorrection) => GdipGetLineGammaCorrection_ptr.Delegate(brush, out useGammaCorrection); private delegate Status GdipGetLinePresetBlendCount_delegate(IntPtr brush, out int count); private static FunctionWrapper<GdipGetLinePresetBlendCount_delegate> GdipGetLinePresetBlendCount_ptr; internal static Status GdipGetLinePresetBlendCount(IntPtr brush, out int count) => GdipGetLinePresetBlendCount_ptr.Delegate(brush, out count); private delegate Status GdipSetLinePresetBlend_delegate(IntPtr brush, int[] blend, float[] positions, int count); private static FunctionWrapper<GdipSetLinePresetBlend_delegate> GdipSetLinePresetBlend_ptr; internal static Status GdipSetLinePresetBlend(IntPtr brush, int[] blend, float[] positions, int count) => GdipSetLinePresetBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipGetLinePresetBlend_delegate(IntPtr brush, int[] blend, float[] positions, int count); private static FunctionWrapper<GdipGetLinePresetBlend_delegate> GdipGetLinePresetBlend_ptr; internal static Status GdipGetLinePresetBlend(IntPtr brush, int[] blend, float[] positions, int count) => GdipGetLinePresetBlend_ptr.Delegate(brush, blend, positions, count); private delegate Status GdipSetLineColors_delegate(IntPtr brush, int color1, int color2); private static FunctionWrapper<GdipSetLineColors_delegate> GdipSetLineColors_ptr; internal static Status GdipSetLineColors(IntPtr brush, int color1, int color2) => GdipSetLineColors_ptr.Delegate(brush, color1, color2); private delegate Status GdipGetLineColors_delegate(IntPtr brush, int[] colors); private static FunctionWrapper<GdipGetLineColors_delegate> GdipGetLineColors_ptr; internal static Status GdipGetLineColors(IntPtr brush, int[] colors) => GdipGetLineColors_ptr.Delegate(brush, colors); private delegate Status GdipGetLineRectI_delegate(IntPtr brush, out Rectangle rect); private static FunctionWrapper<GdipGetLineRectI_delegate> GdipGetLineRectI_ptr; internal static Status GdipGetLineRectI(IntPtr brush, out Rectangle rect) => GdipGetLineRectI_ptr.Delegate(brush, out rect); private delegate Status GdipGetLineRect_delegate(IntPtr brush, out RectangleF rect); private static FunctionWrapper<GdipGetLineRect_delegate> GdipGetLineRect_ptr; internal static Status GdipGetLineRect(IntPtr brush, out RectangleF rect) => GdipGetLineRect_ptr.Delegate(brush, out rect); private delegate Status GdipSetLineTransform_delegate(IntPtr brush, IntPtr matrix); private static FunctionWrapper<GdipSetLineTransform_delegate> GdipSetLineTransform_ptr; internal static Status GdipSetLineTransform(IntPtr brush, IntPtr matrix) => GdipSetLineTransform_ptr.Delegate(brush, matrix); private delegate Status GdipGetLineTransform_delegate(IntPtr brush, IntPtr matrix); private static FunctionWrapper<GdipGetLineTransform_delegate> GdipGetLineTransform_ptr; internal static Status GdipGetLineTransform(IntPtr brush, IntPtr matrix) => GdipGetLineTransform_ptr.Delegate(brush, matrix); private delegate Status GdipSetLineWrapMode_delegate(IntPtr brush, WrapMode wrapMode); private static FunctionWrapper<GdipSetLineWrapMode_delegate> GdipSetLineWrapMode_ptr; internal static Status GdipSetLineWrapMode(IntPtr brush, WrapMode wrapMode) => GdipSetLineWrapMode_ptr.Delegate(brush, wrapMode); private delegate Status GdipGetLineWrapMode_delegate(IntPtr brush, out WrapMode wrapMode); private static FunctionWrapper<GdipGetLineWrapMode_delegate> GdipGetLineWrapMode_ptr; internal static Status GdipGetLineWrapMode(IntPtr brush, out WrapMode wrapMode) => GdipGetLineWrapMode_ptr.Delegate(brush, out wrapMode); private delegate Status GdipSetLineLinearBlend_delegate(IntPtr brush, float focus, float scale); private static FunctionWrapper<GdipSetLineLinearBlend_delegate> GdipSetLineLinearBlend_ptr; internal static Status GdipSetLineLinearBlend(IntPtr brush, float focus, float scale) => GdipSetLineLinearBlend_ptr.Delegate(brush, focus, scale); private delegate Status GdipSetLineSigmaBlend_delegate(IntPtr brush, float focus, float scale); private static FunctionWrapper<GdipSetLineSigmaBlend_delegate> GdipSetLineSigmaBlend_ptr; internal static Status GdipSetLineSigmaBlend(IntPtr brush, float focus, float scale) => GdipSetLineSigmaBlend_ptr.Delegate(brush, focus, scale); private delegate Status GdipMultiplyLineTransform_delegate(IntPtr brush, IntPtr matrix, MatrixOrder order); private static FunctionWrapper<GdipMultiplyLineTransform_delegate> GdipMultiplyLineTransform_ptr; internal static Status GdipMultiplyLineTransform(IntPtr brush, IntPtr matrix, MatrixOrder order) => GdipMultiplyLineTransform_ptr.Delegate(brush, matrix, order); private delegate Status GdipResetLineTransform_delegate(IntPtr brush); private static FunctionWrapper<GdipResetLineTransform_delegate> GdipResetLineTransform_ptr; internal static Status GdipResetLineTransform(IntPtr brush) => GdipResetLineTransform_ptr.Delegate(brush); private delegate Status GdipRotateLineTransform_delegate(IntPtr brush, float angle, MatrixOrder order); private static FunctionWrapper<GdipRotateLineTransform_delegate> GdipRotateLineTransform_ptr; internal static Status GdipRotateLineTransform(IntPtr brush, float angle, MatrixOrder order) => GdipRotateLineTransform_ptr.Delegate(brush, angle, order); private delegate Status GdipScaleLineTransform_delegate(IntPtr brush, float sx, float sy, MatrixOrder order); private static FunctionWrapper<GdipScaleLineTransform_delegate> GdipScaleLineTransform_ptr; internal static Status GdipScaleLineTransform(IntPtr brush, float sx, float sy, MatrixOrder order) => GdipScaleLineTransform_ptr.Delegate(brush, sx, sy, order); private delegate Status GdipTranslateLineTransform_delegate(IntPtr brush, float dx, float dy, MatrixOrder order); private static FunctionWrapper<GdipTranslateLineTransform_delegate> GdipTranslateLineTransform_ptr; internal static Status GdipTranslateLineTransform(IntPtr brush, float dx, float dy, MatrixOrder order) => GdipTranslateLineTransform_ptr.Delegate(brush, dx, dy, order); private delegate Status GdipCreateFromHDC_delegate(IntPtr hDC, out IntPtr graphics); private static FunctionWrapper<GdipCreateFromHDC_delegate> GdipCreateFromHDC_ptr; internal static Status GdipCreateFromHDC(IntPtr hDC, out IntPtr graphics) => GdipCreateFromHDC_ptr.Delegate(hDC, out graphics); private delegate Status GdipDeleteGraphics_delegate(IntPtr graphics); private static FunctionWrapper<GdipDeleteGraphics_delegate> GdipDeleteGraphics_ptr; internal static Status GdipDeleteGraphics(IntPtr graphics) => GdipDeleteGraphics_ptr.Delegate(graphics); internal static int IntGdipDeleteGraphics(HandleRef graphics) => (int)GdipDeleteGraphics_ptr.Delegate(graphics.Handle); private delegate Status GdipRestoreGraphics_delegate(IntPtr graphics, uint graphicsState); private static FunctionWrapper<GdipRestoreGraphics_delegate> GdipRestoreGraphics_ptr; internal static Status GdipRestoreGraphics(IntPtr graphics, uint graphicsState) => GdipRestoreGraphics_ptr.Delegate(graphics, graphicsState); private delegate Status GdipSaveGraphics_delegate(IntPtr graphics, out uint state); private static FunctionWrapper<GdipSaveGraphics_delegate> GdipSaveGraphics_ptr; internal static Status GdipSaveGraphics(IntPtr graphics, out uint state) => GdipSaveGraphics_ptr.Delegate(graphics, out state); private delegate Status GdipMultiplyWorldTransform_delegate(IntPtr graphics, IntPtr matrix, MatrixOrder order); private static FunctionWrapper<GdipMultiplyWorldTransform_delegate> GdipMultiplyWorldTransform_ptr; internal static Status GdipMultiplyWorldTransform(IntPtr graphics, IntPtr matrix, MatrixOrder order) => GdipMultiplyWorldTransform_ptr.Delegate(graphics, matrix, order); private delegate Status GdipRotateWorldTransform_delegate(IntPtr graphics, float angle, MatrixOrder order); private static FunctionWrapper<GdipRotateWorldTransform_delegate> GdipRotateWorldTransform_ptr; internal static Status GdipRotateWorldTransform(IntPtr graphics, float angle, MatrixOrder order) => GdipRotateWorldTransform_ptr.Delegate(graphics, angle, order); private delegate Status GdipTranslateWorldTransform_delegate(IntPtr graphics, float dx, float dy, MatrixOrder order); private static FunctionWrapper<GdipTranslateWorldTransform_delegate> GdipTranslateWorldTransform_ptr; internal static Status GdipTranslateWorldTransform(IntPtr graphics, float dx, float dy, MatrixOrder order) => GdipTranslateWorldTransform_ptr.Delegate(graphics, dx, dy, order); private delegate Status GdipDrawArc_delegate(IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipDrawArc_delegate> GdipDrawArc_ptr; internal static Status GdipDrawArc(IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle) => GdipDrawArc_ptr.Delegate(graphics, pen, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipDrawArcI_delegate(IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipDrawArcI_delegate> GdipDrawArcI_ptr; internal static Status GdipDrawArcI(IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle) => GdipDrawArcI_ptr.Delegate(graphics, pen, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipDrawBezier_delegate(IntPtr graphics, IntPtr pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4); private static FunctionWrapper<GdipDrawBezier_delegate> GdipDrawBezier_ptr; internal static Status GdipDrawBezier(IntPtr graphics, IntPtr pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) => GdipDrawBezier_ptr.Delegate(graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); private delegate Status GdipDrawBezierI_delegate(IntPtr graphics, IntPtr pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4); private static FunctionWrapper<GdipDrawBezierI_delegate> GdipDrawBezierI_ptr; internal static Status GdipDrawBezierI(IntPtr graphics, IntPtr pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) => GdipDrawBezierI_ptr.Delegate(graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); private delegate Status GdipDrawEllipseI_delegate(IntPtr graphics, IntPtr pen, int x, int y, int width, int height); private static FunctionWrapper<GdipDrawEllipseI_delegate> GdipDrawEllipseI_ptr; internal static Status GdipDrawEllipseI(IntPtr graphics, IntPtr pen, int x, int y, int width, int height) => GdipDrawEllipseI_ptr.Delegate(graphics, pen, x, y, width, height); private delegate Status GdipDrawEllipse_delegate(IntPtr graphics, IntPtr pen, float x, float y, float width, float height); private static FunctionWrapper<GdipDrawEllipse_delegate> GdipDrawEllipse_ptr; internal static Status GdipDrawEllipse(IntPtr graphics, IntPtr pen, float x, float y, float width, float height) => GdipDrawEllipse_ptr.Delegate(graphics, pen, x, y, width, height); private delegate Status GdipDrawLine_delegate(IntPtr graphics, IntPtr pen, float x1, float y1, float x2, float y2); private static FunctionWrapper<GdipDrawLine_delegate> GdipDrawLine_ptr; internal static Status GdipDrawLine(IntPtr graphics, IntPtr pen, float x1, float y1, float x2, float y2) => GdipDrawLine_ptr.Delegate(graphics, pen, x1, y1, x2, y2); private delegate Status GdipDrawLineI_delegate(IntPtr graphics, IntPtr pen, int x1, int y1, int x2, int y2); private static FunctionWrapper<GdipDrawLineI_delegate> GdipDrawLineI_ptr; internal static Status GdipDrawLineI(IntPtr graphics, IntPtr pen, int x1, int y1, int x2, int y2) => GdipDrawLineI_ptr.Delegate(graphics, pen, x1, y1, x2, y2); private delegate Status GdipDrawLines_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count); private static FunctionWrapper<GdipDrawLines_delegate> GdipDrawLines_ptr; internal static Status GdipDrawLines(IntPtr graphics, IntPtr pen, PointF[] points, int count) => GdipDrawLines_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawLinesI_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count); private static FunctionWrapper<GdipDrawLinesI_delegate> GdipDrawLinesI_ptr; internal static Status GdipDrawLinesI(IntPtr graphics, IntPtr pen, Point[] points, int count) => GdipDrawLinesI_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawPath_delegate(IntPtr graphics, IntPtr pen, IntPtr path); private static FunctionWrapper<GdipDrawPath_delegate> GdipDrawPath_ptr; internal static Status GdipDrawPath(IntPtr graphics, IntPtr pen, IntPtr path) => GdipDrawPath_ptr.Delegate(graphics, pen, path); private delegate Status GdipDrawPie_delegate(IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipDrawPie_delegate> GdipDrawPie_ptr; internal static Status GdipDrawPie(IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle) => GdipDrawPie_ptr.Delegate(graphics, pen, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipDrawPieI_delegate(IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipDrawPieI_delegate> GdipDrawPieI_ptr; internal static Status GdipDrawPieI(IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle) => GdipDrawPieI_ptr.Delegate(graphics, pen, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipDrawPolygon_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count); private static FunctionWrapper<GdipDrawPolygon_delegate> GdipDrawPolygon_ptr; internal static Status GdipDrawPolygon(IntPtr graphics, IntPtr pen, PointF[] points, int count) => GdipDrawPolygon_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawPolygonI_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count); private static FunctionWrapper<GdipDrawPolygonI_delegate> GdipDrawPolygonI_ptr; internal static Status GdipDrawPolygonI(IntPtr graphics, IntPtr pen, Point[] points, int count) => GdipDrawPolygonI_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawRectangle_delegate(IntPtr graphics, IntPtr pen, float x, float y, float width, float height); private static FunctionWrapper<GdipDrawRectangle_delegate> GdipDrawRectangle_ptr; internal static Status GdipDrawRectangle(IntPtr graphics, IntPtr pen, float x, float y, float width, float height) => GdipDrawRectangle_ptr.Delegate(graphics, pen, x, y, width, height); private delegate Status GdipDrawRectangleI_delegate(IntPtr graphics, IntPtr pen, int x, int y, int width, int height); private static FunctionWrapper<GdipDrawRectangleI_delegate> GdipDrawRectangleI_ptr; internal static Status GdipDrawRectangleI(IntPtr graphics, IntPtr pen, int x, int y, int width, int height) => GdipDrawRectangleI_ptr.Delegate(graphics, pen, x, y, width, height); private delegate Status GdipDrawRectangles_delegate(IntPtr graphics, IntPtr pen, RectangleF[] rects, int count); private static FunctionWrapper<GdipDrawRectangles_delegate> GdipDrawRectangles_ptr; internal static Status GdipDrawRectangles(IntPtr graphics, IntPtr pen, RectangleF[] rects, int count) => GdipDrawRectangles_ptr.Delegate(graphics, pen, rects, count); private delegate Status GdipDrawRectanglesI_delegate(IntPtr graphics, IntPtr pen, Rectangle[] rects, int count); private static FunctionWrapper<GdipDrawRectanglesI_delegate> GdipDrawRectanglesI_ptr; internal static Status GdipDrawRectanglesI(IntPtr graphics, IntPtr pen, Rectangle[] rects, int count) => GdipDrawRectanglesI_ptr.Delegate(graphics, pen, rects, count); private delegate Status GdipFillEllipseI_delegate(IntPtr graphics, IntPtr pen, int x, int y, int width, int height); private static FunctionWrapper<GdipFillEllipseI_delegate> GdipFillEllipseI_ptr; internal static Status GdipFillEllipseI(IntPtr graphics, IntPtr pen, int x, int y, int width, int height) => GdipFillEllipseI_ptr.Delegate(graphics, pen, x, y, width, height); private delegate Status GdipFillEllipse_delegate(IntPtr graphics, IntPtr pen, float x, float y, float width, float height); private static FunctionWrapper<GdipFillEllipse_delegate> GdipFillEllipse_ptr; internal static Status GdipFillEllipse(IntPtr graphics, IntPtr pen, float x, float y, float width, float height) => GdipFillEllipse_ptr.Delegate(graphics, pen, x, y, width, height); private delegate Status GdipFillPolygon_delegate(IntPtr graphics, IntPtr brush, PointF[] points, int count, FillMode fillMode); private static FunctionWrapper<GdipFillPolygon_delegate> GdipFillPolygon_ptr; internal static Status GdipFillPolygon(IntPtr graphics, IntPtr brush, PointF[] points, int count, FillMode fillMode) => GdipFillPolygon_ptr.Delegate(graphics, brush, points, count, fillMode); private delegate Status GdipFillPolygonI_delegate(IntPtr graphics, IntPtr brush, Point[] points, int count, FillMode fillMode); private static FunctionWrapper<GdipFillPolygonI_delegate> GdipFillPolygonI_ptr; internal static Status GdipFillPolygonI(IntPtr graphics, IntPtr brush, Point[] points, int count, FillMode fillMode) => GdipFillPolygonI_ptr.Delegate(graphics, brush, points, count, fillMode); private delegate Status GdipFillPolygon2_delegate(IntPtr graphics, IntPtr brush, PointF[] points, int count); private static FunctionWrapper<GdipFillPolygon2_delegate> GdipFillPolygon2_ptr; internal static Status GdipFillPolygon2(IntPtr graphics, IntPtr brush, PointF[] points, int count) => GdipFillPolygon2_ptr.Delegate(graphics, brush, points, count); private delegate Status GdipFillPolygon2I_delegate(IntPtr graphics, IntPtr brush, Point[] points, int count); private static FunctionWrapper<GdipFillPolygon2I_delegate> GdipFillPolygon2I_ptr; internal static Status GdipFillPolygon2I(IntPtr graphics, IntPtr brush, Point[] points, int count) => GdipFillPolygon2I_ptr.Delegate(graphics, brush, points, count); private delegate Status GdipFillRectangle_delegate(IntPtr graphics, IntPtr brush, float x1, float y1, float x2, float y2); private static FunctionWrapper<GdipFillRectangle_delegate> GdipFillRectangle_ptr; internal static Status GdipFillRectangle(IntPtr graphics, IntPtr brush, float x1, float y1, float x2, float y2) => GdipFillRectangle_ptr.Delegate(graphics, brush, x1, y1, x2, y2); private delegate Status GdipFillRectangleI_delegate(IntPtr graphics, IntPtr brush, int x1, int y1, int x2, int y2); private static FunctionWrapper<GdipFillRectangleI_delegate> GdipFillRectangleI_ptr; internal static Status GdipFillRectangleI(IntPtr graphics, IntPtr brush, int x1, int y1, int x2, int y2) => GdipFillRectangleI_ptr.Delegate(graphics, brush, x1, y1, x2, y2); private delegate Status GdipFillRectangles_delegate(IntPtr graphics, IntPtr brush, RectangleF[] rects, int count); private static FunctionWrapper<GdipFillRectangles_delegate> GdipFillRectangles_ptr; internal static Status GdipFillRectangles(IntPtr graphics, IntPtr brush, RectangleF[] rects, int count) => GdipFillRectangles_ptr.Delegate(graphics, brush, rects, count); private delegate Status GdipFillRectanglesI_delegate(IntPtr graphics, IntPtr brush, Rectangle[] rects, int count); private static FunctionWrapper<GdipFillRectanglesI_delegate> GdipFillRectanglesI_ptr; internal static Status GdipFillRectanglesI(IntPtr graphics, IntPtr brush, Rectangle[] rects, int count) => GdipFillRectanglesI_ptr.Delegate(graphics, brush, rects, count); private delegate Status GdipDrawString_delegate(IntPtr graphics, [MarshalAs(UnmanagedType.LPWStr)]string text, int len, IntPtr font, ref RectangleF rc, IntPtr format, IntPtr brush); private static FunctionWrapper<GdipDrawString_delegate> GdipDrawString_ptr; internal static Status GdipDrawString(IntPtr graphics, string text, int len, IntPtr font, ref RectangleF rc, IntPtr format, IntPtr brush) => GdipDrawString_ptr.Delegate(graphics, text, len, font, ref rc, format, brush); private delegate Status GdipGetDC_delegate(IntPtr graphics, out IntPtr hdc); private static FunctionWrapper<GdipGetDC_delegate> GdipGetDC_ptr; internal static Status GdipGetDC(IntPtr graphics, out IntPtr hdc) => GdipGetDC_ptr.Delegate(graphics, out hdc); private delegate Status GdipReleaseDC_delegate(IntPtr graphics, IntPtr hdc); private static FunctionWrapper<GdipReleaseDC_delegate> GdipReleaseDC_ptr; internal static Status GdipReleaseDC(IntPtr graphics, IntPtr hdc) => GdipReleaseDC_ptr.Delegate(graphics, hdc); internal static int IntGdipReleaseDC(HandleRef graphics, HandleRef hdc) => (int)GdipReleaseDC_ptr.Delegate(graphics.Handle, hdc.Handle); private delegate Status GdipDrawImageRectI_delegate(IntPtr graphics, IntPtr image, int x, int y, int width, int height); private static FunctionWrapper<GdipDrawImageRectI_delegate> GdipDrawImageRectI_ptr; internal static Status GdipDrawImageRectI(IntPtr graphics, IntPtr image, int x, int y, int width, int height) => GdipDrawImageRectI_ptr.Delegate(graphics, image, x, y, width, height); private delegate Status GdipGetRenderingOrigin_delegate(IntPtr graphics, out int x, out int y); private static FunctionWrapper<GdipGetRenderingOrigin_delegate> GdipGetRenderingOrigin_ptr; internal static Status GdipGetRenderingOrigin(IntPtr graphics, out int x, out int y) => GdipGetRenderingOrigin_ptr.Delegate(graphics, out x, out y); private delegate Status GdipSetRenderingOrigin_delegate(IntPtr graphics, int x, int y); private static FunctionWrapper<GdipSetRenderingOrigin_delegate> GdipSetRenderingOrigin_ptr; internal static Status GdipSetRenderingOrigin(IntPtr graphics, int x, int y) => GdipSetRenderingOrigin_ptr.Delegate(graphics, x, y); private delegate Status GdipCloneBitmapArea_delegate(float x, float y, float width, float height, PixelFormat format, IntPtr original, out IntPtr bitmap); private static FunctionWrapper<GdipCloneBitmapArea_delegate> GdipCloneBitmapArea_ptr; internal static Status GdipCloneBitmapArea(float x, float y, float width, float height, PixelFormat format, IntPtr original, out IntPtr bitmap) => GdipCloneBitmapArea_ptr.Delegate(x, y, width, height, format, original, out bitmap); private delegate Status GdipCloneBitmapAreaI_delegate(int x, int y, int width, int height, PixelFormat format, IntPtr original, out IntPtr bitmap); private static FunctionWrapper<GdipCloneBitmapAreaI_delegate> GdipCloneBitmapAreaI_ptr; internal static Status GdipCloneBitmapAreaI(int x, int y, int width, int height, PixelFormat format, IntPtr original, out IntPtr bitmap) => GdipCloneBitmapAreaI_ptr.Delegate(x, y, width, height, format, original, out bitmap); private delegate Status GdipResetWorldTransform_delegate(IntPtr graphics); private static FunctionWrapper<GdipResetWorldTransform_delegate> GdipResetWorldTransform_ptr; internal static Status GdipResetWorldTransform(IntPtr graphics) => GdipResetWorldTransform_ptr.Delegate(graphics); private delegate Status GdipSetWorldTransform_delegate(IntPtr graphics, IntPtr matrix); private static FunctionWrapper<GdipSetWorldTransform_delegate> GdipSetWorldTransform_ptr; internal static Status GdipSetWorldTransform(IntPtr graphics, IntPtr matrix) => GdipSetWorldTransform_ptr.Delegate(graphics, matrix); private delegate Status GdipGetWorldTransform_delegate(IntPtr graphics, IntPtr matrix); private static FunctionWrapper<GdipGetWorldTransform_delegate> GdipGetWorldTransform_ptr; internal static Status GdipGetWorldTransform(IntPtr graphics, IntPtr matrix) => GdipGetWorldTransform_ptr.Delegate(graphics, matrix); private delegate Status GdipScaleWorldTransform_delegate(IntPtr graphics, float sx, float sy, MatrixOrder order); private static FunctionWrapper<GdipScaleWorldTransform_delegate> GdipScaleWorldTransform_ptr; internal static Status GdipScaleWorldTransform(IntPtr graphics, float sx, float sy, MatrixOrder order) => GdipScaleWorldTransform_ptr.Delegate(graphics, sx, sy, order); private delegate Status GdipGraphicsClear_delegate(IntPtr graphics, int argb); private static FunctionWrapper<GdipGraphicsClear_delegate> GdipGraphicsClear_ptr; internal static Status GdipGraphicsClear(IntPtr graphics, int argb) => GdipGraphicsClear_ptr.Delegate(graphics, argb); private delegate Status GdipDrawClosedCurve_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count); private static FunctionWrapper<GdipDrawClosedCurve_delegate> GdipDrawClosedCurve_ptr; internal static Status GdipDrawClosedCurve(IntPtr graphics, IntPtr pen, PointF[] points, int count) => GdipDrawClosedCurve_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawClosedCurveI_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count); private static FunctionWrapper<GdipDrawClosedCurveI_delegate> GdipDrawClosedCurveI_ptr; internal static Status GdipDrawClosedCurveI(IntPtr graphics, IntPtr pen, Point[] points, int count) => GdipDrawClosedCurveI_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawClosedCurve2_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count, float tension); private static FunctionWrapper<GdipDrawClosedCurve2_delegate> GdipDrawClosedCurve2_ptr; internal static Status GdipDrawClosedCurve2(IntPtr graphics, IntPtr pen, PointF[] points, int count, float tension) => GdipDrawClosedCurve2_ptr.Delegate(graphics, pen, points, count, tension); private delegate Status GdipDrawClosedCurve2I_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count, float tension); private static FunctionWrapper<GdipDrawClosedCurve2I_delegate> GdipDrawClosedCurve2I_ptr; internal static Status GdipDrawClosedCurve2I(IntPtr graphics, IntPtr pen, Point[] points, int count, float tension) => GdipDrawClosedCurve2I_ptr.Delegate(graphics, pen, points, count, tension); private delegate Status GdipDrawCurve_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count); private static FunctionWrapper<GdipDrawCurve_delegate> GdipDrawCurve_ptr; internal static Status GdipDrawCurve(IntPtr graphics, IntPtr pen, PointF[] points, int count) => GdipDrawCurve_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawCurveI_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count); private static FunctionWrapper<GdipDrawCurveI_delegate> GdipDrawCurveI_ptr; internal static Status GdipDrawCurveI(IntPtr graphics, IntPtr pen, Point[] points, int count) => GdipDrawCurveI_ptr.Delegate(graphics, pen, points, count); private delegate Status GdipDrawCurve2_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count, float tension); private static FunctionWrapper<GdipDrawCurve2_delegate> GdipDrawCurve2_ptr; internal static Status GdipDrawCurve2(IntPtr graphics, IntPtr pen, PointF[] points, int count, float tension) => GdipDrawCurve2_ptr.Delegate(graphics, pen, points, count, tension); private delegate Status GdipDrawCurve2I_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count, float tension); private static FunctionWrapper<GdipDrawCurve2I_delegate> GdipDrawCurve2I_ptr; internal static Status GdipDrawCurve2I(IntPtr graphics, IntPtr pen, Point[] points, int count, float tension) => GdipDrawCurve2I_ptr.Delegate(graphics, pen, points, count, tension); private delegate Status GdipDrawCurve3_delegate(IntPtr graphics, IntPtr pen, PointF[] points, int count, int offset, int numberOfSegments, float tension); private static FunctionWrapper<GdipDrawCurve3_delegate> GdipDrawCurve3_ptr; internal static Status GdipDrawCurve3(IntPtr graphics, IntPtr pen, PointF[] points, int count, int offset, int numberOfSegments, float tension) => GdipDrawCurve3_ptr.Delegate(graphics, pen, points, count, offset, numberOfSegments, tension); private delegate Status GdipDrawCurve3I_delegate(IntPtr graphics, IntPtr pen, Point[] points, int count, int offset, int numberOfSegments, float tension); private static FunctionWrapper<GdipDrawCurve3I_delegate> GdipDrawCurve3I_ptr; internal static Status GdipDrawCurve3I(IntPtr graphics, IntPtr pen, Point[] points, int count, int offset, int numberOfSegments, float tension) => GdipDrawCurve3I_ptr.Delegate(graphics, pen, points, count, offset, numberOfSegments, tension); private delegate Status GdipSetClipRect_delegate(IntPtr graphics, float x, float y, float width, float height, CombineMode combineMode); private static FunctionWrapper<GdipSetClipRect_delegate> GdipSetClipRect_ptr; internal static Status GdipSetClipRect(IntPtr graphics, float x, float y, float width, float height, CombineMode combineMode) => GdipSetClipRect_ptr.Delegate(graphics, x, y, width, height, combineMode); private delegate Status GdipSetClipRectI_delegate(IntPtr graphics, int x, int y, int width, int height, CombineMode combineMode); private static FunctionWrapper<GdipSetClipRectI_delegate> GdipSetClipRectI_ptr; internal static Status GdipSetClipRectI(IntPtr graphics, int x, int y, int width, int height, CombineMode combineMode) => GdipSetClipRectI_ptr.Delegate(graphics, x, y, width, height, combineMode); private delegate Status GdipSetClipPath_delegate(IntPtr graphics, IntPtr path, CombineMode combineMode); private static FunctionWrapper<GdipSetClipPath_delegate> GdipSetClipPath_ptr; internal static Status GdipSetClipPath(IntPtr graphics, IntPtr path, CombineMode combineMode) => GdipSetClipPath_ptr.Delegate(graphics, path, combineMode); private delegate Status GdipSetClipRegion_delegate(IntPtr graphics, IntPtr region, CombineMode combineMode); private static FunctionWrapper<GdipSetClipRegion_delegate> GdipSetClipRegion_ptr; internal static Status GdipSetClipRegion(IntPtr graphics, IntPtr region, CombineMode combineMode) => GdipSetClipRegion_ptr.Delegate(graphics, region, combineMode); private delegate Status GdipSetClipGraphics_delegate(IntPtr graphics, IntPtr srcgraphics, CombineMode combineMode); private static FunctionWrapper<GdipSetClipGraphics_delegate> GdipSetClipGraphics_ptr; internal static Status GdipSetClipGraphics(IntPtr graphics, IntPtr srcgraphics, CombineMode combineMode) => GdipSetClipGraphics_ptr.Delegate(graphics, srcgraphics, combineMode); private delegate Status GdipResetClip_delegate(IntPtr graphics); private static FunctionWrapper<GdipResetClip_delegate> GdipResetClip_ptr; internal static Status GdipResetClip(IntPtr graphics) => GdipResetClip_ptr.Delegate(graphics); private delegate Status GdipEndContainer_delegate(IntPtr graphics, uint state); private static FunctionWrapper<GdipEndContainer_delegate> GdipEndContainer_ptr; internal static Status GdipEndContainer(IntPtr graphics, uint state) => GdipEndContainer_ptr.Delegate(graphics, state); private delegate Status GdipGetClip_delegate(IntPtr graphics, IntPtr region); private static FunctionWrapper<GdipGetClip_delegate> GdipGetClip_ptr; internal static Status GdipGetClip(IntPtr graphics, IntPtr region) => GdipGetClip_ptr.Delegate(graphics, region); private delegate Status GdipFillClosedCurve_delegate(IntPtr graphics, IntPtr brush, PointF[] points, int count); private static FunctionWrapper<GdipFillClosedCurve_delegate> GdipFillClosedCurve_ptr; internal static Status GdipFillClosedCurve(IntPtr graphics, IntPtr brush, PointF[] points, int count) => GdipFillClosedCurve_ptr.Delegate(graphics, brush, points, count); private delegate Status GdipFillClosedCurveI_delegate(IntPtr graphics, IntPtr brush, Point[] points, int count); private static FunctionWrapper<GdipFillClosedCurveI_delegate> GdipFillClosedCurveI_ptr; internal static Status GdipFillClosedCurveI(IntPtr graphics, IntPtr brush, Point[] points, int count) => GdipFillClosedCurveI_ptr.Delegate(graphics, brush, points, count); private delegate Status GdipFillClosedCurve2_delegate(IntPtr graphics, IntPtr brush, PointF[] points, int count, float tension, FillMode fillMode); private static FunctionWrapper<GdipFillClosedCurve2_delegate> GdipFillClosedCurve2_ptr; internal static Status GdipFillClosedCurve2(IntPtr graphics, IntPtr brush, PointF[] points, int count, float tension, FillMode fillMode) => GdipFillClosedCurve2_ptr.Delegate(graphics, brush, points, count, tension, fillMode); private delegate Status GdipFillClosedCurve2I_delegate(IntPtr graphics, IntPtr brush, Point[] points, int count, float tension, FillMode fillMode); private static FunctionWrapper<GdipFillClosedCurve2I_delegate> GdipFillClosedCurve2I_ptr; internal static Status GdipFillClosedCurve2I(IntPtr graphics, IntPtr brush, Point[] points, int count, float tension, FillMode fillMode) => GdipFillClosedCurve2I_ptr.Delegate(graphics, brush, points, count, tension, fillMode); private delegate Status GdipFillPie_delegate(IntPtr graphics, IntPtr brush, float x, float y, float width, float height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipFillPie_delegate> GdipFillPie_ptr; internal static Status GdipFillPie(IntPtr graphics, IntPtr brush, float x, float y, float width, float height, float startAngle, float sweepAngle) => GdipFillPie_ptr.Delegate(graphics, brush, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipFillPieI_delegate(IntPtr graphics, IntPtr brush, int x, int y, int width, int height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipFillPieI_delegate> GdipFillPieI_ptr; internal static Status GdipFillPieI(IntPtr graphics, IntPtr brush, int x, int y, int width, int height, float startAngle, float sweepAngle) => GdipFillPieI_ptr.Delegate(graphics, brush, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipFillPath_delegate(IntPtr graphics, IntPtr brush, IntPtr path); private static FunctionWrapper<GdipFillPath_delegate> GdipFillPath_ptr; internal static Status GdipFillPath(IntPtr graphics, IntPtr brush, IntPtr path) => GdipFillPath_ptr.Delegate(graphics, brush, path); private delegate Status GdipGetNearestColor_delegate(IntPtr graphics, out int argb); private static FunctionWrapper<GdipGetNearestColor_delegate> GdipGetNearestColor_ptr; internal static Status GdipGetNearestColor(IntPtr graphics, out int argb) => GdipGetNearestColor_ptr.Delegate(graphics, out argb); private delegate Status GdipIsVisiblePoint_delegate(IntPtr graphics, float x, float y, out bool result); private static FunctionWrapper<GdipIsVisiblePoint_delegate> GdipIsVisiblePoint_ptr; internal static Status GdipIsVisiblePoint(IntPtr graphics, float x, float y, out bool result) => GdipIsVisiblePoint_ptr.Delegate(graphics, x, y, out result); private delegate Status GdipIsVisiblePointI_delegate(IntPtr graphics, int x, int y, out bool result); private static FunctionWrapper<GdipIsVisiblePointI_delegate> GdipIsVisiblePointI_ptr; internal static Status GdipIsVisiblePointI(IntPtr graphics, int x, int y, out bool result) => GdipIsVisiblePointI_ptr.Delegate(graphics, x, y, out result); private delegate Status GdipIsVisibleRect_delegate(IntPtr graphics, float x, float y, float width, float height, out bool result); private static FunctionWrapper<GdipIsVisibleRect_delegate> GdipIsVisibleRect_ptr; internal static Status GdipIsVisibleRect(IntPtr graphics, float x, float y, float width, float height, out bool result) => GdipIsVisibleRect_ptr.Delegate(graphics, x, y, width, height, out result); private delegate Status GdipIsVisibleRectI_delegate(IntPtr graphics, int x, int y, int width, int height, out bool result); private static FunctionWrapper<GdipIsVisibleRectI_delegate> GdipIsVisibleRectI_ptr; internal static Status GdipIsVisibleRectI(IntPtr graphics, int x, int y, int width, int height, out bool result) => GdipIsVisibleRectI_ptr.Delegate(graphics, x, y, width, height, out result); private delegate Status GdipTransformPoints_delegate(IntPtr graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, IntPtr points, int count); private static FunctionWrapper<GdipTransformPoints_delegate> GdipTransformPoints_ptr; internal static Status GdipTransformPoints(IntPtr graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, IntPtr points, int count) => GdipTransformPoints_ptr.Delegate(graphics, destSpace, srcSpace, points, count); private delegate Status GdipTransformPointsI_delegate(IntPtr graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, IntPtr points, int count); private static FunctionWrapper<GdipTransformPointsI_delegate> GdipTransformPointsI_ptr; internal static Status GdipTransformPointsI(IntPtr graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, IntPtr points, int count) => GdipTransformPointsI_ptr.Delegate(graphics, destSpace, srcSpace, points, count); private delegate Status GdipTranslateClip_delegate(IntPtr graphics, float dx, float dy); private static FunctionWrapper<GdipTranslateClip_delegate> GdipTranslateClip_ptr; internal static Status GdipTranslateClip(IntPtr graphics, float dx, float dy) => GdipTranslateClip_ptr.Delegate(graphics, dx, dy); private delegate Status GdipTranslateClipI_delegate(IntPtr graphics, int dx, int dy); private static FunctionWrapper<GdipTranslateClipI_delegate> GdipTranslateClipI_ptr; internal static Status GdipTranslateClipI(IntPtr graphics, int dx, int dy) => GdipTranslateClipI_ptr.Delegate(graphics, dx, dy); private delegate Status GdipGetClipBounds_delegate(IntPtr graphics, out RectangleF rect); private static FunctionWrapper<GdipGetClipBounds_delegate> GdipGetClipBounds_ptr; internal static Status GdipGetClipBounds(IntPtr graphics, out RectangleF rect) => GdipGetClipBounds_ptr.Delegate(graphics, out rect); private delegate Status GdipSetCompositingMode_delegate(IntPtr graphics, CompositingMode compositingMode); private static FunctionWrapper<GdipSetCompositingMode_delegate> GdipSetCompositingMode_ptr; internal static Status GdipSetCompositingMode(IntPtr graphics, CompositingMode compositingMode) => GdipSetCompositingMode_ptr.Delegate(graphics, compositingMode); private delegate Status GdipGetCompositingMode_delegate(IntPtr graphics, out CompositingMode compositingMode); private static FunctionWrapper<GdipGetCompositingMode_delegate> GdipGetCompositingMode_ptr; internal static Status GdipGetCompositingMode(IntPtr graphics, out CompositingMode compositingMode) => GdipGetCompositingMode_ptr.Delegate(graphics, out compositingMode); private delegate Status GdipSetCompositingQuality_delegate(IntPtr graphics, CompositingQuality compositingQuality); private static FunctionWrapper<GdipSetCompositingQuality_delegate> GdipSetCompositingQuality_ptr; internal static Status GdipSetCompositingQuality(IntPtr graphics, CompositingQuality compositingQuality) => GdipSetCompositingQuality_ptr.Delegate(graphics, compositingQuality); private delegate Status GdipGetCompositingQuality_delegate(IntPtr graphics, out CompositingQuality compositingQuality); private static FunctionWrapper<GdipGetCompositingQuality_delegate> GdipGetCompositingQuality_ptr; internal static Status GdipGetCompositingQuality(IntPtr graphics, out CompositingQuality compositingQuality) => GdipGetCompositingQuality_ptr.Delegate(graphics, out compositingQuality); private delegate Status GdipSetInterpolationMode_delegate(IntPtr graphics, InterpolationMode interpolationMode); private static FunctionWrapper<GdipSetInterpolationMode_delegate> GdipSetInterpolationMode_ptr; internal static Status GdipSetInterpolationMode(IntPtr graphics, InterpolationMode interpolationMode) => GdipSetInterpolationMode_ptr.Delegate(graphics, interpolationMode); private delegate Status GdipGetInterpolationMode_delegate(IntPtr graphics, out InterpolationMode interpolationMode); private static FunctionWrapper<GdipGetInterpolationMode_delegate> GdipGetInterpolationMode_ptr; internal static Status GdipGetInterpolationMode(IntPtr graphics, out InterpolationMode interpolationMode) => GdipGetInterpolationMode_ptr.Delegate(graphics, out interpolationMode); private delegate Status GdipGetDpiX_delegate(IntPtr graphics, out float dpi); private static FunctionWrapper<GdipGetDpiX_delegate> GdipGetDpiX_ptr; internal static Status GdipGetDpiX(IntPtr graphics, out float dpi) => GdipGetDpiX_ptr.Delegate(graphics, out dpi); private delegate Status GdipGetDpiY_delegate(IntPtr graphics, out float dpi); private static FunctionWrapper<GdipGetDpiY_delegate> GdipGetDpiY_ptr; internal static Status GdipGetDpiY(IntPtr graphics, out float dpi) => GdipGetDpiY_ptr.Delegate(graphics, out dpi); private delegate Status GdipIsClipEmpty_delegate(IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsClipEmpty_delegate> GdipIsClipEmpty_ptr; internal static Status GdipIsClipEmpty(IntPtr graphics, out bool result) => GdipIsClipEmpty_ptr.Delegate(graphics, out result); private delegate Status GdipIsVisibleClipEmpty_delegate(IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisibleClipEmpty_delegate> GdipIsVisibleClipEmpty_ptr; internal static Status GdipIsVisibleClipEmpty(IntPtr graphics, out bool result) => GdipIsVisibleClipEmpty_ptr.Delegate(graphics, out result); private delegate Status GdipGetPageUnit_delegate(IntPtr graphics, out GraphicsUnit unit); private static FunctionWrapper<GdipGetPageUnit_delegate> GdipGetPageUnit_ptr; internal static Status GdipGetPageUnit(IntPtr graphics, out GraphicsUnit unit) => GdipGetPageUnit_ptr.Delegate(graphics, out unit); private delegate Status GdipGetPageScale_delegate(IntPtr graphics, out float scale); private static FunctionWrapper<GdipGetPageScale_delegate> GdipGetPageScale_ptr; internal static Status GdipGetPageScale(IntPtr graphics, out float scale) => GdipGetPageScale_ptr.Delegate(graphics, out scale); private delegate Status GdipSetPageUnit_delegate(IntPtr graphics, GraphicsUnit unit); private static FunctionWrapper<GdipSetPageUnit_delegate> GdipSetPageUnit_ptr; internal static Status GdipSetPageUnit(IntPtr graphics, GraphicsUnit unit) => GdipSetPageUnit_ptr.Delegate(graphics, unit); private delegate Status GdipSetPageScale_delegate(IntPtr graphics, float scale); private static FunctionWrapper<GdipSetPageScale_delegate> GdipSetPageScale_ptr; internal static Status GdipSetPageScale(IntPtr graphics, float scale) => GdipSetPageScale_ptr.Delegate(graphics, scale); private delegate Status GdipSetPixelOffsetMode_delegate(IntPtr graphics, PixelOffsetMode pixelOffsetMode); private static FunctionWrapper<GdipSetPixelOffsetMode_delegate> GdipSetPixelOffsetMode_ptr; internal static Status GdipSetPixelOffsetMode(IntPtr graphics, PixelOffsetMode pixelOffsetMode) => GdipSetPixelOffsetMode_ptr.Delegate(graphics, pixelOffsetMode); private delegate Status GdipGetPixelOffsetMode_delegate(IntPtr graphics, out PixelOffsetMode pixelOffsetMode); private static FunctionWrapper<GdipGetPixelOffsetMode_delegate> GdipGetPixelOffsetMode_ptr; internal static Status GdipGetPixelOffsetMode(IntPtr graphics, out PixelOffsetMode pixelOffsetMode) => GdipGetPixelOffsetMode_ptr.Delegate(graphics, out pixelOffsetMode); private delegate Status GdipSetSmoothingMode_delegate(IntPtr graphics, SmoothingMode smoothingMode); private static FunctionWrapper<GdipSetSmoothingMode_delegate> GdipSetSmoothingMode_ptr; internal static Status GdipSetSmoothingMode(IntPtr graphics, SmoothingMode smoothingMode) => GdipSetSmoothingMode_ptr.Delegate(graphics, smoothingMode); private delegate Status GdipGetSmoothingMode_delegate(IntPtr graphics, out SmoothingMode smoothingMode); private static FunctionWrapper<GdipGetSmoothingMode_delegate> GdipGetSmoothingMode_ptr; internal static Status GdipGetSmoothingMode(IntPtr graphics, out SmoothingMode smoothingMode) => GdipGetSmoothingMode_ptr.Delegate(graphics, out smoothingMode); private delegate Status GdipSetTextContrast_delegate(IntPtr graphics, int contrast); private static FunctionWrapper<GdipSetTextContrast_delegate> GdipSetTextContrast_ptr; internal static Status GdipSetTextContrast(IntPtr graphics, int contrast) => GdipSetTextContrast_ptr.Delegate(graphics, contrast); private delegate Status GdipGetTextContrast_delegate(IntPtr graphics, out int contrast); private static FunctionWrapper<GdipGetTextContrast_delegate> GdipGetTextContrast_ptr; internal static Status GdipGetTextContrast(IntPtr graphics, out int contrast) => GdipGetTextContrast_ptr.Delegate(graphics, out contrast); private delegate Status GdipSetTextRenderingHint_delegate(IntPtr graphics, TextRenderingHint mode); private static FunctionWrapper<GdipSetTextRenderingHint_delegate> GdipSetTextRenderingHint_ptr; internal static Status GdipSetTextRenderingHint(IntPtr graphics, TextRenderingHint mode) => GdipSetTextRenderingHint_ptr.Delegate(graphics, mode); private delegate Status GdipGetTextRenderingHint_delegate(IntPtr graphics, out TextRenderingHint mode); private static FunctionWrapper<GdipGetTextRenderingHint_delegate> GdipGetTextRenderingHint_ptr; internal static Status GdipGetTextRenderingHint(IntPtr graphics, out TextRenderingHint mode) => GdipGetTextRenderingHint_ptr.Delegate(graphics, out mode); private delegate Status GdipGetVisibleClipBounds_delegate(IntPtr graphics, out RectangleF rect); private static FunctionWrapper<GdipGetVisibleClipBounds_delegate> GdipGetVisibleClipBounds_ptr; internal static Status GdipGetVisibleClipBounds(IntPtr graphics, out RectangleF rect) => GdipGetVisibleClipBounds_ptr.Delegate(graphics, out rect); private delegate Status GdipFlush_delegate(IntPtr graphics, FlushIntention intention); private static FunctionWrapper<GdipFlush_delegate> GdipFlush_ptr; internal static Status GdipFlush(IntPtr graphics, FlushIntention intention) => GdipFlush_ptr.Delegate(graphics, intention); private delegate Status GdipAddPathString_delegate(IntPtr path, [MarshalAs(UnmanagedType.LPWStr)]string s, int lenght, IntPtr family, int style, float emSize, ref RectangleF layoutRect, IntPtr format); private static FunctionWrapper<GdipAddPathString_delegate> GdipAddPathString_ptr; internal static Status GdipAddPathString(IntPtr path, string s, int lenght, IntPtr family, int style, float emSize, ref RectangleF layoutRect, IntPtr format) => GdipAddPathString_ptr.Delegate(path, s, lenght, family, style, emSize, ref layoutRect, format); private delegate Status GdipAddPathStringI_delegate(IntPtr path, [MarshalAs(UnmanagedType.LPWStr)]string s, int lenght, IntPtr family, int style, float emSize, ref Rectangle layoutRect, IntPtr format); private static FunctionWrapper<GdipAddPathStringI_delegate> GdipAddPathStringI_ptr; internal static Status GdipAddPathStringI(IntPtr path, string s, int lenght, IntPtr family, int style, float emSize, ref Rectangle layoutRect, IntPtr format) => GdipAddPathStringI_ptr.Delegate(path, s, lenght, family, style, emSize, ref layoutRect, format); private delegate Status GdipCreatePen1_delegate(int argb, float width, GraphicsUnit unit, out IntPtr pen); private static FunctionWrapper<GdipCreatePen1_delegate> GdipCreatePen1_ptr; internal static Status GdipCreatePen1(int argb, float width, GraphicsUnit unit, out IntPtr pen) => GdipCreatePen1_ptr.Delegate(argb, width, unit, out pen); private delegate Status GdipCreatePen2_delegate(IntPtr brush, float width, GraphicsUnit unit, out IntPtr pen); private static FunctionWrapper<GdipCreatePen2_delegate> GdipCreatePen2_ptr; internal static Status GdipCreatePen2(IntPtr brush, float width, GraphicsUnit unit, out IntPtr pen) => GdipCreatePen2_ptr.Delegate(brush, width, unit, out pen); private delegate Status GdipClonePen_delegate(IntPtr pen, out IntPtr clonepen); private static FunctionWrapper<GdipClonePen_delegate> GdipClonePen_ptr; internal static Status GdipClonePen(IntPtr pen, out IntPtr clonepen) => GdipClonePen_ptr.Delegate(pen, out clonepen); private delegate Status GdipDeletePen_delegate(IntPtr pen); private static FunctionWrapper<GdipDeletePen_delegate> GdipDeletePen_ptr; internal static Status GdipDeletePen(IntPtr pen) => GdipDeletePen_ptr.Delegate(pen); internal static int IntGdipDeletePen(HandleRef pen) => (int)GdipDeletePen_ptr.Delegate(pen.Handle); private delegate Status GdipSetPenBrushFill_delegate(IntPtr pen, IntPtr brush); private static FunctionWrapper<GdipSetPenBrushFill_delegate> GdipSetPenBrushFill_ptr; internal static Status GdipSetPenBrushFill(IntPtr pen, IntPtr brush) => GdipSetPenBrushFill_ptr.Delegate(pen, brush); private delegate Status GdipGetPenBrushFill_delegate(IntPtr pen, out IntPtr brush); private static FunctionWrapper<GdipGetPenBrushFill_delegate> GdipGetPenBrushFill_ptr; internal static Status GdipGetPenBrushFill(IntPtr pen, out IntPtr brush) => GdipGetPenBrushFill_ptr.Delegate(pen, out brush); private delegate Status GdipGetPenFillType_delegate(IntPtr pen, out PenType type); private static FunctionWrapper<GdipGetPenFillType_delegate> GdipGetPenFillType_ptr; internal static Status GdipGetPenFillType(IntPtr pen, out PenType type) => GdipGetPenFillType_ptr.Delegate(pen, out type); private delegate Status GdipSetPenColor_delegate(IntPtr pen, int color); private static FunctionWrapper<GdipSetPenColor_delegate> GdipSetPenColor_ptr; internal static Status GdipSetPenColor(IntPtr pen, int color) => GdipSetPenColor_ptr.Delegate(pen, color); private delegate Status GdipGetPenColor_delegate(IntPtr pen, out int color); private static FunctionWrapper<GdipGetPenColor_delegate> GdipGetPenColor_ptr; internal static Status GdipGetPenColor(IntPtr pen, out int color) => GdipGetPenColor_ptr.Delegate(pen, out color); private delegate Status GdipSetPenCompoundArray_delegate(IntPtr pen, float[] dash, int count); private static FunctionWrapper<GdipSetPenCompoundArray_delegate> GdipSetPenCompoundArray_ptr; internal static Status GdipSetPenCompoundArray(IntPtr pen, float[] dash, int count) => GdipSetPenCompoundArray_ptr.Delegate(pen, dash, count); private delegate Status GdipGetPenCompoundArray_delegate(IntPtr pen, float[] dash, int count); private static FunctionWrapper<GdipGetPenCompoundArray_delegate> GdipGetPenCompoundArray_ptr; internal static Status GdipGetPenCompoundArray(IntPtr pen, float[] dash, int count) => GdipGetPenCompoundArray_ptr.Delegate(pen, dash, count); private delegate Status GdipGetPenCompoundCount_delegate(IntPtr pen, out int count); private static FunctionWrapper<GdipGetPenCompoundCount_delegate> GdipGetPenCompoundCount_ptr; internal static Status GdipGetPenCompoundCount(IntPtr pen, out int count) => GdipGetPenCompoundCount_ptr.Delegate(pen, out count); private delegate Status GdipSetPenDashCap197819_delegate(IntPtr pen, DashCap dashCap); private static FunctionWrapper<GdipSetPenDashCap197819_delegate> GdipSetPenDashCap197819_ptr; internal static Status GdipSetPenDashCap197819(IntPtr pen, DashCap dashCap) => GdipSetPenDashCap197819_ptr.Delegate(pen, dashCap); private delegate Status GdipGetPenDashCap197819_delegate(IntPtr pen, out DashCap dashCap); private static FunctionWrapper<GdipGetPenDashCap197819_delegate> GdipGetPenDashCap197819_ptr; internal static Status GdipGetPenDashCap197819(IntPtr pen, out DashCap dashCap) => GdipGetPenDashCap197819_ptr.Delegate(pen, out dashCap); private delegate Status GdipSetPenDashStyle_delegate(IntPtr pen, DashStyle dashStyle); private static FunctionWrapper<GdipSetPenDashStyle_delegate> GdipSetPenDashStyle_ptr; internal static Status GdipSetPenDashStyle(IntPtr pen, DashStyle dashStyle) => GdipSetPenDashStyle_ptr.Delegate(pen, dashStyle); private delegate Status GdipGetPenDashStyle_delegate(IntPtr pen, out DashStyle dashStyle); private static FunctionWrapper<GdipGetPenDashStyle_delegate> GdipGetPenDashStyle_ptr; internal static Status GdipGetPenDashStyle(IntPtr pen, out DashStyle dashStyle) => GdipGetPenDashStyle_ptr.Delegate(pen, out dashStyle); private delegate Status GdipSetPenDashOffset_delegate(IntPtr pen, float offset); private static FunctionWrapper<GdipSetPenDashOffset_delegate> GdipSetPenDashOffset_ptr; internal static Status GdipSetPenDashOffset(IntPtr pen, float offset) => GdipSetPenDashOffset_ptr.Delegate(pen, offset); private delegate Status GdipGetPenDashOffset_delegate(IntPtr pen, out float offset); private static FunctionWrapper<GdipGetPenDashOffset_delegate> GdipGetPenDashOffset_ptr; internal static Status GdipGetPenDashOffset(IntPtr pen, out float offset) => GdipGetPenDashOffset_ptr.Delegate(pen, out offset); private delegate Status GdipGetPenDashCount_delegate(IntPtr pen, out int count); private static FunctionWrapper<GdipGetPenDashCount_delegate> GdipGetPenDashCount_ptr; internal static Status GdipGetPenDashCount(IntPtr pen, out int count) => GdipGetPenDashCount_ptr.Delegate(pen, out count); private delegate Status GdipSetPenDashArray_delegate(IntPtr pen, float[] dash, int count); private static FunctionWrapper<GdipSetPenDashArray_delegate> GdipSetPenDashArray_ptr; internal static Status GdipSetPenDashArray(IntPtr pen, float[] dash, int count) => GdipSetPenDashArray_ptr.Delegate(pen, dash, count); private delegate Status GdipGetPenDashArray_delegate(IntPtr pen, float[] dash, int count); private static FunctionWrapper<GdipGetPenDashArray_delegate> GdipGetPenDashArray_ptr; internal static Status GdipGetPenDashArray(IntPtr pen, float[] dash, int count) => GdipGetPenDashArray_ptr.Delegate(pen, dash, count); private delegate Status GdipSetPenMiterLimit_delegate(IntPtr pen, float miterLimit); private static FunctionWrapper<GdipSetPenMiterLimit_delegate> GdipSetPenMiterLimit_ptr; internal static Status GdipSetPenMiterLimit(IntPtr pen, float miterLimit) => GdipSetPenMiterLimit_ptr.Delegate(pen, miterLimit); private delegate Status GdipGetPenMiterLimit_delegate(IntPtr pen, out float miterLimit); private static FunctionWrapper<GdipGetPenMiterLimit_delegate> GdipGetPenMiterLimit_ptr; internal static Status GdipGetPenMiterLimit(IntPtr pen, out float miterLimit) => GdipGetPenMiterLimit_ptr.Delegate(pen, out miterLimit); private delegate Status GdipSetPenLineJoin_delegate(IntPtr pen, LineJoin lineJoin); private static FunctionWrapper<GdipSetPenLineJoin_delegate> GdipSetPenLineJoin_ptr; internal static Status GdipSetPenLineJoin(IntPtr pen, LineJoin lineJoin) => GdipSetPenLineJoin_ptr.Delegate(pen, lineJoin); private delegate Status GdipGetPenLineJoin_delegate(IntPtr pen, out LineJoin lineJoin); private static FunctionWrapper<GdipGetPenLineJoin_delegate> GdipGetPenLineJoin_ptr; internal static Status GdipGetPenLineJoin(IntPtr pen, out LineJoin lineJoin) => GdipGetPenLineJoin_ptr.Delegate(pen, out lineJoin); private delegate Status GdipSetPenLineCap197819_delegate(IntPtr pen, LineCap startCap, LineCap endCap, DashCap dashCap); private static FunctionWrapper<GdipSetPenLineCap197819_delegate> GdipSetPenLineCap197819_ptr; internal static Status GdipSetPenLineCap197819(IntPtr pen, LineCap startCap, LineCap endCap, DashCap dashCap) => GdipSetPenLineCap197819_ptr.Delegate(pen, startCap, endCap, dashCap); private delegate Status GdipSetPenMode_delegate(IntPtr pen, PenAlignment alignment); private static FunctionWrapper<GdipSetPenMode_delegate> GdipSetPenMode_ptr; internal static Status GdipSetPenMode(IntPtr pen, PenAlignment alignment) => GdipSetPenMode_ptr.Delegate(pen, alignment); private delegate Status GdipGetPenMode_delegate(IntPtr pen, out PenAlignment alignment); private static FunctionWrapper<GdipGetPenMode_delegate> GdipGetPenMode_ptr; internal static Status GdipGetPenMode(IntPtr pen, out PenAlignment alignment) => GdipGetPenMode_ptr.Delegate(pen, out alignment); private delegate Status GdipSetPenStartCap_delegate(IntPtr pen, LineCap startCap); private static FunctionWrapper<GdipSetPenStartCap_delegate> GdipSetPenStartCap_ptr; internal static Status GdipSetPenStartCap(IntPtr pen, LineCap startCap) => GdipSetPenStartCap_ptr.Delegate(pen, startCap); private delegate Status GdipGetPenStartCap_delegate(IntPtr pen, out LineCap startCap); private static FunctionWrapper<GdipGetPenStartCap_delegate> GdipGetPenStartCap_ptr; internal static Status GdipGetPenStartCap(IntPtr pen, out LineCap startCap) => GdipGetPenStartCap_ptr.Delegate(pen, out startCap); private delegate Status GdipSetPenEndCap_delegate(IntPtr pen, LineCap endCap); private static FunctionWrapper<GdipSetPenEndCap_delegate> GdipSetPenEndCap_ptr; internal static Status GdipSetPenEndCap(IntPtr pen, LineCap endCap) => GdipSetPenEndCap_ptr.Delegate(pen, endCap); private delegate Status GdipGetPenEndCap_delegate(IntPtr pen, out LineCap endCap); private static FunctionWrapper<GdipGetPenEndCap_delegate> GdipGetPenEndCap_ptr; internal static Status GdipGetPenEndCap(IntPtr pen, out LineCap endCap) => GdipGetPenEndCap_ptr.Delegate(pen, out endCap); private delegate Status GdipSetPenCustomStartCap_delegate(IntPtr pen, IntPtr customCap); private static FunctionWrapper<GdipSetPenCustomStartCap_delegate> GdipSetPenCustomStartCap_ptr; internal static Status GdipSetPenCustomStartCap(IntPtr pen, IntPtr customCap) => GdipSetPenCustomStartCap_ptr.Delegate(pen, customCap); private delegate Status GdipGetPenCustomStartCap_delegate(IntPtr pen, out IntPtr customCap); private static FunctionWrapper<GdipGetPenCustomStartCap_delegate> GdipGetPenCustomStartCap_ptr; internal static Status GdipGetPenCustomStartCap(IntPtr pen, out IntPtr customCap) => GdipGetPenCustomStartCap_ptr.Delegate(pen, out customCap); private delegate Status GdipSetPenCustomEndCap_delegate(IntPtr pen, IntPtr customCap); private static FunctionWrapper<GdipSetPenCustomEndCap_delegate> GdipSetPenCustomEndCap_ptr; internal static Status GdipSetPenCustomEndCap(IntPtr pen, IntPtr customCap) => GdipSetPenCustomEndCap_ptr.Delegate(pen, customCap); private delegate Status GdipGetPenCustomEndCap_delegate(IntPtr pen, out IntPtr customCap); private static FunctionWrapper<GdipGetPenCustomEndCap_delegate> GdipGetPenCustomEndCap_ptr; internal static Status GdipGetPenCustomEndCap(IntPtr pen, out IntPtr customCap) => GdipGetPenCustomEndCap_ptr.Delegate(pen, out customCap); private delegate Status GdipSetPenTransform_delegate(IntPtr pen, IntPtr matrix); private static FunctionWrapper<GdipSetPenTransform_delegate> GdipSetPenTransform_ptr; internal static Status GdipSetPenTransform(IntPtr pen, IntPtr matrix) => GdipSetPenTransform_ptr.Delegate(pen, matrix); private delegate Status GdipGetPenTransform_delegate(IntPtr pen, IntPtr matrix); private static FunctionWrapper<GdipGetPenTransform_delegate> GdipGetPenTransform_ptr; internal static Status GdipGetPenTransform(IntPtr pen, IntPtr matrix) => GdipGetPenTransform_ptr.Delegate(pen, matrix); private delegate Status GdipSetPenWidth_delegate(IntPtr pen, float width); private static FunctionWrapper<GdipSetPenWidth_delegate> GdipSetPenWidth_ptr; internal static Status GdipSetPenWidth(IntPtr pen, float width) => GdipSetPenWidth_ptr.Delegate(pen, width); private delegate Status GdipGetPenWidth_delegate(IntPtr pen, out float width); private static FunctionWrapper<GdipGetPenWidth_delegate> GdipGetPenWidth_ptr; internal static Status GdipGetPenWidth(IntPtr pen, out float width) => GdipGetPenWidth_ptr.Delegate(pen, out width); private delegate Status GdipResetPenTransform_delegate(IntPtr pen); private static FunctionWrapper<GdipResetPenTransform_delegate> GdipResetPenTransform_ptr; internal static Status GdipResetPenTransform(IntPtr pen) => GdipResetPenTransform_ptr.Delegate(pen); private delegate Status GdipMultiplyPenTransform_delegate(IntPtr pen, IntPtr matrix, MatrixOrder order); private static FunctionWrapper<GdipMultiplyPenTransform_delegate> GdipMultiplyPenTransform_ptr; internal static Status GdipMultiplyPenTransform(IntPtr pen, IntPtr matrix, MatrixOrder order) => GdipMultiplyPenTransform_ptr.Delegate(pen, matrix, order); private delegate Status GdipRotatePenTransform_delegate(IntPtr pen, float angle, MatrixOrder order); private static FunctionWrapper<GdipRotatePenTransform_delegate> GdipRotatePenTransform_ptr; internal static Status GdipRotatePenTransform(IntPtr pen, float angle, MatrixOrder order) => GdipRotatePenTransform_ptr.Delegate(pen, angle, order); private delegate Status GdipScalePenTransform_delegate(IntPtr pen, float sx, float sy, MatrixOrder order); private static FunctionWrapper<GdipScalePenTransform_delegate> GdipScalePenTransform_ptr; internal static Status GdipScalePenTransform(IntPtr pen, float sx, float sy, MatrixOrder order) => GdipScalePenTransform_ptr.Delegate(pen, sx, sy, order); private delegate Status GdipTranslatePenTransform_delegate(IntPtr pen, float dx, float dy, MatrixOrder order); private static FunctionWrapper<GdipTranslatePenTransform_delegate> GdipTranslatePenTransform_ptr; internal static Status GdipTranslatePenTransform(IntPtr pen, float dx, float dy, MatrixOrder order) => GdipTranslatePenTransform_ptr.Delegate(pen, dx, dy, order); private delegate Status GdipCreateFromHWND_delegate(IntPtr hwnd, out IntPtr graphics); private static FunctionWrapper<GdipCreateFromHWND_delegate> GdipCreateFromHWND_ptr; internal static Status GdipCreateFromHWND(IntPtr hwnd, out IntPtr graphics) => GdipCreateFromHWND_ptr.Delegate(hwnd, out graphics); private delegate Status GdipMeasureString_delegate(IntPtr graphics, [MarshalAs(UnmanagedType.LPWStr)]string str, int length, IntPtr font, ref RectangleF layoutRect, IntPtr stringFormat, out RectangleF boundingBox, int* codepointsFitted, int* linesFilled); private static FunctionWrapper<GdipMeasureString_delegate> GdipMeasureString_ptr; internal static Status GdipMeasureString(IntPtr graphics, string str, int length, IntPtr font, ref RectangleF layoutRect, IntPtr stringFormat, out RectangleF boundingBox, int* codepointsFitted, int* linesFilled) => GdipMeasureString_ptr.Delegate(graphics, str, length, font, ref layoutRect, stringFormat, out boundingBox, codepointsFitted, linesFilled); private delegate Status GdipMeasureCharacterRanges_delegate(IntPtr graphics, [MarshalAs(UnmanagedType.LPWStr)]string str, int length, IntPtr font, ref RectangleF layoutRect, IntPtr stringFormat, int regcount, out IntPtr regions); private static FunctionWrapper<GdipMeasureCharacterRanges_delegate> GdipMeasureCharacterRanges_ptr; internal static Status GdipMeasureCharacterRanges(IntPtr graphics, string str, int length, IntPtr font, ref RectangleF layoutRect, IntPtr stringFormat, int regcount, out IntPtr regions) => GdipMeasureCharacterRanges_ptr.Delegate(graphics, str, length, font, ref layoutRect, stringFormat, regcount, out regions); private delegate Status GdipSetStringFormatMeasurableCharacterRanges_delegate(IntPtr native, int cnt, CharacterRange[] range); private static FunctionWrapper<GdipSetStringFormatMeasurableCharacterRanges_delegate> GdipSetStringFormatMeasurableCharacterRanges_ptr; internal static Status GdipSetStringFormatMeasurableCharacterRanges(IntPtr native, int cnt, CharacterRange[] range) => GdipSetStringFormatMeasurableCharacterRanges_ptr.Delegate(native, cnt, range); private delegate Status GdipGetStringFormatMeasurableCharacterRangeCount_delegate(IntPtr native, out int cnt); private static FunctionWrapper<GdipGetStringFormatMeasurableCharacterRangeCount_delegate> GdipGetStringFormatMeasurableCharacterRangeCount_ptr; internal static Status GdipGetStringFormatMeasurableCharacterRangeCount(IntPtr native, out int cnt) => GdipGetStringFormatMeasurableCharacterRangeCount_ptr.Delegate(native, out cnt); private delegate Status GdipCreateBitmapFromScan0_delegate(int width, int height, int stride, PixelFormat format, IntPtr scan0, out IntPtr bmp); private static FunctionWrapper<GdipCreateBitmapFromScan0_delegate> GdipCreateBitmapFromScan0_ptr; internal static Status GdipCreateBitmapFromScan0(int width, int height, int stride, PixelFormat format, IntPtr scan0, out IntPtr bmp) => GdipCreateBitmapFromScan0_ptr.Delegate(width, height, stride, format, scan0, out bmp); private delegate Status GdipCreateBitmapFromGraphics_delegate(int width, int height, IntPtr target, out IntPtr bitmap); private static FunctionWrapper<GdipCreateBitmapFromGraphics_delegate> GdipCreateBitmapFromGraphics_ptr; internal static Status GdipCreateBitmapFromGraphics(int width, int height, IntPtr target, out IntPtr bitmap) => GdipCreateBitmapFromGraphics_ptr.Delegate(width, height, target, out bitmap); private delegate Status GdipBitmapLockBits_delegate(IntPtr bmp, ref Rectangle rc, ImageLockMode flags, PixelFormat format, [In] [Out] BitmapData bmpData); private static FunctionWrapper<GdipBitmapLockBits_delegate> GdipBitmapLockBits_ptr; internal static Status GdipBitmapLockBits(IntPtr bmp, ref Rectangle rc, ImageLockMode flags, PixelFormat format, [In] [Out] BitmapData bmpData) => GdipBitmapLockBits_ptr.Delegate(bmp, ref rc, flags, format, bmpData); private delegate Status GdipBitmapSetResolution_delegate(IntPtr bmp, float xdpi, float ydpi); private static FunctionWrapper<GdipBitmapSetResolution_delegate> GdipBitmapSetResolution_ptr; internal static Status GdipBitmapSetResolution(IntPtr bmp, float xdpi, float ydpi) => GdipBitmapSetResolution_ptr.Delegate(bmp, xdpi, ydpi); private delegate Status GdipBitmapUnlockBits_delegate(IntPtr bmp, [In] [Out] BitmapData bmpData); private static FunctionWrapper<GdipBitmapUnlockBits_delegate> GdipBitmapUnlockBits_ptr; internal static Status GdipBitmapUnlockBits(IntPtr bmp, [In] [Out] BitmapData bmpData) => GdipBitmapUnlockBits_ptr.Delegate(bmp, bmpData); private delegate Status GdipBitmapGetPixel_delegate(IntPtr bmp, int x, int y, out int argb); private static FunctionWrapper<GdipBitmapGetPixel_delegate> GdipBitmapGetPixel_ptr; internal static Status GdipBitmapGetPixel(IntPtr bmp, int x, int y, out int argb) => GdipBitmapGetPixel_ptr.Delegate(bmp, x, y, out argb); private delegate Status GdipBitmapSetPixel_delegate(IntPtr bmp, int x, int y, int argb); private static FunctionWrapper<GdipBitmapSetPixel_delegate> GdipBitmapSetPixel_ptr; internal static Status GdipBitmapSetPixel(IntPtr bmp, int x, int y, int argb) => GdipBitmapSetPixel_ptr.Delegate(bmp, x, y, argb); private delegate Status GdipLoadImageFromFile_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, out IntPtr image); private static FunctionWrapper<GdipLoadImageFromFile_delegate> GdipLoadImageFromFile_ptr; internal static Status GdipLoadImageFromFile(string filename, out IntPtr image) => GdipLoadImageFromFile_ptr.Delegate(filename, out image); private delegate Status GdipLoadImageFromStream_delegate([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ComIStreamMarshaler))]IStream stream, out IntPtr image); private static FunctionWrapper<GdipLoadImageFromStream_delegate> GdipLoadImageFromStream_ptr; internal static Status GdipLoadImageFromStream(IStream stream, out IntPtr image) => GdipLoadImageFromStream_ptr.Delegate(stream, out image); private delegate Status GdipSaveImageToStream_delegate(HandleRef image, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ComIStreamMarshaler))]IStream stream, ref Guid clsidEncoder, HandleRef encoderParams); private static FunctionWrapper<GdipSaveImageToStream_delegate> GdipSaveImageToStream_ptr; internal static Status GdipSaveImageToStream(HandleRef image, IStream stream, ref Guid clsidEncoder, HandleRef encoderParams) => GdipSaveImageToStream_ptr.Delegate(image, stream, ref clsidEncoder, encoderParams); private delegate Status GdipCloneImage_delegate(IntPtr image, out IntPtr imageclone); private static FunctionWrapper<GdipCloneImage_delegate> GdipCloneImage_ptr; internal static Status GdipCloneImage(IntPtr image, out IntPtr imageclone) => GdipCloneImage_ptr.Delegate(image, out imageclone); private delegate Status GdipLoadImageFromFileICM_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, out IntPtr image); private static FunctionWrapper<GdipLoadImageFromFileICM_delegate> GdipLoadImageFromFileICM_ptr; internal static Status GdipLoadImageFromFileICM(string filename, out IntPtr image) => GdipLoadImageFromFileICM_ptr.Delegate(filename, out image); private delegate Status GdipCreateBitmapFromHBITMAP_delegate(IntPtr hBitMap, IntPtr gdiPalette, out IntPtr image); private static FunctionWrapper<GdipCreateBitmapFromHBITMAP_delegate> GdipCreateBitmapFromHBITMAP_ptr; internal static Status GdipCreateBitmapFromHBITMAP(IntPtr hBitMap, IntPtr gdiPalette, out IntPtr image) => GdipCreateBitmapFromHBITMAP_ptr.Delegate(hBitMap, gdiPalette, out image); private delegate Status GdipDisposeImage_delegate(IntPtr image); private static FunctionWrapper<GdipDisposeImage_delegate> GdipDisposeImage_ptr; internal static Status GdipDisposeImage(IntPtr image) => GdipDisposeImage_ptr.Delegate(image); internal static int IntGdipDisposeImage(HandleRef image) => (int)GdipDisposeImage_ptr.Delegate(image.Handle); private delegate Status GdipGetImageFlags_delegate(IntPtr image, out int flag); private static FunctionWrapper<GdipGetImageFlags_delegate> GdipGetImageFlags_ptr; internal static Status GdipGetImageFlags(IntPtr image, out int flag) => GdipGetImageFlags_ptr.Delegate(image, out flag); private delegate Status GdipGetImageType_delegate(IntPtr image, out ImageType type); private static FunctionWrapper<GdipGetImageType_delegate> GdipGetImageType_ptr; internal static Status GdipGetImageType(IntPtr image, out ImageType type) => GdipGetImageType_ptr.Delegate(image, out type); private delegate Status GdipImageGetFrameDimensionsCount_delegate(IntPtr image, out uint count); private static FunctionWrapper<GdipImageGetFrameDimensionsCount_delegate> GdipImageGetFrameDimensionsCount_ptr; internal static Status GdipImageGetFrameDimensionsCount(IntPtr image, out uint count) => GdipImageGetFrameDimensionsCount_ptr.Delegate(image, out count); private delegate Status GdipImageGetFrameDimensionsList_delegate(IntPtr image, [Out] Guid[] dimensionIDs, uint count); private static FunctionWrapper<GdipImageGetFrameDimensionsList_delegate> GdipImageGetFrameDimensionsList_ptr; internal static Status GdipImageGetFrameDimensionsList(IntPtr image, [Out] Guid[] dimensionIDs, uint count) => GdipImageGetFrameDimensionsList_ptr.Delegate(image, dimensionIDs, count); private delegate Status GdipGetImageHeight_delegate(IntPtr image, out uint height); private static FunctionWrapper<GdipGetImageHeight_delegate> GdipGetImageHeight_ptr; internal static Status GdipGetImageHeight(IntPtr image, out uint height) => GdipGetImageHeight_ptr.Delegate(image, out height); private delegate Status GdipGetImageHorizontalResolution_delegate(IntPtr image, out float resolution); private static FunctionWrapper<GdipGetImageHorizontalResolution_delegate> GdipGetImageHorizontalResolution_ptr; internal static Status GdipGetImageHorizontalResolution(IntPtr image, out float resolution) => GdipGetImageHorizontalResolution_ptr.Delegate(image, out resolution); private delegate Status GdipGetImagePaletteSize_delegate(IntPtr image, out int size); private static FunctionWrapper<GdipGetImagePaletteSize_delegate> GdipGetImagePaletteSize_ptr; internal static Status GdipGetImagePaletteSize(IntPtr image, out int size) => GdipGetImagePaletteSize_ptr.Delegate(image, out size); private delegate Status GdipGetImagePalette_delegate(IntPtr image, IntPtr palette, int size); private static FunctionWrapper<GdipGetImagePalette_delegate> GdipGetImagePalette_ptr; internal static Status GdipGetImagePalette(IntPtr image, IntPtr palette, int size) => GdipGetImagePalette_ptr.Delegate(image, palette, size); private delegate Status GdipSetImagePalette_delegate(IntPtr image, IntPtr palette); private static FunctionWrapper<GdipSetImagePalette_delegate> GdipSetImagePalette_ptr; internal static Status GdipSetImagePalette(IntPtr image, IntPtr palette) => GdipSetImagePalette_ptr.Delegate(image, palette); private delegate Status GdipGetImageDimension_delegate(IntPtr image, out float width, out float height); private static FunctionWrapper<GdipGetImageDimension_delegate> GdipGetImageDimension_ptr; internal static Status GdipGetImageDimension(IntPtr image, out float width, out float height) => GdipGetImageDimension_ptr.Delegate(image, out width, out height); private delegate Status GdipGetImagePixelFormat_delegate(IntPtr image, out PixelFormat format); private static FunctionWrapper<GdipGetImagePixelFormat_delegate> GdipGetImagePixelFormat_ptr; internal static Status GdipGetImagePixelFormat(IntPtr image, out PixelFormat format) => GdipGetImagePixelFormat_ptr.Delegate(image, out format); private delegate Status GdipGetPropertyCount_delegate(IntPtr image, out uint propNumbers); private static FunctionWrapper<GdipGetPropertyCount_delegate> GdipGetPropertyCount_ptr; internal static Status GdipGetPropertyCount(IntPtr image, out uint propNumbers) => GdipGetPropertyCount_ptr.Delegate(image, out propNumbers); private delegate Status GdipGetPropertyIdList_delegate(IntPtr image, uint propNumbers, [Out] int[] list); private static FunctionWrapper<GdipGetPropertyIdList_delegate> GdipGetPropertyIdList_ptr; internal static Status GdipGetPropertyIdList(IntPtr image, uint propNumbers, [Out] int[] list) => GdipGetPropertyIdList_ptr.Delegate(image, propNumbers, list); private delegate Status GdipGetPropertySize_delegate(IntPtr image, out int bufferSize, out int propNumbers); private static FunctionWrapper<GdipGetPropertySize_delegate> GdipGetPropertySize_ptr; internal static Status GdipGetPropertySize(IntPtr image, out int bufferSize, out int propNumbers) => GdipGetPropertySize_ptr.Delegate(image, out bufferSize, out propNumbers); private delegate Status GdipGetAllPropertyItems_delegate(IntPtr image, int bufferSize, int propNumbers, IntPtr items); private static FunctionWrapper<GdipGetAllPropertyItems_delegate> GdipGetAllPropertyItems_ptr; internal static Status GdipGetAllPropertyItems(IntPtr image, int bufferSize, int propNumbers, IntPtr items) => GdipGetAllPropertyItems_ptr.Delegate(image, bufferSize, propNumbers, items); private delegate Status GdipGetImageRawFormat_delegate(IntPtr image, out Guid format); private static FunctionWrapper<GdipGetImageRawFormat_delegate> GdipGetImageRawFormat_ptr; internal static Status GdipGetImageRawFormat(IntPtr image, out Guid format) => GdipGetImageRawFormat_ptr.Delegate(image, out format); private delegate Status GdipGetImageVerticalResolution_delegate(IntPtr image, out float resolution); private static FunctionWrapper<GdipGetImageVerticalResolution_delegate> GdipGetImageVerticalResolution_ptr; internal static Status GdipGetImageVerticalResolution(IntPtr image, out float resolution) => GdipGetImageVerticalResolution_ptr.Delegate(image, out resolution); private delegate Status GdipGetImageWidth_delegate(IntPtr image, out uint width); private static FunctionWrapper<GdipGetImageWidth_delegate> GdipGetImageWidth_ptr; internal static Status GdipGetImageWidth(IntPtr image, out uint width) => GdipGetImageWidth_ptr.Delegate(image, out width); private delegate Status GdipGetImageBounds_delegate(IntPtr image, out RectangleF source, ref GraphicsUnit unit); private static FunctionWrapper<GdipGetImageBounds_delegate> GdipGetImageBounds_ptr; internal static Status GdipGetImageBounds(IntPtr image, out RectangleF source, ref GraphicsUnit unit) => GdipGetImageBounds_ptr.Delegate(image, out source, ref unit); private delegate Status GdipGetEncoderParameterListSize_delegate(IntPtr image, ref Guid encoder, out uint size); private static FunctionWrapper<GdipGetEncoderParameterListSize_delegate> GdipGetEncoderParameterListSize_ptr; internal static Status GdipGetEncoderParameterListSize(IntPtr image, ref Guid encoder, out uint size) => GdipGetEncoderParameterListSize_ptr.Delegate(image, ref encoder, out size); private delegate Status GdipGetEncoderParameterList_delegate(IntPtr image, ref Guid encoder, uint size, IntPtr buffer); private static FunctionWrapper<GdipGetEncoderParameterList_delegate> GdipGetEncoderParameterList_ptr; internal static Status GdipGetEncoderParameterList(IntPtr image, ref Guid encoder, uint size, IntPtr buffer) => GdipGetEncoderParameterList_ptr.Delegate(image, ref encoder, size, buffer); private delegate Status GdipImageGetFrameCount_delegate(IntPtr image, ref Guid guidDimension, out uint count); private static FunctionWrapper<GdipImageGetFrameCount_delegate> GdipImageGetFrameCount_ptr; internal static Status GdipImageGetFrameCount(IntPtr image, ref Guid guidDimension, out uint count) => GdipImageGetFrameCount_ptr.Delegate(image, ref guidDimension, out count); private delegate Status GdipImageSelectActiveFrame_delegate(IntPtr image, ref Guid guidDimension, int frameIndex); private static FunctionWrapper<GdipImageSelectActiveFrame_delegate> GdipImageSelectActiveFrame_ptr; internal static Status GdipImageSelectActiveFrame(IntPtr image, ref Guid guidDimension, int frameIndex) => GdipImageSelectActiveFrame_ptr.Delegate(image, ref guidDimension, frameIndex); private delegate Status GdipGetPropertyItemSize_delegate(IntPtr image, int propertyID, out int propertySize); private static FunctionWrapper<GdipGetPropertyItemSize_delegate> GdipGetPropertyItemSize_ptr; internal static Status GdipGetPropertyItemSize(IntPtr image, int propertyID, out int propertySize) => GdipGetPropertyItemSize_ptr.Delegate(image, propertyID, out propertySize); private delegate Status GdipGetPropertyItem_delegate(IntPtr image, int propertyID, int propertySize, IntPtr buffer); private static FunctionWrapper<GdipGetPropertyItem_delegate> GdipGetPropertyItem_ptr; internal static Status GdipGetPropertyItem(IntPtr image, int propertyID, int propertySize, IntPtr buffer) => GdipGetPropertyItem_ptr.Delegate(image, propertyID, propertySize, buffer); private delegate Status GdipRemovePropertyItem_delegate(IntPtr image, int propertyId); private static FunctionWrapper<GdipRemovePropertyItem_delegate> GdipRemovePropertyItem_ptr; internal static Status GdipRemovePropertyItem(IntPtr image, int propertyId) => GdipRemovePropertyItem_ptr.Delegate(image, propertyId); private delegate Status GdipSetPropertyItem_delegate(IntPtr image, GdipPropertyItem* propertyItem); private static FunctionWrapper<GdipSetPropertyItem_delegate> GdipSetPropertyItem_ptr; internal static Status GdipSetPropertyItem(IntPtr image, GdipPropertyItem* propertyItem) => GdipSetPropertyItem_ptr.Delegate(image, propertyItem); private delegate Status GdipGetImageThumbnail_delegate(IntPtr image, uint width, uint height, out IntPtr thumbImage, IntPtr callback, IntPtr callBackData); private static FunctionWrapper<GdipGetImageThumbnail_delegate> GdipGetImageThumbnail_ptr; internal static Status GdipGetImageThumbnail(IntPtr image, uint width, uint height, out IntPtr thumbImage, IntPtr callback, IntPtr callBackData) => GdipGetImageThumbnail_ptr.Delegate(image, width, height, out thumbImage, callback, callBackData); private delegate Status GdipImageRotateFlip_delegate(IntPtr image, RotateFlipType rotateFlipType); private static FunctionWrapper<GdipImageRotateFlip_delegate> GdipImageRotateFlip_ptr; internal static Status GdipImageRotateFlip(IntPtr image, RotateFlipType rotateFlipType) => GdipImageRotateFlip_ptr.Delegate(image, rotateFlipType); private delegate Status GdipSaveImageToFile_delegate(IntPtr image, [MarshalAs(UnmanagedType.LPWStr)]string filename, ref Guid encoderClsID, IntPtr encoderParameters); private static FunctionWrapper<GdipSaveImageToFile_delegate> GdipSaveImageToFile_ptr; internal static Status GdipSaveImageToFile(IntPtr image, string filename, ref Guid encoderClsID, IntPtr encoderParameters) => GdipSaveImageToFile_ptr.Delegate(image, filename, ref encoderClsID, encoderParameters); private delegate Status GdipSaveAdd_delegate(IntPtr image, IntPtr encoderParameters); private static FunctionWrapper<GdipSaveAdd_delegate> GdipSaveAdd_ptr; internal static Status GdipSaveAdd(IntPtr image, IntPtr encoderParameters) => GdipSaveAdd_ptr.Delegate(image, encoderParameters); private delegate Status GdipSaveAddImage_delegate(IntPtr image, IntPtr imagenew, IntPtr encoderParameters); private static FunctionWrapper<GdipSaveAddImage_delegate> GdipSaveAddImage_ptr; internal static Status GdipSaveAddImage(IntPtr image, IntPtr imagenew, IntPtr encoderParameters) => GdipSaveAddImage_ptr.Delegate(image, imagenew, encoderParameters); private delegate Status GdipDrawImageI_delegate(IntPtr graphics, IntPtr image, int x, int y); private static FunctionWrapper<GdipDrawImageI_delegate> GdipDrawImageI_ptr; internal static Status GdipDrawImageI(IntPtr graphics, IntPtr image, int x, int y) => GdipDrawImageI_ptr.Delegate(graphics, image, x, y); private delegate Status GdipGetImageGraphicsContext_delegate(IntPtr image, out IntPtr graphics); private static FunctionWrapper<GdipGetImageGraphicsContext_delegate> GdipGetImageGraphicsContext_ptr; internal static Status GdipGetImageGraphicsContext(IntPtr image, out IntPtr graphics) => GdipGetImageGraphicsContext_ptr.Delegate(image, out graphics); private delegate Status GdipDrawImage_delegate(IntPtr graphics, IntPtr image, float x, float y); private static FunctionWrapper<GdipDrawImage_delegate> GdipDrawImage_ptr; internal static Status GdipDrawImage(IntPtr graphics, IntPtr image, float x, float y) => GdipDrawImage_ptr.Delegate(graphics, image, x, y); private delegate Status GdipBeginContainer_delegate(IntPtr graphics, ref RectangleF dstrect, ref RectangleF srcrect, GraphicsUnit unit, out uint state); private static FunctionWrapper<GdipBeginContainer_delegate> GdipBeginContainer_ptr; internal static Status GdipBeginContainer(IntPtr graphics, ref RectangleF dstrect, ref RectangleF srcrect, GraphicsUnit unit, out uint state) => GdipBeginContainer_ptr.Delegate(graphics, ref dstrect, ref srcrect, unit, out state); private delegate Status GdipBeginContainerI_delegate(IntPtr graphics, ref Rectangle dstrect, ref Rectangle srcrect, GraphicsUnit unit, out uint state); private static FunctionWrapper<GdipBeginContainerI_delegate> GdipBeginContainerI_ptr; internal static Status GdipBeginContainerI(IntPtr graphics, ref Rectangle dstrect, ref Rectangle srcrect, GraphicsUnit unit, out uint state) => GdipBeginContainerI_ptr.Delegate(graphics, ref dstrect, ref srcrect, unit, out state); private delegate Status GdipBeginContainer2_delegate(IntPtr graphics, out uint state); private static FunctionWrapper<GdipBeginContainer2_delegate> GdipBeginContainer2_ptr; internal static Status GdipBeginContainer2(IntPtr graphics, out uint state) => GdipBeginContainer2_ptr.Delegate(graphics, out state); private delegate Status GdipDrawImagePoints_delegate(IntPtr graphics, IntPtr image, PointF[] destPoints, int count); private static FunctionWrapper<GdipDrawImagePoints_delegate> GdipDrawImagePoints_ptr; internal static Status GdipDrawImagePoints(IntPtr graphics, IntPtr image, PointF[] destPoints, int count) => GdipDrawImagePoints_ptr.Delegate(graphics, image, destPoints, count); private delegate Status GdipDrawImagePointsI_delegate(IntPtr graphics, IntPtr image, Point[] destPoints, int count); private static FunctionWrapper<GdipDrawImagePointsI_delegate> GdipDrawImagePointsI_ptr; internal static Status GdipDrawImagePointsI(IntPtr graphics, IntPtr image, Point[] destPoints, int count) => GdipDrawImagePointsI_ptr.Delegate(graphics, image, destPoints, count); private delegate Status GdipDrawImageRectRectI_delegate(IntPtr graphics, IntPtr image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData); private static FunctionWrapper<GdipDrawImageRectRectI_delegate> GdipDrawImageRectRectI_ptr; internal static Status GdipDrawImageRectRectI(IntPtr graphics, IntPtr image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData) => GdipDrawImageRectRectI_ptr.Delegate(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageattr, callback, callbackData); private delegate Status GdipDrawImageRectRect_delegate(IntPtr graphics, IntPtr image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData); private static FunctionWrapper<GdipDrawImageRectRect_delegate> GdipDrawImageRectRect_ptr; internal static Status GdipDrawImageRectRect(IntPtr graphics, IntPtr image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData) => GdipDrawImageRectRect_ptr.Delegate(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageattr, callback, callbackData); private delegate Status GdipDrawImagePointsRectI_delegate(IntPtr graphics, IntPtr image, Point[] destPoints, int count, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData); private static FunctionWrapper<GdipDrawImagePointsRectI_delegate> GdipDrawImagePointsRectI_ptr; internal static Status GdipDrawImagePointsRectI(IntPtr graphics, IntPtr image, Point[] destPoints, int count, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData) => GdipDrawImagePointsRectI_ptr.Delegate(graphics, image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageattr, callback, callbackData); private delegate Status GdipDrawImagePointsRect_delegate(IntPtr graphics, IntPtr image, PointF[] destPoints, int count, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData); private static FunctionWrapper<GdipDrawImagePointsRect_delegate> GdipDrawImagePointsRect_ptr; internal static Status GdipDrawImagePointsRect(IntPtr graphics, IntPtr image, PointF[] destPoints, int count, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData) => GdipDrawImagePointsRect_ptr.Delegate(graphics, image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageattr, callback, callbackData); private delegate Status GdipDrawImageRect_delegate(IntPtr graphics, IntPtr image, float x, float y, float width, float height); private static FunctionWrapper<GdipDrawImageRect_delegate> GdipDrawImageRect_ptr; internal static Status GdipDrawImageRect(IntPtr graphics, IntPtr image, float x, float y, float width, float height) => GdipDrawImageRect_ptr.Delegate(graphics, image, x, y, width, height); private delegate Status GdipDrawImagePointRect_delegate(IntPtr graphics, IntPtr image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit); private static FunctionWrapper<GdipDrawImagePointRect_delegate> GdipDrawImagePointRect_ptr; internal static Status GdipDrawImagePointRect(IntPtr graphics, IntPtr image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit) => GdipDrawImagePointRect_ptr.Delegate(graphics, image, x, y, srcx, srcy, srcwidth, srcheight, srcUnit); private delegate Status GdipDrawImagePointRectI_delegate(IntPtr graphics, IntPtr image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit); private static FunctionWrapper<GdipDrawImagePointRectI_delegate> GdipDrawImagePointRectI_ptr; internal static Status GdipDrawImagePointRectI(IntPtr graphics, IntPtr image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit) => GdipDrawImagePointRectI_ptr.Delegate(graphics, image, x, y, srcx, srcy, srcwidth, srcheight, srcUnit); private delegate Status GdipCreateStringFormat_delegate(StringFormatFlags formatAttributes, int language, out IntPtr native); private static FunctionWrapper<GdipCreateStringFormat_delegate> GdipCreateStringFormat_ptr; internal static Status GdipCreateStringFormat(StringFormatFlags formatAttributes, int language, out IntPtr native) => GdipCreateStringFormat_ptr.Delegate(formatAttributes, language, out native); private delegate Status GdipCreateHBITMAPFromBitmap_delegate(IntPtr bmp, out IntPtr HandleBmp, int clrbackground); private static FunctionWrapper<GdipCreateHBITMAPFromBitmap_delegate> GdipCreateHBITMAPFromBitmap_ptr; internal static Status GdipCreateHBITMAPFromBitmap(IntPtr bmp, out IntPtr HandleBmp, int clrbackground) => GdipCreateHBITMAPFromBitmap_ptr.Delegate(bmp, out HandleBmp, clrbackground); private delegate Status GdipCreateBitmapFromFile_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, out IntPtr bitmap); private static FunctionWrapper<GdipCreateBitmapFromFile_delegate> GdipCreateBitmapFromFile_ptr; internal static Status GdipCreateBitmapFromFile(string filename, out IntPtr bitmap) => GdipCreateBitmapFromFile_ptr.Delegate(filename, out bitmap); private delegate Status GdipCreateBitmapFromFileICM_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, out IntPtr bitmap); private static FunctionWrapper<GdipCreateBitmapFromFileICM_delegate> GdipCreateBitmapFromFileICM_ptr; internal static Status GdipCreateBitmapFromFileICM(string filename, out IntPtr bitmap) => GdipCreateBitmapFromFileICM_ptr.Delegate(filename, out bitmap); private delegate Status GdipCreateHICONFromBitmap_delegate(IntPtr bmp, out IntPtr HandleIcon); private static FunctionWrapper<GdipCreateHICONFromBitmap_delegate> GdipCreateHICONFromBitmap_ptr; internal static Status GdipCreateHICONFromBitmap(IntPtr bmp, out IntPtr HandleIcon) => GdipCreateHICONFromBitmap_ptr.Delegate(bmp, out HandleIcon); private delegate Status GdipCreateBitmapFromHICON_delegate(IntPtr hicon, out IntPtr bitmap); private static FunctionWrapper<GdipCreateBitmapFromHICON_delegate> GdipCreateBitmapFromHICON_ptr; internal static Status GdipCreateBitmapFromHICON(IntPtr hicon, out IntPtr bitmap) => GdipCreateBitmapFromHICON_ptr.Delegate(hicon, out bitmap); private delegate Status GdipCreateBitmapFromResource_delegate(IntPtr hInstance, [MarshalAs(UnmanagedType.LPWStr)]string lpBitmapName, out IntPtr bitmap); private static FunctionWrapper<GdipCreateBitmapFromResource_delegate> GdipCreateBitmapFromResource_ptr; internal static Status GdipCreateBitmapFromResource(IntPtr hInstance, string lpBitmapName, out IntPtr bitmap) => GdipCreateBitmapFromResource_ptr.Delegate(hInstance, lpBitmapName, out bitmap); private delegate Status GdipCreateMatrix_delegate(out IntPtr matrix); private static FunctionWrapper<GdipCreateMatrix_delegate> GdipCreateMatrix_ptr; internal static Status GdipCreateMatrix(out IntPtr matrix) => GdipCreateMatrix_ptr.Delegate(out matrix); private delegate Status GdipCreateMatrix2_delegate(float m11, float m12, float m21, float m22, float dx, float dy, out IntPtr matrix); private static FunctionWrapper<GdipCreateMatrix2_delegate> GdipCreateMatrix2_ptr; internal static Status GdipCreateMatrix2(float m11, float m12, float m21, float m22, float dx, float dy, out IntPtr matrix) => GdipCreateMatrix2_ptr.Delegate(m11, m12, m21, m22, dx, dy, out matrix); private delegate Status GdipCreateMatrix3_delegate(ref RectangleF rect, PointF[] dstplg, out IntPtr matrix); private static FunctionWrapper<GdipCreateMatrix3_delegate> GdipCreateMatrix3_ptr; internal static Status GdipCreateMatrix3(ref RectangleF rect, PointF[] dstplg, out IntPtr matrix) => GdipCreateMatrix3_ptr.Delegate(ref rect, dstplg, out matrix); private delegate Status GdipCreateMatrix3I_delegate(ref Rectangle rect, Point[] dstplg, out IntPtr matrix); private static FunctionWrapper<GdipCreateMatrix3I_delegate> GdipCreateMatrix3I_ptr; internal static Status GdipCreateMatrix3I(ref Rectangle rect, Point[] dstplg, out IntPtr matrix) => GdipCreateMatrix3I_ptr.Delegate(ref rect, dstplg, out matrix); private delegate Status GdipDeleteMatrix_delegate(IntPtr matrix); private static FunctionWrapper<GdipDeleteMatrix_delegate> GdipDeleteMatrix_ptr; internal static Status GdipDeleteMatrix(IntPtr matrix) => GdipDeleteMatrix_ptr.Delegate(matrix); internal static int IntGdipDeleteMatrix(HandleRef matrix) => (int)GdipDeleteMatrix_ptr.Delegate(matrix.Handle); private delegate Status GdipCloneMatrix_delegate(IntPtr matrix, out IntPtr cloneMatrix); private static FunctionWrapper<GdipCloneMatrix_delegate> GdipCloneMatrix_ptr; internal static Status GdipCloneMatrix(IntPtr matrix, out IntPtr cloneMatrix) => GdipCloneMatrix_ptr.Delegate(matrix, out cloneMatrix); private delegate Status GdipSetMatrixElements_delegate(IntPtr matrix, float m11, float m12, float m21, float m22, float dx, float dy); private static FunctionWrapper<GdipSetMatrixElements_delegate> GdipSetMatrixElements_ptr; internal static Status GdipSetMatrixElements(IntPtr matrix, float m11, float m12, float m21, float m22, float dx, float dy) => GdipSetMatrixElements_ptr.Delegate(matrix, m11, m12, m21, m22, dx, dy); private delegate Status GdipGetMatrixElements_delegate(IntPtr matrix, IntPtr matrixOut); private static FunctionWrapper<GdipGetMatrixElements_delegate> GdipGetMatrixElements_ptr; internal static Status GdipGetMatrixElements(IntPtr matrix, IntPtr matrixOut) => GdipGetMatrixElements_ptr.Delegate(matrix, matrixOut); private delegate Status GdipMultiplyMatrix_delegate(IntPtr matrix, IntPtr matrix2, MatrixOrder order); private static FunctionWrapper<GdipMultiplyMatrix_delegate> GdipMultiplyMatrix_ptr; internal static Status GdipMultiplyMatrix(IntPtr matrix, IntPtr matrix2, MatrixOrder order) => GdipMultiplyMatrix_ptr.Delegate(matrix, matrix2, order); private delegate Status GdipTranslateMatrix_delegate(IntPtr matrix, float offsetX, float offsetY, MatrixOrder order); private static FunctionWrapper<GdipTranslateMatrix_delegate> GdipTranslateMatrix_ptr; internal static Status GdipTranslateMatrix(IntPtr matrix, float offsetX, float offsetY, MatrixOrder order) => GdipTranslateMatrix_ptr.Delegate(matrix, offsetX, offsetY, order); private delegate Status GdipScaleMatrix_delegate(IntPtr matrix, float scaleX, float scaleY, MatrixOrder order); private static FunctionWrapper<GdipScaleMatrix_delegate> GdipScaleMatrix_ptr; internal static Status GdipScaleMatrix(IntPtr matrix, float scaleX, float scaleY, MatrixOrder order) => GdipScaleMatrix_ptr.Delegate(matrix, scaleX, scaleY, order); private delegate Status GdipRotateMatrix_delegate(IntPtr matrix, float angle, MatrixOrder order); private static FunctionWrapper<GdipRotateMatrix_delegate> GdipRotateMatrix_ptr; internal static Status GdipRotateMatrix(IntPtr matrix, float angle, MatrixOrder order) => GdipRotateMatrix_ptr.Delegate(matrix, angle, order); private delegate Status GdipShearMatrix_delegate(IntPtr matrix, float shearX, float shearY, MatrixOrder order); private static FunctionWrapper<GdipShearMatrix_delegate> GdipShearMatrix_ptr; internal static Status GdipShearMatrix(IntPtr matrix, float shearX, float shearY, MatrixOrder order) => GdipShearMatrix_ptr.Delegate(matrix, shearX, shearY, order); private delegate Status GdipInvertMatrix_delegate(IntPtr matrix); private static FunctionWrapper<GdipInvertMatrix_delegate> GdipInvertMatrix_ptr; internal static Status GdipInvertMatrix(IntPtr matrix) => GdipInvertMatrix_ptr.Delegate(matrix); private delegate Status GdipTransformMatrixPoints_delegate(IntPtr matrix, [In] [Out] PointF[] pts, int count); private static FunctionWrapper<GdipTransformMatrixPoints_delegate> GdipTransformMatrixPoints_ptr; internal static Status GdipTransformMatrixPoints(IntPtr matrix, [In] [Out] PointF[] pts, int count) => GdipTransformMatrixPoints_ptr.Delegate(matrix, pts, count); private delegate Status GdipTransformMatrixPointsI_delegate(IntPtr matrix, [In] [Out] Point[] pts, int count); private static FunctionWrapper<GdipTransformMatrixPointsI_delegate> GdipTransformMatrixPointsI_ptr; internal static Status GdipTransformMatrixPointsI(IntPtr matrix, [In] [Out] Point[] pts, int count) => GdipTransformMatrixPointsI_ptr.Delegate(matrix, pts, count); private delegate Status GdipVectorTransformMatrixPoints_delegate(IntPtr matrix, [In] [Out] PointF[] pts, int count); private static FunctionWrapper<GdipVectorTransformMatrixPoints_delegate> GdipVectorTransformMatrixPoints_ptr; internal static Status GdipVectorTransformMatrixPoints(IntPtr matrix, [In] [Out] PointF[] pts, int count) => GdipVectorTransformMatrixPoints_ptr.Delegate(matrix, pts, count); private delegate Status GdipVectorTransformMatrixPointsI_delegate(IntPtr matrix, [In] [Out] Point[] pts, int count); private static FunctionWrapper<GdipVectorTransformMatrixPointsI_delegate> GdipVectorTransformMatrixPointsI_ptr; internal static Status GdipVectorTransformMatrixPointsI(IntPtr matrix, [In] [Out] Point[] pts, int count) => GdipVectorTransformMatrixPointsI_ptr.Delegate(matrix, pts, count); private delegate Status GdipIsMatrixInvertible_delegate(IntPtr matrix, out bool result); private static FunctionWrapper<GdipIsMatrixInvertible_delegate> GdipIsMatrixInvertible_ptr; internal static Status GdipIsMatrixInvertible(IntPtr matrix, out bool result) => GdipIsMatrixInvertible_ptr.Delegate(matrix, out result); private delegate Status GdipIsMatrixIdentity_delegate(IntPtr matrix, out bool result); private static FunctionWrapper<GdipIsMatrixIdentity_delegate> GdipIsMatrixIdentity_ptr; internal static Status GdipIsMatrixIdentity(IntPtr matrix, out bool result) => GdipIsMatrixIdentity_ptr.Delegate(matrix, out result); private delegate Status GdipIsMatrixEqual_delegate(IntPtr matrix, IntPtr matrix2, out bool result); private static FunctionWrapper<GdipIsMatrixEqual_delegate> GdipIsMatrixEqual_ptr; internal static Status GdipIsMatrixEqual(IntPtr matrix, IntPtr matrix2, out bool result) => GdipIsMatrixEqual_ptr.Delegate(matrix, matrix2, out result); private delegate Status GdipCreatePath_delegate(FillMode brushMode, out IntPtr path); private static FunctionWrapper<GdipCreatePath_delegate> GdipCreatePath_ptr; internal static Status GdipCreatePath(FillMode brushMode, out IntPtr path) => GdipCreatePath_ptr.Delegate(brushMode, out path); private delegate Status GdipCreatePath2_delegate(PointF[] points, byte[] types, int count, FillMode brushMode, out IntPtr path); private static FunctionWrapper<GdipCreatePath2_delegate> GdipCreatePath2_ptr; internal static Status GdipCreatePath2(PointF[] points, byte[] types, int count, FillMode brushMode, out IntPtr path) => GdipCreatePath2_ptr.Delegate(points, types, count, brushMode, out path); private delegate Status GdipCreatePath2I_delegate(Point[] points, byte[] types, int count, FillMode brushMode, out IntPtr path); private static FunctionWrapper<GdipCreatePath2I_delegate> GdipCreatePath2I_ptr; internal static Status GdipCreatePath2I(Point[] points, byte[] types, int count, FillMode brushMode, out IntPtr path) => GdipCreatePath2I_ptr.Delegate(points, types, count, brushMode, out path); private delegate Status GdipClonePath_delegate(IntPtr path, out IntPtr clonePath); private static FunctionWrapper<GdipClonePath_delegate> GdipClonePath_ptr; internal static Status GdipClonePath(IntPtr path, out IntPtr clonePath) => GdipClonePath_ptr.Delegate(path, out clonePath); private delegate Status GdipDeletePath_delegate(IntPtr path); private static FunctionWrapper<GdipDeletePath_delegate> GdipDeletePath_ptr; internal static Status GdipDeletePath(IntPtr path) => GdipDeletePath_ptr.Delegate(path); internal static int IntGdipDeletePath(HandleRef path) => (int)GdipDeletePath_ptr.Delegate(path.Handle); private delegate Status GdipResetPath_delegate(IntPtr path); private static FunctionWrapper<GdipResetPath_delegate> GdipResetPath_ptr; internal static Status GdipResetPath(IntPtr path) => GdipResetPath_ptr.Delegate(path); private delegate Status GdipGetPointCount_delegate(IntPtr path, out int count); private static FunctionWrapper<GdipGetPointCount_delegate> GdipGetPointCount_ptr; internal static Status GdipGetPointCount(IntPtr path, out int count) => GdipGetPointCount_ptr.Delegate(path, out count); private delegate Status GdipGetPathTypes_delegate(IntPtr path, [Out] byte[] types, int count); private static FunctionWrapper<GdipGetPathTypes_delegate> GdipGetPathTypes_ptr; internal static Status GdipGetPathTypes(IntPtr path, [Out] byte[] types, int count) => GdipGetPathTypes_ptr.Delegate(path, types, count); private delegate Status GdipGetPathPoints_delegate(IntPtr path, [Out] PointF[] points, int count); private static FunctionWrapper<GdipGetPathPoints_delegate> GdipGetPathPoints_ptr; internal static Status GdipGetPathPoints(IntPtr path, [Out] PointF[] points, int count) => GdipGetPathPoints_ptr.Delegate(path, points, count); private delegate Status GdipGetPathPointsI_delegate(IntPtr path, [Out] Point[] points, int count); private static FunctionWrapper<GdipGetPathPointsI_delegate> GdipGetPathPointsI_ptr; internal static Status GdipGetPathPointsI(IntPtr path, [Out] Point[] points, int count) => GdipGetPathPointsI_ptr.Delegate(path, points, count); private delegate Status GdipGetPathFillMode_delegate(IntPtr path, out FillMode fillMode); private static FunctionWrapper<GdipGetPathFillMode_delegate> GdipGetPathFillMode_ptr; internal static Status GdipGetPathFillMode(IntPtr path, out FillMode fillMode) => GdipGetPathFillMode_ptr.Delegate(path, out fillMode); private delegate Status GdipSetPathFillMode_delegate(IntPtr path, FillMode fillMode); private static FunctionWrapper<GdipSetPathFillMode_delegate> GdipSetPathFillMode_ptr; internal static Status GdipSetPathFillMode(IntPtr path, FillMode fillMode) => GdipSetPathFillMode_ptr.Delegate(path, fillMode); private delegate Status GdipStartPathFigure_delegate(IntPtr path); private static FunctionWrapper<GdipStartPathFigure_delegate> GdipStartPathFigure_ptr; internal static Status GdipStartPathFigure(IntPtr path) => GdipStartPathFigure_ptr.Delegate(path); private delegate Status GdipClosePathFigure_delegate(IntPtr path); private static FunctionWrapper<GdipClosePathFigure_delegate> GdipClosePathFigure_ptr; internal static Status GdipClosePathFigure(IntPtr path) => GdipClosePathFigure_ptr.Delegate(path); private delegate Status GdipClosePathFigures_delegate(IntPtr path); private static FunctionWrapper<GdipClosePathFigures_delegate> GdipClosePathFigures_ptr; internal static Status GdipClosePathFigures(IntPtr path) => GdipClosePathFigures_ptr.Delegate(path); private delegate Status GdipSetPathMarker_delegate(IntPtr path); private static FunctionWrapper<GdipSetPathMarker_delegate> GdipSetPathMarker_ptr; internal static Status GdipSetPathMarker(IntPtr path) => GdipSetPathMarker_ptr.Delegate(path); private delegate Status GdipClearPathMarkers_delegate(IntPtr path); private static FunctionWrapper<GdipClearPathMarkers_delegate> GdipClearPathMarkers_ptr; internal static Status GdipClearPathMarkers(IntPtr path) => GdipClearPathMarkers_ptr.Delegate(path); private delegate Status GdipReversePath_delegate(IntPtr path); private static FunctionWrapper<GdipReversePath_delegate> GdipReversePath_ptr; internal static Status GdipReversePath(IntPtr path) => GdipReversePath_ptr.Delegate(path); private delegate Status GdipGetPathLastPoint_delegate(IntPtr path, out PointF lastPoint); private static FunctionWrapper<GdipGetPathLastPoint_delegate> GdipGetPathLastPoint_ptr; internal static Status GdipGetPathLastPoint(IntPtr path, out PointF lastPoint) => GdipGetPathLastPoint_ptr.Delegate(path, out lastPoint); private delegate Status GdipAddPathLine_delegate(IntPtr path, float x1, float y1, float x2, float y2); private static FunctionWrapper<GdipAddPathLine_delegate> GdipAddPathLine_ptr; internal static Status GdipAddPathLine(IntPtr path, float x1, float y1, float x2, float y2) => GdipAddPathLine_ptr.Delegate(path, x1, y1, x2, y2); private delegate Status GdipAddPathLine2_delegate(IntPtr path, PointF[] points, int count); private static FunctionWrapper<GdipAddPathLine2_delegate> GdipAddPathLine2_ptr; internal static Status GdipAddPathLine2(IntPtr path, PointF[] points, int count) => GdipAddPathLine2_ptr.Delegate(path, points, count); private delegate Status GdipAddPathLine2I_delegate(IntPtr path, Point[] points, int count); private static FunctionWrapper<GdipAddPathLine2I_delegate> GdipAddPathLine2I_ptr; internal static Status GdipAddPathLine2I(IntPtr path, Point[] points, int count) => GdipAddPathLine2I_ptr.Delegate(path, points, count); private delegate Status GdipAddPathArc_delegate(IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipAddPathArc_delegate> GdipAddPathArc_ptr; internal static Status GdipAddPathArc(IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle) => GdipAddPathArc_ptr.Delegate(path, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipAddPathBezier_delegate(IntPtr path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4); private static FunctionWrapper<GdipAddPathBezier_delegate> GdipAddPathBezier_ptr; internal static Status GdipAddPathBezier(IntPtr path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) => GdipAddPathBezier_ptr.Delegate(path, x1, y1, x2, y2, x3, y3, x4, y4); private delegate Status GdipAddPathBeziers_delegate(IntPtr path, PointF[] points, int count); private static FunctionWrapper<GdipAddPathBeziers_delegate> GdipAddPathBeziers_ptr; internal static Status GdipAddPathBeziers(IntPtr path, PointF[] points, int count) => GdipAddPathBeziers_ptr.Delegate(path, points, count); private delegate Status GdipAddPathCurve_delegate(IntPtr path, PointF[] points, int count); private static FunctionWrapper<GdipAddPathCurve_delegate> GdipAddPathCurve_ptr; internal static Status GdipAddPathCurve(IntPtr path, PointF[] points, int count) => GdipAddPathCurve_ptr.Delegate(path, points, count); private delegate Status GdipAddPathCurveI_delegate(IntPtr path, Point[] points, int count); private static FunctionWrapper<GdipAddPathCurveI_delegate> GdipAddPathCurveI_ptr; internal static Status GdipAddPathCurveI(IntPtr path, Point[] points, int count) => GdipAddPathCurveI_ptr.Delegate(path, points, count); private delegate Status GdipAddPathCurve2_delegate(IntPtr path, PointF[] points, int count, float tension); private static FunctionWrapper<GdipAddPathCurve2_delegate> GdipAddPathCurve2_ptr; internal static Status GdipAddPathCurve2(IntPtr path, PointF[] points, int count, float tension) => GdipAddPathCurve2_ptr.Delegate(path, points, count, tension); private delegate Status GdipAddPathCurve2I_delegate(IntPtr path, Point[] points, int count, float tension); private static FunctionWrapper<GdipAddPathCurve2I_delegate> GdipAddPathCurve2I_ptr; internal static Status GdipAddPathCurve2I(IntPtr path, Point[] points, int count, float tension) => GdipAddPathCurve2I_ptr.Delegate(path, points, count, tension); private delegate Status GdipAddPathCurve3_delegate(IntPtr path, PointF[] points, int count, int offset, int numberOfSegments, float tension); private static FunctionWrapper<GdipAddPathCurve3_delegate> GdipAddPathCurve3_ptr; internal static Status GdipAddPathCurve3(IntPtr path, PointF[] points, int count, int offset, int numberOfSegments, float tension) => GdipAddPathCurve3_ptr.Delegate(path, points, count, offset, numberOfSegments, tension); private delegate Status GdipAddPathCurve3I_delegate(IntPtr path, Point[] points, int count, int offset, int numberOfSegments, float tension); private static FunctionWrapper<GdipAddPathCurve3I_delegate> GdipAddPathCurve3I_ptr; internal static Status GdipAddPathCurve3I(IntPtr path, Point[] points, int count, int offset, int numberOfSegments, float tension) => GdipAddPathCurve3I_ptr.Delegate(path, points, count, offset, numberOfSegments, tension); private delegate Status GdipAddPathClosedCurve_delegate(IntPtr path, PointF[] points, int count); private static FunctionWrapper<GdipAddPathClosedCurve_delegate> GdipAddPathClosedCurve_ptr; internal static Status GdipAddPathClosedCurve(IntPtr path, PointF[] points, int count) => GdipAddPathClosedCurve_ptr.Delegate(path, points, count); private delegate Status GdipAddPathClosedCurveI_delegate(IntPtr path, Point[] points, int count); private static FunctionWrapper<GdipAddPathClosedCurveI_delegate> GdipAddPathClosedCurveI_ptr; internal static Status GdipAddPathClosedCurveI(IntPtr path, Point[] points, int count) => GdipAddPathClosedCurveI_ptr.Delegate(path, points, count); private delegate Status GdipAddPathClosedCurve2_delegate(IntPtr path, PointF[] points, int count, float tension); private static FunctionWrapper<GdipAddPathClosedCurve2_delegate> GdipAddPathClosedCurve2_ptr; internal static Status GdipAddPathClosedCurve2(IntPtr path, PointF[] points, int count, float tension) => GdipAddPathClosedCurve2_ptr.Delegate(path, points, count, tension); private delegate Status GdipAddPathClosedCurve2I_delegate(IntPtr path, Point[] points, int count, float tension); private static FunctionWrapper<GdipAddPathClosedCurve2I_delegate> GdipAddPathClosedCurve2I_ptr; internal static Status GdipAddPathClosedCurve2I(IntPtr path, Point[] points, int count, float tension) => GdipAddPathClosedCurve2I_ptr.Delegate(path, points, count, tension); private delegate Status GdipAddPathRectangle_delegate(IntPtr path, float x, float y, float width, float height); private static FunctionWrapper<GdipAddPathRectangle_delegate> GdipAddPathRectangle_ptr; internal static Status GdipAddPathRectangle(IntPtr path, float x, float y, float width, float height) => GdipAddPathRectangle_ptr.Delegate(path, x, y, width, height); private delegate Status GdipAddPathRectangles_delegate(IntPtr path, RectangleF[] rects, int count); private static FunctionWrapper<GdipAddPathRectangles_delegate> GdipAddPathRectangles_ptr; internal static Status GdipAddPathRectangles(IntPtr path, RectangleF[] rects, int count) => GdipAddPathRectangles_ptr.Delegate(path, rects, count); private delegate Status GdipAddPathEllipse_delegate(IntPtr path, float x, float y, float width, float height); private static FunctionWrapper<GdipAddPathEllipse_delegate> GdipAddPathEllipse_ptr; internal static Status GdipAddPathEllipse(IntPtr path, float x, float y, float width, float height) => GdipAddPathEllipse_ptr.Delegate(path, x, y, width, height); private delegate Status GdipAddPathEllipseI_delegate(IntPtr path, int x, int y, int width, int height); private static FunctionWrapper<GdipAddPathEllipseI_delegate> GdipAddPathEllipseI_ptr; internal static Status GdipAddPathEllipseI(IntPtr path, int x, int y, int width, int height) => GdipAddPathEllipseI_ptr.Delegate(path, x, y, width, height); private delegate Status GdipAddPathPie_delegate(IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipAddPathPie_delegate> GdipAddPathPie_ptr; internal static Status GdipAddPathPie(IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle) => GdipAddPathPie_ptr.Delegate(path, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipAddPathPieI_delegate(IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipAddPathPieI_delegate> GdipAddPathPieI_ptr; internal static Status GdipAddPathPieI(IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle) => GdipAddPathPieI_ptr.Delegate(path, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipAddPathPolygon_delegate(IntPtr path, PointF[] points, int count); private static FunctionWrapper<GdipAddPathPolygon_delegate> GdipAddPathPolygon_ptr; internal static Status GdipAddPathPolygon(IntPtr path, PointF[] points, int count) => GdipAddPathPolygon_ptr.Delegate(path, points, count); private delegate Status GdipAddPathPath_delegate(IntPtr path, IntPtr addingPath, bool connect); private static FunctionWrapper<GdipAddPathPath_delegate> GdipAddPathPath_ptr; internal static Status GdipAddPathPath(IntPtr path, IntPtr addingPath, bool connect) => GdipAddPathPath_ptr.Delegate(path, addingPath, connect); private delegate Status GdipAddPathLineI_delegate(IntPtr path, int x1, int y1, int x2, int y2); private static FunctionWrapper<GdipAddPathLineI_delegate> GdipAddPathLineI_ptr; internal static Status GdipAddPathLineI(IntPtr path, int x1, int y1, int x2, int y2) => GdipAddPathLineI_ptr.Delegate(path, x1, y1, x2, y2); private delegate Status GdipAddPathArcI_delegate(IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle); private static FunctionWrapper<GdipAddPathArcI_delegate> GdipAddPathArcI_ptr; internal static Status GdipAddPathArcI(IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle) => GdipAddPathArcI_ptr.Delegate(path, x, y, width, height, startAngle, sweepAngle); private delegate Status GdipAddPathBezierI_delegate(IntPtr path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4); private static FunctionWrapper<GdipAddPathBezierI_delegate> GdipAddPathBezierI_ptr; internal static Status GdipAddPathBezierI(IntPtr path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) => GdipAddPathBezierI_ptr.Delegate(path, x1, y1, x2, y2, x3, y3, x4, y4); private delegate Status GdipAddPathBeziersI_delegate(IntPtr path, Point[] points, int count); private static FunctionWrapper<GdipAddPathBeziersI_delegate> GdipAddPathBeziersI_ptr; internal static Status GdipAddPathBeziersI(IntPtr path, Point[] points, int count) => GdipAddPathBeziersI_ptr.Delegate(path, points, count); private delegate Status GdipAddPathPolygonI_delegate(IntPtr path, Point[] points, int count); private static FunctionWrapper<GdipAddPathPolygonI_delegate> GdipAddPathPolygonI_ptr; internal static Status GdipAddPathPolygonI(IntPtr path, Point[] points, int count) => GdipAddPathPolygonI_ptr.Delegate(path, points, count); private delegate Status GdipAddPathRectangleI_delegate(IntPtr path, int x, int y, int width, int height); private static FunctionWrapper<GdipAddPathRectangleI_delegate> GdipAddPathRectangleI_ptr; internal static Status GdipAddPathRectangleI(IntPtr path, int x, int y, int width, int height) => GdipAddPathRectangleI_ptr.Delegate(path, x, y, width, height); private delegate Status GdipAddPathRectanglesI_delegate(IntPtr path, Rectangle[] rects, int count); private static FunctionWrapper<GdipAddPathRectanglesI_delegate> GdipAddPathRectanglesI_ptr; internal static Status GdipAddPathRectanglesI(IntPtr path, Rectangle[] rects, int count) => GdipAddPathRectanglesI_ptr.Delegate(path, rects, count); private delegate Status GdipFlattenPath_delegate(IntPtr path, IntPtr matrix, float floatness); private static FunctionWrapper<GdipFlattenPath_delegate> GdipFlattenPath_ptr; internal static Status GdipFlattenPath(IntPtr path, IntPtr matrix, float floatness) => GdipFlattenPath_ptr.Delegate(path, matrix, floatness); private delegate Status GdipTransformPath_delegate(IntPtr path, IntPtr matrix); private static FunctionWrapper<GdipTransformPath_delegate> GdipTransformPath_ptr; internal static Status GdipTransformPath(IntPtr path, IntPtr matrix) => GdipTransformPath_ptr.Delegate(path, matrix); private delegate Status GdipWarpPath_delegate(IntPtr path, IntPtr matrix, PointF[] points, int count, float srcx, float srcy, float srcwidth, float srcheight, WarpMode mode, float flatness); private static FunctionWrapper<GdipWarpPath_delegate> GdipWarpPath_ptr; internal static Status GdipWarpPath(IntPtr path, IntPtr matrix, PointF[] points, int count, float srcx, float srcy, float srcwidth, float srcheight, WarpMode mode, float flatness) => GdipWarpPath_ptr.Delegate(path, matrix, points, count, srcx, srcy, srcwidth, srcheight, mode, flatness); private delegate Status GdipWidenPath_delegate(IntPtr path, IntPtr pen, IntPtr matrix, float flatness); private static FunctionWrapper<GdipWidenPath_delegate> GdipWidenPath_ptr; internal static Status GdipWidenPath(IntPtr path, IntPtr pen, IntPtr matrix, float flatness) => GdipWidenPath_ptr.Delegate(path, pen, matrix, flatness); private delegate Status GdipGetPathWorldBounds_delegate(IntPtr path, out RectangleF bounds, IntPtr matrix, IntPtr pen); private static FunctionWrapper<GdipGetPathWorldBounds_delegate> GdipGetPathWorldBounds_ptr; internal static Status GdipGetPathWorldBounds(IntPtr path, out RectangleF bounds, IntPtr matrix, IntPtr pen) => GdipGetPathWorldBounds_ptr.Delegate(path, out bounds, matrix, pen); private delegate Status GdipGetPathWorldBoundsI_delegate(IntPtr path, out Rectangle bounds, IntPtr matrix, IntPtr pen); private static FunctionWrapper<GdipGetPathWorldBoundsI_delegate> GdipGetPathWorldBoundsI_ptr; internal static Status GdipGetPathWorldBoundsI(IntPtr path, out Rectangle bounds, IntPtr matrix, IntPtr pen) => GdipGetPathWorldBoundsI_ptr.Delegate(path, out bounds, matrix, pen); private delegate Status GdipIsVisiblePathPoint_delegate(IntPtr path, float x, float y, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisiblePathPoint_delegate> GdipIsVisiblePathPoint_ptr; internal static Status GdipIsVisiblePathPoint(IntPtr path, float x, float y, IntPtr graphics, out bool result) => GdipIsVisiblePathPoint_ptr.Delegate(path, x, y, graphics, out result); private delegate Status GdipIsVisiblePathPointI_delegate(IntPtr path, int x, int y, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsVisiblePathPointI_delegate> GdipIsVisiblePathPointI_ptr; internal static Status GdipIsVisiblePathPointI(IntPtr path, int x, int y, IntPtr graphics, out bool result) => GdipIsVisiblePathPointI_ptr.Delegate(path, x, y, graphics, out result); private delegate Status GdipIsOutlineVisiblePathPoint_delegate(IntPtr path, float x, float y, IntPtr pen, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsOutlineVisiblePathPoint_delegate> GdipIsOutlineVisiblePathPoint_ptr; internal static Status GdipIsOutlineVisiblePathPoint(IntPtr path, float x, float y, IntPtr pen, IntPtr graphics, out bool result) => GdipIsOutlineVisiblePathPoint_ptr.Delegate(path, x, y, pen, graphics, out result); private delegate Status GdipIsOutlineVisiblePathPointI_delegate(IntPtr path, int x, int y, IntPtr pen, IntPtr graphics, out bool result); private static FunctionWrapper<GdipIsOutlineVisiblePathPointI_delegate> GdipIsOutlineVisiblePathPointI_ptr; internal static Status GdipIsOutlineVisiblePathPointI(IntPtr path, int x, int y, IntPtr pen, IntPtr graphics, out bool result) => GdipIsOutlineVisiblePathPointI_ptr.Delegate(path, x, y, pen, graphics, out result); private delegate Status GdipCreateFont_delegate(IntPtr fontFamily, float emSize, FontStyle style, GraphicsUnit unit, out IntPtr font); private static FunctionWrapper<GdipCreateFont_delegate> GdipCreateFont_ptr; internal static Status GdipCreateFont(IntPtr fontFamily, float emSize, FontStyle style, GraphicsUnit unit, out IntPtr font) => GdipCreateFont_ptr.Delegate(fontFamily, emSize, style, unit, out font); private delegate Status GdipDeleteFont_delegate(IntPtr font); private static FunctionWrapper<GdipDeleteFont_delegate> GdipDeleteFont_ptr; internal static Status GdipDeleteFont(IntPtr font) => GdipDeleteFont_ptr.Delegate(font); internal static int IntGdipDeleteFont(HandleRef font) => (int)GdipDeleteFont_ptr.Delegate(font.Handle); #pragma warning disable CS0618 // Legacy code: We don't care about using obsolete API's. private delegate Status GdipGetLogFont_delegate(IntPtr font, IntPtr graphics, [MarshalAs(UnmanagedType.AsAny), Out] object logfontA); #pragma warning restore CS0618 private static FunctionWrapper<GdipGetLogFont_delegate> GdipGetLogFont_ptr; internal static Status GdipGetLogFont(IntPtr font, IntPtr graphics, [Out] object logfontA) => GdipGetLogFont_ptr.Delegate(font, graphics, logfontA); private delegate Status GdipCreateFontFromDC_delegate(IntPtr hdc, out IntPtr font); private static FunctionWrapper<GdipCreateFontFromDC_delegate> GdipCreateFontFromDC_ptr; internal static Status GdipCreateFontFromDC(IntPtr hdc, out IntPtr font) => GdipCreateFontFromDC_ptr.Delegate(hdc, out font); private delegate Status GdipCreateFontFromLogfont_delegate(IntPtr hdc, ref LOGFONT lf, out IntPtr ptr); private static FunctionWrapper<GdipCreateFontFromLogfont_delegate> GdipCreateFontFromLogfont_ptr; internal static Status GdipCreateFontFromLogfont(IntPtr hdc, ref LOGFONT lf, out IntPtr ptr) => GdipCreateFontFromLogfont_ptr.Delegate(hdc, ref lf, out ptr); private delegate Status GdipCreateFontFromHfont_delegate(IntPtr hdc, out IntPtr font, ref LOGFONT lf); private static FunctionWrapper<GdipCreateFontFromHfont_delegate> GdipCreateFontFromHfont_ptr; internal static Status GdipCreateFontFromHfont(IntPtr hdc, out IntPtr font, ref LOGFONT lf) => GdipCreateFontFromHfont_ptr.Delegate(hdc, out font, ref lf); private delegate Status GdipNewPrivateFontCollection_delegate(out IntPtr collection); private static FunctionWrapper<GdipNewPrivateFontCollection_delegate> GdipNewPrivateFontCollection_ptr; internal static Status GdipNewPrivateFontCollection(out IntPtr collection) => GdipNewPrivateFontCollection_ptr.Delegate(out collection); private delegate Status GdipDeletePrivateFontCollection_delegate(ref IntPtr collection); private static FunctionWrapper<GdipDeletePrivateFontCollection_delegate> GdipDeletePrivateFontCollection_ptr; internal static int IntGdipDeletePrivateFontCollection(ref IntPtr collection) => (int)GdipDeletePrivateFontCollection_ptr.Delegate(ref collection); private delegate Status GdipPrivateAddFontFile_delegate(IntPtr collection, [MarshalAs(UnmanagedType.LPWStr)]string fileName); private static FunctionWrapper<GdipPrivateAddFontFile_delegate> GdipPrivateAddFontFile_ptr; internal static Status GdipPrivateAddFontFile(IntPtr collection, string fileName) => GdipPrivateAddFontFile_ptr.Delegate(collection, fileName); private delegate Status GdipPrivateAddMemoryFont_delegate(IntPtr collection, IntPtr mem, int length); private static FunctionWrapper<GdipPrivateAddMemoryFont_delegate> GdipPrivateAddMemoryFont_ptr; internal static Status GdipPrivateAddMemoryFont(IntPtr collection, IntPtr mem, int length) => GdipPrivateAddMemoryFont_ptr.Delegate(collection, mem, length); [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)] private delegate Status GdipCreateFontFamilyFromName_delegate([MarshalAs(UnmanagedType.LPWStr)]string fName, IntPtr collection, out IntPtr fontFamily); private static FunctionWrapper<GdipCreateFontFamilyFromName_delegate> GdipCreateFontFamilyFromName_ptr; internal static Status GdipCreateFontFamilyFromName(string fName, IntPtr collection, out IntPtr fontFamily) => GdipCreateFontFamilyFromName_ptr.Delegate(fName, collection, out fontFamily); private delegate Status GdipGetFamilyName_delegate(IntPtr family, IntPtr name, int language); private static FunctionWrapper<GdipGetFamilyName_delegate> GdipGetFamilyName_ptr; internal static Status GdipGetFamilyName(IntPtr family, IntPtr name, int language) => GdipGetFamilyName_ptr.Delegate(family, name, language); internal static unsafe Status GdipGetFamilyName(IntPtr family, StringBuilder nameBuilder, int language) { const int LF_FACESIZE = 32; char* namePtr = stackalloc char[LF_FACESIZE]; Status ret = GdipGetFamilyName(family, (IntPtr)namePtr, language); string name = Marshal.PtrToStringUni((IntPtr)namePtr); nameBuilder.Append(name); return ret; } private delegate Status GdipGetGenericFontFamilySansSerif_delegate(out IntPtr fontFamily); private static FunctionWrapper<GdipGetGenericFontFamilySansSerif_delegate> GdipGetGenericFontFamilySansSerif_ptr; internal static Status GdipGetGenericFontFamilySansSerif(out IntPtr fontFamily) => GdipGetGenericFontFamilySansSerif_ptr.Delegate(out fontFamily); private delegate Status GdipGetGenericFontFamilySerif_delegate(out IntPtr fontFamily); private static FunctionWrapper<GdipGetGenericFontFamilySerif_delegate> GdipGetGenericFontFamilySerif_ptr; internal static Status GdipGetGenericFontFamilySerif(out IntPtr fontFamily) => GdipGetGenericFontFamilySerif_ptr.Delegate(out fontFamily); private delegate Status GdipGetGenericFontFamilyMonospace_delegate(out IntPtr fontFamily); private static FunctionWrapper<GdipGetGenericFontFamilyMonospace_delegate> GdipGetGenericFontFamilyMonospace_ptr; internal static Status GdipGetGenericFontFamilyMonospace(out IntPtr fontFamily) => GdipGetGenericFontFamilyMonospace_ptr.Delegate(out fontFamily); private delegate Status GdipGetCellAscent_delegate(IntPtr fontFamily, int style, out short ascent); private static FunctionWrapper<GdipGetCellAscent_delegate> GdipGetCellAscent_ptr; internal static Status GdipGetCellAscent(IntPtr fontFamily, int style, out short ascent) => GdipGetCellAscent_ptr.Delegate(fontFamily, style, out ascent); private delegate Status GdipGetCellDescent_delegate(IntPtr fontFamily, int style, out short descent); private static FunctionWrapper<GdipGetCellDescent_delegate> GdipGetCellDescent_ptr; internal static Status GdipGetCellDescent(IntPtr fontFamily, int style, out short descent) => GdipGetCellDescent_ptr.Delegate(fontFamily, style, out descent); private delegate Status GdipGetLineSpacing_delegate(IntPtr fontFamily, int style, out short spacing); private static FunctionWrapper<GdipGetLineSpacing_delegate> GdipGetLineSpacing_ptr; internal static Status GdipGetLineSpacing(IntPtr fontFamily, int style, out short spacing) => GdipGetLineSpacing_ptr.Delegate(fontFamily, style, out spacing); private delegate Status GdipGetEmHeight_delegate(IntPtr fontFamily, int style, out short emHeight); private static FunctionWrapper<GdipGetEmHeight_delegate> GdipGetEmHeight_ptr; internal static Status GdipGetEmHeight(IntPtr fontFamily, int style, out short emHeight) => GdipGetEmHeight_ptr.Delegate(fontFamily, style, out emHeight); private delegate Status GdipIsStyleAvailable_delegate(IntPtr fontFamily, int style, out bool styleAvailable); private static FunctionWrapper<GdipIsStyleAvailable_delegate> GdipIsStyleAvailable_ptr; internal static Status GdipIsStyleAvailable(IntPtr fontFamily, int style, out bool styleAvailable) => GdipIsStyleAvailable_ptr.Delegate(fontFamily, style, out styleAvailable); private delegate Status GdipDeleteFontFamily_delegate(IntPtr fontFamily); private static FunctionWrapper<GdipDeleteFontFamily_delegate> GdipDeleteFontFamily_ptr; internal static Status GdipDeleteFontFamily(IntPtr fontFamily) => GdipDeleteFontFamily_ptr.Delegate(fontFamily); internal static int IntGdipDeleteFontFamily(HandleRef fontFamily) => (int)GdipDeleteFontFamily_ptr.Delegate(fontFamily.Handle); private delegate Status GdipGetFontSize_delegate(IntPtr font, out float size); private static FunctionWrapper<GdipGetFontSize_delegate> GdipGetFontSize_ptr; internal static Status GdipGetFontSize(IntPtr font, out float size) => GdipGetFontSize_ptr.Delegate(font, out size); private delegate Status GdipGetFontHeight_delegate(IntPtr font, IntPtr graphics, out float height); private static FunctionWrapper<GdipGetFontHeight_delegate> GdipGetFontHeight_ptr; internal static Status GdipGetFontHeight(IntPtr font, IntPtr graphics, out float height) => GdipGetFontHeight_ptr.Delegate(font, graphics, out height); private delegate Status GdipGetFontHeightGivenDPI_delegate(IntPtr font, float dpi, out float height); private static FunctionWrapper<GdipGetFontHeightGivenDPI_delegate> GdipGetFontHeightGivenDPI_ptr; internal static Status GdipGetFontHeightGivenDPI(IntPtr font, float dpi, out float height) => GdipGetFontHeightGivenDPI_ptr.Delegate(font, dpi, out height); private delegate Status GdipCreateStringFormat2_delegate(int formatAttributes, int language, out IntPtr format); private static FunctionWrapper<GdipCreateStringFormat2_delegate> GdipCreateStringFormat2_ptr; internal static Status GdipCreateStringFormat(int formatAttributes, int language, out IntPtr format) => GdipCreateStringFormat2_ptr.Delegate(formatAttributes, language, out format); private delegate Status GdipStringFormatGetGenericDefault_delegate(out IntPtr format); private static FunctionWrapper<GdipStringFormatGetGenericDefault_delegate> GdipStringFormatGetGenericDefault_ptr; internal static Status GdipStringFormatGetGenericDefault(out IntPtr format) => GdipStringFormatGetGenericDefault_ptr.Delegate(out format); private delegate Status GdipStringFormatGetGenericTypographic_delegate(out IntPtr format); private static FunctionWrapper<GdipStringFormatGetGenericTypographic_delegate> GdipStringFormatGetGenericTypographic_ptr; internal static Status GdipStringFormatGetGenericTypographic(out IntPtr format) => GdipStringFormatGetGenericTypographic_ptr.Delegate(out format); private delegate Status GdipDeleteStringFormat_delegate(IntPtr format); private static FunctionWrapper<GdipDeleteStringFormat_delegate> GdipDeleteStringFormat_ptr; internal static Status GdipDeleteStringFormat(IntPtr format) => GdipDeleteStringFormat_ptr.Delegate(format); internal static int IntGdipDeleteStringFormat(HandleRef format) => (int)GdipDeleteStringFormat_ptr.Delegate(format.Handle); private delegate Status GdipCloneStringFormat_delegate(IntPtr srcformat, out IntPtr format); private static FunctionWrapper<GdipCloneStringFormat_delegate> GdipCloneStringFormat_ptr; internal static Status GdipCloneStringFormat(IntPtr srcformat, out IntPtr format) => GdipCloneStringFormat_ptr.Delegate(srcformat, out format); private delegate Status GdipSetStringFormatFlags_delegate(IntPtr format, StringFormatFlags flags); private static FunctionWrapper<GdipSetStringFormatFlags_delegate> GdipSetStringFormatFlags_ptr; internal static Status GdipSetStringFormatFlags(IntPtr format, StringFormatFlags flags) => GdipSetStringFormatFlags_ptr.Delegate(format, flags); private delegate Status GdipGetStringFormatFlags_delegate(IntPtr format, out StringFormatFlags flags); private static FunctionWrapper<GdipGetStringFormatFlags_delegate> GdipGetStringFormatFlags_ptr; internal static Status GdipGetStringFormatFlags(IntPtr format, out StringFormatFlags flags) => GdipGetStringFormatFlags_ptr.Delegate(format, out flags); private delegate Status GdipSetStringFormatAlign_delegate(IntPtr format, StringAlignment align); private static FunctionWrapper<GdipSetStringFormatAlign_delegate> GdipSetStringFormatAlign_ptr; internal static Status GdipSetStringFormatAlign(IntPtr format, StringAlignment align) => GdipSetStringFormatAlign_ptr.Delegate(format, align); private delegate Status GdipGetStringFormatAlign_delegate(IntPtr format, out StringAlignment align); private static FunctionWrapper<GdipGetStringFormatAlign_delegate> GdipGetStringFormatAlign_ptr; internal static Status GdipGetStringFormatAlign(IntPtr format, out StringAlignment align) => GdipGetStringFormatAlign_ptr.Delegate(format, out align); private delegate Status GdipSetStringFormatLineAlign_delegate(IntPtr format, StringAlignment align); private static FunctionWrapper<GdipSetStringFormatLineAlign_delegate> GdipSetStringFormatLineAlign_ptr; internal static Status GdipSetStringFormatLineAlign(IntPtr format, StringAlignment align) => GdipSetStringFormatLineAlign_ptr.Delegate(format, align); private delegate Status GdipGetStringFormatLineAlign_delegate(IntPtr format, out StringAlignment align); private static FunctionWrapper<GdipGetStringFormatLineAlign_delegate> GdipGetStringFormatLineAlign_ptr; internal static Status GdipGetStringFormatLineAlign(IntPtr format, out StringAlignment align) => GdipGetStringFormatLineAlign_ptr.Delegate(format, out align); private delegate Status GdipSetStringFormatTrimming_delegate(IntPtr format, StringTrimming trimming); private static FunctionWrapper<GdipSetStringFormatTrimming_delegate> GdipSetStringFormatTrimming_ptr; internal static Status GdipSetStringFormatTrimming(IntPtr format, StringTrimming trimming) => GdipSetStringFormatTrimming_ptr.Delegate(format, trimming); private delegate Status GdipGetStringFormatTrimming_delegate(IntPtr format, out StringTrimming trimming); private static FunctionWrapper<GdipGetStringFormatTrimming_delegate> GdipGetStringFormatTrimming_ptr; internal static Status GdipGetStringFormatTrimming(IntPtr format, out StringTrimming trimming) => GdipGetStringFormatTrimming_ptr.Delegate(format, out trimming); private delegate Status GdipSetStringFormatHotkeyPrefix_delegate(IntPtr format, HotkeyPrefix hotkeyPrefix); private static FunctionWrapper<GdipSetStringFormatHotkeyPrefix_delegate> GdipSetStringFormatHotkeyPrefix_ptr; internal static Status GdipSetStringFormatHotkeyPrefix(IntPtr format, HotkeyPrefix hotkeyPrefix) => GdipSetStringFormatHotkeyPrefix_ptr.Delegate(format, hotkeyPrefix); private delegate Status GdipGetStringFormatHotkeyPrefix_delegate(IntPtr format, out HotkeyPrefix hotkeyPrefix); private static FunctionWrapper<GdipGetStringFormatHotkeyPrefix_delegate> GdipGetStringFormatHotkeyPrefix_ptr; internal static Status GdipGetStringFormatHotkeyPrefix(IntPtr format, out HotkeyPrefix hotkeyPrefix) => GdipGetStringFormatHotkeyPrefix_ptr.Delegate(format, out hotkeyPrefix); private delegate Status GdipSetStringFormatTabStops_delegate(IntPtr format, float firstTabOffset, int count, float[] tabStops); private static FunctionWrapper<GdipSetStringFormatTabStops_delegate> GdipSetStringFormatTabStops_ptr; internal static Status GdipSetStringFormatTabStops(IntPtr format, float firstTabOffset, int count, float[] tabStops) => GdipSetStringFormatTabStops_ptr.Delegate(format, firstTabOffset, count, tabStops); private delegate Status GdipGetStringFormatDigitSubstitution_delegate(IntPtr format, int language, out StringDigitSubstitute substitute); private static FunctionWrapper<GdipGetStringFormatDigitSubstitution_delegate> GdipGetStringFormatDigitSubstitution_ptr; internal static Status GdipGetStringFormatDigitSubstitution(IntPtr format, int language, out StringDigitSubstitute substitute) => GdipGetStringFormatDigitSubstitution_ptr.Delegate(format, language, out substitute); private delegate Status GdipSetStringFormatDigitSubstitution_delegate(IntPtr format, int language, StringDigitSubstitute substitute); private static FunctionWrapper<GdipSetStringFormatDigitSubstitution_delegate> GdipSetStringFormatDigitSubstitution_ptr; internal static Status GdipSetStringFormatDigitSubstitution(IntPtr format, int language, StringDigitSubstitute substitute) => GdipSetStringFormatDigitSubstitution_ptr.Delegate(format, language, substitute); private delegate Status GdipGetStringFormatTabStopCount_delegate(IntPtr format, out int count); private static FunctionWrapper<GdipGetStringFormatTabStopCount_delegate> GdipGetStringFormatTabStopCount_ptr; internal static Status GdipGetStringFormatTabStopCount(IntPtr format, out int count) => GdipGetStringFormatTabStopCount_ptr.Delegate(format, out count); private delegate Status GdipGetStringFormatTabStops_delegate(IntPtr format, int count, out float firstTabOffset, [In] [Out] float[] tabStops); private static FunctionWrapper<GdipGetStringFormatTabStops_delegate> GdipGetStringFormatTabStops_ptr; internal static Status GdipGetStringFormatTabStops(IntPtr format, int count, out float firstTabOffset, [In] [Out] float[] tabStops) => GdipGetStringFormatTabStops_ptr.Delegate(format, count, out firstTabOffset, tabStops); private delegate Status GdipCreateMetafileFromFile_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, out IntPtr metafile); private static FunctionWrapper<GdipCreateMetafileFromFile_delegate> GdipCreateMetafileFromFile_ptr; internal static Status GdipCreateMetafileFromFile(string filename, out IntPtr metafile) => GdipCreateMetafileFromFile_ptr.Delegate(filename, out metafile); private delegate Status GdipCreateMetafileFromEmf_delegate(IntPtr hEmf, bool deleteEmf, out IntPtr metafile); private static FunctionWrapper<GdipCreateMetafileFromEmf_delegate> GdipCreateMetafileFromEmf_ptr; internal static Status GdipCreateMetafileFromEmf(IntPtr hEmf, bool deleteEmf, out IntPtr metafile) => GdipCreateMetafileFromEmf_ptr.Delegate(hEmf, deleteEmf, out metafile); private delegate Status GdipCreateMetafileFromWmf_delegate(IntPtr hWmf, bool deleteWmf, WmfPlaceableFileHeader wmfPlaceableFileHeader, out IntPtr metafile); private static FunctionWrapper<GdipCreateMetafileFromWmf_delegate> GdipCreateMetafileFromWmf_ptr; internal static Status GdipCreateMetafileFromWmf(IntPtr hWmf, bool deleteWmf, WmfPlaceableFileHeader wmfPlaceableFileHeader, out IntPtr metafile) => GdipCreateMetafileFromWmf_ptr.Delegate(hWmf, deleteWmf, wmfPlaceableFileHeader, out metafile); private delegate Status GdipGetMetafileHeaderFromFile_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, IntPtr header); private static FunctionWrapper<GdipGetMetafileHeaderFromFile_delegate> GdipGetMetafileHeaderFromFile_ptr; internal static Status GdipGetMetafileHeaderFromFile(string filename, IntPtr header) => GdipGetMetafileHeaderFromFile_ptr.Delegate(filename, header); private delegate Status GdipGetMetafileHeaderFromMetafile_delegate(IntPtr metafile, IntPtr header); private static FunctionWrapper<GdipGetMetafileHeaderFromMetafile_delegate> GdipGetMetafileHeaderFromMetafile_ptr; internal static Status GdipGetMetafileHeaderFromMetafile(IntPtr metafile, IntPtr header) => GdipGetMetafileHeaderFromMetafile_ptr.Delegate(metafile, header); private delegate Status GdipGetMetafileHeaderFromEmf_delegate(IntPtr hEmf, IntPtr header); private static FunctionWrapper<GdipGetMetafileHeaderFromEmf_delegate> GdipGetMetafileHeaderFromEmf_ptr; internal static Status GdipGetMetafileHeaderFromEmf(IntPtr hEmf, IntPtr header) => GdipGetMetafileHeaderFromEmf_ptr.Delegate(hEmf, header); private delegate Status GdipGetMetafileHeaderFromWmf_delegate(IntPtr hWmf, IntPtr wmfPlaceableFileHeader, IntPtr header); private static FunctionWrapper<GdipGetMetafileHeaderFromWmf_delegate> GdipGetMetafileHeaderFromWmf_ptr; internal static Status GdipGetMetafileHeaderFromWmf(IntPtr hWmf, IntPtr wmfPlaceableFileHeader, IntPtr header) => GdipGetMetafileHeaderFromWmf_ptr.Delegate(hWmf, wmfPlaceableFileHeader, header); private delegate Status GdipGetHemfFromMetafile_delegate(IntPtr metafile, out IntPtr hEmf); private static FunctionWrapper<GdipGetHemfFromMetafile_delegate> GdipGetHemfFromMetafile_ptr; internal static Status GdipGetHemfFromMetafile(IntPtr metafile, out IntPtr hEmf) => GdipGetHemfFromMetafile_ptr.Delegate(metafile, out hEmf); private delegate Status GdipGetMetafileDownLevelRasterizationLimit_delegate(IntPtr metafile, ref uint metafileRasterizationLimitDpi); private static FunctionWrapper<GdipGetMetafileDownLevelRasterizationLimit_delegate> GdipGetMetafileDownLevelRasterizationLimit_ptr; internal static Status GdipGetMetafileDownLevelRasterizationLimit(IntPtr metafile, ref uint metafileRasterizationLimitDpi) => GdipGetMetafileDownLevelRasterizationLimit_ptr.Delegate(metafile, ref metafileRasterizationLimitDpi); private delegate Status GdipSetMetafileDownLevelRasterizationLimit_delegate(IntPtr metafile, uint metafileRasterizationLimitDpi); private static FunctionWrapper<GdipSetMetafileDownLevelRasterizationLimit_delegate> GdipSetMetafileDownLevelRasterizationLimit_ptr; internal static Status GdipSetMetafileDownLevelRasterizationLimit(IntPtr metafile, uint metafileRasterizationLimitDpi) => GdipSetMetafileDownLevelRasterizationLimit_ptr.Delegate(metafile, metafileRasterizationLimitDpi); private delegate Status GdipPlayMetafileRecord_delegate(IntPtr metafile, EmfPlusRecordType recordType, int flags, int dataSize, byte[] data); private static FunctionWrapper<GdipPlayMetafileRecord_delegate> GdipPlayMetafileRecord_ptr; internal static Status GdipPlayMetafileRecord(IntPtr metafile, EmfPlusRecordType recordType, int flags, int dataSize, byte[] data) => GdipPlayMetafileRecord_ptr.Delegate(metafile, recordType, flags, dataSize, data); private delegate Status GdipRecordMetafile_delegate(IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafile_delegate> GdipRecordMetafile_ptr; internal static Status GdipRecordMetafile(IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafile_ptr.Delegate(hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipRecordMetafileI_delegate(IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileI_delegate> GdipRecordMetafileI_ptr; internal static Status GdipRecordMetafileI(IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileI_ptr.Delegate(hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipRecordMetafileFileName_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileFileName_delegate> GdipRecordMetafileFileName_ptr; internal static Status GdipRecordMetafileFileName(string filename, IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileName_ptr.Delegate(filename, hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipRecordMetafileFileNameI_delegate([MarshalAs(UnmanagedType.LPWStr)]string filename, IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileFileNameI_delegate> GdipRecordMetafileFileNameI_ptr; internal static Status GdipRecordMetafileFileNameI(string filename, IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileNameI_ptr.Delegate(filename, hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipCreateMetafileFromStream_delegate([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ComIStreamMarshaler))]IStream stream, out IntPtr metafile); private static FunctionWrapper<GdipCreateMetafileFromStream_delegate> GdipCreateMetafileFromStream_ptr; internal static Status GdipCreateMetafileFromStream(IStream stream, out IntPtr metafile) => GdipCreateMetafileFromStream_ptr.Delegate(stream, out metafile); private delegate Status GdipGetMetafileHeaderFromStream_delegate([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ComIStreamMarshaler))]IStream stream, IntPtr header); private static FunctionWrapper<GdipGetMetafileHeaderFromStream_delegate> GdipGetMetafileHeaderFromStream_ptr; internal static Status GdipGetMetafileHeaderFromStream(IStream stream, IntPtr header) => GdipGetMetafileHeaderFromStream_ptr.Delegate(stream, header); private delegate Status GdipRecordMetafileStream_delegate([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ComIStreamMarshaler))]IStream stream, IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileStream_delegate> GdipRecordMetafileStream_ptr; internal static Status GdipRecordMetafileStream(IStream stream, IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileStream_ptr.Delegate(stream, hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipRecordMetafileStreamI_delegate([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ComIStreamMarshaler))]IStream stream, IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileStreamI_delegate> GdipRecordMetafileStreamI_ptr; internal static Status GdipRecordMetafileStreamI(IStream stream, IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileStreamI_ptr.Delegate(stream, hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipCreateFromContext_macosx_delegate(IntPtr cgref, int width, int height, out IntPtr graphics); private static FunctionWrapper<GdipCreateFromContext_macosx_delegate> GdipCreateFromContext_macosx_ptr; internal static Status GdipCreateFromContext_macosx(IntPtr cgref, int width, int height, out IntPtr graphics) =>GdipCreateFromContext_macosx_ptr.Delegate(cgref, width, height, out graphics); private delegate Status GdipSetVisibleClip_linux_delegate(IntPtr graphics, ref Rectangle rect); private static FunctionWrapper<GdipSetVisibleClip_linux_delegate> GdipSetVisibleClip_linux_ptr; internal static Status GdipSetVisibleClip_linux(IntPtr graphics, ref Rectangle rect) => GdipSetVisibleClip_linux_ptr.Delegate(graphics, ref rect); private delegate Status GdipCreateFromXDrawable_linux_delegate(IntPtr drawable, IntPtr display, out IntPtr graphics); private static FunctionWrapper<GdipCreateFromXDrawable_linux_delegate> GdipCreateFromXDrawable_linux_ptr; internal static Status GdipCreateFromXDrawable_linux(IntPtr drawable, IntPtr display, out IntPtr graphics) => GdipCreateFromXDrawable_linux_ptr.Delegate(drawable, display, out graphics); // Stream functions for non-Win32 (libgdiplus specific) private delegate Status GdipLoadImageFromDelegate_linux_delegate(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, out IntPtr image); private static FunctionWrapper<GdipLoadImageFromDelegate_linux_delegate> GdipLoadImageFromDelegate_linux_ptr; internal static Status GdipLoadImageFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, out IntPtr image) => GdipLoadImageFromDelegate_linux_ptr.Delegate(getHeader, getBytes, putBytes, doSeek, close, size, out image); private delegate Status GdipSaveImageToDelegate_linux_delegate(IntPtr image, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, ref Guid encoderClsID, IntPtr encoderParameters); private static FunctionWrapper<GdipSaveImageToDelegate_linux_delegate> GdipSaveImageToDelegate_linux_ptr; internal static Status GdipSaveImageToDelegate_linux(IntPtr image, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, ref Guid encoderClsID, IntPtr encoderParameters) => GdipSaveImageToDelegate_linux_ptr.Delegate(image, getBytes, putBytes, doSeek, close, size, ref encoderClsID, encoderParameters); private delegate Status GdipCreateMetafileFromDelegate_linux_delegate(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, out IntPtr metafile); private static FunctionWrapper<GdipCreateMetafileFromDelegate_linux_delegate> GdipCreateMetafileFromDelegate_linux_ptr; internal static Status GdipCreateMetafileFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, out IntPtr metafile) => GdipCreateMetafileFromDelegate_linux_ptr.Delegate(getHeader, getBytes, putBytes, doSeek, close, size, out metafile); private delegate Status GdipGetMetafileHeaderFromDelegate_linux_delegate(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr header); private static FunctionWrapper<GdipGetMetafileHeaderFromDelegate_linux_delegate> GdipGetMetafileHeaderFromDelegate_linux_ptr; internal static Status GdipGetMetafileHeaderFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr header) => GdipGetMetafileHeaderFromDelegate_linux_ptr.Delegate(getHeader, getBytes, putBytes, doSeek, close, size, header); private delegate Status GdipRecordMetafileFromDelegate_linux_delegate(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)] string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileFromDelegate_linux_delegate> GdipRecordMetafileFromDelegate_linux_ptr; internal static Status GdipRecordMetafileFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFromDelegate_linux_ptr.Delegate(getHeader, getBytes, putBytes, doSeek, close, size, hdc, type, ref frameRect, frameUnit, description, out metafile); private delegate Status GdipRecordMetafileFromDelegateI_linux_delegate(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)] string description, out IntPtr metafile); private static FunctionWrapper<GdipRecordMetafileFromDelegateI_linux_delegate> GdipRecordMetafileFromDelegateI_linux_ptr; internal static Status GdipRecordMetafileFromDelegateI_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFromDelegateI_linux_ptr.Delegate(getHeader, getBytes, putBytes, doSeek, close, size, hdc, type, ref frameRect, frameUnit, description, out metafile); } } // These are unix-only internal delegate int StreamGetHeaderDelegate(IntPtr buf, int bufsz); internal delegate int StreamGetBytesDelegate(IntPtr buf, int bufsz, bool peek); internal delegate long StreamSeekDelegate(int offset, int whence); internal delegate int StreamPutBytesDelegate(IntPtr buf, int bufsz); internal delegate void StreamCloseDelegate(); internal delegate long StreamSizeDelegate(); }
101.716513
462
0.773437
[ "MIT" ]
harunpehlivan/corefx
src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs
254,395
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SalesReport")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SalesReport")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("10cab81c-232a-4170-aad4-87fb4bd38e40")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.567568
84
0.747482
[ "MIT" ]
StefanLB/Programming-Fundamentals---September-2017
19. Objects and Classes - Lab/SalesReport/Properties/AssemblyInfo.cs
1,393
C#
#pragma warning disable 108 // new keyword hiding #pragma warning disable 114 // new keyword hiding namespace Windows.System.RemoteSystems { #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented] #endif public enum RemoteSystemAuthorizationKind { #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ SameUser, #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ Anonymous, #endif } #endif }
34.1
99
0.727273
[ "Apache-2.0" ]
Abhishek-Sharma-Msft/uno
src/Uno.UWP/Generated/3.0.0.0/Windows.System.RemoteSystems/RemoteSystemAuthorizationKind.cs
682
C#
/* * Nz.Framework * Author Paulo Eduardo Nazeazeno * https://github.com/paulonz/Nz.Framework */ namespace Nz.Api.Auth.Extensions { using Microsoft.Extensions.DependencyInjection; using Nz.Core.Business.Impl.Auth; using Nz.Core.DatabaseContext; using Nz.Core.DatabaseContext.Impl.Auth; using Nz.Core.Service.Impl.Auth; /// <summary> /// Extensões para configuração de dependências /// </summary> internal static class DependencyExtensions { /// <summary> /// Extensão para configurar dependencias /// </summary> /// <param name="services">Serviços</param> /// <returns>Serviços</returns> internal static IServiceCollection ConfigureLocalDependenciesService( this IServiceCollection services) { // Camada Service services.AddScoped<IAuthService, AuthService>(); services.AddScoped<IManageUsersService, ManageUsersService>(); services.AddScoped<IMeService, MeService>(); services.AddScoped<IUserService, UserService>(); // Camada Business services.AddScoped<IAuthBusiness, AuthBusiness>(); services.AddScoped<IMeBusiness, MeBusiness>(); services.AddScoped<IUserBusiness, UserBusiness>(); // Camada Data services.AddScoped<IDbContextSettings, DbContextSettings>(); services.AddScoped<IDbContext, PrincipalContext>(); return services; } } }
31.729167
77
0.64281
[ "Apache-2.0" ]
paulonz/Nz.Framework
Src/Api/Auth/Nz.Api.Auth/Extensions/DependencyExtensions.cs
1,532
C#
/* * Copyright 2012-2017 The Pkcs11Interop Project * * 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. */ /* * Written for the Pkcs11Interop project by: * Jaroslav IMRICH <jimrich@jimrich.sk> */ using System; using System.Collections.Generic; using Net.Pkcs11Interop.Common; using Net.Pkcs11Interop.LowLevelAPI81; using Net.Pkcs11Interop.LowLevelAPI81.MechanismParams; using NativeULong = System.UInt64; namespace Net.Pkcs11Interop.HighLevelAPI81.MechanismParams { /// <summary> /// Parameters returned by all OTP mechanisms in successful calls to Sign method /// </summary> public class CkOtpSignatureInfo : IDisposable { /// <summary> /// Flag indicating whether instance has been disposed /// </summary> private bool _disposed = false; /// <summary> /// Low level mechanism parameters /// </summary> private CK_OTP_SIGNATURE_INFO _lowLevelStruct = new CK_OTP_SIGNATURE_INFO(); /// <summary> /// Flag indicating whether high level list of OTP parameters left this instance /// </summary> private bool _paramsLeftInstance = false; /// <summary> /// List of OTP parameters /// </summary> private List<CkOtpParam> _params = new List<CkOtpParam>(); /// <summary> /// List of OTP parameters /// </summary> public IList<CkOtpParam> Params { get { if (this._disposed) throw new ObjectDisposedException(this.GetType().FullName); // Since now it is the caller's responsibility to dispose parameters _paramsLeftInstance = true; return _params.AsReadOnly(); } } /// <summary> /// Initializes a new instance of the CkOtpSignatureInfo class. /// </summary> /// <param name='signature'>Signature value returned by all OTP mechanisms in successful calls to Sign method</param> public CkOtpSignatureInfo(byte[] signature) { if (signature == null) throw new ArgumentNullException("signature"); // PKCS#11 v2.20a1 page 14: // Since C_Sign and C_SignFinal follows the convention described in Section 11.2 of [1] // on producing output, a call to C_Sign (or C_SignFinal) with pSignature set to // NULL_PTR will return (in the pulSignatureLen parameter) the required number of bytes // to hold the CK_OTP_SIGNATURE_INFO structure as well as all the data in all its // CK_OTP_PARAM components. If an application allocates a memory block based on this // information, it shall therefore not subsequently de-allocate components of such a received // value but rather de-allocate the complete CK_OTP_PARAMS structure itself. A // Cryptoki library that is called with a non-NULL pSignature pointer will assume that it // points to a contiguous memory block of the size indicated by the pulSignatureLen // parameter. // Create CK_OTP_SIGNATURE_INFO from C_Sign or C_SignFinal output // TODO : This may require different low level delegate with IntPtr as output // but currently I am not aware of any implementation I could test with. IntPtr tmpSignature = IntPtr.Zero; try { tmpSignature = UnmanagedMemory.Allocate(signature.Length); UnmanagedMemory.Write(tmpSignature, signature); UnmanagedMemory.Read(tmpSignature, _lowLevelStruct); } finally { UnmanagedMemory.Free(ref tmpSignature); } // Read all CK_OTP_PARAMs from CK_OTP_SIGNATURE_INFO int ckOtpParamSize = UnmanagedMemory.SizeOf(typeof(CK_OTP_PARAM)); for (int i = 0; i < NativeLongUtils.ConvertToInt32(_lowLevelStruct.Count); i++) { // Read CK_OTP_PARAM from CK_OTP_SIGNATURE_INFO IntPtr tempPointer = new IntPtr(_lowLevelStruct.Params.ToInt64() + (i * ckOtpParamSize)); CK_OTP_PARAM ckOtpParam = new CK_OTP_PARAM(); UnmanagedMemory.Read(tempPointer, ckOtpParam); // Read members of CK_OTP_PARAM structure NativeULong ckOtpParamType = ckOtpParam.Type; byte[] ckOtpParamValue = UnmanagedMemory.Read(ckOtpParam.Value, NativeLongUtils.ConvertToInt32(ckOtpParam.ValueLen)); // Construct new high level CkOtpParam object (creates copy of CK_OTP_PARAM structure which is good) _params.Add(new CkOtpParam(ckOtpParamType, ckOtpParamValue)); } } #region IDisposable /// <summary> /// Disposes object /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } /// <summary> /// Disposes object /// </summary> /// <param name="disposing">Flag indicating whether managed resources should be disposed</param> protected virtual void Dispose(bool disposing) { if (!this._disposed) { if (disposing) { // Dispose managed objects if (_paramsLeftInstance == false) { for (int i = 0; i < _params.Count; i++) { if (_params[i] != null) { _params[i].Dispose(); _params[i] = null; } } } } // Dispose unmanaged objects _disposed = true; } } /// <summary> /// Class destructor that disposes object if caller forgot to do so /// </summary> ~CkOtpSignatureInfo() { Dispose(false); } #endregion } }
38.08427
133
0.579436
[ "Apache-2.0" ]
arkkadin/pkcs11Interop
src/Pkcs11Interop/Pkcs11Interop/HighLevelAPI81/MechanismParams/CkOtpSignatureInfo.cs
6,779
C#
using System; namespace chapter09.lib.Helpers { public static class HashingExtension { public static string ToSHA1(this byte[] data) { var sha1 = System.Security.Cryptography.SHA1.Create(); var hash = sha1.ComputeHash(data); return Convert.ToBase64String(hash); } } }
21.4375
66
0.606414
[ "MIT" ]
PacktPublishing/Hands-On-Machine-Learning-With-ML.NET
chapter09/chapter09.lib/Helpers/HashingExtension.cs
345
C#
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Robock.Background")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Robock.Background")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] //ローカライズ可能なアプリケーションのビルドを開始するには、 //.csproj ファイルの <UICulture>CultureYouAreCodingWith</UICulture> を //<PropertyGroup> 内部で設定します。たとえば、 //ソース ファイルで英語を使用している場合、<UICulture> を en-US に設定します。次に、 //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 //(リソースがページ、 //またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 //(リソースがページ、 //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) )] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
33.232143
100
0.707684
[ "MIT" ]
mika-f/Robock
Source/Robock.Background/Properties/AssemblyInfo.cs
2,956
C#
using System.Threading.Tasks; using CollabAssist.Incoming.Models; namespace CollabAssist.Incoming.DevOps.Client { public interface IDevOpsClient { Task<string> GetPullRequestMetaData(PullRequest pr, string key); Task<bool> StorePullRequestMetadata(PullRequest pr, string key, string data); Task<Build> LinkBuildWithPr(Build build); Task<Build> FillPullRequestMetadataFromUrl(Build build); } }
29.333333
85
0.740909
[ "MIT" ]
Dyllaann/CollabAssist
src/CollabAssist.Incoming.DevOps/Client/IDevOpsClient.cs
442
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using CsSystem = System; using Fox; namespace Fox.Core { public partial class UInt16StringMapPropertyDifference : Fox.Core.PropertyDifference { // Properties public Fox.Core.StringMap<ushort> originalValues = new Fox.Core.StringMap<ushort>(); public Fox.Core.StringMap<ushort> values = new Fox.Core.StringMap<ushort>(); // PropertyInfo private static Fox.EntityInfo classInfo; public static new Fox.EntityInfo ClassInfo { get { return classInfo; } } public override Fox.EntityInfo GetClassEntityInfo() { return classInfo; } static UInt16StringMapPropertyDifference() { classInfo = new Fox.EntityInfo("UInt16StringMapPropertyDifference", new Fox.Core.PropertyDifference(0, 0, 0).GetClassEntityInfo(), 0, null, 0); classInfo.StaticProperties.Insert("originalValues", new Fox.Core.PropertyInfo(Fox.Core.PropertyInfo.PropertyType.UInt16, 72, 1, Fox.Core.PropertyInfo.ContainerType.StringMap, Fox.Core.PropertyInfo.PropertyExport.EditorOnly, Fox.Core.PropertyInfo.PropertyExport.EditorOnly, null, null, Fox.Core.PropertyInfo.PropertyStorage.Instance)); classInfo.StaticProperties.Insert("values", new Fox.Core.PropertyInfo(Fox.Core.PropertyInfo.PropertyType.UInt16, 120, 1, Fox.Core.PropertyInfo.ContainerType.StringMap, Fox.Core.PropertyInfo.PropertyExport.EditorOnly, Fox.Core.PropertyInfo.PropertyExport.EditorOnly, null, null, Fox.Core.PropertyInfo.PropertyStorage.Instance)); } // Constructor public UInt16StringMapPropertyDifference(ulong address, ushort idA, ushort idB) : base(address, idA, idB) { } public override void SetProperty(string propertyName, Fox.Value value) { switch(propertyName) { default: base.SetProperty(propertyName, value); return; } } public override void SetPropertyElement(string propertyName, ushort index, Fox.Value value) { switch(propertyName) { default: base.SetPropertyElement(propertyName, index, value); return; } } public override void SetPropertyElement(string propertyName, string key, Fox.Value value) { switch(propertyName) { case "originalValues": this.originalValues.Insert(key, value.GetValueAsUInt16()); return; case "values": this.values.Insert(key, value.GetValueAsUInt16()); return; default: base.SetPropertyElement(propertyName, key, value); return; } } } }
39.411765
337
0.57791
[ "MIT" ]
Joey35233/FoxKit-3
FoxKit/Assets/FoxKit/Fox/Generated/Fox/Core/UInt16StringMapPropertyDifference.generated.cs
3,350
C#
using System; using System.Collections.Generic; using System.Linq; namespace ListExample { class Cliente { public string Nome { get; set; } public string CPF { get; set; } public override string ToString() { return $"NOME: {Nome}"; } } class Program { static void Main(string[] args) { var c1 = new Cliente { Nome = "Flávio", CPF = "123" }; var c2 = new Cliente { Nome = "Fernando", CPF = "456" }; var lista = new List<Cliente> { c1, c2 }; foreach (var item in lista) { Console.WriteLine(item); } var cliente = lista.FirstOrDefault((c) => c.CPF == "123"); Console.WriteLine(cliente); Console.ReadKey(); } } }
25.30303
70
0.494611
[ "MIT" ]
flaviogf/Cursos
geral/curso_devmedia_csharp/ListExample/Program.cs
838
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ModernUI.Windows.Navigation { /// <summary> /// Identifies the types of navigation that are supported. /// </summary> public enum NavigationType { /// <summary> /// Navigating to new content. /// </summary> New, /// <summary> /// Navigating back in the back navigation history. /// </summary> Back, /// <summary> /// Reloading the current content. /// </summary> Refresh } }
23.214286
63
0.549231
[ "MIT" ]
chuongmep/ModernUI
Genew.ModernUI/Genew.ModernUI/Windows/Navigation/NavigationType.cs
652
C#