Skip to content

Commit aa353a2

Browse files
authored
Update README.md
1 parent d950539 commit aa353a2

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

README.md

+30-6
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Please make sure that you don't assign inconsistent values, e.g.
3939
```cs
4040
var target = new Target
4141
{
42-
Instructions = ...
43-
Instruction = ...
42+
Instructions = ...
43+
Instruction = ...
4444
}
4545
```
4646

@@ -52,12 +52,12 @@ Reference dnlib and create an Instruction[] or Instruction with your Instruction
5252
Small Example:
5353
```cs
5454
Instruction[] opCodes = {
55-
Instruction.Create(OpCodes.Ldstr, "Hello Sir 1"),
56-
Instruction.Create(OpCodes.Ldstr, "Hello Sir 2")
55+
Instruction.Create(OpCodes.Ldstr, "Hello Sir 1"),
56+
Instruction.Create(OpCodes.Ldstr, "Hello Sir 2")
5757
};
5858
int[] indexes = {
59-
0, // index of Instruction
60-
2
59+
0, // index of Instruction
60+
2
6161
};
6262
Target target = new Target()
6363
{
@@ -174,6 +174,30 @@ p.PatchOperand(target, 1337);
174174
```
175175
It is also able to patch multiple operands in the same method by using int[] or string[].
176176

177+
### Returning true/false
178+
If you want to overwrite the methodbody with a return true/false statement you can do this:
179+
```cs
180+
target = new Target()
181+
{
182+
Namespace = "Test",
183+
Class = "Program",
184+
Method = "VerifyMe"
185+
};
186+
p.WriteReturnBody(target, bool); // bool represents the return value
187+
```
188+
189+
### Clearing methodbodies
190+
If you just want to empty a methodbody, use this amigo:
191+
```cs
192+
target = new Target()
193+
{
194+
Namespace = "Test",
195+
Class = "Program",
196+
Method = "WriteLog"
197+
};
198+
p.WriteEmptyBody(target);
199+
```
200+
177201
### Saving the patches assembly
178202
If you want to safe the assembly under a different name use this:
179203
```cs

0 commit comments

Comments
 (0)