示例#1
0
文件: Renamer.cs 项目: ldh0227/de4dot
        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);
        }
示例#2
0
文件: Renamer.cs 项目: ldh0227/de4dot
 void prepareRenameTypes(IEnumerable<TypeDef> types, TypeRenamerState state)
 {
     foreach (var typeDef in types) {
         memberInfos.type(typeDef).prepareRenameTypes(state);
         prepareRenameTypes(typeDef.derivedTypes, state);
     }
 }
示例#3
0
        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);
        }