@@ -39,8 +39,8 @@ Please make sure that you don't assign inconsistent values, e.g.
39
39
``` cs
40
40
var target = new Target
41
41
{
42
- Instructions = .. .
43
- Instruction = .. .
42
+ Instructions = .. .
43
+ Instruction = .. .
44
44
}
45
45
```
46
46
@@ -52,12 +52,12 @@ Reference dnlib and create an Instruction[] or Instruction with your Instruction
52
52
Small Example :
53
53
```cs
54
54
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" )
57
57
};
58
58
int [] indexes = {
59
- 0 , // index of Instruction
60
- 2
59
+ 0 , // index of Instruction
60
+ 2
61
61
};
62
62
Target target = new Target ()
63
63
{
@@ -174,6 +174,30 @@ p.PatchOperand(target, 1337);
174
174
```
175
175
It is also able to patch multiple operands in the same method by using int[ ] or string[ ] .
176
176
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
+
177
201
### Saving the patches assembly
178
202
If you want to safe the assembly under a different name use this:
179
203
``` cs
0 commit comments