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>(); }
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>(); }
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>(); }
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); } } }
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); }
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); } } }
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); }
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); } } }
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); } } }
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; }