Esempio n. 1
0
 public Renamer(AssemblyDefinition asmDef, int length)
 {
     this.AsmDef        = asmDef;
     this.Length        = length;
     _typeOverloader    = new MemberOverloader(this.Length);
     _methodOverloaders = new Dictionary <TypeDefinition, MemberOverloader>();
     _fieldOverloaders  = new Dictionary <TypeDefinition, MemberOverloader>();
     _eventOverloaders  = new Dictionary <TypeDefinition, MemberOverloader>();
 }
Esempio n. 2
0
 public Renamer(AssemblyDefinition asmDef, int length)
 {
     this.AsmDef = asmDef;
     this.Length = length;
     _typeOverloader = new MemberOverloader(this.Length);
     _methodOverloaders = new Dictionary<TypeDefinition, MemberOverloader>();
     _fieldOverloaders = new Dictionary<TypeDefinition, MemberOverloader>();
     _eventOverloaders = new Dictionary<TypeDefinition, MemberOverloader>();
 }
Esempio n. 3
0
 public Renamer(AssemblyDefinition def, int length)
 {
     AsmDef            = def;
     Length            = length;
     typeOverloader    = new MemberOverloader(Length, true);
     methodOverloaders = new Dictionary <TypeDefinition, MemberOverloader>();
     fieldOverloaders  = new Dictionary <TypeDefinition, MemberOverloader>();
     eventOverloaders  = new Dictionary <TypeDefinition, MemberOverloader>();
 }
Esempio n. 4
0
        private void RenameInType(TypeDefinition typeDef)
        {
            if (typeDef.Namespace == "xClient.Core" ||
                typeDef.Namespace.StartsWith("xClient.Core.Elevation") ||
                typeDef.Namespace.StartsWith("xClient.Core.Compression") ||
                typeDef.Namespace.StartsWith("xClient.Core.Networking") ||
                typeDef.Namespace.StartsWith("xClient.Core.NetSerializer") ||
                typeDef.Namespace.StartsWith("xClient.Core.ReverseProxy") ||
                typeDef.Namespace.StartsWith("xClient.Core.MouseKeyHook") ||
                typeDef.Namespace.StartsWith("xClient.Core.Packets") ||
                typeDef.Namespace.StartsWith("xClient.Core.Recovery.Browsers") ||
                typeDef.HasInterfaces)
            {
                return;
            }

            _typeOverloader.GiveName(typeDef);

            typeDef.Namespace = string.Empty;

            MemberOverloader methodOverloader = GetMethodOverloader(typeDef);
            MemberOverloader fieldOverloader  = GetFieldOverloader(typeDef);
            MemberOverloader eventOverloader  = GetEventOverloader(typeDef);

            if (typeDef.HasNestedTypes)
            {
                foreach (TypeDefinition nestedType in typeDef.NestedTypes)
                {
                    RenameInType(nestedType);
                }
            }

            if (typeDef.HasMethods)
            {
                foreach (MethodDefinition methodDef in typeDef.Methods.Where(methodDef => !methodDef.IsConstructor))
                {
                    methodOverloader.GiveName(methodDef);
                }
            }

            if (typeDef.HasFields)
            {
                foreach (FieldDefinition fieldDef in typeDef.Fields)
                {
                    fieldOverloader.GiveName(fieldDef);
                }
            }

            if (typeDef.HasEvents)
            {
                foreach (EventDefinition eventDef in typeDef.Events)
                {
                    eventOverloader.GiveName(eventDef);
                }
            }
        }
Esempio n. 5
0
        private MemberOverloader GetOverloader(Dictionary <TypeDefinition, MemberOverloader> overloaderDictionary, TypeDefinition targetTypeDef)
        {
            MemberOverloader memberOverloader;

            if (!overloaderDictionary.TryGetValue(targetTypeDef, out memberOverloader))
            {
                memberOverloader = new MemberOverloader(Length, true);
                overloaderDictionary.Add(targetTypeDef, memberOverloader);
            }
            return(memberOverloader);
        }
Esempio n. 6
0
        private void RenameInType(TypeDefinition typeDef)
        {
            if (typeDef.Namespace.StartsWith("My") || typeDef.Namespace.StartsWith("xClient.Core.Packets") ||
                typeDef.Namespace == "xClient.Core" || typeDef.Namespace == "xClient.Core.Elevation" ||
                typeDef.Namespace == "xClient.Core.Compression" || typeDef.Namespace.StartsWith("ProtoBuf") ||
                typeDef.Namespace.Contains("xClient.Core.ReverseProxy"))
            {
                return;
            }

            TypeOverloader.GiveName(typeDef);

            typeDef.Namespace = string.Empty;

            MemberOverloader methodOverloader = GetMethodOverloader(typeDef);
            MemberOverloader fieldOverloader  = GetFieldOverloader(typeDef);
            MemberOverloader eventOverloader  = GetEventOverloader(typeDef);

            if (typeDef.HasNestedTypes)
            {
                foreach (TypeDefinition nestedType in typeDef.NestedTypes)
                {
                    RenameInType(nestedType);
                }
            }

            if (typeDef.HasMethods)
            {
                foreach (MethodDefinition methodDef in typeDef.Methods)
                {
                    if (!methodDef.IsConstructor)
                    {
                        methodOverloader.GiveName(methodDef);
                    }
                }
            }

            if (typeDef.HasFields)
            {
                foreach (FieldDefinition fieldDef in typeDef.Fields)
                {
                    fieldOverloader.GiveName(fieldDef);
                }
            }


            if (typeDef.HasEvents)
            {
                foreach (EventDefinition eventDef in typeDef.Events)
                {
                    eventOverloader.GiveName(eventDef);
                }
            }
        }
