Exemplo n.º 1
0
 static List<MethodNameScope> getSorted(MethodNameScopes scopes)
 {
     var allScopes = new List<MethodNameScope>(scopes.getAllScopes());
     allScopes.Sort((a, b) => Utils.compareInt32(b.Count, a.Count));
     return allScopes;
 }
Exemplo n.º 2
0
        void restoreMethodArgs(MethodNameScopes scopes)
        {
            foreach (var scope in scopes.getAllScopes()) {
                if (scope.Methods[0].ParamDefs.Count == 0)
                    continue;

                var argNames = getValidArgNames(scope);

                foreach (var method in scope.Methods) {
                    if (!method.Owner.HasModule)
                        continue;
                    var nameChecker = method.Owner.Module.ObfuscatedFile.NameChecker;

                    for (int i = 0; i < argNames.Length; i++) {
                        var argName = argNames[i];
                        if (argName == null || !nameChecker.isValidMethodArgName(argName))
                            continue;
                        var info = memberInfos.param(method.ParamDefs[i]);
                        if (nameChecker.isValidMethodArgName(info.oldName))
                            continue;
                        info.newName = argName;
                    }
                }
            }
        }
Exemplo n.º 3
0
 void restorePropertiesAndEvents(MethodNameScopes scopes)
 {
     var allScopes = scopes.getAllScopes();
     restoreVirtualProperties(allScopes);
     restorePropertiesFromNames(allScopes);
     restoreVirtualEvents(allScopes);
     restoreEventsFromNames(allScopes);
 }
Exemplo n.º 4
0
 void removeUselessOverrides(MethodNameScopes scopes)
 {
     foreach (var scope in scopes.getAllScopes()) {
         foreach (var method in scope.Methods) {
             if (!method.Owner.HasModule)
                 continue;
             if (!method.isPublic())
                 continue;
             var overrides = method.MethodDefinition.Overrides;
             for (int i = 0; i < overrides.Count; i++) {
                 var overrideMethod = overrides[i];
                 if (method.MethodDefinition.Name != overrideMethod.Name)
                     continue;
                 Log.v("Removed useless override from method {0} ({1:X8}), override: {2:X8}",
                             Utils.removeNewlines(method.MethodDefinition),
                             method.MethodDefinition.MetadataToken.ToInt32(),
                             overrideMethod.MetadataToken.ToInt32());
                 overrides.RemoveAt(i);
                 i--;
             }
         }
     }
 }