void renameTypeDefinitions() { Log.v("Renaming obfuscated type definitions"); foreach (var module in modules.TheModules) { if (module.ObfuscatedFile.RemoveNamespaceWithOneType) removeOneClassNamespaces(module); } var state = new TypeRenamerState(); foreach (var type in modules.AllTypes) state.addTypeName(memberInfos.type(type).oldName); prepareRenameTypes(modules.BaseTypes, state); fixClsTypeNames(); renameTypeDefinitions(modules.NonNestedTypes); }
void prepareRenameTypes(IEnumerable<TypeDef> types, TypeRenamerState state) { foreach (var typeDef in types) { memberInfos.type(typeDef).prepareRenameTypes(state); prepareRenameTypes(typeDef.derivedTypes, state); } }
public void prepareRenameTypes(TypeRenamerState state) { var checker = NameChecker; if (newNamespace == null && oldNamespace != "") { if (!checker.isValidNamespaceName(oldNamespace)) { newNamespace = state.createNamespace(oldNamespace); } } string origClassName = null; if (isWinFormsClass()) origClassName = findWindowsFormsClassName(type); if (oldFullName != "<Module>" && !checker.isValidTypeName(oldName)) { if (origClassName != null && checker.isValidTypeName(origClassName)) rename(state.getTypeName(oldName, origClassName)); else { ITypeNameCreator nameCreator = type.isGlobalType() ? state.globalTypeNameCreator : state.internalTypeNameCreator; string newBaseType = null; TypeInfo baseInfo = getBase(); if (baseInfo != null && baseInfo.renamed) newBaseType = baseInfo.newName; rename(nameCreator.create(type.TypeDefinition, newBaseType)); } } prepareRenameGenericParams(type.GenericParams, checker); }