Esempio n. 7
0
        private MemberOverloader GetOverloader(Dictionary <TypeDefinition, MemberOverloader> overloaderDictionary, TypeDefinition targetTypeDef)
        {
            MemberOverloader overloader;

            if (!overloaderDictionary.TryGetValue(targetTypeDef, out overloader))
            {
                overloader = new MemberOverloader(this.length);
                overloaderDictionary.Add(targetTypeDef, overloader);
            }
            return(overloader);
        }
Esempio n. 8
0
        private void RenameInType(TypeDefinition typeDef)
        {
            if (typeDef.Namespace.Contains("NetSerializer") ||
                typeDef.Namespace.Contains("Registry") || typeDef.HasInterfaces)
            {
                return;
            }

            _typeOverloader.GiveName(typeDef);

            typeDef.Namespace = string.Empty;

            MemberOverloader methodOverloader = GetMethodOverloader(typeDef);
            MemberOverloader fieldOverloader  = GetFieldOverloader(typeDef);
            MemberOverloader eventOverloader  = GetEventOverloader(typeDef);

            if (typeDef.HasNestedTypes)
            {
                foreach (TypeDefinition nestedType in typeDef.NestedTypes)
                {
                    RenameInType(nestedType);
                }
            }

            if (typeDef.HasMethods)
            {
                foreach (MethodDefinition methodDef in
                         typeDef.Methods.Where(methodDef =>
                                               !methodDef.IsConstructor && !methodDef.HasCustomAttributes &&
                                               !methodDef.IsAbstract && !methodDef.IsVirtual))
                {
                    methodOverloader.GiveName(methodDef);
                }
            }

            if (typeDef.HasFields)
            {
                foreach (FieldDefinition fieldDef in typeDef.Fields)
                {
                    fieldOverloader.GiveName(fieldDef);
                }
            }

            if (typeDef.HasEvents)
            {
                foreach (EventDefinition eventDef in typeDef.Events)
                {
                    eventOverloader.GiveName(eventDef);
                }
            }
        }
Esempio n. 9
0
        private void RenameInType(TypeDefinition typeDef)
        {
            if (!typeDef.Namespace.StartsWith("Quasar") || typeDef.Namespace.StartsWith("Quasar.Common.Messages") || typeDef.IsEnum /* || typeDef.HasInterfaces */)
            {
                return;
            }

            _typeOverloader.GiveName(typeDef);

            typeDef.Namespace = string.Empty;

            MemberOverloader methodOverloader = GetMethodOverloader(typeDef);
            MemberOverloader fieldOverloader  = GetFieldOverloader(typeDef);
            MemberOverloader eventOverloader  = GetEventOverloader(typeDef);

            if (typeDef.HasNestedTypes)
            {
                foreach (TypeDefinition nestedType in typeDef.NestedTypes)
                {
                    RenameInType(nestedType);
                }
            }

            if (typeDef.HasMethods)
            {
                foreach (MethodDefinition methodDef in
                         typeDef.Methods.Where(methodDef =>
                                               !methodDef.IsConstructor && !methodDef.HasCustomAttributes &&
                                               !methodDef.IsAbstract && !methodDef.IsVirtual))
                {
                    methodOverloader.GiveName(methodDef);
                }
            }

            if (typeDef.HasFields)
            {
                foreach (FieldDefinition fieldDef in typeDef.Fields)
                {
                    fieldOverloader.GiveName(fieldDef);
                }
            }

            if (typeDef.HasEvents)
            {
                foreach (EventDefinition eventDef in typeDef.Events)
                {
                    eventOverloader.GiveName(eventDef);
                }
            }
        }
Esempio n. 10
0
 private MemberOverloader GetOverloader(Dictionary<TypeDefinition, MemberOverloader> overloaderDictionary,
     TypeDefinition targetTypeDef)
 {
     MemberOverloader overloader;
     if (!overloaderDictionary.TryGetValue(targetTypeDef, out overloader))
     {
         overloader = new MemberOverloader(this.Length);
         overloaderDictionary.Add(targetTypeDef, overloader);
     }
     return overloader;
 }