From 3aebaef6c2fc71225c631d06c5262c086169fdc9 Mon Sep 17 00:00:00 2001 From: de4dot Date: Tue, 20 Nov 2012 07:58:53 +0100 Subject: [PATCH] Re-add removed hasString() method --- blocks/DotNetUtils.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blocks/DotNetUtils.cs b/blocks/DotNetUtils.cs index 0b074343..2375a6f7 100644 --- a/blocks/DotNetUtils.cs +++ b/blocks/DotNetUtils.cs @@ -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 getCodeStrings(MethodDef method) { var strings = new List(); if (method != null && method.Body != null) {