public List <string> FindString(AssemblyDefinition assembly) { //List<string> strs = new List<string>(); foreach (var type in assembly.MainModule.Types) { foreach (var met in type.Methods) { foreach (Instruction ist in met.Body.Instructions) { if (ist.OpCode == OpCodes.Ldstr) { if (ist.Next.OpCode == OpCodes.Call || ist.Next.OpCode == OpCodes.Callvirt) { Strs.Add(ist.Operand.ToString()); reportManager.AddLine("Found String."); List <Instruction> temp = new List <Instruction>(); temp.Add(ist); temp.Add(ist.Next); InstructionsToRemove.Add(temp); } } } } } return(Strs); }
public void FindStrs(AssemblyDefinition assembly) { foreach (var type in assembly.MainModule.Types) { foreach (var met in type.Methods) { foreach (var i in met.Body.Instructions) { if (i.Operand != null && i.OpCode == OpCodes.Ldstr && (string)i.Operand != "") { Strs.Add(i.Operand.ToString()); } } } } }