Re-arrange some code

This commit is contained in:
de4dot 2011-11-05 07:42:58 +01:00
parent 51092fa09a
commit f524989a1e

View File

@ -623,20 +623,19 @@ namespace de4dot.renamer {
var call = instructions[i];
if (call.OpCode.Code != Code.Call && call.OpCode.Code != Code.Callvirt)
continue;
var calledMethod = call.Operand as MethodReference;
if (!isWindowsFormsSetNameMethod(calledMethod))
if (!isWindowsFormsSetNameMethod(call.Operand as MethodReference))
continue;
var ldstr = instructions[i - 1];
if (ldstr.OpCode.Code != Code.Ldstr)
continue;
var ldarg = instructions[i - 2];
if (DotNetUtils.getArgIndex(methodDef.MethodDefinition, ldarg) != 0)
continue;
var className = ldstr.Operand as string;
if (className == null)
continue;
if (DotNetUtils.getArgIndex(methodDef.MethodDefinition, instructions[i - 2]) != 0)
continue;
findInitializeComponentMethod(methodDef);
return className;
}
@ -972,12 +971,16 @@ namespace de4dot.renamer {
var call = instructions[i];
if (call.OpCode.Code != Code.Call && call.OpCode.Code != Code.Callvirt)
continue;
var calledMethod = call.Operand as MethodReference;
if (!isWindowsFormsSetNameMethod(calledMethod))
if (!isWindowsFormsSetNameMethod(call.Operand as MethodReference))
continue;
var ldstr = instructions[i - 1];
if (ldstr.OpCode.Code != Code.Ldstr)
continue;
var fieldName = ldstr.Operand as string;
if (fieldName == null || !variableNameState.IsValidName(fieldName))
continue;
var ldfld = instructions[i - 2];
var fieldRef = ldfld.Operand as FieldReference;
if (fieldRef == null)
@ -986,10 +989,6 @@ namespace de4dot.renamer {
if (!ourFields.TryGetValue(new FieldReferenceAndDeclaringTypeKey(fieldRef), out fieldDef))
continue;
var fieldName = ldstr.Operand as string;
if (fieldName == null || !variableNameState.IsValidName(fieldName))
continue;
if (fieldDef.Renamed)
continue;