Re-add removed hasString() method

This commit is contained in:
de4dot 2012-11-20 07:58:53 +01:00
parent 9577bd2118
commit 3aebaef6c2

View File

@ -304,6 +304,16 @@ namespace de4dot.blocks {
return list;
}
public static bool hasString(MethodDef method, string s) {
if (method == null || method.Body == null)
return false;
foreach (var instr in method.Body.Instructions) {
if (instr.OpCode.Code == Code.Ldstr && (string)instr.Operand == s)
return true;
}
return false;
}
public static IList<string> getCodeStrings(MethodDef method) {
var strings = new List<string>();
if (method != null && method.Body != null) {