bool FindInts(int index) { if (index < 0) return false; i2 = 0; var instrs = stringMethod.Body.Instructions; var emu = new InstructionEmulator(stringMethod); foreach (var kv in stringMethodConsts.Locals32) emu.SetLocal(kv.Key, new Int32Value(kv.Value)); var fields = new Dictionary<FieldDef, int?>(); for (int i = index; i < instrs.Count - 2; i++) { var instr = instrs[i]; FieldDef field; switch (instr.OpCode.Code) { case Code.Ldsfld: field = instr.Operand as FieldDef; if (field == null || field.DeclaringType != stringMethod.DeclaringType || field.FieldType.GetElementType() != ElementType.I4) goto default; fields[field] = null; emu.Push(new Int32Value(i1)); break; case Code.Stsfld: field = instr.Operand as FieldDef; if (field == null || field.DeclaringType != stringMethod.DeclaringType || field.FieldType.GetElementType() != ElementType.I4) goto default; if (fields.ContainsKey(field) && fields[field] == null) goto default; var val = emu.Pop() as Int32Value; if (val == null || !val.AllBitsValid()) fields[field] = null; else fields[field] = val.Value; break; case Code.Call: var method = instr.Operand as MethodDef; if (!decrypterType.Detected || method != decrypterType.Int64Method) goto done; emu.Push(new Int64Value((long)decrypterType.GetMagic())); break; case Code.Newobj: if (!EmulateDynocode(emu, ref i)) goto default; break; default: if (instr.OpCode.FlowControl != FlowControl.Next) goto done; emu.Emulate(instr); break; } } done: foreach (var val in fields.Values) { if (val == null) continue; magic1 = i2 = val.Value; return true; } return false; }