-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEditCode.cs
More file actions
78 lines (66 loc) · 2.49 KB
/
EditCode.cs
File metadata and controls
78 lines (66 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Mono.Cecil;
using Mono.Cecil.Cil;
using System.Reflection;
using NetDasm.Controls;
namespace NetDasm
{
public partial class EditCode : Form
{
private AssemblyDefinition assembly;
private MethodDefinition method;
public EditCode(MethodDefinition metodo, AssemblyDefinition assembly)
{
InitializeComponent();
this.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Application.ExecutablePath);
this.assembly = assembly;
this.method = metodo;
methodInstructions1.assembly = assembly;
methodInstructions1.method = metodo;
methodInstructions1.labelInfo = label1;
methodInstructions1.Load();
}
private void button1_Click(object sender, EventArgs e)
{
methodInstructions1.RemoveSelected();
}
private void button2_Click(object sender, EventArgs e)
{
InsertInstruction insert = new InsertInstruction(method.Body.Instructions.Count - 1);
insert.ShowDialog();
if (insert.DialogResult == DialogResult.OK)
{
methodInstructions1.InsertInstruction(insert);
}
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
methodInstructions1.filter = textBox3.Text;
methodInstructions1.Load();
}
private void button3_Click(object sender, EventArgs e)
{
if (methodInstructions1.SelectedItem != null)
{
InsertInstruction insert = new InsertInstruction(method.Body.Instructions.Count - 1);
insert.numericUpDown1.Value = methodInstructions1.SelectedIndex;
insert.comboBox1.SelectedItem = methodInstructions1.SelectedInstruction.OpCode.Code.ToString();
if (methodInstructions1.SelectedInstruction.Operand != null)
insert.textBox1.Text = methodInstructions1.SelectedInstruction.Operand.ToString();
insert.button1.Text = "Modify";
insert.ShowDialog();
if (insert.DialogResult == DialogResult.OK)
{
methodInstructions1.RemoveSelected();
methodInstructions1.InsertInstruction(insert);
}
}
}
}
}