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
using System.Collections.Generic; using Macad.Interaction.Visual; using Macad.Common; using Macad.Core.Shapes; using Macad.Occt; namespace Macad.Interaction.Editors.Shapes { public sealed class SketchSegmentArcCenterCreator : ISketchSegmentCreator { SketchEditorTool _SketchEditorTool; SketchPointAction _PointAction; SketchSegmentArc _Segment; HintCircle _PreviewLine; readonly HintLine[] _HintLines = new HintLine[2]; Coord2DHudElement _Coord2DHudElement; LabelHudElement _LabelHudElement; SketchEditorSegmentElement _Element; readonly Dictionary<int, Pnt2d> _Points = new Dictionary<int, Pnt2d>(3); readonly int[] _MergePointIndices = new int[3]; int _PointsCompleted = 0; Pnt2d _CenterPoint; double _LastEndParameter = 0; bool _ArcDirection = false; //-------------------------------------------------------------------------------------------------- public bool Start(SketchEditorTool sketchEditorTool) { _SketchEditorTool = sketchEditorTool; _PointAction = new SketchPointAction(sketchEditorTool); if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false)) return false; _PointAction.Previewed += _OnActionPreview; _PointAction.Finished += _OnActionFinished; _Coord2DHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement<Coord2DHudElement>(this); _SketchEditorTool.StatusText = "Select center point for circular arc."; return true; } //-------------------------------------------------------------------------------------------------- public void Stop() { if (_PreviewLine != null) { _PreviewLine.Remove(); _PreviewLine = null; } for (int i = 0; i < _HintLines.Length; i++) { if (_HintLines[i] != null) _HintLines[i].Remove(); _HintLines[i] = null; } _Element?.Remove(); _PointAction.ConstraintPoint -= _PointActionOnConstraintPoint; _PointAction.Stop(); _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement); _Coord2DHudElement = null; _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_LabelHudElement); _LabelHudElement = null; } //-------------------------------------------------------------------------------------------------- public bool Continue(int continueWithPoint) { return false; } //-------------------------------------------------------------------------------------------------- void _OnActionPreview(ToolAction toolAction) { if (toolAction == _PointAction) { switch (_PointsCompleted) { case 1: if (_PreviewLine == null) { _PreviewLine = new HintCircle(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost); } if (_HintLines[0] == null) { _HintLines[0] = new HintLine(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost); } var p1 = _CenterPoint; var p2 = _PointAction.Point; var circ = new gce_MakeCirc2d(p1, p2).Value(); _PreviewLine.Set(circ, _SketchEditorTool.Sketch.Plane); _HintLines[0].Set(_CenterPoint, _PointAction.Point, _SketchEditorTool.Sketch.Plane); if (_LabelHudElement == null) _LabelHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement<LabelHudElement>(this); _LabelHudElement?.SetValue("Radius: " + circ.Radius().ToRoundedString()); break; case 2: if (_HintLines[1] == null) { _HintLines[1] = new HintLine(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost); } _HintLines[1].Set(_CenterPoint, _PointAction.Point, _SketchEditorTool.Sketch.Plane); if (_Segment != null) { _CalcArcRimPoints(_PointAction.Point); _Element.OnPointsChanged(_Points, null); } break; } _Coord2DHudElement?.SetValues(_PointAction.Point.X, _PointAction.Point.Y); } } //-------------------------------------------------------------------------------------------------- bool _CalcArcRimPoints(Pnt2d endPoint) { // Project end point on circle var startPoint = _Points[0]; if ((startPoint.Distance(endPoint) <= 0) || (endPoint.Distance(_CenterPoint) <= 0) || (startPoint.Distance(_CenterPoint) <= 0)) return false; var xAxis = new Ax2d(_CenterPoint, new Dir2d(new Vec2d(_CenterPoint, startPoint))); var radius = _CenterPoint.Distance(startPoint); var circ = new gp_Circ2d(xAxis, radius, _ArcDirection); var projEndPoint = new Geom2dAPI_ProjectPointOnCurve(endPoint, new Geom2d_Circle(circ)).NearestPoint(); // Check if we should toggle the direction var endParameter = ElCLib.Parameter(circ, projEndPoint); // If the last parameter was very small (~PI/2), and the current is very high (~PI*1.5), toggle direction if (((_LastEndParameter < 1) && (endParameter > 5)) || ((endParameter < 1) && (_LastEndParameter > 5))) { _ArcDirection = !_ArcDirection; circ = new gp_Circ2d(xAxis, radius, _ArcDirection); endParameter = ElCLib.Parameter(circ, projEndPoint); } _LastEndParameter = endParameter; // Calc rim point var rimPoint = ElCLib.Value(endParameter/2, circ); _Points[1] = projEndPoint; _Points[2] = rimPoint; return true; } //-------------------------------------------------------------------------------------------------- void _OnActionFinished(ToolAction toolAction) { if (toolAction == _PointAction) { switch (_PointsCompleted) { case 0: _CenterPoint = _PointAction.Point; _PointsCompleted++; _SketchEditorTool.StatusText = "Select start point for circular arc."; _PointAction.Reset(); break; case 1: if (_CenterPoint.Distance(_PointAction.Point) < 0.001) { // Minimum length not met _PointAction.Reset(); return; } if (_PreviewLine != null) { _PreviewLine.Remove(); _PreviewLine = null; } _Points.Add(0, _PointAction.Point); _MergePointIndices[0] = _PointAction.MergeCandidateIndex; _PointsCompleted++; _Points.Add(1, _PointAction.Point); _Points.Add(2, _PointAction.Point); _Segment = new SketchSegmentArc(0, 1, 2); _Element = new SketchEditorSegmentElement(_SketchEditorTool, -1, _Segment, _SketchEditorTool.Transform, _SketchEditorTool.Sketch.Plane); _Element.IsCreating = true; _Element.OnPointsChanged(_Points, null); _SketchEditorTool.StatusText = "Select end point for circular arc."; _PointAction.Reset(); _PointAction.ConstraintPoint += _PointActionOnConstraintPoint; break; case 2: if (!_CalcArcRimPoints(_PointAction.Point) || _Points[0].Distance(_Points[2]) < 0.001) { // Minimum length not met _PointAction.Reset(); return; } _PointAction.Stop(); _MergePointIndices[1] = _PointAction.MergeCandidateIndex; _MergePointIndices[2] = -1; _SketchEditorTool.FinishSegmentCreation(_Points, _MergePointIndices, new SketchSegment[] { _Segment }, null); break; } } } //-------------------------------------------------------------------------------------------------- void _PointActionOnConstraintPoint(SketchPointAction sender, ref Pnt2d point) { if (_PointsCompleted == 2) { _CalcArcRimPoints(point); point = _Points[1]; } } //-------------------------------------------------------------------------------------------------- } }
41.703704
161
0.462996
[ "MIT" ]
NanoFabricFX/Macad3D
Source/Macad.Interaction/Editors/Shapes/Sketch/SketchSegmentArcCenterCreator.cs
10,136
C#
// Project: Aguafrommars/TheIdServer // Copyright (c) 2022 @Olivier Lefebvre using System; using Aguacongas.IdentityServer.EntityFramework.Store; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Aguacongas.TheIdServer.MySql.Migrations.ConfigurationDb { [DbContext(typeof(ConfigurationDbContext))] [Migration("20200725174419_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "3.1.6") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("Aguacongas.IdentityServer.EntityFramework.Store.SchemeDefinition", b => { b.Property<string>("Scheme") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("DisplayName") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<bool>("MapDefaultOutboundClaimType") .HasColumnType("tinyint(1)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("SerializedHandlerType") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<string>("SerializedOptions") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<bool>("StoreClaims") .HasColumnType("tinyint(1)"); b.HasKey("Scheme"); b.ToTable("Providers"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiApiScope", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiScopeId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.HasKey("Id"); b.HasIndex("ApiId"); b.HasIndex("ApiScopeId"); b.ToTable("ApiApiScope"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiClaim", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Type") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.HasKey("Id"); b.HasIndex("ApiId", "Type") .IsUnique(); b.ToTable("ApiClaims"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiLocalizedResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("CultureId") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<int>("ResourceKind") .HasColumnType("int"); b.Property<string>("Value") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("ApiId"); b.ToTable("ApiLocalizedResources"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiProperty", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Key") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Value") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.HasKey("Id"); b.HasIndex("ApiId", "Key") .IsUnique(); b.ToTable("ApiProperty"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScope", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Description") .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") .HasMaxLength(1000); b.Property<string>("DisplayName") .IsRequired() .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.Property<bool>("Emphasize") .HasColumnType("tinyint(1)"); b.Property<bool>("Enabled") .HasColumnType("tinyint(1)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<bool>("Required") .HasColumnType("tinyint(1)"); b.Property<bool>("ShowInDiscoveryDocument") .HasColumnType("tinyint(1)"); b.HasKey("Id"); b.ToTable("ApiScopes"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScopeClaim", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiScopeId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Type") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.HasKey("Id"); b.HasIndex("ApiScopeId", "Type") .IsUnique(); b.ToTable("ApiScopeClaims"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScopeLocalizedResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiScopeId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("CultureId") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<int>("ResourceKind") .HasColumnType("int"); b.Property<string>("Value") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("ApiScopeId"); b.ToTable("ApiScopeLocalizedResources"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScopeProperty", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiScopeId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Key") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Value") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.HasKey("Id"); b.HasIndex("ApiScopeId", "Key") .IsUnique(); b.ToTable("ApiScopeProperty"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiSecret", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ApiId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Description") .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") .HasMaxLength(1000); b.Property<DateTime?>("Expiration") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Type") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<string>("Value") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("ApiId"); b.ToTable("ApiSecrets"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.Client", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<int>("AbsoluteRefreshTokenLifetime") .HasColumnType("int"); b.Property<int>("AccessTokenLifetime") .HasColumnType("int"); b.Property<int>("AccessTokenType") .HasColumnType("int"); b.Property<bool>("AllowAccessTokensViaBrowser") .HasColumnType("tinyint(1)"); b.Property<bool>("AllowOfflineAccess") .HasColumnType("tinyint(1)"); b.Property<bool>("AllowPlainTextPkce") .HasColumnType("tinyint(1)"); b.Property<bool>("AllowRememberConsent") .HasColumnType("tinyint(1)"); b.Property<bool>("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("tinyint(1)"); b.Property<bool>("AlwaysSendClientClaims") .HasColumnType("tinyint(1)"); b.Property<int>("AuthorizationCodeLifetime") .HasColumnType("int"); b.Property<bool>("BackChannelLogoutSessionRequired") .HasColumnType("tinyint(1)"); b.Property<string>("BackChannelLogoutUri") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.Property<string>("ClientClaimsPrefix") .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<string>("ClientName") .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.Property<string>("ClientUri") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.Property<int?>("ConsentLifetime") .HasColumnType("int"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Description") .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") .HasMaxLength(1000); b.Property<int>("DeviceCodeLifetime") .HasColumnType("int"); b.Property<bool>("EnableLocalLogin") .HasColumnType("tinyint(1)"); b.Property<bool>("Enabled") .HasColumnType("tinyint(1)"); b.Property<bool>("FrontChannelLogoutSessionRequired") .HasColumnType("tinyint(1)"); b.Property<string>("FrontChannelLogoutUri") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.Property<int>("IdentityTokenLifetime") .HasColumnType("int"); b.Property<bool>("IncludeJwtId") .HasColumnType("tinyint(1)"); b.Property<string>("LogoUri") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<bool>("NonEditable") .HasColumnType("tinyint(1)"); b.Property<string>("PairWiseSubjectSalt") .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.Property<string>("ProtocolType") .IsRequired() .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.Property<int>("RefreshTokenExpiration") .HasColumnType("int"); b.Property<int>("RefreshTokenUsage") .HasColumnType("int"); b.Property<bool>("RequireClientSecret") .HasColumnType("tinyint(1)"); b.Property<bool>("RequireConsent") .HasColumnType("tinyint(1)"); b.Property<bool>("RequirePkce") .HasColumnType("tinyint(1)"); b.Property<int>("SlidingRefreshTokenLifetime") .HasColumnType("int"); b.Property<bool>("UpdateAccessTokenClaimsOnRefresh") .HasColumnType("tinyint(1)"); b.Property<string>("UserCodeType") .HasColumnType("varchar(100) CHARACTER SET utf8mb4") .HasMaxLength(100); b.Property<int?>("UserSsoLifetime") .HasColumnType("int"); b.HasKey("Id"); b.ToTable("Clients"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientClaim", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Type") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<string>("Value") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("ClientId"); b.ToTable("ClientClaims"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientGrantType", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("GrantType") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.HasKey("Id"); b.HasIndex("ClientId", "GrantType") .IsUnique(); b.ToTable("ClientGrantTypes"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientIdpRestriction", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Provider") .IsRequired() .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.HasKey("Id"); b.HasIndex("ClientId", "Provider") .IsUnique(); b.ToTable("ClientIdpRestriction"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientLocalizedResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("CultureId") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<int>("ResourceKind") .HasColumnType("int"); b.Property<string>("Value") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("ClientId"); b.ToTable("ClientLocalizedResources"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientProperty", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Key") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Value") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.HasKey("Id"); b.HasIndex("ClientId", "Key") .IsUnique(); b.ToTable("ClientProperties"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientScope", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Scope") .IsRequired() .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.HasKey("Id"); b.HasIndex("ClientId", "Scope") .IsUnique(); b.ToTable("ClientScopes"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientSecret", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Description") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.Property<DateTime?>("Expiration") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Type") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<string>("Value") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("ClientId"); b.ToTable("ClientSecrets"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientUri", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ClientId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<int>("Kind") .HasColumnType("int"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("SanetizedCorsUri") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.Property<string>("Uri") .IsRequired() .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.HasKey("Id"); b.HasIndex("ClientId", "Uri") .IsUnique(); b.ToTable("ClientUris"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.Culture", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.HasKey("Id"); b.ToTable("Cultures"); b.HasData( new { Id = "en", CreatedAt = new DateTime(2020, 7, 25, 17, 44, 19, 192, DateTimeKind.Utc).AddTicks(5978) }); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ExternalClaimTransformation", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<bool>("AsMultipleValues") .HasColumnType("tinyint(1)"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("FromClaimType") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Scheme") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ToClaimType") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("Scheme", "FromClaimType") .IsUnique(); b.ToTable("ExternalClaimTransformations"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityClaim", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("IdentityId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Type") .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.HasKey("Id"); b.HasIndex("IdentityId", "Type") .IsUnique(); b.ToTable("IdentityClaims"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityLocalizedResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("CultureId") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<string>("IdentityId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<int>("ResourceKind") .HasColumnType("int"); b.Property<string>("Value") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("IdentityId"); b.ToTable("IdentityLocalizedResources"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityProperty", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("IdentityId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("Key") .IsRequired() .HasColumnType("varchar(250) CHARACTER SET utf8mb4") .HasMaxLength(250); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Value") .HasColumnType("varchar(2000) CHARACTER SET utf8mb4") .HasMaxLength(2000); b.HasKey("Id"); b.HasIndex("IdentityId", "Key") .IsUnique(); b.ToTable("IdentityProperties"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Description") .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") .HasMaxLength(1000); b.Property<string>("DisplayName") .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.Property<bool>("Emphasize") .HasColumnType("tinyint(1)"); b.Property<bool>("Enabled") .HasColumnType("tinyint(1)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<bool>("NonEditable") .HasColumnType("tinyint(1)"); b.Property<bool>("Required") .HasColumnType("tinyint(1)"); b.Property<bool>("ShowInDiscoveryDocument") .HasColumnType("tinyint(1)"); b.HasKey("Id"); b.ToTable("Identities"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.LocalizedResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("BaseName") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("CultureId") .IsRequired() .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("Key") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<string>("Location") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<string>("Value") .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.HasIndex("CultureId"); b.ToTable("LocalizedResources"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ProtectResource", b => { b.Property<string>("Id") .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<DateTime>("CreatedAt") .HasColumnType("datetime(6)"); b.Property<string>("Description") .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") .HasMaxLength(1000); b.Property<string>("DisplayName") .IsRequired() .HasColumnType("varchar(200) CHARACTER SET utf8mb4") .HasMaxLength(200); b.Property<bool>("Enabled") .HasColumnType("tinyint(1)"); b.Property<DateTime?>("ModifiedAt") .HasColumnType("datetime(6)"); b.Property<bool>("NonEditable") .HasColumnType("tinyint(1)"); b.HasKey("Id"); b.ToTable("Apis"); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiApiScope", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ProtectResource", "Api") .WithMany("ApiScopes") .HasForeignKey("ApiId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Aguacongas.IdentityServer.Store.Entity.ApiScope", "ApiScope") .WithMany("Apis") .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiClaim", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ProtectResource", "Api") .WithMany("ApiClaims") .HasForeignKey("ApiId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiLocalizedResource", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ProtectResource", "Api") .WithMany("Resources") .HasForeignKey("ApiId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiProperty", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ProtectResource", "Api") .WithMany("Properties") .HasForeignKey("ApiId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScopeClaim", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ApiScope", "ApiScope") .WithMany("ApiScopeClaims") .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScopeLocalizedResource", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ApiScope", "ApiScope") .WithMany("Resources") .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiScopeProperty", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ApiScope", "ApiScope") .WithMany("Properties") .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ApiSecret", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.ProtectResource", "Api") .WithMany("Secrets") .HasForeignKey("ApiId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientClaim", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("ClientClaims") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientGrantType", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientIdpRestriction", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientLocalizedResource", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("Resources") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientProperty", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("Properties") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientScope", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("AllowedScopes") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientSecret", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("ClientSecrets") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ClientUri", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Client", "Client") .WithMany("RedirectUris") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.ExternalClaimTransformation", b => { b.HasOne("Aguacongas.IdentityServer.EntityFramework.Store.SchemeDefinition", null) .WithMany("ClaimTransformations") .HasForeignKey("Scheme") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityClaim", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.IdentityResource", "Identity") .WithMany("IdentityClaims") .HasForeignKey("IdentityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityLocalizedResource", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.IdentityResource", "Identity") .WithMany("Resources") .HasForeignKey("IdentityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.IdentityProperty", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.IdentityResource", "Identity") .WithMany("Properties") .HasForeignKey("IdentityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Aguacongas.IdentityServer.Store.Entity.LocalizedResource", b => { b.HasOne("Aguacongas.IdentityServer.Store.Entity.Culture", "Culture") .WithMany("Resources") .HasForeignKey("CultureId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); #pragma warning restore 612, 618 } } }
39.049789
115
0.460323
[ "Apache-2.0" ]
LibertyEngineeringMovement/TheIdServer
src/IdentityServer/Migrations/Aguacongas.TheIdServer.Migrations.MySql/Migrations/ConfigurationDb/20200725174419_Initial.Designer.cs
46,276
C#
using MetaQuotes.MT5CommonAPI; using MetaQuotes.MT5ManagerAPI; using MT5Wrapper.Interface.EventSource; using System; using System.IO; using System.Reflection; namespace MT5Wrapper.MT5.Sinks { internal class ManagerSink : CIMTManagerSink, IConnectionEventSource { private bool Disposed { get; set; } = false; public CIMTManagerAPI ManagerAPI { get; private set; } #region IConnectionEventSource public event EventHandler ConnectedEventHandler; public event EventHandler DisconnectedEventHandler; #endregion IConnectionEventSource public ManagerSink() { try { Initialize(); } catch (Exception ex) { throw new TypeInitializationException(typeof(ManagerSink).AssemblyQualifiedName, ex); } } private string GetMTDllPath() { var exePath = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase); var dirPath = Path.GetDirectoryName(exePath.LocalPath); var dllPath = $@"{dirPath}\"; return dllPath; } private void Initialize() { try { // Initialize the factory MTRetCode res = SMTManagerAPIFactory.Initialize(GetMTDllPath()); if (MTRetCode.MT_RET_OK != res) { throw new MT5Exception("SMTManagerAPIFactory.Initialize failed", res); } // Receive the API version res = SMTManagerAPIFactory.GetVersion(out uint version); if (MTRetCode.MT_RET_OK != res) { throw new MT5Exception("SMTManagerAPIFactory.GetVersion failed", res); } // Check API version if (version != SMTManagerAPIFactory.ManagerAPIVersion) { throw new MT5Exception($"Manager API version mismatch - {version}!={SMTManagerAPIFactory.ManagerAPIVersion}"); } // Create new manager ManagerAPI = SMTManagerAPIFactory.CreateManager(version, out res); if (MTRetCode.MT_RET_OK != res) { throw new MT5Exception("SMTManagerAPIFactory.CreateManager failed", res); } if (null == ManagerAPI) { throw new MT5Exception("SMTManagerAPIFactory.CreateManager returned null"); } // res = RegisterSink(); if (MTRetCode.MT_RET_OK != res) { throw new MT5Exception("CIMTManagerSink.RegisterSink failed", res); } // Subscribe for events res = ManagerAPI.Subscribe(this); if (MTRetCode.MT_RET_OK != res) { throw new MT5Exception("CIMTManagerAPI.Subscribe failed", res); } } catch { ManagerAPI?.Release(); SMTManagerAPIFactory.Shutdown(); throw; } } #region CIMTManagerSink public override void OnDisconnect() { DisconnectedEventHandler?.Invoke(this, EventArgs.Empty); base.OnDisconnect(); } public override void OnConnect() { ConnectedEventHandler?.Invoke(this, EventArgs.Empty); base.OnConnect(); } protected override void Dispose(bool disposing) { if (Disposed) { return; } if (disposing) { ManagerAPI?.Unsubscribe(this); Disconnect(); ManagerAPI?.Release(); SMTManagerAPIFactory.Shutdown(); } base.Dispose(disposing); Disposed = true; } #endregion CIMTManagerSink public void Connect(ConnectionParams config) { if (Disposed) { throw new ObjectDisposedException(GetType().FullName); } if (null == config) { throw new ArgumentNullException(nameof(config)); } MTRetCode res = ManagerAPI.Connect(config.IP, config.Login, config.Password, null, CIMTManagerAPI.EnPumpModes.PUMP_MODE_FULL, config.ConnectionTimeout); if (MTRetCode.MT_RET_OK != res) { throw new MT5Exception($"Connect to {config.IP} as {config.Login} failed", res); } } public void Disconnect() { if (Disposed) { throw new ObjectDisposedException(GetType().FullName); } ManagerAPI.Disconnect(); } } }
25.629371
155
0.700136
[ "MIT" ]
jaroslavcervenka/trading-watchdog-utility
src/MT5Wrapper/MT5/Sinks/ManagerSink.cs
3,667
C#
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) Microsoft Corporation. All rights reserved. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// namespace Microsoft.SPOT.MFUpdate { using System.Text; using System.Collections; /// <summary> /// Represents an single indexed update packet. All packets for an update must /// be the same length so that the storage facility can track which packets have /// been installed. The one exception is that the last packet may be smaller than /// the packet size if the update size is not a multiple of the packet size. /// </summary> public class MFUpdatePkt { /// <summary> /// Creates an update packet. /// </summary> /// <param name="packetIndex">The index of the packet.</param> /// <param name="data">The packet data to be stored.</param> /// <param name="validationData">The validation data for the packet (e.g. CRC, signature, etc).</param> public MFUpdatePkt(int packetIndex, byte[] data, byte[] validationData) { PacketIndex = packetIndex; ValidationData = validationData; Data = data; } /// <summary> /// The readonly zero based packet index. /// </summary> public readonly int PacketIndex; /// <summary> /// The validation data for the packet. /// </summary> public readonly byte[] ValidationData; /// <summary> /// The data bytes for the packet. /// </summary> public readonly byte[] Data; } }
43.644444
202
0.464358
[ "Apache-2.0" ]
AustinWise/Netduino-Micro-Framework
Framework/Core/Update/MFUpdatePkt.cs
1,966
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Real = System.Double; namespace M2M.Position { [Serializable] public struct Adjacency : IAdjacency { private IPosition_Connected p; private Real d; public Adjacency(IPosition_Connected pisition, Real distance) { p = pisition; d = distance; } #region IAdjacency Members public IPosition_Connected GetPosition_Connected() { return p; } public double GetDistance() { return d; } #endregion } }
19.742857
70
0.549928
[ "MIT" ]
faizol/ai-algorithmplatform
AIAlgorithmPlatform/2008/algorithm/position/M2M.Position/Adjacency.cs
693
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 System.Collections.Generic; using System.Globalization; using System.IO; using System.IO.Pipelines; using System.Linq; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Moq; using Xunit; using BadHttpRequestException = Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException; namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests; public class ResponseTests : TestApplicationErrorLoggerLoggedTest { [Fact] public async Task OnCompleteCalledEvenWhenOnStartingNotCalled() { var onStartingCalled = false; TaskCompletionSource onCompletedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(context => { context.Response.OnStarting(() => Task.Run(() => onStartingCalled = true)); context.Response.OnCompleted(() => Task.Run(() => { onCompletedTcs.SetResult(); })); // Prevent OnStarting call (see HttpProtocol.ProcessRequestsAsync()). throw new Exception(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); await onCompletedTcs.Task.DefaultTimeout(); Assert.False(onStartingCalled); } } } [Fact] public async Task OnStartingThrowsWhenSetAfterResponseHasAlreadyStarted() { InvalidOperationException ex = null; await using (var server = new TestServer(async context => { await context.Response.WriteAsync("hello, world"); await context.Response.BodyWriter.FlushAsync(); ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive($"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); Assert.NotNull(ex); } } } [Fact] public async Task OnStartingThrowsWhenSetAfterStartAsyncIsCalled() { InvalidOperationException ex = null; await using (var server = new TestServer(async context => { await context.Response.StartAsync(); ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null)); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive($"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); Assert.NotNull(ex); } } } [Fact] public async Task ResponseBodyWriteAsyncCanBeCancelled() { var serviceContext = new TestServiceContext(LoggerFactory); var cts = new CancellationTokenSource(); var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var writeBlockedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async context => { try { await context.Response.WriteAsync("hello", cts.Token).DefaultTimeout(); var data = new byte[1024 * 1024 * 10]; var timerTask = Task.Delay(TimeSpan.FromSeconds(1)); var writeTask = context.Response.BodyWriter.WriteAsync(new Memory<byte>(data, 0, data.Length), cts.Token).AsTask().DefaultTimeout(); var completedTask = await Task.WhenAny(writeTask, timerTask); while (completedTask == writeTask) { await writeTask; timerTask = Task.Delay(TimeSpan.FromSeconds(1)); writeTask = context.Response.BodyWriter.WriteAsync(new Memory<byte>(data, 0, data.Length), cts.Token).AsTask().DefaultTimeout(); completedTask = await Task.WhenAny(writeTask, timerTask); } writeBlockedTcs.TrySetResult(); await writeTask; } catch (Exception ex) { appTcs.TrySetException(ex); writeBlockedTcs.TrySetException(ex); } finally { appTcs.TrySetResult(); } }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive($"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "5", "hello"); await writeBlockedTcs.Task.DefaultTimeout(); cts.Cancel(); await Assert.ThrowsAsync<OperationCanceledException>(() => appTcs.Task).DefaultTimeout(); } } } [Fact] public async Task BodyWriterWriteAsync_OnAbortedRequest_ReturnsResultWithIsCompletedTrue() { var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using var server = new TestServer(async context => { try { context.Abort(); var payload = Encoding.ASCII.GetBytes("hello world"); var result = await context.Response.BodyWriter.WriteAsync(payload); Assert.True(result.IsCompleted); appTcs.SetResult(); } catch (Exception ex) { appTcs.SetException(ex); } }); using var connection = server.CreateConnection(); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await appTcs.Task; } [Fact] public async Task BodyWriterWriteAsync_OnCanceledPendingFlush_ReturnsResultWithIsCanceled() { await using var server = new TestServer(async context => { context.Response.BodyWriter.CancelPendingFlush(); var payload = Encoding.ASCII.GetBytes("hello,"); var cancelledResult = await context.Response.BodyWriter.WriteAsync(payload); Assert.True(cancelledResult.IsCanceled); var secondPayload = Encoding.ASCII.GetBytes(" world"); var goodResult = await context.Response.BodyWriter.WriteAsync(secondPayload); Assert.False(goodResult.IsCanceled); }); using var connection = server.CreateConnection(); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive($"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "6", "hello," ); await connection.Receive("", "6", " world" ); } [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposeAppException() { return ResponseStatusCodeSetBeforeHttpContextDispose( TestSink, LoggerFactory, context => { throw new Exception(); }, expectedClientStatusCode: HttpStatusCode.InternalServerError, expectedServerStatusCode: HttpStatusCode.InternalServerError); } [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposeRequestAborted() { return ResponseStatusCodeSetBeforeHttpContextDispose( TestSink, LoggerFactory, context => { context.Abort(); return Task.CompletedTask; }, expectedClientStatusCode: null, expectedServerStatusCode: 0); } [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposeRequestAbortedAppException() { return ResponseStatusCodeSetBeforeHttpContextDispose( TestSink, LoggerFactory, context => { context.Abort(); throw new Exception(); }, expectedClientStatusCode: null, expectedServerStatusCode: 0); } [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposedRequestMalformed() { return ResponseStatusCodeSetBeforeHttpContextDispose( TestSink, LoggerFactory, context => { return Task.CompletedTask; }, expectedClientStatusCode: HttpStatusCode.OK, expectedServerStatusCode: HttpStatusCode.OK, sendMalformedRequest: true); } [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposedRequestMalformedRead() { return ResponseStatusCodeSetBeforeHttpContextDispose( TestSink, LoggerFactory, async context => { await context.Request.Body.ReadAsync(new byte[1], 0, 1); }, expectedClientStatusCode: null, expectedServerStatusCode: HttpStatusCode.BadRequest, sendMalformedRequest: true); } [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposedRequestMalformedReadIgnored() { return ResponseStatusCodeSetBeforeHttpContextDispose( TestSink, LoggerFactory, async context => { try { await context.Request.Body.ReadAsync(new byte[1], 0, 1); } catch (Microsoft.AspNetCore.Http.BadHttpRequestException) { } }, expectedClientStatusCode: HttpStatusCode.OK, expectedServerStatusCode: HttpStatusCode.OK, sendMalformedRequest: true); } [Fact] public async Task OnCompletedExceptionShouldNotPreventAResponse() { await using (var server = new TestServer(async context => { context.Response.OnCompleted(_ => throw new Exception(), null); await context.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive($"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); } } } [Fact] public async Task OnCompletedShouldNotBlockAResponse() { var delayTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async context => { context.Response.OnCompleted(async () => { await delayTcs.Task; }); await context.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive($"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); } delayTcs.SetResult(); } } [Fact] public async Task InvalidChunkedEncodingInRequestShouldNotBlockOnCompleted() { var onCompletedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(httpContext => { httpContext.Response.OnCompleted(() => Task.Run(() => { onCompletedTcs.SetResult(); })); return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "", "gg"); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } await onCompletedTcs.Task.DefaultTimeout(); } // https://github.com/aspnet/KestrelHttpServer/pull/1111/files#r80584475 explains the reason for this test. [Fact] public async Task NoErrorResponseSentWhenAppSwallowsBadRequestException() { #pragma warning disable CS0618 // Type or member is obsolete BadHttpRequestException readException = null; #pragma warning restore CS0618 // Type or member is obsolete await using (var server = new TestServer(async httpContext => { #pragma warning disable CS0618 // Type or member is obsolete readException = await Assert.ThrowsAsync<BadHttpRequestException>( #pragma warning restore CS0618 // Type or member is obsolete async () => await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1)); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "", "gg"); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } Assert.NotNull(readException); #pragma warning disable CS0618 // Type or member is obsolete Assert.Contains(TestSink.Writes, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException && ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); #pragma warning restore CS0618 // Type or member is obsolete } [Fact] public async Task TransferEncodingChunkedSetOnUnknownLengthHttp11Response() { await using (var server = new TestServer(async httpContext => { await httpContext.Response.WriteAsync("hello, "); await httpContext.Response.WriteAsync("world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "7", "hello, ", "5", "world", "0", "", ""); } } } [Theory] [InlineData(StatusCodes.Status204NoContent)] [InlineData(StatusCodes.Status304NotModified)] public async Task TransferEncodingChunkedNotSetOnNonBodyResponse(int statusCode) { await using (var server = new TestServer(httpContext => { httpContext.Response.StatusCode = statusCode; return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 {Encoding.ASCII.GetString(ReasonPhrases.ToStatusBytes(statusCode))}", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ContentLengthZeroSetOn205Response() { await using (var server = new TestServer(httpContext => { httpContext.Response.StatusCode = 205; return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 205 Reset Content", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Theory] [InlineData(StatusCodes.Status204NoContent)] [InlineData(StatusCodes.Status304NotModified)] public async Task AttemptingToWriteFailsForNonBodyResponse(int statusCode) { var responseWriteTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { httpContext.Response.StatusCode = statusCode; try { await httpContext.Response.WriteAsync("hello, world"); } catch (Exception ex) { responseWriteTcs.TrySetException(ex); throw; } responseWriteTcs.TrySetResult(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => responseWriteTcs.Task).DefaultTimeout(); Assert.Equal(CoreStrings.FormatWritingToResponseBodyNotSupported(statusCode), ex.Message); await connection.Receive( $"HTTP/1.1 {Encoding.ASCII.GetString(ReasonPhrases.ToStatusBytes(statusCode))}", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task AttemptingToWriteFailsFor205Response() { var responseWriteTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { httpContext.Response.StatusCode = 205; try { await httpContext.Response.WriteAsync("hello, world"); } catch (Exception ex) { responseWriteTcs.TrySetException(ex); throw; } responseWriteTcs.TrySetResult(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => responseWriteTcs.Task).DefaultTimeout(); Assert.Equal(CoreStrings.FormatWritingToResponseBodyNotSupported(205), ex.Message); await connection.Receive( $"HTTP/1.1 205 Reset Content", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task TransferEncodingNotSetOnHeadResponse() { await using (var server = new TestServer(httpContext => { return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "HEAD / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ResponseBodyNotWrittenOnHeadResponseAndLoggedOnlyOnce() { const string response = "hello, world"; var logTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => { if (context.EventId.Name == "ConnectionHeadResponseBodyWrite") { logTcs.SetResult(); } }; await using (var server = new TestServer(async httpContext => { await httpContext.Response.WriteAsync(response); await httpContext.Response.BodyWriter.FlushAsync(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "HEAD / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "", ""); // Wait for message to be logged before disposing the socket. // Disposing the socket will abort the connection and HttpProtocol._requestAborted // might be 1 by the time ProduceEnd() gets called and the message is logged. await logTcs.Task.DefaultTimeout(); } } var logMessage = Assert.Single(LogMessages, message => message.EventId.Name == "ConnectionHeadResponseBodyWrite"); Assert.Contains( @"write of ""12"" body bytes to non-body HEAD response.", logMessage.Message); } [Fact] public async Task ThrowsAndClosesConnectionWhenAppWritesMoreThanContentLengthWrite() { var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 11; await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("hello,"), 0, 6)); await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes(" world"), 0, 6)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {server.Context.DateHeaderValue}", "", "hello,"); await connection.WaitForConnectionClose(); } } var logMessage = Assert.Single(LogMessages, message => message.LogLevel == LogLevel.Error); Assert.Equal( $"Response Content-Length mismatch: too many bytes written (12 of 11).", logMessage.Exception.Message); } [Fact] public async Task ThrowsAndClosesConnectionWhenAppWritesMoreThanContentLengthWriteAsync() { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 11; await httpContext.Response.WriteAsync("hello,"); await httpContext.Response.WriteAsync(" world"); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( $"HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {server.Context.DateHeaderValue}", "", "hello,"); } } var logMessage = Assert.Single(LogMessages, message => message.LogLevel == LogLevel.Error); Assert.Equal( $"Response Content-Length mismatch: too many bytes written (12 of 11).", logMessage.Exception.Message); } [Fact] public async Task InternalServerErrorAndConnectionClosedOnWriteWithMoreThanContentLengthAndResponseNotStarted() { var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = 5; await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( $"HTTP/1.1 500 Internal Server Error", "Content-Length: 0", "Connection: close", $"Date: {server.Context.DateHeaderValue}", "", ""); } } var logMessage = Assert.Single(LogMessages, message => message.LogLevel == LogLevel.Error); Assert.Equal( $"Response Content-Length mismatch: too many bytes written (12 of 5).", logMessage.Exception.Message); } [Fact] public async Task InternalServerErrorAndConnectionClosedOnWriteAsyncWithMoreThanContentLengthAndResponseNotStarted() { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = 5; await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( $"HTTP/1.1 500 Internal Server Error", "Content-Length: 0", "Connection: close", $"Date: {server.Context.DateHeaderValue}", "", ""); } } var logMessage = Assert.Single(LogMessages, message => message.LogLevel == LogLevel.Error); Assert.Equal( $"Response Content-Length mismatch: too many bytes written (12 of 5).", logMessage.Exception.Message); } [Fact] public async Task WhenAppWritesLessThanContentLengthErrorLogged() { var logTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => { if (context.EventId.Name == "ApplicationError") { logTcs.SetResult(); } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 13; await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); // Don't use ReceiveEnd here, otherwise the FIN might // abort the request before the server checks the // response content length, in which case the check // will be skipped. await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 13", $"Date: {server.Context.DateHeaderValue}", "", "hello, world"); // Wait for error message to be logged. await logTcs.Task.DefaultTimeout(); // The server should close the connection in this situation. await connection.WaitForConnectionClose(); } } Assert.Contains(TestSink.Writes, m => m.EventId.Name == "ApplicationError" && m.Exception is InvalidOperationException ex && ex.Message.Equals(CoreStrings.FormatTooFewBytesWritten(12, 13), StringComparison.Ordinal)); } [Fact] public async Task WhenAppWritesLessThanContentLengthCompleteThrowsAndErrorLogged() { InvalidOperationException completeEx = null; var logTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => { if (context.EventId.Name == "ApplicationError") { logTcs.SetResult(); } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 13; await httpContext.Response.WriteAsync("hello, world"); completeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Complete()); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); // Don't use ReceiveEnd here, otherwise the FIN might // abort the request before the server checks the // response content length, in which case the check // will be skipped. await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 13", $"Date: {server.Context.DateHeaderValue}", "", "hello, world"); // Wait for error message to be logged. await logTcs.Task.DefaultTimeout(); // The server should close the connection in this situation. await connection.WaitForConnectionClose(); } } Assert.Contains(TestSink.Writes, m => m.EventId.Name == "ApplicationError" && m.Exception is InvalidOperationException ex && ex.Message.Equals(CoreStrings.FormatTooFewBytesWritten(12, 13), StringComparison.Ordinal)); Assert.NotNull(completeEx); } [Fact] public async Task WhenAppWritesLessThanContentLengthButRequestIsAbortedErrorNotLogged() { var requestAborted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { httpContext.RequestAborted.Register(() => { requestAborted.SetResult(); }); httpContext.Response.ContentLength = 12; await httpContext.Response.WriteAsync("hello,"); // Wait until the request is aborted so we know HttpProtocol will skip the response content length check. await requestAborted.Task.DefaultTimeout(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {server.Context.DateHeaderValue}", "", "hello,"); } // Verify the request was really aborted. A timeout in // the app would cause a server error and skip the content length // check altogether, making the test pass for the wrong reason. // Await before disposing the server to prevent races between the // abort triggered by the connection RST and the abort called when // disposing the server. await requestAborted.Task.DefaultTimeout(); } // With the server disposed we know all connections were drained and all messages were logged. Assert.Empty(TestSink.Writes.Where(c => c.EventId.Name == "ApplicationError")); } [Fact] public async Task WhenAppSetsContentLengthButDoesNotWriteBody500ResponseSentAndConnectionDoesNotClose() { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(httpContext => { httpContext.Response.ContentLength = 5; return Task.CompletedTask; }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", "HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } var error = LogMessages.Where(message => message.LogLevel == LogLevel.Error); Assert.Equal(2, error.Count()); Assert.All(error, message => message.Message.Equals(CoreStrings.FormatTooFewBytesWritten(0, 5))); } [Theory] [InlineData(true)] [InlineData(false)] public async Task WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown(bool flushResponse) { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 0; if (flushResponse) { await httpContext.Response.BodyWriter.FlushAsync(); } }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } Assert.Empty(LogMessages.Where(message => message.LogLevel == LogLevel.Error)); } // https://tools.ietf.org/html/rfc7230#section-3.3.3 // If a message is received with both a Transfer-Encoding and a // Content-Length header field, the Transfer-Encoding overrides the // Content-Length. [Fact] public async Task WhenAppSetsTransferEncodingAndContentLengthWritingLessIsNotAnError() { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { httpContext.Response.Headers["Transfer-Encoding"] = "chunked"; httpContext.Response.ContentLength = 13; await httpContext.Response.WriteAsync("hello, world"); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 13", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "hello, world"); } } Assert.Empty(LogMessages.Where(message => message.LogLevel == LogLevel.Error)); } // https://tools.ietf.org/html/rfc7230#section-3.3.3 // If a message is received with both a Transfer-Encoding and a // Content-Length header field, the Transfer-Encoding overrides the // Content-Length. [Fact] public async Task WhenAppSetsTransferEncodingAndContentLengthWritingMoreIsNotAnError() { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { httpContext.Response.Headers["Transfer-Encoding"] = "chunked"; httpContext.Response.ContentLength = 11; await httpContext.Response.WriteAsync("hello, world"); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "hello, world"); } } Assert.Empty(LogMessages.Where(message => message.LogLevel == LogLevel.Error)); } [Fact] public async Task HeadResponseCanContainContentLengthHeader() { await using (var server = new TestServer(httpContext => { httpContext.Response.ContentLength = 42; return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "HEAD / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 42", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task HeadResponseBodyNotWrittenWithAsyncWrite() { var flushed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 12; await httpContext.Response.WriteAsync("hello, world"); await flushed.Task; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "HEAD / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {server.Context.DateHeaderValue}", "", ""); flushed.SetResult(); } } } [Fact] public async Task HeadResponseBodyNotWrittenWithSyncWrite() { var flushed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 12; await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("hello, world"), 0, 12)); await flushed.Task; }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "HEAD / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {server.Context.DateHeaderValue}", "", ""); flushed.SetResult(); } } } [Fact] public async Task ZeroLengthWritesFlushHeaders() { var flushed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 12; await httpContext.Response.WriteAsync(""); await flushed.Task; await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {server.Context.DateHeaderValue}", "", ""); flushed.SetResult(); await connection.Receive("hello, world"); } } } [Fact] public async Task AppCanWriteOwnBadRequestResponse() { var expectedResponse = string.Empty; var responseWritten = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { try { await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1); } catch (Microsoft.AspNetCore.Http.BadHttpRequestException ex) { expectedResponse = ex.Message; httpContext.Response.StatusCode = StatusCodes.Status400BadRequest; httpContext.Response.ContentLength = ex.Message.Length; await httpContext.Response.WriteAsync(ex.Message); responseWritten.SetResult(); } }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "", "gg"); await responseWritten.Task.DefaultTimeout(); await connection.ReceiveEnd( "HTTP/1.1 400 Bad Request", $"Content-Length: {expectedResponse.Length}", $"Date: {server.Context.DateHeaderValue}", "", expectedResponse); } } } [Theory] [InlineData("gzip")] [InlineData("chunked, gzip")] public async Task ConnectionClosedWhenChunkedIsNotFinalTransferCoding(string responseTransferEncoding) { await using (var server = new TestServer(async httpContext => { httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding; await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Connection: close", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: {responseTransferEncoding}", "", "hello, world"); } using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.0", "Connection: keep-alive", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Connection: close", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: {responseTransferEncoding}", "", "hello, world"); } } } [Theory] [InlineData("gzip")] [InlineData("chunked, gzip")] public async Task ConnectionClosedWhenChunkedIsNotFinalTransferCodingEvenIfConnectionKeepAliveSetInResponse(string responseTransferEncoding) { await using (var server = new TestServer(async httpContext => { httpContext.Response.Headers["Connection"] = "keep-alive"; httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding; await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Connection: keep-alive", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: {responseTransferEncoding}", "", "hello, world"); } using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.0", "Connection: keep-alive", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Connection: keep-alive", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: {responseTransferEncoding}", "", "hello, world"); } } } [Theory] [InlineData("chunked")] [InlineData("gzip, chunked")] public async Task ConnectionKeptAliveWhenChunkedIsFinalTransferCoding(string responseTransferEncoding) { await using (var server = new TestServer(async httpContext => { httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding; // App would have to chunk manually, but here we don't care await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: {responseTransferEncoding}", "", "hello, world"); // Make sure connection was kept open await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: {responseTransferEncoding}", "", "hello, world"); } } } [Fact] public async Task FirstWriteVerifiedAfterOnStarting() { var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.OnStarting(() => { // Change response to chunked httpContext.Response.ContentLength = null; return Task.CompletedTask; }); var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = response.Length - 1; // If OnStarting is not run before verifying writes, an error response will be sent. await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); } } } [Fact] public async Task FirstWriteVerifiedAfterOnStartingWithResponseBody() { var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.OnStarting(() => { // Change response to chunked httpContext.Response.ContentLength = null; return Task.CompletedTask; }); var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = response.Length - 1; // If OnStarting is not run before verifying writes, an error response will be sent. await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, 0, response.Length)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); } } } [Fact] public async Task SubsequentWriteVerifiedAfterOnStarting() { var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.OnStarting(() => { // Change response to chunked httpContext.Response.ContentLength = null; return Task.CompletedTask; }); var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = response.Length - 1; // If OnStarting is not run before verifying writes, an error response will be sent. await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length / 2)); await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "6", "hello,", "6", " world", "0", "", ""); } } } [Fact] public async Task SubsequentWriteVerifiedAfterOnStartingWithResponseBody() { var serviceContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(async httpContext => { httpContext.Response.OnStarting(() => { // Change response to chunked httpContext.Response.ContentLength = null; return Task.CompletedTask; }); var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = response.Length - 1; // If OnStarting is not run before verifying writes, an error response will be sent. await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, 0, response.Length / 2)); await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2)); }, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "6", "hello,", "6", " world", "0", "", ""); } } } [Fact] public async Task FirstWriteAsyncVerifiedAfterOnStarting() { await using (var server = new TestServer(httpContext => { httpContext.Response.OnStarting(() => { // Change response to chunked httpContext.Response.ContentLength = null; return Task.CompletedTask; }); var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = response.Length - 1; // If OnStarting is not run before verifying writes, an error response will be sent. return httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length)).AsTask(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); } } } [Fact] public async Task SubsequentWriteAsyncVerifiedAfterOnStarting() { await using (var server = new TestServer(async httpContext => { httpContext.Response.OnStarting(() => { // Change response to chunked httpContext.Response.ContentLength = null; return Task.CompletedTask; }); var response = Encoding.ASCII.GetBytes("hello, world"); httpContext.Response.ContentLength = response.Length - 1; // If OnStarting is not run before verifying writes, an error response will be sent. await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length / 2)); await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2)); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "6", "hello,", "6", " world", "0", "", ""); } } } [Fact] public async Task WhenResponseAlreadyStartedResponseEndedBeforeConsumingRequestBody() { await using (var server = new TestServer(async httpContext => { await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Content-Length: 1", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "c", "hello, world", ""); // If the expected behavior is regressed, this will hang because the // server will try to consume the request body before flushing the chunked // terminator. await connection.Receive( "0", "", ""); } } } [Fact] public async Task WhenResponseNotStartedResponseEndedBeforeConsumingRequestBody() { await using (var server = new TestServer(httpContext => Task.CompletedTask, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "", "gg"); // This will receive a success response because the server flushed the response // before reading the malformed chunk header in the request, but then it will close // the connection. await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } #pragma warning disable CS0618 // Type or member is obsolete Assert.Contains(LogMessages, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException && ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); #pragma warning restore CS0618 // Type or member is obsolete } [Fact] public async Task RequestDrainingFor100ContinueDoesNotBlockResponse() { var foundMessage = false; await using (var server = new TestServer(httpContext => { return httpContext.Request.Body.ReadAsync(new byte[1], 0, 1); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "Expect: 100-continue", "", ""); await connection.Receive( "HTTP/1.1 100 Continue", "", ""); // Let the app finish await connection.Send( "1", "a", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); // This will be consumed by Http1Connection when it attempts to // consume the request body and will cause an error. await connection.Send( "gg"); // Wait for the server to drain the request body and log an error. // Time out after 10 seconds for (int i = 0; i < 10 && !foundMessage; i++) { while (LogMessages.TryDequeue(out var message)) { #pragma warning disable CS0618 // Type or member is obsolete if (message.EventId.Id == 17 && message.LogLevel <= LogLevel.Debug && message.Exception is BadHttpRequestException && ((BadHttpRequestException)message.Exception).StatusCode == StatusCodes.Status400BadRequest) #pragma warning restore CS0618 // Type or member is obsolete { foundMessage = true; break; } } if (!foundMessage) { await Task.Delay(TimeSpan.FromSeconds(1)); } } await connection.ReceiveEnd(); } } Assert.True(foundMessage, "Expected log not found"); } [Fact] public async Task Sending100ContinueDoesNotPreventAutomatic400Responses() { await using (var server = new TestServer(httpContext => { return httpContext.Request.Body.ReadAsync(new byte[1], 0, 1); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "Expect: 100-continue", "", ""); await connection.Receive( "HTTP/1.1 100 Continue", "", ""); // Send an invalid chunk prefix to cause an error. await connection.Send( "gg"); // If 100 Continue sets HttpProtocol.HasResponseStarted to true, // a success response will be produced before the server sees the // bad chunk header above, making this test fail. await connection.ReceiveEnd( "HTTP/1.1 400 Bad Request", "Content-Length: 0", "Connection: close", $"Date: {server.Context.DateHeaderValue}", "", ""); } } #pragma warning disable CS0618 // Type or member is obsolete Assert.Contains(LogMessages, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException && ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); #pragma warning restore CS0618 // Type or member is obsolete } [Fact] public async Task Sending100ContinueAndResponseSendsChunkTerminatorBeforeConsumingRequestBody() { await using (var server = new TestServer(async httpContext => { await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1); await httpContext.Response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Content-Length: 2", "Expect: 100-continue", "", ""); await connection.Receive( "HTTP/1.1 100 Continue", "", ""); await connection.Send( "a"); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", $"Transfer-Encoding: chunked", "", "c", "hello, world", ""); // If the expected behavior is regressed, this will hang because the // server will try to consume the request body before flushing the chunked // terminator. await connection.Receive( "0", "", ""); } } } [Fact] public async Task Http11ResponseSentToHttp10Request() { var serviceContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(TestApp.EchoApp, serviceContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.0", "Content-Length: 11", "", "Hello World"); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Connection: close", $"Date: {serviceContext.DateHeaderValue}", "", "Hello World"); } } } [Fact] public async Task ZeroContentLengthSetAutomaticallyAfterNoWrites() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(TestApp.EmptyApp, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", "GET / HTTP/1.0", "Connection: keep-alive", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", "HTTP/1.1 200 OK", "Content-Length: 0", "Connection: keep-alive", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task ZeroContentLengthSetAutomaticallyForNonKeepAliveRequests() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { Assert.Equal(0, await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1).DefaultTimeout()); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "Connection: close", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 0", "Connection: close", $"Date: {testContext.DateHeaderValue}", "", ""); } using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.0", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 0", "Connection: close", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task ZeroContentLengthNotSetAutomaticallyForHeadRequests() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(TestApp.EmptyApp, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "HEAD / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task ZeroContentLengthNotSetAutomaticallyForCertainStatusCodes() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var request = httpContext.Request; var response = httpContext.Response; using (var reader = new StreamReader(request.Body, Encoding.ASCII)) { var statusString = await reader.ReadLineAsync(); response.StatusCode = int.Parse(statusString, CultureInfo.InvariantCulture); } }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.1", "Host:", "Content-Length: 3", "", "204POST / HTTP/1.1", "Host:", "Content-Length: 3", "", "304POST / HTTP/1.1", "Host:", "Content-Length: 3", "", "200"); await connection.Receive( "HTTP/1.1 204 No Content", $"Date: {testContext.DateHeaderValue}", "", "HTTP/1.1 304 Not Modified", $"Date: {testContext.DateHeaderValue}", "", "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task ConnectionClosedAfter101Response() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var request = httpContext.Request; var stream = await httpContext.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); var response = Encoding.ASCII.GetBytes("hello, world"); await stream.WriteAsync(response, 0, response.Length); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "Connection: Upgrade", "", ""); await connection.ReceiveEnd( "HTTP/1.1 101 Switching Protocols", "Connection: Upgrade", $"Date: {testContext.DateHeaderValue}", "", "hello, world"); } using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.0", "Connection: keep-alive, Upgrade", "", ""); await connection.ReceiveEnd( "HTTP/1.1 101 Switching Protocols", "Connection: Upgrade", $"Date: {testContext.DateHeaderValue}", "", "hello, world"); } } } [Fact] public async Task ThrowingResultsIn500Response() { var testContext = new TestServiceContext(LoggerFactory); bool onStartingCalled = false; await using (var server = new TestServer(httpContext => { var response = httpContext.Response; response.OnStarting(_ => { onStartingCalled = true; return Task.CompletedTask; }, null); // Anything added to the ResponseHeaders dictionary is ignored response.Headers["Content-Length"] = "11"; throw new Exception(); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", "GET / HTTP/1.1", "Host:", "Connection: close", "", ""); await connection.ReceiveEnd( "HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", "HTTP/1.1 500 Internal Server Error", "Content-Length: 0", "Connection: close", $"Date: {testContext.DateHeaderValue}", "", ""); } } Assert.False(onStartingCalled); Assert.Equal(2, LogMessages.Where(message => message.LogLevel == LogLevel.Error).Count()); } [Fact] public async Task ThrowingInOnStartingResultsInFailedWritesAnd500Response() { var callback1Called = false; var callback2CallCount = 0; var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var onStartingException = new Exception(); var response = httpContext.Response; response.OnStarting(_ => { callback1Called = true; throw onStartingException; }, null); response.OnStarting(_ => { callback2CallCount++; throw onStartingException; }, null); var writeException = await Assert.ThrowsAsync<ObjectDisposedException>(async () => await response.BodyWriter.FlushAsync()); Assert.Same(onStartingException, writeException.InnerException); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", "HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", ""); } } // The first registered OnStarting callback should have been called, // since they are called LIFO order and the other one failed. Assert.False(callback1Called); Assert.Equal(2, callback2CallCount); Assert.Equal(2, LogMessages.Where(message => message.LogLevel == LogLevel.Error).Count()); } [Fact] public async Task OnStartingThrowsInsideOnStartingCallbacksRuns() { var testContext = new TestServiceContext(LoggerFactory); var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.OnStarting(state1 => { response.OnStarting(state2 => { tcs.TrySetResult(); return Task.CompletedTask; }, null); return Task.CompletedTask; }, null); response.Headers["Content-Length"] = new[] { "11" }; await response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello World"), 0, 11)); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", ""); await tcs.Task.DefaultTimeout(); } } } [Fact] public async Task OnCompletedThrowsInsideOnCompletedCallbackRuns() { var testContext = new TestServiceContext(LoggerFactory); var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.OnCompleted(state1 => { response.OnCompleted(state2 => { tcs.TrySetResult(); return Task.CompletedTask; }, null); return Task.CompletedTask; }, null); response.Headers["Content-Length"] = new[] { "11" }; await response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello World"), 0, 11)); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", ""); await tcs.Task.DefaultTimeout(); } } } [Fact] public async Task ThrowingInOnCompletedIsLogged() { var testContext = new TestServiceContext(LoggerFactory); var onCompletedCalled1 = false; var onCompletedCalled2 = false; await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.OnCompleted(_ => { onCompletedCalled1 = true; throw new Exception(); }, null); response.OnCompleted(_ => { onCompletedCalled2 = true; throw new Exception(); }, null); response.Headers["Content-Length"] = new[] { "11" }; await response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello World"), 0, 11)); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", "", "Hello World"); } } // All OnCompleted callbacks should be called even if they throw. Assert.Equal(2, LogMessages.Where(message => message.LogLevel == LogLevel.Error).Count()); Assert.True(onCompletedCalled1); Assert.True(onCompletedCalled2); } [Fact] public async Task ThrowingAfterWritingKillsConnection() { var testContext = new TestServiceContext(LoggerFactory); bool onStartingCalled = false; await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.OnStarting(_ => { onStartingCalled = true; return Task.FromResult<object>(null); }, null); response.Headers["Content-Length"] = new[] { "11" }; await response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello World"), 0, 11)); throw new Exception(); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", "", "Hello World"); } } Assert.True(onStartingCalled); Assert.Single(LogMessages, message => message.LogLevel == LogLevel.Error); } [Fact] public async Task ThrowingAfterPartialWriteKillsConnection() { var testContext = new TestServiceContext(LoggerFactory); bool onStartingCalled = false; await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.OnStarting(_ => { onStartingCalled = true; return Task.FromResult<object>(null); }, null); response.Headers["Content-Length"] = new[] { "11" }; await response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello"), 0, 5)); throw new Exception(); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", "", "Hello"); } } Assert.True(onStartingCalled); Assert.Single(LogMessages, message => message.LogLevel == LogLevel.Error); } [Fact] public async Task NoErrorsLoggedWhenServerEndsConnectionBeforeClient() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.Headers["Content-Length"] = new[] { "11" }; await response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello World"), 0, 11)); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.0", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 11", "Connection: close", $"Date: {testContext.DateHeaderValue}", "", "Hello World"); } } Assert.Empty(LogMessages.Where(message => message.LogLevel == LogLevel.Error)); } [Fact] public async Task NoResponseSentWhenConnectionIsClosedByServerBeforeClientFinishesSendingRequest() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(httpContext => { httpContext.Abort(); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "POST / HTTP/1.0", "Content-Length: 1", "", ""); await connection.ReceiveEnd(); } } } [Fact] public async Task AppAbortIsLogged() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(httpContext => { httpContext.Abort(); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd(); } } Assert.Single(LogMessages.Where(m => m.Message.Contains(CoreStrings.ConnectionAbortedByApplication))); } [Fact] public async Task AppAbortViaIConnectionLifetimeFeatureIsLogged() { var testContext = new TestServiceContext(LoggerFactory); var closeTaskTcs = new TaskCompletionSource<Task>(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { var closeTask = await closeTaskTcs.Task.DefaultTimeout(); var feature = httpContext.Features.Get<IConnectionLifetimeFeature>(); feature.Abort(); // Ensure the response doesn't get flush before the abort is observed. await closeTask; }, testContext)) { using (var connection = server.CreateConnection()) { closeTaskTcs.SetResult(connection.TransportConnection.WaitForCloseTask); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd(); } } Assert.Single(LogMessages.Where(m => m.Message.Contains("The connection was aborted by the application via IConnectionLifetimeFeature.Abort()."))); } [Fact] public async Task ResponseHeadersAreResetOnEachRequest() { var testContext = new TestServiceContext(LoggerFactory); IHeaderDictionary originalResponseHeaders = null; var firstRequest = true; await using (var server = new TestServer(httpContext => { var responseFeature = httpContext.Features.Get<IHttpResponseFeature>(); if (firstRequest) { originalResponseHeaders = responseFeature.Headers; responseFeature.Headers = new HttpResponseHeaders(); firstRequest = false; } else { Assert.Same(originalResponseHeaders, responseFeature.Headers); } return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task StartAsyncDefaultToChunkedResponse() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task StartAsyncWithContentLengthAndEmptyWriteStillCallsFinalFlush() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 0; await httpContext.Response.StartAsync(); await httpContext.Response.WriteAsync(""); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", ""); } } } [Fact] public async Task StartAsyncAndEmptyWriteStillCallsFinalFlush() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); await httpContext.Response.WriteAsync(""); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task StartAsyncWithSingleChunkedWriteStillWritesSuffix() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); await httpContext.Response.WriteAsync("Hello World!"); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "c", "Hello World!", "0", "", ""); } } } [Fact] public async Task StartAsyncWithoutFlushStartsResponse() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); Assert.True(httpContext.Response.HasStarted); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task StartAsyncThrowExceptionThrowsConnectionAbortedException() { var testContext = new TestServiceContext(LoggerFactory); var expectedException = new Exception(); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); throw expectedException; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", ""); } } } [Fact] public async Task StartAsyncWithContentLengthThrowExceptionThrowsConnectionAbortedException() { var testContext = new TestServiceContext(LoggerFactory); var expectedException = new Exception(); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 11; await httpContext.Response.StartAsync(); throw expectedException; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task StartAsyncWithoutFlushingDoesNotFlush() { var testContext = new TestServiceContext(LoggerFactory); var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); Assert.True(httpContext.Response.HasStarted); // Verify that the response isn't flushed by verifying the TCS isn't set var res = await Task.WhenAny(tcs.Task, Task.Delay(1000)) == tcs.Task; Assert.False(res); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); // If we reach this point before the app exits, this means the flush finished early. tcs.SetResult(); } } } [Fact] public async Task StartAsyncWithContentLengthWritingWorks() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { httpContext.Response.Headers["Content-Length"] = new[] { "11" }; await httpContext.Response.StartAsync(); await httpContext.Response.WriteAsync("Hello World"); Assert.True(httpContext.Response.HasStarted); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 11", $"Date: {testContext.DateHeaderValue}", "", "Hello World"); } } } [Fact] public async Task LargeWriteWithContentLengthWritingWorks() { var testContext = new TestServiceContext(LoggerFactory); var expectedLength = 100000; var expectedString = new string('a', expectedLength); await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = expectedLength; await httpContext.Response.WriteAsync(expectedString); Assert.True(httpContext.Response.HasStarted); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Content-Length: {expectedLength}", $"Date: {testContext.DateHeaderValue}", "", expectedString); } } } [Fact] public async Task UnflushedContentLengthResponseIsFlushedAutomatically() { var testContext = new TestServiceContext(LoggerFactory); var expectedLength = 100000; var expectedString = new string('a', expectedLength); void WriteStringWithoutFlushing(PipeWriter writer, string content) { var encoder = Encoding.ASCII.GetEncoder(); var encodedLength = Encoding.ASCII.GetByteCount(expectedString); var source = expectedString.AsSpan(); var completed = false; while (!completed) { encoder.Convert(source, writer.GetSpan(), flush: source.Length == 0, out var charsUsed, out var bytesUsed, out completed); writer.Advance(bytesUsed); source = source.Slice(charsUsed); } } await using (var server = new TestServer(httpContext => { httpContext.Response.ContentLength = expectedLength; WriteStringWithoutFlushing(httpContext.Response.BodyWriter, expectedString); Assert.False(httpContext.Response.HasStarted); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Content-Length: {expectedLength}", $"Date: {testContext.DateHeaderValue}", "", expectedString); } } } [Fact] public async Task StartAsyncAndFlushWorks() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); await httpContext.Response.BodyWriter.FlushAsync(); Assert.True(httpContext.Response.HasStarted); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task OnStartingCallbacksAreCalledInLastInFirstOutOrder() { const string response = "hello, world"; var testContext = new TestServiceContext(LoggerFactory); var callOrder = new Stack<int>(); var onStartingTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async context => { context.Response.OnStarting(_ => { callOrder.Push(1); onStartingTcs.SetResult(); return Task.CompletedTask; }, null); context.Response.OnStarting(_ => { callOrder.Push(2); return Task.CompletedTask; }, null); context.Response.ContentLength = response.Length; await context.Response.WriteAsync(response); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Content-Length: {response.Length}", $"Date: {testContext.DateHeaderValue}", "", "hello, world"); // Wait for all callbacks to be called. await onStartingTcs.Task.DefaultTimeout(); } } Assert.Equal(1, callOrder.Pop()); Assert.Equal(2, callOrder.Pop()); } [Fact] public async Task OnCompletedCallbacksAreCalledInLastInFirstOutOrder() { const string response = "hello, world"; var testContext = new TestServiceContext(LoggerFactory); var callOrder = new Stack<int>(); var onCompletedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using (var server = new TestServer(async context => { context.Response.OnCompleted(_ => { callOrder.Push(1); onCompletedTcs.SetResult(); return Task.CompletedTask; }, null); context.Response.OnCompleted(_ => { callOrder.Push(2); return Task.CompletedTask; }, null); context.Response.ContentLength = response.Length; await context.Response.WriteAsync(response); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Content-Length: {response.Length}", $"Date: {testContext.DateHeaderValue}", "", "hello, world"); // Wait for all callbacks to be called. await onCompletedTcs.Task.DefaultTimeout(); } } Assert.Equal(1, callOrder.Pop()); Assert.Equal(2, callOrder.Pop()); } [Fact] public async Task SynchronousWritesDisallowedByDefault() { await using (var server = new TestServer(async context => { var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); Assert.False(bodyControlFeature.AllowSynchronousIO); context.Response.ContentLength = 6; // Synchronous writes now throw. var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6)); Assert.Equal(CoreStrings.SynchronousWritesDisallowed, ioEx.Message); await context.Response.Body.WriteAsync(Encoding.ASCII.GetBytes("Hello1"), 0, 6); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.SendEmptyGet(); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 6", $"Date: {server.Context.DateHeaderValue}", "", "Hello1"); } } } [Fact] public async Task SynchronousWritesAllowedByOptIn() { await using (var server = new TestServer(context => { var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); Assert.False(bodyControlFeature.AllowSynchronousIO); bodyControlFeature.AllowSynchronousIO = true; context.Response.ContentLength = 6; context.Response.Body.Write(Encoding.ASCII.GetBytes("Hello1"), 0, 6); return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.SendEmptyGet(); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 6", $"Date: {server.Context.DateHeaderValue}", "", "Hello1"); } } } [Fact] public async Task SynchronousWritesCanBeAllowedGlobally() { var testContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = true } }; await using (var server = new TestServer(context => { var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); Assert.True(bodyControlFeature.AllowSynchronousIO); context.Response.ContentLength = 6; context.Response.Body.Write(Encoding.ASCII.GetBytes("Hello!"), 0, 6); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 6", $"Date: {server.Context.DateHeaderValue}", "", "Hello!"); } } } [Fact] public async Task SynchronousWritesCanBeDisallowedGlobally() { var testContext = new TestServiceContext(LoggerFactory) { ServerOptions = { AllowSynchronousIO = false } }; await using (var server = new TestServer(context => { var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); Assert.False(bodyControlFeature.AllowSynchronousIO); context.Response.ContentLength = 6; // Synchronous writes now throw. var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6)); Assert.Equal(CoreStrings.SynchronousWritesDisallowed, ioEx.Message); return context.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello!"), 0, 6)).AsTask(); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 6", $"Date: {server.Context.DateHeaderValue}", "", "Hello!"); } } } [Fact] public async Task NonZeroContentLengthFor304StatusCodeIsAllowed() { await using (var server = new TestServer(httpContext => { var response = httpContext.Response; response.StatusCode = StatusCodes.Status304NotModified; response.ContentLength = 42; return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 304 Not Modified", "Content-Length: 42", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task AdvanceNegativeValueThrowsArgumentOutOfRangeException() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; await response.StartAsync(); Assert.Throws<ArgumentOutOfRangeException>(() => response.BodyWriter.Advance(-1)); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host: ", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task AdvanceNegativeValueThrowsArgumentOutOfRangeExceptionWithStart() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(httpContext => { var response = httpContext.Response; Assert.Throws<ArgumentOutOfRangeException>(() => response.BodyWriter.Advance(-1)); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host: ", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {testContext.DateHeaderValue}", "", ""); } } } [Fact] public async Task AdvanceWithTooLargeOfAValueThrowInvalidOperationException() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(httpContext => { var response = httpContext.Response; Assert.Throws<InvalidOperationException>(() => response.BodyWriter.Advance(1)); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host: ", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {testContext.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task ContentLengthWithoutStartAsyncWithGetSpanWorks() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(httpContext => { var response = httpContext.Response; response.ContentLength = 12; var span = response.BodyWriter.GetSpan(4096); var fisrtPartOfResponse = Encoding.ASCII.GetBytes("Hello "); fisrtPartOfResponse.CopyTo(span); response.BodyWriter.Advance(6); var secondPartOfResponse = Encoding.ASCII.GetBytes("World!"); secondPartOfResponse.CopyTo(span.Slice(6)); response.BodyWriter.Advance(6); return Task.CompletedTask; }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host: ", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {testContext.DateHeaderValue}", "", "Hello World!"); } } } [Fact] public async Task ContentLengthWithGetMemoryWorks() { var testContext = new TestServiceContext(LoggerFactory); await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.ContentLength = 12; await response.StartAsync(); var memory = response.BodyWriter.GetMemory(4096); var fisrtPartOfResponse = Encoding.ASCII.GetBytes("Hello "); fisrtPartOfResponse.CopyTo(memory); response.BodyWriter.Advance(6); var secondPartOfResponse = Encoding.ASCII.GetBytes("World!"); secondPartOfResponse.CopyTo(memory.Slice(6)); response.BodyWriter.Advance(6); }, testContext)) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host: ", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {testContext.DateHeaderValue}", "", "Hello World!"); } } } [Fact] public async Task ResponseBodyCanWrite() { await using (var server = new TestServer(async httpContext => { httpContext.Response.ContentLength = 12; await httpContext.Response.Body.WriteAsync(Encoding.ASCII.GetBytes("hello, world")); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 12", $"Date: {server.Context.DateHeaderValue}", "", "hello, world"); } } } [Fact] public async Task ResponseBodyAndResponsePipeWorks() { await using (var server = new TestServer(async httpContext => { var response = httpContext.Response; response.ContentLength = 54; await response.StartAsync(); var memory = response.BodyWriter.GetMemory(4096); var fisrtPartOfResponse = Encoding.ASCII.GetBytes("hello,"); fisrtPartOfResponse.CopyTo(memory); response.BodyWriter.Advance(6); var secondPartOfResponse = Encoding.ASCII.GetBytes(" world\r\n"); secondPartOfResponse.CopyTo(memory.Slice(6)); response.BodyWriter.Advance(8); await response.Body.WriteAsync(Encoding.ASCII.GetBytes("hello, world\r\n")); await response.BodyWriter.WriteAsync(Encoding.ASCII.GetBytes("hello, world\r\n")); await response.WriteAsync("hello, world"); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 54", $"Date: {server.Context.DateHeaderValue}", "", "hello, world", "hello, world", "hello, world", "hello, world"); } } } [Fact] public async Task ResponseBodyWriterCompleteWithoutExceptionDoesNotThrow() { await using (var server = new TestServer(async httpContext => { httpContext.Response.BodyWriter.Complete(); await Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ResponseBodyWriterCompleteWithoutExceptionNextWriteDoesThrow() { InvalidOperationException writeEx = null; await using (var server = new TestServer(async httpContext => { httpContext.Response.BodyWriter.Complete(); writeEx = await Assert.ThrowsAsync<InvalidOperationException>(() => httpContext.Response.WriteAsync("test")); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } Assert.NotNull(writeEx); } [Fact] public async Task ResponseBodyWriterCompleteFlushesChunkTerminator() { var middlewareCompletionTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); await using var server = new TestServer(async httpContext => { await httpContext.Response.WriteAsync("hello, world"); await httpContext.Response.BodyWriter.CompleteAsync(); await middlewareCompletionTcs.Task; }, new TestServiceContext(LoggerFactory)); using var connection = server.CreateConnection(); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "c", "hello, world", "0", "", ""); middlewareCompletionTcs.SetResult(); } [Fact] public async Task ResponseAdvanceStateIsResetWithMultipleReqeusts() { var secondRequest = false; await using (var server = new TestServer(async httpContext => { if (secondRequest) { return; } var memory = httpContext.Response.BodyWriter.GetMemory(); Encoding.ASCII.GetBytes("a").CopyTo(memory); httpContext.Response.BodyWriter.Advance(1); await httpContext.Response.BodyWriter.FlushAsync(); secondRequest = true; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "1", "a", "0", "", ""); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ResponseStartCalledAndAutoChunkStateIsResetWithMultipleReqeusts() { await using (var server = new TestServer(async httpContext => { var memory = httpContext.Response.BodyWriter.GetMemory(); Encoding.ASCII.GetBytes("a").CopyTo(memory); httpContext.Response.BodyWriter.Advance(1); await httpContext.Response.BodyWriter.FlushAsync(); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "1", "a", "0", "", ""); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "1", "a", "0", "", ""); } } } [Fact] public async Task ResponseStartCalledStateIsResetWithMultipleReqeusts() { var flip = false; await using (var server = new TestServer(async httpContext => { if (flip) { httpContext.Response.ContentLength = 1; var memory = httpContext.Response.BodyWriter.GetMemory(); Encoding.ASCII.GetBytes("a").CopyTo(memory); httpContext.Response.BodyWriter.Advance(1); await httpContext.Response.BodyWriter.FlushAsync(); } else { var memory = httpContext.Response.BodyWriter.GetMemory(); Encoding.ASCII.GetBytes("a").CopyTo(memory); httpContext.Response.BodyWriter.Advance(1); await httpContext.Response.BodyWriter.FlushAsync(); } flip = !flip; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { for (var i = 0; i < 3; i++) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "1", "a", "0", "", ""); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 1", $"Date: {server.Context.DateHeaderValue}", "", "a"); } } } } [Fact] public async Task ResponseIsLeasedMemoryInvalidStateIsResetWithMultipleReqeusts() { var secondRequest = false; await using (var server = new TestServer(httpContext => { if (secondRequest) { Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1)); return Task.CompletedTask; } var memory = httpContext.Response.BodyWriter.GetMemory(); return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ResponsePipeWriterCompleteWithException() { var expectedException = new Exception(); await using (var server = new TestServer(async httpContext => { httpContext.Response.BodyWriter.Complete(expectedException); await Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( $"HTTP/1.1 500 Internal Server Error", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); Assert.Contains(TestSink.Writes, w => w.EventId.Id == 13 && w.LogLevel == LogLevel.Error && w.Exception is ConnectionAbortedException && w.Exception.InnerException == expectedException); } } } [Fact] public async Task ResponseCompleteGetMemoryReturnsRentedMemory() { await using (var server = new TestServer(async httpContext => { await httpContext.Response.StartAsync(); httpContext.Response.BodyWriter.Complete(); var memory = httpContext.Response.BodyWriter.GetMemory(); // Shouldn't throw Assert.Equal(4096, memory.Length); await Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task ResponseCompleteGetMemoryReturnsRentedMemoryWithoutStartAsync() { await using (var server = new TestServer(async httpContext => { httpContext.Response.BodyWriter.Complete(); var memory = httpContext.Response.BodyWriter.GetMemory(); // Shouldn't throw Assert.Equal(4096, memory.Length); await Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ResponseGetMemoryAndStartAsyncMemoryReturnsNewMemory() { await using (var server = new TestServer(async httpContext => { var memory = httpContext.Response.BodyWriter.GetMemory(); Assert.Equal(4096, memory.Length); await httpContext.Response.StartAsync(); // Original memory is disposed, don't compare against it. memory = httpContext.Response.BodyWriter.GetMemory(); Assert.NotEqual(4096, memory.Length); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task ResponseGetMemoryAndStartAsyncAdvanceThrows() { await using (var server = new TestServer(async httpContext => { var memory = httpContext.Response.BodyWriter.GetMemory(); await httpContext.Response.StartAsync(); Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1)); }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", $"Date: {server.Context.DateHeaderValue}", "Transfer-Encoding: chunked", "", "0", "", ""); } } } [Fact] public async Task ResponseCompleteGetMemoryDoesThrow() { InvalidOperationException writeEx = null; await using (var server = new TestServer(httpContext => { httpContext.Response.BodyWriter.Complete(); writeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.GetMemory()); return Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } Assert.NotNull(writeEx); } [Fact] public async Task ResponseSetBodyToSameValueTwiceGetPipeMultipleTimesDifferentObject() { await using (var server = new TestServer(async httpContext => { httpContext.Response.Body = new MemoryStream(); var BodyWriter1 = httpContext.Response.BodyWriter; httpContext.Response.Body = new MemoryStream(); var BodyWriter2 = httpContext.Response.BodyWriter; Assert.NotEqual(BodyWriter1, BodyWriter2); await Task.CompletedTask; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task ResponseStreamWrappingWorks() { await using (var server = new TestServer(async httpContext => { var oldBody = httpContext.Response.Body; httpContext.Response.Body = new MemoryStream(); await httpContext.Response.BodyWriter.WriteAsync(new byte[1]); await httpContext.Response.Body.WriteAsync(new byte[1]); Assert.Equal(2, httpContext.Response.Body.Length); httpContext.Response.Body = oldBody; }, new TestServiceContext(LoggerFactory))) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task AltSvc_HeaderSetInAppCode_AltSvcNotOverwritten() { await using (var server = new TestServer( httpContext => { httpContext.Response.Headers.AltSvc = "Custom"; return Task.CompletedTask; }, new TestServiceContext(LoggerFactory), options => { options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) { Protocols = HttpProtocols.Http1AndHttp2AndHttp3 }); }, services => { })) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", @"Alt-Svc: Custom", "", ""); } } } [Fact] public async Task AltSvc_Http1And2And3EndpointConfigured_AltSvcInResponseHeaders() { await using (var server = new TestServer( httpContext => Task.CompletedTask, new TestServiceContext(LoggerFactory), options => { options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) { Protocols = HttpProtocols.Http1AndHttp2AndHttp3, IsTls = true }); }, services => { services.AddSingleton<IMultiplexedConnectionListenerFactory>(new MockMultiplexedConnectionListenerFactory()); })) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", @"Alt-Svc: h3="":0""; ma=86400", "", ""); } } } [Fact] public async Task AltSvc_Http1And2And3EndpointConfigured_NoMultiplexedFactory_NoAltSvcInResponseHeaders() { await using (var server = new TestServer( httpContext => Task.CompletedTask, new TestServiceContext(LoggerFactory), options => { options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) { Protocols = HttpProtocols.Http1AndHttp2AndHttp3, IsTls = true }); }, services => { })) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task AltSvc_Http1_NoAltSvcInResponseHeaders() { await using (var server = new TestServer( httpContext => Task.CompletedTask, new TestServiceContext(LoggerFactory), new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) { Protocols = HttpProtocols.Http1 })) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task AltSvc_Http3ConfiguredDifferentEndpoint_NoAltSvcInResponseHeaders() { await using (var server = new TestServer( httpContext => Task.CompletedTask, new TestServiceContext(LoggerFactory), options => { options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) { Protocols = HttpProtocols.Http1 }); options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 1)) { Protocols = HttpProtocols.Http3, IsTls = true }); }, services => { services.AddSingleton<IMultiplexedConnectionListenerFactory>(new MockMultiplexedConnectionListenerFactory()); })) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } [Fact] public async Task AltSvc_DisableAltSvcHeaderIsTrue_Http1And2And3EndpointConfigured_NoAltSvcInResponseHeaders() { await using (var server = new TestServer( httpContext => Task.CompletedTask, new TestServiceContext(LoggerFactory), options => { options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) { Protocols = HttpProtocols.Http1AndHttp2AndHttp3, DisableAltSvcHeader = true }); }, services => { })) { using (var connection = server.CreateConnection()) { await connection.Send( "GET / HTTP/1.1", "Host:", "", ""); await connection.Receive( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } private static async Task ResponseStatusCodeSetBeforeHttpContextDispose( ITestSink testSink, ILoggerFactory loggerFactory, RequestDelegate handler, HttpStatusCode? expectedClientStatusCode, HttpStatusCode expectedServerStatusCode, bool sendMalformedRequest = false) { var mockHttpContextFactory = new Mock<IHttpContextFactory>(); mockHttpContextFactory.Setup(f => f.Create(It.IsAny<IFeatureCollection>())) .Returns<IFeatureCollection>(fc => new DefaultHttpContext(fc)); var disposedTcs = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); mockHttpContextFactory.Setup(f => f.Dispose(It.IsAny<HttpContext>())) .Callback<HttpContext>(c => { disposedTcs.TrySetResult(c.Response.StatusCode); }); await using (var server = new TestServer(handler, new TestServiceContext(loggerFactory), options => options.CodeBackedListenOptions.Add(new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0))), services => services.AddSingleton(mockHttpContextFactory.Object))) { using (var connection = server.CreateConnection()) { if (!sendMalformedRequest) { await connection.Send( "GET / HTTP/1.1", "Host:", "Connection: close", "", ""); using (var reader = new StreamReader(connection.Stream, Encoding.ASCII, detectEncodingFromByteOrderMarks: true, bufferSize: 1024, leaveOpen: true)) { try { var response = await reader.ReadToEndAsync().DefaultTimeout(); Assert.Equal(expectedClientStatusCode, GetStatus(response)); } catch { if (expectedClientStatusCode != null) { throw; } } } } else { await connection.Send( "POST / HTTP/1.1", "Host:", "Transfer-Encoding: chunked", "", "gg"); if (expectedClientStatusCode == HttpStatusCode.OK) { await connection.ReceiveEnd( "HTTP/1.1 200 OK", "Content-Length: 0", $"Date: {server.Context.DateHeaderValue}", "", ""); } else { await connection.ReceiveEnd( "HTTP/1.1 400 Bad Request", "Content-Length: 0", "Connection: close", $"Date: {server.Context.DateHeaderValue}", "", ""); } } } var disposedStatusCode = await disposedTcs.Task.DefaultTimeout(); Assert.Equal(expectedServerStatusCode, (HttpStatusCode)disposedStatusCode); } if (sendMalformedRequest) { #pragma warning disable CS0618 // Type or member is obsolete Assert.Contains(testSink.Writes, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException && ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); #pragma warning restore CS0618 // Type or member is obsolete } else { Assert.DoesNotContain(testSink.Writes, w => w.EventId.Id == 17); } } private static HttpStatusCode GetStatus(string response) { var statusStart = response.IndexOf(' ') + 1; var statusEnd = response.IndexOf(' ', statusStart) - 1; var statusLength = statusEnd - statusStart + 1; if (statusLength < 1) { throw new InvalidDataException($"No StatusCode found in '{response}'"); } return (HttpStatusCode)int.Parse(response.Substring(statusStart, statusLength), CultureInfo.InvariantCulture); } }
34.603363
167
0.486804
[ "MIT" ]
Akarachudra/kontur-aspnetcore-fork
src/Servers/Kestrel/test/InMemory.FunctionalTests/ResponseTests.cs
154,331
C#
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using ByteSizeLib; using Deployer.Core.FileSystem; using Serilog; namespace Deployer.NetFx { public class FileSystem : IFileSystem { public async Task<IList<IDisk>> GetDisks() { var results = await PowerShellMixin.ExecuteScript("Get-Disk"); var disks = results .Select(x => x.ImmediateBaseObject) .Select(ToDisk); return disks.ToList(); } private IDisk ToDisk(object disk) { var number = (uint)disk.GetPropertyValue("Number"); var size = new ByteSize((ulong)disk.GetPropertyValue("Size")); var allocatedSize = new ByteSize((ulong)disk.GetPropertyValue("AllocatedSize")); var diskInfo = new DiskInfo { Number = number, Size = size, AllocatedSize = allocatedSize, FriendlyName = (string)disk.GetPropertyValue("FriendlyName"), IsSystem = (bool)disk.GetPropertyValue("IsSystem"), IsBoot = (bool)disk.GetPropertyValue("IsBoot"), IsOffline = (bool)disk.GetPropertyValue("IsOffline"), IsReadOnly = (bool)disk.GetPropertyValue("IsReadOnly"), UniqueId = (string)disk.GetPropertyValue("UniqueId"), }; return new Disk(diskInfo); } public async Task<IDisk> GetDisk(int n) { Log.Verbose("Getting disk by index {Id}", n); var results = await PowerShellMixin.ExecuteScript($"Get-Disk -Number {n}"); var disks = results .Select(x => x.ImmediateBaseObject) .Select(ToDisk); var disk = disks.First(); Log.Verbose("Returned disk {Disk}", disk); return disk; } } }
31.52459
92
0.563703
[ "MIT" ]
0-Xanthium/WOA-Deployer
Source/Deployer.NetFx/FileSystem.cs
1,925
C#
using SFA.DAS.Commitments.Domain.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace SFA.DAS.Commitments.Support.SubSite.Models { public class ApprenticeshipViewModel { public string PaymentStatus { get; set; } public string AgreementStatus { get; set; } public IEnumerable<string> Alerts { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Name => $"{FirstName} {LastName}"; public string Uln { get; set; } public string UlnText => string.IsNullOrEmpty(Uln) ? "Pending" : Uln; public DateTime? DateOfBirth { get; set; } public string CohortReference { get; set; } public string EmployerReference { get; set; } = string.Empty; public string LegalEntity { get; set; } public string TrainingProvider { get; set; } public long UKPRN { get; set; } public string Trainingcourse { get; set; } public string ApprenticeshipCode { get; set; } public string EndPointAssessor { get; set; } public DateTime? DasTrainingStartDate { get; set; } public DateTime? DasTrainingEndDate { get; set; } public DateTime? ILRTrainingStartDate { get; set; } public DateTime? ILRTrainingeEndDate { get; set; } public Decimal? TrainingCost { get; set; } } }
34.261905
77
0.643502
[ "MIT" ]
SkillsFundingAgency/das-commitments
src/SFA.DAS.Commitments.Support.SubSite/Models/ApprenticeshipViewModel.cs
1,441
C#
using System; using System.Collections.Generic; using System.Text; namespace weixin.work.Request.appchat { public class Request_groupchatmsgnews { public Request_groupchatmsgnews() { this.msgtype = "news"; this.safe = 0; } /// <summary> /// 群聊id /// </summary> public string chatid { get; set; } /// <summary> /// 消息类型,此时固定为:news /// </summary> public string msgtype { get; set; } /// <summary> /// 表示是否是保密消息,0表示否,1表示是,默认0 /// </summary> public int safe { get; set; } /// <summary> /// 图文消息 /// </summary> public MsgNews news { get; set; } public class MsgNews { /// <summary> /// 图文消息,一个图文消息支持1到8条图文 /// </summary> public List<Msg_article> articles { get; set; } } public class Msg_article { /// <summary> /// 标题,不超过128个字节,超过会自动截断 /// </summary> public string title { get; set; } /// <summary> /// 描述,不超过512个字节,超过会自动截断 /// </summary> public string description { get; set; } /// <summary> /// 点击后跳转的链接。 /// </summary> public string url { get; set; } /// <summary> /// 图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图1068*455,小图150*150 /// </summary> public string picurl { get; set; } } } }
25.47541
64
0.457529
[ "MIT" ]
yangyx91/axiangweixinwork
weixin.work/Request/appchat/Request_groupchatmsgnews.cs
1,804
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEngine; using Object = UnityEngine.Object; namespace Game.UI { static public partial class M_UITools { static private M_UITools_AutoSetTranformValueByData M_UIToolsAutoSetTranformValueByData; static M_UITools() { M_UIToolsAutoSetTranformValueByData = new M_UITools_AutoSetTranformValueByData(); } #region 自动设置值 /// <summary> /// 根据数据结构自动给Transform赋值 /// </summary> /// <param name="t"></param> /// <param name="data"></param> static public void AutoSetComValue(Transform t, object data) { M_UIToolsAutoSetTranformValueByData.AutoSetValue(t, data); } private static Type checkType = typeof(Object); /// <summary> /// 绑定Windows的值 /// </summary> /// <param name="o"></param> static public void AutoSetTransformPath(M_AWindow win) { var vt = win.GetType(); var fields = vt.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); var vTransform = win.Transform; foreach (var f in fields) { if (f.FieldType.IsSubclassOf(checkType) == false) { continue; } //1.自动获取节点 //TODO 热更层必须这样获取属性 var _attrs = f.GetCustomAttributes(typeof(M_TransformPath), false); //as Attribute[]; if (_attrs != null && _attrs.Length > 0) { var attr = _attrs.ToList().Find((a) => a is M_TransformPath) as M_TransformPath; if (attr == null) continue; //获取节点,并且获取组件 var trans = vTransform.Find(attr.Path); if (trans == null) { BDebug.LogError(string.Format("自动设置节点失败:{0} - {1}", vt.FullName, attr.Path)); } var com = trans.GetComponent(f.FieldType); if (com == null) { BDebug.LogError(string.Format("节点没有对应组件:type【{0}】 - {1}", f.FieldType, attr.Path)); } //设置属性 f.SetValue(win, com); //Debug.LogFormat("字段{0}获取到setTransform ,path:{1}" , f.Name , attr.Path); } } #endregion } } }
30.752941
108
0.507651
[ "Apache-2.0" ]
HugoFang/BDFramework.Core
Assets/Code/Game/M_UIMgr/M_UITools.cs
2,772
C#
namespace EntertainmentSystem.Web.Controllers.Upload { using System.Web.Mvc; using Services.Contracts.Media.Generators; using ViewModels.Upload; public class UploadVideoController : UploadBaseController { public UploadVideoController(IVideoUploadingGeneratorService videoUploadingGeneratorService) : base(videoUploadingGeneratorService) { } [HttpGet] public ActionResult Create() { return this.PartialView("_UploadVideoPartial"); } [HttpPost] public ActionResult Create(VideoUploadViewModel model) { return this.CreateFromModel(model); } } }
25.703704
100
0.65562
[ "MIT" ]
Borayvor/ASP.NET-MVC-CourseProject
EntertainmentSystem/Web/EntertainmentSystem.Web/Controllers/Upload/UploadVideoController.cs
696
C#
using CefNet.Internal; using CefNet.WinApi; using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Runtime.CompilerServices; using System.Text; using System.Threading; using System.Windows.Forms; namespace CefNet.Windows.Forms { public partial class WebView : Control { private object SyncRoot; private IntPtr browserWindowHandle; private ContextMenuStrip _cefmenu; private EventHandler<ITextFoundEventArgs> TextFoundEvent; private EventHandler<IPdfPrintFinishedEventArgs> PdfPrintFinishedEvent; private EventHandler<EventArgs> StatusTextChangedEvent; private EventHandler<IScriptDialogOpeningEventArgs> ScriptDialogOpeningEvent; public WebView() : this((WebView)null) { } public WebView(WebView opener) { SyncRoot = new Dictionary<InitialPropertyKeys, object>(); if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) { BackColor = System.Drawing.Color.White; return; } if (opener != null) { this.Opener = opener; this.WindowlessRenderingEnabled = opener.WindowlessRenderingEnabled; this.BrowserSettings = opener.BrowserSettings; SimulateDevice(opener.Device); } Initialize(); } protected override void Dispose(bool disposing) { lock (SyncRoot) { ToolTip?.Dispose(); base.Dispose(disposing); } } protected SynchronizationContext UIContext { get; private set; } protected void VerifyAccess() { if (InvokeRequired) throw new InvalidOperationException("Cross-thread operation not valid. The WebView accessed from a thread other than the thread it was created on."); } protected override Size DefaultMinimumSize { get { return new Size(1, 1); } } protected override void CreateHandle() { if (GetState(State.Created)) throw new ObjectDisposedException(GetType().Name); UIContext = SynchronizationContext.Current; base.CreateHandle(); if (this.DesignMode) return; OnCreateBrowser(); } protected override void DestroyHandle() { if (GetState(State.Created) && !GetState(State.Closing)) { OnDestroyBrowser(); } base.DestroyHandle(); } private void SetInitProperty(InitialPropertyKeys key, object value) { var propertyBag = SyncRoot as Dictionary<InitialPropertyKeys, object>; if (propertyBag != null) { propertyBag[key] = value; } else { throw new InvalidOperationException("This property must be set before the underlying CEF browser is created."); } } private T GetInitProperty<T>(InitialPropertyKeys key) { var propertyBag = SyncRoot as Dictionary<InitialPropertyKeys, object>; if (propertyBag != null && propertyBag.TryGetValue(key, out object value)) { return (T)value; } return default; } protected virtual void OnCreateBrowser() { if (this.Opener != null) return; if (GetState(State.Creating) || GetState(State.Created)) throw new InvalidOperationException(); var propertyBag = SyncRoot as Dictionary<InitialPropertyKeys, object>; SetState(State.Creating, true); SyncRoot = new object(); using (var windowInfo = new CefWindowInfo()) { if (WindowlessRenderingEnabled) { windowInfo.SetAsWindowless(Handle); } else { // In order to avoid focus issues when creating browsers offscreen, // the browser must be created with a disabled child window. windowInfo.SetAsDisabledChild(Handle); } string initialUrl = null; CefDictionaryValue extraInfo = null; CefRequestContext requestContext = null; CefBrowserSettings browserSettings = null; if (propertyBag != null) { object value; if (propertyBag.TryGetValue(InitialPropertyKeys.Url, out value)) initialUrl = value as string; if (propertyBag.TryGetValue(InitialPropertyKeys.BrowserSettings, out value)) browserSettings = value as CefBrowserSettings; if (propertyBag.TryGetValue(InitialPropertyKeys.RequestContext, out value)) requestContext = value as CefRequestContext; if (propertyBag.TryGetValue(InitialPropertyKeys.ExtraInfo, out value)) extraInfo = value as CefDictionaryValue; } if (initialUrl == null) initialUrl = "about:blank"; if (browserSettings == null) browserSettings = DefaultBrowserSettings; if (!CefApi.CreateBrowser(windowInfo, ViewGlue.Client, initialUrl, browserSettings, extraInfo, requestContext)) throw new InvalidOperationException("Failed to create browser instance."); } } protected virtual void OnDestroyBrowser() { if (GetState(State.Created) && !GetState(State.Closing)) { SetState(State.Closing, true); if (!this.DesignMode) { ViewGlue.BrowserObject?.Host.CloseBrowser(true); } } } protected virtual void Initialize() { SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.FixedWidth | ControlStyles.FixedHeight | ControlStyles.StandardClick | ControlStyles.StandardDoubleClick | ControlStyles.SupportsTransparentBackColor | ControlStyles.EnableNotifyMessage | ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UseTextForAccessibility | ControlStyles.Opaque | ControlStyles.CacheText | ControlStyles.Selectable , false); SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.Selectable , true); SetStyle(ControlStyles.UserMouse, WindowlessRenderingEnabled); this.BackColor = Color.White; this.AllowDrop = true; this.ViewGlue = CreateWebViewGlue(); this.ToolTip = new ToolTip { ShowAlways = true }; } protected virtual WebViewGlue CreateWebViewGlue() { return new WinFormsWebViewGlue(this); } protected void SetDevicePixelRatio(float ratio) { if (OffscreenGraphics.PixelsPerDip != ratio) { OffscreenGraphics.PixelsPerDip = ratio; RaiseCrossThreadEvent(OnSizeChanged, EventArgs.Empty, false); } } /// <summary> /// Gets or sets the tool-tip object that is displayed for this element in the user interface (UI). /// </summary> public ToolTip ToolTip { get; set; } [Browsable(false)] public string StatusText { get; protected set; } protected virtual void RaiseCrossThreadEvent<TEventArgs>(Action<TEventArgs> raiseEvent, TEventArgs e, bool synchronous) where TEventArgs : class { if (UIContext != null) { if (synchronous) UIContext.Send(new CrossThreadEventMethod<TEventArgs>(raiseEvent, e).Invoke, this); else UIContext.Post(new CrossThreadEventMethod<TEventArgs>(raiseEvent, e).Invoke, this); } else { if (synchronous) this.Invoke(new CrossThreadEventMethod<TEventArgs>(raiseEvent, e).Invoke, this); else this.BeginInvoke(new CrossThreadEventMethod<TEventArgs>(raiseEvent, e).Invoke, this); } } private void AddHandler<TEventHadler>(in TEventHadler eventKey, TEventHadler handler) where TEventHadler : Delegate { TEventHadler current; TEventHadler key = eventKey; do { current = key; key = CefNetApi.CompareExchange<TEventHadler>(in eventKey, (TEventHadler)Delegate.Combine(current, handler), current); } while (key != current); } private void RemoveHandler<TEventHadler>(in TEventHadler eventKey, TEventHadler handler) where TEventHadler : Delegate { TEventHadler current; TEventHadler key = eventKey; do { current = key; key = CefNetApi.CompareExchange<TEventHadler>(in eventKey, (TEventHadler)Delegate.Remove(current, handler), current); } while (key != current); } protected virtual void OnBrowserCreated(EventArgs e) { if (SyncRoot.GetType() != typeof(object)) { #if DEBUG throw new InvalidOperationException("WTF?"); #endif SyncRoot = new object(); // ugly huck } browserWindowHandle = BrowserObject.Host.WindowHandle; BrowserCreated?.Invoke(this, e); ResizeBrowserWindow(); } protected override void OnGotFocus(System.EventArgs e) { BrowserObject?.Host.SetFocus(true); base.OnGotFocus(e); } protected override void OnLostFocus(EventArgs e) { BrowserObject?.Host.SetFocus(false); base.OnLostFocus(e); } protected override void OnResize(EventArgs e) { base.OnResize(e); ResizeBrowserWindow(); } protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged(e); if (!WindowlessRenderingEnabled) { ResizeBrowserWindow(); if (Visible) Invalidate(); } } /// <inheritdoc /> public CefRect GetBounds() { OffscreenGraphics offscreenGraphics = this.OffscreenGraphics; if (offscreenGraphics is null) { var r = this.DisplayRectangle; return new CefRect(r.X, r.Y, r.Width, r.Height); } return offscreenGraphics.GetBounds(); } internal void ResizeBrowserWindow() { const uint SWP_NOSIZE = 0x0001; const uint SWP_NOMOVE = 0x0002; const uint SWP_NOZORDER = 0x0004; const uint SWP_SHOWWINDOW = 0x0040; const uint SWP_HIDEWINDOW = 0x0080; const uint SWP_NOCOPYBITS = 0x0100; const uint SWP_ASYNCWINDOWPOS = 0x4000; const int GWL_STYLE = -16; if (browserWindowHandle == IntPtr.Zero) return; if (!IsHandleCreated) return; WindowStyle style = (WindowStyle)NativeMethods.GetWindowLong(Handle, GWL_STYLE); if (WindowlessRenderingEnabled) { NativeMethods.SetWindowLong(Handle, GWL_STYLE, new IntPtr((int)(style | WindowStyle.WS_VSCROLL | WindowStyle.WS_HSCROLL))); return; } Size size = this.ClientSize; if (Visible && size.Height > 0 && size.Width > 0) { style &= ~WindowStyle.WS_DISABLED; NativeMethods.SetWindowLong(browserWindowHandle, GWL_STYLE, new IntPtr((int)(style | WindowStyle.WS_TABSTOP | WindowStyle.WS_VISIBLE))); NativeMethods.SetWindowPos(browserWindowHandle, IntPtr.Zero, 0, 0, size.Width, size.Height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_ASYNCWINDOWPOS); } else { NativeMethods.SetWindowLong(browserWindowHandle, GWL_STYLE, new IntPtr((int)(style | WindowStyle.WS_DISABLED))); NativeMethods.SetWindowPos(browserWindowHandle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW | SWP_ASYNCWINDOWPOS); } } void IChromiumWebViewPrivate.RaisePopupBrowserCreating() { SetState(State.Creating, true); SyncRoot = new object(); } bool IChromiumWebViewPrivate.RaiseRunContextMenu(CefFrame frame, CefContextMenuParams menuParams, CefMenuModel model, CefRunContextMenuCallback callback) { if (model.Count == 0 #if OBSOLETED_CONTROLS_3_1 || ContextMenu != null #endif || ContextMenuStrip != null) { callback.Cancel(); return true; } var menuRunner = new WinFormsContextMenuRunner(menuParams, model, callback); menuRunner.Build(); _cefmenu = menuRunner.Menu; _cefmenu.Closed += HandleMenuCefMenuClosed; var location = new CefRect(menuParams.XCoord, menuParams.YCoord, 0, 0); VirtualDevice device = Device; if (device != null) { device.ScaleToViewport(ref location, OffscreenGraphics.PixelsPerDip); device.MoveToDevice(ref location, OffscreenGraphics.PixelsPerDip); } else { location.Scale(OffscreenGraphics.PixelsPerDip); } var ea = new ContextMenuEventArgs(menuRunner.Menu, new Point(location.X, location.Y)); RaiseCrossThreadEvent(OnShowContextMenu, ea, true); return ea.Handled; } private void HandleMenuCefMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) { ContextMenuStrip menu = _cefmenu; if (menu != null) { _cefmenu = null; menu.Closed -= HandleMenuCefMenuClosed; } } private void DismissContextMenu() { ContextMenuStrip menu = _cefmenu; if (menu != null) { OnHideContextMenu(new ContextMenuEventArgs(menu, new Point())); } } protected virtual void OnShowContextMenu(ContextMenuEventArgs e) { e.Handled = true; e.ContextMenu.Show(this, e.Location); } protected virtual void OnHideContextMenu(ContextMenuEventArgs e) { e.ContextMenu.Close(); } protected virtual void OnLoadingStateChange(LoadingStateChangeEventArgs e) { LoadingStateChange?.Invoke(this, e); } void IWinFormsWebViewPrivate.CefSetStatusText(string statusText) { this.StatusText = statusText; RaiseCrossThreadEvent(OnStatusTextChanged, EventArgs.Empty, false); } protected override void WndProc(ref Message m) { if (WindowlessRenderingEnabled) { if (ProcessWindowlessMessage(ref m)) return; } else if(m.Msg == 0x0210) // WM_PARENTNOTIFY { DismissContextMenu(); } base.WndProc(ref m); } } }
27.019027
165
0.717527
[ "MIT" ]
AigioL/CefNet
CefNet.Windows.Forms/WebView.cs
12,782
C#
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // </auto-generated> namespace Microsoft.Azure.Management.DevTestLabs { using Microsoft.Rest; using Microsoft.Rest.Azure; using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// <summary> /// VirtualMachinesOperations operations. /// </summary> public partial interface IVirtualMachinesOperations { /// <summary> /// List virtual machines in a given lab. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='odataQuery'> /// OData parameters to apply to the operation. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<IPage<LabVirtualMachine>>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery<LabVirtualMachine> odataQuery = default(ODataQuery<LabVirtualMachine>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Get virtual machine. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='expand'> /// Specify the $expand query. Example: /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<LabVirtualMachine>> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Create or replace an existing Virtual machine. This operation can /// take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='labVirtualMachine'> /// A virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<LabVirtualMachine>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Delete virtual machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Modify properties of virtual machines. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='labVirtualMachine'> /// A virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<LabVirtualMachine>> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Attach a new or existing data disk to virtual machine. This /// operation can take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='dataDiskProperties'> /// Request body for adding a new or existing data disk to a virtual /// machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> AddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Apply artifacts to virtual machine. This operation can take a while /// to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='applyArtifactsRequest'> /// Request body for applying artifacts to a virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Take ownership of an existing virtual machine This operation can /// take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> ClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Detach the specified disk from the virtual machine. This operation /// can take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='detachDataDiskProperties'> /// Request body for detaching data disk from a virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> DetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Gets a string that represents the contents of the RDP file for the /// virtual machine /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<RdpConnection>> GetRdpFileContentsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Lists the applicable start/stop schedules, if any. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<ApplicableSchedule>> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Redeploy a virtual machine This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> RedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Resize Virtual Machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='resizeLabVirtualMachineProperties'> /// Request body for resizing a virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> ResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Restart a virtual machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> RestartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Start a virtual machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> StartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Stop a virtual machine This operation can take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> StopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Transfers all data disks attached to the virtual machine to be /// owned by the current user. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> TransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Release ownership of an existing virtual machine This operation can /// take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> UnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Create or replace an existing Virtual machine. This operation can /// take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='labVirtualMachine'> /// A virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<LabVirtualMachine>> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Delete virtual machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Attach a new or existing data disk to virtual machine. This /// operation can take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='dataDiskProperties'> /// Request body for adding a new or existing data disk to a virtual /// machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginAddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Apply artifacts to virtual machine. This operation can take a while /// to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='applyArtifactsRequest'> /// Request body for applying artifacts to a virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Take ownership of an existing virtual machine This operation can /// take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Detach the specified disk from the virtual machine. This operation /// can take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='detachDataDiskProperties'> /// Request body for detaching data disk from a virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginDetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Redeploy a virtual machine This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Resize Virtual Machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='resizeLabVirtualMachineProperties'> /// Request body for resizing a virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Restart a virtual machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginRestartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Start a virtual machine. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginStartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Stop a virtual machine This operation can take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Transfers all data disks attached to the virtual machine to be /// owned by the current user. This operation can take a while to /// complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginTransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// Release ownership of an existing virtual machine This operation can /// take a while to complete. /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='labName'> /// The name of the lab. /// </param> /// <param name='name'> /// The name of the virtual machine. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse> BeginUnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// <summary> /// List virtual machines in a given lab. /// </summary> /// <param name='nextPageLink'> /// The NextLink from the previous successful call to List operation. /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="Microsoft.Rest.Azure.CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="Microsoft.Rest.SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown when a required parameter is null /// </exception> Task<AzureOperationResponse<IPage<LabVirtualMachine>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } }
47.269441
335
0.603355
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/devtestlabs/Microsoft.Azure.Management.DevTestLabs/src/Generated/IVirtualMachinesOperations.cs
43,157
C#
using MicroService.Core; using MicroService.Data.Common; using MicroService.Data.Enums; using MicroService.Common.Models; using ProtoBuf; using System; using System.Collections.Generic; using System.Text; namespace MicroService.IApplication.Order.Dto { /// <summary> /// OrderInfos --dto /// </summary> [ProtoContract] [Serializable] public class OrderInfosRequestDto:LoginUser { //<summary> // 订单号 //<summary> public string OrderNumber { set; get; } //<summary> // 总金额 //<summary> public decimal TotalMoney { set; get; } //<summary> // 下单用户 //<summary> public string UserId { set; get; } //<summary> // 过期时间 //<summary> public DateTime ExpireTime { set; get; } //<summary> // 订单状态 //<summary> public int Status { set; get; } } }
16.893617
46
0.661209
[ "MIT" ]
DotNetExample/surging.Demo
SurgingDemo/03.Application/MicroService.IApplication.Order/Dto/OrderInfos/OrderInfosRequestDto.cs
830
C#
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Text; using Microsoft.CodeAnalysis.Collections; #pragma warning disable RS0010 // Avoid using cref tags with a prefix namespace Microsoft.CodeAnalysis.Debugging { /// <summary> /// A collection of utility method for consuming custom debug info from a PDB. /// </summary> /// <remarks> /// This is not a public API, so we're just going to let bad offsets fail on their own. /// </remarks> internal static class CustomDebugInfoReader { /// <summary> /// This is the first header in the custom debug info blob. /// </summary> private static void ReadGlobalHeader(byte[] bytes, ref int offset, out byte version, out byte count) { version = bytes[offset + 0]; count = bytes[offset + 1]; offset += CustomDebugInfoConstants.GlobalHeaderSize; } /// <summary> /// After the global header (see <see cref="ReadGlobalHeader"/> comes list of custom debug info record. /// Each record begins with a standard header. /// </summary> private static void ReadRecordHeader(byte[] bytes, ref int offset, out byte version, out CustomDebugInfoKind kind, out int size, out int alignmentSize) { version = bytes[offset + 0]; kind = (CustomDebugInfoKind)bytes[offset + 1]; alignmentSize = bytes[offset + 3]; // two bytes of padding after kind size = BitConverter.ToInt32(bytes, offset + 4); offset += CustomDebugInfoConstants.RecordHeaderSize; } /// <exception cref="InvalidOperationException"></exception> public static ImmutableArray<byte> TryGetCustomDebugInfoRecord(byte[] customDebugInfo, CustomDebugInfoKind recordKind) { foreach (var record in GetCustomDebugInfoRecords(customDebugInfo)) { if (record.Kind == recordKind) { return record.Data; } } return default(ImmutableArray<byte>); } /// <remarks> /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> /// <exception cref="InvalidOperationException"></exception> public static IEnumerable<CustomDebugInfoRecord> GetCustomDebugInfoRecords(byte[] customDebugInfo) { if (customDebugInfo.Length < CustomDebugInfoConstants.GlobalHeaderSize) { throw new InvalidOperationException("Invalid header."); } int offset = 0; byte globalVersion; byte globalCount; ReadGlobalHeader(customDebugInfo, ref offset, out globalVersion, out globalCount); if (globalVersion != CustomDebugInfoConstants.Version) { yield break; } while (offset <= customDebugInfo.Length - CustomDebugInfoConstants.RecordHeaderSize) { byte version; CustomDebugInfoKind kind; int size; int alignmentSize; ReadRecordHeader(customDebugInfo, ref offset, out version, out kind, out size, out alignmentSize); if (size < CustomDebugInfoConstants.RecordHeaderSize) { throw new InvalidOperationException("Invalid header."); } switch (kind) { case CustomDebugInfoKind.EditAndContinueLambdaMap: case CustomDebugInfoKind.EditAndContinueLocalSlotMap: case CustomDebugInfoKind.TupleElementNames: break; default: // ignore alignment for CDIs that don't support it alignmentSize = 0; break; } int bodySize = size - CustomDebugInfoConstants.RecordHeaderSize; if (offset > customDebugInfo.Length - bodySize || alignmentSize > 3 || alignmentSize > bodySize) { throw new InvalidOperationException("Invalid header."); } yield return new CustomDebugInfoRecord(kind, version, ImmutableArray.Create(customDebugInfo, offset, bodySize - alignmentSize)); offset += bodySize; } } /// <summary> /// For each namespace declaration enclosing a method (innermost-to-outermost), there is a count /// of the number of imports in that declaration. /// </summary> /// <remarks> /// There's always at least one entry (for the global namespace). /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> public static ImmutableArray<short> DecodeUsingRecord(ImmutableArray<byte> bytes) { int offset = 0; var numCounts = ReadInt16(bytes, ref offset); var builder = ArrayBuilder<short>.GetInstance(numCounts); for (int i = 0; i < numCounts; i++) { builder.Add(ReadInt16(bytes, ref offset)); } return builder.ToImmutableAndFree(); } /// <summary> /// This indicates that further information can be obtained by looking at the custom debug /// info of another method (specified by token). /// </summary> /// <remarks> /// Appears when multiple method would otherwise have identical using records (see <see cref="DecodeUsingRecord"/>). /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> public static int DecodeForwardRecord(ImmutableArray<byte> bytes) { int offset = 0; return ReadInt32(bytes, ref offset); } /// <summary> /// This indicates that further information can be obtained by looking at the custom debug /// info of another method (specified by token). /// </summary> /// <remarks> /// Appears when there are extern aliases and edit-and-continue is disabled. /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> public static int DecodeForwardToModuleRecord(ImmutableArray<byte> bytes) { int offset = 0; return ReadInt32(bytes, ref offset); } /// <summary> /// Scopes of state machine hoisted local variables. /// </summary> /// <remarks> /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> public static ImmutableArray<StateMachineHoistedLocalScope> DecodeStateMachineHoistedLocalScopesRecord(ImmutableArray<byte> bytes) { int offset = 0; var bucketCount = ReadInt32(bytes, ref offset); var builder = ArrayBuilder<StateMachineHoistedLocalScope>.GetInstance(bucketCount); for (int i = 0; i < bucketCount; i++) { int startOffset = ReadInt32(bytes, ref offset); int endOffset = ReadInt32(bytes, ref offset); builder.Add(new StateMachineHoistedLocalScope(startOffset, endOffset)); } return builder.ToImmutableAndFree(); } /// <summary> /// Indicates that this method is the iterator state machine for the method named in the record. /// </summary> /// <remarks> /// Appears when are iterator methods. /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> public static string DecodeForwardIteratorRecord(ImmutableArray<byte> bytes) { int offset = 0; var pooled = PooledStringBuilder.GetInstance(); var builder = pooled.Builder; while (true) { char ch = (char)ReadInt16(bytes, ref offset); if (ch == 0) { break; } builder.Append(ch); } return pooled.ToStringAndFree(); } /// <summary> /// Does for locals what System.Runtime.CompilerServices.DynamicAttribute does for parameters, return types, and fields. /// In particular, indicates which occurrences of <see cref="object"/> in the signature are really dynamic. /// </summary> /// <remarks> /// Appears when there are dynamic locals. /// Exposed for <see cref="T:Roslyn.Test.PdbUtilities.PdbToXmlConverter"/>. /// </remarks> /// <exception cref="InvalidOperationException">Bad data.</exception> public static ImmutableArray<DynamicLocalInfo> DecodeDynamicLocalsRecord(ImmutableArray<byte> bytes) { int offset = 0; int bucketCount = ReadInt32(bytes, ref offset); var builder = ArrayBuilder<DynamicLocalInfo>.GetInstance(bucketCount); for (int i = 0; i < bucketCount; i++) { const int FlagBytesCount = 64; ulong flags = 0UL; for (int j = 0; j < FlagBytesCount; j++) { var flag = ReadByte(bytes, ref offset) != 0; if (flag) { flags |= 1UL << j; } } int flagCount = ReadInt32(bytes, ref offset); int slotId = ReadInt32(bytes, ref offset); const int NameBytesCount = 128; var pooled = PooledStringBuilder.GetInstance(); var nameBuilder = pooled.Builder; int nameEnd = offset + NameBytesCount; while (offset < nameEnd) { char ch = (char)ReadInt16(bytes, ref offset); if (ch == 0) { // The Identifier name takes 64 WCHAR no matter how big its actual length is. offset = nameEnd; break; } nameBuilder.Append(ch); } var name = pooled.ToStringAndFree(); builder.Add(new DynamicLocalInfo(flagCount, flags, slotId, name)); } return builder.ToImmutableAndFree(); } /// <summary> /// Tuple element names for locals. /// </summary> public static ImmutableArray<TupleElementNamesInfo> DecodeTupleElementNamesRecord(ImmutableArray<byte> bytes) { int offset = 0; int n = ReadInt32(bytes, ref offset); var builder = ArrayBuilder<TupleElementNamesInfo>.GetInstance(n); for (int i = 0; i < n; i++) { builder.Add(DecodeTupleElementNamesInfo(bytes, ref offset)); } return builder.ToImmutableAndFree(); } private static TupleElementNamesInfo DecodeTupleElementNamesInfo(ImmutableArray<byte> bytes, ref int offset) { int n = ReadInt32(bytes, ref offset); var builder = ArrayBuilder<string>.GetInstance(n); for (int i = 0; i < n; i++) { var value = ReadUtf8String(bytes, ref offset); builder.Add(string.IsNullOrEmpty(value) ? null : value); } int slotIndex = ReadInt32(bytes, ref offset); int scopeStart = ReadInt32(bytes, ref offset); int scopeEnd = ReadInt32(bytes, ref offset); var localName = ReadUtf8String(bytes, ref offset); return new TupleElementNamesInfo(builder.ToImmutableAndFree(), slotIndex, localName, scopeStart, scopeEnd); } /// <summary> /// Returns the raw bytes of a record. /// </summary> private static void ReadRawRecordBody(byte[] bytes, ref int offset, int size, out ImmutableArray<byte> body) { int bodySize = size - CustomDebugInfoConstants.RecordHeaderSize; body = ImmutableArray.Create(bytes, offset, bodySize); offset += bodySize; } /// <summary> /// Skips past a record. /// </summary> private static void SkipRecord(byte[] bytes, ref int offset, int size) { offset += size - CustomDebugInfoConstants.RecordHeaderSize; } /// <summary> /// Get the import strings for a given method, following forward pointers as necessary. /// </summary> /// <returns> /// For each namespace enclosing the method, a list of import strings, innermost to outermost. /// There should always be at least one entry, for the global namespace. /// </returns> public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrings<TArg>( int methodToken, TArg arg, Func<int, TArg, byte[]> getMethodCustomDebugInfo, Func<int, TArg, ImmutableArray<string>> getMethodImportStrings, out ImmutableArray<string> externAliasStrings) { externAliasStrings = default(ImmutableArray<string>); ImmutableArray<short> groupSizes = default(ImmutableArray<short>); bool seenForward = false; RETRY: byte[] bytes = getMethodCustomDebugInfo(methodToken, arg); if (bytes == null) { return default(ImmutableArray<ImmutableArray<string>>); } foreach (var record in GetCustomDebugInfoRecords(bytes)) { switch (record.Kind) { case CustomDebugInfoKind.UsingInfo: if (!groupSizes.IsDefault) { throw new InvalidOperationException(string.Format("Expected at most one Using record for method {0}", FormatMethodToken(methodToken))); } groupSizes = DecodeUsingRecord(record.Data); break; case CustomDebugInfoKind.ForwardInfo: if (!externAliasStrings.IsDefault) { throw new InvalidOperationException(string.Format("Did not expect both Forward and ForwardToModule records for method {0}", FormatMethodToken(methodToken))); } methodToken = DecodeForwardRecord(record.Data); // Follow at most one forward link (as in FUNCBRECEE::ensureNamespaces). // NOTE: Dev11 may produce chains of forward links (e.g. for System.Collections.Immutable). if (!seenForward) { seenForward = true; goto RETRY; } break; case CustomDebugInfoKind.ForwardToModuleInfo: if (!externAliasStrings.IsDefault) { throw new InvalidOperationException(string.Format("Expected at most one ForwardToModule record for method {0}", FormatMethodToken(methodToken))); } int moduleInfoMethodToken = DecodeForwardToModuleRecord(record.Data); ImmutableArray<string> allModuleInfoImportStrings = getMethodImportStrings(moduleInfoMethodToken, arg); Debug.Assert(!allModuleInfoImportStrings.IsDefault); var externAliasBuilder = ArrayBuilder<string>.GetInstance(); foreach (string importString in allModuleInfoImportStrings) { if (IsCSharpExternAliasInfo(importString)) { externAliasBuilder.Add(importString); } } externAliasStrings = externAliasBuilder.ToImmutableAndFree(); break; } } if (groupSizes.IsDefault) { // This can happen in malformed PDBs (e.g. chains of forwards). return default(ImmutableArray<ImmutableArray<string>>); } ImmutableArray<string> importStrings = getMethodImportStrings(methodToken, arg); Debug.Assert(!importStrings.IsDefault); var resultBuilder = ArrayBuilder<ImmutableArray<string>>.GetInstance(groupSizes.Length); var groupBuilder = ArrayBuilder<string>.GetInstance(); int pos = 0; foreach (short groupSize in groupSizes) { for (int i = 0; i < groupSize; i++, pos++) { if (pos >= importStrings.Length) { throw new InvalidOperationException(string.Format("Group size indicates more imports than there are import strings (method {0}).", FormatMethodToken(methodToken))); } string importString = importStrings[pos]; if (IsCSharpExternAliasInfo(importString)) { throw new InvalidOperationException(string.Format("Encountered extern alias info before all import strings were consumed (method {0}).", FormatMethodToken(methodToken))); } groupBuilder.Add(importString); } resultBuilder.Add(groupBuilder.ToImmutable()); groupBuilder.Clear(); } if (externAliasStrings.IsDefault) { Debug.Assert(groupBuilder.Count == 0); // Extern alias detail strings (prefix "Z") are not included in the group counts. for (; pos < importStrings.Length; pos++) { string importString = importStrings[pos]; if (!IsCSharpExternAliasInfo(importString)) { throw new InvalidOperationException(string.Format("Expected only extern alias info strings after consuming the indicated number of imports (method {0}).", FormatMethodToken(methodToken))); } groupBuilder.Add(importString); } externAliasStrings = groupBuilder.ToImmutableAndFree(); } else { groupBuilder.Free(); if (pos < importStrings.Length) { throw new InvalidOperationException(string.Format("Group size indicates fewer imports than there are import strings (method {0}).", FormatMethodToken(methodToken))); } } return resultBuilder.ToImmutableAndFree(); } /// <summary> /// Get the import strings for a given method, following forward pointers as necessary. /// </summary> /// <returns> /// A list of import strings. There should always be at least one entry, for the global namespace. /// </returns> public static ImmutableArray<string> GetVisualBasicImportStrings<TArg>( int methodToken, TArg arg, Func<int, TArg, ImmutableArray<string>> getMethodImportStrings) { ImmutableArray<string> importStrings = getMethodImportStrings(methodToken, arg); Debug.Assert(!importStrings.IsDefault); if (importStrings.IsEmpty) { return ImmutableArray<string>.Empty; } // Follow at most one forward link. // As in PdbUtil::GetRawNamespaceListCore, we consider only the first string when // checking for forwarding. string importString = importStrings[0]; if (importString.Length >= 2 && importString[0] == '@') { char ch1 = importString[1]; if ('0' <= ch1 && ch1 <= '9') { int tempMethodToken; if (int.TryParse(importString.Substring(1), NumberStyles.None, CultureInfo.InvariantCulture, out tempMethodToken)) { importStrings = getMethodImportStrings(tempMethodToken, arg); Debug.Assert(!importStrings.IsDefault); } } } return importStrings; } private static void CheckVersion(byte globalVersion, int methodToken) { if (globalVersion != CustomDebugInfoConstants.Version) { throw new InvalidOperationException(string.Format("Method {0}: Expected version {1}, but found version {2}.", FormatMethodToken(methodToken), CustomDebugInfoConstants.Version, globalVersion)); } } private static int ReadInt32(ImmutableArray<byte> bytes, ref int offset) { int i = offset; if (i + sizeof(int) > bytes.Length) { throw new InvalidOperationException("Read out of buffer."); } offset += sizeof(int); return bytes[i] | (bytes[i + 1] << 8) | (bytes[i + 2] << 16) | (bytes[i + 3] << 24); } private static short ReadInt16(ImmutableArray<byte> bytes, ref int offset) { int i = offset; if (i + sizeof(short) > bytes.Length) { throw new InvalidOperationException("Read out of buffer."); } offset += sizeof(short); return (short)(bytes[i] | (bytes[i + 1] << 8)); } private static byte ReadByte(ImmutableArray<byte> bytes, ref int offset) { int i = offset; if (i + sizeof(byte) > bytes.Length) { throw new InvalidOperationException("Read out of buffer."); } offset += sizeof(byte); return bytes[i]; } private static bool IsCSharpExternAliasInfo(string import) { return import.Length > 0 && import[0] == 'Z'; } /// <summary> /// Parse a string representing a C# using (or extern alias) directive. /// </summary> /// <remarks> /// <![CDATA[ /// For C#: /// "USystem" -> <namespace name="System" /> /// "AS USystem" -> <alias name="S" target="System" kind="namespace" /> /// "AC TSystem.Console" -> <alias name="C" target="System.Console" kind="type" /> /// "AS ESystem alias" -> <alias name="S" qualifier="alias" target="System" kind="type" /> /// "XOldLib" -> <extern alias="OldLib" /> /// "ZOldLib assembly" -> <externinfo name="OldLib" assembly="assembly" /> /// "ESystem alias" -> <namespace qualifier="alias" name="System" /> /// "TSystem.Math" -> <type name="System.Math" /> /// ]]> /// </remarks> public static bool TryParseCSharpImportString(string import, out string alias, out string externAlias, out string target, out ImportTargetKind kind) { alias = null; externAlias = null; target = null; kind = default(ImportTargetKind); if (string.IsNullOrEmpty(import)) { return false; } switch (import[0]) { case 'U': // C# (namespace) using alias = null; externAlias = null; target = import.Substring(1); kind = ImportTargetKind.Namespace; return true; case 'E': // C# (namespace) using // NOTE: Dev12 has related cases "I" and "O" in EMITTER::ComputeDebugNamespace, // but they were probably implementation details that do not affect Roslyn. if (!TrySplit(import, 1, ' ', out target, out externAlias)) { return false; } alias = null; kind = ImportTargetKind.Namespace; return true; case 'T': // C# (type) using alias = null; externAlias = null; target = import.Substring(1); kind = ImportTargetKind.Type; return true; case 'A': // C# type or namespace alias if (!TrySplit(import, 1, ' ', out alias, out target)) { return false; } switch (target[0]) { case 'U': kind = ImportTargetKind.Namespace; target = target.Substring(1); externAlias = null; return true; case 'T': kind = ImportTargetKind.Type; target = target.Substring(1); externAlias = null; return true; case 'E': kind = ImportTargetKind.Namespace; // Never happens for types. if (!TrySplit(target, 1, ' ', out target, out externAlias)) { return false; } return true; default: return false; } case 'X': // C# extern alias (in file) externAlias = null; alias = import.Substring(1); // For consistency with the portable format, store it in alias, rather than externAlias. target = null; kind = ImportTargetKind.Assembly; return true; case 'Z': // C# extern alias (module-level) // For consistency with the portable format, store it in alias, rather than externAlias. if (!TrySplit(import, 1, ' ', out alias, out target)) { return false; } externAlias = null; kind = ImportTargetKind.Assembly; return true; default: return false; } } /// <summary> /// Parse a string representing a VB import statement. /// </summary> /// <exception cref="ArgumentNullException"><paramref name="import"/> is null.</exception> /// <exception cref="ArgumentException">Format of <paramref name="import"/> is not valid.</exception> public static bool TryParseVisualBasicImportString(string import, out string alias, out string target, out ImportTargetKind kind, out VBImportScopeKind scope) { alias = null; target = null; kind = default(ImportTargetKind); scope = default(VBImportScopeKind); if (import == null) { return false; } // VB current namespace if (import.Length == 0) { alias = null; target = import; kind = ImportTargetKind.CurrentNamespace; scope = VBImportScopeKind.Unspecified; return true; } int pos = 0; switch (import[pos]) { case '&': // Indicates the presence of embedded PIA types from a given assembly. No longer required (as of Roslyn). case '$': case '#': // From ProcedureContext::LoadImportsAndDefaultNamespaceNormal: // "Module Imports and extension types are no longer needed since we are not doing custom name lookup" alias = null; target = import; kind = ImportTargetKind.Defunct; scope = VBImportScopeKind.Unspecified; return true; case '*': // VB default namespace // see PEBuilder.cpp in vb\language\CodeGen pos++; alias = null; target = import.Substring(pos); kind = ImportTargetKind.DefaultNamespace; scope = VBImportScopeKind.Unspecified; return true; case '@': // VB cases other than default and current namespace // see PEBuilder.cpp in vb\language\CodeGen pos++; if (pos >= import.Length) { return false; } scope = VBImportScopeKind.Unspecified; switch (import[pos]) { case 'F': scope = VBImportScopeKind.File; pos++; break; case 'P': scope = VBImportScopeKind.Project; pos++; break; } if (pos >= import.Length) { return false; } switch (import[pos]) { case 'A': pos++; if (import[pos] != ':') { return false; } pos++; if (!TrySplit(import, pos, '=', out alias, out target)) { return false; } kind = ImportTargetKind.NamespaceOrType; return true; case 'X': pos++; if (import[pos] != ':') { return false; } pos++; if (!TrySplit(import, pos, '=', out alias, out target)) { return false; } kind = ImportTargetKind.XmlNamespace; return true; case 'T': pos++; if (import[pos] != ':') { return false; } pos++; alias = null; target = import.Substring(pos); kind = ImportTargetKind.Type; return true; case ':': pos++; alias = null; target = import.Substring(pos); kind = ImportTargetKind.Namespace; return true; default: alias = null; target = import.Substring(pos); kind = ImportTargetKind.MethodToken; return true; } default: // VB current namespace alias = null; target = import; kind = ImportTargetKind.CurrentNamespace; scope = VBImportScopeKind.Unspecified; return true; } } private static bool TrySplit(string input, int offset, char separator, out string before, out string after) { int separatorPos = input.IndexOf(separator, offset); // Allow zero-length before for the global namespace (empty string). // Allow zero-length after for an XML alias in VB ("@PX:="). Not sure what it means. if (offset <= separatorPos && separatorPos < input.Length) { before = input.Substring(offset, separatorPos - offset); after = separatorPos + 1 == input.Length ? "" : input.Substring(separatorPos + 1); return true; } before = null; after = null; return false; } private static string FormatMethodToken(int methodToken) { return string.Format("0x{0:x8}", methodToken); } /// <summary> /// Read UTF8 string with null terminator. /// </summary> private static string ReadUtf8String(ImmutableArray<byte> bytes, ref int offset) { var builder = ArrayBuilder<byte>.GetInstance(); while (true) { var b = ReadByte(bytes, ref offset); if (b == 0) { break; } builder.Add(b); } var block = builder.ToArrayAndFree(); return Encoding.UTF8.GetString(block, 0, block.Length); } } }
39.224886
212
0.502168
[ "Apache-2.0" ]
hamish-milne/roslyn-OHDL
src/Dependencies/CodeAnalysis.Metadata/CustomDebugInfoReader.cs
34,363
C#
using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using HuaweiCloud.SDK.Core; namespace HuaweiCloud.SDK.Bms.V1.Model { /// <summary> /// Response Object /// </summary> public class ShowJobInfosResponse : SdkResponse { /// <summary> /// Job的状态。SUCCESS:成功RUNNING:运行中FAIL:失败INIT:正在初始化 /// </summary> /// <value>Job的状态。SUCCESS:成功RUNNING:运行中FAIL:失败INIT:正在初始化</value> [JsonConverter(typeof(EnumClassConverter<StatusEnum>))] public class StatusEnum { /// <summary> /// Enum SUCCESS for value: SUCCESS /// </summary> public static readonly StatusEnum SUCCESS = new StatusEnum("SUCCESS"); /// <summary> /// Enum RUNNING for value: RUNNING /// </summary> public static readonly StatusEnum RUNNING = new StatusEnum("RUNNING"); /// <summary> /// Enum FAIL for value: FAIL /// </summary> public static readonly StatusEnum FAIL = new StatusEnum("FAIL"); /// <summary> /// Enum INIT for value: INIT /// </summary> public static readonly StatusEnum INIT = new StatusEnum("INIT"); private static readonly Dictionary<string, StatusEnum> StaticFields = new Dictionary<string, StatusEnum>() { { "SUCCESS", SUCCESS }, { "RUNNING", RUNNING }, { "FAIL", FAIL }, { "INIT", INIT }, }; private string Value; public StatusEnum(string value) { Value = value; } public static StatusEnum FromValue(string value) { if(value == null){ return null; } if (StaticFields.ContainsKey(value)) { return StaticFields[value]; } return null; } public string GetValue() { return Value; } public override string ToString() { return $"{Value}"; } public override int GetHashCode() { return this.Value.GetHashCode(); } public override bool Equals(object obj) { if (obj == null) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (this.Equals(obj as StatusEnum)) { return true; } return false; } public bool Equals(StatusEnum obj) { if ((object)obj == null) { return false; } return StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value); } public static bool operator ==(StatusEnum a, StatusEnum b) { if (System.Object.ReferenceEquals(a, b)) { return true; } if ((object)a == null) { return false; } return a.Equals(b); } public static bool operator !=(StatusEnum a, StatusEnum b) { return !(a == b); } } /// <summary> /// Job的状态。SUCCESS:成功RUNNING:运行中FAIL:失败INIT:正在初始化 /// </summary> [JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)] public StatusEnum Status { get; set; } /// <summary> /// /// </summary> [JsonProperty("entities", NullValueHandling = NullValueHandling.Ignore)] public Entities Entities { get; set; } /// <summary> /// Job ID /// </summary> [JsonProperty("job_id", NullValueHandling = NullValueHandling.Ignore)] public string JobId { get; set; } /// <summary> /// Job的类型,包含以下类型:baremetalBatchCreate:批量创建裸金属服务器baremetalBatchOperate:批量修改裸金属服务器电源状态baremetalBatchCreate:批量创建裸金属服务器baremetalChangeOsVolumeBoot:切换快速发放裸金属服务器操作系统baremetalChangeOsLocalDisk:切换本地盘裸金属服务器操作系统baremetalVolumeBootReinstallOs:重装快速发放裸金属服务器操作系统baremetalReinstallOs:重装本地盘裸金属服务器操作系统baremetalAttachVolume:挂载单个磁盘baremetalDetachVolume:卸载单个磁盘baremetalBatchAttachVolume:裸金属服务器批量挂载共享磁盘 /// </summary> [JsonProperty("job_type", NullValueHandling = NullValueHandling.Ignore)] public string JobType { get; set; } /// <summary> /// 开始时间。时间戳格式为ISO 8601,例如:2019-04-25T20:04:47.591Z /// </summary> [JsonProperty("begin_time", NullValueHandling = NullValueHandling.Ignore)] public DateTime? BeginTime { get; set; } /// <summary> /// 结束时间。时间戳格式为ISO 8601,例如:2019-04-26T20:04:47.591Z /// </summary> [JsonProperty("end_time", NullValueHandling = NullValueHandling.Ignore)] public DateTime? EndTime { get; set; } /// <summary> /// Job执行失败时的错误码 /// </summary> [JsonProperty("error_code", NullValueHandling = NullValueHandling.Ignore)] public string ErrorCode { get; set; } /// <summary> /// Job执行失败时的错误原因 /// </summary> [JsonProperty("fail_reason", NullValueHandling = NullValueHandling.Ignore)] public string FailReason { get; set; } /// <summary> /// 出现错误时,返回的错误消息 /// </summary> [JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)] public string Message { get; set; } /// <summary> /// 出现错误时,返回的错误码。错误码和其对应的含义请参考8.1-状态码。 /// </summary> [JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)] public string Code { get; set; } /// <summary> /// Get the string /// </summary> public override string ToString() { var sb = new StringBuilder(); sb.Append("class ShowJobInfosResponse {\n"); sb.Append(" status: ").Append(Status).Append("\n"); sb.Append(" entities: ").Append(Entities).Append("\n"); sb.Append(" jobId: ").Append(JobId).Append("\n"); sb.Append(" jobType: ").Append(JobType).Append("\n"); sb.Append(" beginTime: ").Append(BeginTime).Append("\n"); sb.Append(" endTime: ").Append(EndTime).Append("\n"); sb.Append(" errorCode: ").Append(ErrorCode).Append("\n"); sb.Append(" failReason: ").Append(FailReason).Append("\n"); sb.Append(" message: ").Append(Message).Append("\n"); sb.Append(" code: ").Append(Code).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns true if objects are equal /// </summary> public override bool Equals(object input) { return this.Equals(input as ShowJobInfosResponse); } /// <summary> /// Returns true if objects are equal /// </summary> public bool Equals(ShowJobInfosResponse input) { if (input == null) return false; return ( this.Status == input.Status || (this.Status != null && this.Status.Equals(input.Status)) ) && ( this.Entities == input.Entities || (this.Entities != null && this.Entities.Equals(input.Entities)) ) && ( this.JobId == input.JobId || (this.JobId != null && this.JobId.Equals(input.JobId)) ) && ( this.JobType == input.JobType || (this.JobType != null && this.JobType.Equals(input.JobType)) ) && ( this.BeginTime == input.BeginTime || (this.BeginTime != null && this.BeginTime.Equals(input.BeginTime)) ) && ( this.EndTime == input.EndTime || (this.EndTime != null && this.EndTime.Equals(input.EndTime)) ) && ( this.ErrorCode == input.ErrorCode || (this.ErrorCode != null && this.ErrorCode.Equals(input.ErrorCode)) ) && ( this.FailReason == input.FailReason || (this.FailReason != null && this.FailReason.Equals(input.FailReason)) ) && ( this.Message == input.Message || (this.Message != null && this.Message.Equals(input.Message)) ) && ( this.Code == input.Code || (this.Code != null && this.Code.Equals(input.Code)) ); } /// <summary> /// Get hash code /// </summary> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.Status != null) hashCode = hashCode * 59 + this.Status.GetHashCode(); if (this.Entities != null) hashCode = hashCode * 59 + this.Entities.GetHashCode(); if (this.JobId != null) hashCode = hashCode * 59 + this.JobId.GetHashCode(); if (this.JobType != null) hashCode = hashCode * 59 + this.JobType.GetHashCode(); if (this.BeginTime != null) hashCode = hashCode * 59 + this.BeginTime.GetHashCode(); if (this.EndTime != null) hashCode = hashCode * 59 + this.EndTime.GetHashCode(); if (this.ErrorCode != null) hashCode = hashCode * 59 + this.ErrorCode.GetHashCode(); if (this.FailReason != null) hashCode = hashCode * 59 + this.FailReason.GetHashCode(); if (this.Message != null) hashCode = hashCode * 59 + this.Message.GetHashCode(); if (this.Code != null) hashCode = hashCode * 59 + this.Code.GetHashCode(); return hashCode; } } } }
34.176471
390
0.481384
[ "Apache-2.0" ]
cnblogs/huaweicloud-sdk-net-v3
Services/Bms/V1/Model/ShowJobInfosResponse.cs
11,629
C#
#region License(Apache Version 2.0) /****************************************** * Copyright ®2017-Now WangHuaiSheng. * 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. * Detail: https://github.com/WangHuaiSheng/WitsWay/LICENSE * ***************************************/ #endregion #region ChangeLog /****************************************** * 2017-10-7 OutMan Create * * ***************************************/ #endregion using System.Collections.Generic; using System.Threading; namespace WitsWay.Utilities.FastReflection.Cache { /// <summary> /// FastReflectionCache 缓存基类 /// </summary> /// <typeparam name="TKey">MethodInfo、ConstructorInfo、PropertyInfo、 FieldInfo</typeparam> /// <typeparam name="TValue">Invoker 或 Accessor对象</typeparam> public abstract class FastReflectionCache<TKey, TValue> : IFastReflectionCache<TKey, TValue> { private Dictionary<TKey, TValue> cache = new Dictionary<TKey, TValue>(); private ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim(); /// <summary> /// 获取缓存的Invoker 或 Accessor对象 /// </summary> /// <param name="key">MethodInfo、ConstructorInfo、PropertyInfo、 FieldInfo</param> /// <returns>Invoker 或 Accessor对象</returns> public TValue Get(TKey key) { var value = default(TValue); try { rwLock.EnterUpgradeableReadLock(); var cacheHit = cache.TryGetValue(key, out value); if (cacheHit) return value; rwLock.EnterWriteLock(); if (!cache.TryGetValue(key, out value)) { value = Create(key); cache[key] = value; } } finally { if (rwLock.IsUpgradeableReadLockHeld) { rwLock.ExitUpgradeableReadLock(); } if (rwLock.IsWriteLockHeld) { rwLock.ExitWriteLock(); } } return value; } /// <summary> /// 执行真正的 Invoker 或 Accessor对象创建 /// 需在子类中实现具体创建逻辑 /// </summary> /// <param name="key">MethodInfo、ConstructorInfo、PropertyInfo、 FieldInfo</param> /// <returns> Invoker 或 Accessor对象</returns> protected abstract TValue Create(TKey key); } }
36.949367
96
0.56766
[ "Apache-2.0" ]
wanghuaisheng/WitsWay
Solutions/AppUtilities/Utilities/FastReflection/Cache/FastReflectionCache.cs
3,028
C#
using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; using WalletWasabi.BitcoinCore.Rpc; using WalletWasabi.Crypto.Randomness; using WalletWasabi.Tests.Helpers; using WalletWasabi.Tor.Http; using WalletWasabi.WabiSabi.Backend; using WalletWasabi.WabiSabi.Backend.Banning; using WalletWasabi.WabiSabi.Backend.Rounds; using WalletWasabi.WabiSabi.Backend.Rounds.CoinJoinStorage; using WalletWasabi.WabiSabi.Backend.Statistics; using WalletWasabi.WabiSabi.Client; using WalletWasabi.WabiSabi.Models; using WalletWasabi.WabiSabi.Models.MultipartyTransaction; namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration; public class WabiSabiApiApplicationFactory<TStartup> : WebApplicationFactory<TStartup> where TStartup : class { // There is a deadlock in the current version of the asp.net testing framework // https://www.strathweb.com/2021/05/the-curious-case-of-asp-net-core-integration-test-deadlock/ protected override IHost CreateHost(IHostBuilder builder) { var host = builder.Build(); Task.Run(() => host.StartAsync()).GetAwaiter().GetResult(); return host; } protected override void ConfigureClient(HttpClient client) { client.Timeout = TimeSpan.FromMinutes(10); } protected override IHostBuilder CreateHostBuilder() { var builder = Host.CreateDefaultBuilder().ConfigureWebHostDefaults(x => x.UseStartup<TStartup>().UseTestServer()); return builder; } protected override void ConfigureWebHost(IWebHostBuilder builder) { // will be called after the `ConfigureServices` from the Startup builder.ConfigureTestServices(services => { services.AddHostedService<BackgroundServiceStarter<Arena>>(); services.AddSingleton<Arena>(); services.AddScoped<Network>(_ => Network.Main); services.AddScoped<IRPCClient>(_ => BitcoinFactory.GetMockMinimalRpc()); services.AddScoped<Prison>(); services.AddScoped<WabiSabiConfig>(); services.AddScoped(typeof(TimeSpan), _ => TimeSpan.FromSeconds(2)); services.AddScoped(s => new InMemoryCoinJoinIdStore()); services.AddSingleton<CoinJoinFeeRateStatStore>(); }); builder.ConfigureLogging(o => { o.SetMinimumLevel(LogLevel.Warning); }); } public Task<ArenaClient> CreateArenaClientAsync(HttpClient httpClient) => CreateArenaClientAsync(CreateWabiSabiHttpApiClient(httpClient)); public Task<ArenaClient> CreateArenaClientAsync(IHttpClient httpClient) => CreateArenaClientAsync(new WabiSabiHttpApiClient(httpClient)); public async Task<ArenaClient> CreateArenaClientAsync(WabiSabiHttpApiClient wabiSabiHttpApiClient) { var rounds = (await wabiSabiHttpApiClient.GetStatusAsync(RoundStateRequest.Empty, CancellationToken.None)).RoundStates; var round = rounds.First(x => x.CoinjoinState is ConstructionState); var insecureRandom = new InsecureRandom(); var arenaClient = new ArenaClient( round.CreateAmountCredentialClient(insecureRandom), round.CreateVsizeCredentialClient(insecureRandom), wabiSabiHttpApiClient); return arenaClient; } public WabiSabiHttpApiClient CreateWabiSabiHttpApiClient(HttpClient httpClient) => new(new HttpClientWrapper(httpClient)); }
37.296703
121
0.803182
[ "MIT" ]
Trxlz/WalletWasabi
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs
3,394
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501 { using Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.PowerShell; /// <summary>A list of server configurations.</summary> [System.ComponentModel.TypeConverter(typeof(ConfigurationListResultAutoGeneratedTypeConverter))] public partial class ConfigurationListResultAutoGenerated { /// <summary> /// <c>AfterDeserializeDictionary</c> will be called after the deserialization has finished, allowing customization of the /// object before it is returned. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); /// <summary> /// <c>AfterDeserializePSObject</c> will be called after the deserialization has finished, allowing customization of the object /// before it is returned. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); /// <summary> /// <c>BeforeDeserializeDictionary</c> will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter. /// Implement this method in a partial class to enable this behavior. /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return /// instantly.</param> partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); /// <summary> /// <c>BeforeDeserializePSObject</c> will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter. /// Implement this method in a partial class to enable this behavior. /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return /// instantly.</param> partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// <summary> /// Deserializes a <see cref="global::System.Collections.IDictionary" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.ConfigurationListResultAutoGenerated" /// />. /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> internal ConfigurationListResultAutoGenerated(global::System.Collections.IDictionary content) { bool returnNow = false; BeforeDeserializeDictionary(content, ref returnNow); if (returnNow) { return; } // actually deserialize ((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationAutoGenerated[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).Value, __y => TypeConverterExtensions.SelectToArray<Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationAutoGenerated>(__y, Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.ConfigurationAutoGeneratedTypeConverter.ConvertFrom)); ((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).NextLink, global::System.Convert.ToString); AfterDeserializeDictionary(content); } /// <summary> /// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.ConfigurationListResultAutoGenerated" /// />. /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> internal ConfigurationListResultAutoGenerated(global::System.Management.Automation.PSObject content) { bool returnNow = false; BeforeDeserializePSObject(content, ref returnNow); if (returnNow) { return; } // actually deserialize ((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationAutoGenerated[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).Value, __y => TypeConverterExtensions.SelectToArray<Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationAutoGenerated>(__y, Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.ConfigurationAutoGeneratedTypeConverter.ConvertFrom)); ((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGeneratedInternal)this).NextLink, global::System.Convert.ToString); AfterDeserializePSObject(content); } /// <summary> /// Deserializes a <see cref="global::System.Collections.IDictionary" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.ConfigurationListResultAutoGenerated" /// />. /// </summary> /// <param name="content">The global::System.Collections.IDictionary content that should be used.</param> /// <returns> /// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGenerated" /// />. /// </returns> public static Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ConfigurationListResultAutoGenerated(content); } /// <summary> /// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.ConfigurationListResultAutoGenerated" /// />. /// </summary> /// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param> /// <returns> /// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGenerated" /// />. /// </returns> public static Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ConfigurationListResultAutoGenerated(content); } /// <summary> /// Creates a new instance of <see cref="ConfigurationListResultAutoGenerated" />, deserializing the content from a json string. /// </summary> /// <param name="jsonText">a string containing a JSON serialized instance of this model.</param> /// <returns>an instance of the <see cref="className" /> model class.</returns> public static Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IConfigurationListResultAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.Json.JsonNode.Parse(jsonText)); /// <summary>Serializes this instance to a json string.</summary> /// <returns>a <see cref="System.String" /> containing this model serialized to JSON text.</returns> public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SerializationMode.IncludeAll)?.ToString(); } /// A list of server configurations. [System.ComponentModel.TypeConverter(typeof(ConfigurationListResultAutoGeneratedTypeConverter))] public partial interface IConfigurationListResultAutoGenerated { } }
71.314286
637
0.717849
[ "MIT" ]
Amrinder-Singh29/azure-powershell
src/MySql/generated/api/Models/Api20210501/ConfigurationListResultAutoGenerated.PowerShell.cs
9,845
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; // The Scoreboard class manages showing the score to the player public class Scoreboard : MonoBehaviour { public static Scoreboard S; // The singleton for Scoreboard [Header("Set in Inspector")] public GameObject prefabFloatingScore; [Header("Set Dynamically")] [SerializeField] private int _score = 0; [SerializeField] private string _scoreString; private Transform canvasTrans; // The score property also sets the scoreString public int score { get { return(_score); } set { _score = value; scoreString = _score.ToString("N0"); } } // The scoreString property also sets the Text.text public string scoreString { get { return(_scoreString); } set { _scoreString = value; GetComponent<Text>().text = _scoreString; } } void Awake() { if (S == null) { S = this; // Set the private singleton } else { Debug.LogError("ERROR: Scoreboard.Awake(): S is already set!"); } canvasTrans = transform.parent; } // When called by SendMessage, this adds the fs.score to this.score public void FSCallback(FloatingScore fs) { score += fs.score; } // This will Instantiate a new FloatingScore GameObject and initialize it. // It also returns a pointer to the FloatingScore created so that the // calling function can do more with it (like set fontSizes, and so on) public FloatingScore CreateFloatingScore(int amt, List<Vector2> pts) { GameObject go = Instantiate<GameObject>(prefabFloatingScore); go.transform.SetParent( canvasTrans ); FloatingScore fs = go.GetComponent<FloatingScore>(); fs.score = amt; fs.reportFinishTo = this.gameObject; // Set fs to call back to this fs.Init(pts); return(fs); } }
29.898551
78
0.62191
[ "BSD-3-Clause" ]
DouglasUrner/IGDPD
Prototype 6 - Word Game/Assets/__Scripts/ProtoTools/Scoreboard.cs
2,065
C#
// // DO NOT MODIFY! THIS IS AUTOGENERATED FILE! // namespace Xilium.CefGlue { using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; using Xilium.CefGlue.Interop; // Role: PROXY public sealed unsafe partial class CefV8Context : IDisposable { internal static CefV8Context FromNative(cef_v8context_t* ptr) { return new CefV8Context(ptr); } internal static CefV8Context FromNativeOrNull(cef_v8context_t* ptr) { if (ptr == null) return null; return new CefV8Context(ptr); } private cef_v8context_t* _self; private CefV8Context(cef_v8context_t* ptr) { if (ptr == null) throw new ArgumentNullException("ptr"); _self = ptr; } ~CefV8Context() { if (_self != null) { Release(); _self = null; } } public void Dispose() { if (_self != null) { Release(); _self = null; } GC.SuppressFinalize(this); } internal void AddRef() { cef_v8context_t.add_ref(_self); } internal bool Release() { return cef_v8context_t.release(_self) != 0; } internal bool HasOneRef { get { return cef_v8context_t.has_one_ref(_self) != 0; } } internal bool HasAtLeastOneRef { get { return cef_v8context_t.has_at_least_one_ref(_self) != 0; } } internal cef_v8context_t* ToNative() { AddRef(); return _self; } } }
23.625
76
0.48836
[ "MIT", "BSD-3-Clause" ]
8/Chromely
src/Chromely.CefGlue/CefGlue/Classes.g/CefV8Context.g.cs
1,892
C#
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; using System.Collections.Generic; using Aliyun.Acs.Core.Transform; using Aliyun.Acs.Rds.Model.V20140815; namespace Aliyun.Acs.Rds.Transform.V20140815 { public class ModifyDBProxyInstanceResponseUnmarshaller { public static ModifyDBProxyInstanceResponse Unmarshall(UnmarshallerContext context) { ModifyDBProxyInstanceResponse modifyDBProxyInstanceResponse = new ModifyDBProxyInstanceResponse(); modifyDBProxyInstanceResponse.HttpResponse = context.HttpResponse; modifyDBProxyInstanceResponse.RequestId = context.StringValue("ModifyDBProxyInstance.RequestId"); return modifyDBProxyInstanceResponse; } } }
37.275
102
0.76727
[ "Apache-2.0" ]
bbs168/aliyun-openapi-net-sdk
aliyun-net-sdk-rds/Rds/Transform/V20140815/ModifyDBProxyInstanceResponseUnmarshaller.cs
1,491
C#
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Web; using V308CMS.Data; using V308CMS.Data.Models; namespace V308CMS.Admin.Models { public class ProductModels:BaseModels { public ProductModels() { ListProductImages = new List<ProductImage>(); } public int Id { get; set; } [Required(ErrorMessage = "Vui lòng nhập Tên sản phẩm.")] [StringLength(250, ErrorMessage = "Tên sản phẩm không được vượt quá 250 ký tự.")] [Display(Name = "Tên")] public string Name { get; set; } [Required(ErrorMessage = "Vui lòng nhập Nội dung mô tả ngắn về sản phẩm.")] [StringLength(1000, ErrorMessage = "Mô tả ngắn không được vượt quá 1000 ký tự.")] [Display(Name="Mô tả ngắn")] public string Summary { get; set; } [Display(Name = "Danh mục")] public int CategoryId { get; set; } [StringLength(50,ErrorMessage = "Mã sản phẩm không được vượt quá 50 ký tự.")] [Display(Name = "Mã")] public string Code { get; set; } [StringLength(250,ErrorMessage = "Ảnh đại diện không được vượt quá 250 ký tự.")] public string ImageUrl { get; set; } public HttpPostedFileBase Image { get; set; } [Display(Name = "Thương hiệu")] public int? BrandId { get; set; } [Display(Name = "Nước sản xuất")] public string Country { get; set; } [Display(Name = "Kho hàng")] public string Store { get; set; } [Display(Name = "Nhà sản xuất")] public int? ManufacturerId { get; set; } [Display(Name = "Nhà cung cấp")] public string ProviderId { get; set; } [Display(Name = "Thứ tự")] public int Number { get; set; } [Display(Name = "Đơn vị tính")] public string Unit { get; set; } [Display(Name = "Trọng lượng")] public string Weight { get; set; } [Display(Name = "Số lượng")] public int Quantity { get; set; } [Display(Name = "Màu sắc")] public string[] Color { get; set; } [Display(Name = "Mức Chiết khấu NPP(%)")] public string Npp { get; set; } [Display(Name = "Kích cỡ")] public string[] Size { get; set; } [Display(Name = "Chiều rộng")] public string Width { get; set; } [Display(Name = "Chiều cao")] public string Height { get; set; } [Display(Name = "Độ dày")] public string Depth { get; set; } [Display(Name = "Chi tiết sản phẩm")] public string Detail { get; set; } [Display(Name = "Thời gian bảo hành")] public string WarrantyTime { get; set; } [Display(Name = "Hạn sử dụng")] public string ExpireDate { get; set; } [Display(Name = "Tiêu đề")] [StringLength(250, ErrorMessage = "Tiêu đề không được vượt quá 250 ký tự.")] public string MetaTitle { get; set; } [Display(Name = "Từ khóa")] [StringLength(500,ErrorMessage = "Từ khóa không được vượt quá 500 ký tự.")] public string MetaKeyword { get; set; } [Display(Name = "Mô tả")] [StringLength(500, ErrorMessage = "Nội dung mô tả không được vượt quá 500 ký tự.")] public string MetaDescription { get; set; } [Display(Name = "Giá")] public int Price { get; set; } [Display(Name = "Giảm giá")] public string Percent { get; set; } [Display(Name = "Ngày bắt đầu")] public string StartDate { get; set; } [Display(Name = "Ngày kết thúc")] public string EndDate { get; set; } public string[] AttrLabel { get; set; } public string[] AttrDesc { get; set; } public string[] ProductImages { get; set; } [Display(Name = "Từ")] public int Transport1 { get; set; } [Display(Name = "Đến")] public int Transport2 { get; set; } public List<ProductImage> ListProductImages { get; set; } public List<ProductColor> ListProductColor { get; set; } public List<ProductAttribute> ListProductAttribute { get; set; } public List<ProductSize> ListProductSize { get; set; } public List<ProductSaleOff> ListProductSaleOff { get; set; } public int? AccountId { get; set; } } }
39.225225
91
0.575103
[ "Unlicense" ]
giaiphapictcom/mamoo.vn
V308CMS.Admin/Models/ProductModels.cs
4,614
C#
using System; using System.Linq; using System.Web; using System.Web.Routing; namespace RobsonROX.Util.MVC.Routes { public class DelegateRouteConstraint : IRouteConstraint { private readonly string[] _routeSegments; private readonly Func<object, bool> _constraintValidator; /// <summary> /// Atribui uma função de validação para um segmento de rota específico a ser procurado na rota /// </summary> /// <param name="constraintValidator">Função para análise do segmento de rota</param> /// <param name="routeSegments">Segmentos de rota a serem analisados</param> /// <exception cref="ArgumentNullException">O segmento de rota e a função de validação do segmento não pode ser nulos</exception> public DelegateRouteConstraint(Func<object, bool> constraintValidator, params string[] routeSegments) { if (routeSegments == null) throw new ArgumentNullException(nameof(routeSegments)); if (constraintValidator == null) throw new ArgumentNullException(nameof(constraintValidator)); _routeSegments = routeSegments; _constraintValidator = constraintValidator; } /// <summary> /// Determines whether the URL parameter contains a valid value for this constraint. /// </summary> /// <returns> /// true if the URL parameter contains a valid value; otherwise, false. /// </returns> /// <param name="httpContext">An object that encapsulates information about the HTTP request.</param><param name="route">The object that this constraint belongs to.</param><param name="parameterName">The name of the parameter that is being checked.</param><param name="values">An object that contains the parameters for the URL.</param><param name="routeDirection">An object that indicates whether the constraint check is being performed when an incoming request is being handled or when a URL is being generated.</param> public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { return _routeSegments.All(s => values.Keys.Contains(s)) && _routeSegments.All(s => _constraintValidator(values[s])); } } }
55.214286
529
0.696852
[ "MIT" ]
Robson-Rocha/Util
Util.MVC/Routes/DelegateRouteConstraint.cs
2,334
C#
using System; namespace lindexi.MVVM.Framework.ViewModel { /// <summary> /// 发送消息 /// </summary> public interface ISendMessage : IViewModel { /// <summary> /// 发送消息 /// </summary> EventHandler<IMessage> Send { set; get; } } }
17.75
49
0.535211
[ "MIT" ]
lindexi/UWP
uwp/src/Framework/Framework/ViewModel/ISendMessage.cs
302
C#
using System; using System.Drawing; namespace Rejive { /// <summary> /// Summary description for ColorHelper. /// </summary> internal class ColorHelper { /// <summary> /// /// </summary> /// <param name="red"></param> /// <param name="green"></param> /// <param name="blue"></param> /// <returns></returns> public static Color CreateColorFromRGB(int red, int green, int blue) { //Corect Red element int r = red; if (r > 255) { r = 255; } if (r < 0) { r = 0; } //Corect Green element int g = green; if (g > 255) { g = 255; } if (g < 0) { g = 0; } //Correct Blue Element int b = blue; if (b > 255) { b = 255; } if (b < 0) { b = 0; } return Color.FromArgb(r, g, b); } /// <summary> /// /// </summary> /// <param name="blendColor"></param> /// <param name="baseColor"></param> /// <param name="opacity"></param> /// <returns></returns> public static Color OpacityMix(Color blendColor, Color baseColor, int opacity) { int r1; int g1; int b1; int r2; int g2; int b2; int r3; int g3; int b3; r1 = blendColor.R; g1 = blendColor.G; b1 = blendColor.B; r2 = baseColor.R; g2 = baseColor.G; b2 = baseColor.B; r3 = (int)(((r1 * ((float)opacity / 100)) + (r2 * (1 - ((float)opacity / 100))))); g3 = (int)(((g1 * ((float)opacity / 100)) + (g2 * (1 - ((float)opacity / 100))))); b3 = (int)(((b1 * ((float)opacity / 100)) + (b2 * (1 - ((float)opacity / 100))))); return CreateColorFromRGB(r3, g3, b3); } /// <summary> /// /// </summary> /// <param name="baseColor"></param> /// <param name="blendColor"></param> /// <param name="opacity"></param> /// <returns></returns> public static Color SoftLightMix(Color baseColor, Color blendColor, int opacity) { int r1; int g1; int b1; int r2; int g2; int b2; int r3; int g3; int b3; r1 = baseColor.R; g1 = baseColor.G; b1 = baseColor.B; r2 = blendColor.R; g2 = blendColor.G; b2 = blendColor.B; r3 = SoftLightMath(r1, r2); g3 = SoftLightMath(g1, g2); b3 = SoftLightMath(b1, b2); return OpacityMix(CreateColorFromRGB(r3, g3, b3), baseColor, opacity); } /// <summary> /// /// </summary> /// <param name="baseColor"></param> /// <param name="blendColor"></param> /// <param name="opacity"></param> /// <returns></returns> public static Color OverlayMix(Color baseColor, Color blendColor, int opacity) { int r1; int g1; int b1; int r2; int g2; int b2; int r3; int g3; int b3; r1 = baseColor.R; g1 = baseColor.G; b1 = baseColor.B; r2 = blendColor.R; g2 = blendColor.G; b2 = blendColor.B; r3 = OverlayMath(baseColor.R, blendColor.R); g3 = OverlayMath(baseColor.G, blendColor.G); b3 = OverlayMath(baseColor.B, blendColor.B); return OpacityMix(CreateColorFromRGB(r3, g3, b3), baseColor, opacity); } /// <summary> /// /// </summary> /// <param name="ibase"></param> /// <param name="blend"></param> /// <returns></returns> private static int SoftLightMath(int ibase, int blend) { float dbase; float dblend; dbase = (float)ibase / 255; dblend = (float)blend / 255; if (dblend < 0.5) { return (int)(((2 * dbase * dblend) + (Math.Pow(dbase, 2)) * (1 - (2 * dblend))) * 255); } else { return (int)(((Math.Sqrt(dbase) * (2 * dblend - 1)) + ((2 * dbase) * (1 - dblend))) * 255); } } /// <summary> /// /// </summary> /// <param name="ibase"></param> /// <param name="blend"></param> /// <returns></returns> public static int OverlayMath(int ibase, int blend) { double dbase; double dblend; dbase = (double)ibase / 255; dblend = (double)blend / 255; if (dbase < 0.5) { return (int)((2 * dbase * dblend) * 255); } else { return (int)((1 - (2 * (1 - dbase) * (1 - dblend))) * 255); } } } }
28.326316
107
0.404125
[ "MIT" ]
padgettrowell/rejive
src/Controls/ColorHelper.cs
5,384
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace indiceNomes { class indiceNome { static void Main(string[] args) { char[][] matriz = { new char[] {'A','B','C','D','E','F','G','H','I','J','K','L', 'M','N','O','P','Q','R','S','T', 'U','V','W','X','Y','Z'}, new char[] {'a','b','c','d','e','f','g','h','i','j','k','l', 'm','n','o','p','q','r','s','t','u','v','w', 'x','y','z'}, new char[] {'0','1','2','3','4','5','6','7','8','9','-','.',' '} }; // Inicializar o array com os caracteres que formam seus nomes e números // Por exemplo, Cris seria formado pelos seguintes caracteres: char[][] dados = new char[2][]; char[] nome = "Cristiane Tuji".ToCharArray(); char[] RG = "12.345.678-9".ToCharArray(); dados[0] = nome; dados[1] = RG; String[] indices = { "Índices do nome: ", "Índices do RG: " }; // Criar o código que percorra o array contendo seus dados e busque os // índices de cada item na matriz. Para percorrer uma matriz são necessários dois for. // Para percorrer duas matrizes são necessários 4 for. Console.WriteLine("Indices = "); for (int z = 0; z < dados.Length; z++) { for (int i = 0; i < dados[z].Length; i++) { for (int x = 0; x < matriz.Length; x++) { for (int y = 0; y < matriz[x].Length; y++) { if (dados[z][i] == matriz[x][y]) { Console.WriteLine(dados[z][i] + " = " + x + " - " + y); } } } } Console.WriteLine(); } Console.ReadKey(); } } }
34.413793
98
0.417836
[ "MIT" ]
CleoLeal/etec
Programacao Algoritmos/matrizes/indiceNome.cs
2,007
C#
using SubPhases; using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace GameCommands { public class PressSkipCommand : GameCommand { public PressSkipCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { } public override void Execute() { UI.SkipButtonEffect(); } } }
19.083333
129
0.663755
[ "MIT" ]
Arahain/FlyCasual
Assets/Scripts/Model/GameController/GameCommands/PressSkipCommand.cs
460
C#
using System; using XVGML.Core.Attributes; using XVGML.Basic.Types; namespace XVGML.Basic.AttributeConverters { class LocationConverter : IAttributeConverter { private SingleConverter singleConverter; public LocationConverter() { singleConverter = new SingleConverter(); } public object Convert(string value) { var values = value.Split(' '); if (values.Length == 1) { return FromOneValue(values[0]); } if (values.Length == 2) { return FromTwoValues(values); } return null; } private object FromOneValue(string value) { var converted = (Single)singleConverter.Convert(value); return new Location { Top = converted, Left = converted }; } private object FromTwoValues(string[] values) { return new Location { Top = (Single)singleConverter.Convert(values[0]), Left = (Single)singleConverter.Convert(values[1]) }; } } }
30.621622
71
0.548102
[ "MIT" ]
junk-machine/XVGML
XVGML.Basic/AttributeConverters/LocationConverter.cs
1,135
C#
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using SFA.DAS.ApprenticeCommitments.Infrastructure; using System.Linq; using System.Net.Mail; using System.Threading; using System.Threading.Tasks; namespace SFA.DAS.ApprenticeCommitments.Data.Models { public class ApprenticeCommitmentsDbContext : DbContext, IRegistrationContext, IApprenticeContext, IApprenticeshipContext, IRevisionContext { protected IEventDispatcher _dispatcher; public ApprenticeCommitmentsDbContext(DbContextOptions<ApprenticeCommitmentsDbContext> options) : this(options, new NullEventDispatcher()) { } public ApprenticeCommitmentsDbContext( DbContextOptions<ApprenticeCommitmentsDbContext> options, IEventDispatcher dispatcher) : base(options) { _dispatcher = dispatcher; } public virtual DbSet<Registration> Registrations { get; set; } = null!; public virtual DbSet<Apprentice> Apprentices { get; set; } = null!; public virtual DbSet<Apprenticeship> Apprenticeships { get; set; } = null!; public virtual DbSet<Revision> Revisions { get; set; } = null!; DbSet<Registration> IEntityContext<Registration>.Entities => Registrations; DbSet<Apprentice> IEntityContext<Apprentice>.Entities => Apprentices; DbSet<Apprenticeship> IEntityContext<Apprenticeship>.Entities => Apprenticeships; DbSet<Revision> IEntityContext<Revision>.Entities => Revisions; protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Revision>().ToTable("Revision"); modelBuilder.Entity<Apprenticeship>().ToTable("Apprenticeship"); modelBuilder.Entity<Apprentice>(a => { a.ToTable("Apprentice"); a.HasKey(e => e.Id); a.Property(e => e.Email) .HasConversion( v => v.ToString(), v => new MailAddress(v)); a.OwnsMany( e => e.PreviousEmailAddresses, c => { c.HasKey("Id"); c.Property(typeof(long), "Id"); c.HasIndex("ApprenticeId"); c.Property(e => e.EmailAddress) .HasConversion( v => v.ToString(), v => new MailAddress(v)); }); a.Property(e => e.CreatedOn).Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); a.Ignore(e => e.TermsOfUseAccepted) .Property("_termsOfUseAcceptedOn") .HasColumnName("TermsOfUseAcceptedOn"); }); modelBuilder.Entity<Revision>(a => { a.HasKey("Id"); }); modelBuilder.Entity<Revision>() .OwnsOne(e => e.Details, details => { details.Property(p => p.EmployerAccountLegalEntityId).HasColumnName("EmployerAccountLegalEntityId"); details.Property(p => p.EmployerName).HasColumnName("EmployerName"); details.Property(p => p.TrainingProviderId).HasColumnName("TrainingProviderId"); details.Property(p => p.TrainingProviderName).HasColumnName("TrainingProviderName"); details.OwnsOne(e => e.Course, course => { course.Property(p => p.Name).HasColumnName("CourseName"); course.Property(p => p.Level).HasColumnName("CourseLevel"); course.Property(p => p.Option).HasColumnName("CourseOption"); course.Property(p => p.PlannedStartDate).HasColumnName("PlannedStartDate"); course.Property(p => p.PlannedEndDate).HasColumnName("PlannedEndDate"); course.Property(p => p.CourseDuration).HasColumnName("CourseDuration"); }); }); modelBuilder.Entity<Registration>(entity => { entity.HasKey(e => e.RegistrationId); entity.Property(e => e.CreatedOn).Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); entity.Property(e => e.Email) .HasConversion( v => v.ToString(), v => new MailAddress(v)); }); modelBuilder.Entity<Registration>(entity => { entity.Property(e => e.CreatedOn).Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); entity.OwnsOne(e => e.Approval, apprenticeship => { apprenticeship.Property(p => p.EmployerAccountLegalEntityId) .HasColumnName("EmployerAccountLegalEntityId"); apprenticeship.Property(p => p.EmployerName).HasColumnName("EmployerName"); apprenticeship.Property(p => p.TrainingProviderId).HasColumnName("TrainingProviderId"); apprenticeship.Property(p => p.TrainingProviderName).HasColumnName("TrainingProviderName"); apprenticeship.OwnsOne(e => e.Course, course => { course.Property(p => p.Name).HasColumnName("CourseName"); course.Property(p => p.Level).HasColumnName("CourseLevel"); course.Property(p => p.Option).HasColumnName("CourseOption"); course.Property(p => p.PlannedStartDate).HasColumnName("PlannedStartDate"); course.Property(p => p.PlannedEndDate).HasColumnName("PlannedEndDate"); course.Property(p => p.CourseDuration).HasColumnName("CourseDuration"); }); }); }); base.OnModelCreating(modelBuilder); } public override async Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default) { var numEntriesWritten = await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken); await DispatchDomainEvents(); return numEntriesWritten; } private async Task DispatchDomainEvents() { var events = ChangeTracker.Entries<Entity>() .SelectMany(x => x.Entity.DomainEvents) .ToArray(); foreach (var domainEvent in events) await _dispatcher.Dispatch(domainEvent); } } }
47.314685
135
0.569465
[ "MIT" ]
SkillsFundingAgency/das-apprentice-commitments-api
src/SFA.DAS.ApprenticeCommitments/Data/Models/ApprenticeCommitmentsDbContext.cs
6,766
C#
using Microsoft.Extensions.Options; using SharpRepository.Benchmarks.Configuration.Models; using SharpRepository.InMemoryRepository; using SharpRepository.Repository; using SharpRepository.Repository.Configuration; namespace SharpRepository.Benchmarks.Configuration.Repositories { public interface IUserRepository : IRepository<User, int> { User GetAdminUser(); } public class UserFromConfigRepository : ConfigurationBasedRepository<User, int>, IUserRepository { public UserFromConfigRepository(ISharpRepositoryConfiguration configuration, string repositoryName = null) : base(configuration, repositoryName) { } public User GetAdminUser() { return Find(x => x.Email == "admin@admin.com"); } } public class UserRepository : InMemoryRepository<User, int>, IUserRepository { public User GetAdminUser() { return Find(x => x.Email == "admin@admin.com"); } } }
29.411765
152
0.695
[ "Apache-2.0" ]
Magicianred/SharpRepository
SharpRepository.Benchmarks.Configuration/Repositories/UserRepository.cs
1,002
C#
// This file is auto-generated, don't edit it. Thanks. using System; using System.Collections.Generic; using System.IO; using Tea; namespace AlibabaCloud.SDK.Ram20150501.Models { public class CreateLoginProfileRequest : TeaModel { [NameInMap("UserName")] [Validation(Required=false)] public string UserName { get; set; } [NameInMap("Password")] [Validation(Required=false)] public string Password { get; set; } [NameInMap("PasswordResetRequired")] [Validation(Required=false)] public bool? PasswordResetRequired { get; set; } [NameInMap("MFABindRequired")] [Validation(Required=false)] public bool? MFABindRequired { get; set; } } }
24.032258
56
0.651007
[ "Apache-2.0" ]
atptro/alibabacloud-sdk
ram-20150501/csharp/core/Models/CreateLoginProfileRequest.cs
745
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; using Watchdog.Web.Areas.Identity.Data; namespace Watchdog.Web.Areas.Identity.Pages.Account.Manage { public class GenerateRecoveryCodesModel : PageModel { private readonly UserManager<WatchdogUser> _userManager; private readonly ILogger<GenerateRecoveryCodesModel> _logger; public GenerateRecoveryCodesModel( UserManager<WatchdogUser> userManager, ILogger<GenerateRecoveryCodesModel> logger) { _userManager = userManager; _logger = logger; } [TempData] public string[] RecoveryCodes { get; set; } [TempData] public string StatusMessage { get; set; } public async Task<IActionResult> OnGetAsync() { var user = await _userManager.GetUserAsync(User); if (user == null) { return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } var isTwoFactorEnabled = await _userManager.GetTwoFactorEnabledAsync(user); if (!isTwoFactorEnabled) { var userId = await _userManager.GetUserIdAsync(user); throw new InvalidOperationException($"Cannot generate recovery codes for user with ID '{userId}' because they do not have 2FA enabled."); } return Page(); } public async Task<IActionResult> OnPostAsync() { var user = await _userManager.GetUserAsync(User); if (user == null) { return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } var isTwoFactorEnabled = await _userManager.GetTwoFactorEnabledAsync(user); var userId = await _userManager.GetUserIdAsync(user); if (!isTwoFactorEnabled) { throw new InvalidOperationException($"Cannot generate recovery codes for user with ID '{userId}' as they do not have 2FA enabled."); } var recoveryCodes = await _userManager.GenerateNewTwoFactorRecoveryCodesAsync(user, 10); RecoveryCodes = recoveryCodes.ToArray(); _logger.LogInformation("User with ID '{UserId}' has generated new 2FA recovery codes.", userId); StatusMessage = "You have generated new recovery codes."; return RedirectToPage("./ShowRecoveryCodes"); } } }
36.876712
153
0.634844
[ "MIT" ]
kiapanahi/watchdog
src/web/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs
2,694
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ActorWordCounter.Messages { public class Complete { public static Complete Instance { get; } = new Complete(); } }
20.153846
66
0.721374
[ "MIT" ]
rikace/parallel-patterns
src/ActorWordCounter/ActorWordCounter/Messages/Complete.cs
264
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace ElGuerre.Microservices.Billing.Api.Domain { public class OrderEntity { public int Id { get; set; } public string Name { get; set; } } }
18
51
0.742063
[ "MIT" ]
juanluelguerre/Microservices
src/ElGuerre.Microservices.Billing.Api/Domain/OrderEntity.cs
254
C#
using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; using System.Linq; using ILRuntime.CLR.TypeSystem; using ILRuntime.CLR.Method; using ILRuntime.Runtime.Enviorment; using ILRuntime.Runtime.Intepreter; using ILRuntime.Runtime.Stack; using ILRuntime.Reflection; using ILRuntime.CLR.Utils; namespace ILRuntime.Runtime.Generated { unsafe class FairyGUI_GObject_Binding { public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) { BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; MethodBase method; FieldInfo field; Type[] args; Type type = typeof(FairyGUI.GObject); args = new Type[]{}; method = type.GetMethod("get_id", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_id_0); args = new Type[]{}; method = type.GetMethod("get_relations", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_relations_1); args = new Type[]{}; method = type.GetMethod("get_parent", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_parent_2); args = new Type[]{}; method = type.GetMethod("get_displayObject", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_displayObject_3); args = new Type[]{}; method = type.GetMethod("get_draggingObject", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_draggingObject_4); args = new Type[]{}; method = type.GetMethod("get_onClick", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onClick_5); args = new Type[]{}; method = type.GetMethod("get_onRightClick", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onRightClick_6); args = new Type[]{}; method = type.GetMethod("get_onTouchBegin", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onTouchBegin_7); args = new Type[]{}; method = type.GetMethod("get_onTouchMove", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onTouchMove_8); args = new Type[]{}; method = type.GetMethod("get_onTouchEnd", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onTouchEnd_9); args = new Type[]{}; method = type.GetMethod("get_onRollOver", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onRollOver_10); args = new Type[]{}; method = type.GetMethod("get_onRollOut", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onRollOut_11); args = new Type[]{}; method = type.GetMethod("get_onAddedToStage", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onAddedToStage_12); args = new Type[]{}; method = type.GetMethod("get_onRemovedFromStage", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onRemovedFromStage_13); args = new Type[]{}; method = type.GetMethod("get_onKeyDown", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onKeyDown_14); args = new Type[]{}; method = type.GetMethod("get_onClickLink", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onClickLink_15); args = new Type[]{}; method = type.GetMethod("get_onPositionChanged", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onPositionChanged_16); args = new Type[]{}; method = type.GetMethod("get_onSizeChanged", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onSizeChanged_17); args = new Type[]{}; method = type.GetMethod("get_onDragStart", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onDragStart_18); args = new Type[]{}; method = type.GetMethod("get_onDragMove", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onDragMove_19); args = new Type[]{}; method = type.GetMethod("get_onDragEnd", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onDragEnd_20); args = new Type[]{}; method = type.GetMethod("get_onGearStop", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onGearStop_21); args = new Type[]{}; method = type.GetMethod("get_x", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_x_22); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_x", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_x_23); args = new Type[]{}; method = type.GetMethod("get_y", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_y_24); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_y", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_y_25); args = new Type[]{}; method = type.GetMethod("get_z", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_z_26); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_z", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_z_27); args = new Type[]{}; method = type.GetMethod("get_xy", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_xy_28); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("set_xy", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_xy_29); args = new Type[]{}; method = type.GetMethod("get_position", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_position_30); args = new Type[]{typeof(UnityEngine.Vector3)}; method = type.GetMethod("set_position", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_position_31); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("SetXY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetXY_32); args = new Type[]{typeof(System.Single), typeof(System.Single), typeof(System.Boolean)}; method = type.GetMethod("SetXY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetXY_33); args = new Type[]{typeof(System.Single), typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("SetPosition", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetPosition_34); args = new Type[]{}; method = type.GetMethod("get_pixelSnapping", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_pixelSnapping_35); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_pixelSnapping", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_pixelSnapping_36); args = new Type[]{}; method = type.GetMethod("Center", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Center_37); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("Center", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Center_38); args = new Type[]{}; method = type.GetMethod("MakeFullScreen", flag, null, args, null); app.RegisterCLRMethodRedirection(method, MakeFullScreen_39); args = new Type[]{}; method = type.GetMethod("get_width", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_width_40); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_width", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_width_41); args = new Type[]{}; method = type.GetMethod("get_height", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_height_42); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_height", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_height_43); args = new Type[]{}; method = type.GetMethod("get_size", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_size_44); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("set_size", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_size_45); args = new Type[]{}; method = type.GetMethod("get_actualWidth", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_actualWidth_46); args = new Type[]{}; method = type.GetMethod("get_actualHeight", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_actualHeight_47); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("SetSize", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetSize_48); args = new Type[]{typeof(System.Single), typeof(System.Single), typeof(System.Boolean)}; method = type.GetMethod("SetSize", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetSize_49); args = new Type[]{}; method = type.GetMethod("get_xMin", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_xMin_50); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_xMin", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_xMin_51); args = new Type[]{}; method = type.GetMethod("get_yMin", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_yMin_52); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_yMin", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_yMin_53); args = new Type[]{}; method = type.GetMethod("get_scaleX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_scaleX_54); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_scaleX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_scaleX_55); args = new Type[]{}; method = type.GetMethod("get_scaleY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_scaleY_56); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_scaleY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_scaleY_57); args = new Type[]{}; method = type.GetMethod("get_scale", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_scale_58); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("set_scale", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_scale_59); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("SetScale", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetScale_60); args = new Type[]{}; method = type.GetMethod("get_skew", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_skew_61); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("set_skew", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_skew_62); args = new Type[]{}; method = type.GetMethod("get_pivotX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_pivotX_63); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_pivotX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_pivotX_64); args = new Type[]{}; method = type.GetMethod("get_pivotY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_pivotY_65); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_pivotY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_pivotY_66); args = new Type[]{}; method = type.GetMethod("get_pivot", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_pivot_67); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("set_pivot", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_pivot_68); args = new Type[]{}; method = type.GetMethod("get_pivotAsAnchor", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_pivotAsAnchor_69); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_pivotAsAnchor", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_pivotAsAnchor_70); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("SetPivot", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetPivot_71); args = new Type[]{typeof(System.Single), typeof(System.Single), typeof(System.Boolean)}; method = type.GetMethod("SetPivot", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetPivot_72); args = new Type[]{}; method = type.GetMethod("get_touchable", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_touchable_73); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_touchable", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_touchable_74); args = new Type[]{}; method = type.GetMethod("get_grayed", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_grayed_75); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_grayed", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_grayed_76); args = new Type[]{}; method = type.GetMethod("get_enabled", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_enabled_77); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_enabled", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_enabled_78); args = new Type[]{}; method = type.GetMethod("get_rotation", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_rotation_79); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_rotation", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_rotation_80); args = new Type[]{}; method = type.GetMethod("get_rotationX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_rotationX_81); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_rotationX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_rotationX_82); args = new Type[]{}; method = type.GetMethod("get_rotationY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_rotationY_83); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_rotationY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_rotationY_84); args = new Type[]{}; method = type.GetMethod("get_alpha", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_alpha_85); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("set_alpha", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_alpha_86); args = new Type[]{}; method = type.GetMethod("get_visible", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_visible_87); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_visible", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_visible_88); args = new Type[]{}; method = type.GetMethod("get_sortingOrder", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_sortingOrder_89); args = new Type[]{typeof(System.Int32)}; method = type.GetMethod("set_sortingOrder", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_sortingOrder_90); args = new Type[]{}; method = type.GetMethod("get_focusable", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_focusable_91); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_focusable", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_focusable_92); args = new Type[]{}; method = type.GetMethod("get_focused", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_focused_93); args = new Type[]{}; method = type.GetMethod("RequestFocus", flag, null, args, null); app.RegisterCLRMethodRedirection(method, RequestFocus_94); args = new Type[]{}; method = type.GetMethod("get_tooltips", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_tooltips_95); args = new Type[]{typeof(System.String)}; method = type.GetMethod("set_tooltips", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_tooltips_96); args = new Type[]{}; method = type.GetMethod("get_filter", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_filter_97); args = new Type[]{typeof(FairyGUI.IFilter)}; method = type.GetMethod("set_filter", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_filter_98); args = new Type[]{}; method = type.GetMethod("get_blendMode", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_blendMode_99); args = new Type[]{typeof(FairyGUI.BlendMode)}; method = type.GetMethod("set_blendMode", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_blendMode_100); args = new Type[]{}; method = type.GetMethod("get_gameObjectName", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_gameObjectName_101); args = new Type[]{typeof(System.String)}; method = type.GetMethod("set_gameObjectName", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_gameObjectName_102); args = new Type[]{typeof(FairyGUI.GObject)}; method = type.GetMethod("SetHome", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetHome_103); args = new Type[]{}; method = type.GetMethod("get_inContainer", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_inContainer_104); args = new Type[]{}; method = type.GetMethod("get_onStage", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_onStage_105); args = new Type[]{}; method = type.GetMethod("get_resourceURL", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_resourceURL_106); args = new Type[]{}; method = type.GetMethod("get_gearXY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_gearXY_107); args = new Type[]{}; method = type.GetMethod("get_gearSize", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_gearSize_108); args = new Type[]{}; method = type.GetMethod("get_gearLook", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_gearLook_109); args = new Type[]{typeof(System.Int32)}; method = type.GetMethod("GetGear", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GetGear_110); args = new Type[]{}; method = type.GetMethod("InvalidateBatchingState", flag, null, args, null); app.RegisterCLRMethodRedirection(method, InvalidateBatchingState_111); args = new Type[]{typeof(FairyGUI.Controller)}; method = type.GetMethod("HandleControllerChanged", flag, null, args, null); app.RegisterCLRMethodRedirection(method, HandleControllerChanged_112); args = new Type[]{typeof(FairyGUI.GObject), typeof(FairyGUI.RelationType)}; method = type.GetMethod("AddRelation", flag, null, args, null); app.RegisterCLRMethodRedirection(method, AddRelation_113); args = new Type[]{typeof(FairyGUI.GObject), typeof(FairyGUI.RelationType), typeof(System.Boolean)}; method = type.GetMethod("AddRelation", flag, null, args, null); app.RegisterCLRMethodRedirection(method, AddRelation_114); args = new Type[]{typeof(FairyGUI.GObject), typeof(FairyGUI.RelationType)}; method = type.GetMethod("RemoveRelation", flag, null, args, null); app.RegisterCLRMethodRedirection(method, RemoveRelation_115); args = new Type[]{}; method = type.GetMethod("RemoveFromParent", flag, null, args, null); app.RegisterCLRMethodRedirection(method, RemoveFromParent_116); args = new Type[]{}; method = type.GetMethod("get_group", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_group_117); args = new Type[]{typeof(FairyGUI.GGroup)}; method = type.GetMethod("set_group", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_group_118); args = new Type[]{}; method = type.GetMethod("get_root", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_root_119); args = new Type[]{}; method = type.GetMethod("get_text", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_text_120); args = new Type[]{typeof(System.String)}; method = type.GetMethod("set_text", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_text_121); args = new Type[]{}; method = type.GetMethod("get_icon", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_icon_122); args = new Type[]{typeof(System.String)}; method = type.GetMethod("set_icon", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_icon_123); args = new Type[]{}; method = type.GetMethod("get_draggable", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_draggable_124); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_draggable", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_draggable_125); args = new Type[]{}; method = type.GetMethod("StartDrag", flag, null, args, null); app.RegisterCLRMethodRedirection(method, StartDrag_126); args = new Type[]{typeof(System.Int32)}; method = type.GetMethod("StartDrag", flag, null, args, null); app.RegisterCLRMethodRedirection(method, StartDrag_127); args = new Type[]{}; method = type.GetMethod("StopDrag", flag, null, args, null); app.RegisterCLRMethodRedirection(method, StopDrag_128); args = new Type[]{}; method = type.GetMethod("get_dragging", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_dragging_129); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("LocalToGlobal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, LocalToGlobal_130); args = new Type[]{typeof(UnityEngine.Vector2)}; method = type.GetMethod("GlobalToLocal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GlobalToLocal_131); args = new Type[]{typeof(UnityEngine.Rect)}; method = type.GetMethod("LocalToGlobal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, LocalToGlobal_132); args = new Type[]{typeof(UnityEngine.Rect)}; method = type.GetMethod("GlobalToLocal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GlobalToLocal_133); args = new Type[]{typeof(UnityEngine.Vector2), typeof(FairyGUI.GRoot)}; method = type.GetMethod("LocalToRoot", flag, null, args, null); app.RegisterCLRMethodRedirection(method, LocalToRoot_134); args = new Type[]{typeof(UnityEngine.Vector2), typeof(FairyGUI.GRoot)}; method = type.GetMethod("RootToLocal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, RootToLocal_135); args = new Type[]{typeof(UnityEngine.Vector3)}; method = type.GetMethod("WorldToLocal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, WorldToLocal_136); args = new Type[]{typeof(UnityEngine.Vector3), typeof(UnityEngine.Camera)}; method = type.GetMethod("WorldToLocal", flag, null, args, null); app.RegisterCLRMethodRedirection(method, WorldToLocal_137); args = new Type[]{typeof(UnityEngine.Vector2), typeof(FairyGUI.GObject)}; method = type.GetMethod("TransformPoint", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TransformPoint_138); args = new Type[]{typeof(UnityEngine.Rect), typeof(FairyGUI.GObject)}; method = type.GetMethod("TransformRect", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TransformRect_139); args = new Type[]{}; method = type.GetMethod("get_isDisposed", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_isDisposed_140); args = new Type[]{}; method = type.GetMethod("Dispose", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Dispose_141); args = new Type[]{}; method = type.GetMethod("get_asImage", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asImage_142); args = new Type[]{}; method = type.GetMethod("get_asCom", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asCom_143); args = new Type[]{}; method = type.GetMethod("get_asButton", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asButton_144); args = new Type[]{}; method = type.GetMethod("get_asLabel", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asLabel_145); args = new Type[]{}; method = type.GetMethod("get_asProgress", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asProgress_146); args = new Type[]{}; method = type.GetMethod("get_asSlider", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asSlider_147); args = new Type[]{}; method = type.GetMethod("get_asComboBox", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asComboBox_148); args = new Type[]{}; method = type.GetMethod("get_asTextField", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asTextField_149); args = new Type[]{}; method = type.GetMethod("get_asRichTextField", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asRichTextField_150); args = new Type[]{}; method = type.GetMethod("get_asTextInput", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asTextInput_151); args = new Type[]{}; method = type.GetMethod("get_asLoader", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asLoader_152); args = new Type[]{}; method = type.GetMethod("get_asList", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asList_153); args = new Type[]{}; method = type.GetMethod("get_asGraph", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asGraph_154); args = new Type[]{}; method = type.GetMethod("get_asGroup", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asGroup_155); args = new Type[]{}; method = type.GetMethod("get_asMovieClip", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_asMovieClip_156); args = new Type[]{}; method = type.GetMethod("ConstructFromResource", flag, null, args, null); app.RegisterCLRMethodRedirection(method, ConstructFromResource_157); args = new Type[]{typeof(FairyGUI.Utils.ByteBuffer), typeof(System.Int32)}; method = type.GetMethod("Setup_BeforeAdd", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Setup_BeforeAdd_158); args = new Type[]{typeof(FairyGUI.Utils.ByteBuffer), typeof(System.Int32)}; method = type.GetMethod("Setup_AfterAdd", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Setup_AfterAdd_159); args = new Type[]{typeof(UnityEngine.Vector2), typeof(System.Single)}; method = type.GetMethod("TweenMove", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenMove_160); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("TweenMoveX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenMoveX_161); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("TweenMoveY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenMoveY_162); args = new Type[]{typeof(UnityEngine.Vector2), typeof(System.Single)}; method = type.GetMethod("TweenScale", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenScale_163); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("TweenScaleX", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenScaleX_164); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("TweenScaleY", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenScaleY_165); args = new Type[]{typeof(UnityEngine.Vector2), typeof(System.Single)}; method = type.GetMethod("TweenResize", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenResize_166); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("TweenFade", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenFade_167); args = new Type[]{typeof(System.Single), typeof(System.Single)}; method = type.GetMethod("TweenRotate", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TweenRotate_168); field = type.GetField("name", flag); app.RegisterCLRFieldGetter(field, get_name_0); app.RegisterCLRFieldSetter(field, set_name_0); field = type.GetField("data", flag); app.RegisterCLRFieldGetter(field, get_data_1); app.RegisterCLRFieldSetter(field, set_data_1); field = type.GetField("sourceWidth", flag); app.RegisterCLRFieldGetter(field, get_sourceWidth_2); app.RegisterCLRFieldSetter(field, set_sourceWidth_2); field = type.GetField("sourceHeight", flag); app.RegisterCLRFieldGetter(field, get_sourceHeight_3); app.RegisterCLRFieldSetter(field, set_sourceHeight_3); field = type.GetField("initWidth", flag); app.RegisterCLRFieldGetter(field, get_initWidth_4); app.RegisterCLRFieldSetter(field, set_initWidth_4); field = type.GetField("initHeight", flag); app.RegisterCLRFieldGetter(field, get_initHeight_5); app.RegisterCLRFieldSetter(field, set_initHeight_5); field = type.GetField("minWidth", flag); app.RegisterCLRFieldGetter(field, get_minWidth_6); app.RegisterCLRFieldSetter(field, set_minWidth_6); field = type.GetField("maxWidth", flag); app.RegisterCLRFieldGetter(field, get_maxWidth_7); app.RegisterCLRFieldSetter(field, set_maxWidth_7); field = type.GetField("minHeight", flag); app.RegisterCLRFieldGetter(field, get_minHeight_8); app.RegisterCLRFieldSetter(field, set_minHeight_8); field = type.GetField("maxHeight", flag); app.RegisterCLRFieldGetter(field, get_maxHeight_9); app.RegisterCLRFieldSetter(field, set_maxHeight_9); field = type.GetField("dragBounds", flag); app.RegisterCLRFieldGetter(field, get_dragBounds_10); app.RegisterCLRFieldSetter(field, set_dragBounds_10); field = type.GetField("packageItem", flag); app.RegisterCLRFieldGetter(field, get_packageItem_11); app.RegisterCLRFieldSetter(field, set_packageItem_11); app.RegisterCLRCreateDefaultInstance(type, () => new FairyGUI.GObject()); app.RegisterCLRCreateArrayInstance(type, s => new FairyGUI.GObject[s]); args = new Type[]{}; method = type.GetConstructor(flag, null, args, null); app.RegisterCLRMethodRedirection(method, Ctor_0); } static StackObject* get_id_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.id; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_relations_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.relations; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_parent_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.parent; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_displayObject_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.displayObject; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_draggingObject_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* __ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = FairyGUI.GObject.draggingObject; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onClick_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onClick; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onRightClick_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onRightClick; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onTouchBegin_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onTouchBegin; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onTouchMove_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onTouchMove; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onTouchEnd_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onTouchEnd; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onRollOver_10(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onRollOver; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onRollOut_11(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onRollOut; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onAddedToStage_12(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onAddedToStage; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onRemovedFromStage_13(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onRemovedFromStage; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onKeyDown_14(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onKeyDown; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onClickLink_15(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onClickLink; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onPositionChanged_16(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onPositionChanged; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onSizeChanged_17(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onSizeChanged; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onDragStart_18(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onDragStart; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onDragMove_19(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onDragMove; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onDragEnd_20(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onDragEnd; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_onGearStop_21(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onGearStop; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_x_22(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.x; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_x_23(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.x = value; return __ret; } static StackObject* get_y_24(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.y; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_y_25(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.y = value; return __ret; } static StackObject* get_z_26(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.z; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_z_27(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.z = value; return __ret; } static StackObject* get_xy_28(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.xy; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_xy_29(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @value = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.xy = value; return __ret; } static StackObject* get_position_30(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.position; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_position_31(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector3 @value = (UnityEngine.Vector3)typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.position = value; return __ret; } static StackObject* SetXY_32(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @yv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @xv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetXY(@xv, @yv); return __ret; } static StackObject* SetXY_33(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @topLeftValue = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @yv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Single @xv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 4); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetXY(@xv, @yv, @topLeftValue); return __ret; } static StackObject* SetPosition_34(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @zv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @yv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Single @xv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 4); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetPosition(@xv, @yv, @zv); return __ret; } static StackObject* get_pixelSnapping_35(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.pixelSnapping; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_pixelSnapping_36(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.pixelSnapping = value; return __ret; } static StackObject* Center_37(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Center(); return __ret; } static StackObject* Center_38(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @restraint = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Center(@restraint); return __ret; } static StackObject* MakeFullScreen_39(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.MakeFullScreen(); return __ret; } static StackObject* get_width_40(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.width; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_width_41(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.width = value; return __ret; } static StackObject* get_height_42(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.height; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_height_43(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.height = value; return __ret; } static StackObject* get_size_44(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.size; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_size_45(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @value = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.size = value; return __ret; } static StackObject* get_actualWidth_46(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.actualWidth; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* get_actualHeight_47(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.actualHeight; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* SetSize_48(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @hv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @wv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetSize(@wv, @hv); return __ret; } static StackObject* SetSize_49(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @ignorePivot = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @hv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Single @wv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 4); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetSize(@wv, @hv, @ignorePivot); return __ret; } static StackObject* get_xMin_50(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.xMin; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_xMin_51(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.xMin = value; return __ret; } static StackObject* get_yMin_52(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.yMin; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_yMin_53(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.yMin = value; return __ret; } static StackObject* get_scaleX_54(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.scaleX; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_scaleX_55(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.scaleX = value; return __ret; } static StackObject* get_scaleY_56(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.scaleY; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_scaleY_57(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.scaleY = value; return __ret; } static StackObject* get_scale_58(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.scale; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_scale_59(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @value = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.scale = value; return __ret; } static StackObject* SetScale_60(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @hv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @wv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetScale(@wv, @hv); return __ret; } static StackObject* get_skew_61(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.skew; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_skew_62(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @value = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.skew = value; return __ret; } static StackObject* get_pivotX_63(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.pivotX; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_pivotX_64(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.pivotX = value; return __ret; } static StackObject* get_pivotY_65(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.pivotY; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_pivotY_66(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.pivotY = value; return __ret; } static StackObject* get_pivot_67(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.pivot; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_pivot_68(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @value = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.pivot = value; return __ret; } static StackObject* get_pivotAsAnchor_69(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.pivotAsAnchor; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_pivotAsAnchor_70(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.pivotAsAnchor = value; return __ret; } static StackObject* SetPivot_71(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @yv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @xv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetPivot(@xv, @yv); return __ret; } static StackObject* SetPivot_72(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @asAnchor = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @yv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Single @xv = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 4); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetPivot(@xv, @yv, @asAnchor); return __ret; } static StackObject* get_touchable_73(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.touchable; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_touchable_74(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.touchable = value; return __ret; } static StackObject* get_grayed_75(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.grayed; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_grayed_76(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.grayed = value; return __ret; } static StackObject* get_enabled_77(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.enabled; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_enabled_78(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.enabled = value; return __ret; } static StackObject* get_rotation_79(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.rotation; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_rotation_80(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.rotation = value; return __ret; } static StackObject* get_rotationX_81(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.rotationX; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_rotationX_82(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.rotationX = value; return __ret; } static StackObject* get_rotationY_83(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.rotationY; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_rotationY_84(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.rotationY = value; return __ret; } static StackObject* get_alpha_85(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.alpha; __ret->ObjectType = ObjectTypes.Float; *(float*)&__ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_alpha_86(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.alpha = value; return __ret; } static StackObject* get_visible_87(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.visible; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_visible_88(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.visible = value; return __ret; } static StackObject* get_sortingOrder_89(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.sortingOrder; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return __ret + 1; } static StackObject* set_sortingOrder_90(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @value = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.sortingOrder = value; return __ret; } static StackObject* get_focusable_91(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.focusable; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_focusable_92(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.focusable = value; return __ret; } static StackObject* get_focused_93(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.focused; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* RequestFocus_94(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.RequestFocus(); return __ret; } static StackObject* get_tooltips_95(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.tooltips; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_tooltips_96(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @value = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.tooltips = value; return __ret; } static StackObject* get_filter_97(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.filter; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_filter_98(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.IFilter @value = (FairyGUI.IFilter)typeof(FairyGUI.IFilter).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.filter = value; return __ret; } static StackObject* get_blendMode_99(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.blendMode; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_blendMode_100(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.BlendMode @value = (FairyGUI.BlendMode)typeof(FairyGUI.BlendMode).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.blendMode = value; return __ret; } static StackObject* get_gameObjectName_101(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.gameObjectName; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_gameObjectName_102(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @value = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.gameObjectName = value; return __ret; } static StackObject* SetHome_103(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject @obj = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetHome(@obj); return __ret; } static StackObject* get_inContainer_104(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.inContainer; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* get_onStage_105(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.onStage; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* get_resourceURL_106(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.resourceURL; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_gearXY_107(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.gearXY; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_gearSize_108(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.gearSize; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_gearLook_109(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.gearLook; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* GetGear_110(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @index = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.GetGear(@index); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* InvalidateBatchingState_111(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.InvalidateBatchingState(); return __ret; } static StackObject* HandleControllerChanged_112(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.Controller @c = (FairyGUI.Controller)typeof(FairyGUI.Controller).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.HandleControllerChanged(@c); return __ret; } static StackObject* AddRelation_113(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.RelationType @relationType = (FairyGUI.RelationType)typeof(FairyGUI.RelationType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject @target = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.AddRelation(@target, @relationType); return __ret; } static StackObject* AddRelation_114(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @usePercent = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.RelationType @relationType = (FairyGUI.RelationType)typeof(FairyGUI.RelationType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject @target = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 4); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.AddRelation(@target, @relationType, @usePercent); return __ret; } static StackObject* RemoveRelation_115(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.RelationType @relationType = (FairyGUI.RelationType)typeof(FairyGUI.RelationType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject @target = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.RemoveRelation(@target, @relationType); return __ret; } static StackObject* RemoveFromParent_116(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.RemoveFromParent(); return __ret; } static StackObject* get_group_117(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.group; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_group_118(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GGroup @value = (FairyGUI.GGroup)typeof(FairyGUI.GGroup).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.group = value; return __ret; } static StackObject* get_root_119(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.root; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_text_120(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.text; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_text_121(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @value = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.text = value; return __ret; } static StackObject* get_icon_122(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.icon; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* set_icon_123(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @value = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.icon = value; return __ret; } static StackObject* get_draggable_124(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.draggable; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_draggable_125(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.draggable = value; return __ret; } static StackObject* StartDrag_126(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.StartDrag(); return __ret; } static StackObject* StartDrag_127(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @touchId = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.StartDrag(@touchId); return __ret; } static StackObject* StopDrag_128(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.StopDrag(); return __ret; } static StackObject* get_dragging_129(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.dragging; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* LocalToGlobal_130(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @pt = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.LocalToGlobal(@pt); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* GlobalToLocal_131(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector2 @pt = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.GlobalToLocal(@pt); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* LocalToGlobal_132(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Rect @rect = (UnityEngine.Rect)typeof(UnityEngine.Rect).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.LocalToGlobal(@rect); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* GlobalToLocal_133(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Rect @rect = (UnityEngine.Rect)typeof(UnityEngine.Rect).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.GlobalToLocal(@rect); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* LocalToRoot_134(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GRoot @r = (FairyGUI.GRoot)typeof(FairyGUI.GRoot).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @pt = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.LocalToRoot(@pt, @r); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* RootToLocal_135(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GRoot @r = (FairyGUI.GRoot)typeof(FairyGUI.GRoot).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @pt = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.RootToLocal(@pt, @r); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* WorldToLocal_136(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Vector3 @pt = (UnityEngine.Vector3)typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.WorldToLocal(@pt); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* WorldToLocal_137(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Camera @camera = (UnityEngine.Camera)typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector3 @pt = (UnityEngine.Vector3)typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.WorldToLocal(@pt, @camera); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TransformPoint_138(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject @targetSpace = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @pt = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TransformPoint(@pt, @targetSpace); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TransformRect_139(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject @targetSpace = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Rect @rect = (UnityEngine.Rect)typeof(UnityEngine.Rect).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TransformRect(@rect, @targetSpace); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_isDisposed_140(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.isDisposed; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* Dispose_141(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Dispose(); return __ret; } static StackObject* get_asImage_142(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asImage; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asCom_143(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asCom; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asButton_144(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asButton; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asLabel_145(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asLabel; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asProgress_146(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asProgress; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asSlider_147(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asSlider; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asComboBox_148(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asComboBox; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asTextField_149(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asTextField; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asRichTextField_150(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asRichTextField; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asTextInput_151(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asTextInput; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asLoader_152(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asLoader; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asList_153(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asList; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asGraph_154(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asGraph; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asGroup_155(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asGroup; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_asMovieClip_156(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.asMovieClip; object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* ConstructFromResource_157(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.ConstructFromResource(); return __ret; } static StackObject* Setup_BeforeAdd_158(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @beginPos = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.Utils.ByteBuffer @buffer = (FairyGUI.Utils.ByteBuffer)typeof(FairyGUI.Utils.ByteBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Setup_BeforeAdd(@buffer, @beginPos); return __ret; } static StackObject* Setup_AfterAdd_159(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @beginPos = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); FairyGUI.Utils.ByteBuffer @buffer = (FairyGUI.Utils.ByteBuffer)typeof(FairyGUI.Utils.ByteBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Setup_AfterAdd(@buffer, @beginPos); return __ret; } static StackObject* TweenMove_160(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @endValue = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenMove(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenMoveX_161(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @endValue = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenMoveX(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenMoveY_162(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @endValue = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenMoveY(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenScale_163(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @endValue = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenScale(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenScaleX_164(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @endValue = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenScaleX(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenScaleY_165(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @endValue = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenScaleY(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenResize_166(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @endValue = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenResize(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenFade_167(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @endValue = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenFade(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* TweenRotate_168(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @duration = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Single @endValue = *(float*)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); FairyGUI.GObject instance_of_this_method = (FairyGUI.GObject)typeof(FairyGUI.GObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TweenRotate(@endValue, @duration); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static object get_name_0(ref object o) { return ((FairyGUI.GObject)o).name; } static void set_name_0(ref object o, object v) { ((FairyGUI.GObject)o).name = (System.String)v; } static object get_data_1(ref object o) { return ((FairyGUI.GObject)o).data; } static void set_data_1(ref object o, object v) { ((FairyGUI.GObject)o).data = (System.Object)v; } static object get_sourceWidth_2(ref object o) { return ((FairyGUI.GObject)o).sourceWidth; } static void set_sourceWidth_2(ref object o, object v) { ((FairyGUI.GObject)o).sourceWidth = (System.Int32)v; } static object get_sourceHeight_3(ref object o) { return ((FairyGUI.GObject)o).sourceHeight; } static void set_sourceHeight_3(ref object o, object v) { ((FairyGUI.GObject)o).sourceHeight = (System.Int32)v; } static object get_initWidth_4(ref object o) { return ((FairyGUI.GObject)o).initWidth; } static void set_initWidth_4(ref object o, object v) { ((FairyGUI.GObject)o).initWidth = (System.Int32)v; } static object get_initHeight_5(ref object o) { return ((FairyGUI.GObject)o).initHeight; } static void set_initHeight_5(ref object o, object v) { ((FairyGUI.GObject)o).initHeight = (System.Int32)v; } static object get_minWidth_6(ref object o) { return ((FairyGUI.GObject)o).minWidth; } static void set_minWidth_6(ref object o, object v) { ((FairyGUI.GObject)o).minWidth = (System.Int32)v; } static object get_maxWidth_7(ref object o) { return ((FairyGUI.GObject)o).maxWidth; } static void set_maxWidth_7(ref object o, object v) { ((FairyGUI.GObject)o).maxWidth = (System.Int32)v; } static object get_minHeight_8(ref object o) { return ((FairyGUI.GObject)o).minHeight; } static void set_minHeight_8(ref object o, object v) { ((FairyGUI.GObject)o).minHeight = (System.Int32)v; } static object get_maxHeight_9(ref object o) { return ((FairyGUI.GObject)o).maxHeight; } static void set_maxHeight_9(ref object o, object v) { ((FairyGUI.GObject)o).maxHeight = (System.Int32)v; } static object get_dragBounds_10(ref object o) { return ((FairyGUI.GObject)o).dragBounds; } static void set_dragBounds_10(ref object o, object v) { ((FairyGUI.GObject)o).dragBounds = (System.Nullable<UnityEngine.Rect>)v; } static object get_packageItem_11(ref object o) { return ((FairyGUI.GObject)o).packageItem; } static void set_packageItem_11(ref object o, object v) { ((FairyGUI.GObject)o).packageItem = (FairyGUI.PackageItem)v; } static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* __ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = new FairyGUI.GObject(); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } } }
53.077337
185
0.679939
[ "MIT" ]
BOBO41/CasinosClient
Assets/Script.ILRuntimeGenerated/FairyGUI_GObject_Binding.cs
207,267
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.EntityFrameworkCore { public abstract class FixtureBase { protected virtual IServiceCollection AddServices(IServiceCollection serviceCollection) => serviceCollection.AddSingleton(TestModelSource.GetFactory(OnModelCreating)); public virtual DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => builder .EnableSensitiveDataLogging() .ConfigureWarnings( b => b.Default(WarningBehavior.Throw) .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning)); protected virtual bool CanExecuteQueryString => false; protected virtual void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { } } }
38.645161
111
0.717028
[ "Apache-2.0" ]
1iveowl/efcore
test/EFCore.Specification.Tests/FixtureBase.cs
1,198
C#
#region License // Copyright (c) 2021 Peter Šulek / ScaleHQ Solutions s.r.o. // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #endregion using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Localization HQ")] [assembly: AssemblyProduct("VsExtension")] [assembly: AssemblyCompany("ScaleHQ Solutions")] [assembly: AssemblyCopyright("Copyright (c) 2021 ScaleHQ Solutions, s.r.o.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", Justification = "AssemblyInformationalVersion does not need to be a parsable version")] [assembly: AssemblyVersion("2022.2")]
43.931818
219
0.770305
[ "MIT" ]
psulek/lhqeditor
src/VsExtension/Properties/AssemblyInfo.cs
1,936
C#
using System; namespace DestroyNobots.Assembler.Emulator.Registers { public class Register<T> : IRegister where T : IConvertible { IConvertible IRegister.Value { get { return Value; } } public virtual T Value { get; set; } public byte Size { get { return (byte)System.Runtime.InteropServices.Marshal.SizeOf(typeof(T)); } } public void Add(IConvertible value) { if (typeof(T) == typeof(byte)) Value = (T)(object)(Value.ToByte(null) + value.ToByte(null)); if (typeof(T) == typeof(sbyte)) Value = (T)(object)(Value.ToSByte(null) + value.ToSByte(null)); if (typeof(T) == typeof(short)) Value = (T)(object)(Value.ToInt16(null) + value.ToInt16(null)); if (typeof(T) == typeof(ushort)) Value = (T)(object)(Value.ToUInt16(null) + value.ToUInt16(null)); if (typeof(T) == typeof(int)) Value = (T)(object)(Value.ToInt32(null) + value.ToInt32(null)); if (typeof(T) == typeof(uint)) Value = (T)(object)(Value.ToUInt32(null) + value.ToUInt32(null)); if (typeof(T) == typeof(long)) Value = (T)(object)(Value.ToInt64(null) + value.ToInt64(null)); if (typeof(T) == typeof(ulong)) Value = (T)(object)(Value.ToUInt64(null) + value.ToUInt64(null)); } public void Substract(IConvertible value) { if (typeof(T) == typeof(byte)) Value = (T)(object)(Value.ToByte(null) - value.ToByte(null)); if (typeof(T) == typeof(sbyte)) Value = (T)(object)(Value.ToSByte(null) - value.ToSByte(null)); if (typeof(T) == typeof(short)) Value = (T)(object)(Value.ToInt16(null) - value.ToInt16(null)); if (typeof(T) == typeof(ushort)) Value = (T)(object)(Value.ToUInt16(null) - value.ToUInt16(null)); if (typeof(T) == typeof(int)) Value = (T)(object)(Value.ToInt32(null) - value.ToInt32(null)); if (typeof(T) == typeof(uint)) Value = (T)(object)(Value.ToUInt32(null) - value.ToUInt32(null)); if (typeof(T) == typeof(long)) Value = (T)(object)(Value.ToInt64(null) - value.ToInt64(null)); if (typeof(T) == typeof(ulong)) Value = (T)(object)(Value.ToUInt64(null) - value.ToUInt64(null)); } public void Increment() { Add(1); } public void Decrement() { Substract(1); } } }
41.234375
107
0.525957
[ "MIT" ]
adamuso/DestroyNobots
DestroyNobots.Assembler/Emulator/Registers/Register.cs
2,641
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace FirmwareInstaller.Framework.Converters { public class BoolNegateConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value != null) { var input = (bool)value; return !input; } return null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new InvalidOperationException("Should never be called"); } } }
27.034483
124
0.642857
[ "Apache-2.0" ]
MaxBranvall/maxmix-software
Desktop/FirmwareInstaller/FirmwareInstaller/Framework/Converters/BoolNegateConverter.cs
786
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/fdi_fci_types.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. namespace TerraFX.Interop.Windows; public static partial class Windows { [NativeTypeName("#define INCLUDED_TYPES_FCI_FDI 1")] public const int INCLUDED_TYPES_FCI_FDI = 1; [NativeTypeName("#define tcompMASK_TYPE 0x000F")] public const int tcompMASK_TYPE = 0x000F; [NativeTypeName("#define tcompTYPE_NONE 0x0000")] public const int tcompTYPE_NONE = 0x0000; [NativeTypeName("#define tcompTYPE_MSZIP 0x0001")] public const int tcompTYPE_MSZIP = 0x0001; [NativeTypeName("#define tcompTYPE_QUANTUM 0x0002")] public const int tcompTYPE_QUANTUM = 0x0002; [NativeTypeName("#define tcompTYPE_LZX 0x0003")] public const int tcompTYPE_LZX = 0x0003; [NativeTypeName("#define tcompBAD 0x000F")] public const int tcompBAD = 0x000F; [NativeTypeName("#define tcompMASK_LZX_WINDOW 0x1F00")] public const int tcompMASK_LZX_WINDOW = 0x1F00; [NativeTypeName("#define tcompLZX_WINDOW_LO 0x0F00")] public const int tcompLZX_WINDOW_LO = 0x0F00; [NativeTypeName("#define tcompLZX_WINDOW_HI 0x1500")] public const int tcompLZX_WINDOW_HI = 0x1500; [NativeTypeName("#define tcompSHIFT_LZX_WINDOW 8")] public const int tcompSHIFT_LZX_WINDOW = 8; [NativeTypeName("#define tcompMASK_QUANTUM_LEVEL 0x00F0")] public const int tcompMASK_QUANTUM_LEVEL = 0x00F0; [NativeTypeName("#define tcompQUANTUM_LEVEL_LO 0x0010")] public const int tcompQUANTUM_LEVEL_LO = 0x0010; [NativeTypeName("#define tcompQUANTUM_LEVEL_HI 0x0070")] public const int tcompQUANTUM_LEVEL_HI = 0x0070; [NativeTypeName("#define tcompSHIFT_QUANTUM_LEVEL 4")] public const int tcompSHIFT_QUANTUM_LEVEL = 4; [NativeTypeName("#define tcompMASK_QUANTUM_MEM 0x1F00")] public const int tcompMASK_QUANTUM_MEM = 0x1F00; [NativeTypeName("#define tcompQUANTUM_MEM_LO 0x0A00")] public const int tcompQUANTUM_MEM_LO = 0x0A00; [NativeTypeName("#define tcompQUANTUM_MEM_HI 0x1500")] public const int tcompQUANTUM_MEM_HI = 0x1500; [NativeTypeName("#define tcompSHIFT_QUANTUM_MEM 8")] public const int tcompSHIFT_QUANTUM_MEM = 8; [NativeTypeName("#define tcompMASK_RESERVED 0xE000")] public const int tcompMASK_RESERVED = 0xE000; }
36.042857
145
0.754261
[ "MIT" ]
reflectronic/terrafx.interop.windows
sources/Interop/Windows/Windows/um/fdi_fci_types/Windows.cs
2,525
C#
// SPDX-FileCopyrightText: 2021 Open Energy Solutions Inc // // SPDX-License-Identifier: Apache-2.0 namespace OpenFMB.Adapters.Core.Models.Goose { public class GseControl { public IED IED { get; set; } public string LogicalDevice { get; set; } public string LogicalNode { get; set; } public string Name { get; set; } public string GooseId { get; set; } public int AppId { get; set; } public string ConfRev { get; set; } public string DestinationMACAddress { get; set; } public DataSet Dataset { get; set; } public string GseControlReference { get { return $"{IED.Name}{LogicalDevice}/{LogicalNode}$GO${Name}"; } } public string DataSetReference { get { return $"{IED.Name}{LogicalDevice}/{LogicalNode}${Dataset.Name}"; } } } }
31.857143
85
0.590807
[ "Apache-2.0" ]
openenergysolutions/openfmb.adapters.config
OpenFMB.Adapters.Core/Models/Goose/GseControl.cs
894
C#
using System; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using Serilog; namespace TreniniDotNet.Web { public class Program { public static void Main(string[] args) { try { CreateHostBuilder(args).Build().Run(); return; } catch (Exception ex) { Console.Error.WriteLine(ex); Log.Fatal(ex, "Host terminated unexpectedly"); return; } finally { Log.CloseAndFlush(); } } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseSerilog() .ConfigureWebHostDefaults(webBuilder => { webBuilder.ConfigureKestrel(options => options.AddServerHeader = false); webBuilder.UseStartup<Startup>(); webBuilder.CaptureStartupErrors(true); }); } }
27.794872
92
0.501845
[ "MIT" ]
CarloMicieli/TreniniDotNet
Src/Web/Program.cs
1,084
C#
/* Copyright © 2018 Dawid Dyrcz */ /* See license file */ using System; namespace FilteringToolStarter { class Program { static void Main(string[] args) { try { var filteringToolStarter = new FilteringToolStarter(); filteringToolStarter.StartFilteringTool(); } catch (Exception ex) { Exceptions.ExceptionHandler.HandleException(ex); } } } }
20.833333
70
0.518
[ "MIT" ]
dawiddyrcz/Filtering-tool-for-tekla-structures
FilteringTool/FilteringToolStarter/Program.cs
503
C#
// *********************************************************************** // Assembly : nem1-sdk // Author : kailin // Created : 06-01-2018 // // Last Modified By : kailin // Last Modified On : 11-07-2018 // *********************************************************************** // <copyright file="PublicAccount.cs" company="Nem.io"> // Copyright 2018 NEM // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // <summary></summary> // *********************************************************************** using System; using System.ComponentModel; using System.Text.RegularExpressions; using io.nem1.sdk.Model.Blockchain; namespace io.nem1.sdk.Model.Accounts { /// <summary> /// The public account structure contains account's address and public key. /// </summary> public class PublicAccount { /// <summary> /// Gets the address. /// </summary> /// <value>The address.</value> public Address Address { get; } /// <summary> /// Gets the public key. /// </summary> /// <value>The public key.</value> public string PublicKey { get; } /// <summary> /// Initializes a new instance of the <see cref="PublicAccount"/> class. /// </summary> /// <param name="publicKey">The public key.</param> /// <param name="networkType">Type of the network.</param> /// <exception cref="ArgumentException"> /// invalid public key length /// or /// invalid public key not hex /// </exception> /// <exception cref="ArgumentNullException">publicKey</exception> /// <exception cref="InvalidEnumArgumentException">networkType</exception> public PublicAccount(string publicKey, NetworkType.Types networkType) { if (publicKey == null) throw new ArgumentNullException(nameof(publicKey)); if (!Regex.IsMatch(publicKey, @"\A\b[0-9a-fA-F]+\b\Z")) throw new ArgumentException("invalid public key length"); if (publicKey.Length != 64) throw new ArgumentException("invalid public key not hex"); if (!Enum.IsDefined(typeof(NetworkType.Types), networkType)) throw new InvalidEnumArgumentException(nameof(networkType), (int) networkType, typeof(NetworkType.Types)); Address = Address.CreateFromPublicKey(publicKey, networkType); PublicKey = publicKey; } /// <summary> /// Create a PublicAccount from a public key and network type. /// </summary> /// <param name="publicKey">The account public key.</param> /// <param name="networkType">The network type.</param> /// <returns>PublicAccount.</returns> public static PublicAccount CreateFromPublicKey(string publicKey, NetworkType.Types networkType) { return new PublicAccount(publicKey, networkType); } /// <summary> /// Compares public accounts for equality. /// </summary> /// <param name="other">The other public account to compare with.</param> /// <returns>True if they are they are equal, else false.</returns> public bool Equals(PublicAccount other) { return Equals(Address, other.Address) && string.Equals(PublicKey, other.PublicKey); } /// <summary> /// Gets the hashcode of PublicAccount. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { unchecked { return ((Address != null ? Address.GetHashCode() : 0) * 397) ^ (PublicKey != null ? PublicKey.GetHashCode() : 0); } } } }
39.842593
129
0.579363
[ "Apache-2.0" ]
LykkeCity/nem1-sdk-csharp
src/nem1-sdk/src/Model/Accounts/PublicAccount.cs
4,305
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using GUC.Log; using GUC.Scripts.Sumpfkraut.VobSystem.Definitions; using GUC.Scripts.Sumpfkraut.Visuals; namespace GUC.Scripts.Sumpfkraut.Daedalus { class InstanceParser { public static void AddInstances() { foreach (KeyValuePair<string, DDLInstance> pair in instances) { if (pair.Value is DDLNpc) AddNPC(pair.Key, (DDLNpc)pair.Value); else if (pair.Value is DDLItem) AddItem(pair.Key, (DDLItem)pair.Value); } } static void AddItem(string codeName, DDLItem instance) { DDLString str; if (!instance.TryGetValue("visual", out str)) return; string modelName = Path.GetFileNameWithoutExtension(str.Value); ModelDef model; if (!ModelDef.TryGetModel(modelName, out model)) { model = new ModelDef(modelName, str.Value); model.Create(); } ItemDef item = ItemDef.Get(codeName); if (item == null) { item = new ItemDef(codeName); } else { item.Delete(); } item.Model = model; if (instance.TryGetValue("name", out str)) item.Name = str.Value; if (string.IsNullOrWhiteSpace(item.Name)) item.Name = "no name (" + codeName + ")"; if (instance.TryGetValue("effect", out str)) item.Effect = str.Value; item.Create(); } static void AddNPC(string codeName, DDLNpc instance) { DDLString str; if (!instance.TryGetValue("visual", out str)) return; string modelName = Path.GetFileNameWithoutExtension(str.Value); ModelDef model; if (!ModelDef.TryGetModel(modelName, out model)) { model = new ModelDef(modelName, str.Value); model.Create(); } NPCDef npc = NPCDef.Get(codeName); if (npc == null) { npc = new NPCDef(codeName); } else { npc.Delete(); } npc.Model = model; if (instance.TryGetValue("name", out str)) npc.Name = str.Value; if (string.IsNullOrWhiteSpace(npc.Name)) npc.Name = "no name (" + codeName + ")"; if (instance.TryGetValue("bodymesh", out str)) npc.BodyMesh = str.Value; if (instance.TryGetValue("headmesh", out str)) npc.HeadMesh = str.Value; DDLInt dint; if (instance.TryGetValue("bodytex", out dint)) npc.BodyTex = dint.Value; if (instance.TryGetValue("headtex", out dint)) npc.HeadTex = dint.Value; npc.Create(); } public static void ParseInstances() { DirectoryInfo dir = new DirectoryInfo("daedalus"); if (!dir.Exists) { Logger.Log("InstanceParser: No daedalus folder found!"); return; } FileInfo[] files = dir.GetFiles("*.d", SearchOption.AllDirectories); if (files.Length == 0) { Logger.Log("InstanceParser: No files to parse found!"); return; } //Logger.Log("InstanceParser: Checking for instances..."); ReadInstances(files); Logger.Log("InstanceParser: {0} instances parsed.", instances.Count); /*File.WriteAllText("instances.txt", ""); foreach (KeyValuePair<string, DDLInstance> pair in instances) { if (pair.Value is DDLNpc) { string name = "", armor = ""; DDLValueType v; if (pair.Value.TryGetValue("name", out v) && v is DDLString) name = ((DDLString)v).Value; if (pair.Value.TryGetValue("armor", out v) && v is DDLString) armor = ((DDLString)v).Value; File.AppendAllText("instances.txt", "NPC: '" + pair.Key + "' Name=" + name + " Armor=" + armor + " Eq: "); foreach(string item in ((DDLNpc)pair.Value).Equipment) File.AppendAllText("instances.txt", " " + item); File.AppendAllText("instances.txt", "\r\n"); } else if (pair.Value is DDLItem) { string name = ""; int dmg = 0, protection = 0; DDLValueType v; if (pair.Value.TryGetValue("name", out v) && v is DDLString) name = ((DDLString)v).Value; if (pair.Value.TryGetValue("visual", out v) && v is DDLArray<DDLInt>) dmg = ((DDLArray<DDLInt>)v).GetValue(2).Value; if (pair.Value.TryGetValue("bodymesh", out v) && v is DDLString) protection = ((DDLArray<DDLInt>)v).GetValue(2).Value; File.AppendAllText("instances.txt", "ITEM: '" + pair.Key + "' Name=" + name + "\r\n"); } }*/ } public static void Free() { instances.Clear(); } readonly static Dictionary<string, DDLInstance> instances = new Dictionary<string, DDLInstance>(StringComparer.OrdinalIgnoreCase); static void ReadInstances(FileInfo[] files) { instances.Clear(); for (int i = 0; i < files.Length; i++) { using (Parser parser = new Parser(files[i].OpenRead())) { while (parser.SkipTillLineStartsWith("INSTANCE")) { string codeName = parser.ReadTill("("); if (string.IsNullOrWhiteSpace(codeName)) continue; string type = parser.ReadTill(")"); if (string.IsNullOrWhiteSpace(type)) continue; string nextWord = parser.ReadWord(); if (nextWord != "{") continue; type = type.Trim(); codeName = codeName.Trim(); DDLInstance instance; if (string.Compare(type, "C_NPC", true) == 0) { instance = new DDLNpc(); } else if (string.Compare(type, "C_ITEM", true) == 0) { instance = new DDLItem(); } else if (PrototypeParser.TryGetPrototype(type, out instance)) { if (instance is DDLNpc) { instance = new DDLNpc((DDLNpc)instance); } else if (instance is DDLItem) { instance = new DDLItem((DDLItem)instance); } else { parser.SkipTill("};"); continue; } } else { parser.SkipTill("};"); continue; } instance.HandleTextBody(parser.ReadTill("};")); instances.Add(codeName, instance); } } } } } }
34.866953
138
0.440423
[ "BSD-2-Clause" ]
JulianVo/SumpfkrautOnline-Khorinis
ScriptsServer/Sumpfkraut/Daedalus/InstanceParser.cs
8,126
C#
// <auto-generated /> using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Internal; using System; using Tinygubackend.Contexts; namespace Tinygubackend.Migrations { [DbContext(typeof(TinyguContext))] [Migration("20180108225248_INIT")] partial class INIT { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) .HasAnnotation("ProductVersion", "2.0.1-rtm-125"); modelBuilder.Entity("Tinygubackend.Models.Link", b => { b.Property<int>("Id") .ValueGeneratedOnAdd(); b.Property<DateTime>("DateCreated"); b.Property<DateTime>("DateModified"); b.Property<string>("LongUrl"); b.Property<int?>("OwnerId"); b.Property<string>("ShortUrl") .HasMaxLength(100); b.HasKey("Id"); b.HasIndex("OwnerId"); b.HasIndex("ShortUrl") .IsUnique(); b.ToTable("Links"); }); modelBuilder.Entity("Tinygubackend.Models.User", b => { b.Property<int>("Id") .ValueGeneratedOnAdd(); b.Property<DateTime>("DateCreated"); b.Property<DateTime>("DateLogin"); b.Property<DateTime>("DateModified"); b.Property<string>("Email"); b.Property<string>("Name") .HasMaxLength(100); b.Property<string>("Password"); b.HasKey("Id"); b.HasIndex("Email") .IsUnique(); b.HasIndex("Name") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("Tinygubackend.Models.Link", b => { b.HasOne("Tinygubackend.Models.User", "Owner") .WithMany("Links") .HasForeignKey("OwnerId"); }); #pragma warning restore 612, 618 } } }
29.662921
108
0.505303
[ "MIT" ]
PhysikOnline-FFM/tinygu_backend
Tinygubackend/Migrations/20180108225248_INIT.Designer.cs
2,642
C#
using UnityEngine; using UnityEngine.Profiling; namespace GameLibrary{ public class Profiler : MonoBehaviour{ GUIStyle style = new GUIStyle(); string monoHeapSizeFormat = "MonoHeapSize:{0}"; string monoUsedSizeFormat = "MonoUsedSize:{0}"; string gpuAllocatedSizeFormat = "GraphicsMemory:{0}"; string totalReserverdSizeFormat = "totalReserverdSize:{0}"; string totalAllocatedSizeFormat = "totalAllocatedSize:{0}"; private void Start() { style.fontSize = 40; } static public void BeginSample(string name) { UnityEngine.Profiling.Profiler.BeginSample(name); } static public void EndSample(string name) { UnityEngine.Profiling.Profiler.EndSample(); } private void OnGUI() { long monoHeapSize = UnityEngine.Profiling.Profiler.GetMonoHeapSizeLong(); long monoUsedSize = UnityEngine.Profiling.Profiler.GetMonoUsedSizeLong(); long totalReserverdSize = UnityEngine.Profiling.Profiler.GetTotalReservedMemoryLong(); long totalAllocatedSize = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong(); long gpuAllocatedSize= UnityEngine.Profiling.Profiler.GetAllocatedMemoryForGraphicsDriver(); //GUI.BeginGroup(new Rect(Screen.width - width, 200, width, 200)); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label(string.Format(monoHeapSizeFormat, monoHeapSize),style); GUILayout.Label(string.Format(monoUsedSizeFormat, monoUsedSize),style); GUILayout.Label(string.Format(gpuAllocatedSizeFormat, gpuAllocatedSize), style); GUILayout.Label(string.Format(totalReserverdSizeFormat, totalReserverdSize),style); GUILayout.Label(string.Format(totalAllocatedSizeFormat, totalAllocatedSize),style); GUILayout.EndVertical(); GUILayout.EndHorizontal(); //GUI.EndGroup(); } [RuntimeInitializeOnLoadMethod] static void RuntimeInitialize() { var go = new GameObject("Profiler", typeof(Profiler)); DontDestroyOnLoad(go); } } }
42.111111
104
0.655673
[ "MIT" ]
zi-su/GameLibrary
Assets/GameLibrary/Script/Memory/Profiler.cs
2,276
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Globalization; using System.Linq; using System.Net.Http; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.IdentityModel.Tokens; namespace Microsoft.Bot.Connector.Authentication { /// <summary> /// Validates JWT tokens from an enterprise channel. /// </summary> public sealed class EnterpriseChannelValidation { /// <summary> /// TO BOT FROM ENTERPRISE CHANNEL: Token validation parameters when connecting to a bot. /// </summary> public static readonly TokenValidationParameters ToBotFromEnterpriseChannelTokenValidationParameters = new TokenValidationParameters() { ValidateIssuer = true, ValidIssuers = new[] { AuthenticationConstants.ToBotFromChannelTokenIssuer }, // Audience validation takes place in JwtTokenExtractor ValidateAudience = false, ValidateLifetime = true, ClockSkew = TimeSpan.FromMinutes(5), RequireSignedTokens = true, ValidateIssuerSigningKey = true, }; /// <summary> /// Validate the incoming Auth Header as a token sent from a Bot Framework Channel Service. /// </summary> /// <param name="authHeader">The raw HTTP header in the format: "Bearer [longString]".</param> /// <param name="credentials">The user defined set of valid credentials, such as the AppId.</param> /// <param name="channelProvider">The user defined configuration for the channel.</param> /// <param name="serviceUrl">The service url from the request.</param> /// <param name="httpClient">Authentication of tokens requires calling out to validate Endorsements and related documents. The /// HttpClient is used for making those calls. Those calls generally require TLS connections, which are expensive to /// setup and teardown, so a shared HttpClient is recommended.</param> /// <param name="channelId">The ID of the channel to validate.</param> /// <returns>ClaimsIdentity.</returns> #pragma warning disable UseAsyncSuffix // Use Async suffix (can't change this without breaking binary compat) public static async Task<ClaimsIdentity> AuthenticateChannelToken(string authHeader, ICredentialProvider credentials, IChannelProvider channelProvider, string serviceUrl, HttpClient httpClient, string channelId) #pragma warning restore UseAsyncSuffix // Use Async suffix { return await AuthenticateChannelToken(authHeader, credentials, channelProvider, serviceUrl, httpClient, channelId, new AuthenticationConfiguration()).ConfigureAwait(false); } /// <summary> /// Validate the incoming Auth Header as a token sent from a Bot Framework Channel Service. /// </summary> /// <param name="authHeader">The raw HTTP header in the format: "Bearer [longString]".</param> /// <param name="credentials">The user defined set of valid credentials, such as the AppId.</param> /// <param name="channelProvider">The user defined configuration for the channel.</param> /// <param name="serviceUrl">The service url from the request.</param> /// <param name="httpClient">Authentication of tokens requires calling out to validate Endorsements and related documents. The /// HttpClient is used for making those calls. Those calls generally require TLS connections, which are expensive to /// setup and teardown, so a shared HttpClient is recommended.</param> /// <param name="channelId">The ID of the channel to validate.</param> /// <param name="authConfig">The authentication configuration.</param> /// <returns>ClaimsIdentity.</returns> #pragma warning disable UseAsyncSuffix // Use Async suffix (can't change this without breaking binary compat) public static async Task<ClaimsIdentity> AuthenticateChannelToken(string authHeader, ICredentialProvider credentials, IChannelProvider channelProvider, string serviceUrl, HttpClient httpClient, string channelId, AuthenticationConfiguration authConfig) #pragma warning restore UseAsyncSuffix // Use Async suffix { if (authConfig == null) { throw new ArgumentNullException(nameof(authConfig)); } var channelService = await channelProvider.GetChannelServiceAsync().ConfigureAwait(false); var tokenExtractor = new JwtTokenExtractor( httpClient, ToBotFromEnterpriseChannelTokenValidationParameters, string.Format(CultureInfo.InvariantCulture, AuthenticationConstants.ToBotFromEnterpriseChannelOpenIdMetadataUrlFormat, channelService), AuthenticationConstants.AllowedSigningAlgorithms); var identity = await tokenExtractor.GetIdentityAsync(authHeader, channelId, authConfig.RequiredEndorsements).ConfigureAwait(false); await ValidateIdentity(identity, credentials, serviceUrl).ConfigureAwait(false); return identity; } /// <summary> /// Validates a <see cref="ClaimsIdentity"/> object against the credentials and service URL provided. /// </summary> /// <param name="identity">The identity to validate.</param> /// <param name="credentials">The credentials to use for validation.</param> /// <param name="serviceUrl">The service URL to validate.</param> /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns> #pragma warning disable UseAsyncSuffix // Use Async suffix (can't change this without breaking binary compat) public static async Task ValidateIdentity(ClaimsIdentity identity, ICredentialProvider credentials, string serviceUrl) #pragma warning restore UseAsyncSuffix // Use Async suffix { if (identity == null) { // No valid identity. Not Authorized. throw new UnauthorizedAccessException(); } if (!identity.IsAuthenticated) { // The token is in some way invalid. Not Authorized. throw new UnauthorizedAccessException(); } // Now check that the AppID in the claimset matches // what we're looking for. Note that in a multi-tenant bot, this value // comes from developer code that may be reaching out to a service, hence the // Async validation. // Look for the "aud" claim, but only if issued from the Bot Framework Claim audienceClaim = identity.Claims.FirstOrDefault( c => c.Issuer == AuthenticationConstants.ToBotFromChannelTokenIssuer && c.Type == AuthenticationConstants.AudienceClaim); if (audienceClaim == null) { // The relevant audience Claim MUST be present. Not Authorized. throw new UnauthorizedAccessException(); } // The AppId from the claim in the token must match the AppId specified by the developer. // In this case, the token is destined for the app, so we find the app ID in the audience claim. string appIdFromClaim = audienceClaim.Value; if (string.IsNullOrWhiteSpace(appIdFromClaim)) { // Claim is present, but doesn't have a value. Not Authorized. throw new UnauthorizedAccessException(); } if (!await credentials.IsValidAppIdAsync(appIdFromClaim).ConfigureAwait(false)) { // The AppId is not valid. Not Authorized. throw new UnauthorizedAccessException($"Invalid AppId passed on token: {appIdFromClaim}"); } if (serviceUrl != null) { var serviceUrlClaim = identity.Claims.FirstOrDefault(claim => claim.Type == AuthenticationConstants.ServiceUrlClaim)?.Value; if (string.IsNullOrWhiteSpace(serviceUrlClaim)) { // Claim must be present. Not Authorized. throw new UnauthorizedAccessException(); } if (!string.Equals(serviceUrlClaim, serviceUrl, StringComparison.OrdinalIgnoreCase)) { // Claim must match. Not Authorized. throw new UnauthorizedAccessException(); } } } } }
53.122699
259
0.658621
[ "MIT" ]
BetaLixT/botbuilder-dotnet
libraries/Microsoft.Bot.Connector/Authentication/EnterpriseChannelValidation.cs
8,661
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/WindowsStorageCOM.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. namespace TerraFX.Interop.WinRT; /// <include file='CreateProcessMethod.xml' path='doc/member[@name="CreateProcessMethod"]/*' /> public enum CreateProcessMethod { /// <include file='CreateProcessMethod.xml' path='doc/member[@name="CreateProcessMethod.CpCreateProcess"]/*' /> CpCreateProcess = 0, /// <include file='CreateProcessMethod.xml' path='doc/member[@name="CreateProcessMethod.CpCreateProcessAsUser"]/*' /> CpCreateProcessAsUser = 1, /// <include file='CreateProcessMethod.xml' path='doc/member[@name="CreateProcessMethod.CpAicLaunchAdminProcess"]/*' /> CpAicLaunchAdminProcess = 2, }
45.75
145
0.747541
[ "MIT" ]
reflectronic/terrafx.interop.windows
sources/Interop/Windows/WinRT/um/WindowsStorageCOM/CreateProcessMethod.cs
917
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Sheriff : Person { //FindMyQuest void Start () { base.Start(); } void Update() { base.Update(); } }
13.647059
33
0.603448
[ "Apache-2.0" ]
peon125/JoffreyCoughs
Assets/scripts/people/Sheriff.cs
234
C#
using Microsoft.AspNetCore.Mvc; using MSD.Product.API.Controllers.Common; using MSD.Product.API.Models; using MSD.Product.Domain.Dtos.ZipCode; using MSD.Product.Domain.Interfaces.Services; using MSD.Product.Infra.Warning; using System; using System.Threading.Tasks; using System.Web; namespace MSD.Product.API.Controllers.V1 { [ApiVersion("1", Deprecated = true)] [Obsolete] public class ZipCodeController : RootController { private readonly IZipCodeService zipCodeService; public ZipCodeController( WarningManagement warningManagement, IZipCodeService zipCodeService ) : base(warningManagement) { this.zipCodeService = zipCodeService; } /// <summary> /// Search for address info in the Brazillian Correios Post Service /// (Internal communication it will be performed by WCF) /// </summary> /// <param name="zipCode">Zip Code, example: 80020000</param> /// <returns>Default API Response with address info</returns> [HttpGet("{zipCode}")] public async Task<ActionResult<ApiDefaultResponse<Address>>> GetByExternalIdAsync(string zipCode) => Response(await zipCodeService.GetAddressByZipCodeV1Async(HttpUtility.UrlDecode(zipCode)).ConfigureAwait(false)); } }
35.702703
221
0.700984
[ "Apache-2.0" ]
spaki/microservices-demo
MSD.Product/MSD.Product.API/Controllers/V1/ZipCodeController.cs
1,323
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.Storage.V20200801Preview.Outputs { /// <summary> /// A tag of the LegalHold of a blob container. /// </summary> [OutputType] public sealed class TagPropertyResponse { /// <summary> /// Returns the Object ID of the user who added the tag. /// </summary> public readonly string ObjectIdentifier; /// <summary> /// The tag value. /// </summary> public readonly string Tag; /// <summary> /// Returns the Tenant ID that issued the token for the user who added the tag. /// </summary> public readonly string TenantId; /// <summary> /// Returns the date and time the tag was added. /// </summary> public readonly string Timestamp; /// <summary> /// Returns the User Principal Name of the user who added the tag. /// </summary> public readonly string Upn; [OutputConstructor] private TagPropertyResponse( string objectIdentifier, string tag, string tenantId, string timestamp, string upn) { ObjectIdentifier = objectIdentifier; Tag = tag; TenantId = tenantId; Timestamp = timestamp; Upn = upn; } } }
27.766667
87
0.582833
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/Storage/V20200801Preview/Outputs/TagPropertyResponse.cs
1,666
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ivony.Data.SqlClient { /// <summary> /// 定义用于 SQL Server 数据库的配置项 /// </summary> public class SqlServerConfiguration { /// <summary> /// 创建一个默认的 SQL Server 数据库配置 /// </summary> public SqlServerConfiguration() { } /// <summary> /// 从现有的 SQL Server 数据库配置中创建一个数据库配置 /// </summary> /// <param name="configuration">现有的数据库配置</param> public SqlServerConfiguration( SqlServerConfiguration configuration ) { } public TimeSpan? QueryExecutingTimeout { get; set; } } }
21.366667
77
0.675507
[ "Apache-2.0" ]
hulukaihuaba/DataPithy
Ivony.Data.SqlServer/SqlClient/SqlServerConfiguration.cs
743
C#
using System.Data; namespace BingoGameCore4 { public class BingoGameGroupPrizeLevel { public BingoGameGroup game_group; public BingoPrize prize; public object ID; public BingoGameGroupPrizeLevel(DataRow row) { } } }
19.466667
53
0.609589
[ "MIT" ]
d3x0r/xperdex
OpenSkiePOS/bingo_odds/BingoGameCore4/BingoGameGroupPrizeLevel.cs
294
C#
using Microsoft.Xrm.Sdk; using System.Runtime.Serialization; namespace Microsoft.Crm.Sdk.Messages { /// <summary>Contains the response from the <see cref="T:Microsoft.crm.Sdk.Messages.RetrieveUnpublishedMultipleRequest"></see> class.</summary> [DataContract(Namespace = "http://schemas.microsoft.com/crm/2011/Contracts")] public sealed class RetrieveUnpublishedMultipleResponse : OrganizationResponse { /// <summary>Gets the collection of records that satisfy the query in the request.</summary> /// <returns>Type: <see cref="T:Microsoft.Xrm.Sdk.EntityCollection"></see>The collection of records that satisfy the query in the request.</returns> public EntityCollection EntityCollection { get { return this.Results.Contains(nameof (EntityCollection)) ? (EntityCollection) this.Results[nameof (EntityCollection)] : (EntityCollection) null; } } } }
43.095238
153
0.739227
[ "MIT" ]
develmax/Crm.Sdk.Core
Microsoft.Crm.Sdk.Proxy/Messages/RetrieveUnpublishedMultipleResponse.cs
907
C#
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="NewCampaignRequestBuilder.cs" company="Sitecore A/S"> // Copyright (C) 2015 by Sitecore // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace KomfoSharp.Sessions.Authenticated.Requests.Ads.Campaigns.New { using System; using KomfoSharp.Configuration.Providers; using KomfoSharp.Model; using KomfoSharp.Sessions.Authenticated.Requests.Ads.Campaigns.New.Fluent; using KomfoSharp.Sessions.Fluent; /// <summary> /// Represents the new campaign request builder. /// </summary> public class NewCampaignRequestBuilder : BaseRequestBuilder, INewCampaignRequestBuilder, INewCalled, IWithPollingCalled { /// <summary> /// Initializes a new instance of the <see cref="NewCampaignRequestBuilder"/> class. /// </summary> /// <param name="configurationProvider">The configuration provider.</param> /// <param name="newCampaign">The new campaign.</param> public NewCampaignRequestBuilder(IConfigurationProvider configurationProvider, Campaign newCampaign) : base(configurationProvider) { this.NewCampaignRequest = new NewCampaignRequest(); this.NewCampaignRequest.Configuration.Campaign = newCampaign; } /// <summary> /// Gets the new campaign request. /// </summary> /// <value> /// The new campaign request. /// </value> protected INewCampaignRequest NewCampaignRequest { get; private set; } /// <summary> /// Enables the polling. /// </summary> /// <param name="pollingSetupFunc">The polling setup function.</param> /// <returns> /// The result of the call. /// </returns> public IWithPollingCalled WithPolling(Func<IWithPollingBuilder, ICreateCalling<PollingRequestConfiguration>> pollingSetupFunc = null) { this.NewCampaignRequest.Configuration.Polling = this.BuildPollingRequestConfiguration(pollingSetupFunc); return this; } /// <summary> /// Creates the new campaign request. /// </summary> /// <returns> /// The new campaign request. /// </returns> public INewCampaignRequest Create() { return this.NewCampaignRequest; } } }
37.301587
137
0.625957
[ "MIT" ]
Sitecore/KomfoSharp
KomfoSharp/Sessions/Authenticated/Requests/Ads/Campaigns/New/NewCampaignRequestBuilder.cs
2,352
C#
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace Lighthouse.Silverlight4.SampleXapWithTests.TestsForBugs.PagesForBugs { public partial class TextBlockInScrollViewerBugPage : UserControl { public TextBlockInScrollViewerBugPage() { InitializeComponent(); } } }
24.478261
78
0.761989
[ "MIT" ]
archnaut/Lighthouse
src/Tests/Silverlight/Silverlight4/Lighthouse.Silverlight4.SampleXapWithTests/TestsForBugs/PagesForBugs/TextBlockInScrollViewerBugPage.xaml.cs
565
C#
/* * The MIT License * * Copyright 2019 Palmtree Software. * * 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.Collections.Generic; using System.Linq; namespace Palmtree.Math.CodeGen.TestData.Plugin.Sint { class TestDataRendererPlugin_LesserThan_UX_X : TestDataRendererPluginBase_2_1 { public TestDataRendererPlugin_LesserThan_UX_X() : base("sint", "test_data_lesserthan_ux_x.xml") { } protected override IEnumerable<TestDataItemContainer> TestDataItems { get { return (UBigIntDataSource .SelectMany(p1 => BigIntDataSource, (p1, p2) => new { p1 = (IDataItem)new UBigIntDataItem(p1), p2 = (IDataItem)new BigIntDataItem(p2), r1 = (IDataItem)new UInt32DataItem(p1 < p2 ? 1U : 0U), }) .Zip(Enumerable.Range(0, int.MaxValue), (item, index) => new TestDataItemContainer { Index = index, Param1 = item.p1, Param2 = item.p2, Result1 = item.r1, })); } } } } /* * END OF FILE */
37.470588
94
0.569074
[ "MIT" ]
rougemeilland/Palmtree.Math
Palmtree.Math.CodeGen.TestData/Plugin/Sint/TestDataRendererPlugin_LesserThan_UX_X.cs
2,550
C#
//----------------------------------------------------------------------- // <copyright file="ClientTemplateModel.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; using System.Linq; using NJsonSchema.CodeGeneration; using NJsonSchema.CodeGeneration.TypeScript; namespace NSwag.CodeGeneration.TypeScript.Models { /// <summary>The TypeScript file template model.</summary> public class TypeScriptFileTemplateModel { private readonly TypeScriptClientGeneratorSettings _settings; private readonly TypeScriptTypeResolver _resolver; private readonly string _clientCode; private readonly IEnumerable<CodeArtifact> _clientTypes; private readonly OpenApiDocument _document; private readonly TypeScriptExtensionCode _extensionCode; /// <summary>Initializes a new instance of the <see cref="TypeScriptFileTemplateModel" /> class.</summary> /// <param name="clientTypes">The client types.</param> /// <param name="dtoTypes">The DTO types.</param> /// <param name="document">The Swagger document.</param> /// <param name="extensionCode">The extension code.</param> /// <param name="settings">The settings.</param> /// <param name="resolver">The resolver.</param> public TypeScriptFileTemplateModel( IEnumerable<CodeArtifact> clientTypes, IEnumerable<CodeArtifact> dtoTypes, OpenApiDocument document, TypeScriptExtensionCode extensionCode, TypeScriptClientGeneratorSettings settings, TypeScriptTypeResolver resolver) { _document = document; _extensionCode = extensionCode; _settings = settings; _resolver = resolver; _clientCode = clientTypes.OrderByBaseDependency().Concatenate(); _clientTypes = clientTypes; Types = dtoTypes.OrderByBaseDependency().Concatenate(); ExtensionCodeBottom = GenerateExtensionCodeAfter(); Framework = new TypeScriptFrameworkModel(settings); } /// <summary>Gets framework specific information.</summary> public TypeScriptFrameworkModel Framework { get; set; } /// <summary>Gets a value indicating whether to generate client classes.</summary> public bool GenerateClientClasses => _settings.GenerateClientClasses; /// <summary>Gets or sets a value indicating whether DTO exceptions are wrapped in a SwaggerException instance.</summary> public bool WrapDtoExceptions => _settings.WrapDtoExceptions; /// <summary>Gets or sets a value indicating whether to wrap success responses to allow full response access.</summary> public bool WrapResponses => _settings.WrapResponses; /// <summary>Gets or sets a value indicating whether to generate the response class (only applied when WrapResponses == true, default: true).</summary> public bool GenerateResponseClasses => _settings.GenerateResponseClasses; /// <summary>Gets the response class names.</summary> public IEnumerable<string> ResponseClassNames { get { // TODO: Merge with ResponseClassNames of C# if (_settings.OperationNameGenerator.SupportsMultipleClients) { return _document.Operations .GroupBy(o => _settings.OperationNameGenerator.GetClientName(_document, o.Path, o.Method, o.Operation)) .Select(g => _settings.ResponseClass.Replace("{controller}", g.Key)) .Where(a => _settings.TypeScriptGeneratorSettings.ExcludedTypeNames?.Contains(a) != true) .Distinct(); } return new[] { _settings.ResponseClass.Replace("{controller}", string.Empty) }; } } /// <summary>Gets a value indicating whether required types should be imported.</summary> public bool ImportRequiredTypes => _settings.ImportRequiredTypes; /// <summary>Gets a value indicating whether to call 'transformOptions' on the base class or extension class.</summary> public bool UseTransformOptionsMethod => _settings.UseTransformOptionsMethod; /// <summary>Gets a value indicating whether to include the httpContext parameter (Angular template only, default: false).</summary> public bool IncludeHttpContext => _settings.IncludeHttpContext; /// <summary>Gets the clients code.</summary> public string Clients => _settings.GenerateClientClasses ? _clientCode : string.Empty; /// <summary>Gets the types code.</summary> public string Types { get; } /// <summary>Gets or sets the extension code imports.</summary> public string ExtensionCodeImport => _extensionCode.ImportCode; /// <summary>Gets or sets the extension code to insert at the beginning.</summary> public string ExtensionCodeTop => _settings.ConfigurationClass != null && _extensionCode.ExtensionClasses.ContainsKey(_settings.ConfigurationClass) ? _extensionCode.ExtensionClasses[_settings.ConfigurationClass] + "\n\n" + _extensionCode.TopCode : _extensionCode.TopCode; /// <summary>Gets or sets the extension code to insert at the end.</summary> public string ExtensionCodeBottom { get; } /// <summary>Gets a value indicating whether the file has module name.</summary> public bool HasModuleName => !string.IsNullOrEmpty(_settings.TypeScriptGeneratorSettings.ModuleName); /// <summary>Gets the name of the module.</summary> public string ModuleName => _settings.TypeScriptGeneratorSettings.ModuleName; /// <summary>Gets a value indicating whether the file has a namespace.</summary> public bool HasNamespace => !string.IsNullOrEmpty(_settings.TypeScriptGeneratorSettings.Namespace); /// <summary>Gets the namespace.</summary> public string Namespace => _settings.TypeScriptGeneratorSettings.Namespace; /// <summary>Gets whether the export keyword should be added to all classes and enums.</summary> public bool ExportTypes => _settings.TypeScriptGeneratorSettings.ExportTypes; /// <summary>Gets a value indicating whether the FileParameter interface should be rendered.</summary> public bool RequiresFileParameterInterface => !_settings.TypeScriptGeneratorSettings.ExcludedTypeNames.Contains("FileParameter") && (_document.Operations.Any(o => o.Operation.ActualParameters.Any(p => p.ActualTypeSchema.IsBinary)) || _document.Operations.Any(o => o.Operation?.RequestBody?.Content?.Any(c => c.Value.Schema?.IsBinary == true || c.Value.Schema?.ActualProperties.Any(p => p.Value.IsBinary || p.Value.Item?.IsBinary == true || p.Value.Items.Any(i => i.IsBinary) ) == true) == true)); /// <summary>Gets a value indicating whether the FileResponse interface should be rendered.</summary> public bool RequiresFileResponseInterface => !Framework.IsJQuery && !_settings.TypeScriptGeneratorSettings.ExcludedTypeNames.Contains("FileResponse") && _document.Operations.Any(o => o.Operation.ActualResponses.Any(r => r.Value.IsBinary(o.Operation))); /// <summary>Gets a value indicating whether the client functions are required.</summary> public bool RequiresClientFunctions => _settings.GenerateClientClasses && !string.IsNullOrEmpty(Clients); /// <summary>Gets the exception class name.</summary> public string ExceptionClassName => _settings.ExceptionClass; /// <summary>Gets a value indicating whether the SwaggerException class is required. Note that if RequiresClientFunctions returns true this returns true since the client functions require it. </summary> public bool RequiresExceptionClass => RequiresClientFunctions && !_settings.TypeScriptGeneratorSettings.ExcludedTypeNames.Contains(_settings.ExceptionClass); /// <summary>Gets a value indicating whether to handle references.</summary> public bool HandleReferences => _settings.TypeScriptGeneratorSettings.HandleReferences; /// <summary>Gets a value indicating whether MomentJS duration format is needed (moment-duration-format package).</summary> public bool RequiresMomentJSDuration => Types?.Contains("moment.duration(") == true; /// <summary>Gets a value indicating whether the target TypeScript version supports override keyword.</summary> public bool SupportsOverrideKeyword => _settings.TypeScriptGeneratorSettings.SupportsOverrideKeyword; private string GenerateExtensionCodeAfter() { var clientClassesVariable = "{" + string.Join(", ", _clientTypes .Where(c => c.Category != CodeArtifactCategory.Utility) .Select(c => "'" + c.TypeName + "': " + c.TypeName)) + "}"; return _extensionCode.BottomCode.Replace("{clientClasses}", clientClassesVariable); } } }
56.329545
210
0.64535
[ "MIT" ]
Kirluu/NSwag
src/NSwag.CodeGeneration.TypeScript/Models/TypeScriptFileTemplateModel.cs
9,914
C#
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Apache License, Version 2.0. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Apache License, Version 2.0, please send an email to * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Apache License, Version 2.0. * * You must not remove this notice, or any other, from this software. * * * ***************************************************************************/ using System.Linq.Expressions; using System; using System.Dynamic; namespace IronPython.Runtime.Binding { interface IPythonGetable { DynamicMetaObject/*!*/ GetMember(PythonGetMemberBinder/*!*/ member, DynamicMetaObject/*!*/ codeContext); } }
37.192308
112
0.607032
[ "Apache-2.0" ]
SueDou/python
Src/IronPython/Runtime/Binding/IPythonGetable.cs
969
C#
using System; using System.IO; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; namespace RequestifyTF2.API { public static class ConsoleSender { public enum Command { Chat, Echo, Raw } public static void SendCommand(string cmnd, Command cmd) { var text = string.Empty; switch (cmd) { case Command.Chat: if (!Instance.IsMuted) { text = "say " + cmnd; } break; case Command.Echo: text = "echo " + cmnd; break; case Command.Raw: text = cmnd; break; default: throw new InvalidOperationException(); } File.WriteAllText(Instance.Config.GameDir + "/cfg/requestify.cfg", text); Task.Run( () => { keybd_event(0x2E, 0x53, 0, 0); Thread.Sleep(30); keybd_event(0x2E, 0x53, 0x2, 0); }); Thread.Sleep(100); File.WriteAllText(Instance.Config.GameDir + "/cfg/requestify.cfg", string.Empty); } [DllImport("user32.dll")] private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); } }
26.661017
99
0.443102
[ "MIT" ]
fossabot/RequestifyTF2
src/Core/RequestifyTF2/API/ConsoleSender.cs
1,575
C#
// Copyright 2007-2016 Chris Patterson, Dru Sellers, Travis Smith, et. al. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace MassTransit.Transports { using GreenPipes; public interface IReceiveTransport : IReceiveObserverConnector, IReceiveTransportObserverConnector, IProbeSite { /// <summary> /// Start receiving on a transport, sending messages to the specified pipe. /// </summary> /// <param name="receivePipe">The receiving pipe</param> /// <returns></returns> ReceiveTransportHandle Start(IPipe<ReceiveContext> receivePipe); } }
39.3
84
0.681086
[ "Apache-2.0" ]
zengdl/MassTransit
src/MassTransit/Transports/IReceiveTransport.cs
1,181
C#
using System; namespace Stratis.SmartContracts.CLR { /// <summary> /// Smart contract state that gets injected into the smart contract by the <see cref="ReflectionVirtualMachine"/>. /// </summary> public sealed class SmartContractState : ISmartContractState { public SmartContractState( IBlock block, IMessage message, IPersistentState persistentState, ISerializer serializer, IContractLogger contractLogger, IInternalTransactionExecutor internalTransactionExecutor, IInternalHashHelper internalHashHelper, Func<ulong> getBalance) { this.Block = block; this.Message = message; this.PersistentState = persistentState; this.Serializer = serializer; this.ContractLogger = contractLogger; this.InternalTransactionExecutor = internalTransactionExecutor; this.InternalHashHelper = internalHashHelper; this.GetBalance = getBalance; } public IBlock Block { get; } public IMessage Message { get; } public IPersistentState PersistentState { get; } public ISerializer Serializer { get; } [Obsolete] public IGasMeter GasMeter { get; } public IContractLogger ContractLogger { get; } public IInternalTransactionExecutor InternalTransactionExecutor { get; } public IInternalHashHelper InternalHashHelper { get; } public Func<ulong> GetBalance { get; } } }
32.061224
118
0.644176
[ "MIT" ]
AequitasCoinProject/AequitasFullNode
src/Stratis.SmartContracts.CLR/SmartContractState.cs
1,573
C#
#pragma checksum "D:\Owner\Desktop\VB.NET\learning\Pocket Rockets\Pocket Rockets\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "3C5B3F322F86A87BDD04EF7E87D3C4B9" //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18033 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Microsoft.Phone.Controls; using System; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Peers; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Resources; using System.Windows.Shapes; using System.Windows.Threading; namespace Pocket_Rockets { public partial class MainPage : Microsoft.Phone.Controls.PhoneApplicationPage { internal System.Windows.Controls.Grid LayoutRoot; internal System.Windows.Controls.StackPanel TitlePanel; internal System.Windows.Controls.Grid ContentPanel; internal System.Windows.Controls.ProgressBar WaitForIt; internal System.Windows.Controls.TextBlock Sex; private bool _contentLoaded; /// <summary> /// InitializeComponent /// </summary> [System.Diagnostics.DebuggerNonUserCodeAttribute()] public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Pocket%20Rockets;component/MainPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.WaitForIt = ((System.Windows.Controls.ProgressBar)(this.FindName("WaitForIt"))); this.Sex = ((System.Windows.Controls.TextBlock)(this.FindName("Sex"))); } } }
38.714286
173
0.638007
[ "MIT" ]
sam17/pocket-rocket
Pocket Rockets/obj/Debug/MainPage.g.i.cs
2,712
C#
// Copyright 2018 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // NOTE: This file is a modified version of SymbolResolver.cs from OleViewDotNet // https://github.com/tyranid/oleviewdotnet. It's been relicensed from GPLv3 by // the original author James Forshaw to be used under the Apache License for this // project. using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; namespace NtApiDotNet.Win32 { /// <summary> /// Represents a loaded module from the symbolc resolver. /// </summary> public sealed class SymbolLoadedModule { /// <summary> /// The name of the module. /// </summary> public string Name { get; private set; } /// <summary> /// The base address of the module. /// </summary> public IntPtr BaseAddress { get; private set; } /// <summary> /// The image size of the module. /// </summary> public int ImageSize { get; private set; } internal SymbolLoadedModule(string name, IntPtr base_address, int image_size) { Name = name; BaseAddress = base_address; ImageSize = image_size; } } /// <summary> /// Interface for a symbol resolver. /// </summary> public interface ISymbolResolver : IDisposable { /// <summary> /// Get list of loaded modules. /// </summary> /// <returns>The list of loaded modules</returns> /// <remarks>Note this will cache the results so subsequent calls won't necessarily see new modules.</remarks> IEnumerable<SymbolLoadedModule> GetLoadedModules(); /// <summary> /// Get list of loaded modules and optionally refresh the list. /// </summary> /// <param name="refresh">True to refresh the current cached list of modules.</param> /// <returns>The list of loaded modules</returns> IEnumerable<SymbolLoadedModule> GetLoadedModules(bool refresh); /// <summary> /// Get module at an address. /// </summary> /// <param name="address">The address for the module.</param> /// <returns>The module, or null if not found.</returns> /// <remarks>Note this will cache the results so subsequent calls won't necessarily see new modules.</remarks> SymbolLoadedModule GetModuleForAddress(IntPtr address); /// <summary> /// Get module at an address. /// </summary> /// <param name="address">The address for the module.</param> /// <param name="refresh">True to refresh the current cached list of modules.</param> /// <returns>The module, or null if not found.</returns> SymbolLoadedModule GetModuleForAddress(IntPtr address, bool refresh); /// <summary> /// Get a string representation of a relative address to a module. /// </summary> /// <param name="address">The address to get the string for,</param> /// <returns>The string form of the address, e.g. modulename+0x100</returns> /// <remarks>Note this will cache the results so subsequent calls won't necessarily see new modules.</remarks> string GetModuleRelativeAddress(IntPtr address); /// <summary> /// Get a string representation of a relative address to a module. /// </summary> /// <param name="address">The address to get the string for,</param> /// <param name="refresh">True to refresh the current cached list of modules.</param> /// <returns>The string form of the address, e.g. modulename+0x100</returns> string GetModuleRelativeAddress(IntPtr address, bool refresh); /// <summary> /// Get the address of a symbol. /// </summary> /// <param name="name">The name of the symbol, should include the module name, e.g. modulename!MySymbol.</param> /// <returns></returns> IntPtr GetAddressOfSymbol(string name); /// <summary> /// Get the symbol name for an address. /// </summary> /// <param name="address">The address of the symbol.</param> /// <returns>The symbol name.</returns> string GetSymbolForAddress(IntPtr address); /// <summary> /// Get the symbol name for an address, with no fallback. /// </summary> /// <param name="address">The address of the symbol.</param> /// <param name="generate_fake_symbol">If true then generate a fake symbol.</param> /// <returns>The symbol name. If |generate_fake_symbol| is true and the symbol doesn't exist one is generated based on module name.</returns> string GetSymbolForAddress(IntPtr address, bool generate_fake_symbol); /// <summary> /// Get the symbol name for an address, with no fallback. /// </summary> /// <param name="address">The address of the symbol.</param> /// <param name="generate_fake_symbol">If true then generate a fake symbol.</param> /// <param name="return_name_only">If true then return only the name of the symbols (such as C++ symbol name) rather than full symbol.</param> /// <returns>The symbol name. If |generate_fake_symbol| is true and the symbol doesn't exist one is generated based on module name.</returns> string GetSymbolForAddress(IntPtr address, bool generate_fake_symbol, bool return_name_only); /// <summary> /// Reload the list of modules for this symbol resolver. /// </summary> void ReloadModuleList(); /// <summary> /// Load a specific module into the symbol resolver. /// </summary> /// <param name="module_path">The path to the module.</param> /// <param name="base_address">The base address of the loaded module.</param> void LoadModule(string module_path, IntPtr base_address); } /// <summary> /// Static class for create symbolc resolvers. /// </summary> public static class SymbolResolver { /// <summary> /// Create a new instance of a symbol resolver. /// </summary> /// <param name="process">The process in which the symbols should be resolved.</param> /// <param name="dbghelp_path">The path to dbghelp.dll, ideally should use the one which comes with Debugging Tools for Windows.</param> /// <param name="symbol_path">The symbol path.</param> /// <returns>The instance of a symbol resolver. Should be disposed when finished.</returns> public static ISymbolResolver Create(NtProcess process, string dbghelp_path, string symbol_path) { return new DbgHelpSymbolResolver(process, dbghelp_path, symbol_path); } /// <summary> /// Create a new instance of a symbol resolver. Uses the system dbghelp library and symbol path /// from _NT_SYMBOL_PATH environment variable. /// </summary> /// <param name="process">The process in which the symbols should be resolved.</param> /// <returns>The instance of a symbol resolver. Should be disposed when finished.</returns> public static ISymbolResolver Create(NtProcess process) { string symbol_path = Environment.GetEnvironmentVariable("_NT_SYMBOL_PATH"); if (string.IsNullOrWhiteSpace(symbol_path)) { throw new ArgumentException("_NT_SYMBOL_PATH environment variable not specified"); } return Create(process, "dbghelp.dll", symbol_path); } } sealed class DbgHelpSymbolResolver : ISymbolResolver, IDisposable { [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymInitializeW( SafeKernelObjectHandle hProcess, [MarshalAs(UnmanagedType.LPWStr)] string UserSearchPath, [MarshalAs(UnmanagedType.Bool)] bool fInvadeProcess ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymCleanup( SafeKernelObjectHandle hProcess ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymFromNameW( SafeKernelObjectHandle hProcess, string Name, SafeBuffer Symbol ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool EnumModules( string ModuleName, long BaseOfDll, IntPtr UserContext); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymEnumerateModulesW64( SafeKernelObjectHandle hProcess, EnumModules EnumModulesCallback, IntPtr UserContext ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymFromAddrW( SafeKernelObjectHandle hProcess, long Address, out long Displacement, SafeBuffer Symbol ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymGetModuleInfoW64( SafeKernelObjectHandle hProcess, long dwAddr, ref IMAGEHLP_MODULE64 ModuleInfo ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi, SetLastError = true)] delegate long SymLoadModule64( SafeKernelObjectHandle hProcess, IntPtr hFile, string ImageName, string ModuleName, long BaseOfDll, int SizeOfDll ); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate bool SymRefreshModuleList( SafeKernelObjectHandle hProcess ); enum SymTagEnum { SymTagNull, SymTagExe, SymTagCompiland, SymTagCompilandDetails, SymTagCompilandEnv, SymTagFunction, SymTagBlock, SymTagData, SymTagAnnotation, SymTagLabel, SymTagPublicSymbol, SymTagUDT, SymTagEnum, SymTagFunctionType, SymTagPointerType, SymTagArrayType, SymTagBaseType, SymTagTypedef, SymTagBaseClass, SymTagFriend, SymTagFunctionArgType, SymTagFuncDebugStart, SymTagFuncDebugEnd, SymTagUsingNamespace, SymTagVTableShape, SymTagVTable, SymTagCustom, SymTagThunk, SymTagCustomType, SymTagManagedType, SymTagDimension } [StructLayout(LayoutKind.Sequential)] class SYMBOL_INFO { public int SizeOfStruct; public int TypeIndex; // Type Index of symbol public long Reserved1; public long Reserved2; public int Index; public int Size; public long ModBase; // Base Address of module comtaining this symbol public int Flags; public long Value; // Value of symbol, ValuePresent should be 1 public long Address; // Address of symbol including base address of module public int Register; // register holding value or pointer to value public int Scope; // scope of the symbol public SymTagEnum Tag; // pdb classification public int NameLen; // Actual length of name public int MaxNameLen; public char Name; public const int MAX_SYM_NAME = 2000; public SYMBOL_INFO() { SizeOfStruct = Marshal.SizeOf(typeof(SYMBOL_INFO)); } public SYMBOL_INFO(int max_name_len) : this() { MaxNameLen = max_name_len; } } [Flags] enum SymOptions : uint { CASE_INSENSITIVE = 0x00000001, UNDNAME = 0x00000002, DEFERRED_LOADS = 0x00000004, NO_CPP = 0x00000008, LOAD_LINES = 0x00000010, OMAP_FIND_NEAREST = 0x00000020, LOAD_ANYTHING = 0x00000040, IGNORE_CVREC = 0x00000080, NO_UNQUALIFIED_LOADS = 0x00000100, FAIL_CRITICAL_ERRORS = 0x00000200, EXACT_SYMBOLS = 0x00000400, ALLOW_ABSOLUTE_SYMBOLS = 0x00000800, IGNORE_NT_SYMPATH = 0x00001000, INCLUDE_32BIT_MODULES = 0x00002000, PUBLICS_ONLY = 0x00004000, NO_PUBLICS = 0x00008000, AUTO_PUBLICS = 0x00010000, NO_IMAGE_SEARCH = 0x00020000, SECURE = 0x00040000, NO_PROMPTS = 0x00080000, OVERWRITE = 0x00100000, IGNORE_IMAGEDIR = 0x00200000, FLAT_DIRECTORY = 0x00400000, FAVOR_COMPRESSED = 0x00800000, ALLOW_ZERO_ADDRESS = 0x01000000, DISABLE_SYMSRV_AUTODETECT = 0x02000000, READONLY_CACHE = 0x04000000, SYMPATH_LAST = 0x08000000, DISABLE_FAST_SYMBOLS = 0x10000000, DISABLE_SYMSRV_TIMEOUT = 0x20000000, DISABLE_SRVSTAR_ON_STARTUP = 0x40000000, DEBUG = 0x80000000, } enum SYM_TYPE { SymNone = 0, SymCoff, SymCv, SymPdb, SymExport, SymDeferred, SymSym, SymDia, SymVirtual, NumSymTypes } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] struct IMAGEHLP_MODULE64 { public int SizeOfStruct; public long BaseOfImage; public int ImageSize; public int TimeDateStamp; public int CheckSum; public int NumSyms; public SYM_TYPE SymType; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string ModuleName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string ImageName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string LoadedImageName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string LoadedPdbName; public int CVSig; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260*3)] public string CVData; public int PdbSig; public Guid PdbSig70; public int PdbAge; [MarshalAs(UnmanagedType.Bool)] public bool PdbUnmatched; [MarshalAs(UnmanagedType.Bool)] public bool DbgUnmatched; [MarshalAs(UnmanagedType.Bool)] public bool LineNumbers; [MarshalAs(UnmanagedType.Bool)] public bool GlobalSymbols; [MarshalAs(UnmanagedType.Bool)] public bool TypeInfo; [MarshalAs(UnmanagedType.Bool)] public bool SourceIndexed; [MarshalAs(UnmanagedType.Bool)] public bool Publics; public int MachineType; public int Reserved; } [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate int SymSetOptions( SymOptions SymOptions ); [Flags] enum EnumProcessModulesFilter { LIST_MODULES_DEFAULT = 0x00, LIST_MODULES_32BIT = 0x01, LIST_MODULES_64BIT = 0x02, LIST_MODULES_ALL = LIST_MODULES_32BIT | LIST_MODULES_64BIT, } [DllImport("Psapi.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern bool EnumProcessModulesEx( SafeKernelObjectHandle hProcess, [Out] IntPtr[] lphModule, int cb, out int lpcbNeeded, EnumProcessModulesFilter dwFilterFlag ); [DllImport("Psapi.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern int GetModuleFileNameEx( SafeKernelObjectHandle hProcess, IntPtr hModule, StringBuilder lpFilename, int nSize ); [StructLayout(LayoutKind.Sequential)] private struct MODULEINFO { public IntPtr lpBaseOfDll; public int SizeOfImage; public IntPtr EntryPoint; } [DllImport("Psapi.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern bool GetModuleInformation( SafeKernelObjectHandle hProcess, IntPtr hModule, out MODULEINFO lpmodinfo, int cb ); private SafeLoadLibraryHandle _dbghelp_lib; private SymInitializeW _sym_init; private SymCleanup _sym_cleanup; private SymFromNameW _sym_from_name; private SymSetOptions _sym_set_options; private SymEnumerateModulesW64 _sym_enum_modules; private SymFromAddrW _sym_from_addr; private SymGetModuleInfoW64 _sym_get_module_info; private SymLoadModule64 _sym_load_module; private SymRefreshModuleList _sym_refresh_module_list; private void GetFunc<T>(ref T f) where T : class { f = _dbghelp_lib.GetFunctionPointer<T>(); } static SafeStructureInOutBuffer<SYMBOL_INFO> AllocateSymInfo() { return new SafeStructureInOutBuffer<SYMBOL_INFO>(new SYMBOL_INFO(SYMBOL_INFO.MAX_SYM_NAME), SYMBOL_INFO.MAX_SYM_NAME * 2, true); } static string GetNameFromSymbolInfo(SafeBuffer buffer) { IntPtr ofs = Marshal.OffsetOf(typeof(SYMBOL_INFO), "Name"); return Marshal.PtrToStringUni(buffer.DangerousGetHandle() + ofs.ToInt32()); } internal DbgHelpSymbolResolver(NtProcess process, string dbghelp_path, string symbol_path) { Process = process.Duplicate(); _dbghelp_lib = SafeLoadLibraryHandle.LoadLibrary(dbghelp_path); GetFunc(ref _sym_init); GetFunc(ref _sym_cleanup); GetFunc(ref _sym_from_name); GetFunc(ref _sym_set_options); GetFunc(ref _sym_enum_modules); GetFunc(ref _sym_from_addr); GetFunc(ref _sym_get_module_info); GetFunc(ref _sym_load_module); GetFunc(ref _sym_refresh_module_list); _sym_set_options(SymOptions.INCLUDE_32BIT_MODULES | SymOptions.UNDNAME | SymOptions.DEFERRED_LOADS); if (!_sym_init(Handle, symbol_path, true)) { // If SymInitialize failed then we'll have to bootstrap modules manually. if (!_sym_init(Handle, symbol_path, false)) { throw new Win32Exception(); } IntPtr[] modules = new IntPtr[1024]; int return_length; if (EnumProcessModulesEx(Handle, modules, modules.Length * IntPtr.Size, out return_length, process.Is64Bit ? EnumProcessModulesFilter.LIST_MODULES_64BIT : EnumProcessModulesFilter.LIST_MODULES_32BIT)) { foreach (IntPtr module in modules.Take(return_length / IntPtr.Size)) { StringBuilder dllpath = new StringBuilder(260); if (GetModuleFileNameEx(Handle, module, dllpath, dllpath.Capacity) > 0) { if (_sym_load_module(Handle, IntPtr.Zero, dllpath.ToString(), Path.GetFileNameWithoutExtension(dllpath.ToString()), module.ToInt64(), GetImageSize(module)) == 0) { System.Diagnostics.Debug.WriteLine(String.Format("Couldn't load {0}", dllpath)); } } } } } } private int GetImageSize(IntPtr base_address) { if (!GetModuleInformation(Handle, base_address, out MODULEINFO mod_info, Marshal.SizeOf(typeof(MODULEINFO)))) { throw new SafeWin32Exception(); } return mod_info.SizeOfImage; } private IMAGEHLP_MODULE64 GetModuleInfo(long base_address) { IMAGEHLP_MODULE64 module = new IMAGEHLP_MODULE64(); module.SizeOfStruct = Marshal.SizeOf(module); if (_sym_get_module_info(Handle, base_address, ref module)) { return module; } return new IMAGEHLP_MODULE64(); } private IEnumerable<SymbolLoadedModule> GetLoadedModulesInternal() { List<SymbolLoadedModule> modules = new List<SymbolLoadedModule>(); if (!_sym_enum_modules(Handle, (s, m, p) => { modules.Add(new SymbolLoadedModule(s, new IntPtr(m), GetModuleInfo(m).ImageSize)); return true; }, IntPtr.Zero)) { throw new Win32Exception(); } return modules.AsReadOnly(); } private IEnumerable<SymbolLoadedModule> _loaded_modules; public IEnumerable<SymbolLoadedModule> GetLoadedModules() { return GetLoadedModules(false); } public IEnumerable<SymbolLoadedModule> GetLoadedModules(bool refresh) { if (_loaded_modules == null || refresh) { _loaded_modules = GetLoadedModulesInternal().OrderBy(s => s.BaseAddress.ToInt64()); } return _loaded_modules; } public SymbolLoadedModule GetModuleForAddress(IntPtr address, bool refresh) { long check_addr = address.ToInt64(); foreach (SymbolLoadedModule module in GetLoadedModules(refresh)) { long base_address = module.BaseAddress.ToInt64(); if (check_addr >= base_address && check_addr < base_address + module.ImageSize) { return module; } } return null; } public SymbolLoadedModule GetModuleForAddress(IntPtr address) { return GetModuleForAddress(address, false); } public string GetModuleRelativeAddress(IntPtr address) { return GetModuleRelativeAddress(address, false); } public string GetModuleRelativeAddress(IntPtr address, bool refresh) { SymbolLoadedModule module = GetModuleForAddress(address, refresh); if (module == null) { return String.Format("0x{0:X}", address.ToInt64()); } return String.Format("{0}+0x{1:X}", module.Name, address.ToInt64() - module.BaseAddress.ToInt64()); } public IntPtr GetAddressOfSymbol(string name) { using (var sym_info = AllocateSymInfo()) { if (!_sym_from_name(Handle, name, sym_info)) { return IntPtr.Zero; } return new IntPtr(sym_info.Result.Address); } } public string GetSymbolForAddress(IntPtr address) { return GetSymbolForAddress(address, true); } private static string GetSymbolName(string symbol) { int last_index = symbol.LastIndexOf("::"); if (last_index >= 0) { symbol = symbol.Substring(last_index + 2); } last_index = symbol.LastIndexOf("`"); if (last_index >= 0) { symbol = symbol.Substring(last_index + 1); } return symbol; } public string GetSymbolForAddress(IntPtr address, bool generate_fake_symbol, bool return_name_only) { using (var sym_info = AllocateSymInfo()) { if (_sym_from_addr(Handle, address.ToInt64(), out long displacement, sym_info)) { string name = GetNameFromSymbolInfo(sym_info); if (return_name_only) { return GetSymbolName(name); } string disp_str = string.Empty; if (displacement < 0) { disp_str = $"-0x{Math.Abs(displacement):X}"; } else if (displacement > 0) { disp_str = $"+0x{displacement:X}"; } return $"{name}{disp_str}"; } // Perhaps should return module+X? if (generate_fake_symbol && !return_name_only) { return String.Format("0x{0:X}", address.ToInt64()); } return null; } } public string GetSymbolForAddress(IntPtr address, bool generate_fake_symbol) { return GetSymbolForAddress(address, generate_fake_symbol, false); } public void ReloadModuleList() { if (!_sym_refresh_module_list(Handle)) { throw new SafeWin32Exception(); } } public void LoadModule(string module_path, IntPtr base_address) { if (_sym_load_module(Handle, IntPtr.Zero, module_path, Path.GetFileNameWithoutExtension(module_path), base_address.ToInt64(), GetImageSize(base_address)) == 0) { int error = Marshal.GetLastWin32Error(); if (error != 0) { throw new SafeWin32Exception(error); } } } internal NtProcess Process { get; } internal SafeKernelObjectHandle Handle { get { return Process.Handle; } } #region IDisposable Support private bool disposedValue = false; void Dispose(bool disposing) { if (!disposedValue) { disposedValue = true; _sym_cleanup?.Invoke(Handle); _dbghelp_lib?.Close(); Process?.Dispose(); } } ~DbgHelpSymbolResolver() { Dispose(false); } void IDisposable.Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion } }
38.681259
150
0.575576
[ "Apache-2.0" ]
1orenz0/sandbox-attacksurface-analysis-tools
NtApiDotNet/Win32/SymbolResolver.cs
28,278
C#
//Copyright 2016 Scifoni Ivano // //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace TestWebApplication { public class BaseTestBatch { public class Person { public string Name { get; set; } public string Address { get; set; } } public async Task<string> Method1() { var response = ""; await Task.Run(() => { for (var i = 0; i < 1000; i++) { response += " Giro giro tondo<br>"; } }); return response; } public void Method2() { } public string Method3() { string result = ""; for (var i = 0; i < 10; i++) { result += $"Test {i} <br/> "; } return result; } public async Task<Person> Method4() { return await Task.Run(() => { var person = new Person() { Name = "John Doe", Address = "Route" }; return person; }); } public string Method5(int Id, string last, DateTime birthDate) { string response=""; for (var i = 0; i < 10000; i++) { response += " Giro giro tondo<br>"; } return $"{Id} - {last} - {birthDate}"; } public string Method6(Person person) { return $"Person Name:{person.Name} Address {person.Address}"; } } }
24.159574
74
0.494496
[ "Apache-2.0" ]
iscifoni/SharpBatch
test/WebApplication/BaseTestBatch.cs
2,273
C#
// // MessageSummaryFetchedEventArgs.cs // // Author: Jeffrey Stedfast <jeff@xamarin.com> // // Copyright (c) 2015 Xamarin Inc. (www.xamarin.com) // // 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; namespace MailKit { /// <summary> /// Event args used when a message summary has been fetched from a folder. /// </summary> /// <remarks> /// Event args used when a message summary has been fetched from a folder. /// </remarks> public class MessageSummaryFetchedEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="MailKit.MessageSummaryFetchedEventArgs"/> class. /// </summary> /// <remarks> /// Creates a new <see cref="MessageSummaryFetchedEventArgs"/> /// </remarks> /// <param name="message">The message summary.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="message"/> is <c>null</c>. /// </exception> public MessageSummaryFetchedEventArgs (IMessageSummary message) { if (message == null) throw new ArgumentNullException (nameof (message)); Message = message; } /// <summary> /// Get the message summary. /// </summary> /// <remarks> /// Gets the message summary. /// </remarks> /// <value>The message summary.</value> public IMessageSummary Message { get; private set; } } }
34.691176
99
0.712166
[ "MIT" ]
muffadalis/rrod
lib/MailKit/MessageSummaryFetchedEventArgs.cs
2,361
C#
using System; using System.Runtime.InteropServices; namespace OpenCV.Net { /// <summary> /// Represents a memory storage block. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct MemBlock { IntPtr prev; IntPtr next; /// <summary> /// Gets the previous memory storage block. /// </summary> public MemBlock Prev { get { unsafe { return *((MemBlock*)prev.ToPointer()); } } } /// <summary> /// Gets the next memory storage block. /// </summary> public MemBlock Next { get { unsafe { return *((MemBlock*)prev.ToPointer()); } } } } }
20.363636
58
0.418527
[ "MIT" ]
horizongir/opencv.net
src/OpenCV.Net/MemBlock.cs
898
C#
namespace StockSharp.Algo.Storages.Csv { using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using Ecng.Collections; using Ecng.Common; using Ecng.Configuration; using Ecng.Serialization; using MoreLinq; using StockSharp.BusinessEntities; using StockSharp.Localization; using StockSharp.Logging; using StockSharp.Messages; /// <summary> /// The CSV storage of trading objects. /// </summary> public class CsvEntityRegistry : IEntityRegistry { private class FakeStorage : IStorage { private readonly CsvEntityRegistry _registry; public FakeStorage(CsvEntityRegistry registry) { _registry = registry; } public long GetCount<TEntity>() { return 0; } public TEntity Add<TEntity>(TEntity entity) { Added?.Invoke(entity); return entity; } public TEntity GetBy<TEntity>(SerializationItemCollection by) { return _registry.Securities.ReadById(by[0].Value).To<TEntity>(); //throw new NotSupportedException(); } public TEntity GetById<TEntity>(object id) { throw new NotSupportedException(); } public IEnumerable<TEntity> GetGroup<TEntity>(long startIndex, long count, Field orderBy, ListSortDirection direction) { throw new NotSupportedException(); } public TEntity Update<TEntity>(TEntity entity) { Updated?.Invoke(entity); return entity; } public void Remove<TEntity>(TEntity entity) { Removed?.Invoke(entity); } public void Clear<TEntity>() { } public void ClearCache() { } public IBatchContext BeginBatch() { return new BatchContext(this); } public void CommitBatch() { } public void EndBatch() { } public event Action<object> Added; public event Action<object> Updated; public event Action<object> Removed; } private class ExchangeCsvList : CsvEntityList<Exchange> { public ExchangeCsvList(CsvEntityRegistry registry) : base(registry, "exchange.csv") { } protected override object GetKey(Exchange item) { return item.Name; } protected override Exchange Read(FastCsvReader reader) { var board = new Exchange { Name = reader.ReadString(), CountryCode = reader.ReadNullableEnum<CountryCodes>(), EngName = reader.ReadString(), RusName = reader.ReadString(), //ExtensionInfo = Deserialize<Dictionary<object, object>>(reader.ReadString()) }; return board; } protected override void Write(CsvFileWriter writer, Exchange data) { writer.WriteRow(new[] { data.Name, data.CountryCode.To<string>(), data.EngName, data.RusName, //Serialize(data.ExtensionInfo) }); } } private class ExchangeBoardCsvList : CsvEntityList<ExchangeBoard> { public ExchangeBoardCsvList(CsvEntityRegistry registry) : base(registry, "exchangeboard.csv") { } protected override object GetKey(ExchangeBoard item) { return item.Code; } private Exchange GetExchange(string exchangeCode) { var exchange = Registry.Exchanges.ReadById(exchangeCode); if (exchange == null) throw new InvalidOperationException(LocalizedStrings.Str1217Params.Put(exchangeCode)); return exchange; } protected override ExchangeBoard Read(FastCsvReader reader) { var board = new ExchangeBoard { Code = reader.ReadString(), Exchange = GetExchange(reader.ReadString()), ExpiryTime = reader.ReadString().ToTime(), //IsSupportAtomicReRegister = reader.ReadBool(), //IsSupportMarketOrders = reader.ReadBool(), TimeZone = TimeZoneInfo.FindSystemTimeZoneById(reader.ReadString()), WorkingTime = { Periods = Deserialize<List<WorkingTimePeriod>>(reader.ReadString()), SpecialWorkingDays = Deserialize<List<DateTime>>(reader.ReadString()), SpecialHolidays = Deserialize<List<DateTime>>(reader.ReadString()) }, //ExtensionInfo = Deserialize<Dictionary<object, object>>(reader.ReadString()) }; return board; } protected override void Write(CsvFileWriter writer, ExchangeBoard data) { writer.WriteRow(new[] { data.Code, data.Exchange.Name, data.ExpiryTime.WriteTime(), //data.IsSupportAtomicReRegister.To<string>(), //data.IsSupportMarketOrders.To<string>(), data.TimeZone.Id, Serialize(data.WorkingTime.Periods), Serialize(data.WorkingTime.SpecialWorkingDays), Serialize(data.WorkingTime.SpecialHolidays), //Serialize(data.ExtensionInfo) }); } private readonly SynchronizedDictionary<Type, IXmlSerializer> _serializers = new SynchronizedDictionary<Type, IXmlSerializer>(); private string Serialize<TItem>(TItem item) where TItem : class { if (item == null) return null; var serializer = GetSerializer<TItem>(); using (var stream = new MemoryStream()) { serializer.Serialize(item, stream); return Registry.Encoding.GetString(stream.ToArray()).Remove(Environment.NewLine).Replace("\"", "'"); } } private TItem Deserialize<TItem>(string value) where TItem : class { if (value.IsEmpty()) return null; var serializer = GetSerializer<TItem>(); var bytes = Registry.Encoding.GetBytes(value.Replace("'", "\"")); using (var stream = new MemoryStream(bytes)) return serializer.Deserialize(stream); } private XmlSerializer<TItem> GetSerializer<TItem>() { return (XmlSerializer<TItem>)_serializers.SafeAdd(typeof(TItem), k => new XmlSerializer<TItem>(false)); } } private class SecurityCsvList : CsvEntityList<Security>, IStorageSecurityList { public SecurityCsvList(CsvEntityRegistry registry) : base(registry, "security.csv") { ((ICollectionEx<Security>)this).AddedRange += s => _added?.Invoke(s); ((ICollectionEx<Security>)this).RemovedRange += s => _removed?.Invoke(s); } #region IStorageSecurityList void IDisposable.Dispose() { } private Action<IEnumerable<Security>> _added; event Action<IEnumerable<Security>> ISecurityProvider.Added { add => _added += value; remove => _added -= value; } private Action<IEnumerable<Security>> _removed; event Action<IEnumerable<Security>> ISecurityProvider.Removed { add => _removed += value; remove => _removed -= value; } IEnumerable<Security> ISecurityProvider.Lookup(Security criteria) { if (criteria.IsLookupAll()) return ToArray(); if (criteria.Id.IsEmpty()) return this.Filter(criteria); var security = ((IStorageSecurityList)this).ReadById(criteria.Id); return security == null ? Enumerable.Empty<Security>() : new[] { security }; } void ISecurityStorage.Delete(Security security) { Remove(security); } void ISecurityStorage.DeleteBy(Security criteria) { this.Filter(criteria).ForEach(s => Remove(s)); } #endregion #region CsvEntityList protected override object GetKey(Security item) { return item.Id; } private class LiteSecurity { public string Id { get; set; } public string Name { get; set; } public string Code { get; set; } public string Class { get; set; } public string ShortName { get; set; } public string Board { get; set; } public string UnderlyingSecurityId { get; set; } public decimal? PriceStep { get; set; } public decimal? VolumeStep { get; set; } public decimal? Multiplier { get; set; } public int? Decimals { get; set; } public SecurityTypes? Type { get; set; } public DateTimeOffset? ExpiryDate { get; set; } public DateTimeOffset? SettlementDate { get; set; } public decimal? Strike { get; set; } public OptionTypes? OptionType { get; set; } public CurrencyTypes? Currency { get; set; } public SecurityExternalId ExternalId { get; set; } public SecurityTypes? UnderlyingSecurityType { get; set; } public string BinaryOptionType { get; set; } public string CfiCode { get; set; } public DateTimeOffset? IssueDate { get; set; } public decimal? IssueSize { get; set; } public string BasketCode { get; set; } public string BasketExpression { get; set; } public Security ToSecurity(SecurityCsvList list) { return new Security { Id = Id, Name = Name, Code = Code, Class = Class, ShortName = ShortName, Board = list.Registry.GetBoard(Board), UnderlyingSecurityId = UnderlyingSecurityId, PriceStep = PriceStep, VolumeStep = VolumeStep, Multiplier = Multiplier, Decimals = Decimals, Type = Type, ExpiryDate = ExpiryDate, SettlementDate = SettlementDate, Strike = Strike, OptionType = OptionType, Currency = Currency, ExternalId = ExternalId.Clone(), UnderlyingSecurityType = UnderlyingSecurityType, BinaryOptionType = BinaryOptionType, CfiCode = CfiCode, IssueDate = IssueDate, IssueSize = IssueSize, BasketCode = BasketCode, BasketExpression = BasketExpression, }; } public void Update(Security security) { Name = security.Name; Code = security.Code; Class = security.Class; ShortName = security.ShortName; Board = security.Board.Code; UnderlyingSecurityId = security.UnderlyingSecurityId; PriceStep = security.PriceStep; VolumeStep = security.VolumeStep; Multiplier = security.Multiplier; Decimals = security.Decimals; Type = security.Type; ExpiryDate = security.ExpiryDate; SettlementDate = security.SettlementDate; Strike = security.Strike; OptionType = security.OptionType; Currency = security.Currency; ExternalId = security.ExternalId.Clone(); UnderlyingSecurityType = security.UnderlyingSecurityType; BinaryOptionType = security.BinaryOptionType; CfiCode = security.CfiCode; IssueDate = security.IssueDate; IssueSize = security.IssueSize; BasketCode = security.BasketCode; BasketExpression = security.BasketExpression; } } private readonly Dictionary<string, LiteSecurity> _cache = new Dictionary<string, LiteSecurity>(StringComparer.InvariantCultureIgnoreCase); private static bool IsChanged(string original, string cached, bool forced) { if (original.IsEmpty()) return forced && !cached.IsEmpty(); else return cached.IsEmpty() || (forced && !cached.CompareIgnoreCase(original)); } private static bool IsChanged<T>(T? original, T? cached, bool forced) where T : struct { if (original == null) return forced && cached != null; else return cached == null || (forced && !original.Value.Equals(cached.Value)); } protected override bool IsChanged(Security security, bool forced) { var liteSec = _cache.TryGetValue(security.Id); if (liteSec == null) throw new ArgumentOutOfRangeException(nameof(security), security.Id, LocalizedStrings.Str2736); if (IsChanged(security.Name, liteSec.Name, forced)) return true; if (IsChanged(security.Code, liteSec.Code, forced)) return true; if (IsChanged(security.Class, liteSec.Class, forced)) return true; if (IsChanged(security.ShortName, liteSec.ShortName, forced)) return true; if (IsChanged(security.UnderlyingSecurityId, liteSec.UnderlyingSecurityId, forced)) return true; if (IsChanged(security.UnderlyingSecurityType, liteSec.UnderlyingSecurityType, forced)) return true; if (IsChanged(security.PriceStep, liteSec.PriceStep, forced)) return true; if (IsChanged(security.VolumeStep, liteSec.VolumeStep, forced)) return true; if (IsChanged(security.Multiplier, liteSec.Multiplier, forced)) return true; if (IsChanged(security.Decimals, liteSec.Decimals, forced)) return true; if (IsChanged(security.Type, liteSec.Type, forced)) return true; if (IsChanged(security.ExpiryDate, liteSec.ExpiryDate, forced)) return true; if (IsChanged(security.SettlementDate, liteSec.SettlementDate, forced)) return true; if (IsChanged(security.Strike, liteSec.Strike, forced)) return true; if (IsChanged(security.OptionType, liteSec.OptionType, forced)) return true; if (IsChanged(security.Currency, liteSec.Currency, forced)) return true; if (IsChanged(security.BinaryOptionType, liteSec.BinaryOptionType, forced)) return true; if (IsChanged(security.CfiCode, liteSec.CfiCode, forced)) return true; if (IsChanged(security.IssueDate, liteSec.IssueDate, forced)) return true; if (IsChanged(security.IssueSize, liteSec.IssueSize, forced)) return true; if (security.Board == null) { if (!liteSec.Board.IsEmpty() && forced) return true; } else { if (liteSec.Board.IsEmpty() || (forced && !liteSec.Board.CompareIgnoreCase(security.Board.Code))) return true; } if (forced && security.ExternalId != liteSec.ExternalId) return true; if (IsChanged(security.BasketCode, liteSec.BasketCode, forced)) return true; if (IsChanged(security.BasketExpression, liteSec.BasketExpression, forced)) return true; return false; } protected override void ClearCache() { _cache.Clear(); } protected override void AddCache(Security item) { var sec = new LiteSecurity { Id = item.Id }; sec.Update(item); _cache.Add(item.Id, sec); } protected override void RemoveCache(Security item) { _cache.Remove(item.Id); } protected override void UpdateCache(Security item) { _cache[item.Id].Update(item); } //protected override void WriteMany(Security[] values) //{ // base.WriteMany(_cache.Values.Select(l => l.ToSecurity(this)).ToArray()); //} protected override Security Read(FastCsvReader reader) { var liteSec = new LiteSecurity { Id = reader.ReadString(), Name = reader.ReadString(), Code = reader.ReadString(), Class = reader.ReadString(), ShortName = reader.ReadString(), Board = reader.ReadString(), UnderlyingSecurityId = reader.ReadString(), PriceStep = reader.ReadNullableDecimal(), VolumeStep = reader.ReadNullableDecimal(), Multiplier = reader.ReadNullableDecimal(), Decimals = reader.ReadNullableInt(), Type = reader.ReadNullableEnum<SecurityTypes>(), ExpiryDate = ReadNullableDateTime(reader), SettlementDate = ReadNullableDateTime(reader), Strike = reader.ReadNullableDecimal(), OptionType = reader.ReadNullableEnum<OptionTypes>(), Currency = reader.ReadNullableEnum<CurrencyTypes>(), ExternalId = new SecurityExternalId { Sedol = reader.ReadString(), Cusip = reader.ReadString(), Isin = reader.ReadString(), Ric = reader.ReadString(), Bloomberg = reader.ReadString(), IQFeed = reader.ReadString(), InteractiveBrokers = reader.ReadNullableInt(), Plaza = reader.ReadString() }, }; if ((reader.ColumnCurr + 1) < reader.ColumnCount) { liteSec.UnderlyingSecurityType = reader.ReadNullableEnum<SecurityTypes>(); liteSec.BinaryOptionType = reader.ReadString(); liteSec.CfiCode = reader.ReadString(); liteSec.IssueDate = ReadNullableDateTime(reader); liteSec.IssueSize = reader.ReadNullableDecimal(); } if ((reader.ColumnCurr + 1) < reader.ColumnCount) liteSec.BasketCode = reader.ReadString(); if ((reader.ColumnCurr + 1) < reader.ColumnCount) liteSec.BasketExpression = reader.ReadString(); return liteSec.ToSecurity(this); } protected override void Write(CsvFileWriter writer, Security data) { writer.WriteRow(new[] { data.Id, data.Name, data.Code, data.Class, data.ShortName, data.Board.Code, data.UnderlyingSecurityId, data.PriceStep.To<string>(), data.VolumeStep.To<string>(), data.Multiplier.To<string>(), data.Decimals.To<string>(), data.Type.To<string>(), data.ExpiryDate?.UtcDateTime.ToString(_dateTimeFormat), data.SettlementDate?.UtcDateTime.ToString(_dateTimeFormat), data.Strike.To<string>(), data.OptionType.To<string>(), data.Currency.To<string>(), data.ExternalId.Sedol, data.ExternalId.Cusip, data.ExternalId.Isin, data.ExternalId.Ric, data.ExternalId.Bloomberg, data.ExternalId.IQFeed, data.ExternalId.InteractiveBrokers.To<string>(), data.ExternalId.Plaza, data.UnderlyingSecurityType.To<string>(), data.BinaryOptionType, data.CfiCode, data.IssueDate?.UtcDateTime.ToString(_dateTimeFormat), data.IssueSize.To<string>(), data.BasketCode, data.BasketExpression, }); } public override void Save(Security entity, bool forced) { lock (Registry.Exchanges.SyncRoot) Registry.Exchanges.TryAdd(entity.Board.Exchange); lock (Registry.ExchangeBoards.SyncRoot) Registry.ExchangeBoards.TryAdd(entity.Board); base.Save(entity, forced); } #endregion } private class PortfolioCsvList : CsvEntityList<Portfolio> { public PortfolioCsvList(CsvEntityRegistry registry) : base(registry, "portfolio.csv") { } protected override object GetKey(Portfolio item) { return item.Name; } protected override Portfolio Read(FastCsvReader reader) { var portfolio = new Portfolio { Name = reader.ReadString(), Board = GetBoard(reader.ReadString()), Leverage = reader.ReadNullableDecimal(), BeginValue = reader.ReadNullableDecimal(), CurrentValue = reader.ReadNullableDecimal(), BlockedValue = reader.ReadNullableDecimal(), VariationMargin = reader.ReadNullableDecimal(), Commission = reader.ReadNullableDecimal(), Currency = reader.ReadNullableEnum<CurrencyTypes>(), State = reader.ReadNullableEnum<PortfolioStates>(), Description = reader.ReadString(), LastChangeTime = _dateTimeParser.Parse(reader.ReadString()).ChangeKind(DateTimeKind.Utc), LocalTime = _dateTimeParser.Parse(reader.ReadString()).ChangeKind(DateTimeKind.Utc) }; return portfolio; } private ExchangeBoard GetBoard(string boardCode) { return boardCode.IsEmpty() ? null : Registry.GetBoard(boardCode); } protected override void Write(CsvFileWriter writer, Portfolio data) { writer.WriteRow(new[] { data.Name, data.Board?.Code, data.Leverage.To<string>(), data.BeginValue.To<string>(), data.CurrentValue.To<string>(), data.BlockedValue.To<string>(), data.VariationMargin.To<string>(), data.Commission.To<string>(), data.Currency.To<string>(), data.State.To<string>(), data.Description, data.LastChangeTime.UtcDateTime.ToString(_dateTimeFormat), data.LocalTime.UtcDateTime.ToString(_dateTimeFormat) }); } } private class PositionCsvList : CsvEntityList<Position>, IStoragePositionList { public PositionCsvList(CsvEntityRegistry registry) : base(registry, "position.csv") { } protected override object GetKey(Position item) { return Tuple.Create(item.Portfolio, item.Security); } private Portfolio GetPortfolio(string id) { var portfolio = Registry.Portfolios.ReadById(id); if (portfolio == null) throw new InvalidOperationException(LocalizedStrings.Str3622Params.Put(id)); return portfolio; } private Security GetSecurity(string id) { var security = Registry.Securities.ReadById(id); if (security == null) throw new InvalidOperationException(LocalizedStrings.Str704Params.Put(id)); return security; } protected override Position Read(FastCsvReader reader) { var pfName = reader.ReadString(); var secId = reader.ReadString(); var position = new Position { Portfolio = GetPortfolio(pfName), Security = GetSecurity(secId), DepoName = reader.ReadString(), LimitType = reader.ReadNullableEnum<TPlusLimits>(), BeginValue = reader.ReadNullableDecimal(), CurrentValue = reader.ReadNullableDecimal(), BlockedValue = reader.ReadNullableDecimal(), VariationMargin = reader.ReadNullableDecimal(), Commission = reader.ReadNullableDecimal(), Currency = reader.ReadNullableEnum<CurrencyTypes>(), LastChangeTime = _dateTimeParser.Parse(reader.ReadString()).ChangeKind(DateTimeKind.Utc), LocalTime = _dateTimeParser.Parse(reader.ReadString()).ChangeKind(DateTimeKind.Utc) }; return position; } protected override void Write(CsvFileWriter writer, Position data) { writer.WriteRow(new[] { data.Portfolio.Name, data.Security.Id, data.DepoName, data.LimitType.To<string>(), data.BeginValue.To<string>(), data.CurrentValue.To<string>(), data.BlockedValue.To<string>(), data.VariationMargin.To<string>(), data.Commission.To<string>(), data.Description, data.LastChangeTime.UtcDateTime.ToString(_dateTimeFormat), data.LocalTime.UtcDateTime.ToString(_dateTimeFormat) }); } public Position ReadBySecurityAndPortfolio(Security security, Portfolio portfolio) { return ((IStoragePositionList)this).ReadById(Tuple.Create(portfolio, security)); } } private const string _dateTimeFormat = "yyyyMMddHHmmss"; private static readonly FastDateTimeParser _dateTimeParser = new FastDateTimeParser(_dateTimeFormat); private static DateTimeOffset? ReadNullableDateTime(FastCsvReader reader) { var str = reader.ReadString(); if (str == null) return null; return _dateTimeParser.Parse(str).ChangeKind(DateTimeKind.Utc); } private readonly ExchangeCsvList _exchanges; private readonly ExchangeBoardCsvList _exchangeBoards; private readonly SecurityCsvList _securities; private readonly PortfolioCsvList _portfolios; private readonly PositionCsvList _positions; private readonly List<ICsvEntityList> _csvLists = new List<ICsvEntityList>(); /// <summary> /// The path to data directory. /// </summary> public string Path { get; set; } /// <inheritdoc /> public IStorage Storage { get; } private Encoding _encoding = Encoding.UTF8; /// <summary> /// Encoding. /// </summary> public Encoding Encoding { get => _encoding; set => _encoding = value ?? throw new ArgumentNullException(nameof(value)); } private DelayAction _delayAction = new DelayAction(ex => ex.LogError()); /// <inheritdoc /> public virtual DelayAction DelayAction { get => _delayAction; set { _delayAction = value ?? throw new ArgumentNullException(nameof(value)); UpdateDelayAction(); } } private void UpdateDelayAction() { _exchanges.DelayAction = _delayAction; _exchangeBoards.DelayAction = _delayAction; _securities.DelayAction = _delayAction; _positions.DelayAction = _delayAction; _portfolios.DelayAction = _delayAction; } /// <inheritdoc /> public IStorageEntityList<Exchange> Exchanges => _exchanges; /// <inheritdoc /> public IStorageEntityList<ExchangeBoard> ExchangeBoards => _exchangeBoards; /// <inheritdoc /> public IStorageSecurityList Securities => _securities; /// <inheritdoc /> public IStorageEntityList<Portfolio> Portfolios => _portfolios; /// <inheritdoc /> public IStoragePositionList Positions => _positions; /// <summary> /// Initializes a new instance of the <see cref="CsvEntityRegistry"/>. /// </summary> /// <param name="path">The path to data directory.</param> public CsvEntityRegistry(string path) { Path = path ?? throw new ArgumentNullException(nameof(path)); Storage = new FakeStorage(this); Add(_exchanges = new ExchangeCsvList(this)); Add(_exchangeBoards = new ExchangeBoardCsvList(this)); Add(_securities = new SecurityCsvList(this)); Add(_portfolios = new PortfolioCsvList(this)); Add(_positions = new PositionCsvList(this)); UpdateDelayAction(); } /// <summary> /// Add list of trade objects. /// </summary> /// <typeparam name="T">Entity type.</typeparam> /// <param name="list">List of trade objects.</param> public void Add<T>(CsvEntityList<T> list) where T : class { if (list == null) throw new ArgumentNullException(nameof(list)); _csvLists.Add(list); } /// <inheritdoc /> public IDictionary<object, Exception> Init() { Directory.CreateDirectory(Path); var errors = new Dictionary<object, Exception>(); foreach (var list in _csvLists) { try { var listErrors = new List<Exception>(); list.Init(listErrors); if (listErrors.Count > 0) errors.Add(list, new AggregateException(listErrors)); } catch (Exception ex) { errors.Add(list, ex); } } return errors; } private readonly InMemoryExchangeInfoProvider _exchangeInfoProvider = new InMemoryExchangeInfoProvider(); internal ExchangeBoard GetBoard(string boardCode) { var board = ExchangeBoards.ReadById(boardCode); if (board != null) return board; board = (ConfigManager.TryGetService<IExchangeInfoProvider>() ?? _exchangeInfoProvider).GetExchangeBoard(boardCode); if (board == null) throw new InvalidOperationException(LocalizedStrings.Str1217Params.Put(boardCode)); return board; } } }
27.565547
142
0.68734
[ "Apache-2.0" ]
1M15M3/StockSharp
Algo/Storages/Csv/CsvEntityRegistry.cs
25,443
C#
namespace Zaabee.DataContractSerializer.UnitTest; public partial class XmlUnitTest { [Fact] public void XmlDictionaryWriterReaderNonGenericTest() { var testModel = TestModelFactory.Create(); TestModel result0; using (var fs = new FileStream("XmlWriterReaderNonGenericTest0.xml", FileMode.Create)) { var writer = XmlDictionaryWriter.CreateDictionaryWriter(new XmlTextWriter(fs, Encoding.UTF8)); writer.WriteXml(typeof(TestModel), testModel); writer.Close(); } using (var fs = new FileStream("XmlWriterReaderNonGenericTest0.xml", FileMode.Open)) { var reader = XmlDictionaryReader.CreateDictionaryReader(new XmlTextReader(fs)); result0 = (TestModel)reader.ReadXml(typeof(TestModel))!; reader.Close(); } TestModel result1; using (var fs = new FileStream("XmlWriterReaderNonGenericTest0.xml", FileMode.Create)) { var writer = XmlDictionaryWriter.CreateDictionaryWriter(new XmlTextWriter(fs, Encoding.UTF8)); testModel.Serialize(typeof(TestModel), writer); writer.Close(); } using (var fs = new FileStream("XmlWriterReaderNonGenericTest0.xml", FileMode.Open)) { var reader = XmlDictionaryReader.CreateDictionaryReader(new XmlTextReader(fs)); result1 = (TestModel)reader.ReadXml(typeof(TestModel))!; reader.Close(); } Assert.Equal( Tuple.Create(testModel.Id, testModel.Age, testModel.CreateTime, testModel.Name, testModel.Gender), Tuple.Create(result0.Id, result0.Age, result0.CreateTime, result0.Name, result0.Gender)); Assert.Equal( Tuple.Create(testModel.Id, testModel.Age, testModel.CreateTime, testModel.Name, testModel.Gender), Tuple.Create(result1.Id, result1.Age, result1.CreateTime, result1.Name, result1.Gender)); } [Fact] public void XmlDictionaryWriterReaderNonGenericNullTest() { TestModel? testModel = null; XmlDictionaryWriter? write = null; XmlDictionaryReader? reader = null; testModel.Serialize(typeof(TestModel), write); write.WriteXml(typeof(TestModel), testModel); reader.ReadXml(typeof(TestModel)); } }
40.912281
110
0.659949
[ "MIT" ]
PicoHex/Zaabee.Serializers
tests/Zaabee.DataContractSerializer.UnitTest/XmlDictiionaryWriterReader.NonGeneric.Test.cs
2,332
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System; // 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("ShortestWalk")] [assembly: AssemblyDescription("Rhinoceros 5 WIP ShortestWalk command. Contact giulio@mcneel.com")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("McNeel Europe - Creative Common, Attribution")] [assembly: AssemblyProduct("ShortestWalk")] [assembly: AssemblyCopyright("© 2010 McNeel Europe. Released under http://creativecommons.org/licenses/by/3.0/es/")] [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("97441433-1ff3-4de1-9ae5-1afcc8ef155d")] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly:CLSCompliant(true)] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.WebSite, @"http://www.food4rhino.com/shortestwalk")] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.Address, @"Roger de Flor, 32-34 Barcelona")] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.Country, @"Spain")] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.Email, @"giulio@mcneel.com")] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.Organization, @"McNeel Europe")] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.Phone, @"+34 933 199 002")] [assembly: Rhino.PlugIns.PlugInDescription(Rhino.PlugIns.DescriptionType.Fax, @"+34 933 195 833")]
50.478261
125
0.774763
[ "Unlicense" ]
mcneeleurope/ShortestWalk
ShortestWalk.Rh/Properties/AssemblyInfo.cs
2,325
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OfficeOpenXml.Drawing.Chart; using Tera.Game; using Tera.Game.Messages; namespace DamageMeter.Heuristic { class S_LOAD_TOPO : AbstractPacketHeuristic { private static Dictionary<ushort, Vector3f> PossibleMessages = new Dictionary<ushort, Vector3f>(); //TODO: add parsing and clear spawn lists public new void Process(ParsedMessage message) { base.Process(message); if (IsKnown || OpcodeFinder.Instance.IsKnown(message.OpCode)) return; if (message.Payload.Count != 4 + 4 + 4 + 4 + 1) return; var zone = Reader.ReadUInt32(); var pos = Reader.ReadVector3f(); try { var quick = Reader.ReadBoolean(); } catch { return; } if(!PossibleMessages.ContainsKey(message.OpCode)) PossibleMessages.Add(message.OpCode, pos); } public static void Confirm(Vector3f pos) { if (PossibleMessages.ContainsValue(pos)) { var opc = PossibleMessages.FirstOrDefault(x => x.Value.Equals(pos)).Key; OpcodeFinder.Instance.SetOpcode(opc, OpcodeEnum.S_LOAD_TOPO); } } } }
32.047619
106
0.611441
[ "MIT" ]
neowutran/OpcodeSearcher
DamageMeter.Core/Heuristic/S_LOAD_TOPO.cs
1,348
C#
using Microsoft.AspNetCore.SignalR.Client; using SharedClass; using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; using System.Text; using TMPro; using UnityEngine; using UnityEngine.UI; using Debug = UnityEngine.Debug; /*when everybody has calculated its dock difference, show the total points on a canvas set * in the editor, at the beggining also notify to the objects they can read their info from file*/ public class GetTotalScoreGeneral : MonoSingleton<GetTotalScoreGeneral> { // Start is called before the first frame update public delegate void buttonManager(int level); public static event buttonManager OnClick; public List<float> points; public Canvas ScoreCanvas; public Canvas LevelThreeCanvas; private int MaxElements = 10; float Total = 0, score = 0; private Stopwatch stopwatch = new Stopwatch(); private int timeElapsed; private readonly string LevelConfig ="Configs/LevelConfig"; private Dictionary<string, int> Food; public LoadLevel.Levels m_actualLevel; public override void Init() { base.Init(); Food = new Dictionary<string, int>(); } /// <summary> /// start stopwatch and also signal other script that needs to know which level is /// </summary> public void StartLevel(string name) { if(Enum.TryParse(name, out m_actualLevel)) { GetLevelMaxPoints(); startCount(); } } public void AddFood(string name , int value) { Food.Add(name, value); } public string GetLevelName() { return m_actualLevel.ToString(); } void Update() { if(points.Count == MaxElements) { //Debug.Log("<color=red>MaxELement reached </color> "); foreach (float p in points) { Total += p; } score = (Total / MaxElements) * 100; /* get tag information and retrieve datas about the level, read the file LevelConfig */ /*open canvas and show score and time elapsed*/ /* only in Android version open Canvas!!!*/ OpenScoreCanvas(); /* call the hub to send the informations*/ /* 0 to occupy field that will be changed in the SERVER*/ //string scoreToS = score.ToString().Replace(",", "."); /*Universal string standard*/ //int firstDecimal = scoreToS.IndexOf("."); //scoreToS = scoreToS.Substring(0, firstDecimal + 2); string scoreToS = String.Format("{0:0.0}", score); RecordInfo recordInfo = new RecordInfo(0, scoreToS, timeElapsed, 0, m_actualLevel.ToString()); OpenConnection.Instance.HubConnection.InvokeAsync("RecordDataAsync", recordInfo); points.Clear(); Total = 0; } } /* Open the canvas and set the points after pressing the button*/ private void OpenScoreCanvas() { int Level =(int) m_actualLevel; string scoreS = String.Format("{0:0.0}", score); if (ScoreCanvas != null && Level <3) { InsertValues(ScoreCanvas, scoreS); } else if (LevelThreeCanvas != null && Level > 2) { InsertValues(LevelThreeCanvas, scoreS); SetToggles(); } else { UnityEngine.Debug.Log("[SCORE_GENERAL] OpenScoreCanvas error: " + Level); } } private void InsertValues(Canvas canvas, string scoreS) { canvas.gameObject.SetActive(true); TextMeshProUGUI[] TextMesh = canvas.transform.GetComponentsInChildren<TextMeshProUGUI>(); TextMesh[0].text = scoreS + " %"; } /* Open the canvas and set the points from clientManager, [ATTENTION]: works only if the texts for the point are the first two sons*/ public void OpenScoreCanvas(RecordInfo recordInfo) { int Level = (int)m_actualLevel; if (ScoreCanvas != null && Level <3 ) { Debug.Log("ScoreCanvas one"); InsertValues(ScoreCanvas, recordInfo.Score ); } else if (LevelThreeCanvas != null && Level >= 3) { InsertValues(LevelThreeCanvas, recordInfo.Score); SetToggles(); /*sets informations about prots and carbs*/ } else { UnityEngine.Debug.Log("[SCORE_GENERAL] OpenScoreCanvas error: " +Level); } } private void SetToggles() { Toggle[] Toggles = LevelThreeCanvas.transform.GetComponentsInChildren<Toggle>(); foreach (Toggle toogle in Toggles) { if (Food.TryGetValue(toogle.gameObject.name, out int value)) { // Debug.Log("[toogles] " + g.gameObject.name + " value " + value); if (value == 1) toogle.isOn = true; } } } private void GetLevelMaxPoints() { try { UnityMainThreadDispatcher.Instance().Enqueue(ReadLevelConfigFile()); } catch (Exception e) { Debug.Log(e.ToString()); } } /*Reads the number of elements that are used to calculate the * total score from a .txt and sets the level variable*/ private IEnumerator ReadLevelConfigFile() { TextAsset txt = (TextAsset)Resources.Load(LevelConfig, typeof(TextAsset)); string content = txt.text; string actualLevel = m_actualLevel.ToString(); using (var sr = new StringReader(content)) { var line = string.Empty; while ((line = sr.ReadLine()) != null) { var dataPoints = line.Split(' '); if( actualLevel.CompareTo(dataPoints[0]) == 0) { MaxElements = Int32.Parse(dataPoints[1]); break; } } } yield return null; } /// <summary> /// Called when someone hit the button /// </summary> public void CallInvoke() { StopCount(); OnClick?.Invoke((int) m_actualLevel); } public void startCount() { stopwatch.Reset(); stopwatch.Start(); /*probably is a new Level so I get the informations*/ } public void StopCount() { stopwatch.Stop(); timeElapsed = (int)stopwatch.Elapsed.TotalMilliseconds; //Debug.Log("[GENERAL]:time (s)" + timeElapsed/1000); } }
27.388
106
0.568278
[ "Apache-2.0" ]
salvolannister/Virtual_Shared_Reality_CLIENT
Virtual_Shared_Reality_CLIENT/Assets/Scripts/GetTotalScoreGeneral.cs
6,849
C#
// Licensed under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Linq; using Antlr4.Runtime.Misc; using AbsoluteGraphicsPlatform.AGPx.Models; using AbsoluteGraphicsPlatform.AGPx.Internal; using AbsoluteGraphicsPlatform.AGPx; using AbsoluteGraphicsPlatform.Templating; using AbsoluteGraphicsPlatform.AGPx.Instructions; namespace AbsoluteGraphicsPlatform.AGPx.Visitors { public class RulesetVisitor : DssParserVisitor<RulesetInstruction> { readonly RulesetSelectorVisitor rulesetSelectorVisitor; readonly StatementVisitor statementVisitor; public RulesetVisitor(DssRuntime dssRuntime, StatementVisitor statementVisitor) : base(dssRuntime) { rulesetSelectorVisitor = new RulesetSelectorVisitor(dssRuntime); this.statementVisitor = statementVisitor; } public override RulesetInstruction VisitRuleset([NotNull] Internal.DssParser.RulesetContext context) { var block = context.block(); var selector = context.selector().Accept(rulesetSelectorVisitor); var ruleset = new RulesetInstruction(); ruleset.Selector = selector; var statements = block.statement().Select(x => x.Accept(statementVisitor)).ToArray(); foreach (var statement in statements) ruleset.Instructions.Add(statement); return ruleset; } public class RulesetSelectorVisitor : DssParserVisitor<RuleSelector> { public RulesetSelectorVisitor(DssRuntime dssRuntime) : base(dssRuntime) { } public override RuleSelector VisitSelector([NotNull] Internal.DssParser.SelectorContext context) { var selectorPart = context.selectorPart(); if (selectorPart.NAME != null) return new RuleSelector(SelectorType.Name, selectorPart.NAME.GetText()); else if (selectorPart.CLASS != null) return new RuleSelector(SelectorType.Class, selectorPart.CLASS.GetText()); else if (selectorPart.COMPONENT != null) return new RuleSelector(SelectorType.Component, selectorPart.COMPONENT.GetText()); else throw new AGPxException("Unexpected parsing error", context.Start.Line, null); } } } }
38.4375
108
0.676016
[ "MIT" ]
evorine/AbsoluteGraphicsPlatform
src/AbsoluteGraphicsPlatform.AGPx.DSS/Visitors/RulesetVisitor.cs
2,462
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.AspNetCore.Routing.Template; public abstract class RoutePrecedenceTestsBase { [Theory] [InlineData("Employees/{id}", "Employees/{employeeId}")] [InlineData("abc", "def")] [InlineData("{x:alpha}", "{x:int}")] public void ComputeMatched_IsEqual(string xTemplate, string yTemplate) { // Arrange & Act var xPrededence = ComputeMatched(xTemplate); var yPrededence = ComputeMatched(yTemplate); // Assert Assert.Equal(xPrededence, yPrededence); } [Theory] [InlineData("Employees/{id}", "Employees/{employeeId}")] [InlineData("abc", "def")] [InlineData("{x:alpha}", "{x:int}")] public void ComputeGenerated_IsEqual(string xTemplate, string yTemplate) { // Arrange & Act var xPrededence = ComputeGenerated(xTemplate); var yPrededence = ComputeGenerated(yTemplate); // Assert Assert.Equal(xPrededence, yPrededence); } [Theory] [InlineData("abc", "a{x}")] [InlineData("abc", "{x}c")] [InlineData("abc", "{x:int}")] [InlineData("abc", "{x}")] [InlineData("abc", "{*x}")] [InlineData("{x:int}", "{x}")] [InlineData("{x:int}", "{*x}")] [InlineData("a{x}", "{x}")] [InlineData("{x}c", "{x}")] [InlineData("a{x}", "{*x}")] [InlineData("{x}c", "{*x}")] [InlineData("{x}", "{*x}")] [InlineData("{*x:maxlength(10)}", "{*x}")] [InlineData("abc/def", "abc/{x:int}")] [InlineData("abc/def", "abc/{x}")] [InlineData("abc/def", "abc/{*x}")] [InlineData("abc/{x:int}", "abc/{x}")] [InlineData("abc/{x:int}", "abc/{*x}")] [InlineData("abc/{x}", "abc/{*x}")] [InlineData("{x}/{y:int}", "{x}/{y}")] public void ComputeMatched_IsLessThan(string xTemplate, string yTemplate) { // Arrange & Act var xPrededence = ComputeMatched(xTemplate); var yPrededence = ComputeMatched(yTemplate); // Assert Assert.True(xPrededence < yPrededence); } [Theory] [InlineData("abc", "a{x}")] [InlineData("abc", "{x}c")] [InlineData("abc", "{x:int}")] [InlineData("abc", "{x}")] [InlineData("abc", "{*x}")] [InlineData("{x:int}", "{x}")] [InlineData("{x:int}", "{*x}")] [InlineData("a{x}", "{x}")] [InlineData("{x}c", "{x}")] [InlineData("a{x}", "{*x}")] [InlineData("{x}c", "{*x}")] [InlineData("{x}", "{*x}")] [InlineData("{*x:maxlength(10)}", "{*x}")] [InlineData("abc/def", "abc/{x:int}")] [InlineData("abc/def", "abc/{x}")] [InlineData("abc/def", "abc/{*x}")] [InlineData("abc/{x:int}", "abc/{x}")] [InlineData("abc/{x:int}", "abc/{*x}")] [InlineData("abc/{x}", "abc/{*x}")] [InlineData("{x}/{y:int}", "{x}/{y}")] public void ComputeGenerated_IsGreaterThan(string xTemplate, string yTemplate) { // Arrange & Act var xPrecedence = ComputeGenerated(xTemplate); var yPrecedence = ComputeGenerated(yTemplate); // Assert Assert.True(xPrecedence > yPrecedence); } [Fact] public void ComputeGenerated_TooManySegments_ThrowHumaneError() { var ex = Assert.Throws<InvalidOperationException>(() => { // Arrange & Act ComputeGenerated("{a}/{b}/{c}/{d}/{e}/{f}/{g}/{h}/{i}/{j}/{k}/{l}/{m}/{n}/{o}/{p}/{q}/{r}/{s}/{t}/{u}/{v}/{w}/{x}/{y}/{z}/{a2}/{b2}/{b3}"); }); // Assert Assert.Equal("Route exceeds the maximum number of allowed segments of 28 and is unable to be processed.", ex.Message); } [Fact] public void ComputeMatched_TooManySegments_ThrowHumaneError() { var ex = Assert.Throws<InvalidOperationException>(() => { // Arrange & Act ComputeMatched("{a}/{b}/{c}/{d}/{e}/{f}/{g}/{h}/{i}/{j}/{k}/{l}/{m}/{n}/{o}/{p}/{q}/{r}/{s}/{t}/{u}/{v}/{w}/{x}/{y}/{z}/{a2}/{b2}/{b3}"); }); // Assert Assert.Equal("Route exceeds the maximum number of allowed segments of 28 and is unable to be processed.", ex.Message); } protected abstract decimal ComputeMatched(string template); protected abstract decimal ComputeGenerated(string template); }
33.804688
151
0.558355
[ "MIT" ]
3ejki/aspnetcore
src/Http/Routing/test/UnitTests/Template/RoutePrecedenceTestsBase.cs
4,327
C#
namespace ResXManager.Model { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Globalization; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using ResXManager.Infrastructure; using TomsToolbox.Essentials; [DataContract] [TypeConverter(typeof(JsonSerializerTypeConverter<ResourceTableEntryRules>))] public sealed class ResourceTableEntryRules : INotifyChanged { private const string MutedRulePattern = @"@MutedRule\(([a-zA-Z]+)\)"; private const string MutedRuleFormat = @"@MutedRule({0})"; private static readonly Regex _mutedRuleExpression = new Regex(MutedRulePattern, RegexOptions.Compiled | RegexOptions.CultureInvariant); public const string Default = @"{""EnabledRules"": [ """ + ResourceTableEntryRulePunctuationLead.Id + @""", """ + ResourceTableEntryRulePunctuationTail.Id + @""", """ + ResourceTableEntryRuleStringFormat.Id + @""", """ + ResourceTableEntryRuleWhiteSpaceLead.Id + @""", """ + ResourceTableEntryRuleWhiteSpaceTail.Id + @""" ]}"; private IReadOnlyCollection<IResourceTableEntryRule>? _rules; private IDictionary<string, IResourceTableEntryRuleConfig>? _configurableRules; private IReadOnlyCollection<IResourceTableEntryRule> Rules => _rules ??= BuildRuleCollection(); public IDictionary<string, IResourceTableEntryRuleConfig> ConfigurableRules => _configurableRules ??= new ReadOnlyDictionary<string, IResourceTableEntryRuleConfig>(Rules.Cast<IResourceTableEntryRuleConfig>().ToDictionary(rule => rule.RuleId)); public bool IsEnabled(string? ruleId) { if (ruleId.IsNullOrEmpty()) return false; return ConfigurableRules!.GetValueOrDefault(ruleId)?.IsEnabled ?? false; } [DataMember(Name = "EnabledRules")] public IEnumerable<string> EnabledRuleIds { get => Rules.Where(r => r.IsEnabled).Select(r => r.RuleId); set { var valueSet = new HashSet<string>(value, StringComparer.OrdinalIgnoreCase); foreach (var rule in Rules) { rule.IsEnabled = valueSet.Contains(rule.RuleId); } } } private IReadOnlyCollection<IResourceTableEntryRule> BuildRuleCollection() { var rules = new List<IResourceTableEntryRule> { new ResourceTableEntryRuleStringFormat(), new ResourceTableEntryRuleWhiteSpaceLead(), new ResourceTableEntryRuleWhiteSpaceTail(), new ResourceTableEntryRulePunctuationLead(), new ResourceTableEntryRulePunctuationTail(), }; // Init default values foreach (var rule in rules) { rule.IsEnabled = true; rule.PropertyChanged += (sender, args) => OnChanged(); } return rules.AsReadOnly(); } internal bool CompliesToRules(ICollection<string> mutedRuleIds, string? reference, string? value, out IList<string> messages) { return CompliesToRules(mutedRuleIds, reference, new[] { value }, out messages); } internal bool CompliesToRules(ICollection<string> mutedRuleIds, string? reference, ICollection<string?> values, out IList<string> messages) { var result = new List<string>(); foreach (var rule in Rules.Where(r => r.IsEnabled && !mutedRuleIds.Contains(r.RuleId))) { if (rule.CompliesToRule(reference, values, out var message)) continue; result.Add(message); } messages = result; return result.Count == 0; } public event EventHandler? Changed; private void OnChanged() { Changed?.Invoke(this, EventArgs.Empty); } internal static IEnumerable<string> GetMutedRuleIds(string? comment) { if (string.IsNullOrWhiteSpace(comment)) return Enumerable.Empty<string>(); var rules = _mutedRuleExpression .Matches(comment) .Cast<Match>() .Where(match => match.Success) .Select(match => match.Groups[1].Value); return rules; } internal static string SetMutedRuleIds(string? comment, ISet<string> mutedRuleIds) { var commentBuilder = new StringBuilder(comment ?? string.Empty); if (!string.IsNullOrWhiteSpace(comment)) { // Existing comment. We may need to strip old muting values. var matches = _mutedRuleExpression.Matches(comment) .Cast<Match>() .Where(match => match.Success) .Reverse(); foreach (var match in matches) { if (!mutedRuleIds.Remove(match.Groups[1].Value)) { commentBuilder.Remove(match.Index, match.Length); } } } foreach (var rule in mutedRuleIds) { commentBuilder.AppendFormat(CultureInfo.InvariantCulture, MutedRuleFormat, rule); } return commentBuilder.ToString(); } } }
36.367089
252
0.580926
[ "MIT" ]
Dalagh/ResXResourceManager
src/ResXManager.Model/ResourceTableEntryRules.cs
5,748
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.Graphics; using Android.OS; using Android.Runtime; using Android.Views; using Android.Widget; using Java.Lang; namespace DualView { public class Item : Java.Lang.Object, IParcelable { public const string KEY = "item"; internal Item(string title, PointF l) { Title = title; Location = l; } public string Title { get; private set; } public PointF Location { get; private set; } public int DescribeContents() => 0; public override string ToString() => Title; public static IParcelableCreator CREATOR => new ItemCreator(); public void WriteToParcel(Parcel dest, [GeneratedEnum] ParcelableWriteFlags flags) { dest.WriteString(Title); dest.WriteFloat(Location.X); dest.WriteFloat(Location.Y); } public static List<Item> Items => new List<Item> { new Item("New York", new PointF(40.7128f, -74.0060f)), new Item("Seattle", new PointF(47.6062f, -122.3425f)), new Item("Palo Alto", new PointF(37.444184f, -122.161059f)), new Item("San Francisco", new PointF(37.7542f, -122.4471f)) }; } public class ItemCreator : Java.Lang.Object, IParcelableCreator { public Java.Lang.Object CreateFromParcel(Parcel source) { var title = source.ReadString(); var x = source.ReadFloat(); var y = source.ReadFloat(); var location = new PointF(x, y); return new Item(title, location); } public Java.Lang.Object[] NewArray(int size) { return new Java.Lang.Object[size]; } } }
22.333333
84
0.69403
[ "MIT" ]
LanceMcCarthy/surface-duo-sdk-xamarin-samples
DualView/Item.cs
1,610
C#
using System; namespace Icu { public enum USystemTimeZoneType { Any, Canonical, CanonicalLocation, } }
9.416667
32
0.716814
[ "MIT" ]
atlastodor/icu-dotnet
source/icu.net/Timezone/USystemTimeZoneType.cs
113
C#
using System.Collections.Generic; using JetBrains.Annotations; using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; namespace GettingStarted.Models { [UsedImplicitly(ImplicitUseTargetFlags.Members)] public sealed class Person : Identifiable { [Attr] public string Name { get; set; } [HasMany] public ICollection<Book> Books { get; set; } } }
23.388889
52
0.710214
[ "MIT" ]
3volutionsAG/JsonApiDotNetCore
src/Examples/GettingStarted/Models/Person.cs
421
C#
using System; //属于组件 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public class GameComp : Attribute { } //属于Mono组件 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public class GameMonoComp : Attribute { }
17.4375
80
0.763441
[ "MIT" ]
yogioh123456/IndieFramework
Server/IDServer/IDServer/Entity/GameComp.cs
297
C#
namespace Kaiyuanshe.OpenHackathon.Server.Biz.Options { public class TeamQueryOptions : TableQueryOptions { } }
18.714286
55
0.70229
[ "MIT" ]
kaiyuanshe/open-hackathon-api
src/open-hackathon-server/Kaiyuanshe.OpenHackathon.Server/Biz/Options/TeamQueryOptions.cs
133
C#
// // Class.cs // // Author: // Jb Evain (jbevain@gmail.com) // // (C) 2005 Jb Evain // // 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. // namespace CilStrip.Mono.Cecil.Signatures { using CilStrip.Mono.Cecil.Metadata; internal sealed class CLASS : SigType { public MetadataToken Type; public CLASS () : base (ElementType.Class) { } } }
32.880952
73
0.741492
[ "MIT" ]
Danyy427/runtime-assets
src/Microsoft.DotNet.CilStrip.Sources/src/Mono.Cecil.Signatures/Class.cs
1,381
C#
namespace App { class Location3d { public double LatitudeInRadians {get; } public double LongitudeInRadians {get; } public double AltitudeMslInMeters {get; } public Location3d(double latitudeInRadians, double longitudeInRadians, double altitudeMslInMeters) { LatitudeInRadians = latitudeInRadians; LongitudeInRadians = longitudeInRadians; AltitudeMslInMeters = altitudeMslInMeters; } } }
28.529412
106
0.663918
[ "MIT" ]
mclayton7/MavLinkTest
Location3d.cs
485
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; using ICSharpCode.SharpZipLib.Core; using ICSharpCode.SharpZipLib.Zip; namespace SketchupMaterialGenerator { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } string DOCUMENT_XML_NAME = "document.xml"; string REFERENCES_XML_NAME = "references.xml"; string DOCUMENT_PROPERTIES_XML_NAME = "documentProperties.xml"; string DOC_THUMBNAIL_PNG_NAME = "doc_thumbnail.png"; string references_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?><references xmlns=\"http://sketchup.google.com/schemas/1.0/references\" xmlns:r=\"http://sketchup.google.com/schemas/1.0/references\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://sketchup.google.com/schemas/1.0/references http://sketchup.google.com/schemas/1.0/references.xsd\" />"; private string Get_DocumentPropertiesXml(string materialName) { return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?><documentProperties xmlns=\"http://sketchup.google.com/schemas/1.0/documentproperties\" xmlns:dp=\"http://sketchup.google.com/schemas/1.0/documentproperties\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://sketchup.google.com/schemas/1.0/documentproperties http://sketchup.google.com/schemas/1.0/documentproperties.xsd\">" +"<dp:title>" + materialName + "</dp:title>" +"<dp:description></dp:description><dp:creator></dp:creator><dp:keywords></dp:keywords><dp:lastModifiedBy></dp:lastModifiedBy><dp:revision>0</dp:revision>" +"<dp:created>2022-03-21T16:07:58Z</dp:created><dp:modified>2022-03-21T16:07:58Z</dp:modified>" +"<dp:thumbnail>doc_thumbnail.png</dp:thumbnail>" +"<dp:generator dp:name=\"Material\" dp:version=\"1\" /></documentProperties>"; } private string Get_DocumentXml(string materialName, string originalFilePath, double scale) { string textureFileName = Path.GetFileName(originalFilePath); return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?><materialDocument xmlns=\"http://sketchup.google.com/schemas/sketchup/1.0/material\" xmlns:mat=\"http://sketchup.google.com/schemas/sketchup/1.0/material\" xmlns:r=\"http://sketchup.google.com/schemas/1.0/references\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://sketchup.google.com/schemas/sketchup/1.0/material http://sketchup.google.com/schemas/sketchup/1.0/material.xsd\">" + "<mat:material name=\"" + materialName + "\" type=\"1\" colorRed=\"255\" colorGreen=\"255\" colorBlue=\"255\" colorizeType=\"0\" trans=\"0.5\" useTrans=\"0\" hasTexture=\"1\">" + "<mat:texture textureFilename=\"" + textureFileName //originalFilePath + "\" xScale=\""+scale.ToString().Replace(",",".")+"\" yScale=\"1.0\" avgColor=\"4294967295\"><mat:images>" + "<mat:image id=\"1\" path=\""+textureFileName+"\" />" + "</mat:images></mat:texture></mat:material></materialDocument>"; } public string[] GetImageFiles(string dir) { return Directory.GetFiles(dir, "*.*", chkSearchSubfolders.Checked?SearchOption.AllDirectories:SearchOption.TopDirectoryOnly) .Where(s => s.ToLower().EndsWith(".png", ".bmp", ".jpg", ".jpeg", ".jpe", ".gif", ".tiff")).ToArray<string>(); } private ImageFormat GetImageFormatFromFileName(string filePath) { string ext = Path.GetExtension(filePath).ToLower(); //rtxt.AppendText(ext + "\n"); if (ext == ".bmp") return ImageFormat.Bmp; else if (ext == ".png") return ImageFormat.Png; else if (ext == ".jpg" || ext == ".jpe" || ext == ".jpeg") return ImageFormat.Jpeg; else if (ext == ".gif") return ImageFormat.Gif; else if (ext == ".tiff") return ImageFormat.Tiff; else return ImageFormat.Jpeg; } private bool SelectFolder(out string path) { //CommonOpenFileDialog = cofd new CommonOpenFileDialog(); path = ""; OpenFileDialog ofd = new OpenFileDialog(); ofd.ValidateNames = false; ofd.CheckFileExists = false; ofd.FileName = "(select folder)"; ofd.Title = "Select the folder"; ofd.InitialDirectory = Application.StartupPath; DialogResult dr = ofd.ShowDialog(); if (dr != DialogResult.OK) return false; path = Path.GetDirectoryName(ofd.FileName); return true; } private void btnSelectFolder_Click(object sender, EventArgs e) { string dir = ""; if (!SelectFolder(out dir)) return; rtxt.Clear(); generate(dir); } private void generate(string dir) { string[] sourceFiles = GetImageFiles(dir); foreach (string file in sourceFiles) generateMaterialFrom(file); } private void generateMaterialFrom(string filePath) { string fileDir = Path.GetDirectoryName(filePath); string fileName = Path.GetFileName(filePath); string materialName = Path.GetFileNameWithoutExtension(fileName); string filePathWithoutExtension = Path.GetFileNameWithoutExtension(filePath); string materialFilePath = fileDir + "\\" + filePathWithoutExtension + ".skm"; MemoryStream references_xml_ms = new MemoryStream(UTF8Encoding.Default.GetBytes(references_xml)); FileStream fs = new FileStream(materialFilePath, FileMode.Create); ZipOutputStream zos = new ZipOutputStream(fs); zos.UseZip64 = UseZip64.Off; zos.SetLevel(0); Image srcImg = Image.FromFile(filePath); zos.AddStringEntry(REFERENCES_XML_NAME, references_xml); zos.AddStringEntry(DOCUMENT_XML_NAME, Get_DocumentXml(materialName, filePath, ((double)srcImg.Width/(double)srcImg.Height))); zos.AddStringEntry(DOCUMENT_PROPERTIES_XML_NAME, Get_DocumentPropertiesXml(materialName)); zos.AddImageEntry("ref\\" + fileName, srcImg, GetImageFormatFromFileName(fileName)); zos.AddImageEntry(DOC_THUMBNAIL_PNG_NAME, srcImg, ImageFormat.Png); zos.Finish(); zos.Close(); fs.Close(); rtxt.AppendText(materialFilePath + " [DONE]\n"); } private string getDimensionsFast(string dir) { string res = ""; // Get all files from sourcefolder, including subfolders. string[] sourceFiles = GetImageFiles(dir); foreach (string file in sourceFiles) { using (Stream stream = File.OpenRead(file)) { using (Image sourceImage = Image.FromStream(stream, false, false)) { int w = sourceImage.Width; int h = sourceImage.Height; double r = (double)w / (double)h; res += file + " W:" + w + ", H:" + h + ", ratio:" + r + "\n"; } } } return res; } } public static class StringExt { public static bool EndsWith(this string ts, params string[] any) { for (int i = 0; i < any.Length; i++) { if (ts.EndsWith(any[i])) return true; } return false; } } public static class ZipExt { public static void AddStreamEntry(this ZipOutputStream zos, string entryName, MemoryStream ms) { ZipEntry ze = new ZipEntry(entryName); ze.DateTime = DateTime.Now; zos.PutNextEntry(ze); ICSharpCode.SharpZipLib.Core.StreamUtils.Copy(ms, zos, new byte[ms.Length]); zos.CloseEntry(); } public static void AddStringEntry(this ZipOutputStream zos, string entryName, string text) { byte[] bytes = UTF8Encoding.Default.GetBytes(text); MemoryStream ms = new MemoryStream(bytes); zos.AddStreamEntry(entryName, ms); } public static void AddImageEntry(this ZipOutputStream zos, string entryName, Image image, ImageFormat imageFormat) { MemoryStream ms = new MemoryStream(); image.Save(ms, imageFormat); ms = new MemoryStream(ms.ToArray()); zos.AddStreamEntry(entryName, ms); } } }
46.188776
497
0.601348
[ "MIT" ]
manicken/SketchupMaterialGenerator
.localhistory/G/_githubClones/SketchupMaterialGenerator/1647932242$MainForm.cs
9,055
C#
using System; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Security; using System.Threading.Tasks; using Microsoft.AspNet.SignalR.Client; namespace JabbR.Client { public class DefaultAuthenticationProvider : IAuthenticationProvider { private readonly string _url; public DefaultAuthenticationProvider(string url) { _url = url; } public async Task<HubConnection> Connect(string userName, string password) { var authUri = new UriBuilder(_url); authUri.Path += authUri.Path.EndsWith("/") ? "account/login" : "/account/login"; var cookieJar = new CookieContainer(); #if PORTABLE var handler = new HttpClientHandler { #else var handler = new WebRequestHandler { #endif CookieContainer = cookieJar }; var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("sec-jabbr-client", "1"); var parameters = new Dictionary<string, string> { { "username" , userName }, { "password" , password } }; var response = await client.PostAsync(authUri.Uri, new FormUrlEncodedContent(parameters)); response.EnsureSuccessStatusCode(); // Create a hub connection and give it our cookie jar var connection = new HubConnection(_url) { CookieContainer = cookieJar }; connection.Headers.Add("sec-jabbr-client", "1"); return connection; } } }
27.766667
102
0.590636
[ "MIT" ]
FaytLeingod007/JabbR
JabbR.Client/DefaultAuthenticationProvider.cs
1,668
C#
using System; namespace TSI.Utils.Shipping.Endicia.Interfaces { public interface ILabel { string FileOnly { get; } string FullPathFileName { get; } string Link { get; } } }
9.318182
47
0.629268
[ "Apache-2.0" ]
neerajkhosla/endiciaApi
TSI.Utils.Shipping.Endicia/TSI.Utils.Shipping.Endicia/Interfaces/ILabel.cs
205
C#
using System.Collections.Generic; using System.Linq; using System.Reflection; using FubuMVC.Core.Projections; using FubuMVC.Core.Registration; using FubuMVC.Core.Resources.Conneg; using FubuMVC.Core.Runtime; using Shouldly; using NUnit.Framework; namespace FubuMVC.Tests.Resources.Conneg { [TestFixture] public class ConnegGraphTester { private readonly ConnegGraph graph = ConnegGraph.Build(new BehaviorGraph { ApplicationAssembly = Assembly.GetExecutingAssembly() }).Result(); [Test] public void build_conneg_graph_for_the_app_domain() {; graph.Writers.ShouldContain(typeof(Resource1Writer1)); graph.Writers.ShouldContain(typeof(Resource1Writer2)); graph.Writers.ShouldContain(typeof(Resource1Writer3)); graph.Writers.ShouldContain(typeof(Resource2Writer1)); graph.Writers.ShouldContain(typeof(Resource2Writer2)); graph.Writers.ShouldContain(typeof(Resource2Writer3)); graph.Readers.ShouldContain(typeof(Input1Reader1)); graph.Readers.ShouldContain(typeof(Input1Reader2)); graph.Readers.ShouldContain(typeof(Input2Reader)); } [Test] public void find_writers_for_resource_type() { graph.WriterTypesFor(typeof(Resource2)).ShouldHaveTheSameElementsAs(typeof(Resource2Writer1), typeof(Resource2Writer2), typeof(Resource2Writer3)); } [Test] public void find_readers_for_input_type() { graph.ReaderTypesFor(typeof (Input2)).Single() .ShouldBe(typeof (Input2Reader)); } } public class Input1{} public class Input2{} public class Resource1{} public class Resource2{} public class Resource1Writer1 : Projection<Resource1>{} public class Resource1Writer2 : Projection<Resource1>{} public class Resource1Writer3 : Projection<Resource1>{} public class Resource2Writer1 : Projection<Resource2>{} public class Resource2Writer2 : Projection<Resource2>{} public class Resource2Writer3 : Projection<Resource2>{} public class Input1Reader1 : IReader<Input1> { public IEnumerable<string> Mimetypes { get; private set; } public Input1 Read(string mimeType, IFubuRequestContext context) { throw new System.NotImplementedException(); } } public class Input1Reader2 : Input1Reader1{} public class Input2Reader : IReader<Input2> { public IEnumerable<string> Mimetypes { get; private set; } public Input2 Read(string mimeType, IFubuRequestContext context) { throw new System.NotImplementedException(); } } }
32.790698
159
0.66383
[ "Apache-2.0" ]
JohnnyKapps/fubumvc
src/FubuMVC.Tests/Resources/Conneg/ConnegGraphTester.cs
2,822
C#
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // <auto-generated/> // Template Source: Templates\CSharp\Model\EntityType.cs.tt namespace Microsoft.Graph { using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using Newtonsoft.Json; /// <summary> /// The type Time Off Reason. /// </summary> [JsonObject(MemberSerialization = MemberSerialization.OptIn)] public partial class TimeOffReason : ChangeTrackedEntity { /// <summary> /// Gets or sets display name. /// </summary> [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "displayName", Required = Newtonsoft.Json.Required.Default)] public string DisplayName { get; set; } /// <summary> /// Gets or sets icon type. /// </summary> [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "iconType", Required = Newtonsoft.Json.Required.Default)] public TimeOffReasonIconType? IconType { get; set; } /// <summary> /// Gets or sets is active. /// </summary> [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "isActive", Required = Newtonsoft.Json.Required.Default)] public bool? IsActive { get; set; } } }
37.304348
153
0.599068
[ "MIT" ]
gurry/msgraph-beta-sdk-dotnet
src/Microsoft.Graph/Models/Generated/TimeOffReason.cs
1,716
C#
using System; using System.Collections.Generic; using System.Linq; using AutobiographicMemory; using Conditions; using EmotionalAppraisal.Components; using EmotionalAppraisal.DTOs; using EmotionalAppraisal.OCCModel; using SerializationUtilities; using KnowledgeBase; using WellFormedNames; using WellFormedNames.Collections; using IQueryable = WellFormedNames.IQueryable; namespace EmotionalAppraisal.AppraisalRules { /// <summary> /// Default reactive module implementation. /// It evaluates events through a evaluatorSet of rules, and determines the emotional reaction of that event. /// It then generates appropriate actions base on the agent's emotional state. /// </summary> /// @author João Dias /// @author Pedro Gonçalves [Serializable] public class ReactiveAppraisalDerivator : IAppraisalDerivator, ICustomSerialization { private const short DEFAULT_APPRAISAL_WEIGHT = 1; private NameSearchTree<HashSet<AppraisalRule>> Rules; public ReactiveAppraisalDerivator() { this.AppraisalWeight = DEFAULT_APPRAISAL_WEIGHT; this.Rules = new NameSearchTree<HashSet<AppraisalRule>>(); } public AppraisalRule Evaluate(IBaseEvent evt, IQueryable kb, Name perspective) { var auxEvt = evt.EventName.SwapTerms(perspective, Name.SELF_SYMBOL); foreach (var possibleAppraisals in this.Rules.Unify(auxEvt)) { //This next for loop is to prevent a problem with using appraisal rules that contain SELF //This will replace all the subs with SELF with the name of the perspective foreach (var sub in possibleAppraisals.Item2) { if (sub.SubValue.Value == Name.SELF_SYMBOL) { sub.SubValue = new ComplexValue(perspective); } } var substitutions = new[] { possibleAppraisals.Item2 }; //this adds the subs found in the eventName foreach (var appRule in possibleAppraisals.Item1) { var finalSubsList = appRule.Conditions.Unify(kb, Name.SELF_SYMBOL, substitutions); //The appraisal will only consider the substitution set that it has the most certainty in var mostCertainSubSet = this.DetermineSubstitutionSetWithMostCertainty(finalSubsList); if (mostCertainSubSet != null) { appRule.Desirability = appRule.Desirability.MakeGround(mostCertainSubSet); appRule.Praiseworthiness = appRule.Praiseworthiness.MakeGround(mostCertainSubSet); if (!appRule.Desirability.IsGrounded || !appRule.Praiseworthiness.IsGrounded) { return null; } //Modify the appraisal variables based on the certainty of the substitutions var minCertainty = mostCertainSubSet.FindMinimumCertainty(); var aux = float.Parse(appRule.Desirability.ToString()) * minCertainty; appRule.Desirability = Name.BuildName(aux); aux = float.Parse(appRule.Praiseworthiness.ToString()) * minCertainty; appRule.Praiseworthiness = Name.BuildName(aux); return appRule; } } } return null; } private SubstitutionSet DetermineSubstitutionSetWithMostCertainty(IEnumerable<SubstitutionSet> subSets) { SubstitutionSet result = null; var max = float.MinValue; foreach (var subSet in subSets) { var minCertainty = subSet.FindMinimumCertainty(); if(minCertainty > max) { max = minCertainty; result = subSet; } } return result; } /// <summary> /// Adds an emotional reaction to an event /// </summary> /// <param name="emotionalAppraisalRule">the AppraisalRule to add</param> public void AddOrUpdateAppraisalRule(AppraisalRuleDTO emotionalAppraisalRuleDTO) { AppraisalRule existingRule = GetAppraisalRule(emotionalAppraisalRuleDTO.Id); if (existingRule != null) { RemoveAppraisalRule(existingRule); existingRule.Desirability = emotionalAppraisalRuleDTO.Desirability; existingRule.Praiseworthiness = emotionalAppraisalRuleDTO.Praiseworthiness; existingRule.EventName = emotionalAppraisalRuleDTO.EventMatchingTemplate; existingRule.Conditions = new ConditionSet(emotionalAppraisalRuleDTO.Conditions); } else { existingRule = new AppraisalRule(emotionalAppraisalRuleDTO); } AddEmotionalReaction(existingRule); } public void AddEmotionalReaction(AppraisalRule appraisalRule) { var name = appraisalRule.EventName; HashSet<AppraisalRule> ruleSet; if (!Rules.TryGetValue(name, out ruleSet)) { ruleSet = new HashSet<AppraisalRule>(); Rules.Add(name, ruleSet); } ruleSet.Add(appraisalRule); } public void RemoveAppraisalRule(AppraisalRule appraisalRule) { HashSet<AppraisalRule> ruleSet; if (Rules.TryGetValue(appraisalRule.EventName, out ruleSet)) { AppraisalRule ruleToRemove = null; foreach (var rule in ruleSet) { if (rule.Id == appraisalRule.Id) { ruleToRemove = rule; } } if (ruleToRemove != null) { ruleSet.Remove(ruleToRemove); } } } public AppraisalRule GetAppraisalRule(Guid id) { return Rules.SelectMany(r => r.Value).FirstOrDefault(a => a.Id == id); } public IEnumerable<AppraisalRule> GetAppraisalRules() { return Rules.Values.SelectMany(set => set); } #region IAppraisalDerivator Implementation public short AppraisalWeight { get; set; } public void Appraisal(KB kb, IBaseEvent evt, IWritableAppraisalFrame frame) { AppraisalRule activeRule = Evaluate(evt, kb, kb.Perspective); if (activeRule != null) { if (activeRule.Desirability != null) { float des; if (!float.TryParse(activeRule.Desirability.ToString(), out des)) { throw new ArgumentException("Desirability can only be a float value"); } frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, des); } if (activeRule.Praiseworthiness != null) { float p; if (!float.TryParse(activeRule.Praiseworthiness.ToString(), out p)) { throw new ArgumentException("Desirability can only be a float value"); } frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, p); } } } #endregion #region Custom Serializer public void GetObjectData(ISerializationData dataHolder, ISerializationContext context) { dataHolder.SetValue("AppraisalWeight",AppraisalWeight); dataHolder.SetValue("Rules",Rules.Values.SelectMany(set => set).ToArray()); } public void SetObjectData(ISerializationData dataHolder, ISerializationContext context) { AppraisalWeight = dataHolder.GetValue<short>("AppraisalWeight"); var rules = dataHolder.GetValue<AppraisalRule[]>("Rules"); if(Rules==null) Rules = new NameSearchTree<HashSet<AppraisalRule>>(); else Rules.Clear(); foreach (var r in rules) { r.Id = Guid.NewGuid(); if (r.Desirability == null) { r.Desirability = (Name)"0"; } if (r.Praiseworthiness == null) { r.Praiseworthiness = (Name)"0"; } AddEmotionalReaction(r); } } #endregion } }
34.483471
112
0.597484
[ "Apache-2.0" ]
RicardoQuinteiro/FAtiMA-Toolkit
Assets/EmotionalAppraisal/AppraisalRules/ReactiveAppraisalDerivator.cs
8,349
C#
using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; using System.Text; using HandlebarsDotNet.StringUtils; namespace HandlebarsDotNet { /// <summary> /// <inheritdoc /> /// Produces <c>HTML</c> safe output. /// </summary> public class HtmlEncoder : ITextEncoder { [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Encode(StringBuilder text, TextWriter target) { if(text == null || text.Length == 0) return; EncodeImpl(new StringBuilderEnumerator(text), target); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Encode(string text, TextWriter target) { if(string.IsNullOrEmpty(text)) return; EncodeImpl(new StringEnumerator(text), target); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Encode<T>(T text, TextWriter target) where T : IEnumerator<char> { if(text == null) return; EncodeImpl(text, target); } private static void EncodeImpl<T>(T text, TextWriter target) where T : IEnumerator<char> { /* * Based on: https://github.com/handlebars-lang/handlebars.js/blob/master/lib/handlebars/utils.js * As of 2021-12-20 / commit https://github.com/handlebars-lang/handlebars.js/commit/3fb331ef40ee1a8308dd83b8e5adbcd798d0adc9 */ while (text.MoveNext()) { var value = text.Current; switch (value) { case '&': target.Write("&amp;"); break; case '<': target.Write("&lt;"); break; case '>': target.Write("&gt;"); break; case '"': target.Write("&quot;"); break; case '\'': target.Write("&#x27;"); break; case '`': target.Write("&#x60;"); break; case '=': target.Write("&#x3D;"); break; default: target.Write(value); break; } } } } }
32.708861
137
0.456656
[ "MIT" ]
Dragwar/Handlebars.Net
source/Handlebars/IO/HtmlEncoder.cs
2,586
C#
/* This code is derived from jgit (http://eclipse.org/jgit). Copyright owners are documented in jgit's IP log. This program and the accompanying materials are made available under the terms of the Eclipse Distribution License v1.0 which accompanies this distribution, is reproduced below, and is available at http://www.eclipse.org/org/documents/edl-v10.php All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System.Collections.Generic; using NGit; using NGit.Storage.File; using NGit.Transport; using Sharpen; namespace NGit.Transport { /// <summary>Lists known refs from the remote and copies objects of selected refs.</summary> /// <remarks> /// Lists known refs from the remote and copies objects of selected refs. /// <p> /// A fetch connection typically connects to the <code>git-upload-pack</code> /// service running where the remote repository is stored. This provides a /// one-way object transfer service to copy objects from the remote repository /// into this local repository. /// <p> /// Instances of a FetchConnection must be created by a /// <see cref="Transport">Transport</see> /// that /// implements a specific object transfer protocol that both sides of the /// connection understand. /// <p> /// FetchConnection instances are not thread safe and may be accessed by only one /// thread at a time. /// </remarks> /// <seealso cref="Transport">Transport</seealso> public interface FetchConnection : Connection { /// <summary>Fetch objects we don't have but that are reachable from advertised refs. /// </summary> /// <remarks> /// Fetch objects we don't have but that are reachable from advertised refs. /// <p> /// Only one call per connection is allowed. Subsequent calls will result in /// <see cref="NGit.Errors.TransportException">NGit.Errors.TransportException</see> /// . /// </p> /// <p> /// Implementations are free to use network connections as necessary to /// efficiently (for both client and server) transfer objects from the remote /// repository into this repository. When possible implementations should /// avoid replacing/overwriting/duplicating an object already available in /// the local destination repository. Locally available objects and packs /// should always be preferred over remotely available objects and packs. /// <see cref="Transport.IsFetchThin()">Transport.IsFetchThin()</see> /// should be honored if applicable. /// </p> /// </remarks> /// <param name="monitor"> /// progress monitor to inform the end-user about the amount of /// work completed, or to indicate cancellation. Implementations /// should poll the monitor at regular intervals to look for /// cancellation requests from the user. /// </param> /// <param name="want"> /// one or more refs advertised by this connection that the caller /// wants to store locally. /// </param> /// <param name="have"> /// additional objects known to exist in the destination /// repository, especially if they aren't yet reachable by the ref /// database. Connections should take this set as an addition to /// what is reachable through all Refs, not in replace of it. /// </param> /// <exception cref="NGit.Errors.TransportException"> /// objects could not be copied due to a network failure, /// protocol error, or error on remote side, or connection was /// already used for fetch. /// </exception> void Fetch(ProgressMonitor monitor, ICollection<Ref> want, ICollection<ObjectId> have); /// <summary> /// Did the last /// <see cref="Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection{E}, System.Collections.Generic.ICollection{E}) /// ">Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection&lt;E&gt;, System.Collections.Generic.ICollection&lt;E&gt;) /// </see> /// get tags? /// <p> /// Some Git aware transports are able to implicitly grab an annotated tag if /// <see cref="TagOpt.AUTO_FOLLOW">TagOpt.AUTO_FOLLOW</see> /// or /// <see cref="TagOpt.FETCH_TAGS">TagOpt.FETCH_TAGS</see> /// was selected and /// the object the tag peels to (references) was transferred as part of the /// last /// <see cref="Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection{E}, System.Collections.Generic.ICollection{E}) /// ">Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection&lt;E&gt;, System.Collections.Generic.ICollection&lt;E&gt;) /// </see> /// call. If it is /// possible for such tags to have been included in the transfer this method /// returns true, allowing the caller to attempt tag discovery. /// <p> /// By returning only true/false (and not the actual list of tags obtained) /// the transport itself does not need to be aware of whether or not tags /// were included in the transfer. /// </summary> /// <returns> /// true if the last fetch call implicitly included tag objects; /// false if tags were not implicitly obtained. /// </returns> bool DidFetchIncludeTags(); /// <summary> /// Did the last /// <see cref="Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection{E}, System.Collections.Generic.ICollection{E}) /// ">Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection&lt;E&gt;, System.Collections.Generic.ICollection&lt;E&gt;) /// </see> /// validate /// graph? /// <p> /// Some transports walk the object graph on the client side, with the client /// looking for what objects it is missing and requesting them individually /// from the remote peer. By virtue of completing the fetch call the client /// implicitly tested the object connectivity, as every object in the graph /// was either already local or was requested successfully from the peer. In /// such transports this method returns true. /// <p> /// Some transports assume the remote peer knows the Git object graph and is /// able to supply a fully connected graph to the client (although it may /// only be transferring the parts the client does not yet have). Its faster /// to assume such remote peers are well behaved and send the correct /// response to the client. In such transports this method returns false. /// </summary> /// <returns> /// true if the last fetch had to perform a connectivity check on the /// client side in order to succeed; false if the last fetch assumed /// the remote peer supplied a complete graph. /// </returns> bool DidFetchTestConnectivity(); /// <summary>Set the lock message used when holding a pack out of garbage collection. /// </summary> /// <remarks> /// Set the lock message used when holding a pack out of garbage collection. /// <p> /// Callers that set a lock message <b>must</b> ensure they call /// <see cref="GetPackLocks()">GetPackLocks()</see> /// after /// <see cref="Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection{E}, System.Collections.Generic.ICollection{E}) /// ">Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection&lt;E&gt;, System.Collections.Generic.ICollection&lt;E&gt;) /// </see> /// , even if an exception /// was thrown, and release the locks that are held. /// </remarks> /// <param name="message">message to use when holding a pack in place.</param> void SetPackLockMessage(string message); /// <summary> /// All locks created by the last /// <see cref="Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection{E}, System.Collections.Generic.ICollection{E}) /// ">Fetch(NGit.ProgressMonitor, System.Collections.Generic.ICollection&lt;E&gt;, System.Collections.Generic.ICollection&lt;E&gt;) /// </see> /// call. /// </summary> /// <returns> /// collection (possibly empty) of locks created by the last call to /// fetch. The caller must release these after refs are updated in /// order to safely permit garbage collection. /// </returns> ICollection<PackLock> GetPackLocks(); } }
45.120192
134
0.726265
[ "BSD-3-Clause" ]
Kavisha90/IIT-4th-year
NGit/NGit.Transport/FetchConnection.cs
9,385
C#
using UnityEngine; public class HitTarget : MonoBehaviour { // These public fields become settable properties in the Unity editor. public GameObject underworld; public GameObject objectToHide; // Occurs when this object starts colliding with another object void OnCollisionEnter(Collision collision) { // Hide the stage and show the underworld. objectToHide.SetActive(false); underworld.SetActive(true); // Disable Spatial Mapping to let the spheres enter the underworld. SpatialMapping.Instance.MappingEnabled = false; } }
31.315789
75
0.715966
[ "MIT" ]
NCEghtebas/HoloLensZoomAR
Origami/Assets/Scripts/HitTarget.cs
597
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using LanguageServer.Json; #pragma warning disable SA1402 // File may only contain a single type namespace LanguageServer { /// <nodoc /> public static class Message { /// <nodoc /> public static Result<T, TError> ToResult<T, TError>(ResponseMessage<T, TError> response) where TError : ResponseError { return (response.error == null) ? Result<T, TError>.Success(response.result) : Result<T, TError>.Error(response.error); } /// <nodoc /> public static VoidResult<TError> ToResult<TError>(VoidResponseMessage<TError> response) where TError : ResponseError { return (response.error == null) ? VoidResult<TError>.Success() : VoidResult<TError>.Error(response.error); } /// <nodoc /> public static ResponseError ParseError(string message = "Parse error") => new ResponseError { code = ErrorCodes.ParseError, message = message }; /// <nodoc /> public static ResponseError<T> ParseError<T>(T data, string message = "Parse error") => new ResponseError<T> { code = ErrorCodes.ParseError, message = message, data = data }; /// <nodoc /> public static ResponseError InvalidRequest(string message = "Invalid Request") => new ResponseError { code = ErrorCodes.InvalidRequest, message = message }; /// <nodoc /> public static ResponseError<T> InvalidRequest<T>(T data, string message = "Invalid Request") => new ResponseError<T> { code = ErrorCodes.InvalidRequest, message = message, data = data }; /// <nodoc /> public static ResponseError MethodNotFound(string message = "Method not found") => new ResponseError { code = ErrorCodes.MethodNotFound, message = message }; /// <nodoc /> public static ResponseError<T> MethodNotFound<T>(T data, string message = "Method not found") => new ResponseError<T> { code = ErrorCodes.MethodNotFound, message = message, data = data }; /// <nodoc /> public static ResponseError InvalidParams(string message = "Invalid params") => new ResponseError { code = ErrorCodes.InvalidParams, message = message }; /// <nodoc /> public static ResponseError<T> InvalidParams<T>(T data, string message = "Invalid params") => new ResponseError<T> { code = ErrorCodes.InvalidParams, message = message, data = data }; /// <nodoc /> public static ResponseError ServerError(ErrorCodes code) => new ResponseError { code = code, message = "Server error" }; /// <nodoc /> public static ResponseError<T> ServerError<T>(ErrorCodes code, T data) => new ResponseError<T> { code = code, message = "Server error", data = data }; /// <nodoc /> public static ResponseError<T> ServerError<T>(string message = "Server error") => new ResponseError<T> { code = ErrorCodes.ServerErrorStart, message = message }; } internal class MessageTest { public string jsonrpc { get; set; } public NumberOrString id { get; set; } public string method { get; set; } public bool IsMessage => jsonrpc == "2.0"; public bool IsRequest => (IsMessage && id != null && method != null); public bool IsResponse => (IsMessage && id != null && method == null); public bool IsNotification => (IsMessage && id == null && method != null); public bool IsCancellation => (IsNotification && method == "$/cancelRequest"); } /// <nodoc /> public abstract class MessageBase { /// <nodoc /> public string jsonrpc { get; set; } = "2.0"; } /// <nodoc /> public abstract class MethodCall : MessageBase { /// <nodoc /> public string method { get; set; } } /// <nodoc /> public abstract class RequestMessageBase : MethodCall { /// <nodoc /> public NumberOrString id { get; set; } } /// <nodoc /> public class VoidRequestMessage : RequestMessageBase { } /// <nodoc /> public class RequestMessage<T> : RequestMessageBase { /// <nodoc /> public T @params { get; set; } } /// <nodoc /> public abstract class ResponseMessageBase : MessageBase { /// <nodoc /> public NumberOrString id { get; set; } } /// <nodoc /> public class VoidResponseMessage<TError> : ResponseMessageBase where TError : ResponseError { /// <nodoc /> public TError error { get; set; } } /// <nodoc /> public class ResponseMessage<T, TError> : ResponseMessageBase where TError : ResponseError { /// <nodoc /> public T result { get; set; } /// <nodoc /> public TError error { get; set; } } /// <nodoc /> public abstract class NotificationMessageBase : MethodCall { } /// <nodoc /> public class VoidNotificationMessage : NotificationMessageBase { } /// <nodoc /> public class NotificationMessage<T> : NotificationMessageBase { /// <nodoc /> public T @params { get; set; } } /// <nodoc /> public class ResponseError { // TODO: Note, the ErrorCodes enum are the defined set that is reserved // TODO: By JSON-RPC, the error code in reality should be a int // TODO: As anything not in the reserved list can be used for application defined errors /// <nodoc /> public ErrorCodes code { get; set; } /// <nodoc /> public string message { get; set; } } /// <nodoc /> public class ResponseError<T> : ResponseError { /// <nodoc /> public T data { get; set; } } /// <nodoc /> public enum ErrorCodes { /// <nodoc /> ParseError = -32700, /// <nodoc /> InvalidRequest = -32600, /// <nodoc /> MethodNotFound = -32601, /// <nodoc /> InvalidParams = -32602, /// <nodoc /> InternalError = -32603, /// <nodoc /> ServerErrorStart = -32099, /// <nodoc /> ServerErrorEnd = -32000, /// <nodoc /> ServerNotInitialized = -32002, /// <nodoc /> UnknownErrorCode = -32001, /// <nodoc /> RequestCancelled = -32800, } }
32.595122
196
0.563753
[ "MIT" ]
BearerPipelineTest/BuildXL
Public/Src/IDE/LanguageServerProtocol/LanguageServer/Message.cs
6,682
C#
using System; using System.Diagnostics; namespace EZB.BuildEngine.Actions { class ProcessAction : IAction { public ProcessAction(string path, string cmdLine, bool isConsole) { _path = path; _cmdLine = cmdLine; _isConsole = isConsole; if (string.IsNullOrEmpty(path)) throw new ApplicationException("Cannot execute an empty path"); } public ProcessAction(string cmdLine, bool isConsole) { string[] args = Common.CommandLine.SplitArgs(cmdLine); _path = (args == null || args.Length == 0) ? null : args[0]; _cmdLine = Common.CommandLine.JoinArgs(args, 1); _isConsole = isConsole; if (string.IsNullOrEmpty(_path)) throw new ApplicationException("Cannot execute an empty path"); } public void Execute() { ProcessStartInfo psi = new ProcessStartInfo() { FileName = _path, Arguments = _cmdLine, CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = _isConsole, RedirectStandardError = _isConsole }; using (Process process = Process.Start(psi)) { while (!process.WaitForExit(100)) FunnelOutput(process); FunnelOutput(process); if (process.ExitCode != 0) throw new ApplicationException($"Command \"{_path} {_cmdLine}\" failed with exit code {process.ExitCode}"); } } private void FunnelOutput(Process process) { if (!_isConsole) return; while (process.StandardOutput.Peek() > 0) Console.Write(process.StandardOutput.ReadToEnd()); while (process.StandardError.Peek() > 0) Console.Write(process.StandardError.ReadToEnd()); } string _path; string _cmdLine; bool _isConsole; } }
29.71831
127
0.540284
[ "Apache-2.0" ]
gurudennis/EzBuildSys
EZB.BuildEngine/Actions/ProcessAction.cs
2,112
C#
using Lucene.Net.Analysis.Tokenattributes; namespace Lucene.Net.Analysis { using Lucene.Net.Support; using BasicAutomata = Lucene.Net.Util.Automaton.BasicAutomata; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 BasicOperations = Lucene.Net.Util.Automaton.BasicOperations; using CharacterRunAutomaton = Lucene.Net.Util.Automaton.CharacterRunAutomaton; /// <summary> /// A tokenfilter for testing that removes terms accepted by a DFA. /// <ul> /// <li>Union a list of singletons to act like a stopfilter. /// <li>Use the complement to act like a keepwordfilter /// <li>Use a regex like <code>.{12,}</code> to act like a lengthfilter /// </ul> /// </summary> public sealed class MockTokenFilter : TokenFilter { /// <summary> /// Empty set of stopwords </summary> public static readonly CharacterRunAutomaton EMPTY_STOPSET = new CharacterRunAutomaton(BasicAutomata.MakeEmpty()); /// <summary> /// Set of common english stopwords </summary> public static readonly CharacterRunAutomaton ENGLISH_STOPSET = new CharacterRunAutomaton(BasicOperations.Union(Arrays.AsList(BasicAutomata.MakeString("a"), BasicAutomata.MakeString("an"), BasicAutomata.MakeString("and"), BasicAutomata.MakeString("are"), BasicAutomata.MakeString("as"), BasicAutomata.MakeString("at"), BasicAutomata.MakeString("be"), BasicAutomata.MakeString("but"), BasicAutomata.MakeString("by"), BasicAutomata.MakeString("for"), BasicAutomata.MakeString("if"), BasicAutomata.MakeString("in"), BasicAutomata.MakeString("into"), BasicAutomata.MakeString("is"), BasicAutomata.MakeString("it"), BasicAutomata.MakeString("no"), BasicAutomata.MakeString("not"), BasicAutomata.MakeString("of"), BasicAutomata.MakeString("on"), BasicAutomata.MakeString("or"), BasicAutomata.MakeString("such"), BasicAutomata.MakeString("that"), BasicAutomata.MakeString("the"), BasicAutomata.MakeString("their"), BasicAutomata.MakeString("then"), BasicAutomata.MakeString("there"), BasicAutomata.MakeString("these"), BasicAutomata.MakeString("they"), BasicAutomata.MakeString("this"), BasicAutomata.MakeString("to"), BasicAutomata.MakeString("was"), BasicAutomata.MakeString("will"), BasicAutomata.MakeString("with")))); private readonly CharacterRunAutomaton Filter; private readonly ICharTermAttribute TermAtt; private readonly IPositionIncrementAttribute PosIncrAtt; private int SkippedPositions; /// <summary> /// Create a new MockTokenFilter. /// </summary> /// <param name="input"> TokenStream to filter </param> /// <param name="filter"> DFA representing the terms that should be removed. </param> public MockTokenFilter(TokenStream input, CharacterRunAutomaton filter) : base(input) { this.Filter = filter; TermAtt = AddAttribute<ICharTermAttribute>(); PosIncrAtt = AddAttribute<IPositionIncrementAttribute>(); } public override bool IncrementToken() { // TODO: fix me when posInc=false, to work like FilteringTokenFilter in that case and not return // initial token with posInc=0 ever // return the first non-stop word found SkippedPositions = 0; while (input.IncrementToken()) { if (!Filter.Run(TermAtt.Buffer(), 0, TermAtt.Length)) { PosIncrAtt.PositionIncrement = PosIncrAtt.PositionIncrement + SkippedPositions; return true; } SkippedPositions += PosIncrAtt.PositionIncrement; } // reached EOS -- return false return false; } public override void End() { base.End(); PosIncrAtt.PositionIncrement = PosIncrAtt.PositionIncrement + SkippedPositions; } public override void Reset() { base.Reset(); SkippedPositions = 0; } } }
51.010309
1,222
0.66249
[ "Apache-2.0" ]
BlueCurve-Team/lucenenet
src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs
4,948
C#
using System.Collections.Generic; using IntoTheCode.Buffer; using IntoTheCode.Basic; using IntoTheCode.Message; using System.Linq; using IntoTheCode.Read.Structure; using System.Globalization; namespace IntoTheCode.Read.Words { /// <remarks>Inherids <see cref="WordBase"/></remarks> internal class WordFloat : WordBase { internal WordFloat() { Name = "float"; _culture = new CultureInfo("en-US"); } public override ParserElementBase CloneForParse(TextBuffer buffer) { return new WordFloat() { Name = Name, TextBuffer = buffer }; } public override string GetGrammar() { return MetaParser.WordFloat__; } private const char Sign = '-'; private const char Comma = '.'; private const string AllowedChars = "0123456789"; private CultureInfo _culture; public override bool Load(List<TextElement> outElements, int level) { TextBuffer.FindNextWord(null, false); int to = 0; if (TextBuffer.IsEnd(to)) return false; if (Sign == TextBuffer.GetChar()) { to++; if (TextBuffer.IsEnd(to)) return false; } if (!AllowedChars.Contains(TextBuffer.GetChar(to++))) return false; while (!TextBuffer.IsEnd(to) && AllowedChars.Contains(TextBuffer.GetChar(to))) { to++; } if (TextBuffer.IsEnd(to + 1) || Comma != TextBuffer.GetChar(to++)) return false; if (!AllowedChars.Contains(TextBuffer.GetChar(to++))) return false; while (!TextBuffer.IsEnd(to) && AllowedChars.Contains(TextBuffer.GetChar(to))) { to++; } if (to > 9 && !float.TryParse(TextBuffer.GetSubString(TextBuffer.PointerNextChar, to), NumberStyles.Float, _culture, out _)) return false; //TextBuffer.InsertComments(outElements); outElements.Add(new CodeElement(this, new TextSubString(TextBuffer.PointerNextChar) { To = TextBuffer.PointerNextChar + to })); TextBuffer.PointerNextChar += to; //TextBuffer.FindNextWord(outElements, true); return true; } public override bool ResolveErrorsForward(int level) { TextBuffer.FindNextWord(null, false); int to = 0; if (TextBuffer.IsEnd(1)) return TextBuffer.Status.AddSyntaxError(this, TextBuffer.Length, 0, () => MessageRes.itc10, GetGrammar(), "EOF"); //if (Sign == TextBuffer.GetChar()) to++; if (Sign == TextBuffer.GetChar()) { to++; if (TextBuffer.IsEnd(to)) return TextBuffer.Status.AddSyntaxError(this, TextBuffer.Length, 0, () => MessageRes.itc10, GetGrammar(), "EOF"); } if (!AllowedChars.Contains(TextBuffer.GetChar(to))) return TextBuffer.Status.AddSyntaxError(this, TextBuffer.PointerNextChar + to, 0, () => MessageRes.itc10, "digit", "'" + TextBuffer.GetChar(to) + "'"); to++; while (!TextBuffer.IsEnd(to) && AllowedChars.Contains(TextBuffer.GetChar(to))) { to++; } if (TextBuffer.IsEnd(to + 1) || Comma != TextBuffer.GetChar(to++)) return TextBuffer.Status.AddSyntaxError(this, TextBuffer.PointerNextChar + to, 0, () => MessageRes.itc10, "'" + Comma + "'", "'" + TextBuffer.GetChar(to) + "'"); if (!AllowedChars.Contains(TextBuffer.GetChar(to))) return TextBuffer.Status.AddSyntaxError(this, TextBuffer.PointerNextChar + to, 0, () => MessageRes.itc10, "digit", "'" + TextBuffer.GetChar(to) + "'"); to++; while (!TextBuffer.IsEnd(to) && AllowedChars.Contains(TextBuffer.GetChar(to))) { to++; } if (!float.TryParse(TextBuffer.GetSubString(TextBuffer.PointerNextChar, to), NumberStyles.Float, _culture, out _)) return TextBuffer.Status.AddSyntaxError(this, to, 0, () => MessageRes.itc11, TextBuffer.GetSubString(TextBuffer.PointerNextChar, to)); TextBuffer.PointerNextChar += to; TextBuffer.FindNextWord(null, true); return true; } /// <returns>0: Not found, 1: Found-read error, 2: Found and read ok.</returns> public override int ResolveErrorsLast(CodeElement last, int level) { CodeElement code = last as CodeElement; if (code != null && code.ParserElement == this) { // found! TextBuffer.PointerNextChar = code.SubString.To + a + 1; return 2; } return 0; } } }
37.899225
177
0.567805
[ "MIT" ]
Krixohub/IntoTheCode
CSharp/IntoTheCode/Read/Words/WordFloat.cs
4,891
C#
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace HtmlParser.Tests { [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { } } }
15.2
51
0.618421
[ "MIT" ]
hakdag/pidococodegen
source/HtmlParser.Tests/UnitTest1.cs
228
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 sns-2010-03-31.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; using System.Xml.Serialization; using Amazon.SimpleNotificationService.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; namespace Amazon.SimpleNotificationService.Model.Internal.MarshallTransformations { /// <summary> /// CheckIfPhoneNumberIsOptedOut Request Marshaller /// </summary> public class CheckIfPhoneNumberIsOptedOutRequestMarshaller : IMarshaller<IRequest, CheckIfPhoneNumberIsOptedOutRequest> , IMarshaller<IRequest,AmazonWebServiceRequest> { /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="input"></param> /// <returns></returns> public IRequest Marshall(AmazonWebServiceRequest input) { return this.Marshall((CheckIfPhoneNumberIsOptedOutRequest)input); } /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="publicRequest"></param> /// <returns></returns> public IRequest Marshall(CheckIfPhoneNumberIsOptedOutRequest publicRequest) { IRequest request = new DefaultRequest(publicRequest, "Amazon.SimpleNotificationService"); request.Parameters.Add("Action", "CheckIfPhoneNumberIsOptedOut"); request.Parameters.Add("Version", "2010-03-31"); if(publicRequest != null) { if(publicRequest.IsSetPhoneNumber()) { request.Parameters.Add("phoneNumber", StringUtils.FromString(publicRequest.PhoneNumber)); } } return request; } private static CheckIfPhoneNumberIsOptedOutRequestMarshaller _instance = new CheckIfPhoneNumberIsOptedOutRequestMarshaller(); internal static CheckIfPhoneNumberIsOptedOutRequestMarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static CheckIfPhoneNumberIsOptedOutRequestMarshaller Instance { get { return _instance; } } } }
35.666667
171
0.656139
[ "Apache-2.0" ]
ChristopherButtars/aws-sdk-net
sdk/src/Services/SimpleNotificationService/Generated/Model/Internal/MarshallTransformations/CheckIfPhoneNumberIsOptedOutRequestMarshaller.cs
3,103
C#
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2019 Suzhou Senparc Network Technology Co.,Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2021 Senparc 文件名:SenparcWeixinSettingItem.cs 文件功能描述:Senparc.Weixin SDK 中单个公众号配置信息 创建标识:Senparc - 20180707 修改标识:Senparc - 20180802 修改描述:MP v15.2.0 SenparcWeixinSetting 添加 TenPayV3_WxOpenTenpayNotify 属性,用于设置小程序支付回调地址 修改标识:Senparc - 20190521 修改描述:v6.4.4 .NET Core 添加多证书注册功能;增加 ISenparcWeixinSettingForTenpayV3 接口中的新属性 修改标识:Senparc - 20191003 修改描述:v6.6.102 提供 SenparcWeixinSettingItem 快速创建构造函数 修改标识:Senparc - 20191004 修改描述:添加新的 Work(企业微信)的参数 ----------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Senparc.Weixin.Entities { /// <summary> /// Senparc.Weixin SDK 中单个公众号配置信息 /// </summary> public class SenparcWeixinSettingItem : ISenparcWeixinSettingForMP, ISenparcWeixinSettingForWxOpen, ISenparcWeixinSettingForWork, ISenparcWeixinSettingForOldTenpay, ISenparcWeixinSettingForTenpayV3, ISenparcWeixinSettingForOpen, ISenparcWeixinSettingForExtension { /// <summary> /// 唯一标识 /// </summary> public virtual string ItemKey { get; set; } #region 构造函数 public SenparcWeixinSettingItem() { } public SenparcWeixinSettingItem(ISenparcWeixinSettingForMP setting) { ItemKey = setting.ItemKey; Token = setting.Token; EncodingAESKey = setting.EncodingAESKey; WeixinAppId = setting.WeixinAppId; WeixinAppSecret = setting.WeixinAppSecret; } public SenparcWeixinSettingItem(ISenparcWeixinSettingForWxOpen setting, bool isDebug = false) { ItemKey = setting.ItemKey; WxOpenAppId = setting.WxOpenAppId; WxOpenAppSecret = setting.WxOpenAppSecret; WxOpenEncodingAESKey = setting.WxOpenEncodingAESKey; WxOpenToken = setting.WxOpenToken; } public SenparcWeixinSettingItem(ISenparcWeixinSettingForWork setting, bool isDebug = false) { ItemKey = setting.ItemKey; WeixinCorpId = setting.WeixinCorpId; WeixinCorpAgentId = setting.WeixinCorpAgentId; WeixinCorpSecret = setting.WeixinCorpSecret; WeixinCorpToken = setting.WeixinCorpToken; WeixinCorpEncodingAESKey = setting.WeixinCorpEncodingAESKey; } public SenparcWeixinSettingItem(ISenparcWeixinSettingForOldTenpay setting, bool isDebug = false) { ItemKey = setting.ItemKey; WeixinPay_AppId = setting.WeixinPay_AppId; WeixinPay_AppKey = setting.WeixinPay_AppKey; WeixinPay_Key = setting.WeixinPay_Key; WeixinPay_PartnerId = setting.WeixinPay_PartnerId; WeixinPay_TenpayNotify = setting.WeixinPay_TenpayNotify; } public SenparcWeixinSettingItem(ISenparcWeixinSettingForTenpayV3 setting, bool isDebug = false) { ItemKey = setting.ItemKey; TenPayV3_AppId = setting.TenPayV3_AppId; TenPayV3_AppSecret = setting.TenPayV3_AppSecret; TenPayV3_CertPath = setting.TenPayV3_CertPath; TenPayV3_CertSecret = setting.TenPayV3_CertSecret; TenPayV3_Key = setting.TenPayV3_Key; TenPayV3_MchId = setting.TenPayV3_MchId; TenPayV3_SubAppId = setting.TenPayV3_SubAppId; TenPayV3_SubAppSecret = setting.TenPayV3_SubAppSecret; TenPayV3_SubMchId = setting.TenPayV3_SubMchId; TenPayV3_TenpayNotify = setting.TenPayV3_TenpayNotify; TenPayV3_WxOpenTenpayNotify = setting.TenPayV3_WxOpenTenpayNotify; } public SenparcWeixinSettingItem(ISenparcWeixinSettingForOpen setting, bool isDebug = false) { ItemKey = setting.ItemKey; Component_Appid = setting.Component_Appid; Component_EncodingAESKey = setting.Component_EncodingAESKey; Component_Secret = setting.Component_Secret; Component_Token = setting.Component_Token; } public SenparcWeixinSettingItem(ISenparcWeixinSettingForExtension setting, bool isDebug = false) { ItemKey = setting.ItemKey; AgentUrl = setting.AgentUrl; AgentToken = setting.AgentToken; SenparcWechatAgentKey = setting.SenparcWechatAgentKey; } #endregion #region 公众号 /// <summary> /// 公众号Token /// </summary> public virtual string Token { get; set; } /// <summary> /// 公众号消息加密Key /// </summary> public virtual string EncodingAESKey { get; set; } /// <summary> /// 公众号AppId /// </summary> public virtual string WeixinAppId { get; set; } /// <summary> /// 公众号AppSecret /// </summary> public virtual string WeixinAppSecret { get; set; } #endregion #region 小程序 /// <summary> /// 小程序AppId /// </summary> public virtual string WxOpenAppId { get; set; } /// <summary> /// 小程序AppSecret /// </summary> public virtual string WxOpenAppSecret { get; set; } /// <summary> /// 小程序 Token /// </summary> public virtual string WxOpenToken { get; set; } /// <summary> /// 小程序EncodingAESKey /// </summary> public virtual string WxOpenEncodingAESKey { get; set; } #endregion #region 企业微信 /// <summary> /// 企业微信CorpId(全局) /// </summary> public virtual string WeixinCorpId { get; set; } /// <summary> /// 企业微信 AgentId(单个应用的Id),一般为数字 /// </summary> public virtual string WeixinCorpAgentId { get; set; } /// <summary> /// 企业微信CorpSecret(和 AgentId对应) /// </summary> public virtual string WeixinCorpSecret { get; set; } /// <summary> /// Token /// </summary> public virtual string WeixinCorpToken { get; set; } /// <summary> /// EncodingAESKey /// </summary> public virtual string WeixinCorpEncodingAESKey { get; set; } #endregion #region 微信支付 #region 微信支付V2(旧版) /// <summary> /// WeixinPay_PartnerId(微信支付V2) /// </summary> public virtual string WeixinPay_PartnerId { get; set; } /// <summary> /// WeixinPay_Key(微信支付V2) /// </summary> public virtual string WeixinPay_Key { get; set; } /// <summary> /// WeixinPay_AppId(微信支付V2) /// </summary> public virtual string WeixinPay_AppId { get; set; } /// <summary> /// WeixinPay_AppKey(微信支付V2) /// </summary> public virtual string WeixinPay_AppKey { get; set; } /// <summary> /// WeixinPay_TenpayNotify(微信支付V2) /// </summary> public virtual string WeixinPay_TenpayNotify { get; set; } #endregion #region 微信支付V3(新版) /// <summary> /// MchId(商户ID) /// </summary> public virtual string TenPayV3_MchId { get; set; } /// <summary> /// 特约商户微信支付 子商户ID,没有可留空 /// </summary> public virtual string TenPayV3_SubMchId { get; set; } /// <summary> /// MchKey /// </summary> public virtual string TenPayV3_Key { get; set; } /// <summary> /// 微信支付证书位置(物理路径),在 .NET Core 下执行 TenPayV3InfoCollection.Register() 方法会为 HttpClient 自动添加证书 /// </summary> public virtual string TenPayV3_CertPath { get; set; } /// <summary> /// 微信支付证书密码,在 .NET Core 下执行 TenPayV3InfoCollection.Register() 方法会为 HttpClient 自动添加证书 /// </summary> public virtual string TenPayV3_CertSecret { get; set; } /// <summary> /// 微信支付AppId /// </summary> public virtual string TenPayV3_AppId { get; set; } /// <summary> /// 微信支付AppSecert /// </summary> public virtual string TenPayV3_AppSecret { get; set; } /// <summary> /// 特约商户微信支付 子商户AppID /// </summary> public virtual string TenPayV3_SubAppId { get; set; } /// <summary> /// 特约商户微信支付 子商户AppSecret /// </summary> public virtual string TenPayV3_SubAppSecret { get; set; } /// <summary> /// 微信支付TenpayNotify /// </summary> public virtual string TenPayV3_TenpayNotify { get; set; } /// <summary> /// 小程序微信支付WxOpenTenpayNotify /// </summary> public virtual string TenPayV3_WxOpenTenpayNotify { get; set; } #endregion #endregion #region 开放平台 /// <summary> /// Component_Appid /// </summary> public virtual string Component_Appid { get; set; } /// <summary> /// Component_Secret /// </summary> public virtual string Component_Secret { get; set; } /// <summary> /// 全局统一的 Component_Token(非必须) /// </summary> public virtual string Component_Token { get; set; } /// <summary> /// 全局统一的 Component_EncodingAESKey(非必须) /// </summary> public virtual string Component_EncodingAESKey { get; set; } #endregion #region 扩展 public virtual string AgentUrl { get; set; } public virtual string AgentToken { get; set; } public virtual string SenparcWechatAgentKey { get; set; } #endregion } }
32.163636
168
0.59544
[ "Apache-2.0" ]
BeidabizLSX/WeiXinMPSDK
src/Senparc.Weixin/Senparc.Weixin/Entities/SenparcWeixinSettings/SenparcWeixinSettingItem.cs
11,428
C#