// this code is mostly copied from Newarr.cs in Il2CPU, just the code to find the size and length is different public override void AssembleNew(Assembler aAssembler, object aMethodInfo) { string xTypeID = ILOp.GetTypeIDLabel(typeof(Array)); MethodBase xCtor = typeof(Array).GetConstructors(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)[0]; string xCtorName = LabelName.Get(xCtor); XS.Set(ECX, EBP, sourceDisplacement: 8); // size XS.Set(EDX, EBP, sourceDisplacement: 12); // length XS.Push(ECX); // size of element XS.Set(EAX, ECX); XS.Multiply(EDX); // total element size XS.Add(EAX, ObjectUtils.FieldDataOffset + 4); // total array size XS.Push(EAX); XS.Call(LabelName.Get(GCImplementationRefs.AllocNewObjectRef)); XS.Label(".AfterAlloc"); XS.Pop(EAX); XS.Pop(ESI); XS.Push(EAX); XS.Push(ESP, isIndirect: true); XS.Push(ESP, isIndirect: true); // it's on the stack 3 times now, once from the return value, twice from the pushes; XS.Pop(EAX); XS.Set(EBX, xTypeID, sourceIsIndirect: true); // array type id XS.Set(EAX, EBX, destinationIsIndirect: true); // array type id XS.Set(EAX, (uint)ObjectUtils.InstanceTypeEnum.Array, destinationDisplacement: 4, destinationIsIndirect: true); XS.Set(EAX, ESI, destinationDisplacement: 8, destinationIsIndirect: true); XS.Set(EAX, ECX); XS.Push(0); XS.Call(xCtorName); XS.Push(0); }
protected void ThrowOverflowException() { new CPU.Call { DestinationLabel = LabelName.Get(typeof(ExceptionHelper).GetMethod("ThrowOverflow", BindingFlags.Static | BindingFlags.Public)) }; }
public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode) { var xOpCode = (OpField)aOpCode; var xFieldName = LabelName.GetStaticFieldName(xOpCode.Value); DoExecute(Assembler, aMethod, xFieldName, xOpCode.Value.DeclaringType, aOpCode); }
void ReleaseDesignerOutlets() { if (ButtonDirections != null) { ButtonDirections.Dispose(); ButtonDirections = null; } if (ImageStore != null) { ImageStore.Dispose(); ImageStore = null; } if (LabelAddress != null) { LabelAddress.Dispose(); LabelAddress = null; } if (LabelName != null) { LabelName.Dispose(); LabelName = null; } if (LabelTelephone != null) { LabelTelephone.Dispose(); LabelTelephone = null; } }
void ReleaseDesignerOutlets() { if (LabelAuthor != null) { LabelAuthor.Dispose(); LabelAuthor = null; } if (LabelName != null) { LabelName.Dispose(); LabelName = null; } if (LabelPublisher != null) { LabelPublisher.Dispose(); LabelPublisher = null; } if (LabelYear != null) { LabelYear.Dispose(); LabelYear = null; } }
public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode) { var xType = (OpType)aOpCode; var xTypeID = GetTypeIDLabel(xType.Value); var xCurrentMethodLabel = GetLabel(aMethod, aOpCode); var xAfterIsInstanceCallLabel = xCurrentMethodLabel + "_After_IsInstance_Call"; var xInvalidCastLabel = xCurrentMethodLabel + "_InvalidCast"; var xNextPositionLabel = GetLabel(aMethod, aOpCode.NextPosition); XS.Set(EAX, ESP, sourceDisplacement: 4); XS.Compare(EAX, 0); XS.Jump(ConditionalTestEnum.Zero, xNextPositionLabel); XS.Push(EAX, isIndirect: true); XS.Push(xTypeID, isIndirect: true); XS.Push(Convert.ToUInt32(xType.Value.IsInterface)); MethodBase xMethodIsInstance = VTablesImplRefs.IsInstanceRef; Call.DoExecute(Assembler, aMethod, xMethodIsInstance, aOpCode, xCurrentMethodLabel, xAfterIsInstanceCallLabel, DebugEnabled); XS.Label(xAfterIsInstanceCallLabel); XS.Pop(EAX); XS.Compare(EAX, 0); XS.Jump(ConditionalTestEnum.Equal, xInvalidCastLabel); XS.Jump(xNextPositionLabel); XS.Label(xInvalidCastLabel); XS.Call(LabelName.Get(ExceptionHelperRefs.ThrowInvalidCastExceptionRef)); }
public bool Equals(MemberInfo x, MemberInfo y) { if (x == null) { return(y == null); } if (y == null) { return(false); } if (x.GetType() == y.GetType()) { if (x.MetadataToken == y.MetadataToken && x.Module == y.Module) { if (x is MethodBase xMethod && y is MethodBase yMethod) { return(LabelName.GetFullName(xMethod) == LabelName.GetFullName(yMethod)); } else if (x is Type xType && y is Type yType) { return(LabelName.GetFullName(xType) == LabelName.GetFullName(yType)); } else { return(true); } }
public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode) { OpType xType = (OpType)aOpCode; if (IsReferenceType(xType.Value)) { return; } uint xSize = Align(SizeOfType(xType.Value), 4); string xTypeID = GetTypeIDLabel(xType.Value); XS.Push(ObjectUtils.FieldDataOffset + xSize); XS.Call(LabelName.Get(GCImplementationRefs.AllocNewObjectRef)); XS.Pop(ESI); XS.Set(EBX, xTypeID, sourceIsIndirect: true); XS.Set(ESI, EBX, destinationIsIndirect: true); XS.Set(ESI, (uint)ObjectUtils.InstanceTypeEnum.BoxedValueType, destinationDisplacement: 4, size: RegisterSize.Int32); new Comment(Assembler, "xSize is " + xSize); for (int i = 0; i < (xSize / 4); i++) { XS.Pop(EDX); XS.Set(ESI, EDX, destinationDisplacement: (ObjectUtils.FieldDataOffset + (i * 4)), size: RegisterSize.Int32); } XS.Push(ESI); XS.Push(0); }
protected void ThrowNotImplementedException(string aMessage) { XS.Push(LdStr.GetContentsArrayName(aMessage)); new CPU.Call { DestinationLabel = LabelName.Get(typeof(ExceptionHelper).GetMethod("ThrowNotImplemented", BindingFlags.Static | BindingFlags.Public)) }; }
private static void __raterdmsr(int *target) { /* * ; esi register layout: (mperf_hi, mperf_lo, aperf_hi, aperf_lo) * ; * ; int* ptr = new int[4]; * ; * lea esi, ptr ;equivalent with `mov esi, &ptr` * mov ecx, e7h * rdmsr * mov [esi + 4], eax * mov [esi], edx * mov ecx, e8h * rdmsr * mov [esi + 12], eax * mov [esi + 8], edx * xor eax, eax * ret */ __raterdmsrptr = target; string intname = LabelName.GetFullName(typeof(CPUImpl).GetTypeInfo().GetField(nameof(__raterdmsrptr))); XS.Lea(XSRegisters.ESI, intname); XS.Set(XSRegisters.ECX, 0xe7); XS.Rdmsr(); XS.Set(XSRegisters.EAX, XSRegisters.ESI, destinationIsIndirect: true, destinationDisplacement: 4); XS.Set(XSRegisters.EDX, XSRegisters.ESI, destinationIsIndirect: true, destinationDisplacement: 0); XS.Set(XSRegisters.ECX, 0xe8); XS.Rdmsr(); XS.Set(XSRegisters.EAX, XSRegisters.ESI, destinationIsIndirect: true, destinationDisplacement: 12); XS.Set(XSRegisters.EDX, XSRegisters.ESI, destinationIsIndirect: true, destinationDisplacement: 8); XS.Xor(XSRegisters.EAX, XSRegisters.EAX); // XS.Set(XSRegisters.EAX, 0); XS.Return(); }
private static void __cyclesrdtsc(int *target) { /* * push eax * push ecx * push edx * lea esi, target * rdtsc * mov [esi+4], eax * mov [esi], edx * pop edx * pop ecx * pop eax * ret */ __cyclesrdtscptr = target; string intname = LabelName.GetFullName(typeof(CPUImpl).GetTypeInfo().GetField(nameof(__cyclesrdtscptr))); XS.Push(XSRegisters.EAX); XS.Push(XSRegisters.ECX); XS.Push(XSRegisters.EDX); XS.Lea(XSRegisters.ESI, intname); XS.Rdtsc(); XS.Set(XSRegisters.ESI, XSRegisters.EAX, destinationIsIndirect: true, destinationDisplacement: 4); XS.Set(XSRegisters.ESI, XSRegisters.EDX, destinationIsIndirect: true); XS.Push(XSRegisters.EDX); XS.Push(XSRegisters.ECX); XS.Push(XSRegisters.EAX); XS.Return(); }
public static void SetAllStates(bool state) { Instance.maskState.list.Clear(); if (state) { Instance.maskState.list.AddRange(LabelName.Get()); } }
/// <summary>Snippet for GetLabel</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetLabelResourceNames() { // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) LabelName resourceName = LabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"); // Make the request Label response = labelServiceClient.GetLabel(resourceName); }
protected void ThrowNotImplementedException(string aMessage) { new CPU.Push { DestinationRef = Cosmos.Assembler.ElementReference.New(LdStr.GetContentsArrayName(aMessage)) }; new CPU.Call { DestinationLabel = LabelName.Get(typeof(ExceptionHelper).GetMethod("ThrowNotImplemented", BindingFlags.Static | BindingFlags.Public)) }; }
/// <summary>Snippet for GetLabelAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetLabelResourceNamesAsync() { // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) LabelName resourceName = LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"); // Make the request Label response = await labelServiceClient.GetLabelAsync(resourceName); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { int hashCode = LabelId != null?LabelId.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (LabelName != null ? LabelName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (HexColor != null ? HexColor.GetHashCode() : 0); return(hashCode); } }
private void textBox_filepath_TextChanged(object sender, EventArgs e) { if (this.textBox_filepath.Lines.Length == 1) { log.Info(LabelName.Replace(":", "").Replace(":", "") + ",载入了: " + this.textBox_filepath.Text); } else { log.Info(LabelName.Replace(":", "").Replace(":", "") + ",载入 " + this.textBox_filepath.Lines.Length + " 条项目:\r\n" + this.textBox_filepath.Text + "\r\n" + this.textBox_filepath.Lines.Length + "条"); } }
/// <summary>Snippet for GetLabel</summary> public void GetLabelResourceNames() { // Snippet: GetLabel(LabelName, CallSettings) // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) LabelName resourceName = LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"); // Make the request Label response = labelServiceClient.GetLabel(resourceName); // End snippet }
public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode) { // TODO: Implement exception DoNullReferenceCheck(Assembler, DebugEnabled, 4); XS.Add(ESP, 4); XS.Pop(EAX); XS.Set(LabelName.GetStaticFieldName(ExceptionHelperRefs.CurrentExceptionRef), EAX, destinationIsIndirect: true); XS.Call("SystemExceptionOccurred"); XS.Set(ECX, 3); EmitExceptionLogic(Assembler, aMethod, aOpCode, false, null); }
/// <summary>Snippet for GetLabel</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetLabelRequestObject() { // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) GetLabelRequest request = new GetLabelRequest { ResourceNameAsLabelName = LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"), }; // Make the request Label response = labelServiceClient.GetLabel(request); }
private Label GetLabel(string txt, Point loaction, LabelName lblName) { Label lbl = new Label(); lbl.Name = ((int)lblName).ToString(); lbl.Text = txt; lbl.Location = loaction; lbl.Width = 150; lbl.Height = 20; lbl.Click += Pnl_Click; return(lbl); }
private Label CreateLabelForSort(string txt, Point loaction, LabelName lblName) { Label lbl = new Label(); lbl.Name = ((int)lblName).ToString(); lbl.Text = txt; lbl.Location = loaction; lbl.Width = 150; lbl.Height = 20; return(lbl); }
/// <summary>Snippet for GetLabelAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetLabelRequestObjectAsync() { // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) GetLabelRequest request = new GetLabelRequest { ResourceNameAsLabelName = LabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"), }; // Make the request Label response = await labelServiceClient.GetLabelAsync(request); }
/// <summary>Snippet for GetLabelAsync</summary> public async Task GetLabelResourceNamesAsync() { // Snippet: GetLabelAsync(LabelName, CallSettings) // Additional: GetLabelAsync(LabelName, CancellationToken) // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) LabelName resourceName = LabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"); // Make the request Label response = await labelServiceClient.GetLabelAsync(resourceName); // End snippet }
void ReleaseDesignerOutlets() { if (LabelAddress != null) { LabelAddress.Dispose(); LabelAddress = null; } if (LabelCity != null) { LabelCity.Dispose(); LabelCity = null; } if (LabelName != null) { LabelName.Dispose(); LabelName = null; } if (LabelTelNumber != null) { LabelTelNumber.Dispose(); LabelTelNumber = null; } if (TextFieldAddress != null) { TextFieldAddress.Dispose(); TextFieldAddress = null; } if (TextFieldCity != null) { TextFieldCity.Dispose(); TextFieldCity = null; } if (TextFieldName != null) { TextFieldName.Dispose(); TextFieldName = null; } if (TextFieldTelNumber != null) { TextFieldTelNumber.Dispose(); TextFieldTelNumber = null; } }
public void TestGetTypeFullName() { Action a = () => { }; Action <int> a1 = (i) => test++; Assert.That(LabelName.GetFullName(a.GetType()) != LabelName.GetFullName(a1.GetType())); var c = new { i = 1, n = "Test" }; var d = new { i = 1, n = "Test" }; var e = new { n = "Test", i = 1 }; Assert.That(LabelName.GetFullName(c.GetType()) != null); Assert.That(LabelName.GetFullName(c.GetType()) == LabelName.GetFullName(d.GetType())); }
void ReleaseDesignerOutlets() { if (LabelName != null) { LabelName.Dispose(); LabelName = null; } if (SwitchComplete != null) { SwitchComplete.Dispose(); SwitchComplete = null; } }
/// <summary>Snippet for GetLabelAsync</summary> public async Task GetLabelRequestObjectAsync() { // Snippet: GetLabelAsync(GetLabelRequest, CallSettings) // Additional: GetLabelAsync(GetLabelRequest, CancellationToken) // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) GetLabelRequest request = new GetLabelRequest { ResourceNameAsLabelName = LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"), }; // Make the request Label response = await labelServiceClient.GetLabelAsync(request); // End snippet }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (Owner != null && Name != null && LabelName != null) { var ownerValue = Owner.GetValue(dc.State); var nameValue = Name.GetValue(dc.State); var labelNameValue = LabelName.GetValue(dc.State); return(gitHubClient.Issue.Labels.Delete(ownerValue, nameValue, labelNameValue)); } if (RepositoryId != null && LabelName != null) { var repositoryIdValue = RepositoryId.GetValue(dc.State); var labelNameValue = LabelName.GetValue(dc.State); return(gitHubClient.Issue.Labels.Delete((Int64)repositoryIdValue, labelNameValue)); } throw new ArgumentNullException("Required [labelName] arguments missing for GitHubClient.Issue.Labels.Delete"); }
public static void DoExecute(Cosmos.Assembler.Assembler assembler, _MethodInfo aMethod, string field, Type declaringType, ILOpCode aCurrentOpCode) { // call cctor: var xCctor = (declaringType.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic) ?? new ConstructorInfo[0]).SingleOrDefault(); if (xCctor != null) { XS.Call(LabelName.Get(xCctor)); if (aCurrentOpCode != null) { ILOp.EmitExceptionLogic(assembler, aMethod, aCurrentOpCode, true, null, ".AfterCCTorExceptionCheck"); XS.Label(".AfterCCTorExceptionCheck"); } } string xDataName = field; XS.Push(xDataName); }