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 YourWaifuWPF.Services { using System; using System.Collections.Generic; using System.Linq; using Contracts.Services; using Helpers; using Microsoft.UI.Xaml.Controls; public class NavigationViewService : INavigationViewService { private readonly INavigationService navigationService; private readonly IPageService pageService; private NavigationView navigationView; public IList<object> MenuItems => navigationView.MenuItems; public object SettingsItem => navigationView.SettingsItem; public NavigationViewService(INavigationService navigationService, IPageService pageService) { this.navigationService = navigationService; this.pageService = pageService; } public void Initialize(NavigationView navigationView) { this.navigationView = navigationView; this.navigationView.BackRequested += OnBackRequested; this.navigationView.ItemInvoked += OnItemInvoked; } public void UnregisterEvents() { navigationView.BackRequested -= OnBackRequested; navigationView.ItemInvoked -= OnItemInvoked; } public NavigationViewItem GetSelectedItem(Type pageType) => GetSelectedItem(navigationView.MenuItems, pageType); private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) => navigationService.GoBack(); private void OnItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) { if (args.IsSettingsInvoked) { // Navigate to the settings page - implement as appropriate if needed } else { var selectedItem = args.InvokedItemContainer as NavigationViewItem; var pageKey = selectedItem.GetValue(NavHelper.NavigateToProperty) as string; if (pageKey != null) { navigationService.NavigateTo(pageKey); } } } private NavigationViewItem GetSelectedItem(IEnumerable<object> menuItems, Type pageType) { foreach (var item in menuItems.OfType<NavigationViewItem>()) { if (IsMenuItemForPageType(item, pageType)) { return item; } var selectedChild = GetSelectedItem(item.MenuItems, pageType); if (selectedChild != null) { return selectedChild; } } return null; } private bool IsMenuItemForPageType(NavigationViewItem menuItem, Type sourcePageType) { var pageKey = menuItem.GetValue(NavHelper.NavigateToProperty) as string; if (pageKey != null) { return pageService.GetPageType(pageKey) == sourcePageType; } return false; } } }
36.85
102
0.63365
[ "MIT" ]
Aloento/Waifu2x-Vulkan-Reunion
YourWaifuWPF/Services/NavigationViewService.cs
2,948
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Mediachase.Ibn.Web.UI.ListApp.Pages { /// <summary> /// ListInfoMove class. /// </summary> /// <remarks> /// Auto-generated class. /// </remarks> public partial class ListInfoMove { /// <summary> /// pT control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::Mediachase.UI.Web.Modules.DialogTemplateNextNew pT; } }
29.8125
84
0.484277
[ "MIT" ]
InstantBusinessNetwork/IBN
Source/Server/WebPortal/Apps/ListApp/Pages/ListInfoMove.aspx.designer.cs
954
C#
using System; using UnityEngine; using UdonSharp; public class MapStratum : UdonSharpBehaviour { public int nTilesX; public int nTilesY; public Mesh[] library; public MeshFilter rendererFilter; /** Implementation */ private int maskX; private int maskY; public int[] map; /* FIXME : * I'm making this public since the Garbage Collector will * try to actively remove Mesh References referenced here * when set to private. * So I'm trying to put the whole collection as "public" * in order to stop the GC from collecting the data there. * We'll see if this works though.. */ public CombineInstance[] stratumCombiner; public Mesh currentSelection; public CombineInstance[] combineCopy; private Matrix4x4 positionZero; private CombineInstance[] libraryDisplay; private int currentMeshIndex = 0; private int currentTextureIndex = 0; private int currentOrientation = 0; private Matrix4x4 currentRotation; private Vector3 position; const int orientationMask = 7; private int currentTileValue = 0; private Mesh currentBakedMesh; private int lastTileSet = -1; Mesh CopyMesh(Mesh meshToCopy) { CombineInstance ci = combineCopy[0]; ci.mesh = meshToCopy; combineCopy[0] = ci; Mesh newMesh = new Mesh(); newMesh.CombineMeshes(combineCopy); return newMesh; } void InitializeMap() { map = new int[nTilesX * nTilesY]; int map_size = map.Length; for (int i = 0; i < map_size; i++) { map[i] = 0; } } void InitializeCombiner() { int map_size = map.Length; stratumCombiner = new CombineInstance[map_size]; for (int i = 0; i < map_size; i++) { CombineInstance tileData = stratumCombiner[i]; tileData.mesh = library[0]; tileData.transform = positionZero; stratumCombiner[i] = tileData; } /* FIXME * This only works with power of 2 aligned values ! * However maskX and maskY are not automatically * aligned on power of 2 values ! */ maskX = nTilesX - 1; maskY = nTilesY - 1; } public void Start() { nTilesX = (nTilesX > 0 ? nTilesX : 8); nTilesY = (nTilesY > 0 ? nTilesY : 8); currentSelection = new Mesh(); position = new Vector3(0,0,0); positionZero = Matrix4x4.Translate(position); currentRotation = Matrix4x4.Rotate(Quaternion.identity); combineCopy = new CombineInstance[1]; CombineInstance copyValue = combineCopy[0]; copyValue.transform = positionZero; combineCopy[0] = copyValue; if (library == null || library.Length < 1) { Debug.LogError("MapStratum - Passed an empty library"); library = new Mesh[1]; } library[0] = new Mesh(); InitializeMap(); InitializeCombiner(); BakeMesh(); SetSelectionMeshIndex(1); /* FIXME Get this out. The map stratum shouldn't maange inventory display */ displayMesh = new Mesh(); InitializeLibraryDisplay(); } public Mesh displayMesh; /* FIXME Get this out. The map stratum shouldn't maange inventory display */ void InitializeLibraryDisplay() { libraryDisplay = new CombineInstance[library.Length]; for (int i = 0; i < library.Length; i++) { Mesh m = library[i]; CombineInstance ci = new CombineInstance(); ci.mesh = m; int pos = (i & 7); Vector3 position = new Vector3(pos * 1.75f, 0, (i / 8)); Debug.Log($"{pos}"); ci.transform = Matrix4x4.Translate(position); libraryDisplay[i] = ci; } displayMesh = new Mesh(); displayMesh.CombineMeshes(libraryDisplay); } void BakeMesh() { Mesh mesh = new Mesh(); mesh.CombineMeshes(stratumCombiner); rendererFilter.sharedMesh = mesh; currentBakedMesh = mesh; } public void SetupMeshForTextureIndex(int textureIndex) { Mesh newMesh = CopyMesh(currentSelection); Color32[] colors = new Color32[newMesh.vertices.Length]; int colorsCount = colors.Length; for (int i = 0; i < colorsCount; i++) { Color32 color = colors[i]; color.r = (byte) textureIndex; colors[i] = color; } newMesh.colors32 = colors; currentSelection = newMesh; currentTextureIndex = textureIndex; ComputeTileValue(); } public void SetSelectionMeshIndex(int meshIndex) { int usedIndex = Mathf.Min(meshIndex, library.Length-1); currentSelection = CopyMesh(library[usedIndex]); currentMeshIndex = usedIndex; SetupMeshForTextureIndex(currentTextureIndex); ComputeTileValue(); } public void SetOrientation(int orientation45deg) { currentOrientation = (orientation45deg & orientationMask); int degrees = (currentOrientation * 45); currentRotation = Matrix4x4.Rotate(Quaternion.Euler(0,degrees,0)); ComputeTileValue(); } public void NextOrientation() { SetOrientation(currentOrientation + 2); } public void PreviousOrientation() { SetOrientation(currentOrientation - 2); } void ComputeTileValue() { currentTileValue = ( currentOrientation << 16 | currentTextureIndex << 08 | currentMeshIndex << 00 ); } public bool SetTile(int x, int y) { int actual_x = Mathf.Clamp(x, 0, nTilesX - 1); int actual_y = Mathf.Clamp(y, 0, nTilesY - 1); int linear_position = actual_y * nTilesX + actual_x; if (lastTileSet == linear_position) { return false; } map[linear_position] = currentTileValue; position.x = actual_x; position.z = actual_y; CombineInstance tileDefinition = stratumCombiner[linear_position]; tileDefinition.mesh = currentSelection; tileDefinition.transform = Matrix4x4.Translate(position) * currentRotation; stratumCombiner[linear_position] = tileDefinition; return true; } public void SetTileAndBake(int x, int y) { if (SetTile(x, y)) { BakeMesh(); } } }
25.867704
84
0.588448
[ "MIT" ]
vr-voyage/vrchat-map-maker
Assets/MapMaker/Scripts/MapStratum.cs
6,648
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. using System; using System.Collections; using System.Diagnostics; using System.Threading; using System.Windows.Forms; using System.Xml; using System.Web; using System.Net; using OpenLiveWriter.Api; using OpenLiveWriter.Controls; using OpenLiveWriter.CoreServices; using OpenLiveWriter.Extensibility.BlogClient; using OpenLiveWriter.Localization; namespace OpenLiveWriter.BlogClient.Clients { /// <summary> /// Summary description for BloggerCompatibleClient. /// </summary> public abstract class BloggerCompatibleClient : XmlRpcBlogClient { public BloggerCompatibleClient(Uri postApiUrl, IBlogCredentialsAccessor credentials) : base(postApiUrl, credentials) { } protected override void VerifyCredentials(TransientCredentials tc) { try { GetUsersBlogs(tc.Username, tc.Password); return; } catch(BlogClientAuthenticationException) { throw; } catch(Exception e) { if(!BlogClientUIContext.SilentModeForCurrentThread) ShowError(e.Message); throw; } } private void ShowError(string error) { ShowErrorHelper helper = new ShowErrorHelper(BlogClientUIContext.ContextForCurrentThread, MessageId.UnexpectedErrorLogin, new object[] {error}); if (BlogClientUIContext.ContextForCurrentThread != null) BlogClientUIContext.ContextForCurrentThread.Invoke(new ThreadStart(helper.Show), null); else helper.Show(); } private class ShowErrorHelper { private readonly IWin32Window _owner; private readonly MessageId _messageId; private readonly object[] _args; public ShowErrorHelper(IWin32Window owner, MessageId messageId, object[] args) { _owner = owner; _messageId = messageId; _args = args; } public void Show() { DisplayMessage.Show(_messageId, _owner, _args); } } public override BlogInfo[] GetUsersBlogs() { TransientCredentials tc = Login(); return GetUsersBlogs(tc.Username, tc.Password); } private BlogInfo[] GetUsersBlogs(string username, string password) { // call method XmlNode result = CallMethod( "blogger.getUsersBlogs", new XmlRpcString( APP_KEY ), new XmlRpcString( username ), new XmlRpcString( password, true ) ) ; try { // parse results ArrayList blogs = new ArrayList() ; XmlNodeList blogNodes = result.SelectNodes( "array/data/value/struct" ) ; foreach ( XmlNode blogNode in blogNodes ) { // get node values XmlNode idNode = blogNode.SelectSingleNode("member[name='blogid']/value") ; XmlNode nameNode = blogNode.SelectSingleNode("member[name='blogName']/value") ; XmlNode urlNode = blogNode.SelectSingleNode("member[name='url']/value") ; // add to our list of blogs blogs.Add(new BlogInfo(idNode.InnerText, HttpUtility.HtmlDecode(NodeToText(nameNode)), urlNode.InnerText)); } // return list of blogs return (BlogInfo[])blogs.ToArray(typeof(BlogInfo)) ; } catch( Exception ex ) { string response = result != null ? result.OuterXml : "(empty response)" ; Trace.Fail( "Exception occurred while parsing GetUsersBlogs response: " + response + "\r\n" + ex.ToString() ) ; throw new BlogClientInvalidServerResponseException( "blogger.getUsersBlogs", ex.Message, response ) ; } } protected virtual string NodeToText(XmlNode node) { return node.InnerText; } public override void DeletePost( string blogId, string postId, bool publish ) { TransientCredentials tc = Login(); XmlNode result = CallMethod( "blogger.deletePost", new XmlRpcString( APP_KEY ), new XmlRpcString( postId ), new XmlRpcString( tc.Username ), new XmlRpcString( tc.Password, true ), new XmlRpcBoolean( publish ) ) ; } protected const string APP_KEY = "0123456789ABCDEF" ; } }
28.048951
130
0.700573
[ "MIT" ]
augustoproiete-forks/OpenLiveWriter--OpenLiveWriter
src/managed/OpenLiveWriter.BlogClient/Clients/BloggerCompatibleClient.cs
4,011
C#
//------------------------------------------------------------------------------ // <auto-generated> // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:4.0.30319.42000 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. // </auto-generated> //------------------------------------------------------------------------------ using NMF.Collections.Generic; using NMF.Collections.ObjectModel; using NMF.Expressions; using NMF.Expressions.Linq; using NMF.Models; using NMF.Models.Collections; using NMF.Models.Expressions; using NMF.Models.Meta; using NMF.Models.Repository; using NMF.Serialization; using NMF.Utilities; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Linq; using TTC2017.SmartGrids.SubstationStandard.Dataclasses; using TTC2017.SmartGrids.SubstationStandard.Enumerations; using TTC2017.SmartGrids.SubstationStandard.LNNodes.DomainLNs; using TTC2017.SmartGrids.SubstationStandard.LNNodes.LNGroupA; namespace TTC2017.SmartGrids.SubstationStandard.LNNodes.LNGroupY { /// <summary> /// The default implementation of the YPSH class /// </summary> [XmlNamespaceAttribute("http://www.transformation-tool-contest.eu/2017/smartGrids/substationStandard/grou" + "pY")] [XmlNamespacePrefixAttribute("groupy")] [ModelRepresentationClassAttribute("http://www.transformation-tool-contest.eu/2017/smartGrids/substationStandard#//LN" + "Nodes/LNGroupY/YPSH")] public partial class YPSH : TTC2017.SmartGrids.SubstationStandard.LNNodes.LNGroupY.GroupY, IYPSH, IModelElement { /// <summary> /// The backing field for the ShOpCap property /// </summary> private Nullable<SwitchingCapabilityKind> _shOpCap; private static Lazy<ITypedElement> _shOpCapAttribute = new Lazy<ITypedElement>(RetrieveShOpCapAttribute); /// <summary> /// The backing field for the MaxOpCap property /// </summary> private Nullable<SwitchingCapabilityKind> _maxOpCap; private static Lazy<ITypedElement> _maxOpCapAttribute = new Lazy<ITypedElement>(RetrieveMaxOpCapAttribute); private static Lazy<ITypedElement> _opTmhReference = new Lazy<ITypedElement>(RetrieveOpTmhReference); /// <summary> /// The backing field for the OpTmh property /// </summary> private IINS _opTmh; private static Lazy<ITypedElement> _posReference = new Lazy<ITypedElement>(RetrievePosReference); /// <summary> /// The backing field for the Pos property /// </summary> private IDPC _pos; private static Lazy<ITypedElement> _blkOpnReference = new Lazy<ITypedElement>(RetrieveBlkOpnReference); /// <summary> /// The backing field for the BlkOpn property /// </summary> private ISPC _blkOpn; private static Lazy<ITypedElement> _blkClsReference = new Lazy<ITypedElement>(RetrieveBlkClsReference); /// <summary> /// The backing field for the BlkCls property /// </summary> private ISPC _blkCls; private static Lazy<ITypedElement> _chaMotEnaReference = new Lazy<ITypedElement>(RetrieveChaMotEnaReference); /// <summary> /// The backing field for the ChaMotEna property /// </summary> private ISPC _chaMotEna; private static IClass _classInstance; /// <summary> /// The ShOpCap property /// </summary> [XmlAttributeAttribute(true)] public virtual Nullable<SwitchingCapabilityKind> ShOpCap { get { return this._shOpCap; } set { if ((this._shOpCap != value)) { Nullable<SwitchingCapabilityKind> old = this._shOpCap; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnShOpCapChanging(e); this.OnPropertyChanging("ShOpCap", e, _shOpCapAttribute); this._shOpCap = value; this.OnShOpCapChanged(e); this.OnPropertyChanged("ShOpCap", e, _shOpCapAttribute); } } } /// <summary> /// The MaxOpCap property /// </summary> [XmlAttributeAttribute(true)] public virtual Nullable<SwitchingCapabilityKind> MaxOpCap { get { return this._maxOpCap; } set { if ((this._maxOpCap != value)) { Nullable<SwitchingCapabilityKind> old = this._maxOpCap; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnMaxOpCapChanging(e); this.OnPropertyChanging("MaxOpCap", e, _maxOpCapAttribute); this._maxOpCap = value; this.OnMaxOpCapChanged(e); this.OnPropertyChanged("MaxOpCap", e, _maxOpCapAttribute); } } } /// <summary> /// The OpTmh property /// </summary> [XmlAttributeAttribute(true)] public virtual IINS OpTmh { get { return this._opTmh; } set { if ((this._opTmh != value)) { IINS old = this._opTmh; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnOpTmhChanging(e); this.OnPropertyChanging("OpTmh", e, _opTmhReference); this._opTmh = value; if ((old != null)) { old.Deleted -= this.OnResetOpTmh; } if ((value != null)) { value.Deleted += this.OnResetOpTmh; } this.OnOpTmhChanged(e); this.OnPropertyChanged("OpTmh", e, _opTmhReference); } } } /// <summary> /// The Pos property /// </summary> [XmlAttributeAttribute(true)] public virtual IDPC Pos { get { return this._pos; } set { if ((this._pos != value)) { IDPC old = this._pos; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnPosChanging(e); this.OnPropertyChanging("Pos", e, _posReference); this._pos = value; if ((old != null)) { old.Deleted -= this.OnResetPos; } if ((value != null)) { value.Deleted += this.OnResetPos; } this.OnPosChanged(e); this.OnPropertyChanged("Pos", e, _posReference); } } } /// <summary> /// The BlkOpn property /// </summary> [XmlAttributeAttribute(true)] public virtual ISPC BlkOpn { get { return this._blkOpn; } set { if ((this._blkOpn != value)) { ISPC old = this._blkOpn; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnBlkOpnChanging(e); this.OnPropertyChanging("BlkOpn", e, _blkOpnReference); this._blkOpn = value; if ((old != null)) { old.Deleted -= this.OnResetBlkOpn; } if ((value != null)) { value.Deleted += this.OnResetBlkOpn; } this.OnBlkOpnChanged(e); this.OnPropertyChanged("BlkOpn", e, _blkOpnReference); } } } /// <summary> /// The BlkCls property /// </summary> [XmlAttributeAttribute(true)] public virtual ISPC BlkCls { get { return this._blkCls; } set { if ((this._blkCls != value)) { ISPC old = this._blkCls; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnBlkClsChanging(e); this.OnPropertyChanging("BlkCls", e, _blkClsReference); this._blkCls = value; if ((old != null)) { old.Deleted -= this.OnResetBlkCls; } if ((value != null)) { value.Deleted += this.OnResetBlkCls; } this.OnBlkClsChanged(e); this.OnPropertyChanged("BlkCls", e, _blkClsReference); } } } /// <summary> /// The ChaMotEna property /// </summary> [XmlAttributeAttribute(true)] public virtual ISPC ChaMotEna { get { return this._chaMotEna; } set { if ((this._chaMotEna != value)) { ISPC old = this._chaMotEna; ValueChangedEventArgs e = new ValueChangedEventArgs(old, value); this.OnChaMotEnaChanging(e); this.OnPropertyChanging("ChaMotEna", e, _chaMotEnaReference); this._chaMotEna = value; if ((old != null)) { old.Deleted -= this.OnResetChaMotEna; } if ((value != null)) { value.Deleted += this.OnResetChaMotEna; } this.OnChaMotEnaChanged(e); this.OnPropertyChanged("ChaMotEna", e, _chaMotEnaReference); } } } /// <summary> /// Gets the referenced model elements of this model element /// </summary> public override IEnumerableExpression<IModelElement> ReferencedElements { get { return base.ReferencedElements.Concat(new YPSHReferencedElementsCollection(this)); } } /// <summary> /// Gets the Class model for this type /// </summary> public new static IClass ClassInstance { get { if ((_classInstance == null)) { _classInstance = ((IClass)(MetaRepository.Instance.Resolve("http://www.transformation-tool-contest.eu/2017/smartGrids/substationStandard#//LN" + "Nodes/LNGroupY/YPSH"))); } return _classInstance; } } /// <summary> /// Gets fired before the ShOpCap property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> ShOpCapChanging; /// <summary> /// Gets fired when the ShOpCap property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> ShOpCapChanged; /// <summary> /// Gets fired before the MaxOpCap property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> MaxOpCapChanging; /// <summary> /// Gets fired when the MaxOpCap property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> MaxOpCapChanged; /// <summary> /// Gets fired before the OpTmh property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> OpTmhChanging; /// <summary> /// Gets fired when the OpTmh property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> OpTmhChanged; /// <summary> /// Gets fired before the Pos property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> PosChanging; /// <summary> /// Gets fired when the Pos property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> PosChanged; /// <summary> /// Gets fired before the BlkOpn property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> BlkOpnChanging; /// <summary> /// Gets fired when the BlkOpn property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> BlkOpnChanged; /// <summary> /// Gets fired before the BlkCls property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> BlkClsChanging; /// <summary> /// Gets fired when the BlkCls property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> BlkClsChanged; /// <summary> /// Gets fired before the ChaMotEna property changes its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> ChaMotEnaChanging; /// <summary> /// Gets fired when the ChaMotEna property changed its value /// </summary> public event System.EventHandler<ValueChangedEventArgs> ChaMotEnaChanged; private static ITypedElement RetrieveShOpCapAttribute() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("ShOpCap"))); } /// <summary> /// Raises the ShOpCapChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnShOpCapChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.ShOpCapChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the ShOpCapChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnShOpCapChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.ShOpCapChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } private static ITypedElement RetrieveMaxOpCapAttribute() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("MaxOpCap"))); } /// <summary> /// Raises the MaxOpCapChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnMaxOpCapChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.MaxOpCapChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the MaxOpCapChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnMaxOpCapChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.MaxOpCapChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } private static ITypedElement RetrieveOpTmhReference() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("OpTmh"))); } /// <summary> /// Raises the OpTmhChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnOpTmhChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.OpTmhChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the OpTmhChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnOpTmhChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.OpTmhChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Handles the event that the OpTmh property must reset /// </summary> /// <param name="sender">The object that sent this reset request</param> /// <param name="eventArgs">The event data for the reset event</param> private void OnResetOpTmh(object sender, System.EventArgs eventArgs) { this.OpTmh = null; } private static ITypedElement RetrievePosReference() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("Pos"))); } /// <summary> /// Raises the PosChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnPosChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.PosChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the PosChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnPosChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.PosChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Handles the event that the Pos property must reset /// </summary> /// <param name="sender">The object that sent this reset request</param> /// <param name="eventArgs">The event data for the reset event</param> private void OnResetPos(object sender, System.EventArgs eventArgs) { this.Pos = null; } private static ITypedElement RetrieveBlkOpnReference() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("BlkOpn"))); } /// <summary> /// Raises the BlkOpnChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnBlkOpnChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.BlkOpnChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the BlkOpnChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnBlkOpnChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.BlkOpnChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Handles the event that the BlkOpn property must reset /// </summary> /// <param name="sender">The object that sent this reset request</param> /// <param name="eventArgs">The event data for the reset event</param> private void OnResetBlkOpn(object sender, System.EventArgs eventArgs) { this.BlkOpn = null; } private static ITypedElement RetrieveBlkClsReference() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("BlkCls"))); } /// <summary> /// Raises the BlkClsChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnBlkClsChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.BlkClsChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the BlkClsChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnBlkClsChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.BlkClsChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Handles the event that the BlkCls property must reset /// </summary> /// <param name="sender">The object that sent this reset request</param> /// <param name="eventArgs">The event data for the reset event</param> private void OnResetBlkCls(object sender, System.EventArgs eventArgs) { this.BlkCls = null; } private static ITypedElement RetrieveChaMotEnaReference() { return ((ITypedElement)(((ModelElement)(YPSH.ClassInstance)).Resolve("ChaMotEna"))); } /// <summary> /// Raises the ChaMotEnaChanging event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnChaMotEnaChanging(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.ChaMotEnaChanging; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Raises the ChaMotEnaChanged event /// </summary> /// <param name="eventArgs">The event data</param> protected virtual void OnChaMotEnaChanged(ValueChangedEventArgs eventArgs) { System.EventHandler<ValueChangedEventArgs> handler = this.ChaMotEnaChanged; if ((handler != null)) { handler.Invoke(this, eventArgs); } } /// <summary> /// Handles the event that the ChaMotEna property must reset /// </summary> /// <param name="sender">The object that sent this reset request</param> /// <param name="eventArgs">The event data for the reset event</param> private void OnResetChaMotEna(object sender, System.EventArgs eventArgs) { this.ChaMotEna = null; } /// <summary> /// Resolves the given attribute name /// </summary> /// <returns>The attribute value or null if it could not be found</returns> /// <param name="attribute">The requested attribute name</param> /// <param name="index">The index of this attribute</param> protected override object GetAttributeValue(string attribute, int index) { if ((attribute == "SHOPCAP")) { return this.ShOpCap; } if ((attribute == "MAXOPCAP")) { return this.MaxOpCap; } return base.GetAttributeValue(attribute, index); } /// <summary> /// Sets a value to the given feature /// </summary> /// <param name="feature">The requested feature</param> /// <param name="value">The value that should be set to that feature</param> protected override void SetFeature(string feature, object value) { if ((feature == "OPTMH")) { this.OpTmh = ((IINS)(value)); return; } if ((feature == "POS")) { this.Pos = ((IDPC)(value)); return; } if ((feature == "BLKOPN")) { this.BlkOpn = ((ISPC)(value)); return; } if ((feature == "BLKCLS")) { this.BlkCls = ((ISPC)(value)); return; } if ((feature == "CHAMOTENA")) { this.ChaMotEna = ((ISPC)(value)); return; } if ((feature == "SHOPCAP")) { this.ShOpCap = ((SwitchingCapabilityKind)(value)); return; } if ((feature == "MAXOPCAP")) { this.MaxOpCap = ((SwitchingCapabilityKind)(value)); return; } base.SetFeature(feature, value); } /// <summary> /// Gets the property expression for the given attribute /// </summary> /// <returns>An incremental property expression</returns> /// <param name="attribute">The requested attribute in upper case</param> protected override NMF.Expressions.INotifyExpression<object> GetExpressionForAttribute(string attribute) { if ((attribute == "OpTmh")) { return new OpTmhProxy(this); } if ((attribute == "Pos")) { return new PosProxy(this); } if ((attribute == "BlkOpn")) { return new BlkOpnProxy(this); } if ((attribute == "BlkCls")) { return new BlkClsProxy(this); } if ((attribute == "ChaMotEna")) { return new ChaMotEnaProxy(this); } return base.GetExpressionForAttribute(attribute); } /// <summary> /// Gets the property expression for the given reference /// </summary> /// <returns>An incremental property expression</returns> /// <param name="reference">The requested reference in upper case</param> protected override NMF.Expressions.INotifyExpression<NMF.Models.IModelElement> GetExpressionForReference(string reference) { if ((reference == "OpTmh")) { return new OpTmhProxy(this); } if ((reference == "Pos")) { return new PosProxy(this); } if ((reference == "BlkOpn")) { return new BlkOpnProxy(this); } if ((reference == "BlkCls")) { return new BlkClsProxy(this); } if ((reference == "ChaMotEna")) { return new ChaMotEnaProxy(this); } return base.GetExpressionForReference(reference); } /// <summary> /// Gets the Class for this model element /// </summary> public override IClass GetClass() { if ((_classInstance == null)) { _classInstance = ((IClass)(MetaRepository.Instance.Resolve("http://www.transformation-tool-contest.eu/2017/smartGrids/substationStandard#//LN" + "Nodes/LNGroupY/YPSH"))); } return _classInstance; } /// <summary> /// The collection class to to represent the children of the YPSH class /// </summary> public class YPSHReferencedElementsCollection : ReferenceCollection, ICollectionExpression<IModelElement>, ICollection<IModelElement> { private YPSH _parent; /// <summary> /// Creates a new instance /// </summary> public YPSHReferencedElementsCollection(YPSH parent) { this._parent = parent; } /// <summary> /// Gets the amount of elements contained in this collection /// </summary> public override int Count { get { int count = 0; if ((this._parent.OpTmh != null)) { count = (count + 1); } if ((this._parent.Pos != null)) { count = (count + 1); } if ((this._parent.BlkOpn != null)) { count = (count + 1); } if ((this._parent.BlkCls != null)) { count = (count + 1); } if ((this._parent.ChaMotEna != null)) { count = (count + 1); } return count; } } protected override void AttachCore() { this._parent.OpTmhChanged += this.PropagateValueChanges; this._parent.PosChanged += this.PropagateValueChanges; this._parent.BlkOpnChanged += this.PropagateValueChanges; this._parent.BlkClsChanged += this.PropagateValueChanges; this._parent.ChaMotEnaChanged += this.PropagateValueChanges; } protected override void DetachCore() { this._parent.OpTmhChanged -= this.PropagateValueChanges; this._parent.PosChanged -= this.PropagateValueChanges; this._parent.BlkOpnChanged -= this.PropagateValueChanges; this._parent.BlkClsChanged -= this.PropagateValueChanges; this._parent.ChaMotEnaChanged -= this.PropagateValueChanges; } /// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.OpTmh == null)) { IINS opTmhCasted = item.As<IINS>(); if ((opTmhCasted != null)) { this._parent.OpTmh = opTmhCasted; return; } } if ((this._parent.Pos == null)) { IDPC posCasted = item.As<IDPC>(); if ((posCasted != null)) { this._parent.Pos = posCasted; return; } } if ((this._parent.BlkOpn == null)) { ISPC blkOpnCasted = item.As<ISPC>(); if ((blkOpnCasted != null)) { this._parent.BlkOpn = blkOpnCasted; return; } } if ((this._parent.BlkCls == null)) { ISPC blkClsCasted = item.As<ISPC>(); if ((blkClsCasted != null)) { this._parent.BlkCls = blkClsCasted; return; } } if ((this._parent.ChaMotEna == null)) { ISPC chaMotEnaCasted = item.As<ISPC>(); if ((chaMotEnaCasted != null)) { this._parent.ChaMotEna = chaMotEnaCasted; return; } } } /// <summary> /// Clears the collection and resets all references that implement it. /// </summary> public override void Clear() { this._parent.OpTmh = null; this._parent.Pos = null; this._parent.BlkOpn = null; this._parent.BlkCls = null; this._parent.ChaMotEna = null; } /// <summary> /// Gets a value indicating whether the given element is contained in the collection /// </summary> /// <returns>True, if it is contained, otherwise False</returns> /// <param name="item">The item that should be looked out for</param> public override bool Contains(IModelElement item) { if ((item == this._parent.OpTmh)) { return true; } if ((item == this._parent.Pos)) { return true; } if ((item == this._parent.BlkOpn)) { return true; } if ((item == this._parent.BlkCls)) { return true; } if ((item == this._parent.ChaMotEna)) { return true; } return false; } /// <summary> /// Copies the contents of the collection to the given array starting from the given array index /// </summary> /// <param name="array">The array in which the elements should be copied</param> /// <param name="arrayIndex">The starting index</param> public override void CopyTo(IModelElement[] array, int arrayIndex) { if ((this._parent.OpTmh != null)) { array[arrayIndex] = this._parent.OpTmh; arrayIndex = (arrayIndex + 1); } if ((this._parent.Pos != null)) { array[arrayIndex] = this._parent.Pos; arrayIndex = (arrayIndex + 1); } if ((this._parent.BlkOpn != null)) { array[arrayIndex] = this._parent.BlkOpn; arrayIndex = (arrayIndex + 1); } if ((this._parent.BlkCls != null)) { array[arrayIndex] = this._parent.BlkCls; arrayIndex = (arrayIndex + 1); } if ((this._parent.ChaMotEna != null)) { array[arrayIndex] = this._parent.ChaMotEna; arrayIndex = (arrayIndex + 1); } } /// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { if ((this._parent.OpTmh == item)) { this._parent.OpTmh = null; return true; } if ((this._parent.Pos == item)) { this._parent.Pos = null; return true; } if ((this._parent.BlkOpn == item)) { this._parent.BlkOpn = null; return true; } if ((this._parent.BlkCls == item)) { this._parent.BlkCls = null; return true; } if ((this._parent.ChaMotEna == item)) { this._parent.ChaMotEna = null; return true; } return false; } /// <summary> /// Gets an enumerator that enumerates the collection /// </summary> /// <returns>A generic enumerator</returns> public override IEnumerator<IModelElement> GetEnumerator() { return Enumerable.Empty<IModelElement>().Concat(this._parent.OpTmh).Concat(this._parent.Pos).Concat(this._parent.BlkOpn).Concat(this._parent.BlkCls).Concat(this._parent.ChaMotEna).GetEnumerator(); } } /// <summary> /// Represents a proxy to represent an incremental access to the ShOpCap property /// </summary> private sealed class ShOpCapProxy : ModelPropertyChange<IYPSH, Nullable<SwitchingCapabilityKind>> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public ShOpCapProxy(IYPSH modelElement) : base(modelElement, "ShOpCap") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override Nullable<SwitchingCapabilityKind> Value { get { return this.ModelElement.ShOpCap; } set { this.ModelElement.ShOpCap = value; } } } /// <summary> /// Represents a proxy to represent an incremental access to the MaxOpCap property /// </summary> private sealed class MaxOpCapProxy : ModelPropertyChange<IYPSH, Nullable<SwitchingCapabilityKind>> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public MaxOpCapProxy(IYPSH modelElement) : base(modelElement, "MaxOpCap") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override Nullable<SwitchingCapabilityKind> Value { get { return this.ModelElement.MaxOpCap; } set { this.ModelElement.MaxOpCap = value; } } } /// <summary> /// Represents a proxy to represent an incremental access to the OpTmh property /// </summary> private sealed class OpTmhProxy : ModelPropertyChange<IYPSH, IINS> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public OpTmhProxy(IYPSH modelElement) : base(modelElement, "OpTmh") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override IINS Value { get { return this.ModelElement.OpTmh; } set { this.ModelElement.OpTmh = value; } } } /// <summary> /// Represents a proxy to represent an incremental access to the Pos property /// </summary> private sealed class PosProxy : ModelPropertyChange<IYPSH, IDPC> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public PosProxy(IYPSH modelElement) : base(modelElement, "Pos") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override IDPC Value { get { return this.ModelElement.Pos; } set { this.ModelElement.Pos = value; } } } /// <summary> /// Represents a proxy to represent an incremental access to the BlkOpn property /// </summary> private sealed class BlkOpnProxy : ModelPropertyChange<IYPSH, ISPC> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public BlkOpnProxy(IYPSH modelElement) : base(modelElement, "BlkOpn") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override ISPC Value { get { return this.ModelElement.BlkOpn; } set { this.ModelElement.BlkOpn = value; } } } /// <summary> /// Represents a proxy to represent an incremental access to the BlkCls property /// </summary> private sealed class BlkClsProxy : ModelPropertyChange<IYPSH, ISPC> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public BlkClsProxy(IYPSH modelElement) : base(modelElement, "BlkCls") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override ISPC Value { get { return this.ModelElement.BlkCls; } set { this.ModelElement.BlkCls = value; } } } /// <summary> /// Represents a proxy to represent an incremental access to the ChaMotEna property /// </summary> private sealed class ChaMotEnaProxy : ModelPropertyChange<IYPSH, ISPC> { /// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public ChaMotEnaProxy(IYPSH modelElement) : base(modelElement, "ChaMotEna") { } /// <summary> /// Gets or sets the value of this expression /// </summary> public override ISPC Value { get { return this.ModelElement.ChaMotEna; } set { this.ModelElement.ChaMotEna = value; } } } } }
35.665882
212
0.487773
[ "MIT" ]
georghinkel/ttc2017smartGrids
generator/61850/LNNodes/LNGroupY/YPSH.cs
45,476
C#
using Godot; using JoyGodot.Assets.Scripts.World; namespace JoyGodot.Assets.Scripts.States { public class WorldDestructionState : GameState { protected IWorldInstance m_OverWorld; protected IWorldInstance m_NextWorld; public WorldDestructionState(IWorldInstance overworld, IWorldInstance nextWorld) { this.m_OverWorld = overworld; this.m_NextWorld = nextWorld; } public override void LoadContent() { } public override void Start() { this.DestroyWorld(); } public override void Update() { } public override void HandleInput(InputEvent @event) { } protected void DestroyWorld() { IGameManager gameManager = GlobalConstants.GameManager; gameManager.EntityPool.RetireAll(); gameManager.ItemPool.RetireAll(); gameManager.FogPool.RetireAll(); gameManager.FloorTileMap.Clear(); gameManager.WallTileMap.Clear(); this.Done = true; } public override GameState GetNextState() { return new WorldInitialisationState(this.m_OverWorld, this.m_NextWorld); } } }
24.692308
88
0.597352
[ "MIT" ]
Nosrick/JoyGodot
Assets/Scripts/States/WorldDestructionState.cs
1,286
C#
using EFCore.Lib.Base; using EFCore.Lib.Config; using EFCore.Lib.Model; using Microsoft.EntityFrameworkCore; namespace EFCore.Lib.Data { public class CommonDbContext : DbContext { // Must not be null or empty for running initial create migration private string _connectionString = "ConnectionString"; // Default constructor for initial create migration public CommonDbContext() { } // Normal use constructor public CommonDbContext(ConnectionStrings connectionStrings) { _connectionString = connectionStrings.DefaultConnection; } public DbSet<Currency> Currencies { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) { options.UseSqlServer(_connectionString); } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.AddConfiguration(new CurrencyConfiguration()); } } }
28.078947
78
0.668229
[ "MIT" ]
mvelosop/EFCoreLib
src/EFCore.Lib/Data/CommonDbContext.cs
1,069
C#
using UnityEngine; //assertのためだけ namespace Kayac { public interface IIntrusiveLinkedListNode // 継承して使ってね! { IIntrusiveLinkedListNode prev{ get; set; } IIntrusiveLinkedListNode next{ get; set; } } #if false // 番兵なし版 // こいつのためにnewしたくないだろうしstruct public struct IntrusiveLinkedList<T> where T : IIntrusiveLinkedListNode { public IIntrusiveLinkedListNode first{ get; private set; } public IIntrusiveLinkedListNode last{ get; private set; } public void AddLast(T newNode) { Debug.Assert(newNode != null); // nullはダメだよ if (this.last == null) // 一個もない { Debug.Assert(this.first == null); // firstもnullのはずだよ this.first = this.last = newNode; } else { this.last.next = newNode; newNode.prev = this.last; this.last = newNode; } } public void AddFirst(T newNode) { Debug.Assert(newNode != null); // nullはダメだよ if (this.first == null) // 一個もない { Debug.Assert(this.last == null); // lastもnullのはずだよ this.first = this.last = newNode; } else { this.first.prev = newNode; newNode.next = this.first; this.first = newNode; } } public void AddBefore(T insertPoint, T newNode) { Debug.Assert(newNode != null); // nullはダメだよ Debug.Assert(insertPoint != null); // これもnullはダメだよ var prev = insertPoint.prev; Debug.Assert(prev != null); // これがnullなのはバグだよ insertPoint.prev = newNode; newNode.next = insertPoint; prev.next = newNode; newNode.prev = prev; } public void AddAfter(T insertPoint, T newNode) { Debug.Assert(newNode != null); // nullはダメだよ Debug.Assert(insertPoint != null); // これもnullはダメだよ var next = insertPoint.next; Debug.Assert(next != null); // これがnullなのはバグだよ insertPoint.next = newNode; newNode.prev = insertPoint; next.prev = newNode; newNode.next = next; } public void Remove(T node) { RemoveImpl(node); } void RemoveImpl(IIntrusiveLinkedListNode node) { Debug.Assert(node != null); // nullはダメだよ // 先頭の場合、末尾の場合、先頭かつ末尾の場合、それ以外、の4場合分けが必要 if (node == this.first) { Debug.Assert(node.prev == null); // 先頭ならprevはnullのはずだよ if (node == this.last) // 唯一要素の場合 { Debug.Assert(node.next == null); // 末尾ならnextはnullのはずだよ this.first = this.last = null; } else { var next = node.next; Debug.Assert(node.next != null); // 末尾じゃないからnextはnullじゃないよ next.prev = null; this.first = next; } } else if (node == this.last) { Debug.Assert(node.next == null); // 末尾ならnextはnullのはずだよ var prev = node.prev; Debug.Assert(node.prev != null); // これがnullなら_firstなので、ここには来ないよ。バグってるよ prev.next = null; this.last = prev; } else { var prev = node.prev; var next = node.next; Debug.Assert(prev != null); // 先頭じゃないからprevはnullじゃないよ Debug.Assert(next != null); // 末尾じゃないからnextはnullじゃないよ prev.next = next; next.prev = prev; } node.next = node.prev = null; // 安全のため切っておく } public void RemoveFirst() { if (this.first != null) { RemoveImpl(this.first); } } public void RemoveLast() { if (this.last != null) { RemoveImpl(this.last); } } } #else // 番兵あり版 public struct IntrusiveLinkedList<T> where T : IIntrusiveLinkedListNode { class Sentinel : IIntrusiveLinkedListNode // 番兵クラス { public IIntrusiveLinkedListNode prev{ get; set; } public IIntrusiveLinkedListNode next{ get; set; } } Sentinel _firstSentinel; Sentinel _lastSentinel; public IIntrusiveLinkedListNode first{ get{ return _firstSentinel.next; } } public IIntrusiveLinkedListNode last{ get{ return _lastSentinel.prev; } } public void Init() // 番兵生成のために必要 { _firstSentinel = new Sentinel(); _lastSentinel = new Sentinel(); _firstSentinel.next = _lastSentinel; _lastSentinel.prev = _firstSentinel; } public void AddLast(T newNode) { AddBeforeImpl(_lastSentinel, newNode); } public void AddFirst(T newNode) { AddAfterImpl(_firstSentinel, newNode); } public void AddBefore(T insertPoint, T newNode) { AddBeforeImpl(insertPoint, newNode); } // 全然関係ない型をつっこまれる危険を減らすために面倒なことをしている void AddBeforeImpl(IIntrusiveLinkedListNode insertPoint, T newNode) { Debug.Assert(newNode != null); // nullはダメだよ Debug.Assert(insertPoint != null); // これもnullはダメだよ var prev = insertPoint.prev; Debug.Assert(prev != null); // これがnullなのはバグだよ insertPoint.prev = newNode; newNode.next = insertPoint; prev.next = newNode; newNode.prev = prev; } public void AddAfter(T insertPoint, T newNode) { AddAfterImpl(insertPoint, newNode); } void AddAfterImpl(IIntrusiveLinkedListNode insertPoint, T newNode) { Debug.Assert(newNode != null); // nullはダメだよ Debug.Assert(insertPoint != null); // これもnullはダメだよ var next = insertPoint.next; Debug.Assert(next != null); // これがnullなのはバグだよ insertPoint.next = newNode; newNode.prev = insertPoint; next.prev = newNode; newNode.next = next; } public void Remove(T node) { RemoveImpl(node); } void RemoveImpl(IIntrusiveLinkedListNode node) { Debug.Assert(node != null); // nullはダメだよ Debug.Assert(node.next != null); // nextはnullじゃないよ Debug.Assert(node.prev != null); // prevはnullじゃないよ var next = node.next; var prev = node.prev; next.prev = prev; prev.next = next; node.next = node.prev = null; // 安全のため切っておく } public void RemoveFirst() { if (this.first != null) { RemoveImpl(this.first); } } public void RemoveLast() { if (this.last != null) { RemoveImpl(this.last); } } } #endif }
23.436975
77
0.660093
[ "MIT" ]
hiryma/UnitySamples
Misc/IntrusiveLinkedList.cs
6,360
C#
using System; using System.Diagnostics; using CommandLine; namespace ExamplesGenerator { internal class Program { private static int Main(string[] args) => Parser.Default.ParseArguments<AsciiDocOptions, CSharpOptions>(args) .MapResult( (AsciiDocOptions opts) => RunAsciiDocAndReturnExitCode(opts), (CSharpOptions opts) => RunCSharpAndReturnExitCode(opts), errs => 1); private static int RunAsciiDocAndReturnExitCode(AsciiDocOptions opts) { var branchName = !string.IsNullOrEmpty(opts.BranchName) ? opts.BranchName : GetBranchNameFromGit(); var examples = CSharpParser.ParseImplementedExamples(); AsciiDocGenerator.GenerateExampleAsciiDoc(examples, branchName); return 0; } private static string GetBranchNameFromGit() { var process = new Process { StartInfo = new ProcessStartInfo { UseShellExecute = false, RedirectStandardOutput = true, FileName = "git.exe", CreateNoWindow = true, WorkingDirectory = Environment.CurrentDirectory, Arguments = "rev-parse --abbrev-ref HEAD" } }; try { process.Start(); var branchName = process.StandardOutput.ReadToEnd().Trim(); process.WaitForExit(); return branchName; } catch (Exception) { return "master"; } finally { process.Dispose(); } } private static int RunCSharpAndReturnExitCode(CSharpOptions opts) { var pages = AsciiDocParser.ParsePages(opts.Path); CSharpGenerator.GenerateExampleClasses(pages); return 0; } } [Verb("asciidoc", HelpText = "Generate asciidoc client example files from the C# Examples classes")] public class AsciiDocOptions { [Option('b', "branch", Required = false, HelpText = "The version that appears in generated from source link")] public string BranchName { get; set; } } [Verb("csharp", HelpText = "Generate C# Examples classes from the asciidoc master reference")] public class CSharpOptions { [Option('p', "path", Required = true, HelpText = "Path to the master reference file")] public string Path { get; set; } } }
25.814815
112
0.702056
[ "Apache-2.0" ]
AnthAbou/elasticsearch-net
src/Examples/ExamplesGenerator/Program.cs
2,093
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Poker { public class Bets { public int Chips { get; set; } = 1000; public int Bet { get; set; } public int MinimumBet { get; set; } // public int HandsCompleted { get; set; } = 0; // <summary> // Add Player's chips to their bet. // </summary> // <param name="bet">The number of Chips to bet</param> public void AddBet(int bet) { Bet += bet; Chips -= bet; } // <summary> // Set Bet to 0 // </summary> public void ClearBet() { Bet = 0; } // <summary> // Cancel player's bet. They will neither lose nor gain any chips. // </summary> public void ReturnBet() { Chips += Bet; ClearBet(); } public void ShowChips() { Console.Write("Current Chip Count: "); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine(Chips); Console.ForegroundColor = ConsoleColor.Black ; Console.Write("Minimum Bet: "); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(MinimumBet); Console.ForegroundColor = ConsoleColor.Black; Console.Write("Bank: "); Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine(Bet*2); } } }
24.815385
75
0.49783
[ "MIT" ]
Donahill/PokerClassic_Vitiaz
Poker/Bets.cs
1,615
C#
// ----------------------------------------------------------------------- // <copyright file="MainForm.cs" company="Secondnorth, Inc."> // All Rights Reserved. // </copyright> // ----------------------------------------------------------------------- namespace PBEM { using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Forms; /// <summary> /// The main form of the application. /// </summary> public partial class MainForm : Form { #region " Private Variables " /// <summary> /// Stores if the current user is an admin or not. /// </summary> private bool admin = false; /// <summary> /// /// </summary> private bool useDefaults = false; #endregion #region " Constructor " /// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { this.InitializeComponent(); // Default the status text this.toolStripStatusLabel1.Text = "Welcome! Please log on first to find a list of games to play!"; // Disable all Functionality until user logs on this.menuStrip1.Enabled = false; this.toolStripComboBoxGameList.Enabled = false; // Figure out which server and root path should be used this.LoadConfig(); #if DEBUG this.admin = true; #endif } #endregion #region " Private Tool Strip Events " /// <summary> /// Fires when the Log On button is pressed. /// </summary> /// <param name="sender">The button.</param> /// <param name="e">Event arguments. Not used.</param> private void ToolStripButtonLogOn_Click(object sender, EventArgs e) { bool result = false; this.toolStripStatusLabel1.Text = "Connecting to Server..."; this.toolStripProgressBar1.Style = ProgressBarStyle.Marquee; this.toolStripProgressBar1.Visible = true; // Log on using (FrmLogin login = new FrmLogin()) { if (this.useDefaults) { login.UserID = AppObjects.User.Name; login.Password = AppObjects.User.Password; login.Default = this.useDefaults; } if (login.ShowDialog() == DialogResult.OK) { result = true; AppObjects.User.Name = login.UserID; AppObjects.User.Password = login.Password; this.useDefaults = login.Default; } } if (result) { // Get account info to test connection result = AppObjects.Server.Connect(); // Stop the progress bar this.toolStripProgressBar1.Style = ProgressBarStyle.Blocks; this.toolStripProgressBar1.Value = 100; if (result) { // Able to connect to the server this.toolStripStatusLabel1.Text = "Successfully connected!"; // Reset the result value result = false; // Now validate the logon if (AppObjects.Server.Logon()) { result = true; this.menuStrip1.Enabled = true; this.toolStripComboBoxGameList.Enabled = true; // Check if the admin options should be visible or not if (admin) { this.adminToolStripMenuItem.Visible = true; } this.toolStripStatusLabel1.Text = $"Welcome {AppObjects.User.Name}!"; this.Text = $"{this.Text} - {AppObjects.User.Name}"; } } else { MessageBox.Show("Cannot connect to this server as this time. Please try again later."); this.toolStripStatusLabel1.Text = "Error connecting to server, please check log file."; } } this.toolStripProgressBar1.Visible = false; } /// <summary> /// Fires when the a new option on the game list combo box is selected. /// </summary> /// <param name="sender">The combo box.</param> /// <param name="e">Event arguments. Not used.</param> private void ToolStripComboBoxGameList_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(((ToolStripComboBox)sender).SelectedItem.ToString())) { foreach (IGameModule game in AppObjects.Constants.Modules()) { if (game.Name == ((ToolStripComboBox)sender).SelectedItem.ToString()) { // Load The game's visual component this.panelMainDisplay.Controls.Clear(); this.panelMainDisplay.Controls.Add(game.GetVisualComponent()); this.panelMainDisplay.ClientSize = game.GetVisualComponent().Size; // Now Add the Game Specific ToolStrip Buttons this.AddMenuItems(game.GetMenuItems()); } } } else { this.panelMainDisplay.Controls.Clear(); for (int i = 0; i < this.toolStrip1.Items.Count; i++) { if (this.toolStrip1.Items[i].Tag != null && this.toolStrip1.Items[i].Tag.ToString() == "Game") { this.toolStrip1.Items.Remove(this.toolStrip1.Items[i--]); } } for (int i = 0; i < this.menuStrip1.Items.Count; i++) { if (this.menuStrip1.Items[i].Tag != null && this.menuStrip1.Items[i].Tag.ToString() == "Game") { this.menuStrip1.Items.Remove(this.menuStrip1.Items[i--]); } } } } #endregion #region " Private Menu Strip Events " /// <summary> /// Fires when the Options -> Settings menu is selected. /// </summary> /// <param name="sender">The menu option.</param> /// <param name="e">Event arguments. Not used.</param> private void SettingsToolStripMenuItem_Click(object sender, EventArgs e) { // Open up the Settings Dialog using (FrmSettings frm = new FrmSettings()) { // Set the current values List<string> serverTypes = new List<string>() { "DropBox", "Local File System" }; frm.ServerTypes = serverTypes; frm.SelectedServerType = AppObjects.Server.Name; frm.SelectedRoot = AppObjects.Server.Root; if (frm.ShowDialog() == DialogResult.OK) { // Now save the settings back to the main forms AppObjects.Server.Name = frm.SelectedServerType; AppObjects.Server.Root = frm.SelectedRoot; Properties.Settings.Default["Server"] = AppObjects.Server.Name; Properties.Settings.Default["Root"] = AppObjects.Server.Root; Properties.Settings.Default.Save(); } } } #endregion #region " Private Menu Strip ADMIN Events " /// <summary> /// Fires when the Server Explorer menu is selected. /// </summary> /// <param name="sender">The menu option.</param> /// <param name="e">Event arguments. Not used.</param> private void LoadServerExplorerToolStripMenuItem_Click(object sender, EventArgs e) { this.panelMainDisplay.Controls.Clear(); this.panelMainDisplay.Controls.Add(AppObjects.Server.GetServerExplorer().GetUserControl()); } /// <summary> /// Create and setup a new account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateNewAccountFileToolStripMenuItem_Click(object sender, EventArgs e) { // Display a form. Must be able to get the } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UserAccountSetupToolStripMenuItem_Click(object sender, EventArgs e) { } #endregion #region " Private Events " /// <summary> /// Fires when the form is loaded. /// </summary> /// <param name="sender">The form.</param> /// <param name="e">Event arguments. Not used.</param> private void MainForm_Load(object sender, EventArgs e) { // Use the begin invoke to do the rest of the initialization so that the screen shows up. this.BeginInvoke((Action)(() => { try { // Load the modules, verify the DB connection and login if (this.LoadModules()) { this.toolStripComboBoxGameList.Items.Add(string.Empty); foreach (IGameModule game in AppObjects.Constants.Modules()) { this.toolStripComboBoxGameList.Items.Add(game.Name); } /* // Notify the modules we are ready to load. CancelEventArgs args = new CancelEventArgs(false); this.Loading?.Invoke(this, args); Application.DoEvents(); if (args.Cancel) { // Close the application. this.Close(); }*/ } else { this.Close(); } } catch (Exception ex) { AppObjects.Log.LogException(ex); this.Close(); } })); } private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { this.SaveConfig(); } #endregion #region " Private Functions " /// <summary> /// Loads in the module class libraries. /// </summary> /// <returns>A flag indicating if the modules were successfully loaded. If false the application should be shut down.</returns> private bool LoadModules() { List<GameModuleInfo> availableModules = new List<GameModuleInfo>(); HashSet<string> dependentModules = new HashSet<string>(); int modulesToLoad = 0; // build a temporary domain to check the modules to load. string pathToDll = Assembly.GetExecutingAssembly().CodeBase; AppDomainSetup domainSetup = new AppDomainSetup { PrivateBinPath = pathToDll }; AppDomain domain = AppDomain.CreateDomain("TempDomain", null, domainSetup); InstanceProxy proxy = domain.CreateInstanceAndUnwrap(Assembly.GetAssembly(typeof(InstanceProxy)).FullName, typeof(InstanceProxy).ToString()) as InstanceProxy; if (proxy != null) { DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); foreach (FileInfo fi in di.GetFiles("*.dll")) { GameModuleInfo m = proxy.LoadAssembly(fi.Name); if (m != null) { if ((AppObjects.Constants as AppConstants).ModulesToBeLoaded.Contains(m.Name.Replace(" ", string.Empty)) || m.IsRequired) { m.Load = true; modulesToLoad++; } #if DEBUG // In debug always load all modules. m.Load = true; #endif m.CodeBase = fi.Name; availableModules.Add(m); } } } // Verify that all dependent modules are loaded. if (modulesToLoad != 0) { #if DEBUG /* todo: if ((AppObjects.Overrides != null) && AppObjects.Overrides.SelectModules) { using (System.Windows.Forms.FrmLoadModules frm = new System.Windows.Forms.FrmLoadModules(availableModules, dependentModules)) { if (frm.ShowDialog() == DialogResult.OK) { availableModules = frm.GetModulesToLoad(); } } }*/ #endif } // Finally load the needed modules into the current domain. foreach (GameModuleInfo mi in availableModules.OrderBy(m => m.Priority)) { if (!string.IsNullOrEmpty(mi.CodeBase) && mi.Load) { // Add the module to the dispose wrapper so they get disposed with the form. // todo: this.disposeWrapper1.ItemsToDispose.Add(m); Assembly a = Assembly.LoadFrom(mi.CodeBase); IGameModule m = Activator.CreateInstance(a.GetType(mi.ObjectClassType)) as IGameModule; (AppObjects.Constants as AppConstants).LoadedModules.Add(m); } } AppDomain.Unload(domain); return (AppObjects.Constants as AppConstants).LoadedModules.Count > 0; } /// <summary> /// Will Add menu items from a game module to the main form's tool strip or menu strip. /// </summary> /// <param name="menuItem">The menu items to merge.</param> private void AddMenuItems(IMenuItem menuItem) { if (menuItem != null) { ToolStrip toolStrip = menuItem.GetToolStrip(); foreach (ToolStripItem ts in toolStrip.Items) { ts.Tag = "Game"; } ToolStripManager.Merge(toolStrip, this.toolStrip1); toolStrip = null; MenuStrip menuStrip = menuItem.GetMenuStrip(); if (menuStrip.Items.Count > 0) { menuStrip.Items[0].Tag = "Game"; this.menuStrip1.Items.Insert(0, menuStrip.Items[0]); } menuStrip = null; menuItem = null; } } /// <summary> /// Attempts to load the server from /// </summary> private void LoadConfig() { try { // Determine the Server type. string serverType = Properties.Settings.Default.Server; switch (serverType) { case "DropBox": AppObjects.Server = new DropBox(); AppObjects.Server.Root = Properties.Settings.Default.Root; break; case "Local File System": AppObjects.Server = new LocalFileSystem(); AppObjects.Server.Root = AppDomain.CurrentDomain.BaseDirectory; break; default: AppObjects.Server = new LocalFileSystem(); AppObjects.Log.Error("Type of server cannot be determined. Defaulting to Local File System."); break; } this.useDefaults = Properties.Settings.Default.UseDefaults; AppObjects.User.Name = Properties.Settings.Default.UserID; AppObjects.User.Password = Properties.Settings.Default.Password; } catch (Exception ex) { AppObjects.Log.LogException(ex); } } /// <summary> /// Save the config values back to the file. /// </summary> private void SaveConfig() { try { if (AppObjects.Server != null) { Properties.Settings.Default["Server"] = AppObjects.Server.Name; Properties.Settings.Default["Root"] = AppObjects.Server.Root; } if (this.useDefaults) { Properties.Settings.Default["UserID"] = AppObjects.User.Name; Properties.Settings.Default["Password"] = AppObjects.User.Password; Properties.Settings.Default["UseDefaults"] = this.useDefaults; } Properties.Settings.Default.Save(); } catch (Exception ex) { AppObjects.Log.LogException(ex); } } #endregion } }
37.708511
170
0.490041
[ "MIT" ]
runmbrun/pbem
PBEM/MainForm.cs
17,725
C#
// <auto-generated /> namespace Lpp.Dns.Data.Migrations { using System.CodeDom.Compiler; using System.Data.Entity.Migrations; using System.Data.Entity.Migrations.Infrastructure; using System.Resources; [GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")] public sealed partial class UpdateTVFForFilteredRequestList2 : IMigrationMetadata { private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateTVFForFilteredRequestList2)); string IMigrationMetadata.Id { get { return "201409162145550_UpdateTVFForFilteredRequestList2"; } } string IMigrationMetadata.Source { get { return null; } } string IMigrationMetadata.Target { get { return Resources.GetString("Target"); } } } }
29.333333
115
0.645455
[ "Apache-2.0" ]
Missouri-BMI/popmednet
Lpp.Dns.Data/Migrations/201409162145550_UpdateTVFForFilteredRequestList2.Designer.cs
880
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using Ambiesoft; namespace testBrowser { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { AmbLib.setRegMaxIE(11000); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
24.5
66
0.591837
[ "BSD-2-Clause" ]
ambiesoft/mdview
testBrowser/Program.cs
590
C#
using Common.Collections; using System; namespace VirtualFileSystem.Model.Implementation { internal sealed class FileSystemItemChildItemSet : ItemSet<IFileSystemItem> { private readonly IFileSystemItem owner; public FileSystemItemChildItemSet(IFileSystemItem owner) { if (owner is null) throw new ArgumentNullException(nameof(owner)); this.owner = owner; } private static void ValidateItem(IFileSystemItem item) { if (item is null) throw new ArgumentNullException(nameof(item)); } public override bool Add(IFileSystemItem item) { ValidateItem(item); item.SetParent(this.owner); return base.Add(item); } public override bool Remove(IFileSystemItem item) { ValidateItem(item); bool removed = base.Remove(item); if (removed) { if (this.Comparer.Equals(item.Parent, this.owner)) item.ResetParent(); } return removed; } } }
23.2
79
0.562931
[ "MIT" ]
andreigit/VirtualFileSystem
VirtualFileSystem.Model/Implementation/FileSystemItemChildItemSet.cs
1,162
C#
using Northwind.Core.Domain.Entities; using System; using System.Collections.Generic; namespace Northwind.Core.Domain { public class OrderDetails { public int OrderId { get; set; } public int ProductId { get; set; } public decimal UnitPrice { get; set; } public short Quantity { get; set; } public float Discount { get; set; } public Orders Order { get; set; } public Products Product { get; set; } } }
24.947368
46
0.626582
[ "MIT" ]
yousefataya/HRMS
Northwind.Core-master/Northwind.Core.Domain/Entities/OrderDetails.cs
476
C#
// <copyright file="StorageTest.cs" company="3M"> // Copyright (c) 3M. All rights reserved. // </copyright> using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.Extensions.Logging; using Mmm.Iot.Common.Services.Config; using Mmm.Iot.Common.Services.Exceptions; using Mmm.Iot.Common.Services.External.AsaManager; using Mmm.Iot.Common.Services.External.StorageAdapter; using Mmm.Iot.Common.Services.Models; using Mmm.Iot.Common.TestHelpers; using Mmm.Iot.Config.Services.Helpers; using Mmm.Iot.Config.Services.Models; using Moq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Xunit; using DeviceGroup = Mmm.Iot.Config.Services.Models.DeviceGroup; using DeviceGroupCondition = Mmm.Iot.Config.Services.Models.DeviceGroupCondition; namespace Mmm.Iot.Config.Services.Test { public class StorageTest { // ReSharper disable once SA1401 [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "This needs to be public for MemberData.")] public static IEnumerable<object[]> PackageDataTags = new List<object[]> { new object[] { new List<string> { "devicegroups.1", "devicegroups.*" }, "OR", 3 }, new object[] { new List<string> { "devicegroups.2", "devicegroups.*" }, "AND", 1 }, new object[] { new List<string> { "isOdd.1" }, "OR", 1 }, new object[] { new List<string> { "devicegroups.*" }, "OR", 3 }, new object[] { new List<string> { "isOdd.0", "devicegroups.*" }, "AND", 2 }, new object[] { new List<string> { "isOdd.0", "isOdd.1" }, "AND", 0 }, }; private const string TenantId = "tenantid-1234"; private const string UserId = "userId"; private const string PackagesCollectionId = "packages"; private const string EdgePackageJson = @"{ ""id"": ""tempid"", ""schemaVersion"": ""1.0"", ""content"": { ""modulesContent"": { ""$edgeAgent"": { ""properties.desired"": { ""schemaVersion"": ""1.0"", ""runtime"": { ""type"": ""docker"", ""settings"": { ""loggingOptions"": """", ""minDockerVersion"": ""v1.25"" } }, ""systemModules"": { ""edgeAgent"": { ""type"": ""docker"", ""settings"": { ""image"": ""mcr.microsoft.com/azureiotedge-agent:1.0"", ""createOptions"": ""{}"" } }, ""edgeHub"": { ""type"": ""docker"", ""settings"": { ""image"": ""mcr.microsoft.com/azureiotedge-hub:1.0"", ""createOptions"": ""{}"" }, ""status"": ""running"", ""restartPolicy"": ""always"" } }, ""modules"": {} } }, ""$edgeHub"": { ""properties.desired"": { ""schemaVersion"": ""1.0"", ""routes"": { ""route"": ""FROM /messages/* INTO $upstream"" }, ""storeAndForwardConfiguration"": { ""timeToLiveSecs"": 7200 } } } } }, ""targetCondition"": ""*"", ""priority"": 30, ""labels"": { ""Name"": ""Test"" }, ""createdTimeUtc"": ""2018-08-20T18:05:55.482Z"", ""lastUpdatedTimeUtc"": ""2018-08-20T18:05:55.482Z"", ""etag"": null, ""metrics"": { ""results"": {}, ""queries"": {} } }"; private const string AdmPackageJson = @"{ ""id"": ""9a9690df-f037-4c3a-8fc0-8eaba687609d"", ""schemaVersion"": ""1.0"", ""labels"": { ""Type"": ""DeviceConfiguration"", ""Name"": ""Deployment-12"", ""DeviceGroupId"": ""MxChip"", ""RMDeployment"": ""True"" }, ""content"": { ""deviceContent"": { ""properties.desired.firmware"": { ""fwVersion"": ""1.0.1"", ""fwPackageURI"": ""https://cs4c496459d5c79x44d1x97a.blob.core.windows.net/firmware/FirmwareOTA.ino.bin"", ""fwPackageCheckValue"": ""45cd"", ""fwSize"": 568648 } } }, ""targetCondition"": ""Tags.isVan1='Y'"", ""createdTimeUtc"": ""2018-11-10T23:50:30.938Z"", ""lastUpdatedTimeUtc"": ""2018-11-10T23:50:30.938Z"", ""priority"": 20, ""systemMetrics"": { ""results"": { ""targetedCount"": 2, ""appliedCount"": 2 }, ""queries"": { ""Targeted"": ""select deviceId from devices where Tags.isVan1='Y'"", ""Applied"": ""select deviceId from devices where Items.[[9a9690df-f037-4c3a-8fc0-8eaba687609d]].status = 'Applied'"" } }, ""metrics"": { ""results"": {}, ""queries"": {} }, ""etag"": ""MQ=="" }"; private readonly string azureMapsKey; private readonly Mock<IStorageAdapterClient> mockClient; private readonly Mock<IAsaManagerClient> mockAsaManager; private readonly Storage storage; private readonly Random rand; private string packageId = "myId"; private List<string> tags = new List<string> { "alpha", "namespace.alpha", "alphanum3ric", "namespace.alphanum3ric", "1234567890", "namespace.1234567890", }; public StorageTest() { this.rand = new Random(); this.azureMapsKey = this.rand.NextString(); this.mockClient = new Mock<IStorageAdapterClient>(); this.mockAsaManager = new Mock<IAsaManagerClient>(); TelemetryClient mockTelemetryClient = this.InitializeMockTelemetryChannel(); this.mockAsaManager .Setup(x => x.BeginDeviceGroupsConversionAsync()) .ReturnsAsync(new BeginConversionApiModel()); this.storage = new Storage( this.mockClient.Object, this.mockAsaManager.Object, new AppConfig { ConfigService = new ConfigServiceConfig { AzureMapsKey = this.azureMapsKey, }, Global = new GlobalConfig { InstrumentationKey = "instrumentationkey", }, }, new Mock<IPackageEventLog>().Object, new Mock<ILogger<Storage>>().Object); } [Fact] public async Task GetThemeAsyncTest() { var name = this.rand.NextString(); var description = this.rand.NextString(); this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(new Theme { Name = name, Description = description, }), }); var result = await this.storage.GetThemeAsync(); this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.ThemeKey)), Times.Once); Assert.Equal(result.Name.ToString(), name); Assert.Equal(result.Description.ToString(), description); Assert.Equal(result.AzureMapsKey.ToString(), this.azureMapsKey); } [Fact] public async Task GetThemeAsyncDefaultTest() { this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ThrowsAsync(new ResourceNotFoundException()); var result = await this.storage.GetThemeAsync(); this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.ThemeKey)), Times.Once); Assert.Equal(result.Name.ToString(), Theme.Default.Name); Assert.Equal(result.Description.ToString(), Theme.Default.Description); Assert.Equal(result.AzureMapsKey.ToString(), this.azureMapsKey); } [Fact] public async Task SetThemeAsyncTest() { var name = this.rand.NextString(); var description = this.rand.NextString(); var theme = new Theme { Name = name, Description = description, }; this.mockClient .Setup(x => x.UpdateAsync( It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(theme), }); var result = await this.storage.SetThemeAsync(theme) as dynamic; this.mockClient .Verify( x => x.UpdateAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.ThemeKey), It.Is<string>(s => s == JsonConvert.SerializeObject(theme)), It.Is<string>(s => s == "*")), Times.Once); Assert.Equal(result.Name.ToString(), name); Assert.Equal(result.Description.ToString(), description); Assert.Equal(result.AzureMapsKey.ToString(), this.azureMapsKey); } [Fact] public async Task GetUserSettingAsyncTest() { var id = this.rand.NextString(); var name = this.rand.NextString(); var description = this.rand.NextString(); this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(new { Name = name, Description = description, }), }); var result = await this.storage.GetUserSetting(id) as dynamic; this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.UserCollectionId), It.Is<string>(s => s == id)), Times.Once); Assert.Equal(result.Name.ToString(), name); Assert.Equal(result.Description.ToString(), description); } [Fact] public async Task SetUserSettingAsyncTest() { var id = this.rand.NextString(); var name = this.rand.NextString(); var description = this.rand.NextString(); var setting = new { Name = name, Description = description, }; this.mockClient .Setup(x => x.UpdateAsync( It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(setting), }); var result = await this.storage.SetUserSetting(id, setting) as dynamic; this.mockClient .Verify( x => x.UpdateAsync( It.Is<string>(s => s == Storage.UserCollectionId), It.Is<string>(s => s == id), It.Is<string>(s => s == JsonConvert.SerializeObject(setting)), It.Is<string>(s => s == "*")), Times.Once); Assert.Equal(result.Name.ToString(), name); Assert.Equal(result.Description.ToString(), description); } [Fact] public async Task GetLogoShouldReturnExpectedLogo() { var image = this.rand.NextString(); var type = this.rand.NextString(); this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(new Logo { Image = image, Type = type, IsDefault = false, }), }); var result = await this.storage.GetLogoAsync() as dynamic; this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.LogoKey)), Times.Once); Assert.Equal(image, result.Image.ToString()); Assert.Equal(type, result.Type.ToString()); Assert.Null(result.Name); Assert.False(result.IsDefault); } [Fact] public async Task GetLogoShouldReturnExpectedLogoAndName() { var image = this.rand.NextString(); var type = this.rand.NextString(); var name = this.rand.NextString(); this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(new Logo { Image = image, Type = type, Name = name, IsDefault = false, }), }); var result = await this.storage.GetLogoAsync() as dynamic; this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.LogoKey)), Times.Once); Assert.Equal(image, result.Image.ToString()); Assert.Equal(type, result.Type.ToString()); Assert.Equal(name, result.Name.ToString()); Assert.False(result.IsDefault); } [Fact] public async Task GetLogoShouldReturnDefaultLogoOnException() { this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ThrowsAsync(new ResourceNotFoundException()); var result = await this.storage.GetLogoAsync() as dynamic; this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.LogoKey)), Times.Once); Assert.Equal(Logo.Default.Image, result.Image.ToString()); Assert.Equal(Logo.Default.Type, result.Type.ToString()); Assert.Equal(Logo.Default.Name, result.Name.ToString()); Assert.True(result.IsDefault); } [Fact] public async Task SetLogoShouldNotOverwriteOldNameWithNull() { var image = this.rand.NextString(); var type = this.rand.NextString(); var oldImage = this.rand.NextString(); var oldType = this.rand.NextString(); var oldName = this.rand.NextString(); var logo = new Logo { Image = image, Type = type, }; Logo result = await this.SetLogoHelper(logo, oldImage, oldName, oldType, false); this.mockClient .Verify( x => x.UpdateAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.LogoKey), It.Is<string>(s => s == JsonConvert.SerializeObject(logo)), It.Is<string>(s => s == "*")), Times.Once); Assert.Equal(image, result.Image.ToString()); Assert.Equal(type, result.Type.ToString()); // If name is not set, old name should remain Assert.Equal(oldName, result.Name.ToString()); Assert.False(result.IsDefault); } [Fact] public async Task SetLogoShouldSetAllPartsOfLogoIfNotNull() { var image = this.rand.NextString(); var type = this.rand.NextString(); var name = this.rand.NextString(); var oldImage = this.rand.NextString(); var oldType = this.rand.NextString(); var oldName = this.rand.NextString(); var logo = new Logo { Image = image, Type = type, Name = name, }; Logo result = await this.SetLogoHelper(logo, oldImage, oldName, oldType, false); Assert.Equal(image, result.Image.ToString()); Assert.Equal(type, result.Type.ToString()); Assert.Equal(name, result.Name.ToString()); Assert.False(result.IsDefault); } [Fact] public async Task GetAllDeviceGroupsAsyncTest() { var groups = new[] { new DeviceGroup { DisplayName = this.rand.NextString(), Conditions = new List<DeviceGroupCondition>() { new DeviceGroupCondition() { Key = this.rand.NextString(), Operator = DeviceGroupConditionOperatorType.EQ, Value = this.rand.NextString(), }, }, }, new DeviceGroup { DisplayName = this.rand.NextString(), Conditions = new List<DeviceGroupCondition>() { new DeviceGroupCondition() { Key = this.rand.NextString(), Operator = DeviceGroupConditionOperatorType.EQ, Value = this.rand.NextString(), }, }, }, new DeviceGroup { DisplayName = this.rand.NextString(), Conditions = new List<DeviceGroupCondition>() { new DeviceGroupCondition() { Key = this.rand.NextString(), Operator = DeviceGroupConditionOperatorType.EQ, Value = this.rand.NextString(), }, }, }, }; var items = groups.Select(g => new ValueApiModel { Key = this.rand.NextString(), Data = JsonConvert.SerializeObject(g), ETag = this.rand.NextString(), }).ToList(); this.mockClient .Setup(x => x.GetAllAsync(It.IsAny<string>())) .ReturnsAsync(new ValueListApiModel { Items = items }); var result = (await this.storage.GetAllDeviceGroupsAsync()).ToList(); this.mockClient .Verify( x => x.GetAllAsync( It.Is<string>(s => s == Storage.DeviceGroupCollectionId)), Times.Once); Assert.Equal(result.Count, groups.Length); foreach (var g in result) { var item = items.Single(i => i.Key == g.Id); var group = JsonConvert.DeserializeObject<DeviceGroup>(item.Data); Assert.Equal(g.DisplayName, group.DisplayName); Assert.Equal(g.Conditions.First().Key, group.Conditions.First().Key); Assert.Equal(g.Conditions.First().Operator, group.Conditions.First().Operator); Assert.Equal(g.Conditions.First().Value, group.Conditions.First().Value); } } [Fact] public async Task GetDeviceGroupsAsyncTest() { var groupId = this.rand.NextString(); var displayName = this.rand.NextString(); var conditions = new List<DeviceGroupCondition>() { new DeviceGroupCondition() { Key = this.rand.NextString(), Operator = DeviceGroupConditionOperatorType.EQ, Value = this.rand.NextString(), }, }; var etag = this.rand.NextString(); this.mockClient .Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Key = groupId, Data = JsonConvert.SerializeObject(new DeviceGroup { DisplayName = displayName, Conditions = conditions, }), ETag = etag, }); var result = await this.storage.GetDeviceGroupAsync(groupId); this.mockClient .Verify( x => x.GetAsync( It.Is<string>(s => s == Storage.DeviceGroupCollectionId), It.Is<string>(s => s == groupId)), Times.Once); Assert.Equal(result.DisplayName, displayName); Assert.Equal(result.Conditions.First().Key, conditions.First().Key); Assert.Equal(result.Conditions.First().Operator, conditions.First().Operator); Assert.Equal(result.Conditions.First().Value, conditions.First().Value); } [Fact] public async Task CreateDeviceGroupAsyncTest() { var groupId = this.rand.NextString(); var displayName = this.rand.NextString(); var conditions = new List<DeviceGroupCondition>() { new DeviceGroupCondition() { Key = this.rand.NextString(), Operator = DeviceGroupConditionOperatorType.EQ, Value = this.rand.NextString(), }, }; var etag = this.rand.NextString(); var group = new DeviceGroup { DisplayName = displayName, Conditions = conditions, }; this.mockClient .Setup(x => x.CreateAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Key = groupId, Data = JsonConvert.SerializeObject(group), ETag = etag, }); this.mockClient .Setup(x => x.GetAllAsync( It.IsAny<string>())) .ReturnsAsync(new ValueListApiModel { Items = new List<ValueApiModel>() }); var result = await this.storage.CreateDeviceGroupAsync(group); this.mockClient .Verify( x => x.CreateAsync( It.Is<string>(s => s == Storage.DeviceGroupCollectionId), It.Is<string>(s => s == JsonConvert.SerializeObject( group, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }))), Times.Once); this.mockAsaManager .Verify( x => x.BeginDeviceGroupsConversionAsync(), Times.Once); Assert.Equal(result.Id, groupId); Assert.Equal(result.DisplayName, displayName); Assert.Equal(result.Conditions.First().Key, conditions.First().Key); Assert.Equal(result.Conditions.First().Operator, conditions.First().Operator); Assert.Equal(result.Conditions.First().Value, conditions.First().Value); Assert.Equal(result.ETag, etag); } [Fact] public async Task CreateDeviceGroupAsyncThrowsConflicatingResourceOnExistingDisplayNameTest() { var existingGroup = new DeviceGroup { Id = this.rand.NextString(), DisplayName = this.rand.NextString(), Conditions = new List<DeviceGroupCondition>(), }; this.mockClient .Setup(x => x.GetAllAsync( It.IsAny<string>())) .ReturnsAsync(new ValueListApiModel { Items = new List<ValueApiModel> { new ValueApiModel { Key = existingGroup.Id, Data = JsonConvert.SerializeObject(existingGroup), ETag = this.rand.NextString(), }, }, }); var newGroup = new DeviceGroup { Id = this.rand.NextString(), DisplayName = existingGroup.DisplayName, Conditions = new List<DeviceGroupCondition>(), }; await Assert.ThrowsAsync<ConflictingResourceException>(async () => await this.storage.CreateDeviceGroupAsync(newGroup)); } [Fact] public async Task UpdateDeviceGroupAsyncTest() { var groupId = this.rand.NextString(); var displayName = this.rand.NextString(); var conditions = new List<DeviceGroupCondition>() { new DeviceGroupCondition() { Key = this.rand.NextString(), Operator = DeviceGroupConditionOperatorType.EQ, Value = this.rand.NextString(), }, }; var etagOld = this.rand.NextString(); var etagNew = this.rand.NextString(); var group = new DeviceGroup { DisplayName = displayName, Conditions = conditions, }; this.mockClient .Setup(x => x.UpdateAsync( It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Key = groupId, Data = JsonConvert.SerializeObject(group), ETag = etagNew, }); this.mockClient .Setup(x => x.GetAllAsync( It.IsAny<string>())) .ReturnsAsync(new ValueListApiModel { Items = new List<ValueApiModel>() }); var result = await this.storage.UpdateDeviceGroupAsync(groupId, group, etagOld); this.mockClient .Verify( x => x.UpdateAsync( It.Is<string>(s => s == Storage.DeviceGroupCollectionId), It.Is<string>(s => s == groupId), It.Is<string>(s => s == JsonConvert.SerializeObject( group, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })), It.Is<string>(s => s == etagOld)), Times.Once); this.mockAsaManager .Verify( x => x.BeginDeviceGroupsConversionAsync(), Times.Once); Assert.Equal(result.Id, groupId); Assert.Equal(result.DisplayName, displayName); Assert.Equal(result.Conditions.First().Key, conditions.First().Key); Assert.Equal(result.Conditions.First().Operator, conditions.First().Operator); Assert.Equal(result.Conditions.First().Value, conditions.First().Value); Assert.Equal(result.ETag, etagNew); } [Fact] public async Task UpdateDeviceGroupAsyncThrowsConflicatingResourceOnExistingDisplayNameTest() { var existingGroup = new DeviceGroup { Id = this.rand.NextString(), DisplayName = this.rand.NextString(), Conditions = new List<DeviceGroupCondition>(), }; this.mockClient .Setup(x => x.GetAllAsync( It.IsAny<string>())) .ReturnsAsync(new ValueListApiModel { Items = new List<ValueApiModel> { new ValueApiModel { Key = existingGroup.Id, Data = JsonConvert.SerializeObject(existingGroup), ETag = this.rand.NextString(), }, }, }); var newGroup = new DeviceGroup { Id = this.rand.NextString(), DisplayName = existingGroup.DisplayName, Conditions = new List<DeviceGroupCondition>(), }; await Assert.ThrowsAsync<ConflictingResourceException>(async () => await this.storage.UpdateDeviceGroupAsync(newGroup.Id, newGroup, this.rand.NextString())); } [Fact] public async Task DeleteDeviceGroupAsyncTest() { var groupId = this.rand.NextString(); this.mockClient .Setup(x => x.DeleteAsync(It.IsAny<string>(), It.IsAny<string>())) .Returns(Task.FromResult(0)); await this.storage.DeleteDeviceGroupAsync(groupId); this.mockClient .Verify( x => x.DeleteAsync( It.Is<string>(s => s == Storage.DeviceGroupCollectionId), It.Is<string>(s => s == groupId)), Times.Once); this.mockAsaManager .Verify( x => x.BeginDeviceGroupsConversionAsync(), Times.Once); } [Fact] public async Task AddEdgePackageTest() { // Arrange const string collectionId = "packages"; const string key = "package name"; var pkg = new PackageServiceModel { Id = string.Empty, Name = key, PackageType = PackageType.EdgeManifest, ConfigType = string.Empty, Content = EdgePackageJson, }; var value = JsonConvert.SerializeObject(pkg); this.mockClient .Setup(x => x.CreateAsync( It.Is<string>(i => i == collectionId), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Key = key, Data = value, }); // Act var result = await this.storage.AddPackageAsync(pkg, UserId, TenantId); // Assert Assert.Equal(pkg.Name, result.Name); Assert.Equal(pkg.PackageType, result.PackageType); Assert.Equal(pkg.Content, result.Content); } [Theory] [InlineData(false)] [InlineData(true)] public async Task AddADMPackageTest(bool isCustomConfigType) { // Arrange const string collectionId = "packages"; const string key = "package name"; string configType = isCustomConfigType ? "Custom-config" : ConfigType.Firmware.ToString(); var pkg = new PackageServiceModel { Id = string.Empty, Name = key, PackageType = PackageType.DeviceConfiguration, Content = AdmPackageJson, ConfigType = configType, }; var value = JsonConvert.SerializeObject(pkg); this.mockClient .Setup(x => x.CreateAsync( It.Is<string>(i => i == collectionId), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Key = key, Data = value, }); const string configKey = "config-types"; this.mockClient .Setup(x => x.UpdateAsync( It.Is<string>(i => i == collectionId), It.Is<string>(i => i == configKey), It.Is<string>(i => i == ConfigType.Firmware.ToString()), It.Is<string>(i => i == "*"))) .ReturnsAsync(new ValueApiModel { Key = key, Data = value, }); this.mockClient .Setup(x => x.GetAsync( It.Is<string>(i => i == collectionId), It.Is<string>(i => i == configKey))) .ThrowsAsync(new ResourceNotFoundException()); // Act var result = await this.storage.AddPackageAsync(pkg, UserId, TenantId); // Assert Assert.Equal(pkg.Name, result.Name); Assert.Equal(pkg.PackageType, result.PackageType); Assert.Equal(pkg.Content, result.Content); Assert.Equal(pkg.ConfigType, result.ConfigType); } [Theory] [InlineData(false)] [InlineData(true)] public async Task ListPackagesTest(bool isEdgeManifest) { // Arrange const string collectionId = "packages"; const string id = "packageId"; const string name = "packageName"; const string content = "{}"; int[] idx = new int[] { 0, 1, 2 }; var packages = idx.Select(i => new PackageServiceModel() { Id = id + i, Name = name + i, Content = content + i, PackageType = (i == 0) ? PackageType.DeviceConfiguration : PackageType.EdgeManifest, ConfigType = (i == 0) ? ConfigType.Firmware.ToString() : string.Empty, }).ToList(); this.mockClient .Setup(x => x.GetAllAsync( It.Is<string>(i => (i == collectionId)))) .ReturnsAsync(new ValueListApiModel { Items = new List<ValueApiModel>() { new ValueApiModel() { Key = string.Empty, Data = JsonConvert.SerializeObject(packages[0]) }, new ValueApiModel() { Key = string.Empty, Data = JsonConvert.SerializeObject(packages[1]) }, new ValueApiModel() { Key = string.Empty, Data = JsonConvert.SerializeObject(packages[2]) }, }, }); // Act var packageType = isEdgeManifest ? PackageType.EdgeManifest.ToString() : PackageType.DeviceConfiguration.ToString(); var configType = isEdgeManifest ? string.Empty : ConfigType.Firmware.ToString(); try { var resultPackages = await this.storage.GetFilteredPackagesAsync( packageType, configType, null, null); // Assert var pkg = resultPackages.First(); Assert.Equal(packageType, pkg.PackageType.ToString()); Assert.Equal(configType, pkg.ConfigType); } catch (Exception e) { Assert.False(isEdgeManifest, e.Message); } } [Theory] [MemberData(nameof(PackageDataTags))] public async Task ListPackagesByTags(List<string> tags, string tagOperator, int numResult) { // Arrange const string collectionId = "packages"; const string id = "packageId"; const string name = "packageName"; const string content = "{}"; int[] idx = new int[] { 0, 1, 2 }; var packages = idx.Select(i => new PackageServiceModel() { Id = id + i, Name = name + i, Content = content + i, PackageType = (i == 0) ? PackageType.DeviceConfiguration : PackageType.EdgeManifest, ConfigType = (i == 0) ? ConfigType.Firmware.ToString() : string.Empty, Tags = new List<string>() { "devicegroups." + i, "devicegroups.*", "isOdd." + (i % 2), }, }).ToList(); this.mockClient .Setup(x => x.GetAllAsync( It.Is<string>(i => (i == collectionId)))) .ReturnsAsync(new ValueListApiModel { Items = new List<ValueApiModel>() { new ValueApiModel() { Key = string.Empty, Data = JsonConvert.SerializeObject(packages[0]) }, new ValueApiModel() { Key = string.Empty, Data = JsonConvert.SerializeObject(packages[1]) }, new ValueApiModel() { Key = string.Empty, Data = JsonConvert.SerializeObject(packages[2]) }, }, }); // Act try { var resultPackages = await this.storage.GetAllPackagesAsync( tags, tagOperator); // Assert Assert.True(resultPackages.Count() == numResult); } catch (Exception e) { throw e; } } [Fact] public async Task ListConfigurationsTest() { const string collectionId = "packages"; const string configKey = "config-types"; // Arrange this.mockClient .Setup(x => x.GetAsync( It.Is<string>(i => i == collectionId), It.Is<string>(i => i == configKey))) .ThrowsAsync(new ResourceNotFoundException()); // Act var result = await this.storage.GetConfigTypesListAsync(); // Assert Assert.Empty(result.ConfigTypes); } [Fact] public async Task InvalidPackageThrowsTest() { // Arrange var pkg = new PackageServiceModel { Id = string.Empty, Name = "testpackage", PackageType = PackageType.EdgeManifest, Content = "InvalidPackage", }; // Act & Assert await Assert.ThrowsAsync<InvalidInputException>(async () => await this.storage.AddPackageAsync(pkg, It.IsAny<string>(), It.IsAny<string>())); } [Fact] public async Task DeletePackageAsyncTest() { // Arrange var packageId = this.rand.NextString(); this.mockClient .Setup(x => x.DeleteAsync( It.Is<string>(s => s == PackagesCollectionId), It.Is<string>(s => s == packageId))) .Returns(Task.FromResult(0)); // Act await this.storage.DeletePackageAsync(packageId, UserId, TenantId); // Assert this.mockClient .Verify( x => x.DeleteAsync( It.Is<string>(s => s == PackagesCollectionId), It.Is<string>(s => s == packageId)), Times.Once); } [Theory] [Trait(Constants.Type, Constants.UnitTest)] [InlineData("alpha", 1)] [InlineData("namespace.alpha", 1)] [InlineData("alphanum3ric", 1)] [InlineData("namespace.alphanum3ric", 1)] [InlineData("1234567890", 1)] [InlineData("namespace.1234567890", 1)] [InlineData(null, 0)] #pragma warning disable SA1122 [InlineData("", 0)] #pragma warning restore SA1122 public async Task PackageTagsCanBeAdded(string tag, int expectedTagCount) { // Arrange this.mockClient.Setup(m => m.GetAsync(Storage.PackagesCollectionId, this.packageId)) .ReturnsAsync(new ValueApiModel { Data = @"{ ""Tags"": []}" }); this.mockClient .Setup(m => m.UpdateAsync( Storage.PackagesCollectionId, this.packageId, It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = $@"{{ ""Tags"": [""{tag}""]}}" }); // Act var package = await this.storage.AddPackageTagAsync(this.packageId, tag, UserId); // Assert Assert.Equal(expectedTagCount, package.Tags.Count); if (expectedTagCount > 0) { Assert.Contains(tag, package.Tags); } } [Theory] [Trait(Constants.Type, Constants.UnitTest)] [InlineData("alpha", 5)] [InlineData("namespace.alpha", 5)] [InlineData("alphanum3ric", 5)] [InlineData("namespace.alphanum3ric", 5)] [InlineData("1234567890", 5)] [InlineData("namespace.1234567890", 5)] [InlineData("non-existent-tag", 6)] [InlineData(null, 6)] #pragma warning disable SA1122 [InlineData("", 6)] #pragma warning restore SA1122 public async Task PackageTagsCanBeRemoved(string tag, int expectedTagCount) { // Arrange var value = new ValueApiModel { Key = this.packageId, Data = JsonConvert.SerializeObject(new PackageServiceModel { Tags = this.tags.ToList() }), }; this.mockClient.Setup(m => m.GetAsync(Storage.PackagesCollectionId, this.packageId)).ReturnsAsync(value); this.mockClient.Setup(m => m.UpdateAsync(Storage.PackagesCollectionId, this.packageId, It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync((string c, string id, string v, string e) => { return new ValueApiModel { Key = id, Data = v }; }); // Act var result = await this.storage.RemovePackageTagAsync(this.packageId, tag, UserId); // Assert Assert.Equal(expectedTagCount, result.Tags.Count); } [Fact] public async Task AddingPackageTagsIsCaseInsensitive() { // Arrange var tag = "myTaG"; this.mockClient.Setup(m => m.GetAsync(Storage.PackagesCollectionId, this.packageId)) .ReturnsAsync(new ValueApiModel { Data = $@"{{ ""Tags"": [""{tag}""]}}" }); // Act var package = await this.storage.AddPackageTagAsync(this.packageId, tag, UserId); // Assert Assert.Equal(1, package.Tags.Count); Assert.Contains(tag, package.Tags); } [Fact] public async Task RemovingPackageTagsIsCaseInsensitive() { // Arrange var tag = "myTaG"; this.mockClient.Setup(m => m.GetAsync( Storage.PackagesCollectionId, this.packageId)) .ReturnsAsync(new ValueApiModel { Data = $@"{{ ""Tags"": [""{tag}""]}}" }); this.mockClient .Setup(m => m.UpdateAsync( Storage.PackagesCollectionId, this.packageId, It.IsAny<string>(), It.IsAny<string>())).ReturnsAsync(new ValueApiModel { Data = @"{ ""Tags"": []}" }); // Act var package = await this.storage.RemovePackageTagAsync(this.packageId, "MYtAg", UserId); // Assert this.mockClient.Verify( m => m.UpdateAsync( Storage.PackagesCollectionId, this.packageId, It.IsAny<string>(), It.IsAny<string>()), Times.Once); } private bool IsMatchingPackage(string pkgJson, string originalPkgJson) { const string dateCreatedField = "DateCreated"; var createdPkg = JObject.Parse(pkgJson); var originalPkg = JObject.Parse(originalPkgJson); // To prevent false failures on unit tests we allow a couple of seconds diffence // when verifying the date created. var dateCreated = DateTimeOffset.Parse(createdPkg[dateCreatedField].ToString()); var secondsDiff = (DateTimeOffset.UtcNow - dateCreated).TotalSeconds; if (secondsDiff > 3) { return false; } createdPkg.Remove(dateCreatedField); originalPkg.Remove(dateCreatedField); return JToken.DeepEquals(createdPkg, originalPkg); } private TelemetryClient InitializeMockTelemetryChannel() { // Application Insights TelemetryClient doesn't have an interface (and is sealed) hence implementation of a class that implements a mock MockTelemetryChannel mockTelemetryChannel = new MockTelemetryChannel(); TelemetryConfiguration mockTelemetryConfiguration = new TelemetryConfiguration { TelemetryChannel = mockTelemetryChannel, InstrumentationKey = Guid.NewGuid().ToString(), }; TelemetryClient mockTelemetryClient = new TelemetryClient(mockTelemetryConfiguration); return mockTelemetryClient; } private async Task<Logo> SetLogoHelper(Logo logo, string oldImage, string oldName, string oldType, bool isDefault) { this.mockClient .Setup(x => x.UpdateAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync((string id, string key, string value, string etag) => new ValueApiModel { Data = value, }); this.mockClient.Setup(x => x.GetAsync(It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(new ValueApiModel { Data = JsonConvert.SerializeObject(new Logo { Image = oldImage, Type = oldType, Name = oldName, IsDefault = false, }), }); Logo result = await this.storage.SetLogoAsync(logo); this.mockClient .Verify( x => x.UpdateAsync( It.Is<string>(s => s == Storage.SolutionCollectionId), It.Is<string>(s => s == Storage.LogoKey), It.Is<string>(s => s == JsonConvert.SerializeObject(logo)), It.Is<string>(s => s == "*")), Times.Once); return result; } } }
38.211916
154
0.468255
[ "MIT" ]
JonathanAsbury-SPS/azure-iot-platform-dotnet
test/services/config/Services.Test/StorageTest.cs
50,669
C#
using LiveCharts; using LiveCharts.Configurations; using LiveCharts.Defaults; using LiveCharts.Definitions.Charts; using LiveCharts.Uwp; using System; using Windows.UI.Xaml.Controls; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace UWP.CartesianChart.LogarithmScale { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class LogarithmScaleExample : Page { public LogarithmScaleExample() { InitializeComponent(); SeriesCollection = new SeriesCollection(Mappers.Xy<ObservablePoint>() .X(point => Math.Log10(point.X)) .Y(point => point.Y)) { new LineSeries { Values = new ChartValues<ObservablePoint> { new ObservablePoint(1, 5), new ObservablePoint(10, 6), new ObservablePoint(100, 4), new ObservablePoint(1000, 2), new ObservablePoint(10000, 8), new ObservablePoint(100000, 2), new ObservablePoint(1000000, 9), new ObservablePoint(10000000, 8) } } }; Formatter = value => Math.Pow(10, value).ToString("N"); DataContext = this; } public SeriesCollection SeriesCollection { get; set; } public Func<double, string> Formatter { get; set; } public ISeparatorView CleanSeparator { get; set; } = DefaultAxes.CleanSeparator; } }
33.403846
94
0.552677
[ "MIT" ]
A36664-joingame/LiveCharts
Examples/UWP/CartesianChart/LogarithmScale/LogarithmScaleExample.xaml.cs
1,739
C#
using System; using System.Collections.Generic; using System.Text; namespace CarRental.Core.CrossCuttingConcerns.Logging.Log4Net.Loggers { public class DatabaseLogger : LoggerServiceBase { public DatabaseLogger() : base("DatabaseLogger") { } } }
20.285714
69
0.697183
[ "Apache-2.0" ]
kdrkrgz/Kiralamax
src/api/CarRental.Core/CrossCuttingConcerns/Logging/Log4Net/Loggers/DatabaseLogger.cs
286
C#
using FlightNode.Identity.Domain.Entities; using FlightNode.Identity.Services.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace FlightNode.Identity.UnitTests.Domain.Managers.UserDomainManagerTests { public class ChangeForgottenPassword : Fixture { [Fact] public void NullTokenNotAllowed() { var input = new ChangePasswordModel(); try { var a = BuildSystem().ChangeForgottenPassword(null, input).Result; } catch (AggregateException agg) { Assert.IsType<ArgumentNullException>(agg.InnerException); } } [Fact] public void EmptyStringTokenNotAllowed() { var input = new ChangePasswordModel(); try { var a = BuildSystem().ChangeForgottenPassword(" ", input).Result; } catch (AggregateException agg) { Assert.IsType<ArgumentException>(agg.InnerException); } } [Fact] public void NullInputModelNotAllowed() { const string token = "asdfA"; try { var a = BuildSystem().ChangeForgottenPassword(token, null).Result; } catch (AggregateException agg) { Assert.IsType<ArgumentNullException>(agg.InnerException); } } [Fact] public void UserDoesNotExistthenReturnFalse() { // Arrange const string token = "asdfA"; var input = new ChangePasswordModel { EmailAddress = "dd", Password = "ee" }; // .. can't find the user MockUserManager.SetupGet(x => x.Users) .Returns(new List<User>().AsQueryable()); // Act var result = BuildSystem().ChangeForgottenPassword(token, input).Result; // Assert Assert.Equal(result, ChangeForgottenPasswordResult.UserDoesNotExist); } [Fact] public void TokenIsNotValidThenReturnFalse() { // Arrange const string token = "asdfA"; var input = new ChangePasswordModel { EmailAddress = "dd", Password = "ee" }; var user = new User { Id = 2, Email = input.EmailAddress }; // .. Find the user MockUserManager.SetupGet(x => x.Users) .Returns(new List<User> { user }.AsQueryable()); // .. invalid token MockUserManager.Setup(x => x.ResetPasswordAsync(user.Id, token, input.Password)) .Returns(Task.FromResult(new Microsoft.AspNet.Identity.IdentityResult("Invalid token."))); // Act var result = BuildSystem().ChangeForgottenPassword(token, input).Result; // Assert Assert.Equal(result, ChangeForgottenPasswordResult.BadToken); } [Fact] public void PasswordDoesNotMeetComplexityRequirements() { // Arrange const string token = "asdfA"; var input = new ChangePasswordModel { EmailAddress = "dd", Password = "ee" }; var user = new User { Id = 2, Email = input.EmailAddress }; // .. Find the user MockUserManager.SetupGet(x => x.Users) .Returns(new List<User> { user }.AsQueryable()); // .. invalid password MockUserManager.Setup(x => x.ResetPasswordAsync(user.Id, token, input.Password)) .Returns(Task.FromResult(new Microsoft.AspNet.Identity.IdentityResult("Passwords must be at ..."))); // Act var result = BuildSystem().ChangeForgottenPassword(token, input).Result; // Assert Assert.Equal(result, ChangeForgottenPasswordResult.InvalidPassword); } [Fact] public void HappyPath() { // Arrange const string token = "asdfA"; var input = new ChangePasswordModel { EmailAddress = "dd", Password = "ee" }; var user = new User { Id = 2, Email = input.EmailAddress }; // .. Find the user MockUserManager.SetupGet(x => x.Users) .Returns(new List<User> { user }.AsQueryable()); MockUserManager.Setup(x => x.ResetPasswordAsync(user.Id, token, input.Password)) .Returns(Task.FromResult(SuccessResult.Create())); // Act var result = BuildSystem().ChangeForgottenPassword(token, input).Result; // Assert Assert.Equal(result, ChangeForgottenPasswordResult.Happy); } } }
29.288136
116
0.516011
[ "MIT" ]
FlightNode/FlightNode.Api
Identity/test/Domain/Managers/UserDomainManagerTests/ChangeForgottenPassword.cs
5,186
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Data; using System.Data.SqlTypes; using System.Diagnostics.Tracing; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Security; using System.Threading; using System.Threading.Tasks; using Microsoft.Identity.Client; using Microsoft.Data.SqlClient.TestUtilities; using Xunit; namespace Microsoft.Data.SqlClient.ManualTesting.Tests { public static class DataTestUtility { public static readonly string NPConnectionString = null; public static readonly string TCPConnectionString = null; public static readonly string TCPConnectionStringHGSVBS = null; public static readonly string TCPConnectionStringAASVBS = null; public static readonly string TCPConnectionStringNoneVBS = null; public static readonly string TCPConnectionStringAASSGX = null; public static readonly string AADAuthorityURL = null; public static readonly string AADPasswordConnectionString = null; public static readonly string AADServicePrincipalId = null; public static readonly string AADServicePrincipalSecret = null; public static readonly string AKVBaseUrl = null; public static readonly string AKVUrl = null; public static readonly string AKVOriginalUrl = null; public static readonly string AKVTenantId = null; public static readonly string AKVClientId = null; public static readonly string AKVClientSecret = null; public static readonly string LocalDbAppName = null; public static readonly string LocalDbSharedInstanceName = null; public static List<string> AEConnStrings = new List<string>(); public static List<string> AEConnStringsSetup = new List<string>(); public static bool EnclaveEnabled { get; private set; } = false; public static readonly bool TracingEnabled = false; public static readonly bool SupportsIntegratedSecurity = false; public static readonly bool UseManagedSNIOnWindows = false; public static readonly bool IsAzureSynapse = false; public static Uri AKVBaseUri = null; public static readonly string MakecertPath = null; public static string FileStreamDirectory = null; public static readonly string DNSCachingConnString = null; public static readonly string DNSCachingServerCR = null; // this is for the control ring public static readonly string DNSCachingServerTR = null; // this is for the tenant ring public static readonly bool IsDNSCachingSupportedCR = false; // this is for the control ring public static readonly bool IsDNSCachingSupportedTR = false; // this is for the tenant ring public static readonly string UserManagedIdentityClientId = null; public static readonly string EnclaveAzureDatabaseConnString = null; public static bool ManagedIdentitySupported = true; public static string AADAccessToken = null; public static string AADSystemIdentityAccessToken = null; public static string AADUserIdentityAccessToken = null; public const string ApplicationClientId = "2fd908ad-0664-4344-b9be-cd3e8b574c38"; public const string UdtTestDbName = "UdtTestDb"; public const string AKVKeyName = "TestSqlClientAzureKeyVaultProvider"; public const string EventSourcePrefix = "Microsoft.Data.SqlClient"; public const string MDSEventSourceName = "Microsoft.Data.SqlClient.EventSource"; public const string AKVEventSourceName = "Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.EventSource"; private const string ManagedNetworkingAppContextSwitch = "Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows"; private static Dictionary<string, bool> AvailableDatabases; private static BaseEventListener TraceListener; //Kerberos variables public static readonly string KerberosDomainUser = null; internal static readonly string KerberosDomainPassword = null; static DataTestUtility() { Config c = Config.Load(); NPConnectionString = c.NPConnectionString; TCPConnectionString = c.TCPConnectionString; TCPConnectionStringHGSVBS = c.TCPConnectionStringHGSVBS; TCPConnectionStringAASVBS = c.TCPConnectionStringAASVBS; TCPConnectionStringNoneVBS = c.TCPConnectionStringNoneVBS; TCPConnectionStringAASSGX = c.TCPConnectionStringAASSGX; AADAuthorityURL = c.AADAuthorityURL; AADPasswordConnectionString = c.AADPasswordConnectionString; AADServicePrincipalId = c.AADServicePrincipalId; AADServicePrincipalSecret = c.AADServicePrincipalSecret; LocalDbAppName = c.LocalDbAppName; LocalDbSharedInstanceName = c.LocalDbSharedInstanceName; SupportsIntegratedSecurity = c.SupportsIntegratedSecurity; FileStreamDirectory = c.FileStreamDirectory; EnclaveEnabled = c.EnclaveEnabled; TracingEnabled = c.TracingEnabled; UseManagedSNIOnWindows = c.UseManagedSNIOnWindows; DNSCachingConnString = c.DNSCachingConnString; DNSCachingServerCR = c.DNSCachingServerCR; DNSCachingServerTR = c.DNSCachingServerTR; IsAzureSynapse = c.IsAzureSynapse; IsDNSCachingSupportedCR = c.IsDNSCachingSupportedCR; IsDNSCachingSupportedTR = c.IsDNSCachingSupportedTR; EnclaveAzureDatabaseConnString = c.EnclaveAzureDatabaseConnString; UserManagedIdentityClientId = c.UserManagedIdentityClientId; MakecertPath = c.MakecertPath; KerberosDomainPassword = c.KerberosDomainPassword; KerberosDomainUser = c.KerberosDomainUser; System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12; if (TracingEnabled) { TraceListener = new BaseEventListener(); } if (UseManagedSNIOnWindows) { AppContext.SetSwitch(ManagedNetworkingAppContextSwitch, true); Console.WriteLine($"App Context switch {ManagedNetworkingAppContextSwitch} enabled on {Environment.OSVersion}"); } AKVOriginalUrl = c.AzureKeyVaultURL; if (!string.IsNullOrEmpty(AKVOriginalUrl) && Uri.TryCreate(AKVOriginalUrl, UriKind.Absolute, out AKVBaseUri)) { AKVBaseUri = new Uri(AKVBaseUri, "/"); AKVBaseUrl = AKVBaseUri.AbsoluteUri; AKVUrl = (new Uri(AKVBaseUri, $"/keys/{AKVKeyName}")).AbsoluteUri; } AKVTenantId = c.AzureKeyVaultTenantId; AKVClientId = c.AzureKeyVaultClientId; AKVClientSecret = c.AzureKeyVaultClientSecret; if (EnclaveEnabled) { if (!string.IsNullOrEmpty(TCPConnectionStringHGSVBS)) { AEConnStrings.Add(TCPConnectionStringHGSVBS); AEConnStringsSetup.Add(TCPConnectionStringHGSVBS); } if (!string.IsNullOrEmpty(TCPConnectionStringAASVBS)) { AEConnStrings.Add(TCPConnectionStringAASVBS); } if (!string.IsNullOrEmpty(TCPConnectionStringNoneVBS)) { AEConnStrings.Add(TCPConnectionStringNoneVBS); AEConnStringsSetup.Add(TCPConnectionStringNoneVBS); } if (!string.IsNullOrEmpty(TCPConnectionStringAASSGX)) { AEConnStrings.Add(TCPConnectionStringAASSGX); AEConnStringsSetup.Add(TCPConnectionStringAASSGX); } } else { if (!string.IsNullOrEmpty(TCPConnectionString)) { AEConnStrings.Add(TCPConnectionString); AEConnStringsSetup.Add(TCPConnectionString); } } } public static IEnumerable<string> ConnectionStrings => GetConnectionStrings(withEnclave: true); public static IEnumerable<string> GetConnectionStrings(bool withEnclave) { if (!string.IsNullOrEmpty(TCPConnectionString)) { yield return TCPConnectionString; } // Named Pipes are not supported on Unix platform and for Azure DB if (Environment.OSVersion.Platform != PlatformID.Unix && IsNotAzureServer() && !string.IsNullOrEmpty(NPConnectionString)) { yield return NPConnectionString; } if (withEnclave && EnclaveEnabled) { foreach (var connStr in AEConnStrings) { yield return connStr; } } } private static string GenerateAccessToken(string authorityURL, string aADAuthUserID, string aADAuthPassword) { return AcquireTokenAsync(authorityURL, aADAuthUserID, aADAuthPassword).Result; } private static Task<string> AcquireTokenAsync(string authorityURL, string userID, string password) => Task.Run(() => { // The below properties are set specific to test configurations. string scope = "https://database.windows.net//.default"; string applicationName = "Microsoft Data SqlClient Manual Tests"; string clientVersion = "1.0.0.0"; string adoClientId = "2fd908ad-0664-4344-b9be-cd3e8b574c38"; IPublicClientApplication app = PublicClientApplicationBuilder.Create(adoClientId) .WithAuthority(authorityURL) .WithClientName(applicationName) .WithClientVersion(clientVersion) .Build(); AuthenticationResult result; string[] scopes = new string[] { scope }; // Note: CorrelationId, which existed in ADAL, can not be set in MSAL (yet?). // parameter.ConnectionId was passed as the CorrelationId in ADAL to aid support in troubleshooting. // If/When MSAL adds CorrelationId support, it should be passed from parameters here, too. SecureString securePassword = new SecureString(); foreach (char c in password) securePassword.AppendChar(c); securePassword.MakeReadOnly(); result = app.AcquireTokenByUsernamePassword(scopes, userID, securePassword).ExecuteAsync().Result; return result.AccessToken; }); public static bool IsKerberosTest => !string.IsNullOrEmpty(KerberosDomainUser) && !string.IsNullOrEmpty(KerberosDomainPassword); public static bool IsDatabasePresent(string name) { AvailableDatabases = AvailableDatabases ?? new Dictionary<string, bool>(); bool present = false; if (AreConnStringsSetup() && !string.IsNullOrEmpty(name) && !AvailableDatabases.TryGetValue(name, out present)) { var builder = new SqlConnectionStringBuilder(TCPConnectionString); builder.ConnectTimeout = 2; using (var connection = new SqlConnection(builder.ToString())) using (var command = new SqlCommand("SELECT COUNT(*) FROM sys.databases WHERE name=@name", connection)) { connection.Open(); command.Parameters.AddWithValue("name", name); present = Convert.ToInt32(command.ExecuteScalar()) == 1; } AvailableDatabases[name] = present; } return present; } /// <summary> /// Checks if object SYS.SENSITIVITY_CLASSIFICATIONS exists in SQL Server /// </summary> /// <returns>True, if target SQL Server supports Data Classification</returns> public static bool IsSupportedDataClassification() { try { using (var connection = new SqlConnection(TCPConnectionString)) using (var command = new SqlCommand("SELECT * FROM SYS.SENSITIVITY_CLASSIFICATIONS", connection)) { connection.Open(); command.ExecuteNonQuery(); } } catch (SqlException e) { // Check for Error 208: Invalid Object Name if (e.Errors != null && e.Errors[0].Number == 208) { return false; } } return true; } public static bool IsDNSCachingSetup() => !string.IsNullOrEmpty(DNSCachingConnString); // Synapse: Always Encrypted is not supported with Azure Synapse. // Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/17858869-support-always-encrypted-in-sql-data-warehouse public static bool IsEnclaveAzureDatabaseSetup() { return EnclaveEnabled && !string.IsNullOrEmpty(EnclaveAzureDatabaseConnString) && IsNotAzureSynapse(); } public static bool IsNotAzureSynapse() => !IsAzureSynapse; // Synapse: UDT Test Database not compatible with Azure Synapse. public static bool IsUdtTestDatabasePresent() => IsDatabasePresent(UdtTestDbName) && IsNotAzureSynapse(); public static bool AreConnStringsSetup() { return !string.IsNullOrEmpty(NPConnectionString) && !string.IsNullOrEmpty(TCPConnectionString); } // Synapse: Always Encrypted is not supported with Azure Synapse. // Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/17858869-support-always-encrypted-in-sql-data-warehouse public static bool AreConnStringSetupForAE() { return AEConnStrings.Count > 0 && IsNotAzureSynapse(); } public static bool IsSGXEnclaveConnStringSetup() => !string.IsNullOrEmpty(TCPConnectionStringAASSGX); public static bool IsAADPasswordConnStrSetup() { return !string.IsNullOrEmpty(AADPasswordConnectionString); } public static bool IsAADServicePrincipalSetup() { return !string.IsNullOrEmpty(AADServicePrincipalId) && !string.IsNullOrEmpty(AADServicePrincipalSecret); } public static bool IsAADAuthorityURLSetup() { return !string.IsNullOrEmpty(AADAuthorityURL); } public static bool IsNotAzureServer() { return !AreConnStringsSetup() || !Utils.IsAzureSqlServer(new SqlConnectionStringBuilder((TCPConnectionString)).DataSource); } // Synapse: Always Encrypted is not supported with Azure Synapse. // Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/17858869-support-always-encrypted-in-sql-data-warehouse public static bool IsAKVSetupAvailable() { return !string.IsNullOrEmpty(AKVUrl) && !string.IsNullOrEmpty(AKVClientId) && !string.IsNullOrEmpty(AKVClientSecret) && !string.IsNullOrEmpty(AKVTenantId) && IsNotAzureSynapse(); } public static bool IsUsingManagedSNI() => UseManagedSNIOnWindows; public static bool IsNotUsingManagedSNIOnWindows() => !UseManagedSNIOnWindows; public static bool IsUsingNativeSNI() => !IsUsingManagedSNI(); // Synapse: UTF8 collations are not supported with Azure Synapse. // Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/40103791-utf-8-collations-should-be-supported-in-azure-syna public static bool IsUTF8Supported() { bool retval = false; if (AreConnStringsSetup() && IsNotAzureSynapse()) { using (SqlConnection connection = new SqlConnection(TCPConnectionString)) using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = "SELECT CONNECTIONPROPERTY('SUPPORT_UTF8')"; connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { // CONNECTIONPROPERTY('SUPPORT_UTF8') returns NULL in SQLServer versions that don't support UTF-8. retval = !reader.IsDBNull(0); } } } } return retval; } public static bool IsTCPConnectionStringPasswordIncluded() { return RetrieveValueFromConnStr(TCPConnectionString, new string[] { "Password", "PWD" }) != string.Empty; } public static bool DoesHostAddressContainBothIPv4AndIPv6() { if (!IsDNSCachingSetup()) { return false; } using (var connection = new SqlConnection(DNSCachingConnString)) { List<IPAddress> ipAddresses = Dns.GetHostAddresses(connection.DataSource).ToList(); return ipAddresses.Exists(ip => ip.AddressFamily == AddressFamily.InterNetwork) && ipAddresses.Exists(ip => ip.AddressFamily == AddressFamily.InterNetworkV6); } } /// <summary> /// Generate a unique name to use in Sql Server; /// some providers does not support names (Oracle supports up to 30). /// </summary> /// <param name="prefix">The name length will be no more then (16 + prefix.Length + escapeLeft.Length + escapeRight.Length).</param> /// <param name="withBracket">Name without brackets.</param> /// <returns>Unique name by considering the Sql Server naming rules.</returns> public static string GetUniqueName(string prefix, bool withBracket = true) { string escapeLeft = withBracket ? "[" : string.Empty; string escapeRight = withBracket ? "]" : string.Empty; string uniqueName = string.Format("{0}{1}_{2}_{3}{4}", escapeLeft, prefix, DateTime.Now.Ticks.ToString("X", CultureInfo.InvariantCulture), // up to 8 characters Guid.NewGuid().ToString().Substring(0, 6), // take the first 6 characters only escapeRight); return uniqueName; } /// <summary> /// Uses environment values `UserName` and `MachineName` in addition to the specified `prefix` and current date /// to generate a unique name to use in Sql Server; /// SQL Server supports long names (up to 128 characters), add extra info for troubleshooting. /// </summary> /// <param name="prefix">Add the prefix to the generate string.</param> /// <param name="withBracket">Database name must be pass with brackets by default.</param> /// <returns>Unique name by considering the Sql Server naming rules.</returns> public static string GetUniqueNameForSqlServer(string prefix, bool withBracket = true) { string extendedPrefix = string.Format( "{0}_{1}_{2}@{3}", prefix, Environment.UserName, Environment.MachineName, DateTime.Now.ToString("yyyy_MM_dd", CultureInfo.InvariantCulture)); string name = GetUniqueName(extendedPrefix, withBracket); if (name.Length > 128) { throw new ArgumentOutOfRangeException("the name is too long - SQL Server names are limited to 128"); } return name; } public static void DropTable(SqlConnection sqlConnection, string tableName) { using (SqlCommand cmd = new SqlCommand(string.Format("IF (OBJECT_ID('{0}') IS NOT NULL) \n DROP TABLE {0}", tableName), sqlConnection)) { cmd.ExecuteNonQuery(); } } public static void DropUserDefinedType(SqlConnection sqlConnection, string typeName) { using (SqlCommand cmd = new SqlCommand(string.Format("IF (TYPE_ID('{0}') IS NOT NULL) \n DROP TYPE {0}", typeName), sqlConnection)) { cmd.ExecuteNonQuery(); } } public static void DropStoredProcedure(SqlConnection sqlConnection, string spName) { using (SqlCommand cmd = new SqlCommand(string.Format("IF (OBJECT_ID('{0}') IS NOT NULL) \n DROP PROCEDURE {0}", spName), sqlConnection)) { cmd.ExecuteNonQuery(); } } /// <summary> /// Drops specified database on provided connection. /// </summary> /// <param name="sqlConnection">Open connection to be used.</param> /// <param name="dbName">Database name without brackets.</param> public static void DropDatabase(SqlConnection sqlConnection, string dbName) { using SqlCommand cmd = new(string.Format("IF (EXISTS(SELECT 1 FROM sys.databases WHERE name = '{0}')) \nBEGIN \n ALTER DATABASE [{0}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE \n DROP DATABASE [{0}] \nEND", dbName), sqlConnection); cmd.ExecuteNonQuery(); } public static bool IsLocalDBInstalled() => !string.IsNullOrEmpty(LocalDbAppName?.Trim()) && IsIntegratedSecuritySetup(); public static bool IsLocalDbSharedInstanceSetup() => !string.IsNullOrEmpty(LocalDbSharedInstanceName?.Trim()) && IsIntegratedSecuritySetup(); public static bool IsIntegratedSecuritySetup() => SupportsIntegratedSecurity; public static string GetAccessToken() { if (null == AADAccessToken && IsAADPasswordConnStrSetup() && IsAADAuthorityURLSetup()) { string username = RetrieveValueFromConnStr(AADPasswordConnectionString, new string[] { "User ID", "UID" }); string password = RetrieveValueFromConnStr(AADPasswordConnectionString, new string[] { "Password", "PWD" }); AADAccessToken = GenerateAccessToken(AADAuthorityURL, username, password); } // Creates a new Object Reference of Access Token - See GitHub Issue 438 return (null != AADAccessToken) ? new string(AADAccessToken.ToCharArray()) : null; } public static string GetSystemIdentityAccessToken() { if (true == ManagedIdentitySupported && null == AADSystemIdentityAccessToken && IsAADPasswordConnStrSetup()) { AADSystemIdentityAccessToken = AADUtility.GetManagedIdentityToken().GetAwaiter().GetResult(); if (AADSystemIdentityAccessToken == null) { ManagedIdentitySupported = false; } } return (null != AADSystemIdentityAccessToken) ? new string(AADSystemIdentityAccessToken.ToCharArray()) : null; } public static string GetUserIdentityAccessToken() { if (true == ManagedIdentitySupported && null == AADUserIdentityAccessToken && IsAADPasswordConnStrSetup()) { // Pass User Assigned Managed Identity Client Id here. AADUserIdentityAccessToken = AADUtility.GetManagedIdentityToken(UserManagedIdentityClientId).GetAwaiter().GetResult(); if (AADUserIdentityAccessToken == null) { ManagedIdentitySupported = false; } } return (null != AADUserIdentityAccessToken) ? new string(AADUserIdentityAccessToken.ToCharArray()) : null; } public static bool IsAccessTokenSetup() => !string.IsNullOrEmpty(GetAccessToken()); public static bool IsSystemIdentityTokenSetup() => !string.IsNullOrEmpty(GetSystemIdentityAccessToken()); public static bool IsUserIdentityTokenSetup() => !string.IsNullOrEmpty(GetUserIdentityAccessToken()); public static bool IsFileStreamSetup() => !string.IsNullOrEmpty(FileStreamDirectory) && IsNotAzureServer() && IsNotAzureSynapse(); private static bool CheckException<TException>(Exception ex, string exceptionMessage, bool innerExceptionMustBeNull) where TException : Exception { return ((ex != null) && (ex is TException) && ((string.IsNullOrEmpty(exceptionMessage)) || (ex.Message.Contains(exceptionMessage))) && ((!innerExceptionMustBeNull) || (ex.InnerException == null))); } public static void AssertEqualsWithDescription(object expectedValue, object actualValue, string failMessage) { if (expectedValue == null || actualValue == null) { var msg = string.Format("{0}\nExpected: {1}\nActual: {2}", failMessage, expectedValue, actualValue); Assert.True(expectedValue == actualValue, msg); } else { var msg = string.Format("{0}\nExpected: {1} ({2})\nActual: {3} ({4})", failMessage, expectedValue, expectedValue.GetType(), actualValue, actualValue.GetType()); Assert.True(expectedValue.Equals(actualValue), msg); } } public static TException AssertThrowsWrapper<TException>(Action actionThatFails, string exceptionMessage = null, bool innerExceptionMustBeNull = false, Func<TException, bool> customExceptionVerifier = null) where TException : Exception { TException ex = Assert.Throws<TException>(actionThatFails); if (exceptionMessage != null) { Assert.True(ex.Message.Contains(exceptionMessage), string.Format("FAILED: Exception did not contain expected message.\nExpected: {0}\nActual: {1}", exceptionMessage, ex.Message)); } if (innerExceptionMustBeNull) { Assert.True(ex.InnerException == null, "FAILED: Expected InnerException to be null."); } if (customExceptionVerifier != null) { Assert.True(customExceptionVerifier(ex), "FAILED: Custom exception verifier returned false for this exception."); } return ex; } public static TException AssertThrowsWrapper<TException, TInnerException>(Action actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, bool innerExceptionMustBeNull = false, Func<TException, bool> customExceptionVerifier = null) where TException : Exception { TException ex = AssertThrowsWrapper<TException>(actionThatFails, exceptionMessage, innerExceptionMustBeNull, customExceptionVerifier); if (innerExceptionMessage != null) { Assert.True(ex.InnerException != null, "FAILED: Cannot check innerExceptionMessage because InnerException is null."); Assert.True(ex.InnerException.Message.Contains(innerExceptionMessage), string.Format("FAILED: Inner Exception did not contain expected message.\nExpected: {0}\nActual: {1}", innerExceptionMessage, ex.InnerException.Message)); } return ex; } public static TException AssertThrowsWrapper<TException, TInnerException, TInnerInnerException>(Action actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, string innerInnerExceptionMessage = null, bool innerInnerInnerExceptionMustBeNull = false) where TException : Exception where TInnerException : Exception where TInnerInnerException : Exception { TException ex = AssertThrowsWrapper<TException, TInnerException>(actionThatFails, exceptionMessage, innerExceptionMessage); if (innerInnerInnerExceptionMustBeNull) { Assert.True(ex.InnerException != null, "FAILED: Cannot check innerInnerInnerExceptionMustBeNull since InnerException is null"); Assert.True(ex.InnerException.InnerException == null, "FAILED: Expected InnerInnerException to be null."); } if (innerInnerExceptionMessage != null) { Assert.True(ex.InnerException != null, "FAILED: Cannot check innerInnerExceptionMessage since InnerException is null"); Assert.True(ex.InnerException.InnerException != null, "FAILED: Cannot check innerInnerExceptionMessage since InnerInnerException is null"); Assert.True(ex.InnerException.InnerException.Message.Contains(innerInnerExceptionMessage), string.Format("FAILED: Inner Exception did not contain expected message.\nExpected: {0}\nActual: {1}", innerInnerExceptionMessage, ex.InnerException.InnerException.Message)); } return ex; } public static TException ExpectFailure<TException>(Action actionThatFails, string[] exceptionMessages, bool innerExceptionMustBeNull = false, Func<TException, bool> customExceptionVerifier = null) where TException : Exception { try { actionThatFails(); Assert.False(true, "ERROR: Did not get expected exception"); return null; } catch (Exception ex) { foreach (string exceptionMessage in exceptionMessages) { if ((CheckException<TException>(ex, exceptionMessage, innerExceptionMustBeNull)) && ((customExceptionVerifier == null) || (customExceptionVerifier(ex as TException)))) { return (ex as TException); } } throw; } } public static TException ExpectFailure<TException, TInnerException>(Action actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, bool innerInnerExceptionMustBeNull = false) where TException : Exception where TInnerException : Exception { try { actionThatFails(); Assert.False(true, "ERROR: Did not get expected exception"); return null; } catch (Exception ex) { if ((CheckException<TException>(ex, exceptionMessage, false)) && (CheckException<TInnerException>(ex.InnerException, innerExceptionMessage, innerInnerExceptionMustBeNull))) { return (ex as TException); } else { throw; } } } public static TException ExpectFailure<TException, TInnerException, TInnerInnerException>(Action actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, string innerInnerExceptionMessage = null, bool innerInnerInnerExceptionMustBeNull = false) where TException : Exception where TInnerException : Exception where TInnerInnerException : Exception { try { actionThatFails(); Assert.False(true, "ERROR: Did not get expected exception"); return null; } catch (Exception ex) { if ((CheckException<TException>(ex, exceptionMessage, false)) && (CheckException<TInnerException>(ex.InnerException, innerExceptionMessage, false)) && (CheckException<TInnerInnerException>(ex.InnerException.InnerException, innerInnerExceptionMessage, innerInnerInnerExceptionMustBeNull))) { return (ex as TException); } else { throw; } } } public static void ExpectAsyncFailure<TException>(Func<Task> actionThatFails, string exceptionMessage = null, bool innerExceptionMustBeNull = false) where TException : Exception { ExpectFailure<AggregateException, TException>(() => actionThatFails().Wait(), null, exceptionMessage, innerExceptionMustBeNull); } public static void ExpectAsyncFailure<TException, TInnerException>(Func<Task> actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, bool innerInnerExceptionMustBeNull = false) where TException : Exception where TInnerException : Exception { ExpectFailure<AggregateException, TException, TInnerException>(() => actionThatFails().Wait(), null, exceptionMessage, innerExceptionMessage, innerInnerExceptionMustBeNull); } public static string GenerateObjectName() { return string.Format("TEST_{0}{1}{2}", Environment.GetEnvironmentVariable("ComputerName"), Environment.TickCount, Guid.NewGuid()).Replace('-', '_'); } // Returns randomly generated characters of length 11. public static string GenerateRandomCharacters(string prefix) { string path = Path.GetRandomFileName(); path = path.Replace(".", ""); // Remove period. return prefix + path; } public static void RunNonQuery(string connectionString, string sql, int numberOfRetries = 0) { int retries = 0; while (true) { try { using (SqlConnection connection = new SqlConnection(connectionString)) using (SqlCommand command = connection.CreateCommand()) { connection.Open(); command.CommandText = sql; command.ExecuteNonQuery(); break; } } catch (Exception) { if (retries >= numberOfRetries) { throw; } retries++; Thread.Sleep(1000); } } } public static DataTable RunQuery(string connectionString, string sql) { DataTable result = null; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = connection.CreateCommand()) { command.CommandText = sql; using (SqlDataReader reader = command.ExecuteReader()) { result = new DataTable(); result.Load(reader); } } } return result; } public static void DropFunction(SqlConnection sqlConnection, string funcName) { using (SqlCommand cmd = new SqlCommand(string.Format("IF EXISTS (SELECT * FROM sys.objects WHERE name = '{0}') \n DROP FUNCTION {0}", funcName), sqlConnection)) { cmd.ExecuteNonQuery(); } } public static string GetValueString(object paramValue) { if (paramValue.GetType() == typeof(DateTimeOffset)) { return ((DateTimeOffset)paramValue).ToString("M/d/yyyy hh:mm:ss tt zzz"); } else if (paramValue.GetType() == typeof(DateTime)) { return ((DateTime)paramValue).ToString("M/d/yyyy hh:mm:ss tt"); } else if (paramValue.GetType() == typeof(SqlDateTime)) { return ((SqlDateTime)paramValue).Value.ToString("M/d/yyyy hh:mm:ss tt"); } return paramValue.ToString(); } public static string FetchKeyInConnStr(string connStr, string[] keys) { // tokenize connection string and find matching key if (connStr != null && keys != null) { string[] connProps = connStr.Split(';'); foreach (string cp in connProps) { if (!string.IsNullOrEmpty(cp.Trim())) { foreach (var key in keys) { if (cp.Trim().ToLower().StartsWith(key.Trim().ToLower())) { return cp.Substring(cp.IndexOf('=') + 1); } } } } } return null; } public static string RemoveKeysInConnStr(string connStr, string[] keysToRemove) { // tokenize connection string and remove input keys. string res = ""; if (connStr != null && keysToRemove != null) { string[] keys = connStr.Split(';'); foreach (var key in keys) { if (!string.IsNullOrEmpty(key.Trim())) { bool removeKey = false; foreach (var keyToRemove in keysToRemove) { if (key.Trim().ToLower().StartsWith(keyToRemove.Trim().ToLower())) { removeKey = true; break; } } if (!removeKey) { res += key + ";"; } } } } return res; } public static string RetrieveValueFromConnStr(string connStr, string[] keywords) { // tokenize connection string and retrieve value for a specific key. string res = ""; if (connStr != null && keywords != null) { string[] keys = connStr.Split(';'); foreach (var key in keys) { foreach (var keyword in keywords) { if (!string.IsNullOrEmpty(key.Trim())) { if (key.Trim().ToLower().StartsWith(keyword.Trim().ToLower())) { res = key.Substring(key.IndexOf('=') + 1).Trim(); break; } } } } } return res; } public class AKVEventListener : BaseEventListener { public override string Name => AKVEventSourceName; } public class MDSEventListener : BaseEventListener { public override string Name => MDSEventSourceName; } public class BaseEventListener : EventListener { public readonly List<int> IDs = new(); public readonly List<EventWrittenEventArgs> EventData = new(); public virtual string Name => EventSourcePrefix; protected override void OnEventSourceCreated(EventSource eventSource) { if (eventSource.Name.StartsWith(Name)) { // Collect all traces for better code coverage EnableEvents(eventSource, EventLevel.LogAlways, EventKeywords.All); } else { DisableEvents(eventSource); } } protected override void OnEventWritten(EventWrittenEventArgs eventData) { if (Name == eventData.EventSource.Name) { IDs.Add(eventData.EventId); EventData.Add(eventData); } } } } }
46.386025
389
0.600247
[ "MIT" ]
EngRajabi/SqlClient
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
40,495
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using VAdmin; namespace VAdmin { public class ArgInputStatus { public CommandArg Arg { get; set; } public bool InProgress { get; set; } public ArgValidation Validation { get; set; } = ArgValidation.Valid; } }
17.789474
70
0.739645
[ "MIT" ]
civilgamers/vrp
code/VAdmin/ArgInputStatus.cs
340
C#
using RPA.Interfaces.Nupkg; using RPA.Shared.Configs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace RPA.Services.Nupkg { public class PackageExportSettingsService : IPackageExportSettingsService { private const string _exportDirKey = "PackageExport.LastExportDirectory"; public string GetLastExportDir() { return UserKeyValueConfig.GetValue(_exportDirKey); } public bool SetLastExportDir(string dir) { return UserKeyValueConfig.SetKeyValue(_exportDirKey, dir); } public bool AddToExportDirHistoryList(string dir) { try { XmlDocument doc = new XmlDocument(); var path = AppPathConfig.RecentExportPathsXml; doc.Load(path); var rootNode = doc.DocumentElement; var items = rootNode.SelectNodes("Item"); if (items.Count > ProjectConstantConfig.ExportDirHistoryMaxRecordCount) { rootNode.RemoveChild(rootNode.LastChild); } foreach (XmlElement item in items) { if (dir.ToLower() == item.InnerText.ToLower()) { rootNode.RemoveChild(item); break; } } XmlElement itemElement = doc.CreateElement("Item"); itemElement.InnerText = dir; rootNode.PrependChild(itemElement); doc.Save(path); } catch (Exception) { return false; } return true; } public List<string> GetExportDirHistoryList() { try { var ret = new List<string>(); XmlDocument doc = new XmlDocument(); var path = AppPathConfig.RecentExportPathsXml; doc.Load(path); var rootNode = doc.DocumentElement; var items = rootNode.SelectNodes("Item"); foreach (XmlElement item in items) { ret.Add(item.InnerText); } return ret; } catch (Exception) { return null; } } } }
26.967742
87
0.50319
[ "BSD-3-Clause" ]
RPA-ai/rpastudio-book
samples/RPAStudio/RPA.Services/Nupkg/PackageExportSettingsService.cs
2,510
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("CompareArrays")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CompareArrays")] [assembly: AssemblyCopyright("Copyright © 2015")] [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("b29505d1-2f2b-495c-a92e-3f361bd355ab")] // 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.810811
84
0.745533
[ "MIT" ]
VProfirov/Telerik-Academy
Module 1/[02] CSharp Advanced/[performance improvement versions] C# Advanced/C# Advanced v0.1/Arrays/CompareArrays/Properties/AssemblyInfo.cs
1,402
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Base { public partial class NewClient : Form { private SqlConnection sqlConnection; public NewClient(SqlConnection connection) { InitializeComponent(); sqlConnection = connection; } private void close_Click(object sender, EventArgs e) { Close(); } private async void login_Click(object sender, EventArgs e) { SqlCommand insertClientCommand = new SqlCommand("INSERT INTO [Clients] (name, dataVisit,phoneNumber,email,dateOfBirth,note) VALUES (@name, @dataVisit,@phoneNumber,@email,@dateOfBirth,@note)", sqlConnection); if (nameTextBox.Text == "" || dataVisitDateTimePicker.Text == "" || dateOfBirthDateTimePicker.Text == "") { MessageBox.Show("Помилка! Не всі данні введенні!"); } else if ((phoneNumberTextBox.Text == "" && emailTextBox.Text == "")) { MessageBox.Show("Помилка! Укажіть номер телефону або email!"); } else { insertClientCommand.Parameters.AddWithValue("name", nameTextBox.Text); insertClientCommand.Parameters.AddWithValue("dataVisit",Convert.ToDateTime(dataVisitDateTimePicker.Text)); insertClientCommand.Parameters.AddWithValue("phoneNumber", phoneNumberTextBox.Text); insertClientCommand.Parameters.AddWithValue("email", emailTextBox.Text); insertClientCommand.Parameters.AddWithValue("dateOfBirth", Convert.ToDateTime(dateOfBirthDateTimePicker.Text)); insertClientCommand.Parameters.AddWithValue("note", noteTextBox.Text); try { await insertClientCommand.ExecuteNonQueryAsync(); MessageBox.Show("Нового клієнта було додано!"); Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Помилка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } private Point lastPoint; private void panel1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Left += e.X - lastPoint.X; this.Top += e.Y - lastPoint.Y; } } private void panel1_MouseDown(object sender, MouseEventArgs e) { lastPoint = new Point(e.X, e.Y); } private void close_MouseEnter(object sender, EventArgs e) { close.ForeColor = Color.Red; } private void close_MouseLeave(object sender, EventArgs e) { close.ForeColor = Color.White; } private void NewClient_Load(object sender, EventArgs e) { int ScreenWidth = Screen.PrimaryScreen.Bounds.Width; int ScreenHeight = Screen.PrimaryScreen.Bounds.Height; this.Location = new Point((ScreenWidth / 2) - (this.Width / 2), (ScreenHeight / 2) - (this.Height / 2)); } } }
34.19802
219
0.582513
[ "MIT" ]
mariayurchenko/FitnessPro
Base/NewClient.cs
3,541
C#
namespace _04._Cities_by_Continent_and_Country { using System; using System.Collections.Generic; public class StartUp { public static void Main() { int number = int.Parse(Console.ReadLine()); Dictionary<string, Dictionary<string, List<string>>> geography = new Dictionary<string, Dictionary<string, List<string>>>(); for (int i = 0; i < number; i++) { string[] tokens = Console.ReadLine() .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string continent = tokens[0]; string country = tokens[1]; string city = tokens[2]; if (!geography.ContainsKey(continent)) { geography.Add(continent, new Dictionary<string, List<string>>()); } if (!geography[continent].ContainsKey(country)) { geography[continent].Add(country, new List<string>()); } geography[continent][country].Add(city); } foreach (var kvp in geography) { Console.WriteLine($"{kvp.Key}:"); foreach (var item in kvp.Value) { List<string> city = item.Value; string country = item.Key; Console.Write($" {country} -> "); Console.WriteLine(string.Join(", ", city)); } } } } }
30.188679
136
0.47125
[ "MIT" ]
AntoniyaIvanova/SoftUni
C#/C# Advanced/C# Advanced/03. Sets and Dictionaries Advanced/LAB/04. Cities by Continent and Country/StartUp.cs
1,602
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the opensearch-2021-01-01.normal.json service model. */ using System; using Amazon.Runtime; namespace Amazon.OpenSearchService { /// <summary> /// Constants used for properties of type AutoTuneDesiredState. /// </summary> public class AutoTuneDesiredState : ConstantClass { /// <summary> /// Constant DISABLED for AutoTuneDesiredState /// </summary> public static readonly AutoTuneDesiredState DISABLED = new AutoTuneDesiredState("DISABLED"); /// <summary> /// Constant ENABLED for AutoTuneDesiredState /// </summary> public static readonly AutoTuneDesiredState ENABLED = new AutoTuneDesiredState("ENABLED"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public AutoTuneDesiredState(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static AutoTuneDesiredState FindValue(string value) { return FindValue<AutoTuneDesiredState>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator AutoTuneDesiredState(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type AutoTuneState. /// </summary> public class AutoTuneState : ConstantClass { /// <summary> /// Constant DISABLE_IN_PROGRESS for AutoTuneState /// </summary> public static readonly AutoTuneState DISABLE_IN_PROGRESS = new AutoTuneState("DISABLE_IN_PROGRESS"); /// <summary> /// Constant DISABLED for AutoTuneState /// </summary> public static readonly AutoTuneState DISABLED = new AutoTuneState("DISABLED"); /// <summary> /// Constant DISABLED_AND_ROLLBACK_COMPLETE for AutoTuneState /// </summary> public static readonly AutoTuneState DISABLED_AND_ROLLBACK_COMPLETE = new AutoTuneState("DISABLED_AND_ROLLBACK_COMPLETE"); /// <summary> /// Constant DISABLED_AND_ROLLBACK_ERROR for AutoTuneState /// </summary> public static readonly AutoTuneState DISABLED_AND_ROLLBACK_ERROR = new AutoTuneState("DISABLED_AND_ROLLBACK_ERROR"); /// <summary> /// Constant DISABLED_AND_ROLLBACK_IN_PROGRESS for AutoTuneState /// </summary> public static readonly AutoTuneState DISABLED_AND_ROLLBACK_IN_PROGRESS = new AutoTuneState("DISABLED_AND_ROLLBACK_IN_PROGRESS"); /// <summary> /// Constant DISABLED_AND_ROLLBACK_SCHEDULED for AutoTuneState /// </summary> public static readonly AutoTuneState DISABLED_AND_ROLLBACK_SCHEDULED = new AutoTuneState("DISABLED_AND_ROLLBACK_SCHEDULED"); /// <summary> /// Constant ENABLE_IN_PROGRESS for AutoTuneState /// </summary> public static readonly AutoTuneState ENABLE_IN_PROGRESS = new AutoTuneState("ENABLE_IN_PROGRESS"); /// <summary> /// Constant ENABLED for AutoTuneState /// </summary> public static readonly AutoTuneState ENABLED = new AutoTuneState("ENABLED"); /// <summary> /// Constant ERROR for AutoTuneState /// </summary> public static readonly AutoTuneState ERROR = new AutoTuneState("ERROR"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public AutoTuneState(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static AutoTuneState FindValue(string value) { return FindValue<AutoTuneState>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator AutoTuneState(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type AutoTuneType. /// </summary> public class AutoTuneType : ConstantClass { /// <summary> /// Constant SCHEDULED_ACTION for AutoTuneType /// </summary> public static readonly AutoTuneType SCHEDULED_ACTION = new AutoTuneType("SCHEDULED_ACTION"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public AutoTuneType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static AutoTuneType FindValue(string value) { return FindValue<AutoTuneType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator AutoTuneType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type DeploymentStatus. /// </summary> public class DeploymentStatus : ConstantClass { /// <summary> /// Constant COMPLETED for DeploymentStatus /// </summary> public static readonly DeploymentStatus COMPLETED = new DeploymentStatus("COMPLETED"); /// <summary> /// Constant ELIGIBLE for DeploymentStatus /// </summary> public static readonly DeploymentStatus ELIGIBLE = new DeploymentStatus("ELIGIBLE"); /// <summary> /// Constant IN_PROGRESS for DeploymentStatus /// </summary> public static readonly DeploymentStatus IN_PROGRESS = new DeploymentStatus("IN_PROGRESS"); /// <summary> /// Constant NOT_ELIGIBLE for DeploymentStatus /// </summary> public static readonly DeploymentStatus NOT_ELIGIBLE = new DeploymentStatus("NOT_ELIGIBLE"); /// <summary> /// Constant PENDING_UPDATE for DeploymentStatus /// </summary> public static readonly DeploymentStatus PENDING_UPDATE = new DeploymentStatus("PENDING_UPDATE"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public DeploymentStatus(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static DeploymentStatus FindValue(string value) { return FindValue<DeploymentStatus>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator DeploymentStatus(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type DescribePackagesFilterName. /// </summary> public class DescribePackagesFilterName : ConstantClass { /// <summary> /// Constant PackageID for DescribePackagesFilterName /// </summary> public static readonly DescribePackagesFilterName PackageID = new DescribePackagesFilterName("PackageID"); /// <summary> /// Constant PackageName for DescribePackagesFilterName /// </summary> public static readonly DescribePackagesFilterName PackageName = new DescribePackagesFilterName("PackageName"); /// <summary> /// Constant PackageStatus for DescribePackagesFilterName /// </summary> public static readonly DescribePackagesFilterName PackageStatus = new DescribePackagesFilterName("PackageStatus"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public DescribePackagesFilterName(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static DescribePackagesFilterName FindValue(string value) { return FindValue<DescribePackagesFilterName>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator DescribePackagesFilterName(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type DomainPackageStatus. /// </summary> public class DomainPackageStatus : ConstantClass { /// <summary> /// Constant ACTIVE for DomainPackageStatus /// </summary> public static readonly DomainPackageStatus ACTIVE = new DomainPackageStatus("ACTIVE"); /// <summary> /// Constant ASSOCIATING for DomainPackageStatus /// </summary> public static readonly DomainPackageStatus ASSOCIATING = new DomainPackageStatus("ASSOCIATING"); /// <summary> /// Constant ASSOCIATION_FAILED for DomainPackageStatus /// </summary> public static readonly DomainPackageStatus ASSOCIATION_FAILED = new DomainPackageStatus("ASSOCIATION_FAILED"); /// <summary> /// Constant DISSOCIATING for DomainPackageStatus /// </summary> public static readonly DomainPackageStatus DISSOCIATING = new DomainPackageStatus("DISSOCIATING"); /// <summary> /// Constant DISSOCIATION_FAILED for DomainPackageStatus /// </summary> public static readonly DomainPackageStatus DISSOCIATION_FAILED = new DomainPackageStatus("DISSOCIATION_FAILED"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public DomainPackageStatus(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static DomainPackageStatus FindValue(string value) { return FindValue<DomainPackageStatus>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator DomainPackageStatus(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type EngineType. /// </summary> public class EngineType : ConstantClass { /// <summary> /// Constant Elasticsearch for EngineType /// </summary> public static readonly EngineType Elasticsearch = new EngineType("Elasticsearch"); /// <summary> /// Constant OpenSearch for EngineType /// </summary> public static readonly EngineType OpenSearch = new EngineType("OpenSearch"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public EngineType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static EngineType FindValue(string value) { return FindValue<EngineType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator EngineType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type InboundConnectionStatusCode. /// </summary> public class InboundConnectionStatusCode : ConstantClass { /// <summary> /// Constant ACTIVE for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode ACTIVE = new InboundConnectionStatusCode("ACTIVE"); /// <summary> /// Constant APPROVED for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode APPROVED = new InboundConnectionStatusCode("APPROVED"); /// <summary> /// Constant DELETED for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode DELETED = new InboundConnectionStatusCode("DELETED"); /// <summary> /// Constant DELETING for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode DELETING = new InboundConnectionStatusCode("DELETING"); /// <summary> /// Constant PENDING_ACCEPTANCE for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode PENDING_ACCEPTANCE = new InboundConnectionStatusCode("PENDING_ACCEPTANCE"); /// <summary> /// Constant PROVISIONING for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode PROVISIONING = new InboundConnectionStatusCode("PROVISIONING"); /// <summary> /// Constant REJECTED for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode REJECTED = new InboundConnectionStatusCode("REJECTED"); /// <summary> /// Constant REJECTING for InboundConnectionStatusCode /// </summary> public static readonly InboundConnectionStatusCode REJECTING = new InboundConnectionStatusCode("REJECTING"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public InboundConnectionStatusCode(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static InboundConnectionStatusCode FindValue(string value) { return FindValue<InboundConnectionStatusCode>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator InboundConnectionStatusCode(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type LogType. /// </summary> public class LogType : ConstantClass { /// <summary> /// Constant AUDIT_LOGS for LogType /// </summary> public static readonly LogType AUDIT_LOGS = new LogType("AUDIT_LOGS"); /// <summary> /// Constant ES_APPLICATION_LOGS for LogType /// </summary> public static readonly LogType ES_APPLICATION_LOGS = new LogType("ES_APPLICATION_LOGS"); /// <summary> /// Constant INDEX_SLOW_LOGS for LogType /// </summary> public static readonly LogType INDEX_SLOW_LOGS = new LogType("INDEX_SLOW_LOGS"); /// <summary> /// Constant SEARCH_SLOW_LOGS for LogType /// </summary> public static readonly LogType SEARCH_SLOW_LOGS = new LogType("SEARCH_SLOW_LOGS"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public LogType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static LogType FindValue(string value) { return FindValue<LogType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator LogType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type OpenSearchPartitionInstanceType. /// </summary> public class OpenSearchPartitionInstanceType : ConstantClass { /// <summary> /// Constant C42xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C42xlargeSearch = new OpenSearchPartitionInstanceType("c4.2xlarge.search"); /// <summary> /// Constant C44xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C44xlargeSearch = new OpenSearchPartitionInstanceType("c4.4xlarge.search"); /// <summary> /// Constant C48xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C48xlargeSearch = new OpenSearchPartitionInstanceType("c4.8xlarge.search"); /// <summary> /// Constant C4LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C4LargeSearch = new OpenSearchPartitionInstanceType("c4.large.search"); /// <summary> /// Constant C4XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C4XlargeSearch = new OpenSearchPartitionInstanceType("c4.xlarge.search"); /// <summary> /// Constant C518xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C518xlargeSearch = new OpenSearchPartitionInstanceType("c5.18xlarge.search"); /// <summary> /// Constant C52xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C52xlargeSearch = new OpenSearchPartitionInstanceType("c5.2xlarge.search"); /// <summary> /// Constant C54xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C54xlargeSearch = new OpenSearchPartitionInstanceType("c5.4xlarge.search"); /// <summary> /// Constant C59xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C59xlargeSearch = new OpenSearchPartitionInstanceType("c5.9xlarge.search"); /// <summary> /// Constant C5LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C5LargeSearch = new OpenSearchPartitionInstanceType("c5.large.search"); /// <summary> /// Constant C5XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C5XlargeSearch = new OpenSearchPartitionInstanceType("c5.xlarge.search"); /// <summary> /// Constant C6g12xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C6g12xlargeSearch = new OpenSearchPartitionInstanceType("c6g.12xlarge.search"); /// <summary> /// Constant C6g2xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C6g2xlargeSearch = new OpenSearchPartitionInstanceType("c6g.2xlarge.search"); /// <summary> /// Constant C6g4xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C6g4xlargeSearch = new OpenSearchPartitionInstanceType("c6g.4xlarge.search"); /// <summary> /// Constant C6g8xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C6g8xlargeSearch = new OpenSearchPartitionInstanceType("c6g.8xlarge.search"); /// <summary> /// Constant C6gLargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C6gLargeSearch = new OpenSearchPartitionInstanceType("c6g.large.search"); /// <summary> /// Constant C6gXlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType C6gXlargeSearch = new OpenSearchPartitionInstanceType("c6g.xlarge.search"); /// <summary> /// Constant D22xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType D22xlargeSearch = new OpenSearchPartitionInstanceType("d2.2xlarge.search"); /// <summary> /// Constant D24xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType D24xlargeSearch = new OpenSearchPartitionInstanceType("d2.4xlarge.search"); /// <summary> /// Constant D28xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType D28xlargeSearch = new OpenSearchPartitionInstanceType("d2.8xlarge.search"); /// <summary> /// Constant D2XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType D2XlargeSearch = new OpenSearchPartitionInstanceType("d2.xlarge.search"); /// <summary> /// Constant I22xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I22xlargeSearch = new OpenSearchPartitionInstanceType("i2.2xlarge.search"); /// <summary> /// Constant I2XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I2XlargeSearch = new OpenSearchPartitionInstanceType("i2.xlarge.search"); /// <summary> /// Constant I316xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I316xlargeSearch = new OpenSearchPartitionInstanceType("i3.16xlarge.search"); /// <summary> /// Constant I32xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I32xlargeSearch = new OpenSearchPartitionInstanceType("i3.2xlarge.search"); /// <summary> /// Constant I34xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I34xlargeSearch = new OpenSearchPartitionInstanceType("i3.4xlarge.search"); /// <summary> /// Constant I38xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I38xlargeSearch = new OpenSearchPartitionInstanceType("i3.8xlarge.search"); /// <summary> /// Constant I3LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I3LargeSearch = new OpenSearchPartitionInstanceType("i3.large.search"); /// <summary> /// Constant I3XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType I3XlargeSearch = new OpenSearchPartitionInstanceType("i3.xlarge.search"); /// <summary> /// Constant M32xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M32xlargeSearch = new OpenSearchPartitionInstanceType("m3.2xlarge.search"); /// <summary> /// Constant M3LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M3LargeSearch = new OpenSearchPartitionInstanceType("m3.large.search"); /// <summary> /// Constant M3MediumSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M3MediumSearch = new OpenSearchPartitionInstanceType("m3.medium.search"); /// <summary> /// Constant M3XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M3XlargeSearch = new OpenSearchPartitionInstanceType("m3.xlarge.search"); /// <summary> /// Constant M410xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M410xlargeSearch = new OpenSearchPartitionInstanceType("m4.10xlarge.search"); /// <summary> /// Constant M42xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M42xlargeSearch = new OpenSearchPartitionInstanceType("m4.2xlarge.search"); /// <summary> /// Constant M44xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M44xlargeSearch = new OpenSearchPartitionInstanceType("m4.4xlarge.search"); /// <summary> /// Constant M4LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M4LargeSearch = new OpenSearchPartitionInstanceType("m4.large.search"); /// <summary> /// Constant M4XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M4XlargeSearch = new OpenSearchPartitionInstanceType("m4.xlarge.search"); /// <summary> /// Constant M512xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M512xlargeSearch = new OpenSearchPartitionInstanceType("m5.12xlarge.search"); /// <summary> /// Constant M524xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M524xlargeSearch = new OpenSearchPartitionInstanceType("m5.24xlarge.search"); /// <summary> /// Constant M52xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M52xlargeSearch = new OpenSearchPartitionInstanceType("m5.2xlarge.search"); /// <summary> /// Constant M54xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M54xlargeSearch = new OpenSearchPartitionInstanceType("m5.4xlarge.search"); /// <summary> /// Constant M5LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M5LargeSearch = new OpenSearchPartitionInstanceType("m5.large.search"); /// <summary> /// Constant M5XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M5XlargeSearch = new OpenSearchPartitionInstanceType("m5.xlarge.search"); /// <summary> /// Constant M6g12xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M6g12xlargeSearch = new OpenSearchPartitionInstanceType("m6g.12xlarge.search"); /// <summary> /// Constant M6g2xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M6g2xlargeSearch = new OpenSearchPartitionInstanceType("m6g.2xlarge.search"); /// <summary> /// Constant M6g4xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M6g4xlargeSearch = new OpenSearchPartitionInstanceType("m6g.4xlarge.search"); /// <summary> /// Constant M6g8xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M6g8xlargeSearch = new OpenSearchPartitionInstanceType("m6g.8xlarge.search"); /// <summary> /// Constant M6gLargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M6gLargeSearch = new OpenSearchPartitionInstanceType("m6g.large.search"); /// <summary> /// Constant M6gXlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType M6gXlargeSearch = new OpenSearchPartitionInstanceType("m6g.xlarge.search"); /// <summary> /// Constant R32xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R32xlargeSearch = new OpenSearchPartitionInstanceType("r3.2xlarge.search"); /// <summary> /// Constant R34xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R34xlargeSearch = new OpenSearchPartitionInstanceType("r3.4xlarge.search"); /// <summary> /// Constant R38xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R38xlargeSearch = new OpenSearchPartitionInstanceType("r3.8xlarge.search"); /// <summary> /// Constant R3LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R3LargeSearch = new OpenSearchPartitionInstanceType("r3.large.search"); /// <summary> /// Constant R3XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R3XlargeSearch = new OpenSearchPartitionInstanceType("r3.xlarge.search"); /// <summary> /// Constant R416xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R416xlargeSearch = new OpenSearchPartitionInstanceType("r4.16xlarge.search"); /// <summary> /// Constant R42xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R42xlargeSearch = new OpenSearchPartitionInstanceType("r4.2xlarge.search"); /// <summary> /// Constant R44xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R44xlargeSearch = new OpenSearchPartitionInstanceType("r4.4xlarge.search"); /// <summary> /// Constant R48xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R48xlargeSearch = new OpenSearchPartitionInstanceType("r4.8xlarge.search"); /// <summary> /// Constant R4LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R4LargeSearch = new OpenSearchPartitionInstanceType("r4.large.search"); /// <summary> /// Constant R4XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R4XlargeSearch = new OpenSearchPartitionInstanceType("r4.xlarge.search"); /// <summary> /// Constant R512xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R512xlargeSearch = new OpenSearchPartitionInstanceType("r5.12xlarge.search"); /// <summary> /// Constant R524xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R524xlargeSearch = new OpenSearchPartitionInstanceType("r5.24xlarge.search"); /// <summary> /// Constant R52xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R52xlargeSearch = new OpenSearchPartitionInstanceType("r5.2xlarge.search"); /// <summary> /// Constant R54xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R54xlargeSearch = new OpenSearchPartitionInstanceType("r5.4xlarge.search"); /// <summary> /// Constant R5LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R5LargeSearch = new OpenSearchPartitionInstanceType("r5.large.search"); /// <summary> /// Constant R5XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R5XlargeSearch = new OpenSearchPartitionInstanceType("r5.xlarge.search"); /// <summary> /// Constant R6g12xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6g12xlargeSearch = new OpenSearchPartitionInstanceType("r6g.12xlarge.search"); /// <summary> /// Constant R6g2xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6g2xlargeSearch = new OpenSearchPartitionInstanceType("r6g.2xlarge.search"); /// <summary> /// Constant R6g4xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6g4xlargeSearch = new OpenSearchPartitionInstanceType("r6g.4xlarge.search"); /// <summary> /// Constant R6g8xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6g8xlargeSearch = new OpenSearchPartitionInstanceType("r6g.8xlarge.search"); /// <summary> /// Constant R6gd12xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gd12xlargeSearch = new OpenSearchPartitionInstanceType("r6gd.12xlarge.search"); /// <summary> /// Constant R6gd16xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gd16xlargeSearch = new OpenSearchPartitionInstanceType("r6gd.16xlarge.search"); /// <summary> /// Constant R6gd2xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gd2xlargeSearch = new OpenSearchPartitionInstanceType("r6gd.2xlarge.search"); /// <summary> /// Constant R6gd4xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gd4xlargeSearch = new OpenSearchPartitionInstanceType("r6gd.4xlarge.search"); /// <summary> /// Constant R6gd8xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gd8xlargeSearch = new OpenSearchPartitionInstanceType("r6gd.8xlarge.search"); /// <summary> /// Constant R6gdLargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gdLargeSearch = new OpenSearchPartitionInstanceType("r6gd.large.search"); /// <summary> /// Constant R6gdXlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gdXlargeSearch = new OpenSearchPartitionInstanceType("r6gd.xlarge.search"); /// <summary> /// Constant R6gLargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gLargeSearch = new OpenSearchPartitionInstanceType("r6g.large.search"); /// <summary> /// Constant R6gXlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType R6gXlargeSearch = new OpenSearchPartitionInstanceType("r6g.xlarge.search"); /// <summary> /// Constant T2MediumSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T2MediumSearch = new OpenSearchPartitionInstanceType("t2.medium.search"); /// <summary> /// Constant T2MicroSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T2MicroSearch = new OpenSearchPartitionInstanceType("t2.micro.search"); /// <summary> /// Constant T2SmallSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T2SmallSearch = new OpenSearchPartitionInstanceType("t2.small.search"); /// <summary> /// Constant T32xlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T32xlargeSearch = new OpenSearchPartitionInstanceType("t3.2xlarge.search"); /// <summary> /// Constant T3LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T3LargeSearch = new OpenSearchPartitionInstanceType("t3.large.search"); /// <summary> /// Constant T3MediumSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T3MediumSearch = new OpenSearchPartitionInstanceType("t3.medium.search"); /// <summary> /// Constant T3MicroSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T3MicroSearch = new OpenSearchPartitionInstanceType("t3.micro.search"); /// <summary> /// Constant T3NanoSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T3NanoSearch = new OpenSearchPartitionInstanceType("t3.nano.search"); /// <summary> /// Constant T3SmallSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T3SmallSearch = new OpenSearchPartitionInstanceType("t3.small.search"); /// <summary> /// Constant T3XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T3XlargeSearch = new OpenSearchPartitionInstanceType("t3.xlarge.search"); /// <summary> /// Constant T4gMediumSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T4gMediumSearch = new OpenSearchPartitionInstanceType("t4g.medium.search"); /// <summary> /// Constant T4gSmallSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType T4gSmallSearch = new OpenSearchPartitionInstanceType("t4g.small.search"); /// <summary> /// Constant Ultrawarm1LargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType Ultrawarm1LargeSearch = new OpenSearchPartitionInstanceType("ultrawarm1.large.search"); /// <summary> /// Constant Ultrawarm1MediumSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType Ultrawarm1MediumSearch = new OpenSearchPartitionInstanceType("ultrawarm1.medium.search"); /// <summary> /// Constant Ultrawarm1XlargeSearch for OpenSearchPartitionInstanceType /// </summary> public static readonly OpenSearchPartitionInstanceType Ultrawarm1XlargeSearch = new OpenSearchPartitionInstanceType("ultrawarm1.xlarge.search"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public OpenSearchPartitionInstanceType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static OpenSearchPartitionInstanceType FindValue(string value) { return FindValue<OpenSearchPartitionInstanceType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator OpenSearchPartitionInstanceType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type OpenSearchWarmPartitionInstanceType. /// </summary> public class OpenSearchWarmPartitionInstanceType : ConstantClass { /// <summary> /// Constant Ultrawarm1LargeSearch for OpenSearchWarmPartitionInstanceType /// </summary> public static readonly OpenSearchWarmPartitionInstanceType Ultrawarm1LargeSearch = new OpenSearchWarmPartitionInstanceType("ultrawarm1.large.search"); /// <summary> /// Constant Ultrawarm1MediumSearch for OpenSearchWarmPartitionInstanceType /// </summary> public static readonly OpenSearchWarmPartitionInstanceType Ultrawarm1MediumSearch = new OpenSearchWarmPartitionInstanceType("ultrawarm1.medium.search"); /// <summary> /// Constant Ultrawarm1XlargeSearch for OpenSearchWarmPartitionInstanceType /// </summary> public static readonly OpenSearchWarmPartitionInstanceType Ultrawarm1XlargeSearch = new OpenSearchWarmPartitionInstanceType("ultrawarm1.xlarge.search"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public OpenSearchWarmPartitionInstanceType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static OpenSearchWarmPartitionInstanceType FindValue(string value) { return FindValue<OpenSearchWarmPartitionInstanceType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator OpenSearchWarmPartitionInstanceType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type OptionState. /// </summary> public class OptionState : ConstantClass { /// <summary> /// Constant Active for OptionState /// </summary> public static readonly OptionState Active = new OptionState("Active"); /// <summary> /// Constant Processing for OptionState /// </summary> public static readonly OptionState Processing = new OptionState("Processing"); /// <summary> /// Constant RequiresIndexDocuments for OptionState /// </summary> public static readonly OptionState RequiresIndexDocuments = new OptionState("RequiresIndexDocuments"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public OptionState(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static OptionState FindValue(string value) { return FindValue<OptionState>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator OptionState(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type OutboundConnectionStatusCode. /// </summary> public class OutboundConnectionStatusCode : ConstantClass { /// <summary> /// Constant ACTIVE for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode ACTIVE = new OutboundConnectionStatusCode("ACTIVE"); /// <summary> /// Constant APPROVED for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode APPROVED = new OutboundConnectionStatusCode("APPROVED"); /// <summary> /// Constant DELETED for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode DELETED = new OutboundConnectionStatusCode("DELETED"); /// <summary> /// Constant DELETING for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode DELETING = new OutboundConnectionStatusCode("DELETING"); /// <summary> /// Constant PENDING_ACCEPTANCE for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode PENDING_ACCEPTANCE = new OutboundConnectionStatusCode("PENDING_ACCEPTANCE"); /// <summary> /// Constant PROVISIONING for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode PROVISIONING = new OutboundConnectionStatusCode("PROVISIONING"); /// <summary> /// Constant REJECTED for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode REJECTED = new OutboundConnectionStatusCode("REJECTED"); /// <summary> /// Constant REJECTING for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode REJECTING = new OutboundConnectionStatusCode("REJECTING"); /// <summary> /// Constant VALIDATING for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode VALIDATING = new OutboundConnectionStatusCode("VALIDATING"); /// <summary> /// Constant VALIDATION_FAILED for OutboundConnectionStatusCode /// </summary> public static readonly OutboundConnectionStatusCode VALIDATION_FAILED = new OutboundConnectionStatusCode("VALIDATION_FAILED"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public OutboundConnectionStatusCode(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static OutboundConnectionStatusCode FindValue(string value) { return FindValue<OutboundConnectionStatusCode>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator OutboundConnectionStatusCode(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type OverallChangeStatus. /// </summary> public class OverallChangeStatus : ConstantClass { /// <summary> /// Constant COMPLETED for OverallChangeStatus /// </summary> public static readonly OverallChangeStatus COMPLETED = new OverallChangeStatus("COMPLETED"); /// <summary> /// Constant FAILED for OverallChangeStatus /// </summary> public static readonly OverallChangeStatus FAILED = new OverallChangeStatus("FAILED"); /// <summary> /// Constant PENDING for OverallChangeStatus /// </summary> public static readonly OverallChangeStatus PENDING = new OverallChangeStatus("PENDING"); /// <summary> /// Constant PROCESSING for OverallChangeStatus /// </summary> public static readonly OverallChangeStatus PROCESSING = new OverallChangeStatus("PROCESSING"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public OverallChangeStatus(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static OverallChangeStatus FindValue(string value) { return FindValue<OverallChangeStatus>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator OverallChangeStatus(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type PackageStatus. /// </summary> public class PackageStatus : ConstantClass { /// <summary> /// Constant AVAILABLE for PackageStatus /// </summary> public static readonly PackageStatus AVAILABLE = new PackageStatus("AVAILABLE"); /// <summary> /// Constant COPY_FAILED for PackageStatus /// </summary> public static readonly PackageStatus COPY_FAILED = new PackageStatus("COPY_FAILED"); /// <summary> /// Constant COPYING for PackageStatus /// </summary> public static readonly PackageStatus COPYING = new PackageStatus("COPYING"); /// <summary> /// Constant DELETE_FAILED for PackageStatus /// </summary> public static readonly PackageStatus DELETE_FAILED = new PackageStatus("DELETE_FAILED"); /// <summary> /// Constant DELETED for PackageStatus /// </summary> public static readonly PackageStatus DELETED = new PackageStatus("DELETED"); /// <summary> /// Constant DELETING for PackageStatus /// </summary> public static readonly PackageStatus DELETING = new PackageStatus("DELETING"); /// <summary> /// Constant VALIDATING for PackageStatus /// </summary> public static readonly PackageStatus VALIDATING = new PackageStatus("VALIDATING"); /// <summary> /// Constant VALIDATION_FAILED for PackageStatus /// </summary> public static readonly PackageStatus VALIDATION_FAILED = new PackageStatus("VALIDATION_FAILED"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public PackageStatus(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static PackageStatus FindValue(string value) { return FindValue<PackageStatus>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator PackageStatus(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type PackageType. /// </summary> public class PackageType : ConstantClass { /// <summary> /// Constant TXTDICTIONARY for PackageType /// </summary> public static readonly PackageType TXTDICTIONARY = new PackageType("TXT-DICTIONARY"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public PackageType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static PackageType FindValue(string value) { return FindValue<PackageType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator PackageType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type ReservedInstancePaymentOption. /// </summary> public class ReservedInstancePaymentOption : ConstantClass { /// <summary> /// Constant ALL_UPFRONT for ReservedInstancePaymentOption /// </summary> public static readonly ReservedInstancePaymentOption ALL_UPFRONT = new ReservedInstancePaymentOption("ALL_UPFRONT"); /// <summary> /// Constant NO_UPFRONT for ReservedInstancePaymentOption /// </summary> public static readonly ReservedInstancePaymentOption NO_UPFRONT = new ReservedInstancePaymentOption("NO_UPFRONT"); /// <summary> /// Constant PARTIAL_UPFRONT for ReservedInstancePaymentOption /// </summary> public static readonly ReservedInstancePaymentOption PARTIAL_UPFRONT = new ReservedInstancePaymentOption("PARTIAL_UPFRONT"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public ReservedInstancePaymentOption(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static ReservedInstancePaymentOption FindValue(string value) { return FindValue<ReservedInstancePaymentOption>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator ReservedInstancePaymentOption(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type RollbackOnDisable. /// </summary> public class RollbackOnDisable : ConstantClass { /// <summary> /// Constant DEFAULT_ROLLBACK for RollbackOnDisable /// </summary> public static readonly RollbackOnDisable DEFAULT_ROLLBACK = new RollbackOnDisable("DEFAULT_ROLLBACK"); /// <summary> /// Constant NO_ROLLBACK for RollbackOnDisable /// </summary> public static readonly RollbackOnDisable NO_ROLLBACK = new RollbackOnDisable("NO_ROLLBACK"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public RollbackOnDisable(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static RollbackOnDisable FindValue(string value) { return FindValue<RollbackOnDisable>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator RollbackOnDisable(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type ScheduledAutoTuneActionType. /// </summary> public class ScheduledAutoTuneActionType : ConstantClass { /// <summary> /// Constant JVM_HEAP_SIZE_TUNING for ScheduledAutoTuneActionType /// </summary> public static readonly ScheduledAutoTuneActionType JVM_HEAP_SIZE_TUNING = new ScheduledAutoTuneActionType("JVM_HEAP_SIZE_TUNING"); /// <summary> /// Constant JVM_YOUNG_GEN_TUNING for ScheduledAutoTuneActionType /// </summary> public static readonly ScheduledAutoTuneActionType JVM_YOUNG_GEN_TUNING = new ScheduledAutoTuneActionType("JVM_YOUNG_GEN_TUNING"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public ScheduledAutoTuneActionType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static ScheduledAutoTuneActionType FindValue(string value) { return FindValue<ScheduledAutoTuneActionType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator ScheduledAutoTuneActionType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type ScheduledAutoTuneSeverityType. /// </summary> public class ScheduledAutoTuneSeverityType : ConstantClass { /// <summary> /// Constant HIGH for ScheduledAutoTuneSeverityType /// </summary> public static readonly ScheduledAutoTuneSeverityType HIGH = new ScheduledAutoTuneSeverityType("HIGH"); /// <summary> /// Constant LOW for ScheduledAutoTuneSeverityType /// </summary> public static readonly ScheduledAutoTuneSeverityType LOW = new ScheduledAutoTuneSeverityType("LOW"); /// <summary> /// Constant MEDIUM for ScheduledAutoTuneSeverityType /// </summary> public static readonly ScheduledAutoTuneSeverityType MEDIUM = new ScheduledAutoTuneSeverityType("MEDIUM"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public ScheduledAutoTuneSeverityType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static ScheduledAutoTuneSeverityType FindValue(string value) { return FindValue<ScheduledAutoTuneSeverityType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator ScheduledAutoTuneSeverityType(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type TimeUnit. /// </summary> public class TimeUnit : ConstantClass { /// <summary> /// Constant HOURS for TimeUnit /// </summary> public static readonly TimeUnit HOURS = new TimeUnit("HOURS"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public TimeUnit(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static TimeUnit FindValue(string value) { return FindValue<TimeUnit>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator TimeUnit(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type TLSSecurityPolicy. /// </summary> public class TLSSecurityPolicy : ConstantClass { /// <summary> /// Constant PolicyMinTLS10201907 for TLSSecurityPolicy /// </summary> public static readonly TLSSecurityPolicy PolicyMinTLS10201907 = new TLSSecurityPolicy("Policy-Min-TLS-1-0-2019-07"); /// <summary> /// Constant PolicyMinTLS12201907 for TLSSecurityPolicy /// </summary> public static readonly TLSSecurityPolicy PolicyMinTLS12201907 = new TLSSecurityPolicy("Policy-Min-TLS-1-2-2019-07"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public TLSSecurityPolicy(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static TLSSecurityPolicy FindValue(string value) { return FindValue<TLSSecurityPolicy>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator TLSSecurityPolicy(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type UpgradeStatus. /// </summary> public class UpgradeStatus : ConstantClass { /// <summary> /// Constant FAILED for UpgradeStatus /// </summary> public static readonly UpgradeStatus FAILED = new UpgradeStatus("FAILED"); /// <summary> /// Constant IN_PROGRESS for UpgradeStatus /// </summary> public static readonly UpgradeStatus IN_PROGRESS = new UpgradeStatus("IN_PROGRESS"); /// <summary> /// Constant SUCCEEDED for UpgradeStatus /// </summary> public static readonly UpgradeStatus SUCCEEDED = new UpgradeStatus("SUCCEEDED"); /// <summary> /// Constant SUCCEEDED_WITH_ISSUES for UpgradeStatus /// </summary> public static readonly UpgradeStatus SUCCEEDED_WITH_ISSUES = new UpgradeStatus("SUCCEEDED_WITH_ISSUES"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public UpgradeStatus(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static UpgradeStatus FindValue(string value) { return FindValue<UpgradeStatus>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator UpgradeStatus(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type UpgradeStep. /// </summary> public class UpgradeStep : ConstantClass { /// <summary> /// Constant PRE_UPGRADE_CHECK for UpgradeStep /// </summary> public static readonly UpgradeStep PRE_UPGRADE_CHECK = new UpgradeStep("PRE_UPGRADE_CHECK"); /// <summary> /// Constant SNAPSHOT for UpgradeStep /// </summary> public static readonly UpgradeStep SNAPSHOT = new UpgradeStep("SNAPSHOT"); /// <summary> /// Constant UPGRADE for UpgradeStep /// </summary> public static readonly UpgradeStep UPGRADE = new UpgradeStep("UPGRADE"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public UpgradeStep(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static UpgradeStep FindValue(string value) { return FindValue<UpgradeStep>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator UpgradeStep(string value) { return FindValue(value); } } /// <summary> /// Constants used for properties of type VolumeType. /// </summary> public class VolumeType : ConstantClass { /// <summary> /// Constant Gp2 for VolumeType /// </summary> public static readonly VolumeType Gp2 = new VolumeType("gp2"); /// <summary> /// Constant Io1 for VolumeType /// </summary> public static readonly VolumeType Io1 = new VolumeType("io1"); /// <summary> /// Constant Standard for VolumeType /// </summary> public static readonly VolumeType Standard = new VolumeType("standard"); /// <summary> /// This constant constructor does not need to be called if the constant /// you are attempting to use is already defined as a static instance of /// this class. /// This constructor should be used to construct constants that are not /// defined as statics, for instance if attempting to use a feature that is /// newer than the current version of the SDK. /// </summary> public VolumeType(string value) : base(value) { } /// <summary> /// Finds the constant for the unique value. /// </summary> /// <param name="value">The unique value for the constant</param> /// <returns>The constant for the unique value</returns> public static VolumeType FindValue(string value) { return FindValue<VolumeType>(value); } /// <summary> /// Utility method to convert strings to the constant class. /// </summary> /// <param name="value">The string value to convert to the constant class.</param> /// <returns></returns> public static implicit operator VolumeType(string value) { return FindValue(value); } } }
44.500549
160
0.653381
[ "Apache-2.0" ]
Hazy87/aws-sdk-net
sdk/src/Services/OpenSearchService/Generated/ServiceEnumerations.cs
80,991
C#
using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Joobie.Data; using Joobie.Models.JobModels; using Joobie.Utility; using Microsoft.AspNetCore.Authorization; namespace Joobie.Controllers { [Authorize(Roles = Strings.AdminUser + "," + Strings.ModeratorUser)] public class CategoriesController : Controller { private readonly ApplicationDbContext _context; public CategoriesController(ApplicationDbContext context) { _context = context; } public async Task<IActionResult> Index() { return View(await _context.Category.ToListAsync()); } public async Task<IActionResult> Details(byte? id) { if (id == null) { return NotFound(); } var category = await _context.Category .FirstOrDefaultAsync(m => m.Id == id); if (category == null) { return NotFound(); } return View(category); } public IActionResult Create() { return View(); } [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Create([Bind("Id,Name")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } return View(category); } public async Task<IActionResult> Edit(byte? id) { if (id == null) { return NotFound(); } var category = await _context.Category.FindAsync(id); if (category == null) { return NotFound(); } return View(category); } [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Edit(byte id, [Bind("Id,Name")] Category category) { if (id != category.Id) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } return View(category); } public async Task<IActionResult> Delete(byte? id) { if (id == null) { return NotFound(); } var category = await _context.Category .FirstOrDefaultAsync(m => m.Id == id); if (category == null) { return NotFound(); } return View(category); } [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public async Task<IActionResult> DeleteConfirmed(byte id) { var category = await _context.Category.FindAsync(id); _context.Category.Remove(category); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } private bool CategoryExists(byte id) { return _context.Category.Any(e => e.Id == id); } } }
26.774648
91
0.48606
[ "MIT" ]
JoobieTeam/Jobie
Joobie/Joobie/Controllers/CategoriesController.cs
3,804
C#
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BinaryQuest.Framework.Core.Data { public class SettingKey { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string? Key { get; set; } [Required] public Guid SystemSettingId { get; set; } [Required] public string? Value { get; set; } [Required] [StringLength(50)] public string? DisplayName { get; set; } [ForeignKey("SystemSettingId")] public virtual SystemSetting? SystemSetting { get; set; } public int GetValueAsInt() { _ = int.TryParse(Value, out int ret); return ret; } public long GetValueAsLong() { _ = long.TryParse(Value, out long ret); return ret; } public bool GetValueAsBool() { if (string.IsNullOrWhiteSpace(Value)) return false; else if (Value.ToLower().Trim() == "true" || Value.ToLower().Trim() == "yes") return true; else return false; } } }
25.169811
89
0.563718
[ "MIT" ]
binaryquest/bqstart
aspnet/src/bqStart/Binaryquest.Framework.Core/Data/SettingKey.cs
1,336
C#
using AvDe.Contracts.Models; using AvDe.Demo.Tests.Services.XUnitUtilities; using AvDe.Demo.Tests.Services; using AvDe.Persistence.Repositories; using Microsoft.Extensions.DependencyInjection; using System.Collections.Generic; using System.Threading.Tasks; using Xunit; using System; namespace AvDe.Demo.Tests.UnitTests { [TestCaseOrderer("AvDe.Demo.Tests.Services.XUnitUtilities.CustomTestCaseOrderer", "AvDe.Demo.Tests")] public class OrderRepositoryTests : IClassFixture<TestWebApplicationFactory> { private readonly IOrderRepository _orderRepository; public OrderRepositoryTests(TestWebApplicationFactory factory) { factory.CreateClient(); _orderRepository = factory.Server.Host.Services.GetRequiredService<IOrderRepository>(); } [Fact] [Order(1)] public async Task TestUpsertAsync() { var order = new Order { Id = "O_TEST_REPO", DatePlaced = DateTime.Today }; var newOrder = await _orderRepository.UpsertAsync(order).ConfigureAwait(false); Assert.Equal("O_TEST_REPO", newOrder.Id); } [Fact] [Order(2)] public async Task TestGetByIdAsync() { var result = await _orderRepository.GetAsync("O_TEST_REPO").ConfigureAwait(false) as Order; Assert.NotNull(result); } [Fact] [Order(3)] public async Task TestGetAsync() { var result = await _orderRepository.GetAsync().ConfigureAwait(false) as List<Order>; Assert.NotNull(result); } [Fact] [Order(4)] public async Task TestDeleteAsync() { var result = await _orderRepository.DeleteAsync("O_TEST_REPO").ConfigureAwait(false); Assert.True(result > 0); } } }
30.709677
105
0.630777
[ "MIT" ]
matjazbravc/AvDe.Sales.Demo
test/AvDe.Demo.Tests/UnitTests/OrderRepositoryTests.cs
1,906
C#
using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Controllers; using JsonApiDotNetCore.Services; using Microsoft.Extensions.Logging; namespace JsonApiDotNetCoreMongoDbExampleTests.IntegrationTests.ReadWrite { public class WorkItemGroupsController : JsonApiController<WorkItemGroup, string> { public WorkItemGroupsController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<WorkItemGroup, string> resourceService) : base(options, loggerFactory, resourceService) { } } }
35.3125
94
0.775221
[ "MIT" ]
alastairtree/JsonApiDotNetCore.MongoDb
test/JsonApiDotNetCoreMongoDbExampleTests/IntegrationTests/ReadWrite/WorkItemGroupsController.cs
565
C#
using System; class CompareArrays { static void Main() { int n = int.Parse(Console.ReadLine()); int[] arr1 = new int[n]; int[] arr2 = new int[n]; bool areEqial = true; for (int i = 0; i < n; i++) { arr1[i] = int.Parse(Console.ReadLine()); } for (int j = 0; j < n; j++) { arr2[j] = int.Parse(Console.ReadLine()); } for (int k = 0; k < n; k++) { if (arr1[k] != arr2[k]) { areEqial = false; break; } } Console.WriteLine(areEqial ? "Equal" : "Not equal"); } }
23.206897
60
0.401189
[ "MIT" ]
kaneva91/belongs-to-kali
Telerik Academy/C#/1.C#Basics/Homeworks/07Arrays/02CompareArrays/CompareArrays.cs
675
C#
// Please go to the ClrMD project page on github for full source and to report issues: // https://github.com/Microsoft/clrmd using System; using Microsoft.Diagnostics.Runtime; using System.IO; static class Program { public static void PrintDict(ClrRuntime runtime, string args) { bool failed = false; ulong obj = 0; try { obj = Convert.ToUInt64(args, 16); failed = obj == 0; } catch (ArgumentException) { failed = true; } if (failed) { Console.WriteLine("Usage: !PrintDict <dictionary>"); return; } ClrHeap heap = runtime.Heap; ClrType type = heap.GetObjectType(obj); if (type == null) { Console.WriteLine("Invalid object {0:X}", obj); return; } if (!type.Name.StartsWith("System.Collections.Generic.Dictionary")) { Console.WriteLine("Error: Expected object {0:X} to be a dictionary, instead it's of type '{1}'."); return; } // Get the entries field. ulong entries = type.GetFieldValue(obj, "entries"); if (entries == 0) return; ClrType entryArray = heap.GetObjectType(entries); ClrType arrayComponent = entryArray.ComponentType; ClrInstanceField hashCodeField = arrayComponent.GetFieldByName("hashCode"); ClrInstanceField keyField = arrayComponent.GetFieldByName("key"); ClrInstanceField valueField = arrayComponent.GetFieldByName("value"); Console.WriteLine("{0,8} {1,16} : {2}", "hash", "key", "value"); int len = entryArray.GetArrayLength(entries); for (int i = 0; i < len; ++i) { ulong arrayElementAddr = entryArray.GetArrayElementAddress(entries, i); int hashCode = (int)hashCodeField.GetValue(arrayElementAddr, true); object key = keyField.GetValue(arrayElementAddr, true); object value = valueField.GetValue(arrayElementAddr, true); key = Format(heap, key); value = Format(heap, value); bool skip = key is ulong && (ulong)key == 0 && value is ulong && (ulong)value == 0; if (!skip) Console.WriteLine("{0,8:X} {1,16} : {2}", hashCode, key, value); } } static object Format(ClrHeap heap, object val) { if (val == null) return "{null}"; if (val is ulong) { ulong addr = (ulong)val; var type = heap.GetObjectType(addr); if (type != null && type.Name == "System.String") return type.GetValue(addr); else return ((ulong)val).ToString("X"); } return val; } static ulong GetFieldValue(this ClrType type, ulong obj, string name) { var field = type.GetFieldByName(name); if (field == null) return 0; object val = field.GetValue(obj); if (val is ulong) return (ulong)val; return 0; } static void Main(string[] args) { if (args.Length != 3) { Console.WriteLine("Usage: DumpDict <dump> <dac> <objref>"); return; } string dumpFileName = args[0]; string dacPath = args[1]; string objRef = args[2]; ClrRuntime runtime = CreateRuntime(dumpFileName, dacPath); PrintDict(runtime, objRef); } private static ClrRuntime CreateRuntime(string dump, string dac) { // Create the data target. This tells us the versions of CLR loaded in the target process. DataTarget dataTarget = DataTarget.LoadCrashDump(dump); // Now check bitness of our program/target: bool isTarget64Bit = dataTarget.PointerSize == 8; if (Environment.Is64BitProcess != isTarget64Bit) throw new Exception(string.Format("Architecture mismatch: Process is {0} but target is {1}", Environment.Is64BitProcess ? "64 bit" : "32 bit", isTarget64Bit ? "64 bit" : "32 bit")); // Note I just take the first version of CLR in the process. You can loop over every loaded // CLR to handle the SxS case where both v2 and v4 are loaded in the process. ClrInfo version = dataTarget.ClrVersions[0]; // Next, let's try to make sure we have the right Dac to load. Note we are doing this manually for // illustration. Simply calling version.CreateRuntime with no arguments does the same steps. if (dac != null && Directory.Exists(dac)) dac = Path.Combine(dac, version.DacInfo.FileName); else if (dac == null || !File.Exists(dac)) dac = dataTarget.SymbolLocator.FindBinary(version.DacInfo); // Finally, check to see if the dac exists. If not, throw an exception. if (dac == null || !File.Exists(dac)) throw new FileNotFoundException("Could not find the specified dac.", dac); // Now that we have the DataTarget, the version of CLR, and the right dac, we create and return a // ClrRuntime instance. return version.CreateRuntime(dac); } }
33.286624
194
0.585917
[ "MIT" ]
WillVan/dotnet-samples
Microsoft.Diagnostics.Runtime/CLRMD/DumpDict/Program.cs
5,228
C#
namespace AzureMapsControl.Components.Atlas.FormatOptions { using System.Diagnostics.CodeAnalysis; [ExcludeFromCodeCoverage] public sealed class HyperLinkFormatOptions { /// <summary> /// Specifies the text that should be displayed to the user. /// If not specified, the hyperlink will be displayed. /// If the hyperlink is an image, this will be set as the "alt" property of the img tag. /// </summary> public string Label { get; set; } /// <summary> /// Specifies if the hyperlink is for an image. /// If set to true, the hyperlink will be loaded into an img tag and when clicked, will open the hyperlink to the image. /// </summary> public bool? IsImage { get; set; } /// <summary> /// Specifies a scheme to prepend to a hyperlink such as 'mailto:' or 'tel:'. /// </summary> public string Scheme { get; set; } /// <summary> /// Format options for hyperlink strings. /// </summary> public HyperLinkFormatOptionsTarget Target { get; set; } } }
35.0625
128
0.608734
[ "MIT" ]
ADefWebserver/AzureMapsControl.Components
src/AzureMapsControl.Components/Atlas/FormatOptions/HyperLinkFormatOptions.cs
1,124
C#
#region License and Warranty Information // ========================================================== // <copyright file="Group.cs" company="iWork Technologies"> // Copyright (c) 2015 All Right Reserved, http://www.iworktech.com/ // // This source is subject to the iWork Technologies Permissive License. // Please see the License.txt file for more information. // All other rights reserved. // // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // </copyright> // <author>iWorkTech Dev</author> // <email>info@iworktech.com</email> // <date>2017-01-05</date> // =========================================================== #endregion #region using System; using System.Collections.Generic; using Newtonsoft.Json.Linq; using xAPI.Json; #endregion namespace xAPI { /// <summary> /// Class Group. /// </summary> /// <seealso cref="xAPI.Agent" /> public class Group : Agent { /// <summary> /// The object type /// </summary> public static readonly new string OBJECT_TYPE = "Group"; /// <summary> /// Initializes a new instance of the <see cref="Group"/> class. /// </summary> public Group() { } /// <summary> /// Initializes a new instance of the <see cref="Group"/> class. /// </summary> /// <param name="json">The json.</param> public Group(StringOfJSON json) : this(json.toJObject()) { } /// <summary> /// Initializes a new instance of the <see cref="Group"/> class. /// </summary> /// <param name="jobj">The jobj.</param> public Group(JObject jobj) : base(jobj) { if (jobj["member"] != null) { Member = new List<Agent>(); foreach (var jToken in jobj["member"]) { var jagent = (JObject) jToken; if (jagent == null) throw new ArgumentNullException(nameof(jagent)); Member.Add(new Agent(jagent)); } } } /// <summary> /// Gets the type of the object. /// </summary> /// <value>The type of the object.</value> public override string ObjectType => OBJECT_TYPE; /// <summary> /// Gets or sets the member. /// </summary> /// <value>The member.</value> public List<Agent> Member { get; set; } /// <summary> /// To the j object. /// </summary> /// <param name="version">The version.</param> /// <returns>JObject.</returns> public override JObject ToJObject(xAPIVersion version) { var result = base.ToJObject(version); if (Member != null && Member.Count > 0) { var jmember = new JArray(); result.Add("member", jmember); foreach (var agent in Member) { jmember.Add(agent.ToJObject(version)); } } return result; } /// <summary> /// Performs an explicit conversion from <see cref="JObject"/> to <see cref="Group"/>. /// </summary> /// <param name="jobj">The jobj.</param> /// <returns>The result of the conversion.</returns> public static explicit operator Group(JObject jobj) { return new Group(jobj); } } }
29.845528
94
0.516753
[ "Apache-2.0" ]
iWorkTech/xapi-wrapper-xamarin-core
component/src/TinCan/Group.cs
3,673
C#
using Microsoft.AspNetCore.Mvc; namespace ClaimManager.Web.Views.Shared.Components.Logout { public class LogoutViewComponent : ViewComponent { public IViewComponentResult Invoke() { return View(); } } }
21
57
0.646825
[ "MIT" ]
seungilpark/ClaimManager
ClaimManager.Web/Views/Shared/Components/Logout/LogoutViewComponent.cs
254
C#
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. * */ using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using BerkeleyDB; namespace CsharpAPITest { [TestFixture] public class TransactionCommitTokenTest : CSharpTestFixture { private uint masterPort; private uint clientPort; private string ip = "127.0.0.1"; [TestFixtureSetUp] public void SetUpTestFixture() { testFixtureName = "TransactionCommitTokenTest"; base.SetUpTestfixture(); ReplicationTest.AvailablePorts portGen = new ReplicationTest.AvailablePorts(); masterPort = portGen.Current; portGen.MoveNext(); clientPort = portGen.Current; } public DatabaseEnvironment SetUpEnv(String home, uint priority, uint port, bool isMaster) { try { Configuration.ClearDir(home); } catch (Exception e) { Console.WriteLine(e.Message); throw new TestException("Please clean the directory"); } /* Configure and open environment with replication * application. */ DatabaseEnvironmentConfig cfg = new DatabaseEnvironmentConfig(); cfg.UseReplication = true; cfg.MPoolSystemCfg = new MPoolConfig(); cfg.MPoolSystemCfg.CacheSize = new CacheInfo(0, 20485760, 1); cfg.UseLocking = true; cfg.UseTxns = true; cfg.UseMPool = true; cfg.Create = true; cfg.UseLogging = true; cfg.RunRecovery = true; cfg.TxnNoSync = true; cfg.FreeThreaded = true; cfg.RepSystemCfg = new ReplicationConfig(); cfg.RepSystemCfg.RepMgrLocalSite = new ReplicationHostAddress(ip, port); cfg.RepSystemCfg.Priority = priority; cfg.RepSystemCfg.NSites = 0; if (!isMaster) cfg.RepSystemCfg.AddRemoteSite(new ReplicationHostAddress(ip, masterPort), false); cfg.RepSystemCfg.BulkTransfer = false; cfg.RepSystemCfg.AckTimeout = 5000; cfg.RepSystemCfg.RepMgrAckPolicy = AckPolicy.ALL_PEERS; DatabaseEnvironment env = DatabaseEnvironment.Open( home, cfg); return env; } public BTreeDatabase Open(DatabaseEnvironment env, bool isMaster) { string dbName = "rep.db"; // Set up the database. BTreeDatabaseConfig dbCfg = new BTreeDatabaseConfig(); dbCfg.Env = env; if (isMaster) dbCfg.Creation = CreatePolicy.IF_NEEDED; dbCfg.AutoCommit = true; dbCfg.FreeThreaded = true; /* * Open the database. Do not provide a txn handle. This * Open is autocommitted because BTreeDatabaseConfig.AutoCommit * is true. */ return BTreeDatabase.Open(dbName, dbCfg); } [Test] public void TestCommitSuccess() { testName = "TestCommitSuccess"; SetUpTest(true); string[] keys = {"key 1", "key 2", "key 3", "key 4", "key 5", "key 6", "key 7", "key 8", "key 9", "key 10"}; DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, masterPort, true); DatabaseEnvironment client = SetUpEnv(testHome + "/client", 0, clientPort, false); master.RepMgrStartMaster(2); client.RepMgrStartClient(2); BTreeDatabase db1 = Open(master, true); BTreeDatabase db2 = null; for (; ; ) { if (db2 == null) try { db2 = Open(client, false); break; } catch (DatabaseException) { if (db2 != null) { db2.Close(true); db2 = null; } System.Threading.Thread.Sleep(1000); continue; } } try { for (int i = 0; i < 3; i++) { Transaction txn = master.BeginTransaction(); // Get the key. DatabaseEntry key, data; key = new DatabaseEntry( ASCIIEncoding.ASCII.GetBytes(keys[i])); data = new DatabaseEntry( ASCIIEncoding.ASCII.GetBytes(keys[i])); db1.Put(key, data, txn); txn.Commit(); byte[] token = txn.CommitToken; Assert.AreEqual(master.IsTransactionApplied(token, 5000), TransactionAppliedStatus.APPLIED); Assert.AreEqual(client.IsTransactionApplied(token, 200000), TransactionAppliedStatus.APPLIED); } } finally { db1.Close(); db2.Close(); master.Close(); client.Close(); } } [Test] public void TestNullArgument() { testName = "TestNullArgument"; SetUpTest(true); DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, 8000, true); Assert.Throws<ArgumentNullException>( delegate { master.IsTransactionApplied(null, 0); }); master.Close(); } [Test] public void TestValidArgument() { testName = "TestValidArgument"; SetUpTest(true); DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, 8000, true); Assert.Throws<ArgumentOutOfRangeException>( delegate { master.IsTransactionApplied(new byte[10], 0); }); master.Close(); } [Test] public void TestEmptyException() { testName = "TestEmptyException"; SetUpTest(true); DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, 8000, true); Transaction txn = master.BeginTransaction(); txn.Commit(); byte[] token = txn.CommitToken; Assert.AreEqual(TransactionAppliedStatus.EMPTY_TRANSACTION, master.IsTransactionApplied(token, 1000)); master.Close(); } [Test] public void TestInvalidToken() { testName = "TestInvalidToken"; SetUpTest(true); DatabaseEntry key, data; DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, 8000, true); BTreeDatabase db = Open(master,true); Transaction txn = master.BeginTransaction(); key = new DatabaseEntry( ASCIIEncoding.ASCII.GetBytes("Key")); data = new DatabaseEntry( ASCIIEncoding.ASCII.GetBytes("Data")); db.Put(key, data, txn); txn.Commit(); byte[] token = txn.CommitToken; token[19] += 123; Assert.Throws<DatabaseException>(delegate { master.IsTransactionApplied(token, 1000); }); db.Close(); master.Close(); } [Test] public void TestOperationOrder() { testName = "TestOperationOrder"; SetUpTest(true); DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, 8000, true); Transaction txn = master.BeginTransaction(); txn.Abort(); byte[] token; Assert.Throws<InvalidOperationException>(delegate { token = txn.CommitToken; }); master.Close(); } [Test] public void TestNestedTXN() { testName = "TestNestedTXN"; SetUpTest(true); DatabaseEntry key, data; DatabaseEnvironment master = SetUpEnv(testHome + "/master", 100, 8000, true); BTreeDatabase db = Open(master, true); TransactionConfig txnconfig = new TransactionConfig(); Transaction txn = master.BeginTransaction(); Transaction txn1 = master.BeginTransaction(txnconfig, txn); key = new DatabaseEntry( ASCIIEncoding.ASCII.GetBytes("Key")); data = new DatabaseEntry( ASCIIEncoding.ASCII.GetBytes("Data")); db.Put(key, data, txn1); txn1.Commit(); txn.Commit(); byte[] token; Assert.Throws<ArgumentException>(delegate { token = txn1.CommitToken; }); master.Close(); } } }
34.940711
114
0.53405
[ "MIT" ]
UncleBitcoin/doge
db-5.1.29.NC/test/csharp/TransactionCommitTokenTest.cs
8,840
C#
using System; using System.IO; using System.Reflection; // The unmanaged size_t is UInt32 in 32bit processes and UInt64 in 64bit processes // For simplicity and CLS compliancy we generally use Int32, but where it matters Int64 using Size_t = System.Int32; using Size_T = System.Int64; // just some aliases for better readability using IWICImagingFactoryPtr = System.IntPtr; using ID3D11DevicePtr = System.IntPtr; using ID3D11ResourcePtr = System.IntPtr; using ID3D11ShaderResourceViewPtr = System.IntPtr; using ID3D11DeviceContextPtr = System.IntPtr; using XMVectorPtr = System.IntPtr; namespace DirectXTexNet { #region enums public enum DXGI_FORMAT { UNKNOWN = 0, R32G32B32A32_TYPELESS = 1, R32G32B32A32_FLOAT = 2, R32G32B32A32_UINT = 3, R32G32B32A32_SINT = 4, R32G32B32_TYPELESS = 5, R32G32B32_FLOAT = 6, R32G32B32_UINT = 7, R32G32B32_SINT = 8, R16G16B16A16_TYPELESS = 9, R16G16B16A16_FLOAT = 10, R16G16B16A16_UNORM = 11, R16G16B16A16_UINT = 12, R16G16B16A16_SNORM = 13, R16G16B16A16_SINT = 14, R32G32_TYPELESS = 15, R32G32_FLOAT = 16, R32G32_UINT = 17, R32G32_SINT = 18, R32G8X24_TYPELESS = 19, D32_FLOAT_S8X24_UINT = 20, R32_FLOAT_X8X24_TYPELESS = 21, X32_TYPELESS_G8X24_UINT = 22, R10G10B10A2_TYPELESS = 23, R10G10B10A2_UNORM = 24, R10G10B10A2_UINT = 25, R11G11B10_FLOAT = 26, R8G8B8A8_TYPELESS = 27, R8G8B8A8_UNORM = 28, R8G8B8A8_UNORM_SRGB = 29, R8G8B8A8_UINT = 30, R8G8B8A8_SNORM = 31, R8G8B8A8_SINT = 32, R16G16_TYPELESS = 33, R16G16_FLOAT = 34, R16G16_UNORM = 35, R16G16_UINT = 36, R16G16_SNORM = 37, R16G16_SINT = 38, R32_TYPELESS = 39, D32_FLOAT = 40, R32_FLOAT = 41, R32_UINT = 42, R32_SINT = 43, R24G8_TYPELESS = 44, D24_UNORM_S8_UINT = 45, R24_UNORM_X8_TYPELESS = 46, X24_TYPELESS_G8_UINT = 47, R8G8_TYPELESS = 48, R8G8_UNORM = 49, R8G8_UINT = 50, R8G8_SNORM = 51, R8G8_SINT = 52, R16_TYPELESS = 53, R16_FLOAT = 54, D16_UNORM = 55, R16_UNORM = 56, R16_UINT = 57, R16_SNORM = 58, R16_SINT = 59, R8_TYPELESS = 60, R8_UNORM = 61, R8_UINT = 62, R8_SNORM = 63, R8_SINT = 64, A8_UNORM = 65, R1_UNORM = 66, R9G9B9E5_SHAREDEXP = 67, R8G8_B8G8_UNORM = 68, G8R8_G8B8_UNORM = 69, BC1_TYPELESS = 70, BC1_UNORM = 71, BC1_UNORM_SRGB = 72, BC2_TYPELESS = 73, BC2_UNORM = 74, BC2_UNORM_SRGB = 75, BC3_TYPELESS = 76, BC3_UNORM = 77, BC3_UNORM_SRGB = 78, BC4_TYPELESS = 79, BC4_UNORM = 80, BC4_SNORM = 81, BC5_TYPELESS = 82, BC5_UNORM = 83, BC5_SNORM = 84, B5G6R5_UNORM = 85, B5G5R5A1_UNORM = 86, B8G8R8A8_UNORM = 87, B8G8R8X8_UNORM = 88, R10G10B10_XR_BIAS_A2_UNORM = 89, B8G8R8A8_TYPELESS = 90, B8G8R8A8_UNORM_SRGB = 91, B8G8R8X8_TYPELESS = 92, B8G8R8X8_UNORM_SRGB = 93, BC6H_TYPELESS = 94, BC6H_UF16 = 95, BC6H_SF16 = 96, BC7_TYPELESS = 97, BC7_UNORM = 98, BC7_UNORM_SRGB = 99, AYUV = 100, Y410 = 101, Y416 = 102, NV12 = 103, P010 = 104, P016 = 105, OPAQUE_420 = 106, YUY2 = 107, Y210 = 108, Y216 = 109, NV11 = 110, AI44 = 111, IA44 = 112, P8 = 113, A8P8 = 114, B4G4R4A4_UNORM = 115, //FORCE_UINT = 0xffffffff } public enum D3D11_USAGE { DEFAULT = 0, IMMUTABLE = 1, DYNAMIC = 2, STAGING = 3 } [Flags] public enum D3D11_BIND_FLAG { VERTEX_BUFFER = 0x1, INDEX_BUFFER = 0x2, CONSTANT_BUFFER = 0x4, SHADER_RESOURCE = 0x8, STREAM_OUTPUT = 0x10, RENDER_TARGET = 0x20, DEPTH_STENCIL = 0x40, UNORDERED_ACCESS = 0x80, DECODER = 0x200, VIDEO_ENCODER = 0x400 } [Flags] public enum D3D11_CPU_ACCESS_FLAG { WRITE = 0x10000, READ = 0x20000 } [Flags] public enum D3D11_RESOURCE_MISC_FLAG { GENERATE_MIPS = 0x1, SHARED = 0x2, TEXTURECUBE = 0x4, DRAWINDIRECT_ARGS = 0x10, BUFFER_ALLOW_RAW_VIEWS = 0x20, BUFFER_STRUCTURED = 0x40, RESOURCE_CLAMP = 0x80, SHARED_KEYEDMUTEX = 0x100, GDI_COMPATIBLE = 0x200, SHARED_NTHANDLE = 0x800, RESTRICTED_CONTENT = 0x1000, RESTRICT_SHARED_RESOURCE = 0x2000, RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000, GUARDED = 0x8000, TILE_POOL = 0x20000, TILED = 0x40000 } [Flags] public enum CP_FLAGS { /// <summary> /// Normal operation /// </summary> NONE = 0x0, /// <summary> /// Assume pitch is DWORD aligned instead of BYTE aligned /// </summary> LEGACY_DWORD = 0x1, /// <summary> /// Assume pitch is 16-byte aligned instead of BYTE aligned /// </summary> PARAGRAPH = 0x2, /// <summary> /// Assume pitch is 32-byte aligned instead of BYTE aligned /// </summary> YMM = 0x4, /// <summary> /// The ZMM /// </summary> ZMM = 0x8, /// <summary> /// Assume pitch is 4096-byte aligned instead of BYTE aligned /// </summary> PAGE4K = 0x200, /// <summary> /// BC formats with malformed mipchain blocks smaller than 4x4 /// </summary> BAD_DXTN_TAILS = 0x1000, /// <summary> /// Override with a legacy 24 bits-per-pixel format size /// </summary> BPP24 = 0x10000, /// <summary> /// Override with a legacy 16 bits-per-pixel format size /// </summary> BPP16 = 0x20000, /// <summary> /// Override with a legacy 8 bits-per-pixel format size /// </summary> BPP8 = 0x40000, } public enum TEX_DIMENSION { TEXTURE1D = 2, TEXTURE2D = 3, TEXTURE3D = 4, } /// <summary> /// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG /// </summary> [Flags] public enum TEX_MISC_FLAG { TEXTURECUBE = 0x4, } [Flags] public enum TEX_MISC_FLAG2 { ALPHA_MODE_MASK = 0x7, } /// <summary> /// Matches DDS_ALPHA_MODE, encoded in MISC_FLAGS2 /// </summary> public enum TEX_ALPHA_MODE { UNKNOWN = 0, STRAIGHT = 1, PREMULTIPLIED = 2, OPAQUE = 3, CUSTOM = 4, } [Flags] public enum DDS_FLAGS { NONE = 0x0, /// <summary> /// Assume pitch is DWORD aligned instead of BYTE aligned (used by some legacy DDS files) /// </summary> LEGACY_DWORD = 0x1, /// <summary> /// Do not implicitly convert legacy formats that result in larger pixel sizes (24 bpp, 3:3:2, A8L8, A4L4, P8, A8P8) /// </summary> NO_LEGACY_EXPANSION = 0x2, /// <summary> /// Do not use work-around for long-standing D3DX DDS file format issue which reversed the 10:10:10:2 color order masks /// </summary> NO_R10B10G10A2_FIXUP = 0x4, /// <summary> /// Convert DXGI 1.1 BGR formats to DXGI_FORMAT_R8G8B8A8_UNORM to avoid use of optional WDDM 1.1 formats /// </summary> FORCE_RGB = 0x8, /// <summary> /// Conversions avoid use of 565, 5551, and 4444 formats and instead expand to 8888 to avoid use of optional WDDM 1.2 formats /// </summary> NO_16BPP = 0x10, /// <summary> /// When loading legacy luminance formats expand replicating the color channels rather than leaving them packed (L8, L16, A8L8) /// </summary> EXPAND_LUMINANCE = 0x20, /// <summary> /// Some older DXTn DDS files incorrectly handle mipchain tails for blocks smaller than 4x4 /// </summary> BAD_DXTN_TAILS = 0x40, /// <summary> /// Always use the 'DX10' header extension for DDS writer (i.e. don't try to write DX9 compatible DDS files) /// </summary> FORCE_DX10_EXT = 0x10000, /// <summary> /// FORCE_DX10_EXT including miscFlags2 information (result may not be compatible with D3DX10 or D3DX11) /// </summary> FORCE_DX10_EXT_MISC2 = 0x20000 } [Flags] public enum WIC_FLAGS { NONE = 0x0, /// <summary> /// Loads DXGI 1.1 BGR formats as DXGI_FORMAT_R8G8B8A8_UNORM to avoid use of optional WDDM 1.1 formats /// </summary> FORCE_RGB = 0x1, /// <summary> /// Loads DXGI 1.1 X2 10:10:10:2 format as DXGI_FORMAT_R10G10B10A2_UNORM /// </summary> NO_X2_BIAS = 0x2, /// <summary> /// Loads 565, 5551, and 4444 formats as 8888 to avoid use of optional WDDM 1.2 formats /// </summary> NO_16BPP = 0x4, /// <summary> /// Loads 1-bit monochrome (black and white) as R1_UNORM rather than 8-bit grayscale /// </summary> ALLOW_MONO = 0x8, /// <summary> /// Loads all images in a multi-frame file, converting/resizing to match the first frame as needed, defaults to 0th frame otherwise /// </summary> ALL_FRAMES = 0x10, /// <summary> /// Ignores sRGB metadata if present in the file /// </summary> IGNORE_SRGB = 0x20, /// <summary> /// Use ordered 4x4 dithering for any required conversions /// </summary> DITHER = 0x10000, /// <summary> /// Use error-diffusion dithering for any required conversions /// </summary> DITHER_DIFFUSION = 0x20000, /// <summary> /// Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant) /// </summary> FILTER_POINT = 0x100000, /// <summary> /// Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant) /// </summary> FILTER_LINEAR = 0x200000, /// <summary> /// Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant) /// </summary> FILTER_CUBIC = 0x300000, /// <summary> /// Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant) /// Combination of Linear and Box filter /// </summary> FILTER_FANT = 0x400000 } [Flags] public enum TEX_FR_FLAGS { ROTATE0 = 0x0, ROTATE90 = 0x1, ROTATE180 = 0x2, ROTATE270 = 0x3, FLIP_HORIZONTAL = 0x08, FLIP_VERTICAL = 0x10, } [Flags] public enum TEX_FILTER_FLAGS { DEFAULT = 0, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> WRAP_U = 0x1, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> WRAP_V = 0x2, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> WRAP_W = 0x4, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> WRAP = (WRAP_U | WRAP_V | WRAP_W), MIRROR_U = 0x10, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> MIRROR_V = 0x20, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> MIRROR_W = 0x40, /// <summary> /// Wrap vs. Mirror vs. Clamp filtering options /// </summary> MIRROR = (MIRROR_U | MIRROR_V | MIRROR_W), /// <summary> /// Resize color and alpha channel independently /// </summary> SEPARATE_ALPHA = 0x100, /// <summary> /// Enable *2 - 1 conversion cases for unorm to/from float and positive-only float formats /// </summary> FLOAT_X2BIAS = 0x200, /// <summary> /// When converting RGB to R, defaults to using grayscale. These flags indicate copying a specific channel instead /// When converting RGB to RG, defaults to copying RED | GREEN. These flags control which channels are selected instead. /// </summary> RGB_COPY_RED = 0x1000, /// <summary> /// When converting RGB to R, defaults to using grayscale. These flags indicate copying a specific channel instead /// When converting RGB to RG, defaults to copying RED | GREEN. These flags control which channels are selected instead. /// </summary> RGB_COPY_GREEN = 0x2000, /// <summary> /// When converting RGB to R, defaults to using grayscale. These flags indicate copying a specific channel instead /// When converting RGB to RG, defaults to copying RED | GREEN. These flags control which channels are selected instead. /// </summary> RGB_COPY_BLUE = 0x4000, /// <summary> /// Use ordered 4x4 dithering for any required conversions /// </summary> DITHER = 0x10000, /// <summary> /// Use error-diffusion dithering for any required conversions /// </summary> DITHER_DIFFUSION = 0x20000, /// <summary> /// Filtering mode to use for any required image resizing /// </summary> POINT = 0x100000, /// <summary> /// Filtering mode to use for any required image resizing /// </summary> LINEAR = 0x200000, /// <summary> /// Filtering mode to use for any required image resizing /// </summary> CUBIC = 0x300000, /// <summary> /// Filtering mode to use for any required image resizing /// </summary> BOX = 0x400000, /// <summary> /// Filtering mode to use for any required image resizing /// Equiv to Box filtering for mipmap generation /// </summary> FANT = 0x400000, /// <summary> /// Filtering mode to use for any required image resizing /// </summary> TRIANGLE = 0x500000, SRGB_IN = 0x1000000, SRGB_OUT = 0x2000000, /// <summary> /// sRGB to/from RGB for use in conversion operations /// if the input format type is IsSRGB(), then SRGB_IN is on by default /// if the output format type is IsSRGB(), then SRGB_OUT is on by default /// </summary> SRGB = (SRGB_IN | SRGB_OUT), /// <summary> /// Forces use of the non-WIC path when both are an option /// </summary> FORCE_NON_WIC = 0x10000000, /// <summary> /// Forces use of the WIC path even when logic would have picked a non-WIC path when both are an option /// </summary> FORCE_WIC = 0x20000000 } [Flags] public enum TEX_PMALPHA_FLAGS { DEFAULT = 0, /// <summary> /// ignores sRGB colorspace conversions /// </summary> IGNORE_SRGB = 0x1, /// <summary> /// converts from premultiplied alpha back to straight alpha /// </summary> REVERSE = 0x2, SRGB_IN = 0x1000000, SRGB_OUT = 0x2000000, /// <summary> /// if the input format type is IsSRGB(), then SRGB_IN is on by default /// if the output format type is IsSRGB(), then SRGB_OUT is on by default /// </summary> SRGB = (SRGB_IN | SRGB_OUT) } [Flags] public enum TEX_COMPRESS_FLAGS { DEFAULT = 0, /// <summary> /// Enables dithering RGB colors for BC1-3 compression /// </summary> RGB_DITHER = 0x10000, /// <summary> /// Enables dithering alpha for BC1-3 compression /// </summary> A_DITHER = 0x20000, /// <summary> /// Enables both RGB and alpha dithering for BC1-3 compression /// </summary> DITHER = 0x30000, /// <summary> /// Uniform color weighting for BC1-3 compression; by default uses perceptual weighting /// </summary> UNIFORM = 0x40000, /// <summary> /// Enables exhaustive search for BC7 compress for mode 0 and 2; by default skips trying these modes /// </summary> BC7_USE_3SUBSETS = 0x80000, /// <summary> /// Minimal modes (usually mode 6) for BC7 compression /// </summary> BC7_QUICK = 0x100000, SRGB_IN = 0x1000000, SRGB_OUT = 0x2000000, /// <summary> /// if the input format type is IsSRGB(), then SRGB_IN is on by default /// if the output format type is IsSRGB(), then SRGB_OUT is on by default /// </summary> SRGB = (SRGB_IN | SRGB_OUT), /// <summary> /// Compress is free to use multithreading to improve performance (by default it does not use multithreading) /// </summary> PARALLEL = 0x10000000 } [Flags] public enum CNMAP_FLAGS { DEFAULT = 0, /// <summary> /// Channel selection when evaluting color value for height /// </summary> CHANNEL_RED = 0x1, /// <summary> /// Channel selection when evaluting color value for height /// </summary> CHANNEL_GREEN = 0x2, /// <summary> /// Channel selection when evaluting color value for height /// </summary> CHANNEL_BLUE = 0x3, /// <summary> /// Channel selection when evaluting color value for height /// </summary> CHANNEL_ALPHA = 0x4, /// <summary> /// Channel selection when evaluting color value for height /// Luminance is a combination of red, green, and blue /// </summary> CHANNEL_LUMINANCE = 0x5, /// <summary> /// Use mirror semantics for scanline references (defaults to wrap) /// </summary> MIRROR_U = 0x1000, /// <summary> /// Use mirror semantics for scanline references (defaults to wrap) /// </summary> MIRROR_V = 0x2000, /// <summary> /// Use mirror semantics for scanline references (defaults to wrap) /// </summary> MIRROR = 0x3000, /// <summary> /// Inverts normal sign /// </summary> INVERT_SIGN = 0x4000, /// <summary> /// Computes a crude occlusion term stored in the alpha channel /// </summary> COMPUTE_OCCLUSION = 0x8000 } [Flags] public enum CMSE_FLAGS { DEFAULT = 0, /// <summary> /// Indicates that image needs gamma correction before comparision /// </summary> IMAGE1_SRGB = 0x1, /// <summary> /// Indicates that image needs gamma correction before comparision /// </summary> IMAGE2_SRGB = 0x2, /// <summary> /// Ignore the channel when computing MSE /// </summary> IGNORE_RED = 0x10, /// <summary> /// Ignore the channel when computing MSE /// </summary> IGNORE_GREEN = 0x20, /// <summary> /// Ignore the channel when computing MSE /// </summary> IGNORE_BLUE = 0x40, /// <summary> /// Ignore the channel when computing MSE /// </summary> IGNORE_ALPHA = 0x80, /// <summary> /// Indicates that image should be scaled and biased before comparison (i.e. UNORM -> SNORM) /// </summary> IMAGE1_X2_BIAS = 0x100, /// <summary> /// Indicates that image should be scaled and biased before comparison (i.e. UNORM -> SNORM) /// </summary> IMAGE2_X2_BIAS = 0x200, }; public enum WICCodecs { /// <summary> /// Windows Bitmap (.bmp) /// </summary> BMP = 1, /// <summary> /// Joint Photographic Experts Group (.jpg, .jpeg) /// </summary> JPEG, /// <summary> /// Portable Network Graphics (.png) /// </summary> PNG, /// <summary> /// Tagged Image File Format (.tif, .tiff) /// </summary> TIFF, /// <summary> /// Graphics Interchange Format (.gif) /// </summary> GIF, /// <summary> /// Windows Media Photo / HD Photo / JPEG XR (.hdp, .jxr, .wdp) /// </summary> WMP, /// <summary> /// Windows Icon (.ico) /// </summary> ICO } #endregion #region Delegates /// <summary> /// The delegate used for the EvaluateImage method. /// </summary> /// <param name="pixels">The pixels. This a row of Pixels with each pixel normally represented as RBGA in 4x32bit float (0.0-1.0).</param> /// <param name="width">The width.</param> /// <param name="y">The y/row index.</param> public delegate void EvaluatePixelsDelegate(XMVectorPtr pixels, IntPtr width, IntPtr y); /// <summary> /// The delegate used for the EvaluateImage method. /// </summary> /// <param name="outPixels"> /// The out pixels to write to. This a row of Pixels with each pixel normally represented as RBGA in 4x32bit float /// (0.0-1.0). /// </param> /// <param name="inPixels">The input pixels. This a row of Pixels with each pixel normally represented as RBGA in 4x32bit float (0.0-1.0).</param> /// <param name="width">The width.</param> /// <param name="y">The y/row index.</param> public delegate void TransformPixelsDelegate(XMVectorPtr outPixels, XMVectorPtr inPixels, IntPtr width, IntPtr y); #endregion #region structs public struct MseV { public float V0, V1, V2, V3; } #endregion /// <summary> /// This is an immutable class representing the native Image struct. /// It also keeps a reference to a parent to prevent finalizing of the parent when the image is still used. /// But it's still strongly encouraged to manually dispose ScratchImages. /// </summary> public sealed class Image { public Size_t Width { get; } public Size_t Height { get; } public DXGI_FORMAT Format { get; } public Size_T RowPitch { get; } public Size_T SlicePitch { get; } public IntPtr Pixels { get; } public object Parent { get; } public Image(Size_t width, Size_t height, DXGI_FORMAT format, Size_T rowPitch, Size_T slicePitch, IntPtr pixels, object parent) { this.Width = width; this.Height = height; this.Format = format; this.RowPitch = rowPitch; this.SlicePitch = slicePitch; this.Pixels = pixels; this.Parent = parent; } } /// <summary> /// This class represents the native TexMetadata struct. A managed class is used to simplify passing it by reference. /// </summary> public sealed class TexMetadata { public Size_t Width; /// <summary> /// The height. Should be 1 for 1D textures. /// </summary> public Size_t Height; /// <summary> /// The depth. Should be 1 for 1D or 2D textures. /// </summary> public Size_t Depth; /// <summary> /// The array size. For cubemap, this is a multiple of 6. /// </summary> public Size_t ArraySize; public Size_t MipLevels; public TEX_MISC_FLAG MiscFlags; public TEX_MISC_FLAG2 MiscFlags2; public DXGI_FORMAT Format; public TEX_DIMENSION Dimension; public TexMetadata( Size_t width, Size_t height, Size_t depth, Size_t arraySize, Size_t mipLevels, TEX_MISC_FLAG miscFlags, TEX_MISC_FLAG2 miscFlags2, DXGI_FORMAT format, TEX_DIMENSION dimension) { this.Width = width; this.Height = height; this.Depth = depth; this.ArraySize = arraySize; this.MipLevels = mipLevels; this.MiscFlags = miscFlags; this.MiscFlags2 = miscFlags2; this.Format = format; this.Dimension = dimension; } public bool IsCubemap() { return (this.MiscFlags & TEX_MISC_FLAG.TEXTURECUBE) != 0; } public bool IsPMAlpha() { return (uint)(this.MiscFlags2 & TEX_MISC_FLAG2.ALPHA_MODE_MASK) == (uint)TEX_ALPHA_MODE.PREMULTIPLIED; } public void SetAlphaMode(TEX_ALPHA_MODE mode) { this.MiscFlags2 = (TEX_MISC_FLAG2)(((uint)this.MiscFlags2 & ~(uint)TEX_MISC_FLAG2.ALPHA_MODE_MASK) | (uint)mode); } public TEX_ALPHA_MODE GetAlphaMode() { return (TEX_ALPHA_MODE)(this.MiscFlags2 & TEX_MISC_FLAG2.ALPHA_MODE_MASK); } public bool IsVolumemap() { return this.Dimension == TEX_DIMENSION.TEXTURE3D; } } public abstract class ScratchImage : IDisposable { //internal ScratchImage() { } public abstract bool IsDisposed { get; } public abstract Size_t GetImageCount(); /// <summary> /// Computes the image index for the specified values. If the image index is out of range <see cref="TexHelper.IndexOutOfRange" /> is returned. /// </summary> /// <param name="mip">The mip.</param> /// <param name="item">The item.</param> /// <param name="slice">The slice.</param> /// <returns>The image index. If the image index is out of range <see cref="TexHelper.IndexOutOfRange" /> is returned.</returns> public abstract Size_t ComputeImageIndex(Size_t mip, Size_t item, Size_t slice); public abstract Image GetImage(Size_t idx); public abstract Image GetImage(Size_t mip, Size_t item, Size_t slice); public abstract TexMetadata GetMetadata(); public abstract bool OverrideFormat(DXGI_FORMAT f); /// <summary> /// Whether this ScratchImage owns the pixel data; /// </summary> public abstract bool OwnsData(); /// <summary> /// Normally GetImage().pixels should be used instead, because this only returns a pointer to the pixel data if this image owns the pixel data. /// </summary> public abstract IntPtr GetPixels(); /// <summary> /// This only returns a value if this image owns the pixel data. /// </summary> public abstract Size_T GetPixelsSize(); /// <summary> /// Determines whether all pixels are opaque. This method is not supported by temporary scratch images. /// </summary> public abstract bool IsAlphaAllOpaque(); #region creating image copies /// <summary> /// Creates a new ScratchImage (deep copy). /// </summary> /// <param name="imageIndex">Index of the image to make a copy of.</param> /// <param name="allow1D">if set to <c>true</c> and the height of the image is 1 a 1D Texture is created instead a 2D Texture.</param> /// <param name="flags">The flags.</param> public abstract ScratchImage CreateImageCopy(Size_t imageIndex, bool allow1D, CP_FLAGS flags); /// <summary> /// Creates a new Array ScratchImage (deep copy). /// </summary> /// <param name="startIndex">The start index.</param> /// <param name="nImages">The n images.</param> /// <param name="allow1D">if set to <c>true</c> and the height of the image is 1 a 1D Texture is created instead a 2D Texture.</param> /// <param name="flags">The flags.</param> public abstract ScratchImage CreateArrayCopy(Size_t startIndex, Size_t nImages, bool allow1D, CP_FLAGS flags); public abstract ScratchImage CreateCubeCopy(Size_t startIndex, Size_t nImages, CP_FLAGS flags); public abstract ScratchImage CreateVolumeCopy(Size_t startIndex, Size_t depth, CP_FLAGS flags); /// <summary> /// Creates a copy of the image but with empty mip maps (not part of original DirectXTex). /// Can be used to generate the mip maps by other means (DirectXTex MipMap Generation is pretty slow). /// </summary> /// <param name="levels">The levels.</param> /// <param name="fmt">The format.</param> /// <param name="flags">The flags.</param> /// <param name="zeroOutMipMaps">if set to <c>true</c> the mip map levels are zeroed out.</param> public abstract ScratchImage CreateCopyWithEmptyMipMaps(Size_t levels, DXGI_FORMAT fmt, CP_FLAGS flags, bool zeroOutMipMaps); #endregion #region saving images to file/memory public abstract UnmanagedMemoryStream SaveToDDSMemory(Size_t imageIndex, DDS_FLAGS flags); public abstract UnmanagedMemoryStream SaveToDDSMemory(DDS_FLAGS flags); public abstract UnmanagedMemoryStream SaveToHDRMemory(Size_t imageIndex); public abstract void SaveToHDRFile(Size_t imageIndex, String szFile); public abstract UnmanagedMemoryStream SaveToTGAMemory(Size_t imageIndex); public abstract void SaveToTGAFile(Size_t imageIndex, String szFile); public abstract void SaveToDDSFile(Size_t imageIndex, DDS_FLAGS flags, String szFile); public abstract void SaveToDDSFile(DDS_FLAGS flags, String szFile); public abstract UnmanagedMemoryStream SaveToWICMemory(Size_t imageIndex, WIC_FLAGS flags, Guid guidContainerFormat); public abstract UnmanagedMemoryStream SaveToWICMemory(Size_t startIndex, Size_t nImages, WIC_FLAGS flags, Guid guidContainerFormat); public abstract void SaveToWICFile(Size_t imageIndex, WIC_FLAGS flags, Guid guidContainerFormat, String szFile); public abstract void SaveToWICFile(Size_t startIndex, Size_t nImages, WIC_FLAGS flags, Guid guidContainerFormat, String szFile); #endregion #region Texture conversion, resizing, mipmap generation, and block compression public abstract ScratchImage FlipRotate(Size_t imageIndex, TEX_FR_FLAGS flags); public abstract ScratchImage FlipRotate(TEX_FR_FLAGS flags); public abstract ScratchImage Resize(Size_t imageIndex, Size_t width, Size_t height, TEX_FILTER_FLAGS filter); /// <summary> /// Resize the image to width x height. Defaults to Fant filtering. Note for a complex resize, the result will always have mipLevels == 1. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="filter">The filter.</param> /// <returns>The resized image.</returns> public abstract ScratchImage Resize(Size_t width, Size_t height, TEX_FILTER_FLAGS filter); public abstract ScratchImage Convert(Size_t imageIndex, DXGI_FORMAT format, TEX_FILTER_FLAGS filter, float threshold); public abstract ScratchImage Convert(DXGI_FORMAT format, TEX_FILTER_FLAGS filter, float threshold); /// <summary> /// Converts the image from a planar format to an equivalent non-planar format. /// </summary> public abstract ScratchImage ConvertToSinglePlane(Size_t imageIndex); /// <summary> /// Converts the image from a planar format to an equivalent non-planar format. /// </summary> public abstract ScratchImage ConvertToSinglePlane(); /// <summary> /// Generates the mip maps. /// </summary> /// <param name="imageIndex">Index of the image.</param> /// <param name="filter">The filter. Defaults to Fant filtering which is equivalent to a box filter.</param> /// <param name="levels"> /// Levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base /// image). /// </param> /// <param name="allow1D">if set to <c>true</c> and the height of the image is 1 a 1D Texture is created instead a 2D Texture.</param> public abstract ScratchImage GenerateMipMaps(Size_t imageIndex, TEX_FILTER_FLAGS filter, Size_t levels, bool allow1D); /// <summary> /// Generates the mip maps. /// </summary> /// <param name="filter">The filter. Defaults to Fant filtering which is equivalent to a box filter.</param> /// <param name="levels"> /// Levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base /// image). /// </param> public abstract ScratchImage GenerateMipMaps(TEX_FILTER_FLAGS filter, Size_t levels); /// <summary> /// Generates the mip maps. /// </summary> /// <param name="startIndex">The start index.</param> /// <param name="depth">The depth.</param> /// <param name="filter">The filter. Defaults to Fant filtering which is equivalent to a box filter.</param> /// <param name="levels"> /// Levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base /// image). /// </param> public abstract ScratchImage GenerateMipMaps3D(Size_t startIndex, Size_t depth, TEX_FILTER_FLAGS filter, Size_t levels); /// <summary> /// Generates the mip maps. /// </summary> /// <param name="filter">The filter. Defaults to Fant filtering which is equivalent to a box filter.</param> /// <param name="levels"> /// Levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base /// image). /// </param> public abstract ScratchImage GenerateMipMaps3D(TEX_FILTER_FLAGS filter, Size_t levels); /// <summary> /// Converts to/from a premultiplied alpha version of the texture. /// </summary> /// <param name="imageIndex">Index of the image.</param> /// <param name="flags">The flags.</param> public abstract ScratchImage PremultiplyAlpha(Size_t imageIndex, TEX_PMALPHA_FLAGS flags); /// <summary> /// Converts to/from a premultiplied alpha version of the texture. /// </summary> /// <param name="flags">The flags.</param> public abstract ScratchImage PremultiplyAlpha(TEX_PMALPHA_FLAGS flags); /// <summary> /// Compresses the specified source image. Note that threshold is only used by BC1. /// </summary> /// <param name="imageIndex">Index of the image.</param> /// <param name="format">The format.</param> /// <param name="compress">The compress.</param> /// <param name="threshold">The threshold. Default 0.5</param> public abstract ScratchImage Compress(Size_t imageIndex, DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float threshold); /// <summary> /// DirectCompute-based compression /// </summary> /// <param name="imageIndex">Index of the image.</param> /// <param name="pDevice">The device.</param> /// <param name="format">The format.</param> /// <param name="compress">The compress.</param> /// <param name="alphaWeight">The alpha weight (is only used by BC7. 1.0 is the typical value to use).</param> public abstract ScratchImage Compress( Size_t imageIndex, ID3D11DevicePtr pDevice, DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float alphaWeight); /// <summary> /// Compresses the specified source image. Note that threshold is only used by BC1. /// </summary> /// <param name="format">The format.</param> /// <param name="compress">The compress.</param> /// <param name="threshold">The threshold. Default 0.5</param> public abstract ScratchImage Compress(DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float threshold); /// <summary> /// DirectCompute-based compression /// </summary> /// <param name="pDevice">The device.</param> /// <param name="format">The format.</param> /// <param name="compress">The compress.</param> /// <param name="alphaWeight">The alpha weight (is only used by BC7. 1.0 is the typical value to use).</param> public abstract ScratchImage Compress(ID3D11DevicePtr pDevice, DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float alphaWeight); public abstract ScratchImage Decompress(Size_t imageIndex, DXGI_FORMAT format); public abstract ScratchImage Decompress(DXGI_FORMAT format); #endregion #region Normal map operations public abstract ScratchImage ComputeNormalMap(Size_t imageIndex, CNMAP_FLAGS flags, float amplitude, DXGI_FORMAT format); public abstract ScratchImage ComputeNormalMap(CNMAP_FLAGS flags, float amplitude, DXGI_FORMAT format); #endregion #region Misc image operations public abstract void EvaluateImage(Size_t imageIndex, EvaluatePixelsDelegate pixelFunc); public abstract void EvaluateImage(EvaluatePixelsDelegate pixelFunc); public abstract ScratchImage TransformImage(Size_t imageIndex, TransformPixelsDelegate pixelFunc); public abstract ScratchImage TransformImage(TransformPixelsDelegate pixelFunc); #endregion #region Direct3D 11 functions public abstract ID3D11ResourcePtr CreateTexture(ID3D11DevicePtr pDevice); public abstract ID3D11ShaderResourceViewPtr CreateShaderResourceView(ID3D11DevicePtr pDevice); public abstract ID3D11ResourcePtr CreateTextureEx( ID3D11DevicePtr pDevice, D3D11_USAGE usage, D3D11_BIND_FLAG bindFlags, D3D11_CPU_ACCESS_FLAG cpuAccessFlags, D3D11_RESOURCE_MISC_FLAG miscFlags, bool forceSRGB); public abstract ID3D11ShaderResourceViewPtr CreateShaderResourceViewEx( ID3D11DevicePtr pDevice, D3D11_USAGE usage, D3D11_BIND_FLAG bindFlags, D3D11_CPU_ACCESS_FLAG cpuAccessFlags, D3D11_RESOURCE_MISC_FLAG miscFlags, bool forceSRGB); #endregion public virtual void Dispose() { } } public abstract class TexHelper { public static readonly TexHelper Instance; static TexHelper() { String folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); String filePath = Path.Combine(folder, Environment.Is64BitProcess ? "x64" : "x86", "DirectXTexNetImpl.dll"); Assembly assembly = Assembly.LoadFile(filePath); Instance = (TexHelper)Activator.CreateInstance(assembly.GetType("DirectXTexNet.TexHelperImpl")); } public readonly Size_t IndexOutOfRange = unchecked((Size_t)(Environment.Is64BitProcess ? UInt64.MaxValue : UInt32.MaxValue)); //internal DirectXTexNet() { } public abstract void SetOmpMaxThreadCount(int maxThreadCount); #region DXGI Format Utilities public abstract bool IsValid(DXGI_FORMAT fmt); public abstract bool IsCompressed(DXGI_FORMAT fmt); public abstract bool IsPacked(DXGI_FORMAT fmt); public abstract bool IsVideo(DXGI_FORMAT fmt); public abstract bool IsPlanar(DXGI_FORMAT fmt); public abstract bool IsPalettized(DXGI_FORMAT fmt); public abstract bool IsDepthStencil(DXGI_FORMAT fmt); public abstract bool IsSRGB(DXGI_FORMAT fmt); public abstract bool IsTypeless(DXGI_FORMAT fmt, bool partialTypeless); public abstract bool HasAlpha(DXGI_FORMAT fmt); public abstract Size_t BitsPerPixel(DXGI_FORMAT fmt); public abstract Size_t BitsPerColor(DXGI_FORMAT fmt); public abstract void ComputePitch( DXGI_FORMAT fmt, Size_t width, Size_t height, out Size_T rowPitch, out Size_T slicePitch, CP_FLAGS flags); public abstract Size_T ComputeScanlines(DXGI_FORMAT fmt, Size_t height); /// <summary> /// Computes the image index for the specified values. If the image index is out of range <see cref="TexHelper.IndexOutOfRange" /> is returned. /// The ScratchImage provide a ComputeImageIndex method as well, which should be used preferrably. /// </summary> /// <param name="metadata">The metadata.</param> /// <param name="mip">The mip.</param> /// <param name="item">The item.</param> /// <param name="slice">The slice.</param> /// <returns> /// The image index. If the image index is out of range <see cref="TexHelper.IndexOutOfRange" /> is returned. /// </returns> public abstract Size_t ComputeImageIndex(TexMetadata metadata, Size_t mip, Size_t item, Size_t slice); public abstract DXGI_FORMAT MakeSRGB(DXGI_FORMAT fmt); public abstract DXGI_FORMAT MakeTypeless(DXGI_FORMAT fmt); public abstract DXGI_FORMAT MakeTypelessUNORM(DXGI_FORMAT fmt); public abstract DXGI_FORMAT MakeTypelessFLOAT(DXGI_FORMAT fmt); #endregion #region Texture metadata public abstract TexMetadata GetMetadataFromDDSMemory(IntPtr pSource, Size_T size, DDS_FLAGS flags); public abstract TexMetadata GetMetadataFromDDSFile(String szFile, DDS_FLAGS flags); public abstract TexMetadata GetMetadataFromHDRMemory(IntPtr pSource, Size_T size); public abstract TexMetadata GetMetadataFromHDRFile(String szFile); public abstract TexMetadata GetMetadataFromTGAMemory(IntPtr pSource, Size_T size); public abstract TexMetadata GetMetadataFromTGAFile(String szFile); public abstract TexMetadata GetMetadataFromWICMemory(IntPtr pSource, Size_T size, WIC_FLAGS flags); public abstract TexMetadata GetMetadataFromWICFile(String szFile, WIC_FLAGS flags); #endregion #region create new ScratchImages public abstract ScratchImage Initialize(TexMetadata mdata, CP_FLAGS flags); public abstract ScratchImage Initialize1D(DXGI_FORMAT fmt, Size_t length, Size_t arraySize, Size_t mipLevels, CP_FLAGS flags); public abstract ScratchImage Initialize2D( DXGI_FORMAT fmt, Size_t width, Size_t height, Size_t arraySize, Size_t mipLevels, CP_FLAGS flags); public abstract ScratchImage Initialize3D(DXGI_FORMAT fmt, Size_t width, Size_t height, Size_t depth, Size_t mipLevels, CP_FLAGS flags); public abstract ScratchImage InitializeCube( DXGI_FORMAT fmt, Size_t width, Size_t height, Size_t nCubes, Size_t mipLevels, CP_FLAGS flags); /// <summary> /// Creates a temporary image collection (Not part of the original DirectXTex). This does not copy the data. Be sure to not dispose the original ScratchImages that were combined in this /// collection. Alternatively the ownership of the original ScratchImage(s) can be passed to this instance. /// </summary> /// <param name="images">The images.</param> /// <param name="metadata">The metadata.</param> /// <param name="takeOwnershipOf">Optional objects this instance should take ownership of.</param> public abstract ScratchImage InitializeTemporary(Image[] images, TexMetadata metadata, params IDisposable[] takeOwnershipOf); #endregion #region Image I/O // DDS operations public abstract ScratchImage LoadFromDDSMemory(IntPtr pSource, Size_T size, DDS_FLAGS flags); public abstract ScratchImage LoadFromDDSFile(String szFile, DDS_FLAGS flags); // HDR operations public abstract ScratchImage LoadFromHDRMemory(IntPtr pSource, Size_T size); public abstract ScratchImage LoadFromHDRFile(String szFile); // TGA operations public abstract ScratchImage LoadFromTGAMemory(IntPtr pSource, Size_T size); public abstract ScratchImage LoadFromTGAFile(String szFile); // WIC operations public abstract ScratchImage LoadFromWICMemory(IntPtr pSource, Size_T size, WIC_FLAGS flags); public abstract ScratchImage LoadFromWICFile(String szFile, WIC_FLAGS flags); #endregion #region Misc image operations public abstract void CopyRectangle( Image srcImage, Size_t srcX, Size_t srcY, Size_t srcWidth, Size_t srcHeight, Image dstImage, TEX_FILTER_FLAGS filter, Size_t xOffset, Size_t yOffset); public abstract void ComputeMSE(Image image1, Image image2, out float mse, out MseV mseV, CMSE_FLAGS flags); #endregion #region WIC utility public abstract Guid GetWICCodec(WICCodecs codec); public abstract IWICImagingFactoryPtr GetWICFactory(bool iswic2); public abstract void SetWICFactory(IWICImagingFactoryPtr pWIC); #endregion #region Direct3D 11 functions public abstract bool IsSupportedTexture(ID3D11DevicePtr pDevice, TexMetadata metadata); public abstract ScratchImage CaptureTexture(ID3D11DevicePtr pDevice, ID3D11DeviceContextPtr pContext, ID3D11ResourcePtr pSource); #endregion } }
36.759445
194
0.593913
[ "MIT" ]
malware-dev/DirectXTexNet
DirectXTexNet/DirectXTexNet.cs
47,679
C#
using System; using Eto.Forms; using System.Collections.Generic; using System.Linq; namespace Pablo.Sauce.Types.Bitmap { public enum BitmapFileType { Gif = 0, // (CompuServe Graphics Interchange format) Pcx = 1, // (ZSoft Paintbrush PCX format) LbmIff = 2, // (DeluxePaint LBM/IFF format) Tga = 3, // (Targa Truecolor) Fli = 4, // (Autodesk FLI animation file) Flc = 5, // (Autodesk FLC animation file) Bmp = 6, // (Windows or OS/2 Bitmap) Gl = 7, // (Grasp GL Animation) Dl = 8, // (DL Animation) Wpg = 9, // (Wordperfect Bitmap) Png = 10, // (Portable Graphics) Jpeg = 11, // (JPeg compressed File) Mpeg = 12, // (MPeg compressed animation/video) Avi = 13, // (Audio Visual Interlace) } public class DataTypeInfo : BaseFileType.DataTypeInfo { public override IEnumerable<SauceFileTypeInfo> FileTypes { get { yield return new SauceFileTypeInfo{ Type = 0, Name = "GIF" }; yield return new SauceFileTypeInfo{ Type = 1, Name = "PCX" }; yield return new SauceFileTypeInfo{ Type = 2, Name = "LBM/IFF" }; yield return new SauceFileTypeInfo{ Type = 3, Name = "TGA" }; yield return new SauceFileTypeInfo{ Type = 4, Name = "FLI" }; yield return new SauceFileTypeInfo{ Type = 5, Name = "FLC" }; yield return new SauceFileTypeInfo{ Type = 6, Name = "BMP" }; yield return new SauceFileTypeInfo{ Type = 7, Name = "GL" }; yield return new SauceFileTypeInfo{ Type = 8, Name = "DL" }; yield return new SauceFileTypeInfo{ Type = 9, Name = "WPG" }; yield return new SauceFileTypeInfo{ Type = 10, Name = "PNG" }; yield return new SauceFileTypeInfo{ Type = 11, Name = "JPG" }; yield return new SauceFileTypeInfo{ Type = 12, Name = "MPG" }; yield return new SauceFileTypeInfo{ Type = 13, Name = "AVI" }; } } public BitmapFileType Type { get { return (BitmapFileType)Sauce.ByteFileType; } set { Sauce.ByteFileType = (byte)value; } } } }
28.057143
69
0.648676
[ "MIT" ]
blocktronics/pablodraw
Source/Pablo/Sauce/Types/Bitmap/DataTypeInfo.cs
1,964
C#
using Hl7.Fhir.ElementModel.Adapters; using Hl7.Fhir.Model; using Hl7.Fhir.Serialization; using Hl7.Fhir.Specification; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tasks = System.Threading.Tasks; namespace Hl7.Fhir.ElementModel.Tests { [TestClass] public class TypedElementToSourceNodeAdapterTests { /// <summary> /// This test proves issue https://github.com/FirelyTeam/firely-net-sdk/issues/888 /// </summary> [TestMethod] public void AnnotationsTest() { var patient = new Patient() { Active = true }; var typedElement = patient.ToTypedElement(); var sourceNode = typedElement.ToSourceNode(); var result = sourceNode.Annotation<ISourceNode>(); Assert.IsNotNull(result); Assert.AreEqual(typeof(TypedElementToSourceNodeAdapter), result.GetType()); Assert.AreSame(sourceNode, result); var result2 = sourceNode.Annotation<IResourceTypeSupplier>(); Assert.IsNotNull(result2); Assert.AreEqual("TypedElementToSourceNodeAdapter", result2.GetType().Name); // I use the classname here, because PocoElementNode is internal in Hl7.Fhir.Core Assert.AreSame(sourceNode, result2); } [TestMethod] public async Tasks.Task AnnotationsFromParsingTest() { var _sdsProvider = new PocoStructureDefinitionSummaryProvider(); var patientJson = "{\"resourceType\":\"Patient\", \"active\":\"true\"}"; var patient = await FhirJsonNode.ParseAsync(patientJson); var typedPatient = patient.ToTypedElement(_sdsProvider, "Patient"); var sourceNode = typedPatient.ToSourceNode(); var result = patient.Annotation<ISourceNode>(); Assert.IsNotNull(result); Assert.AreEqual(typeof(FhirJsonNode), result.GetType(), "ISourceNode is provided by FhirJsonNode"); Assert.AreSame(patient, result); var result2 = sourceNode.Annotation<ISourceNode>(); Assert.IsNotNull(result2); Assert.AreEqual(typeof(TypedElementToSourceNodeAdapter), result2.GetType(), "Now ISourceNode is provided by TypedElementToSourceNodeAdapter"); Assert.AreSame(sourceNode, result2); var result3 = sourceNode.Annotation<IResourceTypeSupplier>(); Assert.IsNotNull(result3); Assert.AreEqual(typeof(TypedElementToSourceNodeAdapter), result3.GetType()); } [TestMethod] public async Tasks.Task SourceNodeFromElementNodeReturnsResourceTypeSupplier() { var _sdsProvider = new PocoStructureDefinitionSummaryProvider(); var patientJson = "{\"resourceType\":\"Patient\", \"active\":\"true\"}"; var patientNode = await FhirJsonNode.ParseAsync(patientJson); var typedPatient = patientNode.ToTypedElement(_sdsProvider, "Patient"); var elementNode = ElementNode.FromElement(typedPatient); var adapter = elementNode.ToSourceNode(); Assert.AreEqual(typeof(TypedElementToSourceNodeAdapter), adapter.GetType(), "ISourceNode is provided by TypedElementToSourceNodeAdapter"); var result = adapter.Annotation<IResourceTypeSupplier>(); Assert.IsNotNull(result); Assert.AreEqual(typeof(TypedElementToSourceNodeAdapter), result.GetType()); Assert.AreEqual("Patient", adapter.GetResourceTypeIndicator()); Assert.AreSame(adapter, result); } } }
45.303797
169
0.664711
[ "BSD-3-Clause" ]
FirelyTeam/fhir-net-api
src/Hl7.Fhir.ElementModel.Tests/TypedElementToSourceNodeAdapterTests.cs
3,581
C#
using NebzzClient; using NebzzClient.Handlers; using NebzzClient.Messages; using System; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Windows; using System.Windows.Interop; namespace NebzzClientFront { public partial class MainWindow : Window { internal ObservableCollection<Message> Messages { get; private set; } = new ObservableCollection<Message>(); internal ObservableCollection<User> Users { get; private set; } = new ObservableCollection<User>(); public MainWindow() { Connection.Instance.AddHandler<WarnHandler>(); Connection.Instance.AddHandler<ErrorHandler>(); Connection.Instance.AddHandler<MotdHandler>(); Connection.Instance.AddHandler<RegisterHandler>(); Connection.Instance.AddHandler<LoginHandler>(); Connection.Instance.AddHandler<InfoHandler>(); Connection.Instance.AddHandler<BroadcastLoginHandler>(); Connection.Instance.AddHandler(new BroadcastMessageHandler(new WindowInteropHelper(this).Handle)); InitializeComponent(); var login = new LoginControl(); login.LoggedEvent += Login_LoggedEvent; ContentArea.Content = login; } private void Login_LoggedEvent(object sender, EventArgs e) { ContentArea.Content = new MainControl(); } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (ContentArea.Content is MainControl mc) { try { mc.StopTimer(); Console.WriteLine("Disconnecting"); Task.Run(async () => await Connection.Instance.DisconnectAsync()).Wait(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } } }
34.912281
116
0.61005
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
michalusio/NebzzChatClient
NebzzClientFront/MainWindow.xaml.cs
1,992
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; using TCPingInfoView.Collection; using TCPingInfoView.Forms; namespace TCPingInfoView.Model { public class MainTable : INotifyPropertyChanged { private int Timeout => MainForm.Timeout; private int index; private string hostsName; private string endpoint; private string description; private int totalPing = 0; private int count = 0; private int succeedCount = 0; private int failedCount = 0; private int? lastPing; private int? maxPing; private int? minPing; private readonly ConcurrentList<DateTable> _info; public int Index { get => index; set { if (index != value) { index = value; NotifyPropertyChanged(); } } } public string HostsName { get => hostsName; set { if (hostsName != value) { hostsName = value; NotifyPropertyChanged(); } } } public string Endpoint { get => endpoint; set { if (endpoint != value) { endpoint = value; NotifyPropertyChanged(); } } } public string FailedP { get { if (Count == 0) { return @"0%"; } var fp = (double)FailedCount / Count; return fp > 0.0 ? fp.ToString(@"P") : @"0%"; } } public string Description { get => description; set { if (description != value) { description = value; NotifyPropertyChanged(); } } } public IEnumerable<DateTable> Info => _info; public int? Average { get { if (SucceedCount != 0) { return Convert.ToInt32(TotalPing / SucceedCount); } else { return null; } } } public string SucceedP { get { if (Count == 0) { return @"0%"; } var sp = (double)SucceedCount / Count; return sp > 0.0 ? sp.ToString(@"P") : @"0%"; } } private int TotalPing { get => totalPing; set { if (totalPing != value) { totalPing = value; NotifyPropertyChanged(); } } } private int Count { get => count; set { if (count != value) { count = value; NotifyPropertyChanged(); } } } public int SucceedCount { get => succeedCount; set { if (succeedCount != value) { succeedCount = value; NotifyPropertyChanged(); } } } public int FailedCount { get => failedCount; set { if (failedCount != value) { failedCount = value; NotifyPropertyChanged(); } } } public int? LastPing { get => lastPing; set { if (value != lastPing) { lastPing = value; NotifyPropertyChanged(); } } } public int? MaxPing { get => maxPing; set { if (maxPing != value) { maxPing = value; NotifyPropertyChanged(); } } } public int? MinPing { get => minPing; set { if (minPing != value) { minPing = value; NotifyPropertyChanged(); } } } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] string propertyName = @"") { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public MainTable() { index = 0; hostsName = string.Empty; endpoint = string.Empty; description = string.Empty; _info = new ConcurrentList<DateTable>(); } public void AddNewLog(DateTable info) { _info.Add(info); ++Count; if (info.Latency < Timeout) { ++SucceedCount; TotalPing += info.Latency; LastPing = info.Latency; if (MaxPing < LastPing || MaxPing == null) { MaxPing = LastPing; } if (MinPing > LastPing || MinPing == null) { MinPing = LastPing; } } else { LastPing = Timeout; ++FailedCount; } } public void Reset() { _info.Clear(); TotalPing = 0; Count = 0; SucceedCount = 0; FailedCount = 0; LastPing = null; MaxPing = null; MinPing = null; } } }
15.242537
82
0.575031
[ "MIT" ]
HMBSbige/TCPingInfoView
TCPingInfoView/Model/MainTable.cs
4,087
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FourDigits { class DigitPlay { static void Main(string[] args) { int number = Int32.Parse(Console.ReadLine()); byte lengthDigit = 4; sum(number, lengthDigit); reverse_num(number, lengthDigit); lastDigitFirst(number, lengthDigit); exch_second_third_bit(number, lengthDigit); } static void exch_second_third_bit(int num, int len) { string mynumber = num.ToString(); string first_letter, second_letter, third_letter, fourth_letter; first_letter = mynumber.Substring(0, 1); second_letter = mynumber.Substring(1,1); third_letter = mynumber.Substring(2,1); fourth_letter = mynumber.Substring(3,1); Console.WriteLine(first_letter+third_letter+second_letter+fourth_letter); } static void sum(int number, int lengthDigit) { int result = new int(); for (int i = 0; i < lengthDigit; i++) { result += (number % 10); number = number / 10; } Console.WriteLine(result); } static void lastDigitFirst(int number, int lengthDigit) { char last_ch = number.ToString()[lengthDigit-1]; string result = number.ToString().Substring(0, lengthDigit - 1); Console.WriteLine(last_ch + result); } static void reverse_num(int number, int lengthDigit) { string result = number.ToString(); Console.WriteLine(result.Reverse().ToArray()); } } }
29.295082
85
0.573027
[ "MIT" ]
singularity0/CSharpBasics
OperatorsExpressions/06.DigitPlay.cs
1,789
C#
#nullable enable using Elffy.Effective; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace Elffy.Features.Internal { internal readonly struct LazyApplyingList<T> { private readonly List<T> _list; private readonly List<T> _addedList; private readonly List<T> _removedList; public int Count => _list.Count; private LazyApplyingList(List<T> list, List<T> addedList, List<T> removedList) { _list = list; _addedList = addedList; _removedList = removedList; } public static LazyApplyingList<T> New() { return new LazyApplyingList<T>(new List<T>(), new List<T>(), new List<T>()); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Add(in T item) { _addedList.Add(item); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Remove(in T item) { _removedList.Add(item); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Clear() { _list.Clear(); _addedList.Clear(); _removedList.Clear(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ApplyAdd() { if(_addedList.Count == 0) { return; } Apply(this); // uncommon path [MethodImpl(MethodImplOptions.NoInlining)] static void Apply(in LazyApplyingList<T> self) { self._list.AddRange(self._addedList); self._addedList.Clear(); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ApplyAdd(Action<T> onAdded) { if(_addedList.Count == 0) { return; } Apply(this, onAdded); // uncommon path [MethodImpl(MethodImplOptions.NoInlining)] static void Apply(in LazyApplyingList<T> self, Action<T> onAdded) { var addedList = self._addedList; var list = self._list; foreach(var item in addedList.AsSpan()) { list.Add(item); onAdded(item); } addedList.Clear(); } } public void ApplyRemove(Action<T> onRemoved) { if(_removedList.Count == 0) { return; } Apply(this, onRemoved); // uncommon path [MethodImpl(MethodImplOptions.NoInlining)] static void Apply(in LazyApplyingList<T> self, Action<T> onRemoved) { foreach(var item in self._removedList.AsSpan()) { if(self._list.Remove(item)) { onRemoved.Invoke(item); } } self._removedList.Clear(); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ApplyRemove() { if(_removedList.Count == 0) { return; } Apply(this); // uncommon path static void Apply(in LazyApplyingList<T> self) { foreach(var item in self._removedList.AsSpan()) { self._list.Remove(item); } self._removedList.Clear(); } } public Span<T> AsSpan() => _list.AsSpan(); public ReadOnlySpan<T> AsReadOnlySpan() => _list.AsSpan(); } }
29.284553
88
0.526652
[ "MIT" ]
ikorin24/Elffy
src/Elffy.Engine/Features/Internal/LazyApplyingList.cs
3,604
C#
using System.Configuration; namespace Contoso.GenericBus.Config { /// <summary> /// BusConfigurationSection /// </summary> public class BusConfigurationSection : ConfigurationSection { /// <summary> /// Initializes a new instance of the <see cref="BusConfigurationSection"/> class. /// </summary> public BusConfigurationSection() { SetupDefaults(); } /// <summary> /// Gets or sets the assemblies. /// </summary> /// <value> /// The assemblies. /// </value> [ConfigurationProperty("assemblies")] public AssemblyElementCollection Assemblies { get { return this["assemblies"] as AssemblyElementCollection; } set { this["assemblies"] = value; } } private void SetupDefaults() { Properties.Add(new ConfigurationProperty("assemblies", typeof(AssemblyElementCollection), null)); } } }
28.162162
110
0.552783
[ "MIT" ]
BclEx/BclEx-Abstract
src/ServiceBuses/Contoso.GenericBus/Config/BusConfigurationSection.cs
1,042
C#
namespace Azure.Monitor.Query { public partial class LogsBatchQuery { public LogsBatchQuery() { } public virtual string AddWorkspaceQuery(string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = null) { throw null; } } public partial class LogsQueryClient { protected LogsQueryClient() { } public LogsQueryClient(Azure.Core.TokenCredential credential) { } public LogsQueryClient(Azure.Core.TokenCredential credential, Azure.Monitor.Query.LogsQueryClientOptions options) { } public LogsQueryClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public LogsQueryClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Monitor.Query.LogsQueryClientOptions options) { } public System.Uri Endpoint { get { throw null; } } public static string CreateQuery(System.FormattableString query) { throw null; } public virtual Azure.Response<Azure.Monitor.Query.Models.LogsBatchQueryResultCollection> QueryBatch(Azure.Monitor.Query.LogsBatchQuery batch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Query.Models.LogsBatchQueryResultCollection>> QueryBatchAsync(Azure.Monitor.Query.LogsBatchQuery batch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response<Azure.Monitor.Query.Models.LogsQueryResult> QueryWorkspace(string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Query.Models.LogsQueryResult>> QueryWorkspaceAsync(string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<T>>> QueryWorkspaceAsync<T>(string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<T>> QueryWorkspace<T>(string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct LogsQueryClientAudience : System.IEquatable<Azure.Monitor.Query.LogsQueryClientAudience> { private readonly object _dummy; private readonly int _dummyPrimitive; public LogsQueryClientAudience(string value) { throw null; } public static Azure.Monitor.Query.LogsQueryClientAudience AzurePublicCloud { get { throw null; } } public bool Equals(Azure.Monitor.Query.LogsQueryClientAudience other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.LogsQueryClientAudience left, Azure.Monitor.Query.LogsQueryClientAudience right) { throw null; } public static implicit operator Azure.Monitor.Query.LogsQueryClientAudience (string value) { throw null; } public static bool operator !=(Azure.Monitor.Query.LogsQueryClientAudience left, Azure.Monitor.Query.LogsQueryClientAudience right) { throw null; } public override string ToString() { throw null; } } public partial class LogsQueryClientOptions : Azure.Core.ClientOptions { public LogsQueryClientOptions(Azure.Monitor.Query.LogsQueryClientOptions.ServiceVersion version = Azure.Monitor.Query.LogsQueryClientOptions.ServiceVersion.V1) { } public Azure.Monitor.Query.LogsQueryClientAudience? Audience { get { throw null; } set { } } public enum ServiceVersion { V1 = 1, } } public partial class LogsQueryOptions { public LogsQueryOptions() { } public System.Collections.Generic.IList<string> AdditionalWorkspaces { get { throw null; } } public bool AllowPartialErrors { get { throw null; } set { } } public bool IncludeStatistics { get { throw null; } set { } } public bool IncludeVisualization { get { throw null; } set { } } public System.TimeSpan? ServerTimeout { get { throw null; } set { } } } public partial class MetricsQueryClient { protected MetricsQueryClient() { } public MetricsQueryClient(Azure.Core.TokenCredential credential) { } public MetricsQueryClient(Azure.Core.TokenCredential credential, Azure.Monitor.Query.MetricsQueryClientOptions options) { } public MetricsQueryClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Monitor.Query.MetricsQueryClientOptions options = null) { } public System.Uri Endpoint { get { throw null; } } public virtual Azure.Pageable<Azure.Monitor.Query.Models.MetricDefinition> GetMetricDefinitions(string resourceId, string metricsNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable<Azure.Monitor.Query.Models.MetricDefinition> GetMetricDefinitionsAsync(string resourceId, string metricsNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable<Azure.Monitor.Query.Models.MetricNamespace> GetMetricNamespaces(string resourceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable<Azure.Monitor.Query.Models.MetricNamespace> GetMetricNamespacesAsync(string resourceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response<Azure.Monitor.Query.Models.MetricsQueryResult> QueryResource(string resourceId, System.Collections.Generic.IEnumerable<string> metrics, Azure.Monitor.Query.MetricsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Query.Models.MetricsQueryResult>> QueryResourceAsync(string resourceId, System.Collections.Generic.IEnumerable<string> metrics, Azure.Monitor.Query.MetricsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MetricsQueryClientAudience : System.IEquatable<Azure.Monitor.Query.MetricsQueryClientAudience> { private readonly object _dummy; private readonly int _dummyPrimitive; public MetricsQueryClientAudience(string value) { throw null; } public static Azure.Monitor.Query.MetricsQueryClientAudience AzureResourceManagerChina { get { throw null; } } public static Azure.Monitor.Query.MetricsQueryClientAudience AzureResourceManagerGermany { get { throw null; } } public static Azure.Monitor.Query.MetricsQueryClientAudience AzureResourceManagerGovernment { get { throw null; } } public static Azure.Monitor.Query.MetricsQueryClientAudience AzureResourceManagerPublicCloud { get { throw null; } } public bool Equals(Azure.Monitor.Query.MetricsQueryClientAudience other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.MetricsQueryClientAudience left, Azure.Monitor.Query.MetricsQueryClientAudience right) { throw null; } public static implicit operator Azure.Monitor.Query.MetricsQueryClientAudience (string value) { throw null; } public static bool operator !=(Azure.Monitor.Query.MetricsQueryClientAudience left, Azure.Monitor.Query.MetricsQueryClientAudience right) { throw null; } public override string ToString() { throw null; } } public partial class MetricsQueryClientOptions : Azure.Core.ClientOptions { public MetricsQueryClientOptions(Azure.Monitor.Query.MetricsQueryClientOptions.ServiceVersion version = Azure.Monitor.Query.MetricsQueryClientOptions.ServiceVersion.V2018_01_01) { } public Azure.Monitor.Query.MetricsQueryClientAudience? Audience { get { throw null; } set { } } public enum ServiceVersion { V2018_01_01 = 1, } } public partial class MetricsQueryOptions { public MetricsQueryOptions() { } public System.Collections.Generic.IList<Azure.Monitor.Query.Models.MetricAggregationType> Aggregations { get { throw null; } } public string Filter { get { throw null; } set { } } public System.TimeSpan? Granularity { get { throw null; } set { } } public string MetricNamespace { get { throw null; } set { } } public string OrderBy { get { throw null; } set { } } public int? Size { get { throw null; } set { } } public Azure.Monitor.Query.QueryTimeRange? TimeRange { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct QueryTimeRange : System.IEquatable<Azure.Monitor.Query.QueryTimeRange> { public QueryTimeRange(System.DateTimeOffset start, System.DateTimeOffset end) { throw null; } public QueryTimeRange(System.DateTimeOffset start, System.TimeSpan duration) { throw null; } public QueryTimeRange(System.TimeSpan duration) { throw null; } public QueryTimeRange(System.TimeSpan duration, System.DateTimeOffset end) { throw null; } public static Azure.Monitor.Query.QueryTimeRange All { get { throw null; } } public System.TimeSpan Duration { get { throw null; } } public System.DateTimeOffset? End { get { throw null; } } public System.DateTimeOffset? Start { get { throw null; } } public bool Equals(Azure.Monitor.Query.QueryTimeRange other) { throw null; } public override bool Equals(object obj) { throw null; } public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.QueryTimeRange left, Azure.Monitor.Query.QueryTimeRange right) { throw null; } public static implicit operator Azure.Monitor.Query.QueryTimeRange (System.TimeSpan timeSpan) { throw null; } public static bool operator !=(Azure.Monitor.Query.QueryTimeRange left, Azure.Monitor.Query.QueryTimeRange right) { throw null; } public override string ToString() { throw null; } } } namespace Azure.Monitor.Query.Models { public partial class LogsBatchQueryResult : Azure.Monitor.Query.Models.LogsQueryResult { internal LogsBatchQueryResult() { } public string Id { get { throw null; } } } public partial class LogsBatchQueryResultCollection : System.Collections.ObjectModel.ReadOnlyCollection<Azure.Monitor.Query.Models.LogsBatchQueryResult> { internal LogsBatchQueryResultCollection() : base (default(System.Collections.Generic.IList<Azure.Monitor.Query.Models.LogsBatchQueryResult>)) { } public Azure.Monitor.Query.Models.LogsBatchQueryResult GetResult(string queryId) { throw null; } public System.Collections.Generic.IReadOnlyList<T> GetResult<T>(string queryId) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct LogsColumnType : System.IEquatable<Azure.Monitor.Query.Models.LogsColumnType> { private readonly object _dummy; private readonly int _dummyPrimitive; public LogsColumnType(string value) { throw null; } public static Azure.Monitor.Query.Models.LogsColumnType Bool { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Datetime { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Decimal { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Dynamic { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Guid { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Int { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Long { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Real { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType String { get { throw null; } } public static Azure.Monitor.Query.Models.LogsColumnType Timespan { get { throw null; } } public bool Equals(Azure.Monitor.Query.Models.LogsColumnType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.Models.LogsColumnType left, Azure.Monitor.Query.Models.LogsColumnType right) { throw null; } public static implicit operator Azure.Monitor.Query.Models.LogsColumnType (string value) { throw null; } public static bool operator !=(Azure.Monitor.Query.Models.LogsColumnType left, Azure.Monitor.Query.Models.LogsColumnType right) { throw null; } public override string ToString() { throw null; } } public partial class LogsQueryResult { internal LogsQueryResult() { } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.LogsTable> AllTables { get { throw null; } } public Azure.ResponseError Error { get { throw null; } } public Azure.Monitor.Query.Models.LogsQueryResultStatus Status { get { throw null; } } public Azure.Monitor.Query.Models.LogsTable Table { get { throw null; } } public System.BinaryData GetStatistics() { throw null; } public System.BinaryData GetVisualization() { throw null; } } public enum LogsQueryResultStatus { Success = 0, PartialFailure = 1, Failure = 2, } public partial class LogsTable { internal LogsTable() { } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.LogsTableColumn> Columns { get { throw null; } } public string Name { get { throw null; } } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.LogsTableRow> Rows { get { throw null; } } public override string ToString() { throw null; } } public partial class LogsTableColumn { internal LogsTableColumn() { } public string Name { get { throw null; } } public Azure.Monitor.Query.Models.LogsColumnType Type { get { throw null; } } public override string ToString() { throw null; } } public partial class LogsTableRow : System.Collections.Generic.IEnumerable<object>, System.Collections.Generic.IReadOnlyCollection<object>, System.Collections.Generic.IReadOnlyList<object>, System.Collections.IEnumerable { internal LogsTableRow() { } public int Count { get { throw null; } } public object this[int index] { get { throw null; } } public object this[string name] { get { throw null; } } public bool? GetBoolean(int index) { throw null; } public bool? GetBoolean(string name) { throw null; } public System.DateTimeOffset? GetDateTimeOffset(int index) { throw null; } public System.DateTimeOffset? GetDateTimeOffset(string name) { throw null; } public decimal? GetDecimal(int index) { throw null; } public decimal? GetDecimal(string name) { throw null; } public double? GetDouble(int index) { throw null; } public double? GetDouble(string name) { throw null; } public System.BinaryData GetDynamic(int index) { throw null; } public System.BinaryData GetDynamic(string name) { throw null; } public System.Guid? GetGuid(int index) { throw null; } public System.Guid? GetGuid(string name) { throw null; } public int? GetInt32(int index) { throw null; } public int? GetInt32(string name) { throw null; } public long? GetInt64(int index) { throw null; } public long? GetInt64(string name) { throw null; } public string GetString(int index) { throw null; } public string GetString(string name) { throw null; } public System.TimeSpan? GetTimeSpan(int index) { throw null; } public System.TimeSpan? GetTimeSpan(string name) { throw null; } System.Collections.Generic.IEnumerator<object> System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } public override string ToString() { throw null; } } public enum MetricAggregationType { None = 0, Average = 1, Count = 2, Minimum = 3, Maximum = 4, Total = 5, } public partial class MetricAvailability { internal MetricAvailability() { } public System.TimeSpan? Granularity { get { throw null; } } public System.TimeSpan? Retention { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MetricClass : System.IEquatable<Azure.Monitor.Query.Models.MetricClass> { private readonly object _dummy; private readonly int _dummyPrimitive; public MetricClass(string value) { throw null; } public static Azure.Monitor.Query.Models.MetricClass Availability { get { throw null; } } public static Azure.Monitor.Query.Models.MetricClass Errors { get { throw null; } } public static Azure.Monitor.Query.Models.MetricClass Latency { get { throw null; } } public static Azure.Monitor.Query.Models.MetricClass Saturation { get { throw null; } } public static Azure.Monitor.Query.Models.MetricClass Transactions { get { throw null; } } public bool Equals(Azure.Monitor.Query.Models.MetricClass other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.Models.MetricClass left, Azure.Monitor.Query.Models.MetricClass right) { throw null; } public static implicit operator Azure.Monitor.Query.Models.MetricClass (string value) { throw null; } public static bool operator !=(Azure.Monitor.Query.Models.MetricClass left, Azure.Monitor.Query.Models.MetricClass right) { throw null; } public override string ToString() { throw null; } } public partial class MetricDefinition { internal MetricDefinition() { } public string Category { get { throw null; } } public System.Collections.Generic.IReadOnlyList<string> Dimensions { get { throw null; } } public string DisplayDescription { get { throw null; } } public string Id { get { throw null; } } public bool? IsDimensionRequired { get { throw null; } } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.MetricAvailability> MetricAvailabilities { get { throw null; } } public Azure.Monitor.Query.Models.MetricClass? MetricClass { get { throw null; } } public string Name { get { throw null; } } public string Namespace { get { throw null; } } public Azure.Monitor.Query.Models.MetricAggregationType? PrimaryAggregationType { get { throw null; } } public string ResourceId { get { throw null; } } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.MetricAggregationType> SupportedAggregationTypes { get { throw null; } } public Azure.Monitor.Query.Models.MetricUnit? Unit { get { throw null; } } } public partial class MetricNamespace { internal MetricNamespace() { } public Azure.Monitor.Query.Models.MetricNamespaceClassification? Classification { get { throw null; } } public string FullyQualifiedName { get { throw null; } } public string Id { get { throw null; } } public string Name { get { throw null; } } public string Type { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MetricNamespaceClassification : System.IEquatable<Azure.Monitor.Query.Models.MetricNamespaceClassification> { private readonly object _dummy; private readonly int _dummyPrimitive; public MetricNamespaceClassification(string value) { throw null; } public static Azure.Monitor.Query.Models.MetricNamespaceClassification Custom { get { throw null; } } public static Azure.Monitor.Query.Models.MetricNamespaceClassification Platform { get { throw null; } } public static Azure.Monitor.Query.Models.MetricNamespaceClassification QualityOfService { get { throw null; } } public bool Equals(Azure.Monitor.Query.Models.MetricNamespaceClassification other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.Models.MetricNamespaceClassification left, Azure.Monitor.Query.Models.MetricNamespaceClassification right) { throw null; } public static implicit operator Azure.Monitor.Query.Models.MetricNamespaceClassification (string value) { throw null; } public static bool operator !=(Azure.Monitor.Query.Models.MetricNamespaceClassification left, Azure.Monitor.Query.Models.MetricNamespaceClassification right) { throw null; } public override string ToString() { throw null; } } public partial class MetricResult { internal MetricResult() { } public string Description { get { throw null; } } public Azure.ResponseError Error { get { throw null; } } public string Id { get { throw null; } } public string Name { get { throw null; } } public string ResourceType { get { throw null; } } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.MetricTimeSeriesElement> TimeSeries { get { throw null; } } public Azure.Monitor.Query.Models.MetricUnit Unit { get { throw null; } } } public partial class MetricsQueryResult { internal MetricsQueryResult() { } public int? Cost { get { throw null; } } public System.TimeSpan? Granularity { get { throw null; } } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.MetricResult> Metrics { get { throw null; } } public string Namespace { get { throw null; } } public string ResourceRegion { get { throw null; } } public Azure.Monitor.Query.QueryTimeRange TimeSpan { get { throw null; } } } public partial class MetricTimeSeriesElement { internal MetricTimeSeriesElement() { } public System.Collections.Generic.IReadOnlyDictionary<string, string> Metadata { get { throw null; } } public System.Collections.Generic.IReadOnlyList<Azure.Monitor.Query.Models.MetricValue> Values { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MetricUnit : System.IEquatable<Azure.Monitor.Query.Models.MetricUnit> { private readonly object _dummy; private readonly int _dummyPrimitive; public MetricUnit(string value) { throw null; } public static Azure.Monitor.Query.Models.MetricUnit BitsPerSecond { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit Bytes { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit ByteSeconds { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit BytesPerSecond { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit Cores { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit Count { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit CountPerSecond { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit MilliCores { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit MilliSeconds { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit NanoCores { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit Percent { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit Seconds { get { throw null; } } public static Azure.Monitor.Query.Models.MetricUnit Unspecified { get { throw null; } } public bool Equals(Azure.Monitor.Query.Models.MetricUnit other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.Monitor.Query.Models.MetricUnit left, Azure.Monitor.Query.Models.MetricUnit right) { throw null; } public static implicit operator Azure.Monitor.Query.Models.MetricUnit (string value) { throw null; } public static bool operator !=(Azure.Monitor.Query.Models.MetricUnit left, Azure.Monitor.Query.Models.MetricUnit right) { throw null; } public override string ToString() { throw null; } } public partial class MetricValue { internal MetricValue() { } public double? Average { get { throw null; } } public double? Count { get { throw null; } } public double? Maximum { get { throw null; } } public double? Minimum { get { throw null; } } public System.DateTimeOffset TimeStamp { get { throw null; } } public double? Total { get { throw null; } } public override string ToString() { throw null; } } public static partial class MonitorQueryModelFactory { public static Azure.Monitor.Query.Models.LogsTableColumn LogsTableColumn(string name = null, Azure.Monitor.Query.Models.LogsColumnType type = default(Azure.Monitor.Query.Models.LogsColumnType)) { throw null; } public static Azure.Monitor.Query.Models.MetricAvailability MetricAvailability(System.TimeSpan? granularity = default(System.TimeSpan?), System.TimeSpan? retention = default(System.TimeSpan?)) { throw null; } public static Azure.Monitor.Query.Models.MetricValue MetricValue(System.DateTimeOffset timeStamp = default(System.DateTimeOffset), double? average = default(double?), double? minimum = default(double?), double? maximum = default(double?), double? total = default(double?), double? count = default(double?)) { throw null; } } }
75.865979
383
0.728122
[ "MIT" ]
Kevan-Y/azure-sdk-for-net
sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs
29,436
C#
using Seal.Helpers; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; namespace Seal.Model { /// <summary> /// Exception that should not be logged or audited /// </summary> public class ValidationException : Exception { public ValidationException(string message) : base(message) { } } /// <summary> /// Exception for Login process /// </summary> public class LoginException : Exception { public LoginException(string message) : base(message) { } } /// <summary> /// Exception for Session Lost /// </summary> public class SessionLostException : Exception { public SessionLostException(string message) : base(message) { } } /// <summary> /// Class dedicated to log events for audit purpose /// </summary> public class Audit { public const string AuditScriptTemplate = @"@using System.Data @using System.Data.Common @using System.Data.OleDb @using System.Data.Odbc @{ Audit audit = Model; var auditSource = Repository.Instance.Sources.FirstOrDefault(i => i.Name.StartsWith(""Audit"")); if (auditSource != null) { var helper = new TaskDatabaseHelper(); var command = helper.GetDbCommand(auditSource.Connection.GetOpenConnection()); //Create audit table if necessary checkTableCreation(command); command.CommandText = @""insert into sr_audit(event_date,event_type,event_path,event_detail,event_error,user_name,user_groups,user_session,execution_name,execution_context,execution_view,execution_duration,output_type,output_name,output_information,schedule_name)""; if (command is OleDbCommand || command is OdbcCommand) { command.CommandText += "" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""; } else { command.CommandText += "" values(@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12,@p13,@p14,@p15,@p16)""; } var date = DateTime.Now; date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second); int index=1; addParameter(command, index++, DbType.DateTime, date); //event_date, addParameter(command, index++, DbType.AnsiString, audit.Type.ToString()); //event_type, addParameter(command, index++, DbType.AnsiString, audit.Path); //event_path, addParameter(command, index++, DbType.AnsiString, audit.Detail); //event_detail, addParameter(command, index++, DbType.AnsiString, audit.Error); //event_error, addParameter(command, index++, DbType.AnsiString, audit.User != null ? audit.User.Name : null); //user_name, addParameter(command, index++, DbType.AnsiString, audit.User != null ? audit.User.SecurityGroupsDisplay : null); //user_groups, addParameter(command, index++, DbType.AnsiString, audit.User != null ? audit.User.SessionID : null); //user_session, addParameter(command, index++, DbType.AnsiString, audit.Report != null ? audit.Report.ExecutionName : null); //execution_name, addParameter(command, index++, DbType.AnsiString, audit.Report != null ? audit.Report.ExecutionContext.ToString() : null); //execution_context, addParameter(command, index++, DbType.AnsiString, audit.Report != null ? audit.Report.ExecutionView.Name : null); //execution_view, addParameter(command, index++, DbType.Int32, audit.Report != null ? Convert.ToInt32(audit.Report.ExecutionFullDuration.TotalSeconds) : (object) DBNull.Value); //execution_duration, addParameter(command, index++, DbType.AnsiString, audit.Report != null && audit.Report.OutputToExecute != null ? audit.Report.OutputToExecute.DeviceName : null); //output_type, addParameter(command, index++, DbType.AnsiString, audit.Report != null && audit.Report.OutputToExecute != null ? audit.Report.OutputToExecute.Name : null);//output_name, addParameter(command, index++, DbType.AnsiString, audit.Report != null && audit.Report.OutputToExecute != null ? audit.Report.OutputToExecute.Information : null);//output_information, addParameter(command, index++, DbType.AnsiString, audit.Schedule != null ? audit.Schedule.Name : null);//schedule_name command.ExecuteNonQuery(); } } @functions { void checkTableCreation(DbCommand command) { if (Audit.CheckTableCreation) { //Check table creation Audit.CheckTableCreation = false; try { command.CommandText = ""select 1 from sr_audit where 1=0""; command.ExecuteNonQuery(); } catch { //Create the table (to be adapted for your database type, e.g. ident identity(1,1), execution_error varchar(max) for SQLServer) command.CommandText = @""create table sr_audit ( event_date datetime,event_type varchar(255),event_path varchar(255),event_detail varchar(255),event_error varchar(255),user_name varchar(255),user_groups varchar(255),user_session varchar(255),execution_name varchar(255),execution_context varchar(255),execution_view varchar(255),execution_status varchar(255),execution_duration int null,execution_locale varchar(255),execution_error varchar(255),output_type varchar(255),output_name varchar(255),output_information varchar(255),schedule_name varchar(255) )""; command.ExecuteNonQuery(); } } } void addParameter(DbCommand command, int index, DbType type, Object value) { var parameter = command.CreateParameter(); parameter.ParameterName = ""@p"" + index.ToString(); parameter.DbType = type; if (value == null) value = (object) DBNull.Value; if (value is string && ((string)value).Length >= 255) parameter.Value = ((string)value).Substring(0, 254); else parameter.Value = value; command.Parameters.Add(parameter); } } "; public static bool CheckTableCreation = true; public AuditType Type; public string Path; public string Detail; public string Error; public SecurityUser User; public Report Report; public ReportSchedule Schedule; static string Key = Guid.NewGuid().ToString(); /// <summary> /// Audit a report execution /// </summary> public static void LogReportAudit(AuditType type, SecurityUser user, Report report, ReportSchedule schedule) { Audit.LogAudit(report.HasErrors ? AuditType.ReportExecutionError : AuditType.ReportExecution, report.SecurityContext, report.FilePath, null, report.ExecutionErrors, report, schedule); } /// <summary> /// Audit an eventn /// </summary> public static void LogEventAudit(AuditType type, string detail) { Audit.LogAudit(type, null, null, detail); } /// <summary> /// Executes the audit script for a given event /// </summary> public static void LogAudit(AuditType type, SecurityUser user, string path = null, string detail = null, string error = null, Report report = null, ReportSchedule schedule = null) { try { if (Repository.Instance.Configuration.AuditEnabled) { var script = Repository.Instance.Configuration.AuditScript; if (string.IsNullOrEmpty(script)) script = AuditScriptTemplate; var audit = new Audit() { Type = type, User = user, Path = path, Detail = detail, Error = error, Report = report, Schedule = schedule }; RazorHelper.CompileExecute(script, audit, Key); } } catch (Exception ex) { var message = string.Format("Error executing the Audit Script:\r\n{0}", ex.Message); Helper.WriteLogEntry("Seal Audit", EventLogEntryType.Error, ex.Message); } } } }
45.252747
529
0.642545
[ "Apache-2.0" ]
destevetewis/Seal-Report
Projects/SealLibrary/Model/Audit.cs
8,238
C#
using System; using System.Threading.Tasks; namespace Passingwind.Blog.Widgets { public interface IWidget { void ConfigureServices(WidgetConfigureServicesContext context); void Configure(WidgetConfigureContext context); //Task InstallAsync(WidgetInstallContext context); //Task UninstallAsync(WidgetUninstallContext context); string GetAdminConfigureUrl(); } }
22.176471
65
0.809019
[ "MIT" ]
jxnkwlp/Passingwind.Blog
Passingwind.Blog.Widgets/IWidget.cs
377
C#
using System; using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Tests.Logging; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using OpenQA.Selenium; using Xunit; namespace BTCPayServer.Tests { public static class Extensions { private static readonly JsonSerializerSettings jsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; public static string ToJson(this object o) { var res = JsonConvert.SerializeObject(o, Formatting.None, jsonSettings); return res; } public static void ScrollTo(this IWebDriver driver, By by) { var element = driver.FindElement(by); } /// <summary> /// Sometimes the chrome driver is fucked up and we need some magic to click on the element. /// </summary> /// <param name="element"></param> public static void ForceClick(this IWebElement element) { element.SendKeys(Keys.Return); } public static void AssertNoError(this IWebDriver driver) { try { Assert.NotEmpty(driver.FindElements(By.ClassName("navbar-brand"))); if (driver.PageSource.Contains("alert-danger")) { foreach (var dangerAlert in driver.FindElements(By.ClassName("alert-danger"))) Assert.False(dangerAlert.Displayed, "No alert should be displayed"); } } catch { StringBuilder builder = new StringBuilder(); builder.AppendLine(); foreach (var logKind in new[] { LogType.Browser, LogType.Client, LogType.Driver, LogType.Server }) { try { var logs = driver.Manage().Logs.GetLog(logKind); builder.AppendLine($"Selenium [{logKind}]:"); foreach (var entry in logs) { builder.AppendLine($"[{entry.Level}]: {entry.Message}"); } } catch { } builder.AppendLine($"---------"); } Logs.Tester.LogInformation(builder.ToString()); builder = new StringBuilder(); builder.AppendLine($"Selenium [Sources]:"); builder.AppendLine(driver.PageSource); builder.AppendLine($"---------"); Logs.Tester.LogInformation(builder.ToString()); throw; } } public static T AssertViewModel<T>(this IActionResult result) { Assert.NotNull(result); var vr = Assert.IsType<ViewResult>(result); return Assert.IsType<T>(vr.Model); } public static async Task<T> AssertViewModelAsync<T>(this Task<IActionResult> task) { var result = await task; Assert.NotNull(result); var vr = Assert.IsType<ViewResult>(result); return Assert.IsType<T>(vr.Model); } public static void AssertElementNotFound(this IWebDriver driver, By by) { DateTimeOffset now = DateTimeOffset.Now; var wait = SeleniumTester.ImplicitWait; while (DateTimeOffset.UtcNow - now < wait) { try { var webElement = driver.FindElement(by); if (!webElement.Displayed) return; } catch (NoSuchWindowException) { return; } catch (NoSuchElementException) { return; } Thread.Sleep(50); } Assert.False(true, "Elements was found"); } } }
36.176991
165
0.517613
[ "MIT" ]
Cr4zylive/btcpayserver
BTCPayServer.Tests/Extensions.cs
4,088
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TriggerDescriptiveClose : MonoBehaviour { private TriggerDescriptiveMessage messageTrigger; private void Start() { messageTrigger = GetComponentInChildren<TriggerDescriptiveMessage>(); } private void OnTriggerExit(Collider other) { if (Player.IsPlayerTrigger(other) && !messageTrigger.isActiveAndEnabled) { // messageTrigger is disabled -> enable it, and clear the overlay messageTrigger.gameObject.SetActive(true); HUD.MessageOverlayDescriptive.Clear(); } } }
30.333333
82
0.712716
[ "Apache-2.0", "MIT" ]
austin-j-taylor/Invested
Assets/Scripts/Environment/Triggers/TriggerDescriptiveClose.cs
639
C#
/* * Copyright (c) Dominick Baier. All rights reserved. * see license.txt */ using System; using System.IdentityModel.Services; using System.IdentityModel.Tokens; using System.Linq; using System.Security.Claims; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Web; using Thinktecture.IdentityModel.Tokens.Http; namespace Thinktecture.IdentityModel.Web { public class ClaimsAuthenticationHttpModule : IHttpModule { public void Dispose() { } public void Init(HttpApplication context) { context.PostAuthenticateRequest += Context_PostAuthenticateRequest; } void Context_PostAuthenticateRequest(object sender, EventArgs e) { var context = ((HttpApplication)sender).Context; // no need to call transformation if session already exists if (FederatedAuthentication.SessionAuthenticationModule != null && FederatedAuthentication.SessionAuthenticationModule.ContainsSessionTokenCookie(context.Request.Cookies)) { return; } var transformer = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.ClaimsAuthenticationManager; if (transformer != null) { var principal = context.User as ClaimsPrincipal; if (context.Request.ClientCertificate.IsPresent && context.Request.ClientCertificate.IsValid) { var cert = new X509Certificate2(context.Request.ClientCertificate.Certificate); var token = new X509SecurityToken(cert); var certId = new HttpsSecurityTokenHandler().ValidateToken(token).First(); principal.AddIdentity(certId); } var transformedPrincipal = transformer.Authenticate(context.Request.RawUrl, principal); context.User = transformedPrincipal; Thread.CurrentPrincipal = transformedPrincipal; } } } }
34.816667
128
0.656295
[ "BSD-3-Clause" ]
YouthLab/Thinktecture.IdentityModel.45
IdentityModel/Thinktecture.IdentityModel/Web/ClaimsAuthenticationHttpModule.cs
2,091
C#
using System; using System.Collections.Generic; using System.Text; namespace SubSonic { public class Sql2005Query:SqlQuery { } }
14.3
40
0.72028
[ "BSD-3-Clause" ]
BlackMael/SubSonic-2.0
SubSonic/SqlQuery/Sql2005Query.cs
143
C#
using Khooversoft.Toolbox; namespace Khooversoft.Net { public class EventDataHeader : IHttpHeaderProperty { public EventDataHeader(string value) { Verify.IsNotEmpty(nameof(value), value); Value = value; } public EventDataHeader(string[] values) { Verify.IsNotNull(nameof(values), values); Verify.Assert(values.Length > 0, nameof(values)); Value = values[0]; } public static string HeaderKey { get; } = "API-EventData"; public string Key { get; } = EventDataHeader.HeaderKey; public string Value { get; } public string FormatValueForHttp() { return Value; } } }
22.058824
66
0.566667
[ "MIT" ]
khoover768/Khooversoft
Src/Common/Khooversoft.Toolbox/Khooversoft.Net/Headers/Properties/EventDataHeader.cs
752
C#
// This file was generated from LLVM 3.6.1 llvm-c API using ClangSharp // it was further modified in the following ways: // - removed most uses of the partial keyword except for LLVMNative static class and LLVMBool // - added warning disable to avoid benign compiler warnings about fields only set by native code // - modified all elements to be internal instead of public // - modified PInvoke attributes to use fully qualified name for CallingConvention to avoid conflicts // - Added Missing LLVMLinkerMode enumeration // - Fixed signature of LLVMLinkModules to use new enum // - modified all LLVMNative.* functions returning a string to return IntPtr // as using string with default CLR marshaling was causing run-time // Heap Corruption. [Reason unknown] Calling these functions requires calling // Marshal.PtrToAnsi( x ) manually, which is handled by the OO wrappers. // - made Value field of LLVMBool private to help prevent confusion on use the Value. For status // code values code should use the Success/Failure properties (added to partial implementation) // and implicit casts to/from bool for actual boolean. Unfortunately nothing in LLVM or the // value of a LLVMBool can help in identifying which form one should use. The only way to know // at this point is to read the LLVM-C API documentation. In the Future it may be good to Create // an LLVMStatusResult type for those function returning a status and use standard marshaling // techniques for actual boolean values... // - manually updated to 3.8.0 APIs using System; using System.Runtime.InteropServices; //warning CS0649: Field 'xxx' is never assigned to, and will always have its default value 0 #pragma warning disable 649 namespace Llvm.NET.Native { internal struct LLVMOpaqueMemoryBuffer { } internal struct LLVMOpaqueContext { } internal struct LLVMOpaqueModule { } internal struct LLVMOpaqueType { } internal struct LLVMOpaqueValue { } internal struct LLVMOpaqueBasicBlock { } internal struct LLVMOpaqueBuilder { } internal struct LLVMOpaqueModuleProvider { } internal struct LLVMOpaquePassManager { } internal struct LLVMOpaquePassRegistry { } internal struct LLVMOpaqueUse { } internal struct LLVMOpaqueDiagnosticInfo { } internal struct LLVMOpInfoSymbol1 { public int @Present; [MarshalAs(UnmanagedType.LPStr)] public string @Name; public int @Value; } internal struct LLVMOpInfo1 { public LLVMOpInfoSymbol1 @AddSymbol; public LLVMOpInfoSymbol1 @SubtractSymbol; public int @Value; public int @VariantKind; } internal struct LLVMOpaqueTargetData { } internal struct LLVMOpaqueTargetLibraryInfotData { } internal struct LLVMOpaqueTargetMachine { } internal struct LLVMTarget { } internal struct LLVMOpaqueGenericValue { } internal struct LLVMOpaqueExecutionEngine { } internal struct LLVMOpaqueMCJITMemoryManager { } internal struct LLVMMCJITCompilerOptions { public uint @OptLevel; public LLVMCodeModel @CodeModel; public int @NoFramePointerElim; public int @EnableFastISel; public IntPtr @MCJMM; } internal struct LLVMOpaqueLTOModule { } internal struct LLVMOpaqueLTOCodeGenerator { } internal struct LLVMOpaqueObjectFile { } internal struct LLVMOpaqueSectionIterator { } internal struct LLVMOpaqueSymbolIterator { } internal struct LLVMOpaqueRelocationIterator { } internal struct LLVMOpaquePassManagerBuilder { } internal partial struct LLVMBool { public LLVMBool(int value) { this.Value = value; } internal int Value; } internal struct LLVMMemoryBufferRef { public LLVMMemoryBufferRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMContextRef { public LLVMContextRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMModuleRef { public LLVMModuleRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMTypeRef { public LLVMTypeRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMValueRef { public LLVMValueRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer { get; } public readonly static LLVMValueRef Zero = new LLVMValueRef( IntPtr.Zero ); } internal struct LLVMBasicBlockRef { public LLVMBasicBlockRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMBuilderRef { public LLVMBuilderRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMModuleProviderRef { public LLVMModuleProviderRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMPassManagerRef { public LLVMPassManagerRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMPassRegistryRef { public LLVMPassRegistryRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMUseRef { public LLVMUseRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMDiagnosticInfoRef { public LLVMDiagnosticInfoRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate void LLVMFatalErrorHandler([MarshalAs(UnmanagedType.LPStr)] string @Reason); [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate void LLVMDiagnosticHandler(out LLVMOpaqueDiagnosticInfo @param0, IntPtr @param1); [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate void LLVMYieldCallback(out LLVMOpaqueContext @param0, IntPtr @param1); internal struct LLVMDisasmContextRef { public LLVMDisasmContextRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate int LLVMOpInfoCallback(IntPtr @DisInfo, int @PC, int @Offset, int @Size, int @TagType, IntPtr @TagBuf); [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate string LLVMSymbolLookupCallback(IntPtr @DisInfo, int @ReferenceValue, out int @ReferenceType, int @ReferencePC, out IntPtr @ReferenceName); internal struct LLVMTargetDataRef { public LLVMTargetDataRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMTargetLibraryInfoRef { public LLVMTargetLibraryInfoRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMTargetMachineRef { public LLVMTargetMachineRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMTargetRef { public LLVMTargetRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMGenericValueRef { public LLVMGenericValueRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMExecutionEngineRef { public LLVMExecutionEngineRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMMCJITMemoryManagerRef { public LLVMMCJITMemoryManagerRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate IntPtr LLVMMemoryManagerAllocateCodeSectionCallback(IntPtr @Opaque, int @Size, uint @Alignment, uint @SectionID, [MarshalAs(UnmanagedType.LPStr)] string @SectionName); [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate IntPtr LLVMMemoryManagerAllocateDataSectionCallback(IntPtr @Opaque, int @Size, uint @Alignment, uint @SectionID, [MarshalAs(UnmanagedType.LPStr)] string @SectionName, int @IsReadOnly); [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate int LLVMMemoryManagerFinalizeMemoryCallback(IntPtr @Opaque, out IntPtr @ErrMsg); [UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal delegate void LLVMMemoryManagerDestroyCallback(IntPtr @Opaque); //internal struct llvm_lto_t //{ // public llvm_lto_t(IntPtr pointer) // { // this.Pointer = pointer; // } // public IntPtr Pointer; //} //internal struct lto_bool_t //{ // public lto_bool_t(bool value) // { // this.Value = value; // } // public bool Value; //} //internal struct lto_module_t //{ // public lto_module_t(IntPtr pointer) // { // this.Pointer = pointer; // } // public IntPtr Pointer; //} //internal struct lto_code_gen_t //{ // public lto_code_gen_t(IntPtr pointer) // { // this.Pointer = pointer; // } // public IntPtr Pointer; //} //[UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal delegate void lto_diagnostic_handler_t(lto_codegen_diagnostic_severity_t @severity, [MarshalAs(UnmanagedType.LPStr)] string @diag, IntPtr @ctxt); internal struct LLVMObjectFileRef { public LLVMObjectFileRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMSectionIteratorRef { public LLVMSectionIteratorRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMSymbolIteratorRef { public LLVMSymbolIteratorRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMRelocationIteratorRef { public LLVMRelocationIteratorRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal struct LLVMPassManagerBuilderRef { public LLVMPassManagerBuilderRef(IntPtr pointer) { this.Pointer = pointer; } public IntPtr Pointer; } internal enum LLVMAttribute : int { @LLVMZExtAttribute = 1, @LLVMSExtAttribute = 2, @LLVMNoReturnAttribute = 4, @LLVMInRegAttribute = 8, @LLVMStructRetAttribute = 16, @LLVMNoUnwindAttribute = 32, @LLVMNoAliasAttribute = 64, @LLVMByValAttribute = 128, @LLVMNestAttribute = 256, @LLVMReadNoneAttribute = 512, @LLVMReadOnlyAttribute = 1024, @LLVMNoInlineAttribute = 2048, @LLVMAlwaysInlineAttribute = 4096, @LLVMOptimizeForSizeAttribute = 8192, @LLVMStackProtectAttribute = 16384, @LLVMStackProtectReqAttribute = 32768, @LLVMAlignment = 2031616, @LLVMNoCaptureAttribute = 2097152, @LLVMNoRedZoneAttribute = 4194304, @LLVMNoImplicitFloatAttribute = 8388608, @LLVMNakedAttribute = 16777216, @LLVMInlineHintAttribute = 33554432, @LLVMStackAlignment = 469762048, @LLVMReturnsTwice = 536870912, @LLVMUWTable = 1073741824, @LLVMNonLazyBind = -2147483648, } internal enum LLVMOpcode : uint { @LLVMRet = 1, @LLVMBr = 2, @LLVMSwitch = 3, @LLVMIndirectBr = 4, @LLVMInvoke = 5, @LLVMUnreachable = 7, @LLVMAdd = 8, @LLVMFAdd = 9, @LLVMSub = 10, @LLVMFSub = 11, @LLVMMul = 12, @LLVMFMul = 13, @LLVMUDiv = 14, @LLVMSDiv = 15, @LLVMFDiv = 16, @LLVMURem = 17, @LLVMSRem = 18, @LLVMFRem = 19, @LLVMShl = 20, @LLVMLShr = 21, @LLVMAShr = 22, @LLVMAnd = 23, @LLVMOr = 24, @LLVMXor = 25, @LLVMAlloca = 26, @LLVMLoad = 27, @LLVMStore = 28, @LLVMGetElementPtr = 29, @LLVMTrunc = 30, @LLVMZExt = 31, @LLVMSExt = 32, @LLVMFPToUI = 33, @LLVMFPToSI = 34, @LLVMUIToFP = 35, @LLVMSIToFP = 36, @LLVMFPTrunc = 37, @LLVMFPExt = 38, @LLVMPtrToInt = 39, @LLVMIntToPtr = 40, @LLVMBitCast = 41, @LLVMAddrSpaceCast = 60, @LLVMICmp = 42, @LLVMFCmp = 43, @LLVMPHI = 44, @LLVMCall = 45, @LLVMSelect = 46, @LLVMUserOp1 = 47, @LLVMUserOp2 = 48, @LLVMVAArg = 49, @LLVMExtractElement = 50, @LLVMInsertElement = 51, @LLVMShuffleVector = 52, @LLVMExtractValue = 53, @LLVMInsertValue = 54, @LLVMFence = 55, @LLVMAtomicCmpXchg = 56, @LLVMAtomicRMW = 57, @LLVMResume = 58, @LLVMLandingPad = 59, // Gap = 60 @LLVMCleanupRet = 61, @LLVMCatchRet = 62, @LLVMCatchPad = 63, @LLVMCleandupPad = 64, @LLVMCatchSwitch = 65 } internal enum LLVMTypeKind : uint { @LLVMVoidTypeKind = 0, @LLVMHalfTypeKind = 1, @LLVMFloatTypeKind = 2, @LLVMDoubleTypeKind = 3, @LLVMX86_FP80TypeKind = 4, @LLVMFP128TypeKind = 5, @LLVMPPC_FP128TypeKind = 6, @LLVMLabelTypeKind = 7, @LLVMIntegerTypeKind = 8, @LLVMFunctionTypeKind = 9, @LLVMStructTypeKind = 10, @LLVMArrayTypeKind = 11, @LLVMPointerTypeKind = 12, @LLVMVectorTypeKind = 13, @LLVMMetadataTypeKind = 14, @LLVMX86_MMXTypeKind = 15, @LLVMTokenTypeKind = 16, } internal enum LLVMLinkage : uint { @LLVMExternalLinkage = 0, @LLVMAvailableExternallyLinkage = 1, @LLVMLinkOnceAnyLinkage = 2, @LLVMLinkOnceODRLinkage = 3, @LLVMLinkOnceODRAutoHideLinkage = 4, @LLVMWeakAnyLinkage = 5, @LLVMWeakODRLinkage = 6, @LLVMAppendingLinkage = 7, @LLVMInternalLinkage = 8, @LLVMPrivateLinkage = 9, @LLVMDLLImportLinkage = 10, @LLVMDLLExportLinkage = 11, @LLVMExternalWeakLinkage = 12, @LLVMGhostLinkage = 13, @LLVMCommonLinkage = 14, @LLVMLinkerPrivateLinkage = 15, @LLVMLinkerPrivateWeakLinkage = 16, } internal enum LLVMVisibility : uint { @LLVMDefaultVisibility = 0, @LLVMHiddenVisibility = 1, @LLVMProtectedVisibility = 2, } internal enum LLVMDLLStorageClass : uint { @LLVMDefaultStorageClass = 0, @LLVMDLLImportStorageClass = 1, @LLVMDLLExportStorageClass = 2, } internal enum LLVMCallConv : uint { @LLVMCCallConv = 0, @LLVMFastCallConv = 8, @LLVMColdCallConv = 9, @LLVMWebKitJSCallConv = 12, @LLVMAnyRegCallConv = 13, @LLVMX86StdcallCallConv = 64, @LLVMX86FastcallCallConv = 65, } internal enum LLVMIntPredicate : uint { @LLVMIntEQ = 32, @LLVMIntNE = 33, @LLVMIntUGT = 34, @LLVMIntUGE = 35, @LLVMIntULT = 36, @LLVMIntULE = 37, @LLVMIntSGT = 38, @LLVMIntSGE = 39, @LLVMIntSLT = 40, @LLVMIntSLE = 41, } internal enum LLVMRealPredicate : uint { @LLVMRealPredicateFalse = 0, @LLVMRealOEQ = 1, @LLVMRealOGT = 2, @LLVMRealOGE = 3, @LLVMRealOLT = 4, @LLVMRealOLE = 5, @LLVMRealONE = 6, @LLVMRealORD = 7, @LLVMRealUNO = 8, @LLVMRealUEQ = 9, @LLVMRealUGT = 10, @LLVMRealUGE = 11, @LLVMRealULT = 12, @LLVMRealULE = 13, @LLVMRealUNE = 14, @LLVMRealPredicateTrue = 15, } internal enum LLVMLandingPadClauseTy : uint { @LLVMLandingPadCatch = 0, @LLVMLandingPadFilter = 1, } internal enum LLVMThreadLocalMode : uint { @LLVMNotThreadLocal = 0, @LLVMGeneralDynamicTLSModel = 1, @LLVMLocalDynamicTLSModel = 2, @LLVMInitialExecTLSModel = 3, @LLVMLocalExecTLSModel = 4, } internal enum LLVMAtomicOrdering : uint { @LLVMAtomicOrderingNotAtomic = 0, @LLVMAtomicOrderingUnordered = 1, @LLVMAtomicOrderingMonotonic = 2, @LLVMAtomicOrderingAcquire = 4, @LLVMAtomicOrderingRelease = 5, @LLVMAtomicOrderingAcquireRelease = 6, @LLVMAtomicOrderingSequentiallyConsistent = 7, } internal enum LLVMAtomicRMWBinOp : uint { @LLVMAtomicRMWBinOpXchg = 0, @LLVMAtomicRMWBinOpAdd = 1, @LLVMAtomicRMWBinOpSub = 2, @LLVMAtomicRMWBinOpAnd = 3, @LLVMAtomicRMWBinOpNand = 4, @LLVMAtomicRMWBinOpOr = 5, @LLVMAtomicRMWBinOpXor = 6, @LLVMAtomicRMWBinOpMax = 7, @LLVMAtomicRMWBinOpMin = 8, @LLVMAtomicRMWBinOpUMax = 9, @LLVMAtomicRMWBinOpUMin = 10, } internal enum LLVMDiagnosticSeverity : uint { @LLVMDSError = 0, @LLVMDSWarning = 1, @LLVMDSRemark = 2, @LLVMDSNote = 3, } internal enum LLVMVerifierFailureAction : uint { @LLVMAbortProcessAction = 0, @LLVMPrintMessageAction = 1, @LLVMReturnStatusAction = 2, } internal enum LLVMByteOrdering : uint { @LLVMBigEndian = 0, @LLVMLittleEndian = 1, } internal enum LLVMCodeGenOptLevel : uint { @LLVMCodeGenLevelNone = 0, @LLVMCodeGenLevelLess = 1, @LLVMCodeGenLevelDefault = 2, @LLVMCodeGenLevelAggressive = 3, } internal enum LLVMRelocMode : uint { @LLVMRelocDefault = 0, @LLVMRelocStatic = 1, @LLVMRelocPIC = 2, @LLVMRelocDynamicNoPic = 3, } internal enum LLVMCodeModel : uint { @LLVMCodeModelDefault = 0, @LLVMCodeModelJITDefault = 1, @LLVMCodeModelSmall = 2, @LLVMCodeModelKernel = 3, @LLVMCodeModelMedium = 4, @LLVMCodeModelLarge = 5, } internal enum LLVMCodeGenFileType : uint { @LLVMAssemblyFile = 0, @LLVMObjectFile = 1, } internal enum llvm_lto_status : uint { @LLVM_LTO_UNKNOWN = 0, @LLVM_LTO_OPT_SUCCESS = 1, @LLVM_LTO_READ_SUCCESS = 2, @LLVM_LTO_READ_FAILURE = 3, @LLVM_LTO_WRITE_FAILURE = 4, @LLVM_LTO_NO_TARGET = 5, @LLVM_LTO_NO_WORK = 6, @LLVM_LTO_MODULE_MERGE_FAILURE = 7, @LLVM_LTO_ASM_FAILURE = 8, @LLVM_LTO_NULL_OBJECT = 9, } internal enum lto_symbol_attributes : uint { @LTO_SYMBOL_ALIGNMENT_MASK = 31, @LTO_SYMBOL_PERMISSIONS_MASK = 224, @LTO_SYMBOL_PERMISSIONS_CODE = 160, @LTO_SYMBOL_PERMISSIONS_DATA = 192, @LTO_SYMBOL_PERMISSIONS_RODATA = 128, @LTO_SYMBOL_DEFINITION_MASK = 1792, @LTO_SYMBOL_DEFINITION_REGULAR = 256, @LTO_SYMBOL_DEFINITION_TENTATIVE = 512, @LTO_SYMBOL_DEFINITION_WEAK = 768, @LTO_SYMBOL_DEFINITION_UNDEFINED = 1024, @LTO_SYMBOL_DEFINITION_WEAKUNDEF = 1280, @LTO_SYMBOL_SCOPE_MASK = 14336, @LTO_SYMBOL_SCOPE_INTERNAL = 2048, @LTO_SYMBOL_SCOPE_HIDDEN = 4096, @LTO_SYMBOL_SCOPE_PROTECTED = 8192, @LTO_SYMBOL_SCOPE_DEFAULT = 6144, @LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN = 10240, } internal enum lto_debug_model : uint { @LTO_DEBUG_MODEL_NONE = 0, @LTO_DEBUG_MODEL_DWARF = 1, } internal enum lto_codegen_model : uint { @LTO_CODEGEN_PIC_MODEL_STATIC = 0, @LTO_CODEGEN_PIC_MODEL_DYNAMIC = 1, @LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC = 2, @LTO_CODEGEN_PIC_MODEL_DEFAULT = 3, } internal enum lto_codegen_diagnostic_severity_t : uint { @LTO_DS_ERROR = 0, @LTO_DS_WARNING = 1, @LTO_DS_REMARK = 3, @LTO_DS_NOTE = 2, } internal enum LLVMLinkerMode : uint { @LLVMLinkerDestroySource = 0, /* Allow source module to be destroyed. */ @LLVMLinkerPreserveSource = 1 /* Preserve the source module. */ } internal static partial class NativeMethods { private const string libraryPath = "LibLlvm.dll"; [DllImport(libraryPath, EntryPoint = "LLVMLoadLibraryPermanently", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true )] internal static extern LLVMBool LoadLibraryPermanently([MarshalAs(UnmanagedType.LPStr)] string @Filename); [DllImport(libraryPath, EntryPoint = "LLVMParseCommandLineOptions", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ParseCommandLineOptions(int @argc, string[] @argv, [MarshalAs(UnmanagedType.LPStr)] string @Overview); [DllImport(libraryPath, EntryPoint = "LLVMInitializeCore", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeCore(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMShutdown", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void Shutdown(); [DllImport(libraryPath, EntryPoint = "LLVMCreateMessage", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr CreateMessage([MarshalAs(UnmanagedType.LPStr)] string @Message); [DllImport(libraryPath, EntryPoint = "LLVMDisposeMessage", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeMessage(IntPtr @Message); [DllImport(libraryPath, EntryPoint = "LLVMInstallFatalErrorHandler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InstallFatalErrorHandler(LLVMFatalErrorHandler @Handler); [DllImport(libraryPath, EntryPoint = "LLVMResetFatalErrorHandler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ResetFatalErrorHandler(); [DllImport(libraryPath, EntryPoint = "LLVMEnablePrettyStackTrace", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void EnablePrettyStackTrace(); [DllImport(libraryPath, EntryPoint = "LLVMContextCreate", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMContextRef ContextCreate(); [DllImport(libraryPath, EntryPoint = "LLVMGetGlobalContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMContextRef GetGlobalContext(); [DllImport(libraryPath, EntryPoint = "LLVMContextSetDiagnosticHandler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ContextSetDiagnosticHandler(LLVMContextRef @C, LLVMDiagnosticHandler @Handler, IntPtr @DiagnosticContext); [DllImport(libraryPath, EntryPoint = "LLVMContextSetYieldCallback", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ContextSetYieldCallback(LLVMContextRef @C, LLVMYieldCallback @Callback, IntPtr @OpaqueHandle); [DllImport(libraryPath, EntryPoint = "LLVMContextDispose", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ContextDispose(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMGetDiagInfoDescription", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetDiagInfoDescription(LLVMDiagnosticInfoRef @DI); [DllImport(libraryPath, EntryPoint = "LLVMGetDiagInfoSeverity", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMDiagnosticSeverity GetDiagInfoSeverity(LLVMDiagnosticInfoRef @DI); [DllImport(libraryPath, EntryPoint = "LLVMGetMDKindIDInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetMDKindIDInContext(LLVMContextRef @C, [MarshalAs(UnmanagedType.LPStr)] string @Name, uint @SLen); [DllImport(libraryPath, EntryPoint = "LLVMGetMDKindID", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetMDKindID([MarshalAs(UnmanagedType.LPStr)] string @Name, uint @SLen); [DllImport(libraryPath, EntryPoint = "LLVMModuleCreateWithName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMModuleRef ModuleCreateWithName([MarshalAs(UnmanagedType.LPStr)] string @ModuleID); [DllImport(libraryPath, EntryPoint = "LLVMModuleCreateWithNameInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMModuleRef ModuleCreateWithNameInContext([MarshalAs(UnmanagedType.LPStr)] string @ModuleID, LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMCloneModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMModuleRef CloneModule(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMDisposeModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeModule(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMGetDataLayout", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetDataLayout(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMSetDataLayout", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetDataLayout(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Triple); [DllImport(libraryPath, EntryPoint = "LLVMGetTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetTarget(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMSetTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetTarget(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Triple); [DllImport(libraryPath, EntryPoint = "LLVMDumpModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DumpModule(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMPrintModuleToFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool PrintModuleToFile(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Filename, out IntPtr @ErrorMessage); [DllImport(libraryPath, EntryPoint = "LLVMPrintModuleToString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr PrintModuleToString(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMSetModuleInlineAsm", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetModuleInlineAsm(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Asm); [DllImport(libraryPath, EntryPoint = "LLVMGetModuleContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMContextRef GetModuleContext(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMGetTypeByName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef GetTypeByName(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetNamedMetadataNumOperands", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetNamedMetadataNumOperands(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @name); [DllImport(libraryPath, EntryPoint = "LLVMGetNamedMetadataOperands", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void GetNamedMetadataOperands(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @name, out LLVMValueRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMAddNamedMetadataOperand", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddNamedMetadataOperand(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @name, LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMAddFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef AddFunction(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name, LLVMTypeRef @FunctionTy); [DllImport(libraryPath, EntryPoint = "LLVMGetNamedFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetNamedFunction(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetFirstFunction(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMGetLastFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetLastFunction(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMGetNextFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetNextFunction(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetPreviousFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetPreviousFunction(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetTypeKind", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeKind GetTypeKind(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMTypeIsSized", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool TypeIsSized(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMGetTypeContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMContextRef GetTypeContext(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMDumpType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DumpType(LLVMTypeRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMPrintTypeToString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr PrintTypeToString(LLVMTypeRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMInt1TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int1TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMInt8TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int8TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMInt16TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int16TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMInt32TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int32TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMInt64TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int64TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMIntTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef IntTypeInContext(LLVMContextRef @C, uint @NumBits); [DllImport(libraryPath, EntryPoint = "LLVMInt1Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int1Type(); [DllImport(libraryPath, EntryPoint = "LLVMInt8Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int8Type(); [DllImport(libraryPath, EntryPoint = "LLVMInt16Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int16Type(); [DllImport(libraryPath, EntryPoint = "LLVMInt32Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int32Type(); [DllImport(libraryPath, EntryPoint = "LLVMInt64Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef Int64Type(); [DllImport(libraryPath, EntryPoint = "LLVMIntType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef IntType(uint @NumBits); [DllImport(libraryPath, EntryPoint = "LLVMGetIntTypeWidth", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetIntTypeWidth(LLVMTypeRef @IntegerTy); [DllImport(libraryPath, EntryPoint = "LLVMHalfTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef HalfTypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMFloatTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef FloatTypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMDoubleTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef DoubleTypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMX86FP80TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef X86FP80TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMFP128TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef FP128TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMPPCFP128TypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef PPCFP128TypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMHalfType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef HalfType(); [DllImport(libraryPath, EntryPoint = "LLVMFloatType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef FloatType(); [DllImport(libraryPath, EntryPoint = "LLVMDoubleType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef DoubleType(); [DllImport(libraryPath, EntryPoint = "LLVMX86FP80Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef X86FP80Type(); [DllImport(libraryPath, EntryPoint = "LLVMFP128Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef FP128Type(); [DllImport(libraryPath, EntryPoint = "LLVMPPCFP128Type", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef PPCFP128Type(); [DllImport(libraryPath, EntryPoint = "LLVMFunctionType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef FunctionType(LLVMTypeRef @ReturnType, out LLVMTypeRef @ParamTypes, uint @ParamCount, LLVMBool @IsVarArg); [DllImport(libraryPath, EntryPoint = "LLVMIsFunctionVarArg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsFunctionVarArg(LLVMTypeRef @FunctionTy); [DllImport(libraryPath, EntryPoint = "LLVMGetReturnType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef GetReturnType(LLVMTypeRef @FunctionTy); [DllImport(libraryPath, EntryPoint = "LLVMCountParamTypes", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint CountParamTypes(LLVMTypeRef @FunctionTy); [DllImport(libraryPath, EntryPoint = "LLVMGetParamTypes", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void GetParamTypes(LLVMTypeRef @FunctionTy, out LLVMTypeRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMStructTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef StructTypeInContext(LLVMContextRef @C, out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMStructType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef StructType(out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMStructCreateNamed", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef StructCreateNamed(LLVMContextRef @C, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetStructName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetStructName(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMStructSetBody", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void StructSetBody(LLVMTypeRef @StructTy, out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMCountStructElementTypes", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint CountStructElementTypes(LLVMTypeRef @StructTy); [DllImport(libraryPath, EntryPoint = "LLVMGetStructElementTypes", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void GetStructElementTypes(LLVMTypeRef @StructTy, out LLVMTypeRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMIsPackedStruct", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsPackedStruct(LLVMTypeRef @StructTy); [DllImport(libraryPath, EntryPoint = "LLVMIsOpaqueStruct", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsOpaqueStruct(LLVMTypeRef @StructTy); [DllImport(libraryPath, EntryPoint = "LLVMGetElementType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef GetElementType(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMArrayType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef ArrayType(LLVMTypeRef @ElementType, uint @ElementCount); [DllImport(libraryPath, EntryPoint = "LLVMGetArrayLength", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetArrayLength(LLVMTypeRef @ArrayTy); [DllImport(libraryPath, EntryPoint = "LLVMPointerType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef PointerType(LLVMTypeRef @ElementType, uint @AddressSpace); [DllImport(libraryPath, EntryPoint = "LLVMGetPointerAddressSpace", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetPointerAddressSpace(LLVMTypeRef @PointerTy); [DllImport(libraryPath, EntryPoint = "LLVMVectorType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef VectorType(LLVMTypeRef @ElementType, uint @ElementCount); [DllImport(libraryPath, EntryPoint = "LLVMGetVectorSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetVectorSize(LLVMTypeRef @VectorTy); [DllImport(libraryPath, EntryPoint = "LLVMVoidTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef VoidTypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMLabelTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef LabelTypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMX86MMXTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef X86MMXTypeInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMVoidType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef VoidType(); [DllImport(libraryPath, EntryPoint = "LLVMLabelType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef LabelType(); [DllImport(libraryPath, EntryPoint = "LLVMX86MMXType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef X86MMXType(); [DllImport(libraryPath, EntryPoint = "LLVMTypeOf", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef TypeOf(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetValueName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetValueName(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMSetValueName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetValueName(LLVMValueRef @Val, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMDumpValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DumpValue(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMPrintValueToString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr PrintValueToString(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMReplaceAllUsesWith", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ReplaceAllUsesWith(LLVMValueRef @OldVal, LLVMValueRef @NewVal); [DllImport(libraryPath, EntryPoint = "LLVMIsConstant", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsConstant(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsUndef", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsUndef(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAArgument", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAArgument(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsABasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsABasicBlock(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAInlineAsm", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAInlineAsm(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAUser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAUser(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstant", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstant(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsABlockAddress", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsABlockAddress(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantAggregateZero", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantAggregateZero(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantArray", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantArray(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantDataSequential", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantDataSequential(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantDataArray", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantDataArray(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantDataVector", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantDataVector(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantExpr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantExpr(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantFP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantFP(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantInt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantInt(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantPointerNull", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantPointerNull(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantStruct", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantStruct(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAConstantVector", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAConstantVector(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAGlobalValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAGlobalValue(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAGlobalAlias", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAGlobalAlias(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAGlobalObject", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAGlobalObject(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAFunction(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAGlobalVariable", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAGlobalVariable(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAUndefValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAUndefValue(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAInstruction(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsABinaryOperator", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsABinaryOperator(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsACallInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsACallInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAIntrinsicInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAIntrinsicInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsADbgInfoIntrinsic", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsADbgInfoIntrinsic(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsADbgDeclareInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsADbgDeclareInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAMemIntrinsic", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAMemIntrinsic(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAMemCpyInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAMemCpyInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAMemMoveInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAMemMoveInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAMemSetInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAMemSetInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsACmpInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsACmpInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAFCmpInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAFCmpInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAICmpInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAICmpInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAExtractElementInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAExtractElementInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAGetElementPtrInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAGetElementPtrInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAInsertElementInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAInsertElementInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAInsertValueInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAInsertValueInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsALandingPadInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsALandingPadInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAPHINode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAPHINode(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsASelectInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsASelectInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAShuffleVectorInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAShuffleVectorInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAStoreInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAStoreInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsATerminatorInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsATerminatorInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsABranchInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsABranchInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAIndirectBrInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAIndirectBrInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAInvokeInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAInvokeInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAReturnInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAReturnInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsASwitchInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsASwitchInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAUnreachableInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAUnreachableInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAResumeInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAResumeInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAUnaryInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAUnaryInstruction(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAAllocaInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAAllocaInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsACastInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsACastInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAAddrSpaceCastInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAAddrSpaceCastInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsABitCastInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsABitCastInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAFPExtInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAFPExtInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAFPToSIInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAFPToSIInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAFPToUIInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAFPToUIInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAFPTruncInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAFPTruncInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAIntToPtrInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAIntToPtrInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAPtrToIntInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAPtrToIntInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsASExtInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsASExtInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsASIToFPInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsASIToFPInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsATruncInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsATruncInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAUIToFPInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAUIToFPInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAZExtInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAZExtInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAExtractValueInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAExtractValueInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsALoadInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsALoadInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAVAArgInst", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAVAArgInst(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAMDNode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAMDNode(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMIsAMDString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef IsAMDString(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstUse", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMUseRef GetFirstUse(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetNextUse", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMUseRef GetNextUse(LLVMUseRef @U); [DllImport(libraryPath, EntryPoint = "LLVMGetUser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetUser(LLVMUseRef @U); [DllImport(libraryPath, EntryPoint = "LLVMGetUsedValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetUsedValue(LLVMUseRef @U); [DllImport(libraryPath, EntryPoint = "LLVMGetOperand", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetOperand(LLVMValueRef @Val, uint @Index); [DllImport(libraryPath, EntryPoint = "LLVMGetOperandUse", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMUseRef GetOperandUse(LLVMValueRef @Val, uint @Index); [DllImport(libraryPath, EntryPoint = "LLVMSetOperand", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetOperand(LLVMValueRef @User, uint @Index, LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetNumOperands", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetNumOperands(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMConstNull", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNull(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMConstAllOnes", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstAllOnes(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMGetUndef", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetUndef(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMIsNull", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsNull(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMConstPointerNull", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstPointerNull(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMConstInt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstInt(LLVMTypeRef @IntTy, ulong @N, LLVMBool @SignExtend); [DllImport(libraryPath, EntryPoint = "LLVMConstIntOfArbitraryPrecision", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstIntOfArbitraryPrecision(LLVMTypeRef @IntTy, uint @NumWords, int[] @Words); [DllImport(libraryPath, EntryPoint = "LLVMConstIntOfString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstIntOfString(LLVMTypeRef @IntTy, [MarshalAs(UnmanagedType.LPStr)] string @Text, char @Radix); [DllImport(libraryPath, EntryPoint = "LLVMConstIntOfStringAndSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstIntOfStringAndSize(LLVMTypeRef @IntTy, [MarshalAs(UnmanagedType.LPStr)] string @Text, uint @SLen, char @Radix); [DllImport(libraryPath, EntryPoint = "LLVMConstReal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstReal(LLVMTypeRef @RealTy, double @N); [DllImport(libraryPath, EntryPoint = "LLVMConstRealOfString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstRealOfString(LLVMTypeRef @RealTy, [MarshalAs(UnmanagedType.LPStr)] string @Text); [DllImport(libraryPath, EntryPoint = "LLVMConstRealOfStringAndSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstRealOfStringAndSize(LLVMTypeRef @RealTy, [MarshalAs(UnmanagedType.LPStr)] string @Text, uint @SLen); [DllImport(libraryPath, EntryPoint = "LLVMConstIntGetZExtValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern ulong ConstIntGetZExtValue(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstIntGetSExtValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern long ConstIntGetSExtValue(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstRealGetDouble", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern double ConstRealGetDouble(LLVMValueRef @ConstantVal, out LLVMBool @losesInfo); [DllImport(libraryPath, EntryPoint = "LLVMConstStringInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstStringInContext(LLVMContextRef @C, [MarshalAs(UnmanagedType.LPStr)] string @Str, uint @Length, LLVMBool @DontNullTerminate); [DllImport(libraryPath, EntryPoint = "LLVMConstString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstString([MarshalAs(UnmanagedType.LPStr)] string @Str, uint @Length, LLVMBool @DontNullTerminate); [DllImport(libraryPath, EntryPoint = "LLVMIsConstantString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsConstantString(LLVMValueRef @c); [DllImport(libraryPath, EntryPoint = "LLVMGetAsString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetAsString(LLVMValueRef @c, out int @out); [DllImport(libraryPath, EntryPoint = "LLVMConstStructInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstStructInContext(LLVMContextRef @C, out LLVMValueRef @ConstantVals, uint @Count, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMConstStruct", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstStruct(out LLVMValueRef @ConstantVals, uint @Count, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMConstArray", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstArray(LLVMTypeRef @ElementTy, out LLVMValueRef @ConstantVals, uint @Length); [DllImport(libraryPath, EntryPoint = "LLVMConstNamedStruct", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNamedStruct(LLVMTypeRef @StructTy, out LLVMValueRef @ConstantVals, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMGetElementAsConstant", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetElementAsConstant(LLVMValueRef @c, uint @idx); [DllImport(libraryPath, EntryPoint = "LLVMConstVector", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstVector(out LLVMValueRef @ScalarConstantVals, uint @Size); [DllImport(libraryPath, EntryPoint = "LLVMGetConstOpcode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMOpcode GetConstOpcode(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMAlignOf", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef AlignOf(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMSizeOf", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef SizeOf(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMConstNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNeg(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstNSWNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNSWNeg(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstNUWNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNUWNeg(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstFNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFNeg(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstNot", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNot(LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMConstAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstAdd(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstNSWAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNSWAdd(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstNUWAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNUWAdd(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstFAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFAdd(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSub(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstNSWSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNSWSub(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstNUWSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNUWSub(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstFSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFSub(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstMul(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstNSWMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNSWMul(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstNUWMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstNUWMul(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstFMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFMul(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstUDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstUDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstSDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstExactSDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstExactSDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstFDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstURem", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstURem(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstSRem", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSRem(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstFRem", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFRem(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstAnd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstAnd(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstOr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstOr(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstXor", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstXor(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstICmp", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstICmp(LLVMIntPredicate @Predicate, LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstFCmp", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFCmp(LLVMRealPredicate @Predicate, LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstShl", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstShl(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstLShr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstLShr(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstAShr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstAShr(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstGEP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstGEP(LLVMValueRef @ConstantVal, out LLVMValueRef @ConstantIndices, uint @NumIndices); [DllImport(libraryPath, EntryPoint = "LLVMConstInBoundsGEP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstInBoundsGEP(LLVMValueRef @ConstantVal, out LLVMValueRef @ConstantIndices, uint @NumIndices); [DllImport(libraryPath, EntryPoint = "LLVMConstTrunc", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstTrunc(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstSExt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSExt(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstZExt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstZExt(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstFPTrunc", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFPTrunc(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstFPExt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFPExt(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstUIToFP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstUIToFP(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstSIToFP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSIToFP(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstFPToUI", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFPToUI(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstFPToSI", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFPToSI(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstPtrToInt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstPtrToInt(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstIntToPtr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstIntToPtr(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstBitCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstAddrSpaceCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstAddrSpaceCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstZExtOrBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstZExtOrBitCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstSExtOrBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSExtOrBitCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstTruncOrBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstTruncOrBitCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstPointerCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstPointerCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstIntCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstIntCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType, LLVMBool @isSigned); [DllImport(libraryPath, EntryPoint = "LLVMConstFPCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstFPCast(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); [DllImport(libraryPath, EntryPoint = "LLVMConstSelect", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstSelect(LLVMValueRef @ConstantCondition, LLVMValueRef @ConstantIfTrue, LLVMValueRef @ConstantIfFalse); [DllImport(libraryPath, EntryPoint = "LLVMConstExtractElement", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstExtractElement(LLVMValueRef @VectorConstant, LLVMValueRef @IndexConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstInsertElement", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstInsertElement(LLVMValueRef @VectorConstant, LLVMValueRef @ElementValueConstant, LLVMValueRef @IndexConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstShuffleVector", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstShuffleVector(LLVMValueRef @VectorAConstant, LLVMValueRef @VectorBConstant, LLVMValueRef @MaskConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstExtractValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstExtractValue(LLVMValueRef @AggConstant, out uint @IdxList, uint @NumIdx); [DllImport(libraryPath, EntryPoint = "LLVMConstInsertValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstInsertValue(LLVMValueRef @AggConstant, LLVMValueRef @ElementValueConstant, out uint @IdxList, uint @NumIdx); [DllImport(libraryPath, EntryPoint = "LLVMConstInlineAsm", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef ConstInlineAsm(LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @AsmString, [MarshalAs(UnmanagedType.LPStr)] string @Constraints, LLVMBool @HasSideEffects, LLVMBool @IsAlignStack); [DllImport(libraryPath, EntryPoint = "LLVMBlockAddress", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BlockAddress(LLVMValueRef @F, LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMGetGlobalParent", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMModuleRef GetGlobalParent(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMIsDeclaration", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsDeclaration(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMGetLinkage", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMLinkage GetLinkage(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMSetLinkage", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetLinkage(LLVMValueRef @Global, LLVMLinkage @Linkage); [DllImport(libraryPath, EntryPoint = "LLVMGetSection", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetSection(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMSetSection", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetSection(LLVMValueRef @Global, [MarshalAs(UnmanagedType.LPStr)] string @Section); [DllImport(libraryPath, EntryPoint = "LLVMGetVisibility", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMVisibility GetVisibility(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMSetVisibility", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetVisibility(LLVMValueRef @Global, LLVMVisibility @Viz); [DllImport(libraryPath, EntryPoint = "LLVMGetDLLStorageClass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMDLLStorageClass GetDLLStorageClass(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMSetDLLStorageClass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetDLLStorageClass(LLVMValueRef @Global, LLVMDLLStorageClass @Class); [DllImport(libraryPath, EntryPoint = "LLVMHasUnnamedAddr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool HasUnnamedAddr(LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMSetUnnamedAddr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetUnnamedAddr(LLVMValueRef @Global, LLVMBool @HasUnnamedAddr); [DllImport(libraryPath, EntryPoint = "LLVMGetAlignment", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetAlignment(LLVMValueRef @V); [DllImport(libraryPath, EntryPoint = "LLVMSetAlignment", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetAlignment(LLVMValueRef @V, uint @Bytes); [DllImport(libraryPath, EntryPoint = "LLVMAddGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef AddGlobal(LLVMModuleRef @M, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMAddGlobalInAddressSpace", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef AddGlobalInAddressSpace(LLVMModuleRef @M, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name, uint @AddressSpace); [DllImport(libraryPath, EntryPoint = "LLVMGetNamedGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetNamedGlobal(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetFirstGlobal(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMGetLastGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetLastGlobal(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMGetNextGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetNextGlobal(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMGetPreviousGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetPreviousGlobal(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMDeleteGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DeleteGlobal(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMGetInitializer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetInitializer(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMSetInitializer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetInitializer(LLVMValueRef @GlobalVar, LLVMValueRef @ConstantVal); [DllImport(libraryPath, EntryPoint = "LLVMIsThreadLocal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsThreadLocal(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMSetThreadLocal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetThreadLocal(LLVMValueRef @GlobalVar, LLVMBool @IsThreadLocal); [DllImport(libraryPath, EntryPoint = "LLVMIsGlobalConstant", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsGlobalConstant(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMSetGlobalConstant", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetGlobalConstant(LLVMValueRef @GlobalVar, LLVMBool @IsConstant); [DllImport(libraryPath, EntryPoint = "LLVMGetThreadLocalMode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMThreadLocalMode GetThreadLocalMode(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMSetThreadLocalMode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetThreadLocalMode(LLVMValueRef @GlobalVar, LLVMThreadLocalMode @Mode); [DllImport(libraryPath, EntryPoint = "LLVMIsExternallyInitialized", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsExternallyInitialized(LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMSetExternallyInitialized", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetExternallyInitialized(LLVMValueRef @GlobalVar, LLVMBool @IsExtInit); [DllImport(libraryPath, EntryPoint = "LLVMAddAlias", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef AddAlias(LLVMModuleRef @M, LLVMTypeRef @Ty, LLVMValueRef @Aliasee, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMDeleteFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DeleteFunction(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetIntrinsicID", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetIntrinsicID(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetFunctionCallConv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetFunctionCallConv(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMSetFunctionCallConv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetFunctionCallConv(LLVMValueRef @Fn, uint @CC); [DllImport(libraryPath, EntryPoint = "LLVMGetGC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetGC(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMSetGC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetGC(LLVMValueRef @Fn, [MarshalAs(UnmanagedType.LPStr)] string @Name); // legacy attribute manipulation is deprecated - use the LLVMAttributeXXX APIs in GeneratedExtensions.cs instead // attribute support was fairly significantly reworked in LLVM 3.6+ //[DllImport(libraryPath, EntryPoint = "LLVMAddFunctionAttr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void AddFunctionAttr(LLVMValueRef @Fn, LLVMAttribute @PA); //[DllImport(libraryPath, EntryPoint = "LLVMAddTargetDependentFunctionAttr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void AddTargetDependentFunctionAttr(LLVMValueRef @Fn, [MarshalAs(UnmanagedType.LPStr)] string @A, [MarshalAs(UnmanagedType.LPStr)] string @V); //[DllImport(libraryPath, EntryPoint = "LLVMGetFunctionAttr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern LLVMAttribute GetFunctionAttr(LLVMValueRef @Fn); //[DllImport(libraryPath, EntryPoint = "LLVMRemoveFunctionAttr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void RemoveFunctionAttr(LLVMValueRef @Fn, LLVMAttribute @PA); //[DllImport(libraryPath, EntryPoint = "LLVMAddAttribute", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void AddAttribute(LLVMValueRef @Arg, LLVMAttribute @PA); //[DllImport(libraryPath, EntryPoint = "LLVMRemoveAttribute", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void RemoveAttribute(LLVMValueRef @Arg, LLVMAttribute @PA); //[DllImport(libraryPath, EntryPoint = "LLVMGetAttribute", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern LLVMAttribute GetAttribute(LLVMValueRef @Arg); //[DllImport(libraryPath, EntryPoint = "LLVMAddInstrAttribute", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void AddInstrAttribute(LLVMValueRef @Instr, uint @index, LLVMAttribute @param2); //[DllImport(libraryPath, EntryPoint = "LLVMRemoveInstrAttribute", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] //internal static extern void RemoveInstrAttribute(LLVMValueRef @Instr, uint @index, LLVMAttribute @param2); [DllImport(libraryPath, EntryPoint = "LLVMCountParams", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint CountParams(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetParams", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void GetParams(LLVMValueRef @Fn, out LLVMValueRef @Params); [DllImport(libraryPath, EntryPoint = "LLVMGetParam", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetParam(LLVMValueRef @Fn, uint @Index); [DllImport(libraryPath, EntryPoint = "LLVMGetParamParent", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetParamParent(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstParam", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetFirstParam(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetLastParam", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetLastParam(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetNextParam", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetNextParam(LLVMValueRef @Arg); [DllImport(libraryPath, EntryPoint = "LLVMGetPreviousParam", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetPreviousParam(LLVMValueRef @Arg); [DllImport(libraryPath, EntryPoint = "LLVMSetParamAlignment", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetParamAlignment(LLVMValueRef @Arg, uint @align); [DllImport(libraryPath, EntryPoint = "LLVMMDStringInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef MDStringInContext(LLVMContextRef @C, [MarshalAs(UnmanagedType.LPStr)] string @Str, uint @SLen); [DllImport(libraryPath, EntryPoint = "LLVMMDString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef MDString([MarshalAs(UnmanagedType.LPStr)] string @Str, uint @SLen); [DllImport(libraryPath, EntryPoint = "LLVMMDNodeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef MDNodeInContext(LLVMContextRef @C, out LLVMValueRef @Vals, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMMDNode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef MDNode(out LLVMValueRef @Vals, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMGetMDString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetMDString(LLVMValueRef @V, out uint @Len); [DllImport(libraryPath, EntryPoint = "LLVMGetMDNodeNumOperands", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetMDNodeNumOperands(LLVMValueRef @V); [DllImport(libraryPath, EntryPoint = "LLVMGetMDNodeOperands", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void GetMDNodeOperands(LLVMValueRef @V, out LLVMValueRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMBasicBlockAsValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BasicBlockAsValue(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMValueIsBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool ValueIsBasicBlock(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMValueAsBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef ValueAsBasicBlock(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetBasicBlockParent", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetBasicBlockParent(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMGetBasicBlockTerminator", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetBasicBlockTerminator(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMCountBasicBlocks", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint CountBasicBlocks(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetBasicBlocks", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void GetBasicBlocks(LLVMValueRef @Fn, out LLVMBasicBlockRef @BasicBlocks); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetFirstBasicBlock(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetLastBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetLastBasicBlock(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetNextBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetNextBasicBlock(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMGetPreviousBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetPreviousBasicBlock(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMGetEntryBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetEntryBasicBlock(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMAppendBasicBlockInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef AppendBasicBlockInContext(LLVMContextRef @C, LLVMValueRef @Fn, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMAppendBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef AppendBasicBlock(LLVMValueRef @Fn, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMInsertBasicBlockInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef InsertBasicBlockInContext(LLVMContextRef @C, LLVMBasicBlockRef @BB, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMInsertBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef InsertBasicBlock(LLVMBasicBlockRef @InsertBeforeBB, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMDeleteBasicBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DeleteBasicBlock(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMRemoveBasicBlockFromParent", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void RemoveBasicBlockFromParent(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMMoveBasicBlockBefore", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void MoveBasicBlockBefore(LLVMBasicBlockRef @BB, LLVMBasicBlockRef @MovePos); [DllImport(libraryPath, EntryPoint = "LLVMMoveBasicBlockAfter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void MoveBasicBlockAfter(LLVMBasicBlockRef @BB, LLVMBasicBlockRef @MovePos); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetFirstInstruction(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMGetLastInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetLastInstruction(LLVMBasicBlockRef @BB); [DllImport(libraryPath, EntryPoint = "LLVMHasMetadata", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int HasMetadata(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetMetadata", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetMetadata(LLVMValueRef @Val, uint @KindID); [DllImport(libraryPath, EntryPoint = "LLVMSetMetadata", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetMetadata(LLVMValueRef @Val, uint @KindID, LLVMValueRef @Node); [DllImport(libraryPath, EntryPoint = "LLVMGetInstructionParent", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetInstructionParent(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMGetNextInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetNextInstruction(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMGetPreviousInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetPreviousInstruction(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMInstructionEraseFromParent", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InstructionEraseFromParent(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMGetInstructionOpcode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMOpcode GetInstructionOpcode(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMGetICmpPredicate", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMIntPredicate GetICmpPredicate(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMGetFCmpPredicate", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMRealPredicate GetFCmpPredicate(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMInstructionClone", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef InstructionClone(LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMSetInstructionCallConv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetInstructionCallConv(LLVMValueRef @Instr, uint @CC); [DllImport(libraryPath, EntryPoint = "LLVMGetInstructionCallConv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetInstructionCallConv(LLVMValueRef @Instr); [DllImport(libraryPath, EntryPoint = "LLVMSetInstrParamAlignment", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetInstrParamAlignment(LLVMValueRef @Instr, uint @index, uint @align); [DllImport(libraryPath, EntryPoint = "LLVMIsTailCall", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsTailCall(LLVMValueRef @CallInst); [DllImport(libraryPath, EntryPoint = "LLVMSetTailCall", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetTailCall(LLVMValueRef @CallInst, LLVMBool @IsTailCall); [DllImport(libraryPath, EntryPoint = "LLVMGetNumSuccessors", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GetNumSuccessors(LLVMValueRef @Term); [DllImport(libraryPath, EntryPoint = "LLVMGetSuccessor", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetSuccessor(LLVMValueRef @Term, uint @i); [DllImport(libraryPath, EntryPoint = "LLVMSetSuccessor", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetSuccessor(LLVMValueRef @Term, uint @i, LLVMBasicBlockRef @block); [DllImport(libraryPath, EntryPoint = "LLVMIsConditional", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsConditional(LLVMValueRef @Branch); [DllImport(libraryPath, EntryPoint = "LLVMGetCondition", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetCondition(LLVMValueRef @Branch); [DllImport(libraryPath, EntryPoint = "LLVMSetCondition", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetCondition(LLVMValueRef @Branch, LLVMValueRef @Cond); [DllImport(libraryPath, EntryPoint = "LLVMGetSwitchDefaultDest", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetSwitchDefaultDest(LLVMValueRef @SwitchInstr); [DllImport(libraryPath, EntryPoint = "LLVMAddIncoming", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddIncoming(LLVMValueRef @PhiNode, out LLVMValueRef @IncomingValues, out LLVMBasicBlockRef @IncomingBlocks, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMCountIncoming", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint CountIncoming(LLVMValueRef @PhiNode); [DllImport(libraryPath, EntryPoint = "LLVMGetIncomingValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetIncomingValue(LLVMValueRef @PhiNode, uint @Index); [DllImport(libraryPath, EntryPoint = "LLVMGetIncomingBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetIncomingBlock(LLVMValueRef @PhiNode, uint @Index); [DllImport(libraryPath, EntryPoint = "LLVMCreateBuilderInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBuilderRef CreateBuilderInContext(LLVMContextRef @C); [DllImport(libraryPath, EntryPoint = "LLVMCreateBuilder", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBuilderRef CreateBuilder(); [DllImport(libraryPath, EntryPoint = "LLVMPositionBuilder", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PositionBuilder(LLVMBuilderRef @Builder, LLVMBasicBlockRef @Block, LLVMValueRef @Instr); [DllImport(libraryPath, EntryPoint = "LLVMPositionBuilderBefore", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PositionBuilderBefore(LLVMBuilderRef @Builder, LLVMValueRef @Instr); [DllImport(libraryPath, EntryPoint = "LLVMPositionBuilderAtEnd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PositionBuilderAtEnd(LLVMBuilderRef @Builder, LLVMBasicBlockRef @Block); [DllImport(libraryPath, EntryPoint = "LLVMGetInsertBlock", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBasicBlockRef GetInsertBlock(LLVMBuilderRef @Builder); [DllImport(libraryPath, EntryPoint = "LLVMClearInsertionPosition", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ClearInsertionPosition(LLVMBuilderRef @Builder); [DllImport(libraryPath, EntryPoint = "LLVMInsertIntoBuilder", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InsertIntoBuilder(LLVMBuilderRef @Builder, LLVMValueRef @Instr); [DllImport(libraryPath, EntryPoint = "LLVMInsertIntoBuilderWithName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InsertIntoBuilderWithName(LLVMBuilderRef @Builder, LLVMValueRef @Instr, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMDisposeBuilder", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeBuilder(LLVMBuilderRef @Builder); [DllImport(libraryPath, EntryPoint = "LLVMSetCurrentDebugLocation", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetCurrentDebugLocation(LLVMBuilderRef @Builder, LLVMValueRef @L); [DllImport(libraryPath, EntryPoint = "LLVMGetCurrentDebugLocation", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetCurrentDebugLocation(LLVMBuilderRef @Builder); [DllImport(libraryPath, EntryPoint = "LLVMSetInstDebugLocation", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetInstDebugLocation(LLVMBuilderRef @Builder, LLVMValueRef @Inst); [DllImport(libraryPath, EntryPoint = "LLVMBuildRetVoid", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildRetVoid(LLVMBuilderRef @param0); [DllImport(libraryPath, EntryPoint = "LLVMBuildRet", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildRet(LLVMBuilderRef @param0, LLVMValueRef @V); [DllImport(libraryPath, EntryPoint = "LLVMBuildAggregateRet", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAggregateRet(LLVMBuilderRef @param0, out LLVMValueRef @RetVals, uint @N); [DllImport(libraryPath, EntryPoint = "LLVMBuildBr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildBr(LLVMBuilderRef @param0, LLVMBasicBlockRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMBuildCondBr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildCondBr(LLVMBuilderRef @param0, LLVMValueRef @If, LLVMBasicBlockRef @Then, LLVMBasicBlockRef @Else); [DllImport(libraryPath, EntryPoint = "LLVMBuildSwitch", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSwitch(LLVMBuilderRef @param0, LLVMValueRef @V, LLVMBasicBlockRef @Else, uint @NumCases); [DllImport(libraryPath, EntryPoint = "LLVMBuildIndirectBr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildIndirectBr(LLVMBuilderRef @B, LLVMValueRef @Addr, uint @NumDests); [DllImport(libraryPath, EntryPoint = "LLVMBuildInvoke", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildInvoke(LLVMBuilderRef @param0, LLVMValueRef @Fn, out LLVMValueRef @Args, uint @NumArgs, LLVMBasicBlockRef @Then, LLVMBasicBlockRef @Catch, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildLandingPad", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildLandingPad(LLVMBuilderRef @B, LLVMTypeRef @Ty, LLVMValueRef PersFn, uint @NumClauses, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildResume", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildResume(LLVMBuilderRef @B, LLVMValueRef @Exn); [DllImport(libraryPath, EntryPoint = "LLVMBuildUnreachable", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildUnreachable(LLVMBuilderRef @param0); [DllImport(libraryPath, EntryPoint = "LLVMAddCase", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddCase(LLVMValueRef @Switch, LLVMValueRef @OnVal, LLVMBasicBlockRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMAddDestination", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddDestination(LLVMValueRef @IndirectBr, LLVMBasicBlockRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMAddClause", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddClause(LLVMValueRef @LandingPad, LLVMValueRef @ClauseVal); [DllImport(libraryPath, EntryPoint = "LLVMSetCleanup", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetCleanup(LLVMValueRef @LandingPad, LLVMBool @Val); [DllImport(libraryPath, EntryPoint = "LLVMBuildAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAdd(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNSWAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNSWAdd(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNUWAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNUWAdd(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFAdd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFAdd(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSub(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNSWSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNSWSub(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNUWSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNUWSub(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFSub", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFSub(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildMul(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNSWMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNSWMul(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNUWMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNUWMul(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFMul", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFMul(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildUDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildUDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildExactSDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildExactSDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFDiv", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildURem", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildURem(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSRem", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSRem(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFRem", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFRem(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildShl", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildShl(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildLShr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildLShr(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildAShr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAShr(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildAnd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAnd(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildOr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildOr(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildXor", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildXor(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildBinOp", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildBinOp(LLVMBuilderRef @B, LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNeg(LLVMBuilderRef @param0, LLVMValueRef @V, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNSWNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNSWNeg(LLVMBuilderRef @B, LLVMValueRef @V, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNUWNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNUWNeg(LLVMBuilderRef @B, LLVMValueRef @V, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFNeg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFNeg(LLVMBuilderRef @param0, LLVMValueRef @V, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildNot", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildNot(LLVMBuilderRef @param0, LLVMValueRef @V, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildMalloc", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildMalloc(LLVMBuilderRef @param0, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildArrayMalloc", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildArrayMalloc(LLVMBuilderRef @param0, LLVMTypeRef @Ty, LLVMValueRef @Val, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildAlloca", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAlloca(LLVMBuilderRef @param0, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildArrayAlloca", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildArrayAlloca(LLVMBuilderRef @param0, LLVMTypeRef @Ty, LLVMValueRef @Val, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFree", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFree(LLVMBuilderRef @param0, LLVMValueRef @PointerVal); [DllImport(libraryPath, EntryPoint = "LLVMBuildLoad", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildLoad(LLVMBuilderRef @param0, LLVMValueRef @PointerVal, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildStore", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildStore(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMValueRef @Ptr); [DllImport(libraryPath, EntryPoint = "LLVMBuildGEP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, out LLVMValueRef @Indices, uint @NumIndices, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildInBoundsGEP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildInBoundsGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, out LLVMValueRef @Indices, uint @NumIndices, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildStructGEP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildStructGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, uint @Idx, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildGlobalString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildGlobalString(LLVMBuilderRef @B, [MarshalAs(UnmanagedType.LPStr)] string @Str, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildGlobalStringPtr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildGlobalStringPtr(LLVMBuilderRef @B, [MarshalAs(UnmanagedType.LPStr)] string @Str, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetVolatile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool GetVolatile(LLVMValueRef @MemoryAccessInst); [DllImport(libraryPath, EntryPoint = "LLVMSetVolatile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetVolatile(LLVMValueRef @MemoryAccessInst, LLVMBool @IsVolatile); [DllImport( libraryPath, EntryPoint = "LLVMGetOrdering", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true )] internal static extern LLVMAtomicOrdering GetOrdering( LLVMValueRef @MemoryAccessInst ); [DllImport( libraryPath, EntryPoint = "LLVMSetOrdering", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true )] internal static extern void SetOrdering( LLVMValueRef @MemoryAccessInst, LLVMAtomicOrdering @Ordering ); [DllImport(libraryPath, EntryPoint = "LLVMBuildTrunc", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildTrunc(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildZExt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildZExt(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSExt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSExt(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFPToUI", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFPToUI(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFPToSI", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFPToSI(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildUIToFP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildUIToFP(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSIToFP", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSIToFP(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFPTrunc", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFPTrunc(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFPExt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFPExt(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildPtrToInt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildPtrToInt(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildIntToPtr", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildIntToPtr(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildBitCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildAddrSpaceCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAddrSpaceCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildZExtOrBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildZExtOrBitCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSExtOrBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSExtOrBitCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildTruncOrBitCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildTruncOrBitCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildCast(LLVMBuilderRef @B, LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildPointerCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildPointerCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildIntCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildIntCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFPCast", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFPCast(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildICmp", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildICmp(LLVMBuilderRef @param0, LLVMIntPredicate @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFCmp", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFCmp(LLVMBuilderRef @param0, LLVMRealPredicate @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildPhi", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildPhi(LLVMBuilderRef @param0, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildCall", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildCall(LLVMBuilderRef @param0, LLVMValueRef @Fn, out LLVMValueRef @Args, uint @NumArgs, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSelect", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildSelect(LLVMBuilderRef @param0, LLVMValueRef @If, LLVMValueRef @Then, LLVMValueRef @Else, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildVAArg", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildVAArg(LLVMBuilderRef @param0, LLVMValueRef @List, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildExtractElement", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildExtractElement(LLVMBuilderRef @param0, LLVMValueRef @VecVal, LLVMValueRef @Index, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildInsertElement", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildInsertElement(LLVMBuilderRef @param0, LLVMValueRef @VecVal, LLVMValueRef @EltVal, LLVMValueRef @Index, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildShuffleVector", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildShuffleVector(LLVMBuilderRef @param0, LLVMValueRef @V1, LLVMValueRef @V2, LLVMValueRef @Mask, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildExtractValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildExtractValue(LLVMBuilderRef @param0, LLVMValueRef @AggVal, uint @Index, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildInsertValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildInsertValue(LLVMBuilderRef @param0, LLVMValueRef @AggVal, LLVMValueRef @EltVal, uint @Index, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildIsNull", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildIsNull(LLVMBuilderRef @param0, LLVMValueRef @Val, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildIsNotNull", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildIsNotNull(LLVMBuilderRef @param0, LLVMValueRef @Val, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildPtrDiff", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildPtrDiff(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildFence", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildFence(LLVMBuilderRef @B, LLVMAtomicOrdering @ordering, LLVMBool @singleThread, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildAtomicRMW", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef BuildAtomicRMW(LLVMBuilderRef @B, LLVMAtomicRMWBinOp @op, LLVMValueRef @PTR, LLVMValueRef @Val, LLVMAtomicOrdering @ordering, LLVMBool @singleThread); [DllImport(libraryPath, EntryPoint = "LLVMCreateModuleProviderForExistingModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMModuleProviderRef CreateModuleProviderForExistingModule(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMDisposeModuleProvider", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeModuleProvider(LLVMModuleProviderRef @M); [DllImport(libraryPath, EntryPoint = "LLVMCreateMemoryBufferWithContentsOfFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool CreateMemoryBufferWithContentsOfFile([MarshalAs(UnmanagedType.LPStr)] string @Path, out LLVMMemoryBufferRef @OutMemBuf, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMCreateMemoryBufferWithSTDIN", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool CreateMemoryBufferWithSTDIN(out LLVMMemoryBufferRef @OutMemBuf, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMCreateMemoryBufferWithMemoryRange", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMMemoryBufferRef CreateMemoryBufferWithMemoryRange([MarshalAs(UnmanagedType.LPStr)] string @InputData, int @InputDataLength, [MarshalAs(UnmanagedType.LPStr)] string @BufferName, LLVMBool @RequiresNullTerminator); [DllImport(libraryPath, EntryPoint = "LLVMCreateMemoryBufferWithMemoryRangeCopy", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMMemoryBufferRef CreateMemoryBufferWithMemoryRangeCopy([MarshalAs(UnmanagedType.LPStr)] string @InputData, int @InputDataLength, [MarshalAs(UnmanagedType.LPStr)] string @BufferName); [DllImport(libraryPath, EntryPoint = "LLVMGetBufferStart", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetBufferStart(LLVMMemoryBufferRef @MemBuf); [DllImport(libraryPath, EntryPoint = "LLVMGetBufferSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetBufferSize(LLVMMemoryBufferRef @MemBuf); [DllImport(libraryPath, EntryPoint = "LLVMDisposeMemoryBuffer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeMemoryBuffer(LLVMMemoryBufferRef @MemBuf); [DllImport(libraryPath, EntryPoint = "LLVMGetGlobalPassRegistry", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMPassRegistryRef GetGlobalPassRegistry(); [DllImport(libraryPath, EntryPoint = "LLVMCreatePassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMPassManagerRef CreatePassManager(); [DllImport(libraryPath, EntryPoint = "LLVMCreateFunctionPassManagerForModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMPassManagerRef CreateFunctionPassManagerForModule(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMCreateFunctionPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMPassManagerRef CreateFunctionPassManager(LLVMModuleProviderRef @MP); [DllImport(libraryPath, EntryPoint = "LLVMRunPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool RunPassManager(LLVMPassManagerRef @PM, LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMInitializeFunctionPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool InitializeFunctionPassManager(LLVMPassManagerRef @FPM); [DllImport(libraryPath, EntryPoint = "LLVMRunFunctionPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool RunFunctionPassManager(LLVMPassManagerRef @FPM, LLVMValueRef @F); [DllImport(libraryPath, EntryPoint = "LLVMFinalizeFunctionPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool FinalizeFunctionPassManager(LLVMPassManagerRef @FPM); [DllImport(libraryPath, EntryPoint = "LLVMDisposePassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposePassManager(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMStartMultithreaded", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool StartMultithreaded(); [DllImport(libraryPath, EntryPoint = "LLVMStopMultithreaded", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void StopMultithreaded(); [DllImport(libraryPath, EntryPoint = "LLVMIsMultithreaded", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsMultithreaded(); [DllImport(libraryPath, EntryPoint = "LLVMVerifyModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool VerifyModule(LLVMModuleRef @M, LLVMVerifierFailureAction @Action, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMVerifyFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool VerifyFunction(LLVMValueRef @Fn, LLVMVerifierFailureAction @Action); [DllImport(libraryPath, EntryPoint = "LLVMViewFunctionCFG", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ViewFunctionCFG(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMViewFunctionCFGOnly", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void ViewFunctionCFGOnly(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMParseBitcode", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool ParseBitcode(LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutModule, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMParseBitcodeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool ParseBitcodeInContext(LLVMContextRef @ContextRef, LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutModule, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMGetBitcodeModuleInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool GetBitcodeModuleInContext(LLVMContextRef @ContextRef, LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMGetBitcodeModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool GetBitcodeModule(LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMWriteBitcodeToFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int WriteBitcodeToFile(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Path); [DllImport(libraryPath, EntryPoint = "LLVMWriteBitcodeToFD", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int WriteBitcodeToFD(LLVMModuleRef @M, int @FD, int @ShouldClose, int @Unbuffered); [DllImport(libraryPath, EntryPoint = "LLVMWriteBitcodeToFileHandle", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int WriteBitcodeToFileHandle(LLVMModuleRef @M, int @Handle); [DllImport(libraryPath, EntryPoint = "LLVMWriteBitcodeToMemoryBuffer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMMemoryBufferRef WriteBitcodeToMemoryBuffer(LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMCreateDisasm", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMDisasmContextRef CreateDisasm([MarshalAs(UnmanagedType.LPStr)] string @TripleName, IntPtr @DisInfo, int @TagType, LLVMOpInfoCallback @GetOpInfo, LLVMSymbolLookupCallback @SymbolLookUp); [DllImport(libraryPath, EntryPoint = "LLVMCreateDisasmCPU", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMDisasmContextRef CreateDisasmCPU([MarshalAs(UnmanagedType.LPStr)] string @Triple, [MarshalAs(UnmanagedType.LPStr)] string @CPU, IntPtr @DisInfo, int @TagType, LLVMOpInfoCallback @GetOpInfo, LLVMSymbolLookupCallback @SymbolLookUp); [DllImport(libraryPath, EntryPoint = "LLVMCreateDisasmCPUFeatures", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMDisasmContextRef CreateDisasmCPUFeatures([MarshalAs(UnmanagedType.LPStr)] string @Triple, [MarshalAs(UnmanagedType.LPStr)] string @CPU, [MarshalAs(UnmanagedType.LPStr)] string @Features, IntPtr @DisInfo, int @TagType, LLVMOpInfoCallback @GetOpInfo, LLVMSymbolLookupCallback @SymbolLookUp); [DllImport(libraryPath, EntryPoint = "LLVMSetDisasmOptions", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int SetDisasmOptions(LLVMDisasmContextRef @DC, int @Options); [DllImport(libraryPath, EntryPoint = "LLVMDisasmDispose", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisasmDispose(LLVMDisasmContextRef @DC); [DllImport(libraryPath, EntryPoint = "LLVMDisasmInstruction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int DisasmInstruction(LLVMDisasmContextRef @DC, out char @Bytes, int @BytesSize, int @PC, IntPtr @OutString, int @OutStringSize); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAMDGPUTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAMDGPUTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSystemZTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSystemZTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeHexagonTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeHexagonTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNVPTXTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeNVPTXTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeCppBackendTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeCppBackendTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMSP430TargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMSP430TargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeXCoreTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeXCoreTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMipsTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMipsTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAArch64TargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAArch64TargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeARMTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeARMTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializePowerPCTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializePowerPCTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSparcTargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSparcTargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeX86TargetInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeX86TargetInfo(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAMDGPUTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAMDGPUTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSystemZTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSystemZTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeHexagonTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeHexagonTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNVPTXTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeNVPTXTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeCppBackendTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeCppBackendTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMSP430Target", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMSP430Target(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeXCoreTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeXCoreTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMipsTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMipsTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAArch64Target", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAArch64Target(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeARMTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeARMTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializePowerPCTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializePowerPCTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSparcTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSparcTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeX86Target", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeX86Target(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAMDGPUTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAMDGPUTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSystemZTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSystemZTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeHexagonTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeHexagonTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNVPTXTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeNVPTXTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeCppBackendTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeCppBackendTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMSP430TargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMSP430TargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeXCoreTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeXCoreTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMipsTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMipsTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAArch64TargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAArch64TargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeARMTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeARMTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializePowerPCTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializePowerPCTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSparcTargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSparcTargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeX86TargetMC", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeX86TargetMC(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAMDGPUAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAMDGPUAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSystemZAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSystemZAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeHexagonAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeHexagonAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNVPTXAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeNVPTXAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMSP430AsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMSP430AsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeXCoreAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeXCoreAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMipsAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMipsAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAArch64AsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAArch64AsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeARMAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeARMAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializePowerPCAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializePowerPCAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSparcAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSparcAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeX86AsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeX86AsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAMDGPUAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAMDGPUAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSystemZAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSystemZAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMipsAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMipsAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAArch64AsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAArch64AsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeARMAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeARMAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializePowerPCAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializePowerPCAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSparcAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSparcAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeX86AsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeX86AsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSystemZDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSystemZDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeHexagonDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeHexagonDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeXCoreDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeXCoreDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMipsDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMipsDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAArch64Disassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAArch64Disassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeARMDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeARMDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializePowerPCDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializePowerPCDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeSparcDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeSparcDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeX86Disassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeX86Disassembler(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAllTargetInfos", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAllTargetInfos(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAllTargets", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAllTargets(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAllTargetMCs", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAllTargetMCs(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAllAsmPrinters", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAllAsmPrinters(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAllAsmParsers", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAllAsmParsers(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAllDisassemblers", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAllDisassemblers(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNativeTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool InitializeNativeTarget(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNativeAsmParser", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool InitializeNativeAsmParser(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNativeAsmPrinter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool InitializeNativeAsmPrinter(); [DllImport(libraryPath, EntryPoint = "LLVMInitializeNativeDisassembler", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool InitializeNativeDisassembler(); [DllImport(libraryPath, EntryPoint = "LLVMCreateTargetData", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetDataRef CreateTargetData([MarshalAs(UnmanagedType.LPStr)] string @StringRep); [DllImport(libraryPath, EntryPoint = "LLVMAddTargetData", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddTargetData(LLVMTargetDataRef @TD, LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddTargetLibraryInfo", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddTargetLibraryInfo(LLVMTargetLibraryInfoRef @TLI, LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMCopyStringRepOfTargetData", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr CopyStringRepOfTargetData(LLVMTargetDataRef @TD); [DllImport(libraryPath, EntryPoint = "LLVMByteOrder", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMByteOrdering ByteOrder(LLVMTargetDataRef @TD); [DllImport(libraryPath, EntryPoint = "LLVMPointerSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint PointerSize(LLVMTargetDataRef @TD); [DllImport(libraryPath, EntryPoint = "LLVMPointerSizeForAS", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint PointerSizeForAS(LLVMTargetDataRef @TD, uint @AS); [DllImport(libraryPath, EntryPoint = "LLVMIntPtrType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef IntPtrType(LLVMTargetDataRef @TD); [DllImport(libraryPath, EntryPoint = "LLVMIntPtrTypeForAS", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef IntPtrTypeForAS(LLVMTargetDataRef @TD, uint @AS); [DllImport(libraryPath, EntryPoint = "LLVMIntPtrTypeInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef IntPtrTypeInContext(LLVMContextRef @C, LLVMTargetDataRef @TD); [DllImport(libraryPath, EntryPoint = "LLVMIntPtrTypeForASInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTypeRef IntPtrTypeForASInContext(LLVMContextRef @C, LLVMTargetDataRef @TD, uint @AS); [DllImport(libraryPath, EntryPoint = "LLVMSizeOfTypeInBits", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern ulong SizeOfTypeInBits(LLVMTargetDataRef @TD, LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMStoreSizeOfType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern ulong StoreSizeOfType(LLVMTargetDataRef @TD, LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMABISizeOfType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern ulong ABISizeOfType(LLVMTargetDataRef @TD, LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMABIAlignmentOfType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint ABIAlignmentOfType(LLVMTargetDataRef @TD, LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMCallFrameAlignmentOfType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint CallFrameAlignmentOfType(LLVMTargetDataRef @TD, LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMPreferredAlignmentOfType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint PreferredAlignmentOfType(LLVMTargetDataRef @TD, LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMPreferredAlignmentOfGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint PreferredAlignmentOfGlobal(LLVMTargetDataRef @TD, LLVMValueRef @GlobalVar); [DllImport(libraryPath, EntryPoint = "LLVMElementAtOffset", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint ElementAtOffset(LLVMTargetDataRef @TD, LLVMTypeRef @StructTy, ulong @Offset); [DllImport(libraryPath, EntryPoint = "LLVMOffsetOfElement", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern ulong OffsetOfElement(LLVMTargetDataRef @TD, LLVMTypeRef @StructTy, uint @Element); [DllImport(libraryPath, EntryPoint = "LLVMDisposeTargetData", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeTargetData(LLVMTargetDataRef @TD); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetRef GetFirstTarget(); [DllImport(libraryPath, EntryPoint = "LLVMGetNextTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetRef GetNextTarget(LLVMTargetRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetFromName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetRef GetTargetFromName([MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetFromTriple", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool GetTargetFromTriple([MarshalAs(UnmanagedType.LPStr)] string @Triple, out LLVMTargetRef @T, out IntPtr @ErrorMessage); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetTargetName(LLVMTargetRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetDescription", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetTargetDescription(LLVMTargetRef @T); [DllImport(libraryPath, EntryPoint = "LLVMTargetHasJIT", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool TargetHasJIT(LLVMTargetRef @T); [DllImport(libraryPath, EntryPoint = "LLVMTargetHasTargetMachine", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool TargetHasTargetMachine(LLVMTargetRef @T); [DllImport(libraryPath, EntryPoint = "LLVMTargetHasAsmBackend", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool TargetHasAsmBackend(LLVMTargetRef @T); [DllImport(libraryPath, EntryPoint = "LLVMCreateTargetMachine", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetMachineRef CreateTargetMachine(LLVMTargetRef @T, [MarshalAs(UnmanagedType.LPStr)] string @Triple, [MarshalAs(UnmanagedType.LPStr)] string @CPU, [MarshalAs(UnmanagedType.LPStr)] string @Features, LLVMCodeGenOptLevel @Level, LLVMRelocMode @Reloc, LLVMCodeModel @CodeModel); [DllImport(libraryPath, EntryPoint = "LLVMDisposeTargetMachine", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeTargetMachine(LLVMTargetMachineRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetMachineTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetRef GetTargetMachineTarget(LLVMTargetMachineRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetMachineTriple", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetTargetMachineTriple(LLVMTargetMachineRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetMachineCPU", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetTargetMachineCPU(LLVMTargetMachineRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetMachineFeatureString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetTargetMachineFeatureString(LLVMTargetMachineRef @T); [DllImport(libraryPath, EntryPoint = "LLVMGetTargetMachineData", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetDataRef GetTargetMachineData(LLVMTargetMachineRef @T); [DllImport(libraryPath, EntryPoint = "LLVMSetTargetMachineAsmVerbosity", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetTargetMachineAsmVerbosity(LLVMTargetMachineRef @T, LLVMBool @VerboseAsm); [DllImport(libraryPath, EntryPoint = "LLVMTargetMachineEmitToFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool TargetMachineEmitToFile(LLVMTargetMachineRef @T, LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Filename, LLVMCodeGenFileType @codegen, out IntPtr @ErrorMessage); [DllImport(libraryPath, EntryPoint = "LLVMTargetMachineEmitToMemoryBuffer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool TargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef @T, LLVMModuleRef @M, LLVMCodeGenFileType @codegen, out IntPtr @ErrorMessage, out LLVMMemoryBufferRef @OutMemBuf); [DllImport(libraryPath, EntryPoint = "LLVMGetDefaultTargetTriple", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetDefaultTargetTriple(); [DllImport(libraryPath, EntryPoint = "LLVMAddAnalysisPasses", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddAnalysisPasses(LLVMTargetMachineRef @T, LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMLinkInMCJIT", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void LinkInMCJIT(); [DllImport(libraryPath, EntryPoint = "LLVMLinkInInterpreter", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void LinkInInterpreter(); [DllImport(libraryPath, EntryPoint = "LLVMCreateGenericValueOfInt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMGenericValueRef CreateGenericValueOfInt(LLVMTypeRef @Ty, ulong @N, LLVMBool @IsSigned); [DllImport(libraryPath, EntryPoint = "LLVMCreateGenericValueOfPointer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMGenericValueRef CreateGenericValueOfPointer(IntPtr @P); [DllImport(libraryPath, EntryPoint = "LLVMCreateGenericValueOfFloat", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMGenericValueRef CreateGenericValueOfFloat(LLVMTypeRef @Ty, double @N); [DllImport(libraryPath, EntryPoint = "LLVMGenericValueIntWidth", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern uint GenericValueIntWidth(LLVMGenericValueRef @GenValRef); [DllImport(libraryPath, EntryPoint = "LLVMGenericValueToInt", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern ulong GenericValueToInt(LLVMGenericValueRef @GenVal, LLVMBool @IsSigned); [DllImport(libraryPath, EntryPoint = "LLVMGenericValueToPointer", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GenericValueToPointer(LLVMGenericValueRef @GenVal); [DllImport(libraryPath, EntryPoint = "LLVMGenericValueToFloat", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern double GenericValueToFloat(LLVMTypeRef @TyRef, LLVMGenericValueRef @GenVal); [DllImport(libraryPath, EntryPoint = "LLVMDisposeGenericValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeGenericValue(LLVMGenericValueRef @GenVal); [DllImport(libraryPath, EntryPoint = "LLVMCreateExecutionEngineForModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool CreateExecutionEngineForModule(out LLVMExecutionEngineRef @OutEE, LLVMModuleRef @M, out IntPtr @OutError); [DllImport(libraryPath, EntryPoint = "LLVMCreateInterpreterForModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool CreateInterpreterForModule(out LLVMExecutionEngineRef @OutInterp, LLVMModuleRef @M, out IntPtr @OutError); [DllImport(libraryPath, EntryPoint = "LLVMCreateJITCompilerForModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool CreateJITCompilerForModule(out LLVMExecutionEngineRef @OutJIT, LLVMModuleRef @M, uint @OptLevel, out IntPtr @OutError); [DllImport(libraryPath, EntryPoint = "LLVMInitializeMCJITCompilerOptions", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeMCJITCompilerOptions(out LLVMMCJITCompilerOptions @Options, int @SizeOfOptions); [DllImport(libraryPath, EntryPoint = "LLVMCreateMCJITCompilerForModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool CreateMCJITCompilerForModule(out LLVMExecutionEngineRef @OutJIT, LLVMModuleRef @M, out LLVMMCJITCompilerOptions @Options, int @SizeOfOptions, out IntPtr @OutError); [DllImport(libraryPath, EntryPoint = "LLVMDisposeExecutionEngine", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeExecutionEngine(LLVMExecutionEngineRef @EE); [DllImport(libraryPath, EntryPoint = "LLVMRunStaticConstructors", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void RunStaticConstructors(LLVMExecutionEngineRef @EE); [DllImport(libraryPath, EntryPoint = "LLVMRunStaticDestructors", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void RunStaticDestructors(LLVMExecutionEngineRef @EE); [DllImport(libraryPath, EntryPoint = "LLVMRunFunctionAsMain", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int RunFunctionAsMain(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @ArgC, string[] @ArgV, string[] @EnvP); [DllImport(libraryPath, EntryPoint = "LLVMRunFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @NumArgs, out LLVMGenericValueRef @Args); [DllImport(libraryPath, EntryPoint = "LLVMFreeMachineCodeForFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void FreeMachineCodeForFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F); [DllImport(libraryPath, EntryPoint = "LLVMAddModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddModule(LLVMExecutionEngineRef @EE, LLVMModuleRef @M); [DllImport(libraryPath, EntryPoint = "LLVMRemoveModule", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool RemoveModule(LLVMExecutionEngineRef @EE, LLVMModuleRef @M, out LLVMModuleRef @OutMod, out IntPtr @OutError); [DllImport(libraryPath, EntryPoint = "LLVMFindFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool FindFunction(LLVMExecutionEngineRef @EE, [MarshalAs(UnmanagedType.LPStr)] string @Name, out LLVMValueRef @OutFn); [DllImport(libraryPath, EntryPoint = "LLVMRecompileAndRelinkFunction", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr RecompileAndRelinkFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetExecutionEngineTargetData", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetDataRef GetExecutionEngineTargetData(LLVMExecutionEngineRef @EE); [DllImport(libraryPath, EntryPoint = "LLVMGetExecutionEngineTargetMachine", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMTargetMachineRef GetExecutionEngineTargetMachine(LLVMExecutionEngineRef @EE); [DllImport(libraryPath, EntryPoint = "LLVMAddGlobalMapping", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddGlobalMapping(LLVMExecutionEngineRef @EE, LLVMValueRef @Global, IntPtr @Addr); [DllImport(libraryPath, EntryPoint = "LLVMGetPointerToGlobal", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetPointerToGlobal(LLVMExecutionEngineRef @EE, LLVMValueRef @Global); [DllImport(libraryPath, EntryPoint = "LLVMGetGlobalValueAddress", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetGlobalValueAddress(LLVMExecutionEngineRef @EE, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetFunctionAddress", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetFunctionAddress(LLVMExecutionEngineRef @EE, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMCreateSimpleMCJITMemoryManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMMCJITMemoryManagerRef CreateSimpleMCJITMemoryManager(IntPtr @Opaque, LLVMMemoryManagerAllocateCodeSectionCallback @AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback @AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback @FinalizeMemory, LLVMMemoryManagerDestroyCallback @Destroy); [DllImport(libraryPath, EntryPoint = "LLVMDisposeMCJITMemoryManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeMCJITMemoryManager(LLVMMCJITMemoryManagerRef @MM); [DllImport(libraryPath, EntryPoint = "LLVMInitializeTransformUtils", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeTransformUtils(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeScalarOpts", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeScalarOpts(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeObjCARCOpts", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeObjCARCOpts(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeVectorization", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeVectorization(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeInstCombine", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeInstCombine(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeIPO", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeIPO(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeInstrumentation", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeInstrumentation(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeAnalysis", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeAnalysis(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeIPA", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeIPA(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeCodeGen", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeCodeGen(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMInitializeTarget", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void InitializeTarget(LLVMPassRegistryRef @R); [DllImport(libraryPath, EntryPoint = "LLVMParseIRInContext", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool ParseIRInContext(LLVMContextRef @ContextRef, LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMLinkModules", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool LinkModules(LLVMModuleRef @Dest, LLVMModuleRef @Src, LLVMLinkerMode @Mode, out IntPtr @OutMessage); [DllImport(libraryPath, EntryPoint = "LLVMCreateObjectFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMObjectFileRef CreateObjectFile(LLVMMemoryBufferRef @MemBuf); [DllImport(libraryPath, EntryPoint = "LLVMDisposeObjectFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeObjectFile(LLVMObjectFileRef @ObjectFile); [DllImport(libraryPath, EntryPoint = "LLVMGetSections", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMSectionIteratorRef GetSections(LLVMObjectFileRef @ObjectFile); [DllImport(libraryPath, EntryPoint = "LLVMDisposeSectionIterator", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeSectionIterator(LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMIsSectionIteratorAtEnd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsSectionIteratorAtEnd(LLVMObjectFileRef @ObjectFile, LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMMoveToNextSection", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void MoveToNextSection(LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMMoveToContainingSection", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void MoveToContainingSection(LLVMSectionIteratorRef @Sect, LLVMSymbolIteratorRef @Sym); [DllImport(libraryPath, EntryPoint = "LLVMGetSymbols", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMSymbolIteratorRef GetSymbols(LLVMObjectFileRef @ObjectFile); [DllImport(libraryPath, EntryPoint = "LLVMDisposeSymbolIterator", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeSymbolIterator(LLVMSymbolIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMIsSymbolIteratorAtEnd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsSymbolIteratorAtEnd(LLVMObjectFileRef @ObjectFile, LLVMSymbolIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMMoveToNextSymbol", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void MoveToNextSymbol(LLVMSymbolIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSectionName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetSectionName(LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSectionSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetSectionSize(LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSectionContents", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetSectionContents(LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSectionAddress", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetSectionAddress(LLVMSectionIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSectionContainsSymbol", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool GetSectionContainsSymbol(LLVMSectionIteratorRef @SI, LLVMSymbolIteratorRef @Sym); [DllImport(libraryPath, EntryPoint = "LLVMGetRelocations", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMRelocationIteratorRef GetRelocations(LLVMSectionIteratorRef @Section); [DllImport(libraryPath, EntryPoint = "LLVMDisposeRelocationIterator", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void DisposeRelocationIterator(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMIsRelocationIteratorAtEnd", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMBool IsRelocationIteratorAtEnd(LLVMSectionIteratorRef @Section, LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMMoveToNextRelocation", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void MoveToNextRelocation(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMGetSymbolName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetSymbolName(LLVMSymbolIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSymbolAddress", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetSymbolAddress(LLVMSymbolIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetSymbolSize", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetSymbolSize(LLVMSymbolIteratorRef @SI); [DllImport(libraryPath, EntryPoint = "LLVMGetRelocationOffset", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetRelocationOffset(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMGetRelocationSymbol", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMSymbolIteratorRef GetRelocationSymbol(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMGetRelocationType", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern int GetRelocationType(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMGetRelocationTypeName", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetRelocationTypeName(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMGetRelocationValueString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr GetRelocationValueString(LLVMRelocationIteratorRef @RI); [DllImport(libraryPath, EntryPoint = "LLVMAddArgumentPromotionPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddArgumentPromotionPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddConstantMergePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddConstantMergePass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddDeadArgEliminationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddDeadArgEliminationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddFunctionAttrsPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddFunctionAttrsPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddFunctionInliningPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddFunctionInliningPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddAlwaysInlinerPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddAlwaysInlinerPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddGlobalDCEPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddGlobalDCEPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddGlobalOptimizerPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddGlobalOptimizerPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddIPConstantPropagationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddIPConstantPropagationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddPruneEHPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddPruneEHPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddIPSCCPPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddIPSCCPPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddInternalizePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddInternalizePass(LLVMPassManagerRef @param0, uint @AllButMain); [DllImport(libraryPath, EntryPoint = "LLVMAddStripDeadPrototypesPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddStripDeadPrototypesPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddStripSymbolsPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddStripSymbolsPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderCreate", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMPassManagerBuilderRef PassManagerBuilderCreate(); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderDispose", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderDispose(LLVMPassManagerBuilderRef @PMB); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderSetOptLevel", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef @PMB, uint @OptLevel); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderSetSizeLevel", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef @PMB, uint @SizeLevel); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderSetDisableUnitAtATime", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef @PMB, LLVMBool @Value); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderSetDisableUnrollLoops", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef @PMB, LLVMBool @Value); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderSetDisableSimplifyLibCalls", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef @PMB, LLVMBool @Value); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderUseInlinerWithThreshold", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef @PMB, uint @Threshold); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderPopulateFunctionPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef @PMB, LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderPopulateModulePassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef @PMB, LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMPassManagerBuilderPopulateLTOPassManager", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void PassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef @PMB, LLVMPassManagerRef @PM, LLVMBool @Internalize, LLVMBool @RunInliner); [DllImport(libraryPath, EntryPoint = "LLVMAddAggressiveDCEPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddAggressiveDCEPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddAlignmentFromAssumptionsPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddAlignmentFromAssumptionsPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddCFGSimplificationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddCFGSimplificationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddDeadStoreEliminationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddDeadStoreEliminationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddScalarizerPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddScalarizerPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddMergedLoadStoreMotionPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddMergedLoadStoreMotionPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddGVNPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddGVNPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddIndVarSimplifyPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddIndVarSimplifyPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddInstructionCombiningPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddInstructionCombiningPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddJumpThreadingPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddJumpThreadingPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLICMPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLICMPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopDeletionPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopDeletionPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopIdiomPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopIdiomPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopRotatePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopRotatePass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopRerollPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopRerollPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopUnrollPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopUnrollPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopUnswitchPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopUnswitchPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddMemCpyOptPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddMemCpyOptPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddPartiallyInlineLibCallsPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddPartiallyInlineLibCallsPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLowerSwitchPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLowerSwitchPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddPromoteMemoryToRegisterPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddPromoteMemoryToRegisterPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddReassociatePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddReassociatePass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddSCCPPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddSCCPPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddScalarReplAggregatesPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddScalarReplAggregatesPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddScalarReplAggregatesPassSSA", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddScalarReplAggregatesPassSSA(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddScalarReplAggregatesPassWithThreshold", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef @PM, int @Threshold); [DllImport(libraryPath, EntryPoint = "LLVMAddSimplifyLibCallsPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddSimplifyLibCallsPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddTailCallEliminationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddTailCallEliminationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddConstantPropagationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddConstantPropagationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddDemoteMemoryToRegisterPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddDemoteMemoryToRegisterPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddVerifierPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddVerifierPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddCorrelatedValuePropagationPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddCorrelatedValuePropagationPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddEarlyCSEPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddEarlyCSEPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLowerExpectIntrinsicPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLowerExpectIntrinsicPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddTypeBasedAliasAnalysisPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddTypeBasedAliasAnalysisPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddScopedNoAliasAAPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddScopedNoAliasAAPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddBasicAliasAnalysisPass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddBasicAliasAnalysisPass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddBBVectorizePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddBBVectorizePass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddLoopVectorizePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddLoopVectorizePass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMAddSLPVectorizePass", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void AddSLPVectorizePass(LLVMPassManagerRef @PM); [DllImport(libraryPath, EntryPoint = "LLVMGetPersonalityFn", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern LLVMValueRef GetPersonalityFunction(LLVMValueRef function); [DllImport(libraryPath, EntryPoint = "LLVMSetPersonalityFn", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern void SetPersonalityFunction(LLVMValueRef function, LLVMValueRef personalityFunction); } }
82.57906
339
0.771111
[ "MIT" ]
NETMF/llilum
Zelig/Zelig/CompileTime/Llvm.NET/Llvm.NET/LLVM/Generated.cs
268,960
C#
using System; using System.Collections.Generic; using System.Text; namespace OKExSDK.Models.Spot { public class SpotOrderMarket : SpotOrder { /// <summary> /// 买入金额,市价买入是必填notional /// </summary> public string notional { get; set; } } }
18.866667
44
0.618375
[ "Apache-2.0" ]
yellow001/CoinAPP_Server
OKExSDK/Models/Spot/SpotOrderMarket.cs
309
C#
namespace Novell.Directory.Ldap.Sasl { public class SaslCramMd5Request : SaslRequest { public SaslCramMd5Request() : base(SaslConstants.Mechanism.CramMd5) { } public SaslCramMd5Request(string username, string password) : this() { AuthorizationId = username; Credentials = password.IsNotEmpty() ? password.ToUtf8Bytes() : null; } } }
24.611111
80
0.586907
[ "MIT" ]
dogguts/Novell.Directory.Ldap.NETStandard
src/Novell.Directory.Ldap.NETStandard/Sasl/SaslCramMd5Request.cs
445
C#
namespace Intro.Api.Web.Areas.HelpPage { /// <summary> /// Indicates whether the sample is used for request or response /// </summary> public enum SampleDirection { Request = 0, Response } }
20.909091
68
0.604348
[ "MIT" ]
Miruken-DotNet/Presentation-AspNet-Intro
Intro.Api.Web/Areas/HelpPage/SampleGeneration/SampleDirection.cs
230
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Net; using System.Net.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.ReverseProxy.Abstractions; using Microsoft.ReverseProxy.RuntimeModel; using Microsoft.ReverseProxy.Service.Management; using Moq; using Xunit; namespace Microsoft.ReverseProxy.Service.HealthChecks { public class ConsecutiveFailuresHealthPolicyTests { [Fact] public void ProbingCompleted_FailureThresholdExceeded_MarkDestinationUnhealthy() { var options = Options.Create(new ConsecutiveFailuresHealthPolicyOptions { DefaultThreshold = 2 }); var policy = new ConsecutiveFailuresHealthPolicy(options, new Mock<ILogger<ConsecutiveFailuresHealthPolicy>>().Object); var cluster0 = GetClusterInfo("cluster0", destinationCount: 2); var cluster1 = GetClusterInfo("cluster0", destinationCount: 2, failureThreshold: 3); var probingResults0 = new[] { new DestinationProbingResult(cluster0.DestinationManager.Items[0], new HttpResponseMessage(HttpStatusCode.InternalServerError), null), new DestinationProbingResult(cluster0.DestinationManager.Items[1], new HttpResponseMessage(HttpStatusCode.OK), null) }; var probingResults1 = new[] { new DestinationProbingResult(cluster1.DestinationManager.Items[0], new HttpResponseMessage(HttpStatusCode.OK), null), new DestinationProbingResult(cluster1.DestinationManager.Items[1], null, new InvalidOperationException()) }; Assert.Equal(HealthCheckConstants.ActivePolicy.ConsecutiveFailures, policy.Name); // Initial state Assert.All(cluster0.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Unknown, d.Health.Active)); Assert.All(cluster1.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Unknown, d.Health.Active)); // First probing attempt policy.ProbingCompleted(cluster0, probingResults0); Assert.All(cluster0.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Healthy, d.Health.Active)); policy.ProbingCompleted(cluster1, probingResults1); Assert.All(cluster1.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Healthy, d.Health.Active)); // Second probing attempt policy.ProbingCompleted(cluster0, probingResults0); Assert.Equal(DestinationHealth.Unhealthy, cluster0.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Healthy, cluster0.DestinationManager.Items[1].Health.Active); policy.ProbingCompleted(cluster1, probingResults1); Assert.All(cluster1.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Healthy, d.Health.Active)); // Third probing attempt policy.ProbingCompleted(cluster0, probingResults0); Assert.Equal(DestinationHealth.Unhealthy, cluster0.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Healthy, cluster0.DestinationManager.Items[1].Health.Active); policy.ProbingCompleted(cluster1, probingResults1); Assert.Equal(DestinationHealth.Healthy, cluster1.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Unhealthy, cluster1.DestinationManager.Items[1].Health.Active); Assert.All(cluster0.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Unknown, d.Health.Passive)); Assert.All(cluster1.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Unknown, d.Health.Passive)); } [Fact] public void ProbingCompleted_SuccessfulResponse_MarkDestinationHealthy() { var options = Options.Create(new ConsecutiveFailuresHealthPolicyOptions { DefaultThreshold = 2 }); var policy = new ConsecutiveFailuresHealthPolicy(options, new Mock<ILogger<ConsecutiveFailuresHealthPolicy>>().Object); var cluster = GetClusterInfo("cluster0", destinationCount: 2); var probingResults = new[] { new DestinationProbingResult(cluster.DestinationManager.Items[0], new HttpResponseMessage(HttpStatusCode.InternalServerError), null), new DestinationProbingResult(cluster.DestinationManager.Items[1], new HttpResponseMessage(HttpStatusCode.OK), null) }; for (var i = 0; i < 2; i++) { policy.ProbingCompleted(cluster, probingResults); } Assert.Equal(DestinationHealth.Unhealthy, cluster.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Healthy, cluster.DestinationManager.Items[1].Health.Active); policy.ProbingCompleted(cluster, new[] { new DestinationProbingResult(cluster.DestinationManager.Items[0], new HttpResponseMessage(HttpStatusCode.OK), null) }); Assert.Equal(DestinationHealth.Healthy, cluster.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Healthy, cluster.DestinationManager.Items[1].Health.Active); Assert.All(cluster.DestinationManager.Items, d => Assert.Equal(DestinationHealth.Unknown, d.Health.Passive)); } [Fact] public void ProbingCompleted_EmptyProbingResultList_DoNothing() { var options = Options.Create(new ConsecutiveFailuresHealthPolicyOptions { DefaultThreshold = 2 }); var policy = new ConsecutiveFailuresHealthPolicy(options, new Mock<ILogger<ConsecutiveFailuresHealthPolicy>>().Object); var cluster = GetClusterInfo("cluster0", destinationCount: 2); var probingResults = new[] { new DestinationProbingResult(cluster.DestinationManager.Items[0], new HttpResponseMessage(HttpStatusCode.InternalServerError), null), new DestinationProbingResult(cluster.DestinationManager.Items[1], new HttpResponseMessage(HttpStatusCode.OK), null) }; for (var i = 0; i < 2; i++) { policy.ProbingCompleted(cluster, probingResults); } Assert.Equal(DestinationHealth.Unhealthy, cluster.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Healthy, cluster.DestinationManager.Items[1].Health.Active); policy.ProbingCompleted(cluster, new DestinationProbingResult[0]); Assert.Equal(DestinationHealth.Unhealthy, cluster.DestinationManager.Items[0].Health.Active); Assert.Equal(DestinationHealth.Healthy, cluster.DestinationManager.Items[1].Health.Active); } private ClusterInfo GetClusterInfo(string id, int destinationCount, int? failureThreshold = null) { var metadata = failureThreshold != null ? new Dictionary<string, string> { { ConsecutiveFailuresHealthPolicyOptions.ThresholdMetadataName, failureThreshold.ToString() } } : null; var clusterConfig = new ClusterConfig( new Cluster { Id = id }, new ClusterHealthCheckOptions(default, new ClusterActiveHealthCheckOptions(true, null, null, "policy", "/api/health/")), default, default, null, default, metadata); var clusterInfo = new ClusterInfo(id, new DestinationManager()); clusterInfo.Config = clusterConfig; for (var i = 0; i < destinationCount; i++) { var destinationConfig = new DestinationConfig($"https://localhost:1000{i}/{id}/", $"https://localhost:2000{i}/{id}/"); var destinationId = $"destination{i}"; clusterInfo.DestinationManager.GetOrCreateItem(destinationId, d => { d.Config = destinationConfig; }); } return clusterInfo; } } }
54.07947
172
0.682709
[ "MIT" ]
jrunyen/reverse-proxy
test/ReverseProxy.Tests/Service/HealthChecks/ConsecutiveFailuresHealthPolicyTests.cs
8,166
C#
// Decompiled with JetBrains decompiler // Type: Diga.WebView2.Interop.COREWEBVIEW2_KEY_EVENT_KIND // Assembly: Diga.WebView2.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: E0C0240C-E7D7-45C8-B13A-ACBB49432772 // Assembly location: O:\webview2\V9622\Diga.WebView2.Interop.dll namespace Diga.WebView2.Interop { public enum COREWEBVIEW2_KEY_EVENT_KIND { COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN, COREWEBVIEW2_KEY_EVENT_KIND_KEY_UP, COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN, COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_UP, } }
33.352941
89
0.811287
[ "MIT" ]
ITAgnesmeyer/Diga.WebView2
Archive/V109634/Diga.WebView2.Interop.V109634/COREWEBVIEW2_KEY_EVENT_KIND.cs
569
C#
namespace Vanguard.Framework.Core.Parsers { using System; /// <summary> /// The integer 64 bit converter. /// </summary> /// <seealso cref="TypeConverterBase" /> internal class Int64Converter : TypeConverterBase { /// <inheritdoc /> public override object? Convert(string value) { Guard.ArgumentNotNullOrEmpty(value, nameof(value)); if (IsNullValue(value)) { return null; } else if (long.TryParse(value, out var result)) { return result; } throw new FormatException($"{value} is not a valid Int64 value."); } } }
25.285714
78
0.526836
[ "MIT" ]
jgveire/Vanguard.Framework
src/Vanguard.Framework.Core/Parsers/Int64Converter.cs
710
C#
// --------------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // // The MIT License (MIT) // // 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.Runtime.Serialization; using Windows.Devices.Geolocation; using Windows.Foundation; using Windows.Services.Maps; namespace Location { /// <summary> /// Represents a saved location for use in tracking travel time, distance, and routes. /// </summary> public class LocationData : BindableBase { private string name; /// <summary> /// Gets or sets the name of the location. /// </summary> public string Name { get { return this.name; } set { this.SetProperty(ref this.name, value); } } private string address; /// <summary> /// Gets or sets the address of the location. /// </summary> public string Address { get { return this.address; } set { this.SetProperty(ref this.address, value); } } private BasicGeoposition position; /// <summary> /// Gets the geographic position of the location. /// </summary> public BasicGeoposition Position { get { return this.position; } set { this.SetProperty(ref this.position, value); this.OnPropertyChanged(nameof(Geopoint)); } } /// <summary> /// Gets a Geopoint representation of the current location for use with the map service APIs. /// </summary> public Geopoint Geopoint => new Geopoint(this.Position); private bool isCurrentLocation; /// <summary> /// Gets or sets a value that indicates whether the location represents the user's current location. /// </summary> public bool IsCurrentLocation { get { return this.isCurrentLocation; } set { this.SetProperty(ref this.isCurrentLocation, value); this.OnPropertyChanged(nameof(NormalizedAnchorPoint)); } } private bool isSelected; /// <summary> /// Gets or sets a value that indicates whether the location is /// the currently selected one in the list of saved locations. /// </summary> [IgnoreDataMember] public bool IsSelected { get { return this.isSelected; } set { this.SetProperty(ref this.isSelected, value); this.OnPropertyChanged(nameof(ImageSource)); } } /// <summary> /// Gets a path to an image to use as a map pin, reflecting the IsSelected property value. /// </summary> public string ImageSource => IsSelected ? "Assets/mappin-yellow.png" : "Assets/mappin.png"; private Point centerpoint = new Point(0.5, 0.5); private Point pinpoint = new Point(0.5, 0.9778); /// <summary> /// Gets a value for the MapControl.NormalizedAnchorPoint attached property /// to reflect the different map icon used for the user's current location. /// </summary> public Point NormalizedAnchorPoint => IsCurrentLocation ? centerpoint : pinpoint; private MapRoute fastestRoute; /// <summary> /// Gets or sets the route with the shortest travel time to the /// location from the user's current position. /// </summary> [IgnoreDataMember] public MapRoute FastestRoute { get { return this.fastestRoute; } set { this.SetProperty(ref this.fastestRoute, value); } } private int currentTravelTimeWithoutTraffic; /// <summary> /// Gets or sets the number of minutes it takes to drive to the location, /// without taking traffic into consideration. /// </summary> public int CurrentTravelTimeWithoutTraffic { get { return this.currentTravelTimeWithoutTraffic; } set { this.SetProperty(ref this.currentTravelTimeWithoutTraffic, value); } } private int currentTravelTime; /// <summary> /// Gets or sets the number of minutes it takes to drive to the location, /// taking traffic into consideration. /// </summary> public int CurrentTravelTime { get { return this.currentTravelTime; } set { this.SetProperty(ref this.currentTravelTime, value); this.OnPropertyChanged(nameof(FormattedCurrentTravelTime)); } } /// <summary> /// Gets a display-string representation of the current travel time. /// </summary> public string FormattedCurrentTravelTime => this.CurrentTravelTime == 0 ? "??:??" : new TimeSpan(0, this.CurrentTravelTime, 0).ToString("hh\\:mm"); private double currentTravelDistance; /// <summary> /// Gets or sets the current driving distance to the location, in miles. /// </summary> public double CurrentTravelDistance { get { return this.currentTravelDistance; } set { this.SetProperty(ref this.currentTravelDistance, value); this.OnPropertyChanged(nameof(FormattedCurrentTravelDistance)); } } /// <summary> /// Gets a display-string representation of the current travel distance. /// </summary> public string FormattedCurrentTravelDistance => this.CurrentTravelDistance == 0 ? "?? miles" : this.CurrentTravelDistance + " miles"; private DateTimeOffset timestamp; /// <summary> /// Gets or sets a value that indicates when the travel info was last updated. /// </summary> public DateTimeOffset Timestamp { get { return this.timestamp; } set { this.SetProperty(ref this.timestamp, value); this.OnPropertyChanged(nameof(FormattedTimeStamp)); } } /// <summary> /// Raises a change notification for the timestamp in order to update databound UI. /// </summary> public void RefreshFormattedTimestamp() => this.OnPropertyChanged(nameof(FormattedTimeStamp)); /// <summary> /// Gets a display-string representation of the freshness timestamp. /// </summary> public string FormattedTimeStamp { get { double minutesAgo = this.Timestamp == DateTimeOffset.MinValue ? 0 : Math.Floor((DateTimeOffset.Now - this.Timestamp).TotalMinutes); return $"{minutesAgo} minute{(minutesAgo == 1 ? "" : "s")} ago"; } } private bool isMonitored; /// <summary> /// Gets or sets a value that indicates whether this location is /// being monitored for an increase in travel time due to traffic. /// </summary> public bool IsMonitored { get { return this.isMonitored; } set { this.SetProperty(ref this.isMonitored, value); } } /// <summary> /// Resets the travel time and distance values to 0, which indicates an unknown value. /// </summary> public void ClearTravelInfo() { this.CurrentTravelDistance = 0; this.currentTravelTime = 0; this.Timestamp = DateTimeOffset.Now; } /// <summary> /// Returns the name of the location, or the geocoordinates if there is no name. /// </summary> /// <returns></returns> public override string ToString() => String.IsNullOrEmpty(this.Name) ? $"{this.Position.Latitude}, {this.Position.Longitude}" : this.Name; /// <summary> /// Return a new LocationData with the same property values as the current one. /// </summary> /// <returns>The new LocationData instance.</returns> public LocationData Clone() { var location = new LocationData(); location.Copy(this); return location; } /// <summary> /// Copies the property values of the specified location into the current location. /// </summary> /// <param name="location">The location to copy the values from.</param> public void Copy(LocationData location) { this.Name = location.Name; this.Address = location.Address; this.Position = location.Position; this.CurrentTravelDistance = location.CurrentTravelDistance; this.CurrentTravelTime = location.CurrentTravelTime; this.Timestamp = location.Timestamp; this.IsMonitored = location.IsMonitored; } } }
37.49635
108
0.583317
[ "MIT" ]
Bhaskers-Blu-Org2/Windows-appsample-trafficapp
LocationHelper/LocationData.cs
10,276
C#
using System; using System.Collections.Generic; using System.Text; namespace MainLibrary { public static class CLIUtils { public static void WaitForExit() { Console.Write("Press any key to exit... "); Console.ReadKey(); } } }
18
55
0.590278
[ "MIT" ]
r-mura/CSharpCodeAcademy
HelloCSharpUniverse/MainLibrary/CLIUtils.cs
290
C#
using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Loader; using static WorkspaceServer.Kernel.CSharpKernelExtensions; namespace MLS.Agent { public class NativeAssemblyLoadHelper : INativeAssemblyLoadHelper { private AssemblyDependencyResolver _resolver; public NativeAssemblyLoadHelper() { } public void Configure(string path) { if (_resolver != null) { return; } _resolver = new AssemblyDependencyResolver(path); } public void Handle(string assembly) { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyLoad += AssemblyLoaded(assembly); } private AssemblyLoadEventHandler AssemblyLoaded(string assembly) { return (object sender, AssemblyLoadEventArgs args) => { if (args.LoadedAssembly.Location == assembly) { NativeLibrary.SetDllImportResolver(args.LoadedAssembly, Resolve); } }; } private IntPtr Resolve(string libraryName, Assembly assembly, DllImportSearchPath? searchPath) { var path = _resolver.ResolveUnmanagedDllToPath(libraryName); return NativeLibrary.Load(path); } } }
27.557692
102
0.610607
[ "MIT" ]
siyabongaprospersithole/try
MLS.Agent/NativeAssemblyLoadHelper.cs
1,435
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Diagnostics; namespace Internal.TypeSystem { // This is the api surface necessary to query the field layout of a type public abstract partial class DefType : TypeDesc { /// <summary> /// Bit flags for layout /// </summary> private class FieldLayoutFlags { /// <summary> /// True if ContainsGCPointers has been computed /// </summary> public const int ComputedContainsGCPointers = 1; /// <summary> /// True if the type contains GC pointers /// </summary> public const int ContainsGCPointers = 2; /// <summary> /// True if the instance type only layout is computed /// </summary> public const int ComputedInstanceTypeLayout = 4; /// <summary> /// True if the static field layout for the static regions have been computed /// </summary> public const int ComputedStaticRegionLayout = 8; /// <summary> /// True if the instance type layout is complete including fields /// </summary> public const int ComputedInstanceTypeFieldsLayout = 0x10; /// <summary> /// True if the static field layout for the static fields have been computed /// </summary> public const int ComputedStaticFieldsLayout = 0x20; /// <summary> /// True if information about the shape of value type has been computed. /// </summary> public const int ComputedValueTypeShapeCharacteristics = 0x40; } private class StaticBlockInfo { public StaticsBlock NonGcStatics; public StaticsBlock GcStatics; public StaticsBlock ThreadStatics; } ThreadSafeFlags _fieldLayoutFlags; LayoutInt _instanceFieldSize; LayoutInt _instanceFieldAlignment; LayoutInt _instanceByteCountUnaligned; LayoutInt _instanceByteAlignment; // Information about various static blocks is rare, so we keep it out of line. StaticBlockInfo _staticBlockInfo; ValueTypeShapeCharacteristics _valueTypeShapeCharacteristics; /// <summary> /// Does a type transitively have any fields which are GC object pointers /// </summary> public bool ContainsGCPointers { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedContainsGCPointers)) { ComputeTypeContainsGCPointers(); } return _fieldLayoutFlags.HasFlags(FieldLayoutFlags.ContainsGCPointers); } } /// <summary> /// The number of bytes required to hold a field of this type /// </summary> public LayoutInt InstanceFieldSize { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeLayout)) { ComputeInstanceLayout(InstanceLayoutKind.TypeOnly); } return _instanceFieldSize; } } /// <summary> /// What is the alignment requirement of the fields of this type /// </summary> public LayoutInt InstanceFieldAlignment { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeLayout)) { ComputeInstanceLayout(InstanceLayoutKind.TypeOnly); } return _instanceFieldAlignment; } } /// <summary> /// The number of bytes required when allocating this type on this GC heap /// </summary> public LayoutInt InstanceByteCount { get { return LayoutInt.AlignUp(InstanceByteCountUnaligned, InstanceByteAlignment); } } /// <summary> /// The number of bytes used by the instance fields of this type and its parent types without padding at the end for alignment/gc. /// </summary> public LayoutInt InstanceByteCountUnaligned { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeLayout)) { ComputeInstanceLayout(InstanceLayoutKind.TypeOnly); } return _instanceByteCountUnaligned; } } /// <summary> /// The alignment required for instances of this type on the GC heap /// </summary> public LayoutInt InstanceByteAlignment { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeLayout)) { ComputeInstanceLayout(InstanceLayoutKind.TypeOnly); } return _instanceByteAlignment; } } /// <summary> /// How many bytes must be allocated to represent the non GC visible static fields of this type. /// </summary> public LayoutInt NonGCStaticFieldSize { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.NonGcStatics.Size; } } /// <summary> /// What is the alignment required for allocating the non GC visible static fields of this type. /// </summary> public LayoutInt NonGCStaticFieldAlignment { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.NonGcStatics.LargestAlignment; } } /// <summary> /// How many bytes must be allocated to represent the GC visible static fields of this type. /// </summary> public LayoutInt GCStaticFieldSize { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.GcStatics.Size; } } /// <summary> /// What is the alignment required for allocating the GC visible static fields of this type. /// </summary> public LayoutInt GCStaticFieldAlignment { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.GcStatics.LargestAlignment; } } /// <summary> /// How many bytes must be allocated to represent the (potentially GC visible) thread static /// fields of this type. /// </summary> public LayoutInt ThreadStaticFieldSize { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadStatics.Size; } } /// <summary> /// What is the alignment required for allocating the (potentially GC visible) thread static /// fields of this type. /// </summary> public LayoutInt ThreadStaticFieldAlignment { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadStatics.LargestAlignment; } } /// <summary> /// Gets a value indicating whether the fields of the type satisfy the Homogeneous Float Aggregate classification. /// </summary> public bool IsHfa { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedValueTypeShapeCharacteristics)) { ComputeValueTypeShapeCharacteristics(); } return (_valueTypeShapeCharacteristics & ValueTypeShapeCharacteristics.HomogenousFloatAggregate) != 0; } } internal ValueTypeShapeCharacteristics ValueTypeShapeCharacteristics { get { if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedValueTypeShapeCharacteristics)) { ComputeValueTypeShapeCharacteristics(); } return _valueTypeShapeCharacteristics; } } /// <summary> /// Get the Homogeneous Float Aggregate element type if this is a HFA type (<see cref="IsHfa"/> is true). /// </summary> public DefType HfaElementType { get { // We are not caching this because this is rare and not worth wasting space in DefType. return this.Context.GetLayoutAlgorithmForType(this).ComputeHomogeneousFloatAggregateElementType(this); } } private void ComputeValueTypeShapeCharacteristics() { _valueTypeShapeCharacteristics = this.Context.GetLayoutAlgorithmForType(this).ComputeValueTypeShapeCharacteristics(this); _fieldLayoutFlags.AddFlags(FieldLayoutFlags.ComputedValueTypeShapeCharacteristics); } public void ComputeInstanceLayout(InstanceLayoutKind layoutKind) { if (_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeFieldsLayout | FieldLayoutFlags.ComputedInstanceTypeLayout)) return; var computedLayout = this.Context.GetLayoutAlgorithmForType(this).ComputeInstanceLayout(this, layoutKind); _instanceFieldSize = computedLayout.FieldSize; _instanceFieldAlignment = computedLayout.FieldAlignment; _instanceByteCountUnaligned = computedLayout.ByteCountUnaligned; _instanceByteAlignment = computedLayout.ByteCountAlignment; if (computedLayout.Offsets != null) { foreach (var fieldAndOffset in computedLayout.Offsets) { Debug.Assert(fieldAndOffset.Field.OwningType == this); fieldAndOffset.Field.InitializeOffset(fieldAndOffset.Offset); } _fieldLayoutFlags.AddFlags(FieldLayoutFlags.ComputedInstanceTypeFieldsLayout); } _fieldLayoutFlags.AddFlags(FieldLayoutFlags.ComputedInstanceTypeLayout); } public void ComputeStaticFieldLayout(StaticLayoutKind layoutKind) { if (_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticFieldsLayout | FieldLayoutFlags.ComputedStaticRegionLayout)) return; var computedStaticLayout = this.Context.GetLayoutAlgorithmForType(this).ComputeStaticFieldLayout(this, layoutKind); if ((computedStaticLayout.NonGcStatics.Size != LayoutInt.Zero) || (computedStaticLayout.GcStatics.Size != LayoutInt.Zero) || (computedStaticLayout.ThreadStatics.Size != LayoutInt.Zero)) { var staticBlockInfo = new StaticBlockInfo { NonGcStatics = computedStaticLayout.NonGcStatics, GcStatics = computedStaticLayout.GcStatics, ThreadStatics = computedStaticLayout.ThreadStatics }; _staticBlockInfo = staticBlockInfo; } if (computedStaticLayout.Offsets != null) { foreach (var fieldAndOffset in computedStaticLayout.Offsets) { Debug.Assert(fieldAndOffset.Field.OwningType == this); fieldAndOffset.Field.InitializeOffset(fieldAndOffset.Offset); } _fieldLayoutFlags.AddFlags(FieldLayoutFlags.ComputedStaticFieldsLayout); } _fieldLayoutFlags.AddFlags(FieldLayoutFlags.ComputedStaticRegionLayout); } public void ComputeTypeContainsGCPointers() { if (_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedContainsGCPointers)) return; int flagsToAdd = FieldLayoutFlags.ComputedContainsGCPointers; if (!IsValueType && HasBaseType && BaseType.ContainsGCPointers) { _fieldLayoutFlags.AddFlags(flagsToAdd | FieldLayoutFlags.ContainsGCPointers); return; } if (this.Context.GetLayoutAlgorithmForType(this).ComputeContainsGCPointers(this)) { flagsToAdd |= FieldLayoutFlags.ContainsGCPointers; } _fieldLayoutFlags.AddFlags(flagsToAdd); } } }
37.35809
140
0.58783
[ "MIT" ]
anydream/corert
src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs
14,084
C#
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Generated code. DO NOT EDIT! namespace Google.Cloud.Dialogflow.V2.Snippets { // [START dialogflow_v2_generated_Participants_SuggestFaqAnswers_async_flattened] using Google.Cloud.Dialogflow.V2; using System.Threading.Tasks; public sealed partial class GeneratedParticipantsClientSnippets { /// <summary>Snippet for SuggestFaqAnswersAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task SuggestFaqAnswersAsync() { // Create client ParticipantsClient participantsClient = await ParticipantsClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/conversations/[CONVERSATION]/participants/[PARTICIPANT]"; // Make the request SuggestFaqAnswersResponse response = await participantsClient.SuggestFaqAnswersAsync(parent); } } // [END dialogflow_v2_generated_Participants_SuggestFaqAnswers_async_flattened] }
41.619048
105
0.717391
[ "Apache-2.0" ]
AlexandrTrf/google-cloud-dotnet
apis/Google.Cloud.Dialogflow.V2/Google.Cloud.Dialogflow.V2.GeneratedSnippets/ParticipantsClient.SuggestFaqAnswersAsyncSnippet.g.cs
1,748
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using MongoDB.Bson; using MongoDB.Driver.Builders; using MongoDB.Driver.Core.Configuration; using MongoDB.Driver.Core.Events.Diagnostics; namespace MongoDB.Driver.TestConsoleApplication { public class Api { private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); public void Run(int numConcurrentWorkers, Action<ClusterBuilder> configurator) { try { RunAsync(numConcurrentWorkers, configurator).GetAwaiter().GetResult(); } catch (Exception ex) { Console.WriteLine("Unhandled exception:"); Console.WriteLine(ex.ToString()); } Console.WriteLine("Press Enter to exit"); Console.ReadLine(); } public async Task RunAsync(int numConcurrentWorkers, Action<ClusterBuilder> configurator) { var settings = new MongoClientSettings(); settings.ClusterConfigurator = configurator; settings.OperationTimeout = TimeSpan.FromSeconds(5); var client = new MongoClient(settings); var db = client.GetDatabase("foo"); var collection = db.GetCollection<BsonDocument>("bar"); Console.WriteLine("Press Enter to begin"); Console.ReadLine(); Console.WriteLine("Clearing Data"); await ClearData(collection); Console.WriteLine("Inserting Seed Data"); await InsertData(collection); Console.WriteLine("Running CRUD (errors will show up as + (query error) or * (insert/update error))"); var tasks = new List<Task>(); for (int i = 0; i < numConcurrentWorkers; i++) { tasks.Add(DoWork(collection)); } Console.WriteLine("Press Enter to shutdown"); Console.ReadLine(); _cancellationTokenSource.Cancel(); Task.WaitAll(tasks.ToArray()); } private async Task DoWork(IMongoCollection<BsonDocument> collection) { var rand = new Random(); while(!_cancellationTokenSource.IsCancellationRequested) { var i = rand.Next(0, 10000); List<BsonDocument> docs; try { docs = await collection.Find(new BsonDocument("i", i)) .ToListAsync(_cancellationTokenSource.Token); } catch { Console.Write("+"); continue; } if(docs.Count == 0) { try { await collection.InsertOneAsync(new BsonDocument("i", i), _cancellationTokenSource.Token); } catch { Console.Write("*"); } } else { try { var filter = new QueryDocument("_id", docs[0]["_id"]); var update = new UpdateDocument("$set", new BsonDocument("i", i + 1)); await collection.UpdateOneAsync(filter, update, cancellationToken: _cancellationTokenSource.Token); //Console.Write("."); } catch (Exception) { Console.Write("*"); } } } } private Task ClearData(IMongoCollection<BsonDocument> collection) { return collection.DeleteManyAsync("{}", _cancellationTokenSource.Token); } private async Task InsertData(IMongoCollection<BsonDocument> collection) { for (int i = 0; i < 100; i++) { await collection.InsertOneAsync(new BsonDocument("i", i), _cancellationTokenSource.Token); } } } }
32.784615
123
0.516893
[ "Apache-2.0" ]
mfloryan/mongo-csharp-driver
src/MongoDB.Driver.TestConsoleApplication/Api.cs
4,264
C#
namespace Ianitor.Osp.Backend.Identity.ViewModels.Account { public class RedirectViewModel { public string RedirectUrl { get; set; } } }
22.285714
57
0.692308
[ "MIT" ]
ianitor/ObjectServicePlatform
Osp/Backend/Ianitor.Osp.Backend.Identity/ViewModels/Account/RedirectViewModel.cs
156
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace AstroWorld.Common { public class Rotator : MonoBehaviour { public enum Direction { xAxis, yAxis, zAxis }; public Direction direction; public float rotationSpeed = 5f; /// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// </summary> void Update() { switch (direction) { case Direction.xAxis: transform.Rotate(Vector3.right * rotationSpeed); break; case Direction.yAxis: transform.Rotate(Vector3.up * rotationSpeed); break; case Direction.zAxis: transform.Rotate(Vector3.forward * rotationSpeed); break; } } } }
24.375
74
0.497436
[ "MIT" ]
Rud156/AstroWorld
Assets/Scripts/Common/Rotator.cs
977
C#
namespace GestionZoo.Models { public class Agent : Personne { public string NumeroMatricule { get; set; } } }
18.428571
51
0.635659
[ "MIT" ]
passyweb/csharp-codes
GestionZoo/Models/Agent.cs
129
C#
using Raider.Validation.Test.Model; using Raider.Validation.Test.Validators; using System; using System.Collections.Generic; using System.Diagnostics; using Xunit; using Xunit.Abstractions; namespace Raider.Validation.Test { public class ComplexValidationTest { private readonly ITestOutputHelper _output; public ComplexValidationTest(ITestOutputHelper output) { _output = output ?? throw new ArgumentNullException(nameof(output)); } [Fact] public void Nullable_Flat_NoError() { var person = new Person { MyStringNullable = "test@email.com", MyIntNullable = 5, MyDateTimeNullable = DateTime.Now, MyDecimalNullable = 12.34m, ANullable = new A { AStringNullable = "test@email.com", AIntNullable = 5, ADateTimeNullable = DateTime.Now, ADecimalNullable = 12.34m, }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddStringNullable = "test@email.com", AddIntNullable = 5, AddDateTimeNullable = DateTime.Now, AddDecimalNullable = 12.34m }, new Address { AddStringNullable = "test@email.com", AddIntNullable = 5, AddDateTimeNullable = DateTime.Now, AddDecimalNullable = 12.34m }, } }; var validator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.EmailAddress()) .ForProperty(x => x.MyStringNullable, x => x.MaxLength(14)) .ForProperty(x => x.MyStringNullable, x => x.RegEx(@"^[a-z]{4}@[a-z]{5}.com$")) .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyStringNullable, x => x.NotNull()) .ForProperty(x => x.MyIntNullable, x => x.EqualsTo(5)) .ForProperty(x => x.MyIntNullable, x => x.NotEqualsTo(6)) .ForProperty(x => x.MyIntNullable, x => x.ExclusiveBetween(4, 6)) .ForProperty(x => x.MyIntNullable, x => x.InclusiveBetween(5, 5)) .ForProperty(x => x.MyIntNullable, x => x.GreaterThanOrEqual(5)) .ForProperty(x => x.MyIntNullable, x => x.GreaterThan(4)) .ForProperty(x => x.MyIntNullable, x => x.LessThanOrEqual(5)) .ForProperty(x => x.MyIntNullable, x => x.LessThan(6)) .ForProperty(x => x.MyIntNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyIntNullable, x => x.NotNull()) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x.EmailAddress()) .ForProperty(x => x.AStringNullable, x => x.MaxLength(14)) .ForProperty(x => x.AStringNullable, x => x.RegEx(@"^[a-z]{4}@[a-z]{5}.com$")) .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AStringNullable, x => x.NotNull()) .ForProperty(x => x.AIntNullable, x => x.EqualsTo(5)) .ForProperty(x => x.AIntNullable, x => x.NotEqualsTo(6)) .ForProperty(x => x.AIntNullable, x => x.ExclusiveBetween(4, 6)) .ForProperty(x => x.AIntNullable, x => x.InclusiveBetween(5, 5)) .ForProperty(x => x.AIntNullable, x => x.GreaterThanOrEqual(5)) .ForProperty(x => x.AIntNullable, x => x.GreaterThan(4)) .ForProperty(x => x.AIntNullable, x => x.LessThanOrEqual(5)) .ForProperty(x => x.AIntNullable, x => x.LessThan(6)) .ForProperty(x => x.AIntNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AIntNullable, x => x.NotNull()) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x.EmailAddress()) .ForProperty(x => x.AddStringNullable, x => x.MaxLength(14)) .ForProperty(x => x.AddStringNullable, x => x.RegEx(@"^[a-z]{4}@[a-z]{5}.com$")) .ForProperty(x => x.AddStringNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddStringNullable, x => x.NotNull()) .ForProperty(x => x.AddIntNullable, x => x.EqualsTo(5)) .ForProperty(x => x.AddIntNullable, x => x.NotEqualsTo(6)) .ForProperty(x => x.AddIntNullable, x => x.ExclusiveBetween(4, 6)) .ForProperty(x => x.AddIntNullable, x => x.InclusiveBetween(5, 5)) .ForProperty(x => x.AddIntNullable, x => x.GreaterThanOrEqual(5)) .ForProperty(x => x.AddIntNullable, x => x.GreaterThan(4)) .ForProperty(x => x.AddIntNullable, x => x.LessThanOrEqual(5)) .ForProperty(x => x.AddIntNullable, x => x.LessThan(6)) .ForProperty(x => x.AddIntNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddIntNullable, x => x.NotNull()) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false))) ; var result = validator.Validate(person); Assert.Equal(0, result.Errors.Count); } [Fact] public void Nullable_Chained_NoError() { var person = new Person { MyStringNullable = "test@email.com", MyIntNullable = 5, MyDateTimeNullable = DateTime.Now, MyDecimalNullable = 12.34m, ANullable = new A { AStringNullable = "test@email.com", AIntNullable = 5, ADateTimeNullable = DateTime.Now, ADecimalNullable = 12.34m, }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddStringNullable = "test@email.com", AddIntNullable = 5, AddDateTimeNullable = DateTime.Now, AddDecimalNullable = 12.34m }, new Address { AddStringNullable = "test@email.com", AddIntNullable = 5, AddDateTimeNullable = DateTime.Now, AddDecimalNullable = 12.34m }, } }; var validator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x .EmailAddress() .MaxLength(14) .RegEx(@"^[a-z]{4}@[a-z]{5}.com$") .NotDefaultOrEmpty() .NotNull()) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(6) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(5) .GreaterThan(4) .LessThanOrEqual(5) .LessThan(6) .NotDefaultOrEmpty() .NotNull()) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x .EmailAddress() .MaxLength(14) .RegEx(@"^[a-z]{4}@[a-z]{5}.com$") .NotDefaultOrEmpty() .NotNull()) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(6) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(5) .GreaterThan(4) .LessThanOrEqual(5) .LessThan(6) .NotDefaultOrEmpty() .NotNull()) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x .EmailAddress() .MaxLength(14) .RegEx(@"^[a-z]{4}@[a-z]{5}.com$") .NotDefaultOrEmpty() .NotNull()) .ForProperty(x => x.AddIntNullable, x => x.EqualsTo(5) .EqualsTo(5) .NotEqualsTo(6) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(5) .GreaterThan(4) .LessThanOrEqual(5) .LessThan(6) .NotDefaultOrEmpty() .NotNull()) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false))) ; var result = validator.Validate(person); Assert.Equal(0, result.Errors.Count); } [Fact] public void Nullable_Flat_AllError() { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160 }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var validator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyStringNullable, x => x.NotNull()) .ForProperty(x => x.MyIntNullable, x => x.EqualsTo(5)) .ForProperty(x => x.MyIntNullable, x => x.NotEqualsTo(10)) .ForProperty(x => x.MyIntNullable, x => x.ExclusiveBetween(4, 6)) .ForProperty(x => x.MyIntNullable, x => x.InclusiveBetween(5, 5)) .ForProperty(x => x.MyIntNullable, x => x.GreaterThanOrEqual(15)) .ForProperty(x => x.MyIntNullable, x => x.GreaterThan(14)) .ForProperty(x => x.MyIntNullable, x => x.LessThanOrEqual(5)) .ForProperty(x => x.MyIntNullable, x => x.LessThan(6)) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AStringNullable, x => x.NotNull()) .ForProperty(x => x.AIntNullable, x => x.EqualsTo(5)) .ForProperty(x => x.AIntNullable, x => x.NotEqualsTo(10)) .ForProperty(x => x.AIntNullable, x => x.ExclusiveBetween(4, 6)) .ForProperty(x => x.AIntNullable, x => x.InclusiveBetween(5, 5)) .ForProperty(x => x.AIntNullable, x => x.GreaterThanOrEqual(15)) .ForProperty(x => x.AIntNullable, x => x.GreaterThan(14)) .ForProperty(x => x.AIntNullable, x => x.LessThanOrEqual(5)) .ForProperty(x => x.AIntNullable, x => x.LessThan(6)) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddStringNullable, x => x.NotNull()) .ForProperty(x => x.AddIntNullable, x => x.EqualsTo(5)) .ForProperty(x => x.AddIntNullable, x => x.NotEqualsTo(10)) .ForProperty(x => x.AddIntNullable, x => x.ExclusiveBetween(4, 6)) .ForProperty(x => x.AddIntNullable, x => x.InclusiveBetween(5, 5)) .ForProperty(x => x.AddIntNullable, x => x.GreaterThanOrEqual(15)) .ForProperty(x => x.AddIntNullable, x => x.GreaterThan(14)) .ForProperty(x => x.AddIntNullable, x => x.LessThanOrEqual(5)) .ForProperty(x => x.AddIntNullable, x => x.LessThan(6)) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false))) ; var result = validator.Validate(person); Assert.Equal(48, result.Errors.Count); } [Fact] public void Nullable_Chained_AllError() { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160 }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var validator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AddIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false))) ; var result = validator.Validate(person); Assert.Equal(48, result.Errors.Count); } [Fact] public void Complex1() { var person = new Person { MyStringNullable = "test@email.com", MyIntNullable = 5, MyDateTimeNullable = DateTime.Now, MyDecimalNullable = 12.34m, ANullable = new A { AStringNullable = "test@email.com", AIntNullable = 5, ADateTimeNullable = DateTime.Now, ADecimalNullable = 12.34m, }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddStringNullable = "test@email.com", AddIntNullable = 5, AddDateTimeNullable = DateTime.Now, AddDecimalNullable = 12.34m }, new Address { AddStringNullable = "test@email.com", AddIntNullable = 5, AddDateTimeNullable = DateTime.Now, AddDecimalNullable = 12.34m }, } }; var validator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x .EmailAddress() .MaxLength(14) .RegEx(@"^[a-z]{4}@[a-z]{5}.com$") .NotDefaultOrEmpty() .NotNull(), c => c.MyBoolNotNull == false) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(6) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(5) .GreaterThan(4) .LessThanOrEqual(5) .LessThan(6) .NotDefaultOrEmpty() .NotNull(), c => c.MyBoolNotNull == false) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x .EmailAddress() .MaxLength(14) .RegEx(@"^[a-z]{4}@[a-z]{5}.com$") .NotDefaultOrEmpty() .NotNull(), c => c.ABoolNotNull == false) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(6) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(5) .GreaterThan(4) .LessThanOrEqual(5) .LessThan(6) .NotDefaultOrEmpty() .NotNull(), c => c.ABoolNotNull == false) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x .EmailAddress() .MaxLength(14) .RegEx(@"^[a-z]{4}@[a-z]{5}.com$") .NotDefaultOrEmpty() .NotNull(), c => c.AddBoolNotNull == false) .ForProperty(x => x.AddIntNullable, x => x.EqualsTo(5) .EqualsTo(5) .NotEqualsTo(6) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(5) .GreaterThan(4) .LessThanOrEqual(5) .LessThan(6) .NotDefaultOrEmpty() .NotNull(), c => c.AddBoolNotNull == false) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false))) ; var result = validator.Validate(person); Assert.Equal(0, result.Errors.Count); } [Fact] public void Complex2() { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, MyBoolNotNull = true, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160, ABoolNotNull = true }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160, AddBoolNotNull = true }, new Address { AddIntNullable = 10, AddDecimalNullable = 160, AddBoolNotNull = true }, } }; var validator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty().NotNull(), c => c.MyBoolNotNull == false) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6), c => c.MyBoolNotNull == false) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty(), c => c.MyBoolNotNull == false) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false), c => c.MyBoolNotNull == false) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty(), c => c.MyBoolNotNull == false) .ForProperty(x => x.ANullable, x => x.NotNull(), c => c.MyBoolNotNull == false) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty().NotNull(), c => c.ABoolNotNull == false) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6), c => c.ABoolNotNull == false) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty(), c => c.ABoolNotNull == false) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false), c => c.ABoolNotNull == false)) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull(), c => c.MyBoolNotNull == false) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty(), c => c.MyBoolNotNull == false) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x.NotDefaultOrEmpty().NotNull(), c => c.AddBoolNotNull == false) .ForProperty(x => x.AddIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6), c => c.AddBoolNotNull == false) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty(), c => c.AddBoolNotNull == false) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false), c => c.AddBoolNotNull == false)) ; var result = validator.Validate(person); Assert.Equal(0, result.Errors.Count); } [Theory] [InlineData(true)] [InlineData(false)] public void Nullable_Chained_AllError_If(bool mainCondition) { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160 }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var validator = Validator<Person>.Rules() .If(a => mainCondition, y => y .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AddIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false)))) ; var result = validator.Validate(person); Assert.Equal(mainCondition ? 48 : 0, result.Errors.Count); } [Theory] [InlineData(true)] [InlineData(false)] public void Nullable_Chained_AllError_IfElse(bool mainCondition) { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160 }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var validator = Validator<Person>.Rules() .IfElse(a => mainCondition, y => y .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForProperty(x => x.ANullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ANullable, x => x.NotNull()) .ForNavigation(x => x.ANullable, x => x .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false))) .ForProperty(x => x.MyAddressesNullable, x => x.NotNull()) .ForProperty(x => x.MyAddressesNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.MyAddressesNullable, x => x .ForProperty(x => x.AddStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AddIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.AddDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.AddDecimalNullable, x => x.PrecisionScale(4, 2, false))), y => y .ForProperty(x => x.MyIntNullable, v => v.LessThan(0))) ; var result = validator.Validate(person); Assert.Equal(mainCondition ? 48 : 1, result.Errors.Count); } [Fact] public void MultipleValidators() { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160, BNullable = new B { BIntNullable = 10, BDecimalNullable = 160, CNullable = new C { CIntNullable = 10, CDecimalNullable = 160, CItemsNullable = new System.Collections.Generic.List<CItem> { new CItem { CItemIntNullable = 10, CItemDecimalNullable = 160 }, new CItem { CItemIntNullable = 10, CItemDecimalNullable = 160 } } }, BItemsNullable = new System.Collections.Generic.List<BItem> { new BItem { BItemIntNullable = 10, BItemDecimalNullable = 160 }, new BItem { BItemIntNullable = 10, BItemDecimalNullable = 160 } } }, }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var barProfileItemValidator = Validator<CItem>.Rules() .ForProperty(x => x.CItemStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.CItemIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.CItemDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.CItemDecimalNullable, x => x.PrecisionScale(4, 2, false)); var barProfileValidator = Validator<C>.Rules() .ForProperty(x => x.CStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.CIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.CDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.CDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForEach(x => x.CItemsNullable, x => barProfileItemValidator.AttachTo(x)); var fooProfileItemValidator = Validator<BItem>.Rules() .ForProperty(x => x.BItemStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.BItemIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.BItemDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.BItemDecimalNullable, x => x.PrecisionScale(4, 2, false)); var fooProfileValidator = Validator<B>.Rules() .ForProperty(x => x.BStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.BIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.BDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.BDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForNavigation(x => x.CNullable, x => barProfileValidator.AttachTo(x)) .ForEach(x => x.BItemsNullable, x => fooProfileItemValidator.AttachTo(x)); var profileValidator = Validator<A>.Rules() .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForNavigation(x => x.BNullable, x => fooProfileValidator.AttachTo(x)); var personValidator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForNavigation(x => x.ANullable, x => profileValidator.AttachTo(x)); var result = personValidator.Validate(person); Assert.Equal(96, result.Errors.Count); } [Fact] public void MultipleValidators2() { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160, BNullable = new B { BIntNullable = 10, BDecimalNullable = 160, CNullable = new C { CIntNullable = 10, CDecimalNullable = 160, CItemsNullable = new System.Collections.Generic.List<CItem> { new CItem { CItemIntNullable = 10, CItemDecimalNullable = 160 }, new CItem { CItemIntNullable = 10, CItemDecimalNullable = 160 } } }, BItemsNullable = new System.Collections.Generic.List<BItem> { new BItem { BItemIntNullable = 10, BItemDecimalNullable = 160 }, new BItem { BItemIntNullable = 10, BItemDecimalNullable = 160 } } }, }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var barProfileItemValidator = Validator<CItem>.Rules() .ForProperty(x => x.CItemStringNullable, x => x.NotDefaultOrEmpty()); var barProfileValidator = Validator<C>.Rules() .ForProperty(x => x.CStringNullable, x => x.NotDefaultOrEmpty()) .ForEach(x => x.CItemsNullable, x => barProfileItemValidator.AttachTo(x)); var fooProfileItemValidator = Validator<BItem>.Rules() .ForProperty(x => x.BItemStringNullable, x => x.NotDefaultOrEmpty()); var fooProfileValidator = Validator<B>.Rules() .ForProperty(x => x.BStringNullable, x => x.NotDefaultOrEmpty()) .ForNavigation(x => x.CNullable, x => barProfileValidator.AttachTo(x)) .ForEach(x => x.BItemsNullable, x => fooProfileItemValidator.AttachTo(x)); var profileValidator = Validator<A>.Rules() .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty()) .ForNavigation(x => x.BNullable, x => fooProfileValidator.AttachTo(x)); var personValidator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty()) .ForNavigation(x => x.ANullable, x => profileValidator.AttachTo(x)); var result = personValidator.Validate(person); Assert.Equal(8, result.Errors.Count); } private static List<IValidationDescriptor> MultipleValidators_Builder_DESCRIPTORS = new List<IValidationDescriptor>(); [Theory] [InlineData(true)] [InlineData(false)] public void MultipleValidators_Builder(bool condition) { var person = new Person { MyIntNullable = 10, MyDecimalNullable = 160, ANullable = new A { AIntNullable = 10, ADecimalNullable = 160, BNullable = new B { BIntNullable = 10, BDecimalNullable = 160, CNullable = new C { CIntNullable = 10, CDecimalNullable = 160, CItemsNullable = new System.Collections.Generic.List<CItem> { new CItem { CItemIntNullable = 10, CItemDecimalNullable = 160 }, new CItem { CItemIntNullable = 10, CItemDecimalNullable = 160 } } }, BItemsNullable = new System.Collections.Generic.List<BItem> { new BItem { BItemIntNullable = 10, BItemDecimalNullable = 160 }, new BItem { BItemIntNullable = 10, BItemDecimalNullable = 160 } } }, }, MyAddressesNullable = new System.Collections.Generic.List<Address> { new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, new Address { AddIntNullable = 10, AddDecimalNullable = 160 }, } }; var barProfileValidator = Validator<C>.Rules() .ForProperty(x => x.CStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.CIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.CDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.CDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForEach(x => x.CItemsNullable, x => new BarProfileItemValidator().Configure(condition).BuildRules(null, x)); var fooProfileItemValidator = Validator<BItem>.Rules() .ForProperty(x => x.BItemStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.BItemIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.BItemDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.BItemDecimalNullable, x => x.PrecisionScale(4, 2, false)); var fooProfileValidator = Validator<B>.Rules() .ForProperty(x => x.BStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.BIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.BDateTimeNullable, x => x.NotDefaultOrEmpty(), c => true) .ForProperty(x => x.BDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForNavigation(x => x.CNullable, x => barProfileValidator.AttachTo(x)) .ForEach(x => x.BItemsNullable, x => fooProfileItemValidator.AttachTo(x)); var profileValidator = Validator<A>.Rules() .ForProperty(x => x.AStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.AIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.ADateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.ADecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForNavigation(x => x.BNullable, x => fooProfileValidator.AttachTo(x)); var personValidator = Validator<Person>.Rules() .ForProperty(x => x.MyStringNullable, x => x.NotDefaultOrEmpty().NotNull()) .ForProperty(x => x.MyIntNullable, x => x .EqualsTo(5) .NotEqualsTo(10) .ExclusiveBetween(4, 6) .InclusiveBetween(5, 5) .GreaterThanOrEqual(15) .GreaterThan(14) .LessThanOrEqual(5) .LessThan(6)) .ForProperty(x => x.MyDateTimeNullable, x => x.NotDefaultOrEmpty()) .ForProperty(x => x.MyDecimalNullable, x => x.PrecisionScale(4, 2, false)) .ForNavigation(x => x.ANullable, x => profileValidator.AttachTo(x)); var result = personValidator.Validate(person); var desc = personValidator.ToDescriptor(); MultipleValidators_Builder_DESCRIPTORS.Add(desc); if (1 < MultipleValidators_Builder_DESCRIPTORS.Count) { var desc0 = MultipleValidators_Builder_DESCRIPTORS[0]; var str = desc0.Print(); System.Diagnostics.Debug.WriteLine(str); for (int i = 1; i < MultipleValidators_Builder_DESCRIPTORS.Count; i++) { var d = MultipleValidators_Builder_DESCRIPTORS[i]; Assert.True(desc0.IsEqualTo(d)); } } Assert.Equal(condition ? 96 : 76, result.Errors.Count); } [Fact] public void Attached_Builders() { var person = new Person(); var cValidator = Validator<C>.Rules() .ForNavigation( x => x.DNullable, x => x.ForNavigation( y => y.ENullable, y => y.ForNavigation( z => z.FNullable, z => z.ForProperty(p => p.FIntNullable, c => c.NotDefaultOrEmpty())))); var personValidator = Validator<Person>.Rules() .ForNavigation( x => x.ANullable, x => x.ForNavigation( y => y.BNullable, y => y.ForNavigation( z => z.CNullable, z => cValidator.AttachTo(z)))); var desc = personValidator.ToDescriptor(); var descInfo = desc.Print(); Debug.WriteLine(descInfo); var result = personValidator.Validate(person); Assert.Equal(1, result.Errors.Count); Assert.Equal("_.ANullable.BNullable.CNullable.DNullable.ENullable.FNullable.FIntNullable", result.Errors[0].ValidationFrame.ToString()); Assert.Equal(ValidatorType.NotDefaultOrEmpty, result.Errors[0].Type); } [Fact] public void Attached_Conditional_Builders() { var person = new Person(); var cValidator = Validator<C>.Rules() .ForNavigation( x => x.DNullable, x => x.ForNavigation( y => y.ENullable, y => y.ForNavigation( z => z.FNullable, z => z.ForProperty(p => p.FIntNullable, c => c.NotDefaultOrEmpty()), c => true), c => true), c => true); var personValidator = Validator<Person>.Rules() .ForNavigation( x => x.ANullable, x => x.ForNavigation( y => y.BNullable, y => y.ForNavigation( z => z.CNullable, z => cValidator.AttachTo(z), c => true), c => true), c => true); var desc = personValidator.ToDescriptor(); var descInfo = desc.Print(); Debug.WriteLine(descInfo); var result = personValidator.Validate(person); Assert.Equal(1, result.Errors.Count); Assert.Equal("_.ANullable.BNullable.CNullable.DNullable.ENullable.FNullable.FIntNullable", result.Errors[0].ValidationFrame.ToString()); Assert.Equal(ValidatorType.NotDefaultOrEmpty, result.Errors[0].Type); } } }
29.391553
139
0.61734
[ "Apache-2.0" ]
raider-net/Raider
test/Raider.Validation.Test/ComplexValidationTest.cs
41,062
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using Silk.NET.Core.Attributes; #pragma warning disable 1591 namespace Silk.NET.Direct3D12 { [Flags] [NativeName("Name", "D3D12_DRED_ENABLEMENT")] public enum DredEnablement : int { [NativeName("Name", "")] None = 0, [NativeName("Name", "D3D12_DRED_ENABLEMENT_SYSTEM_CONTROLLED")] DredEnablementSystemControlled = 0x0, [NativeName("Name", "D3D12_DRED_ENABLEMENT_FORCED_OFF")] DredEnablementForcedOff = 0x1, [NativeName("Name", "D3D12_DRED_ENABLEMENT_FORCED_ON")] DredEnablementForcedOn = 0x2, } }
28.307692
71
0.6875
[ "MIT" ]
Libertus-Lab/Silk.NET
src/Microsoft/Silk.NET.Direct3D12/Enums/DredEnablement.gen.cs
736
C#
using System; using NetOffice; namespace NetOffice.OWC10Api.Enums { /// <summary> /// SupportByVersion OWC10 1 /// </summary> [SupportByVersionAttribute("OWC10", 1)] [EntityTypeAttribute(EntityType.IsEnum)] public enum DscPageRelTypeEnum { /// <summary> /// SupportByVersion OWC10 1 /// </summary> /// <remarks>1</remarks> [SupportByVersionAttribute("OWC10", 1)] dscSublist = 1, /// <summary> /// SupportByVersion OWC10 1 /// </summary> /// <remarks>2</remarks> [SupportByVersionAttribute("OWC10", 1)] dscLookup = 2 } }
21.846154
42
0.653169
[ "MIT" ]
brunobola/NetOffice
Source/OWC10/Enums/DscPageRelTypeEnum.cs
570
C#
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using NUnit.Framework; using System; using System.Linq.Expressions; namespace YetiCommon.Tests.CastleAspects.TestSupport { [TestFixture] public class MethodInfoUtilTests { #region helpers public static void StaticMethod() { } #endregion [Test] public void ShouldReturnMethodInfoForFunctionInBody() { var methodInfo = MethodInfoUtil.GetMethodInfo<int>( x => x.ToString()); Assert.NotNull(methodInfo); Assert.AreEqual("ToString", methodInfo.Name); Assert.AreEqual(typeof(string), methodInfo.ReturnType); } [Test] public void ShouldReturnMethodInfoForFunctionInBodyNoArgument() { int x = 5; var methodInfo = MethodInfoUtil.GetMethodInfo(() => x.ToString()); Assert.NotNull(methodInfo); Assert.AreEqual("ToString", methodInfo.Name); Assert.AreEqual(typeof(string), methodInfo.ReturnType); } [Test] public void ShouldReturnMethodInfoForStaticMethod() { var methodInfo = MethodInfoUtil.GetMethodInfo(() => StaticMethod()); Assert.NotNull(methodInfo); Assert.AreEqual("StaticMethod", methodInfo.Name); Assert.AreEqual(typeof(void), methodInfo.ReturnType); } [Test] public void ShouldThrowArgumentExceptionForObjectCreationInBody() { Assert.Throws<ArgumentException>(() => { var methodInfo = MethodInfoUtil.GetMethodInfo<DummyObject.Factory>( factory => new DummyObject.Factory()); }); } } }
32.507042
83
0.630849
[ "Apache-2.0" ]
googlestadia/vsi-lldb
YetiCommon.Tests/CastleAspects/TestSupport/MethodInfoUtilTests.cs
2,310
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Cubes : MonoBehaviour { private GameSettings settings; private bool isActive; private GameObject[] cubeList = new GameObject[4]; void Start() { settings = GameObject.Find("GameSettings").GetComponent<GameSettings>(); isActive = true; /* check child objects */ if (transform.childCount != cubeList.Length) { Debug.Log("INVALID_STATE"); return; } /* copy child objects */ for (int cubeIdx = 0; cubeIdx < transform.childCount; cubeIdx++) { cubeList[cubeIdx] = transform.GetChild(cubeIdx).gameObject; } } void Update() { /* return if not active */ if (!isActive) { return; } /* backup while getting the floor and ceiling coordinates of the cubes */ List<Vector3> backupPositionList = new List<Vector3>(); int xFloor = Int32.MaxValue, zFloor = Int32.MaxValue, xCeiling = Int32.MinValue, zCeiling = Int32.MinValue; for (int cubeIdx = 0; cubeIdx < transform.childCount; cubeIdx++) { backupPositionList.Add(new Vector3(cubeList[cubeIdx].transform.position.x, cubeList[cubeIdx].transform.position.y, cubeList[cubeIdx].transform.position.z)); xFloor = Math.Min((int) Math.Floor(cubeList[cubeIdx].transform.position.x), xFloor); zFloor = Math.Min((int) Math.Floor(cubeList[cubeIdx].transform.position.z), zFloor); xCeiling = Math.Max((int) Math.Ceiling(cubeList[cubeIdx].transform.position.x), xCeiling); zCeiling = Math.Max((int) Math.Ceiling(cubeList[cubeIdx].transform.position.z), zCeiling); } /* rotate the cubes */ if (Input.GetKeyUp("right")) { for (int cubeIdx = 0; cubeIdx < gameObject.transform.childCount; cubeIdx++) { float x = xCeiling + cubeList[cubeIdx].transform.position.y; float y = xCeiling - cubeList[cubeIdx].transform.position.x; float z = cubeList[cubeIdx].transform.position.z; cubeList[cubeIdx].transform.position = new Vector3(x, y, z); } } else if (Input.GetKeyUp("left")) { for (int cubeIdx = 0; cubeIdx < gameObject.transform.childCount; cubeIdx++) { float x = xFloor - cubeList[cubeIdx].transform.position.y; float y = cubeList[cubeIdx].transform.position.x - xFloor; float z = cubeList[cubeIdx].transform.position.z; cubeList[cubeIdx].transform.position = new Vector3(x, y, z); } } else if (Input.GetKeyUp("up")) { for (int cubeIdx = 0; cubeIdx < gameObject.transform.childCount; cubeIdx++) { float x = cubeList[cubeIdx].transform.position.x; float y = zCeiling - cubeList[cubeIdx].transform.position.z; float z = zCeiling + cubeList[cubeIdx].transform.position.y; cubeList[cubeIdx].transform.position = new Vector3(x, y, z); } } else if (Input.GetKeyUp("down")) { for (int cubeIdx = 0; cubeIdx < gameObject.transform.childCount; cubeIdx++) { float x = cubeList[cubeIdx].transform.position.x; float y = cubeList[cubeIdx].transform.position.z - zFloor; float z = zFloor - cubeList[cubeIdx].transform.position.y; cubeList[cubeIdx].transform.position = new Vector3(x, y, z); } } else { return; } /* validate and increase count */ bool isActionValid = true; for (int cubeIdx = 0; cubeIdx < gameObject.transform.childCount; cubeIdx++) { int number = 1 + (int)Math.Floor(cubeList[cubeIdx].transform.position.x) + settings.squareSize * (int)Math.Floor(cubeList[cubeIdx].transform.position.z); isActionValid &= cubeList[cubeIdx].transform.position.x >= 0; isActionValid &= cubeList[cubeIdx].transform.position.x < settings.squareSize; isActionValid &= cubeList[cubeIdx].transform.position.z >= 0; isActionValid &= cubeList[cubeIdx].transform.position.z < settings.squareSize; isActionValid &= !(settings.blockNumberSet.Contains(number)); } if (isActionValid) { settings.stepCount += 1; } else { for (int cubeIdx = 0; cubeIdx < gameObject.transform.childCount; cubeIdx++) { cubeList[cubeIdx].transform.position = backupPositionList[cubeIdx]; } } /* check stage goal */ bool areCubesMatched = true; for (int cubeIdx = 0; cubeIdx < transform.childCount; cubeIdx++) { int number = 1 + (int)Math.Floor(cubeList[cubeIdx].transform.position.x) + settings.squareSize * (int)Math.Floor(cubeList[cubeIdx].transform.position.z); if (number != settings.targetNumberList[cubeIdx] || cubeList[cubeIdx].transform.position.y > 1f) { areCubesMatched = false; } } if (areCubesMatched) { isActive = false; for (int cubeIdx = 0; cubeIdx < transform.childCount; cubeIdx++) { cubeList[cubeIdx].GetComponent<Renderer>().material.color /= 2; } if (settings.NextStage()) { settings.SetupNewCubes(); } else { settings.ShowGameOverWindow(); settings.AppendNewScore(); settings.UpdateTopScoreList(); } } } }
39.36
168
0.568767
[ "MIT" ]
der3318/flipping-cubes
Assets/Cubes.cs
5,906
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class SuccessSports : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }
19.285714
56
0.748148
[ "MIT" ]
BJB-SK/MK
Website_public/SuccessSports.aspx.cs
272
C#
using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tynamix.ObjectFiller; namespace ObjectFiller.Test { public abstract class Parent { public Parent(int id) { Id = id; } public int Id { get; set; } } public class ChildOne : Parent { public ChildOne(int id) : base(id) { } public string Name { get; set; } } public class ChildTwo : Parent { public ChildTwo(int id) : base(id) { } public string OtherName { get; set; } } public class ParentOfParent { public ParentOfParent() { Parents = new List<Parent>(); } public List<Parent> Parents { get; private set; } } [TestClass] public class CreateInstanceTest { [TestMethod] public void TestCreateInstanceOfChildOne() { Filler<ParentOfParent> p = new Filler<ParentOfParent>(); p.Setup().OnType<Parent>().CreateInstanceOf<ChildOne>() .SetupFor<ChildOne>() .OnProperty(x => x.Name).Use(() => "TEST"); var pop = p.Create(); Assert.IsNotNull(pop); Assert.IsNotNull(pop.Parents); Assert.IsTrue(pop.Parents.All(x => x is ChildOne)); Assert.IsFalse(pop.Parents.Any(x => x is ChildTwo)); Assert.IsTrue(pop.Parents.Cast<ChildOne>().All(x => x.Name == "TEST")); } } }
20.269231
83
0.531942
[ "MIT" ]
twenzel/ObjectFiller.NET
Tynamix.ObjectFiller.Test/CreateInstanceTest.cs
1,583
C#
#region License // Copyright (c) 2011, ClearCanvas Inc. // All rights reserved. // http://www.clearcanvas.ca // // This software is licensed under the Open Software License v3.0. // For the complete license, see http://www.clearcanvas.ca/OSLv3.0// #endregion // This file is auto-generated by the ClearCanvas.Model.SqlServer.CodeGenerator project. namespace ClearCanvas.ImageServer.Model.EntityBrokers { using System; using System.Xml; using ClearCanvas.Enterprise.Core; using ClearCanvas.ImageServer.Enterprise; public partial class CannedTextSelectCriteria : EntitySelectCriteria { public CannedTextSelectCriteria() : base("CannedText") {} public CannedTextSelectCriteria(CannedTextSelectCriteria other) : base(other) {} public override object Clone() { return new CannedTextSelectCriteria(this); } [EntityFieldDatabaseMappingAttribute(TableName="CannedText", ColumnName="Label")] public ISearchCondition<String> Label { get { if (!SubCriteria.ContainsKey("Label")) { SubCriteria["Label"] = new SearchCondition<String>("Label"); } return (ISearchCondition<String>)SubCriteria["Label"]; } } [EntityFieldDatabaseMappingAttribute(TableName="CannedText", ColumnName="Category")] public ISearchCondition<String> Category { get { if (!SubCriteria.ContainsKey("Category")) { SubCriteria["Category"] = new SearchCondition<String>("Category"); } return (ISearchCondition<String>)SubCriteria["Category"]; } } [EntityFieldDatabaseMappingAttribute(TableName="CannedText", ColumnName="Text")] public ISearchCondition<String> Text { get { if (!SubCriteria.ContainsKey("Text")) { SubCriteria["Text"] = new SearchCondition<String>("Text"); } return (ISearchCondition<String>)SubCriteria["Text"]; } } } }
32.43662
93
0.573165
[ "Apache-2.0" ]
SNBnani/Xian
ImageServer/Model/EntityBrokers/CannedTextSelectCriteria.gen.cs
2,303
C#
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using JetBrains.Annotations; using Nuke.Common.Execution; using Nuke.Common.Utilities; namespace Nuke.Common { [PublicAPI] [DebuggerNonUserCode] [DebuggerStepThrough] public static partial class EnvironmentInfo { public static void SetVariable(string name, string value) { Environment.SetEnvironmentVariable(name, value); } public static void SetVariable<T>(string name, IEnumerable<T> values, char separator) { SetVariable(name, values.Select(x => x.ToString()).Join(separator)); } #region Parameter /// <summary> /// Provides access to a command-line argument or environment variable switch. /// </summary> public static bool ParameterSwitch(string name) { return ParameterService.Instance.GetParameter<bool>(name); } /// <summary> /// Provides access to a command-line argument or environment variable. /// </summary> [CanBeNull] public static string Parameter(string name) { return ParameterService.Instance.GetParameter<string>(name); } /// <summary> /// Provides access to a converted command-line argument or environment variable. /// </summary> [CanBeNull] public static T Parameter<T>(string name) { return ParameterService.Instance.GetParameter<T>(name); } /// <summary> /// Provides access to a command-line argument or environment variable set. /// </summary> [CanBeNull] public static T[] ParameterSet<T>(string name, char? separator = null) { return ParameterService.Instance.GetParameter<T[]>(name, separator); } /// <summary> /// Provides ensured access to a command-line argument or environment variable. /// </summary> public static string EnsureParameter(string name) { return Parameter(name).NotNull($"Parameter('{name}') != null"); } /// <summary> /// Provides ensured access to a converted command-line argument or environment variable. /// </summary> public static T EnsureParameter<T>(string name) { return Parameter<T>(name).NotNull($"Parameter<{typeof(T).Name}>('{name}') != null"); } /// <summary> /// Provides ensured access to a command-line argument or environment variable set. /// </summary> public static T[] EnsureParameterSet<T>(string name, char? separator = null) { return ParameterSet<T>(name, separator).NotNull($"ParameterSet<{typeof(T).Name}>('{name}', '{separator}') != null"); } #endregion #region Variable /// <summary> /// Provides access to an environment variable switch. /// </summary> public static bool VariableSwitch(string name) { return ParameterService.Instance.GetEnvironmentVariable<bool>(name); } /// <summary> /// Provides access to an environment variable. /// </summary> [CanBeNull] public static string Variable(string name) { return ParameterService.Instance.GetEnvironmentVariable<string>(name); } /// <summary> /// Provides access to a converted environment variable. /// </summary> [CanBeNull] public static T Variable<T>(string name) { return ParameterService.Instance.GetEnvironmentVariable<T>(name); } /// <summary> /// Provides access to an environment variable set. /// </summary> [CanBeNull] public static T[] VariableSet<T>(string name, char? separator = null) { return ParameterService.Instance.GetEnvironmentVariable<T[]>(name, separator); } /// <summary> /// Provides ensured access to an environment variable. /// </summary> public static string EnsureVariable(string name) { return Variable(name).NotNull($"Variable('{name}') != null"); } /// <summary> /// Provides ensured access to a converted environment variable. /// </summary> public static T EnsureVariable<T>(string name) { return Variable<T>(name).NotNull($"Variable<{typeof(T).Name}>('{name}') != null"); } /// <summary> /// Provides ensured access to an environment variable set. /// </summary> public static T[] EnsureVariableSet<T>(string name, char? separator = null) { return VariableSet<T>(name, separator).NotNull($"VariableSet<{typeof(T).Name}>('{name}', '{separator}') != null"); } #endregion #region Argument /// <summary> /// Provides access to a command-line argument switch. /// </summary> public static bool ArgumentSwitch(string name) { return ParameterService.Instance.GetCommandLineArgument<bool>(name); } /// <summary> /// Provides access to a command-line argument. /// </summary> [CanBeNull] public static string Argument(string name) { return ParameterService.Instance.GetCommandLineArgument<string>(name); } /// <summary> /// Provides access to a converted command-line argument. /// </summary> [CanBeNull] public static T Argument<T>(string name) { return ParameterService.Instance.GetCommandLineArgument<T>(name); } /// <summary> /// Provides access to a command-line argument set. /// </summary> [CanBeNull] public static T[] ArgumentSet<T>(string name, char? separator = null) { return ParameterService.Instance.GetCommandLineArgument<T[]>(name, separator); } /// <summary> /// Provides ensured access to a command-line argument. /// </summary> public static string EnsureArgument(string name) { return Argument(name).NotNull($"Argument('{name}') != null"); } /// <summary> /// Provides ensured access to a converted command-line argument. /// </summary> public static T EnsureArgument<T>(string name) { return Argument<T>(name).NotNull($"Argument<{typeof(T).Name}>('{name}') != null"); } /// <summary> /// Provides ensured access to a command-line argument set. /// </summary> public static T[] EnsureArgumentSet<T>(string name, char? separator = null) { return ArgumentSet<T>(name, separator).NotNull($"ArgumentSet<{typeof(T).Name}>('{name}', '{separator}') != null"); } #endregion } }
32.663636
128
0.5828
[ "MIT" ]
Bloemert/nuke-build-common
source/Nuke.Common/EnvironmentInfo.Parameters.cs
7,188
C#
using System.IO; using Microsoft.AspNetCore.Hosting; namespace Don.SportsStoreCore.Web.Host.Startup { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } } }
22.666667
64
0.535714
[ "MIT" ]
antgerasim/Don.SportsStoreCore
aspnet-core/src/Don.SportsStoreCore.Web.Host/Startup/Program.cs
478
C#
// Copyright © 2020 EPAM Systems, Inc. All Rights Reserved. All information contained herein is, and remains the // property of EPAM Systems, Inc. and/or its suppliers and is protected by international intellectual // property law. Dissemination of this information or reproduction of this material is strictly forbidden, // unless prior written permission is obtained from EPAM Systems, Inc using System; using System.Linq; using Epam.GraphQL.Infrastructure; #nullable enable namespace Epam.GraphQL.Relay { internal static class Paginator { public static Paginatior<TSource> From<TSource>(IQueryExecuter executer, Func<string> stepNameFactory, IQueryable<TSource> query, bool shouldMaterialize) { return new Paginatior<TSource>(executer, stepNameFactory, query, shouldMaterialize); } } internal class Paginatior<TSource> : IPaginatorWithoutSkip<TSource> { private readonly IQueryExecuter _executer; private readonly Func<string> _stepNameFactory; private readonly IQueryable<TSource> _query; private readonly bool _shouldMaterialize; private int _skipCount; private int _takeCount; private int _takeLastCount; private int _takeBeforeCount; private bool _shouldTake; private bool _shouldSkip; private bool _shouldTakeLast; private bool _shouldTakeBefore; public Paginatior(IQueryExecuter executer, Func<string> stepNameFactory, IQueryable<TSource> query, bool shouldMaterialize) { _query = query; _executer = executer; _stepNameFactory = stepNameFactory; _shouldMaterialize = shouldMaterialize; } public IPaginatorWithoutSkip<TSource> SkipIncluding(int? index) { if (index.HasValue) { if (_shouldTake) { throw new InvalidOperationException("Cannot perform skip after take."); } _skipCount += index.Value + 1; _shouldSkip = true; } return this; } public IPaginatorWithoutSkip<TSource> Take(int? count) { if (count.HasValue) { if (_shouldTake) { _takeCount = Math.Min(count.Value, _takeCount); } else { _takeCount = count.Value; _shouldTake = true; } } return this; } public IPaginatorWithoutSkip<TSource> TakeLast(int? count) { if (count.HasValue) { if (_shouldTakeLast) { _takeLastCount = Math.Min(count.Value, _takeCount); } else { _takeLastCount = count.Value; _shouldTakeLast = true; } } return this; } public IPaginatorWithoutSkip<TSource> TakeBefore(int? index) { if (index.HasValue) { _shouldTakeBefore = true; _takeBeforeCount = index.Value; if (_shouldSkip) { return Take(index.Value - _skipCount); } return Take(index.Value); } return this; } public IPaginatorWithoutSkip<TSource> DropLast(int? count) { if (count.HasValue) { if (!_shouldTake) { throw new NotImplementedException(); } _takeCount -= count.Value; } return this; } #pragma warning disable CA1502 public PaginatorResult<TSource> Materialize() #pragma warning restore CA1502 { // Dragons live here... var query = _query; if (!_shouldMaterialize && !_shouldSkip && !_shouldTake && !_shouldTakeBefore && !_shouldTakeLast) { return new PaginatorResult<TSource> { StartOffset = 0, Page = _executer.ToEnumerable(_stepNameFactory, query), }; } var liveSkipCount = _skipCount - (_shouldSkip ? 1 : 0); if (_shouldSkip) { // Skip items excluding the last one. // It is intended to ensure that we did not skip the whole data sequence. query = query.Skip(liveSkipCount); } var liveTakeCount = _takeCount + 1 + (_shouldSkip ? 1 : 0); if (_shouldTake) { // Take items including the next item and maybe including previous one (if 'Skip' was performed). query = query.Take(liveTakeCount); } var sample = _executer.ToList(_stepNameFactory, query); var shouldRemoveLast = false; var skipCanceled = false; var hasNextPage = false; var hasPreviousPage = false; int? offset = 0; int? totalCount = null; if (_shouldTake) { if (sample.Count > 0) { if (sample.Count == liveTakeCount) { if (!_shouldTakeBefore || _takeBeforeCount > 0) { hasNextPage = true; } shouldRemoveLast = true; } else { // If sample.Count < liveTakeCount then 'Take' operation gave us one item at least. // It means that we reached the end of data sequence, so there is no the next page for current page. totalCount = liveSkipCount + sample.Count; } } else if (_shouldSkip) { // Query is being executed the second time because 'Take' gave us no items. It is possible by two reasons: // 1) we reached the end of data sequence by skiping items. This case will be handled below by taking items again. // 2) the sequence is initially empty. This case should not be handled here. // Again, we apply the same technique (take one more item from data sequence) to ensure that we have items after the current page. sample = _executer.ToList(_stepNameFactory, _query.Take(_takeCount + 1)); skipCanceled = true; if (sample.Count == _takeCount + 1) { hasNextPage = true; shouldRemoveLast = true; } } } else { // 'Take' operation was not performed, so we've got all the items from the sequence till the end. totalCount = liveSkipCount + sample.Count; } if (sample.Count > 0) { // Remove extra items if necessary... if (shouldRemoveLast) { sample.RemoveAt(sample.Count - 1); } if (_shouldSkip && !skipCanceled) { sample.RemoveAt(0); offset = _skipCount; } if (!skipCanceled && !hasNextPage && sample.Count == 0) { offset = null; } } else { skipCanceled = true; if (_shouldSkip && !_shouldTake) { // If there is no items after skipping (and we did not perform taking), try to materialize query again. sample = _executer.ToList(_stepNameFactory, _query); } if (sample.Count == 0) { offset = null; } totalCount = sample.Count; } if (_shouldSkip && !skipCanceled) { hasPreviousPage = true; } if (_shouldTakeLast) { var removeCount = Math.Max(0, sample.Count - _takeLastCount); if (removeCount > 0) { offset += removeCount; sample.RemoveRange(0, removeCount); hasPreviousPage = true; } if (sample.Count == 0 && !_shouldTakeBefore) { hasPreviousPage = false; offset = null; } } // Reset wrapper _skipCount = 0; _takeCount = 0; _takeLastCount = 0; _takeBeforeCount = 0; _shouldTake = false; _shouldSkip = false; _shouldTakeLast = false; _shouldTakeBefore = false; return new PaginatorResult<TSource> { StartOffset = offset, EndOffset = offset + Math.Max(sample.Count - 1, 0), HasPreviousPage = hasPreviousPage, HasNextPage = hasNextPage, Page = sample, TotalCount = totalCount, }; } } }
32.688136
161
0.486674
[ "MIT" ]
epam/epam-graphql
src/Epam.GraphQL/Relay/Paginator.cs
9,644
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _04.LINQ.Largest3Numbers { class Largest3Numbers { static void Main(string[] args) { List<double> numbers = Console.ReadLine().Split().Select(double.Parse).OrderByDescending(x => x).Take(3).ToList(); Console.WriteLine(string.Join(" ", numbers)); } } }
24.444444
126
0.652273
[ "MIT" ]
DimchoLakov/ProgrammingFundamentalsMay2017
08.Dictionaries.Lambda.LINQ-Lab/04.LINQ.Largest3Numbers/Largest3Numbers.cs
442
C#
using System.Linq; using ZSZ.Service.Entities; namespace ZSZ.Service { //这个类是用来引用的,不是用来继承的 //上层不应该知道数据是如何存储的,使用的什么ORM(如:EF) internal sealed class CommonService<T> where T:BaseEntity { private ZSZDbContext ctx; public CommonService(ZSZDbContext ctx) { this.ctx = ctx; } /// <summary> /// 获取所有没有软删除的数据 /// </summary> /// <returns></returns> public IQueryable<T> GetAll() { return ctx.Set<T>().Where(e=>e.IsDeleted==false); } /// <summary> /// 获取总数据条数 /// </summary> /// <returns></returns> public long GetTotalCount() { return GetAll().LongCount(); } /// <summary> /// 分页获取数据 /// </summary> /// <param name="startIndex"></param> /// <param name="count"></param> /// <returns></returns> public IQueryable<T> GetPagedData(int startIndex,int count) { return GetAll().OrderBy(e => e.CreateDateTime) .Skip(startIndex).Take(count); } /// <summary> /// 查找id=id的数据,如果找不到返回null /// </summary> /// <param name="id"></param> /// <returns></returns> public T GetById(long id) { return GetAll().Where(e=>e.Id==id).SingleOrDefault(); } public void MarkDeleted(long id) { var data = GetById(id); data.IsDeleted = true; ctx.SaveChanges(); } } }
24.53125
67
0.491083
[ "Apache-2.0" ]
laoshuai/ZSZ
ZSZ.Service/CommonService.cs
1,730
C#
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Text.RegularExpressions; using System.Net; using EasyWeb.Log; namespace EasyWeb.Net.Http { public class Server { protected Router _router; protected IHandler _notFoundHandler; protected ILogger _logger; public Server(ILogger logger) { _router = new Router(new RegexRoute(), new DelimiterSegmenter('/')); _logger = logger; } public void Handle(string url, IHandler handler) { _router.Add(url, handler); } public void NotFound(IHandler notFoundHandler) { _notFoundHandler = notFoundHandler; } public void ListenAndServe(string address) { HttpListener listener = new HttpListener(); listener.Prefixes.Add(address); listener.Start(); for(;;) { HttpListenerContext context = listener.GetContext(); Task.Run(() => route(context)); } } protected void route(HttpListenerContext context) { var handlerWithParameters = _router.Lookup(System.Web.HttpUtility.UrlDecode(context.Request.Url.AbsolutePath)); if (handlerWithParameters.Key == null) { callHandler(_notFoundHandler, new UrlParamsEmpty(), context); return; } callHandler(handlerWithParameters.Key, handlerWithParameters.Value, context); return; } protected void callHandler(IHandler handler, IUrlParams urlParams, HttpListenerContext context) { HttpListenerRequest request = context.Request; HttpListenerResponse response = context.Response; _logger.Info(string.Format("{0} - {1} - {2} {3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), request.RemoteEndPoint.ToString(), request.HttpMethod, request.RawUrl)); try { handler.ServeHttp(new ResponseWriter(response), new Request(request), urlParams); } catch(Exception e) { _logger.Error(string.Format("Exception: {0}, Source: {1}, StackTrace: {2}", e.Message, e.Source, e.StackTrace)); } finally { response.Close(); } } } }
29.630952
128
0.57493
[ "MIT" ]
dragonquest/easy-web
EasyWeb/Net/Http/Server.cs
2,489
C#
namespace MarkdownWeb { /// <summary> /// The purpose of this class is to be able to convert wiki url paths to website url paths. /// </summary> /// <remarks> /// <para> /// Wiki paths are relative to the wiki root, while the wiki might be in a sub path on the web site. So when a path /// in the wiki is <c>/patterns/srp</c> the complete /// website path might be <c>/doc/wiki/patterns/srp</c>. /// </para> /// </remarks> public interface IUrlPathConverter { /// <summary> /// Remove the root path that specifies where the wiki/markdown pages reside. /// </summary> /// <param name="url">web url</param> /// <returns>wiki path</returns> string RemoveWebRoot(string url); /// <summary> /// Convert an wiki path to an absolute web site path. /// </summary> /// <param name="wikiPath">Path in the wiki</param> /// <returns>Path in the web site</returns> string ToWebUrl(string wikiPath); /// <summary> /// The path is a virtual path (i.e. starts with "~"). /// </summary> /// <param name="virtualPath">Virtual path</param> /// <returns>Path in the web site</returns> string ToAbsolutePath(string virtualPath); /// <summary> /// Convert a web path to a wiki path /// </summary> /// <param name="websiteAbsolutePath">Path in the web site</param> /// <returns>Path for the wiki document.</returns> PageReference MapUrlToWikiPath(string websiteAbsolutePath); PageReference ToReference(string wikiPath); } }
38.065217
128
0.557967
[ "Apache-2.0" ]
jgauffin/markdownweb
src/MarkdownWeb/IUrlPathConverter.cs
1,753
C#
#region License // TableDependency, SqlTableDependency // Copyright (c) 2015-2019 Christian Del Bianco. All rights reserved. // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #endregion using TableDependency.SqlClient.Base.Exceptions; namespace TableDependency.SqlClient.Exceptions { public class DbObjectsWithSameNameException : TableDependencyException { protected internal DbObjectsWithSameNameException(string naming) : base($"Already existing database objects (queue, trigger, stored procedure or service broker) with name '{naming}'.") { } } }
43.945946
131
0.758918
[ "MIT" ]
GSUFan513/monitor-table-change-with-sqltabledependency
TableDependency.SqlClient/Exceptions/DbObjectsWithSameNameException.cs
1,628
C#
using System; using Tccp.PlayBall.GroupManagement.Business.Impl.Services; using Tccp.PlayBall.GroupManagement.Business.Services; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions { public static IServiceCollection AddBusiness(this IServiceCollection services) { services.AddSingleton<IGroupsService, InMemoryGroupsService>(); //more business services... return services; } public static TConfig ConfigurePOCO<TConfig>(this IServiceCollection services, IConfiguration configuration) where TConfig : class, new() { if (services == null) throw new ArgumentNullException(nameof(services)); if (configuration == null) throw new ArgumentNullException(nameof(configuration)); var config = new TConfig(); configuration.Bind(config); services.AddSingleton(config); return config; } } }
35.83871
145
0.685869
[ "MIT" ]
tarcisiocorte/GroupManagementTarcisio
src/TCCP.PlayBall.GroupManagement.Web/IoC/ServiceCollectionExtensions.cs
1,111
C#
using System; using System.Collections.Generic; using Android.Runtime; namespace Android.Text { // Metadata.xml XPath class reference: path="/api/package[@name='android.text']/class[@name='SpannableStringInternal']" [global::Android.Runtime.Register ("android/text/SpannableStringInternal", DoNotGenerateAcw=true)] public abstract partial class SpannableStringInternal : Java.Lang.Object { internal static IntPtr java_class_handle; internal static IntPtr class_ref { get { return JNIEnv.FindClass ("android/text/SpannableStringInternal", ref java_class_handle); } } protected override IntPtr ThresholdClass { get { return class_ref; } } protected override global::System.Type ThresholdType { get { return typeof (SpannableStringInternal); } } protected SpannableStringInternal (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} static Delegate cb_getSpanFlags_Ljava_lang_Object_; #pragma warning disable 0169 static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () { if (cb_getSpanFlags_Ljava_lang_Object_ == null) cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((Func<IntPtr, IntPtr, IntPtr, int>) n_GetSpanFlags_Ljava_lang_Object_); return cb_getSpanFlags_Ljava_lang_Object_; } static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0) { Android.Text.SpannableStringInternal __this = global::Java.Lang.Object.GetObject<Android.Text.SpannableStringInternal> (jnienv, native__this, JniHandleOwnership.DoNotTransfer); Java.Lang.Object p0 = global::Java.Lang.Object.GetObject<Java.Lang.Object> (native_p0, JniHandleOwnership.DoNotTransfer); int __ret = (int) __this.GetSpanFlags (p0); return __ret; } #pragma warning restore 0169 static IntPtr id_getSpanFlags_Ljava_lang_Object_; // Metadata.xml XPath method reference: path="/api/package[@name='android.text']/class[@name='SpannableStringInternal']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" [return:global::Android.Runtime.GeneratedEnum] [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler")] public virtual unsafe Android.Text.SpanTypes GetSpanFlags (Java.Lang.Object p0) { if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); try { JValue* __args = stackalloc JValue [1]; __args [0] = new JValue (p0); Android.Text.SpanTypes __ret; if (GetType () == ThresholdType) __ret = (Android.Text.SpanTypes) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); else __ret = (Android.Text.SpanTypes) JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getSpanFlags", "(Ljava/lang/Object;)I"), __args); return __ret; } finally { } } } [global::Android.Runtime.Register ("android/text/SpannableStringInternal", DoNotGenerateAcw=true)] internal partial class SpannableStringInternalInvoker : SpannableStringInternal { public SpannableStringInternalInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} protected override global::System.Type ThresholdType { get { return typeof (SpannableStringInternalInvoker); } } } }
42.609756
217
0.77075
[ "MIT" ]
pjcollins/java.interop
tools/generator/Tests-Core/expected/Android.Text.SpannableStringInternal.cs
3,494
C#
using System; using System.Collections.Generic; using System.Text; namespace Restaurant { public class Dessert : Food { public double Calories { get; set; } public Dessert(string name, decimal price, double grams, double calories) :base(name, price,grams) { Calories = calories; } } }
17.9
81
0.603352
[ "MIT" ]
Plamen-Angelov/OOP
Inheritance/Exercise/Restaurant/Dessert.cs
360
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.Buffers; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Threading; using System.Threading.Tasks; namespace System.Text.Json { public sealed partial class JsonDocument { private const int UnseekableStreamInitialRentSize = 4096; /// <summary> /// Parse memory as UTF-8-encoded text representing a single JSON value into a JsonDocument. /// </summary> /// <remarks> /// <para> /// The <see cref="ReadOnlyMemory{T}"/> value will be used for the entire lifetime of the /// JsonDocument object, and the caller must ensure that the data therein does not change during /// the object lifetime. /// </para> /// /// <para> /// Because the input is considered to be text, a UTF-8 Byte-Order-Mark (BOM) must not be present. /// </para> /// </remarks> /// <param name="utf8Json">JSON text to parse.</param> /// <param name="options">Options to control the reader behavior during parsing.</param> /// <returns> /// A JsonDocument representation of the JSON value. /// </returns> /// <exception cref="JsonException"> /// <paramref name="utf8Json"/> does not represent a valid single JSON value. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="options"/> contains unsupported options. /// </exception> public static JsonDocument Parse(ReadOnlyMemory<byte> utf8Json, JsonDocumentOptions options = default) { return Parse(utf8Json, options.GetReaderOptions(), null); } /// <summary> /// Parse a sequence as UTF-8-encoded text representing a single JSON value into a JsonDocument. /// </summary> /// <remarks> /// <para> /// The <see cref="ReadOnlySequence{T}"/> may be used for the entire lifetime of the /// JsonDocument object, and the caller must ensure that the data therein does not change during /// the object lifetime. /// </para> /// /// <para> /// Because the input is considered to be text, a UTF-8 Byte-Order-Mark (BOM) must not be present. /// </para> /// </remarks> /// <param name="utf8Json">JSON text to parse.</param> /// <param name="options">Options to control the reader behavior during parsing.</param> /// <returns> /// A JsonDocument representation of the JSON value. /// </returns> /// <exception cref="JsonException"> /// <paramref name="utf8Json"/> does not represent a valid single JSON value. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="options"/> contains unsupported options. /// </exception> public static JsonDocument Parse(ReadOnlySequence<byte> utf8Json, JsonDocumentOptions options = default) { JsonReaderOptions readerOptions = options.GetReaderOptions(); if (utf8Json.IsSingleSegment) { return Parse(utf8Json.First, readerOptions, null); } int length = checked((int)utf8Json.Length); byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(length); try { utf8Json.CopyTo(utf8Bytes.AsSpan()); return Parse(utf8Bytes.AsMemory(0, length), readerOptions, utf8Bytes); } catch { // Holds document content, clear it before returning it. utf8Bytes.AsSpan(0, length).Clear(); ArrayPool<byte>.Shared.Return(utf8Bytes); throw; } } /// <summary> /// Parse a <see cref="Stream"/> as UTF-8-encoded data representing a single JSON value into a /// JsonDocument. The Stream will be read to completion. /// </summary> /// <param name="utf8Json">JSON data to parse.</param> /// <param name="options">Options to control the reader behavior during parsing.</param> /// <returns> /// A JsonDocument representation of the JSON value. /// </returns> /// <exception cref="JsonException"> /// <paramref name="utf8Json"/> does not represent a valid single JSON value. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="options"/> contains unsupported options. /// </exception> public static JsonDocument Parse(Stream utf8Json, JsonDocumentOptions options = default) { if (utf8Json == null) { throw new ArgumentNullException(nameof(utf8Json)); } ArraySegment<byte> drained = ReadToEnd(utf8Json); Debug.Assert(drained.Array != null); try { return Parse(drained.AsMemory(), options.GetReaderOptions(), drained.Array); } catch { // Holds document content, clear it before returning it. drained.AsSpan().Clear(); ArrayPool<byte>.Shared.Return(drained.Array); throw; } } /// <summary> /// Parse a <see cref="Stream"/> as UTF-8-encoded data representing a single JSON value into a /// JsonDocument. The Stream will be read to completion. /// </summary> /// <param name="utf8Json">JSON data to parse.</param> /// <param name="options">Options to control the reader behavior during parsing.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns> /// A Task to produce a JsonDocument representation of the JSON value. /// </returns> /// <exception cref="JsonException"> /// <paramref name="utf8Json"/> does not represent a valid single JSON value. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="options"/> contains unsupported options. /// </exception> public static Task<JsonDocument> ParseAsync( Stream utf8Json, JsonDocumentOptions options = default, CancellationToken cancellationToken = default) { if (utf8Json == null) { throw new ArgumentNullException(nameof(utf8Json)); } return ParseAsyncCore(utf8Json, options, cancellationToken); } private static async Task<JsonDocument> ParseAsyncCore( Stream utf8Json, JsonDocumentOptions options = default, CancellationToken cancellationToken = default) { ArraySegment<byte> drained = await ReadToEndAsync(utf8Json, cancellationToken).ConfigureAwait(false); Debug.Assert(drained.Array != null); try { return Parse(drained.AsMemory(), options.GetReaderOptions(), drained.Array); } catch { // Holds document content, clear it before returning it. drained.AsSpan().Clear(); ArrayPool<byte>.Shared.Return(drained.Array); throw; } } /// <summary> /// Parse text representing a single JSON value into a JsonDocument. /// </summary> /// <remarks> /// The <see cref="ReadOnlyMemory{T}"/> value may be used for the entire lifetime of the /// JsonDocument object, and the caller must ensure that the data therein does not change during /// the object lifetime. /// </remarks> /// <param name="json">JSON text to parse.</param> /// <param name="options">Options to control the reader behavior during parsing.</param> /// <returns> /// A JsonDocument representation of the JSON value. /// </returns> /// <exception cref="JsonException"> /// <paramref name="json"/> does not represent a valid single JSON value. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="options"/> contains unsupported options. /// </exception> public static JsonDocument Parse(ReadOnlyMemory<char> json, JsonDocumentOptions options = default) { ReadOnlySpan<char> jsonChars = json.Span; int expectedByteCount = JsonReaderHelper.GetUtf8ByteCount(jsonChars); byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(expectedByteCount); try { int actualByteCount = JsonReaderHelper.GetUtf8FromText(jsonChars, utf8Bytes); Debug.Assert(expectedByteCount == actualByteCount); return Parse(utf8Bytes.AsMemory(0, actualByteCount), options.GetReaderOptions(), utf8Bytes); } catch { // Holds document content, clear it before returning it. utf8Bytes.AsSpan(0, expectedByteCount).Clear(); ArrayPool<byte>.Shared.Return(utf8Bytes); throw; } } /// <summary> /// Parse text representing a single JSON value into a JsonDocument. /// </summary> /// <param name="json">JSON text to parse.</param> /// <param name="options">Options to control the reader behavior during parsing.</param> /// <returns> /// A JsonDocument representation of the JSON value. /// </returns> /// <exception cref="JsonException"> /// <paramref name="json"/> does not represent a valid single JSON value. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="options"/> contains unsupported options. /// </exception> public static JsonDocument Parse(string json, JsonDocumentOptions options = default) { if (json == null) { throw new ArgumentNullException(nameof(json)); } return Parse(json.AsMemory(), options); } /// <summary> /// Attempts to parse one JSON value (including objects or arrays) from the provided reader. /// </summary> /// <param name="reader">The reader to read.</param> /// <param name="document">Receives the parsed document.</param> /// <returns> /// <see langword="true"/> if a value was read and parsed into a JsonDocument, /// <see langword="false"/> if the reader ran out of data while parsing. /// All other situations result in an exception being thrown. /// </returns> /// <remarks> /// <para> /// If the <see cref="Utf8JsonReader.TokenType"/> property of <paramref name="reader"/> /// is <see cref="JsonTokenType.PropertyName"/> or <see cref="JsonTokenType.None"/>, the /// reader will be advanced by one call to <see cref="Utf8JsonReader.Read"/> to determine /// the start of the value. /// </para> /// /// <para> /// Upon completion of this method <paramref name="reader"/> will be positioned at the /// final token in the JSON value. If an exception is thrown, or <see langword="false"/> /// is returned, the reader is reset to the state it was in when the method was called. /// </para> /// /// <para> /// This method makes a copy of the data the reader acted on, so there is no caller /// requirement to maintain data integrity beyond the return of this method. /// </para> /// </remarks> /// <exception cref="ArgumentException"> /// <paramref name="reader"/> is using unsupported options. /// </exception> /// <exception cref="ArgumentException"> /// The current <paramref name="reader"/> token does not start or represent a value. /// </exception> /// <exception cref="JsonException"> /// A value could not be read from the reader. /// </exception> public static bool TryParseValue(ref Utf8JsonReader reader, [NotNullWhen(true)] out JsonDocument? document) { return TryParseValue(ref reader, out document, shouldThrow: false); } /// <summary> /// Parses one JSON value (including objects or arrays) from the provided reader. /// </summary> /// <param name="reader">The reader to read.</param> /// <returns> /// A JsonDocument representing the value (and nested values) read from the reader. /// </returns> /// <remarks> /// <para> /// If the <see cref="Utf8JsonReader.TokenType"/> property of <paramref name="reader"/> /// is <see cref="JsonTokenType.PropertyName"/> or <see cref="JsonTokenType.None"/>, the /// reader will be advanced by one call to <see cref="Utf8JsonReader.Read"/> to determine /// the start of the value. /// </para> /// /// <para> /// Upon completion of this method <paramref name="reader"/> will be positioned at the /// final token in the JSON value. If an exception is thrown the reader is reset to /// the state it was in when the method was called. /// </para> /// /// <para> /// This method makes a copy of the data the reader acted on, so there is no caller /// requirement to maintain data integrity beyond the return of this method. /// </para> /// </remarks> /// <exception cref="ArgumentException"> /// <paramref name="reader"/> is using unsupported options. /// </exception> /// <exception cref="ArgumentException"> /// The current <paramref name="reader"/> token does not start or represent a value. /// </exception> /// <exception cref="JsonException"> /// A value could not be read from the reader. /// </exception> public static JsonDocument ParseValue(ref Utf8JsonReader reader) { bool ret = TryParseValue(ref reader, out JsonDocument? document, shouldThrow: true); Debug.Assert(ret, "TryParseValue returned false with shouldThrow: true."); return document!; } private static bool TryParseValue(ref Utf8JsonReader reader, [NotNullWhen(true)] out JsonDocument? document, bool shouldThrow) { JsonReaderState state = reader.CurrentState; CheckSupportedOptions(state.Options, nameof(reader)); // Value copy to overwrite the ref on an exception and undo the destructive reads. Utf8JsonReader restore = reader; ReadOnlySpan<byte> valueSpan = default; ReadOnlySequence<byte> valueSequence = default; try { switch (reader.TokenType) { // A new reader was created and has never been read, // so we need to move to the first token. // (or a reader has terminated and we're about to throw) case JsonTokenType.None: // Using a reader loop the caller has identified a property they wish to // hydrate into a JsonDocument. Move to the value first. case JsonTokenType.PropertyName: { if (!reader.Read()) { if (shouldThrow) { ThrowHelper.ThrowJsonReaderException( ref reader, ExceptionResource.ExpectedJsonTokens); } reader = restore; document = null; return false; } break; } } switch (reader.TokenType) { // Any of the "value start" states are acceptable. case JsonTokenType.StartObject: case JsonTokenType.StartArray: { long startingOffset = reader.TokenStartIndex; if (!reader.TrySkip()) { if (shouldThrow) { ThrowHelper.ThrowJsonReaderException( ref reader, ExceptionResource.ExpectedJsonTokens); } reader = restore; document = null; return false; } long totalLength = reader.BytesConsumed - startingOffset; ReadOnlySequence<byte> sequence = reader.OriginalSequence; if (sequence.IsEmpty) { valueSpan = reader.OriginalSpan.Slice( checked((int)startingOffset), checked((int)totalLength)); } else { valueSequence = sequence.Slice(startingOffset, totalLength); } Debug.Assert( reader.TokenType == JsonTokenType.EndObject || reader.TokenType == JsonTokenType.EndArray); break; } // Single-token values case JsonTokenType.Number: case JsonTokenType.True: case JsonTokenType.False: case JsonTokenType.Null: { if (reader.HasValueSequence) { valueSequence = reader.ValueSequence; } else { valueSpan = reader.ValueSpan; } break; } // String's ValueSequence/ValueSpan omits the quotes, we need them back. case JsonTokenType.String: { ReadOnlySequence<byte> sequence = reader.OriginalSequence; if (sequence.IsEmpty) { // Since the quoted string fit in a ReadOnlySpan originally // the contents length plus the two quotes can't overflow. int payloadLength = reader.ValueSpan.Length + 2; Debug.Assert(payloadLength > 1); ReadOnlySpan<byte> readerSpan = reader.OriginalSpan; Debug.Assert( readerSpan[(int)reader.TokenStartIndex] == (byte)'"', $"Calculated span starts with {readerSpan[(int)reader.TokenStartIndex]}"); Debug.Assert( readerSpan[(int)reader.TokenStartIndex + payloadLength - 1] == (byte)'"', $"Calculated span ends with {readerSpan[(int)reader.TokenStartIndex + payloadLength - 1]}"); valueSpan = readerSpan.Slice((int)reader.TokenStartIndex, payloadLength); } else { long payloadLength = 2; if (reader.HasValueSequence) { payloadLength += reader.ValueSequence.Length; } else { payloadLength += reader.ValueSpan.Length; } valueSequence = sequence.Slice(reader.TokenStartIndex, payloadLength); Debug.Assert( valueSequence.First.Span[0] == (byte)'"', $"Calculated sequence starts with {valueSequence.First.Span[0]}"); Debug.Assert( valueSequence.ToArray()[payloadLength - 1] == (byte)'"', $"Calculated sequence ends with {valueSequence.ToArray()[payloadLength - 1]}"); } break; } default: { if (shouldThrow) { // Default case would only hit if TokenType equals JsonTokenType.EndObject or JsonTokenType.EndArray in which case it would never be sequence Debug.Assert(!reader.HasValueSequence); byte displayByte = reader.ValueSpan[0]; ThrowHelper.ThrowJsonReaderException( ref reader, ExceptionResource.ExpectedStartOfValueNotFound, displayByte); } reader = restore; document = null; return false; } } } catch { reader = restore; throw; } int length = valueSpan.IsEmpty ? checked((int)valueSequence.Length) : valueSpan.Length; byte[] rented = ArrayPool<byte>.Shared.Rent(length); Span<byte> rentedSpan = rented.AsSpan(0, length); try { if (valueSpan.IsEmpty) { valueSequence.CopyTo(rentedSpan); } else { valueSpan.CopyTo(rentedSpan); } document = Parse(rented.AsMemory(0, length), state.Options, rented); return true; } catch { // This really shouldn't happen since the document was already checked // for consistency by Skip. But if data mutations happened just after // the calls to Read then the copy may not be valid. rentedSpan.Clear(); ArrayPool<byte>.Shared.Return(rented); throw; } } private static JsonDocument Parse( ReadOnlyMemory<byte> utf8Json, JsonReaderOptions readerOptions, byte[]? extraRentedBytes) { ReadOnlySpan<byte> utf8JsonSpan = utf8Json.Span; var database = new MetadataDb(utf8Json.Length); var stack = new StackRowStack(JsonDocumentOptions.DefaultMaxDepth * StackRow.Size); try { Parse(utf8JsonSpan, readerOptions, ref database, ref stack); } catch { database.Dispose(); throw; } finally { stack.Dispose(); } return new JsonDocument(utf8Json, database, extraRentedBytes); } private static ArraySegment<byte> ReadToEnd(Stream stream) { int written = 0; byte[]? rented = null; ReadOnlySpan<byte> utf8Bom = JsonConstants.Utf8Bom; try { if (stream.CanSeek) { // Ask for 1 more than the length to avoid resizing later, // which is unnecessary in the common case where the stream length doesn't change. long expectedLength = Math.Max(utf8Bom.Length, stream.Length - stream.Position) + 1; rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); } else { rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); } int lastRead; // Read up to 3 bytes to see if it's the UTF-8 BOM do { // No need for checking for growth, the minimal rent sizes both guarantee it'll fit. Debug.Assert(rented.Length >= utf8Bom.Length); lastRead = stream.Read( rented, written, utf8Bom.Length - written); written += lastRead; } while (lastRead > 0 && written < utf8Bom.Length); // If we have 3 bytes, and they're the BOM, reset the write position to 0. if (written == utf8Bom.Length && utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length))) { written = 0; } do { if (rented.Length == written) { byte[] toReturn = rented; rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2)); Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length); // Holds document content, clear it. ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); } lastRead = stream.Read(rented, written, rented.Length - written); written += lastRead; } while (lastRead > 0); return new ArraySegment<byte>(rented, 0, written); } catch { if (rented != null) { // Holds document content, clear it before returning it. rented.AsSpan(0, written).Clear(); ArrayPool<byte>.Shared.Return(rented); } throw; } } private static async #if BUILDING_INBOX_LIBRARY ValueTask<ArraySegment<byte>> #else Task<ArraySegment<byte>> #endif ReadToEndAsync( Stream stream, CancellationToken cancellationToken) { int written = 0; byte[]? rented = null; try { // Save the length to a local to be reused across awaits. int utf8BomLength = JsonConstants.Utf8Bom.Length; if (stream.CanSeek) { // Ask for 1 more than the length to avoid resizing later, // which is unnecessary in the common case where the stream length doesn't change. long expectedLength = Math.Max(utf8BomLength, stream.Length - stream.Position) + 1; rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); } else { rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); } int lastRead; // Read up to 3 bytes to see if it's the UTF-8 BOM do { // No need for checking for growth, the minimal rent sizes both guarantee it'll fit. Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length); lastRead = await stream.ReadAsync( #if BUILDING_INBOX_LIBRARY rented.AsMemory(written, utf8BomLength - written), #else rented, written, utf8BomLength - written, #endif cancellationToken).ConfigureAwait(false); written += lastRead; } while (lastRead > 0 && written < utf8BomLength); // If we have 3 bytes, and they're the BOM, reset the write position to 0. if (written == utf8BomLength && JsonConstants.Utf8Bom.SequenceEqual(rented.AsSpan(0, utf8BomLength))) { written = 0; } do { if (rented.Length == written) { byte[] toReturn = rented; rented = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2); Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length); // Holds document content, clear it. ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); } lastRead = await stream.ReadAsync( #if BUILDING_INBOX_LIBRARY rented.AsMemory(written), #else rented, written, rented.Length - written, #endif cancellationToken).ConfigureAwait(false); written += lastRead; } while (lastRead > 0); return new ArraySegment<byte>(rented, 0, written); } catch { if (rented != null) { // Holds document content, clear it before returning it. rented.AsSpan(0, written).Clear(); ArrayPool<byte>.Shared.Return(rented); } throw; } } } }
41.315718
169
0.503263
[ "MIT" ]
06needhamt/runtime
src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.Parse.cs
30,491
C#
using System; namespace HallOfBeorn.Models.LotR.ProductGroups { public class VengeanceOfMordorProductGroup : ProductGroup { public VengeanceOfMordorProductGroup() : base("Vengeance of Mordor Cycle") { AddMainProduct(Product.AShadowInTheEast); AddChildProduct(Product.WrathAndRuin); AddChildProduct(Product.TheCityOfUlfast); AddChildProduct(Product.ChallengeOfTheWainriders); AddChildProduct(Product.UnderTheAshMountains); AddChildProduct(Product.TheLandOfSorrow); AddChildProduct(Product.TheFortressOfNurn); AddChildProduct(Product.WrathAndRuinPreorderPromotion); AddChildProduct(Product.TheCityOfUlfastPreorderPromotion); AddChildProduct(Product.ChallengeOfTheWainridersPreorderPromotion); AddChildProduct(Product.UnderTheAshMountainsPreorderPromotion); AddChildProduct(Product.TheLandOfSorrowPreorderPromotion); AddChildProduct(Product.TheFortressOfNurnPreorderPromotion); } } }
42.769231
80
0.697842
[ "MIT" ]
danpoage/hall-of-beorn
src/HallOfBeorn/Models/LotR/ProductGroups/VengeanceOfMordorProductGroup.cs
1,114
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using BuildXL.Cache.ContentStore.Interfaces.Results; using BuildXL.Cache.ContentStore.Interfaces.Sessions; using BuildXL.Cache.ContentStore.Interfaces.Tracing; namespace BuildXL.Cache.MemoizationStore.Interfaces.Sessions { /// <summary> /// Useful extensions to IContentSession /// </summary> public static class ContentSessionExtensions { /// <summary> /// Ensure the existence of all related content by pinning it. /// </summary> public static async Task<bool> EnsureContentIsAvailableAsync(this IContentSession contentSession, Context context, ContentHashList contentHashList, CancellationToken cts) { // If there is no contentSession in which to find content, then trivially no content is available. if (contentSession == null) { return false; } // If the contentHashList does not exist, then trivially all content is pinned. if (contentHashList == null) { return true; } IEnumerable<Task<Indexed<PinResult>>> pinResultEnumerable = await contentSession.PinAsync(context, contentHashList.Hashes, cts).ConfigureAwait(false); var pinSucceeded = true; foreach (var pinResultTask in pinResultEnumerable) { var pinResult = await pinResultTask.ConfigureAwait(false); if (!pinResult.Item.Succeeded) { if (pinResult.Item.Code != PinResult.ResultCode.ContentNotFound) { context.Warning($"Pinning hash {contentHashList.Hashes[pinResult.Index]} failed with error {pinResult}"); } pinSucceeded = false; } } return pinSucceeded; } } }
39.490909
179
0.609576
[ "MIT" ]
AzureMentor/BuildXL
Public/Src/Cache/MemoizationStore/Interfaces/Sessions/ContentSessionExtensions.cs
2,172
C#
// Copyright 2017 the original author or 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. using Microsoft.Extensions.Logging; using Microsoft.Owin; using Steeltoe.Management.Endpoint; using Steeltoe.Management.Endpoint.HeapDump; using Steeltoe.Management.EndpointBase; using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Threading.Tasks; namespace Steeltoe.Management.EndpointOwin.HeapDump { public class HeapDumpEndpointOwinMiddleware : EndpointOwinMiddleware<string> { protected new HeapDumpEndpoint _endpoint; public HeapDumpEndpointOwinMiddleware(OwinMiddleware next, HeapDumpEndpoint endpoint, IEnumerable<IManagementOptions> mgmtOptions, ILogger<HeapDumpEndpointOwinMiddleware> logger = null) : base(next, endpoint, mgmtOptions, logger: logger) { _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); } [Obsolete] public HeapDumpEndpointOwinMiddleware(OwinMiddleware next, HeapDumpEndpoint endpoint, ILogger<HeapDumpEndpointOwinMiddleware> logger = null) : base(next, endpoint, logger: logger) { _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); } public override async Task Invoke(IOwinContext context) { if (!RequestVerbAndPathMatch(context.Request.Method, context.Request.Path.Value)) { await Next.Invoke(context); } else { await HandleHeapDumpRequestAsync(context); } } protected internal async Task HandleHeapDumpRequestAsync(IOwinContext context) { var filename = _endpoint.Invoke(); _logger?.LogDebug("Returning: {0}", filename); context.Response.Headers.SetValues("Content-Type", new string[] { "application/octet-stream" }); if (!File.Exists(filename)) { context.Response.StatusCode = (int)HttpStatusCode.NotFound; return; } string gzFilename = filename + ".gz"; var result = await Utils.CompressFileAsync(filename, gzFilename); if (result != null) { using (result) { context.Response.Headers.Add("Content-Disposition", new string[] { "attachment; filename=\"" + Path.GetFileName(gzFilename) + "\"" }); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.ContentLength = result.Length; await result.CopyToAsync(context.Response.Body); } File.Delete(gzFilename); } else { context.Response.StatusCode = (int)HttpStatusCode.NotFound; } } } }
37.626374
193
0.641063
[ "ECL-2.0", "Apache-2.0" ]
spring-operator/Management
src/Steeltoe.Management.EndpointOwin/HeapDump/HeapDumpEndpointOwinMiddleware.cs
3,426
C#
namespace EmployeeBonusSharp.Shared; public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public List<Certificate> Certificates { get; set; } public DateTime DateOfEmployment { get; set; } public int TotalVotesForHelpingOtherColleagues { get; set; } public List<PerformanceReviewByManager> AllPerformanceReviewByManager { get; set; } public PerformanceReviewByManager LastPerformanceReviewByManager { get { if (AllPerformanceReviewByManager is null or { Count: 0 }) return null; return (from x in AllPerformanceReviewByManager orderby x.DateOfReview select x) .LastOrDefault(); } } public Bonus EmployeeBonus { get; set; } }
32.230769
87
0.636038
[ "MIT" ]
marko-lohert/Talk-CSharp10-demo-app-EmployeeBonusSharp
Demo/EmployeeBonusSharp/EmployeeBonusSharp/Shared/Employee.cs
840
C#
using UnityEngine; using System; using UnityEngine.UI; using Modules.General.InAppPurchase; using Drawmasters.ServiceUtil; using Drawmasters.OffersSystem; using Drawmasters.Ui; namespace Drawmasters { [Serializable] public class ChoosableCardVisualStateData { public ChoosableCardState state = default; public GameObject mainRoot = default; public GameObject commonRoot = default; public GameObject forSubscriptionRoot = default; } public abstract class ChoosableCard<T> : MonoBehaviour { #region Fields [SerializeField] private Image[] icons = default; [SerializeField] private Button chooseButton = default; [SerializeField] private Button purchaseSubscriptionButton = default; [Header("View")] [SerializeField] private ChoosableCardVisualStateData[] visualStatesData = default; [SerializeField] private Animator cardAnimator = default; protected T currentType; private ChoosableCardState currentState; #endregion #region Properties public abstract bool IsActive { get; } public bool IsForSubscrption { get; private set; } #endregion #region Methods public virtual void Initialize() { chooseButton.onClick.AddListener(ChooseButton_OnClick); purchaseSubscriptionButton.onClick.AddListener(PurchaseSubscriptionButton_OnClick); } public virtual void Deinitialize() { chooseButton.onClick.RemoveListener(ChooseButton_OnClick); purchaseSubscriptionButton.onClick.RemoveListener(PurchaseSubscriptionButton_OnClick); } public virtual void SetupType(T type) { currentType = type; InitialRefresh(); RefreshIcons(); } public virtual void MarkForSubscription() => IsForSubscrption = true; public void RefreshView() { ChoosableCardState state; if (IsForSubscrption && !SubscriptionManager.Instance.IsSubscriptionActive) { state = ChoosableCardState.WaitingForSubscriptionPurchase; } else if (!IsBought(currentType)) { state = ChoosableCardState.Unbought; } else { state = IsActive ? ChoosableCardState.Active : ChoosableCardState.Inactive; } OnChangeCardState(state); } public void PlayShowAnimation() { cardAnimator.ResetTrigger(AnimationKeys.SkinCard.Disabled); cardAnimator.SetTrigger(AnimationKeys.SkinCard.Show); } public void PlayDisabledAnimation() { cardAnimator.SetTrigger(AnimationKeys.SkinCard.Disabled); cardAnimator.Update(default); } protected virtual void OnChangeCardState(ChoosableCardState state) { currentState = state; foreach (var data in visualStatesData) { CommonUtility.SetObjectActive(data.mainRoot, currentState == data.state); if (currentState == data.state) { CommonUtility.SetObjectActive(data.commonRoot, !IsForSubscrption); CommonUtility.SetObjectActive(data.forSubscriptionRoot, IsForSubscrption); } } } protected virtual void RefreshIcons() { foreach (var icon in icons) { icon.sprite = GetIconSprite(currentType); icon.SetNativeSize(); } } protected virtual void InitialRefresh() { } protected abstract void OnChooseCard(); protected abstract Sprite GetIconSprite(T type); protected abstract bool IsBought(T type); #endregion #region Events handlers private void ChooseButton_OnClick() => OnChooseCard(); protected virtual void PurchaseSubscriptionButton_OnClick() => GameServices.Instance.ProposalService.GetOffer<SubscriptionOffer>().ForcePropose(); #endregion } }
25.634731
98
0.613408
[ "Unlicense" ]
TheProxor/code-samples-from-pg
Assets/Scripts/GameFlow/Gui/Core/ChoosableCard.cs
4,283
C#
// This file has been generated by the GUI designer. Do not modify. public partial class MainWindow { private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.TextView textview; protected virtual void Build() { global::Stetic.Gui.Initialize(this); // Widget MainWindow this.Name = "MainWindow"; this.Title = global::Mono.Unix.Catalog.GetString("random_number_test"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Container child MainWindow.Gtk.Container+ContainerChild this.GtkScrolledWindow = new global::Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.textview = new global::Gtk.TextView(); this.textview.CanFocus = true; this.textview.Name = "textview"; this.textview.Editable = false; this.textview.WrapMode = ((global::Gtk.WrapMode)(3)); this.GtkScrolledWindow.Add(this.textview); this.Add(this.GtkScrolledWindow); if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 400; this.DefaultHeight = 300; this.Show(); this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent); this.textview.SizeAllocated += new global::Gtk.SizeAllocatedHandler(this.OnSizeAllocated); } }
34.075
92
0.744681
[ "BSD-2-Clause" ]
EvilusPL/random_number_test
random_number_test/gtk-gui/MainWindow.cs
1,363
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using Microsoft.Extensions.DependencyInjection; using System; namespace Microsoft.Azure.WebJobs.Extensions.Kafka { public static class KafkaWebJobsBuilderExtensions { /// <summary> /// Adds the Kafka extensions to the provider <see cref="IWebJobsBuilder"/> /// </summary> public static IWebJobsBuilder AddKafka(this IWebJobsBuilder builder) => AddKafka(builder, o => { }); /// <summary> /// Adds the Kafka extensions to the provider <see cref="IWebJobsBuilder"/> /// </summary> public static IWebJobsBuilder AddKafka(this IWebJobsBuilder builder, Action<KafkaOptions> configure) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } builder.AddExtension<KafkaExtensionConfigProvider>() .BindOptions<KafkaOptions>(); builder.Services.Configure<KafkaOptions>(options => { configure(options); }); builder.Services.AddSingleton<IKafkaProducerProvider, KafkaProducerProvider>(); return builder; } } }
33.113636
108
0.61359
[ "MIT" ]
TsuyoshiUshio/azure-functions-kafka-extension
src/Microsoft.Azure.WebJobs.Extensions.Kafka/Config/KafkaWebJobsBuilderExtensions.cs
1,459
C#
using UnityEngine; using System.Collections; namespace Obi { public interface IBendTwistConstraintsBatchImpl : IConstraintsBatchImpl { void SetBendTwistConstraints(ObiNativeIntList orientationIndices, ObiNativeQuaternionList restDarboux, ObiNativeVector3List stiffnesses, ObiNativeVector2List plasticity, ObiNativeFloatList lambdas, int count); } }
33.727273
217
0.822102
[ "Apache-2.0" ]
Kasunay/Venomx
Assets/Obi/Scripts/Common/Backends/Interface/Constraints/IBendTwistConstraintsBatchImpl.cs
373
C#
using System; using System.Web.Mvc; using Castle.Services.Transaction; using MvcContrib.Services; namespace MvcContrib.Castle { /// <summary> /// Indicates the transaction support for a method. /// This attribute is modeled after Castle's ATM: /// http://www.castleproject.org/container/facilities/v1rc3/atm/index.html /// /// Castle ATM used DynamicProxy to wrap the Transaction methods. This causes problems with Parameter Binders because DynamicProxy does /// not copy parameter attributes, a known bug (DYNPROXY-ISSUE-14) currently market as Won't Fix. (10/19/08) /// /// There is no Controller attribute for using the MvcTransactionAttribute, /// simply mark the methods that you want transactioned with MvcTransaction /// /// [MvcTransaction] /// public void ActionResult AddItem /// { /// //do work /// } /// /// Thrown Exceptions will cause a rollback. At minimum you'll need to configure an ITransactionManager with the ServiceLocator. /// For example with NHibernate and Rhino Tools this would go in your global.aspx.cs: /// /// Container.AddFacility("rhino_transaction", new RhinoTransactionFacility()); /// DependencyResolver.InitializeWith(new WindsorDependencyResolver(Container)); /// /// </summary> [Obsolete] [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class MvcTransactionAttribute : ActionFilterAttribute { private ITransaction transaction; private bool rolledback; /// <summary> /// Declares unspecified values for transaction and isolation, which /// means that the transaction manager will use the default values /// for them /// </summary> public MvcTransactionAttribute() : this(TransactionMode.Unspecified, IsolationMode.Unspecified) { } /// <summary> /// Declares the transaction mode, but omits the isolation, /// which means that the transaction manager should use the /// default value for it. /// </summary> /// <param name="transactionMode"></param> public MvcTransactionAttribute(TransactionMode transactionMode) : this(transactionMode, IsolationMode.Unspecified) { } /// <summary> /// Declares both the transaction mode and isolation /// desired for this method. The transaction manager should /// obey the declaration. /// </summary> /// <param name="transactionMode"></param> /// <param name="isolationMode"></param> public MvcTransactionAttribute(TransactionMode transactionMode, IsolationMode isolationMode) { TransactionMode = transactionMode; IsolationMode = isolationMode; Distributed = false; } /// <summary> /// Returns the <see cref="IsolationMode"/> /// </summary> public IsolationMode IsolationMode { get; set; } /// <summary> /// Returns the <see cref="TransactionMode"/> /// </summary> public TransactionMode TransactionMode { get; set; } /// <summary> /// Gets or sets a value indicating whether the transaction should be distributed. /// </summary> /// <value> /// <c>true</c> if a distributed transaction should be created; otherwise, <c>false</c>. /// </value> public bool Distributed { get; set; } public override void OnActionExecuting(ActionExecutingContext filterContext) { rolledback = false; var manager = DependencyResolver.Current.GetService<ITransactionManager>(); transaction = manager.CreateTransaction(TransactionMode, IsolationMode, Distributed); if (transaction != null) { transaction.Begin(); } base.OnActionExecuting(filterContext); } public override void OnActionExecuted(ActionExecutedContext filterContext) { if (transaction == null) throw new TransactionException("Transaction was never started."); Exception exception = filterContext.Exception; try { if (exception == null) { if (transaction.IsRollbackOnlySet) { rolledback = true; transaction.Rollback(); } else { transaction.Commit(); } } else throw exception; } catch (TransactionException) { throw; } catch (Exception) { if (!rolledback) { transaction.Rollback(); } throw; } finally { var manager = DependencyResolver.Current.GetService<ITransactionManager>(); manager.Dispose(transaction); transaction = null; } base.OnActionExecuted(filterContext); } } }
30.053333
137
0.67835
[ "Apache-2.0" ]
ekonbenefits/MVCContrib.FluentHtml
src/MvcContrib.Castle/MvcTransactionAttribute.cs
4,508
C#
// <auto-generated /> using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable namespace Reminder.api.Migrations { [DbContext(typeof(ApiDbContext))] [Migration("20211125233954_Initial Migration")] partial class InitialMigration { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "6.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Item", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); b.Property<bool>("IsCompleted") .HasColumnType("bit"); b.Property<string>("Title") .IsRequired() .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("Items"); }); #pragma warning restore 612, 618 } } }
31.479167
103
0.590338
[ "MIT" ]
William-io/Reminder
src/Reminder.api/Migrations/20211125233954_Initial Migration.Designer.cs
1,513
C#
// Copyright (c) 2001-2016 Aspose Pty Ltd. All Rights Reserved. // // This file is part of Aspose.Words. The source code in this file // is only intended as a supplement to the documentation, and is provided // "as is", without warranty of any kind, either expressed or implied. ////////////////////////////////////////////////////////////////////////// using System; using System.IO; using System.Data; using Aspose.Words; using Aspose.Words.Drawing; using Aspose.Words.Reporting; using NUnit.Framework; namespace ApiExamples { [TestFixture] public class ExReportingEngine : ApiExampleBase { private readonly string _image = MyDir + "Test_636_852.gif"; [Test] public void StretchImagefitHeight() { Document doc = DocumentHelper.CreateTemplateDocumentWithDrawObjects("<<image [src.Image] -fitHeight>>", ShapeType.TextBox); ImageStream imageStream = new ImageStream(new FileStream(this._image, FileMode.Open, FileAccess.Read)); BuildReport(doc, imageStream, "src", ReportBuildOptions.None); MemoryStream dstStream = new MemoryStream(); doc.Save(dstStream, SaveFormat.Docx); doc = new Document(dstStream); NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true); foreach (Shape shape in shapes) { // Assert that the image is really insert in textbox Assert.IsTrue(shape.ImageData.HasImage); //Assert that width is keeped and height is changed Assert.AreNotEqual(346.35, shape.Height); Assert.AreEqual(431.5, shape.Width); } dstStream.Dispose(); } [Test] public void StretchImagefitWidth() { Document doc = DocumentHelper.CreateTemplateDocumentWithDrawObjects("<<image [src.Image] -fitWidth>>", ShapeType.TextBox); ImageStream imageStream = new ImageStream(new FileStream(this._image, FileMode.Open, FileAccess.Read)); BuildReport(doc, imageStream, "src", ReportBuildOptions.None); MemoryStream dstStream = new MemoryStream(); doc.Save(dstStream, SaveFormat.Docx); doc = new Document(dstStream); NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true); foreach (Shape shape in shapes) { // Assert that the image is really insert in textbox and Assert.IsTrue(shape.ImageData.HasImage); //Assert that height is keeped and width is changed Assert.AreNotEqual(431.5, shape.Width); Assert.AreEqual(346.35, shape.Height); } dstStream.Dispose(); } [Test] public void StretchImagefitSize() { Document doc = DocumentHelper.CreateTemplateDocumentWithDrawObjects("<<image [src.Image] -fitSize>>", ShapeType.TextBox); ImageStream imageStream = new ImageStream(new FileStream(this._image, FileMode.Open, FileAccess.Read)); BuildReport(doc, imageStream, "src", ReportBuildOptions.None); MemoryStream dstStream = new MemoryStream(); doc.Save(dstStream, SaveFormat.Docx); doc = new Document(dstStream); NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true); foreach (Shape shape in shapes) { // Assert that the image is really insert in textbox Assert.IsTrue(shape.ImageData.HasImage); //Assert that height is changed and width is changed Assert.AreNotEqual(346.35, shape.Height); Assert.AreNotEqual(431.5, shape.Width); } dstStream.Dispose(); } [Test] public void WithoutMissingMembers() { DocumentBuilder builder = new DocumentBuilder(); //Add templete to the document for reporting engine DocumentHelper.InsertBuilderText(builder, new[] { "<<[missingObject.First().id]>>", "<<foreach [in missingObject]>><<[id]>><</foreach>>" }); //Assert that build report failed without "ReportBuildOptions.AllowMissingMembers" Assert.That(() => BuildReport(builder.Document, new DataSet(), "", ReportBuildOptions.None), Throws.TypeOf<InvalidOperationException>()); } [Test] public void WithMissingMembers() { DocumentBuilder builder = new DocumentBuilder(); //Add templete to the document for reporting engine DocumentHelper.InsertBuilderText(builder, new[] { "<<[missingObject.First().id]>>", "<<foreach [in missingObject]>><<[id]>><</foreach>>" }); BuildReport(builder.Document, new DataSet(), "", ReportBuildOptions.AllowMissingMembers); //Assert that build report success with "ReportBuildOptions.AllowMissingMembers" Assert.AreEqual( ControlChar.ParagraphBreak + ControlChar.ParagraphBreak + ControlChar.SectionBreak, builder.Document.GetText()); } private static void BuildReport(Document document, object dataSource, string dataSourceName, ReportBuildOptions reportBuildOptions) { ReportingEngine engine = new ReportingEngine(); engine.Options = reportBuildOptions; engine.BuildReport(document, dataSource, dataSourceName); } private static void BuildReport(Document document, object[] dataSource, string[] dataSourceName) { ReportingEngine engine = new ReportingEngine(); engine.BuildReport(document, dataSource, dataSourceName); } } } public class ImageStream { public ImageStream(Stream stream) { this.Image = stream; } public Stream Image { get; set; } }
36.506173
152
0.621238
[ "MIT" ]
Aspose/Aspose.Words-for-.NET
ApiExamples/CSharp/ExReportingEngine.cs
5,916
C#
using System; using FluentAssertions; using NUnit.Framework; namespace StatementConverter.Test { [TestFixture] public class GenericMethodTest { [SetUp] public void Setup() { Helper.Setup(); } [Test] public void Default() { var lamdaExpression = Helper.GetLamdaExpression("GenericMethodTestClass", "GenericMethod"); var del = lamdaExpression.Compile(); var instance = new GenericMethodTestClass(); var result = del.DynamicInvoke(instance, "hello"); result.Should().Be("hello"); } } }
20.709677
103
0.577882
[ "MIT" ]
andreinitescu/HotReloading
Core/StatementConverter.Test/IntegrationTests/GenericMethodTest.cs
644
C#