i'm trying to replace a string to call a function but send the string as param (the function will return something)
Result.Append(b.ToString("AnyString"));
i'm trying to replace to something like this:
Result.Append(b.ToString(Class1.Function1("AnyString")));
using dnlib
what i have :
...
...
foreach (var method in type.Methods)
{
if (!method.HasBody)
continue;
if (method == decryptMethod)
continue;
method.Body.KeepOldMaxStack = true;
for (var i = 0; i < method.Body.Instructions.Count; i++)
{
if (method.Body.Instructions[i].OpCode != OpCodes.Ldstr) continue;
var oldString = method.Body.Instructions[i].Operand.ToString(); //Original String
method.Body.Instructions[i].Operand = Algorithm.Aes256.EncryptString(oldString); //i encrypt the string here
method.Body.Instructions.Insert(i + 1, new Instruction(OpCodes.Call, decryptMethod)); //what do i use for decryptMethod?
}
method.Body.SimplifyBranches();
method.Body.OptimizeBranches();
}