Changeset 113 for binary-improvements/NamePatcher
- Timestamp:
- Jul 27, 2014, 11:30:15 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/NamePatcher/ManualPatches.cs
r107 r113 61 61 public static void applyManualPatches (ModuleDefinition mainModule) 62 62 { 63 renameMember (mainModule.GetType ("ItemBlock").BaseType.Resolve (), "ItemBase");64 65 63 FieldDefinition fd; 66 64 MethodDefinition md; 65 bool renamed = false; 66 67 68 renamed = false; 69 foreach (TypeDefinition td in mainModule.Types) { 70 md = getMethodInType (td, (method, isConstructor, retType, paramCount, paramList) => { 71 return !isConstructor && method.IsPublic && method.IsStatic && paramCount == 0 && retType.Name.Equals ("Boolean") && method.Name.Equals ("CheckIfStartedAsDedicatedServer"); 72 } 73 ); 74 if (md != null) { 75 renameMember (td, "StaticDirectories"); 76 renamed = true; 77 break; 78 } 79 } 80 if (!renamed) 81 Console.WriteLine ("FAILED: StaticDirectories"); 82 renamed = false; 83 84 85 renameMember (mainModule.GetType ("ItemBlock").BaseType.Resolve (), "ItemBase"); 86 87 88 fd = getFieldInType (mainModule.GetType ("PersistentPlayerList"), (field, fieldType) => { 89 return fieldType.FullName.Contains ("Dictionary") && fieldType.FullName.Contains ("Vector3i") && fieldType.FullName.Contains ("PersistentPlayerData"); } 90 ); 91 if (fd != null) { 92 makeFieldPublic (fd); 93 renameMember (fd, "positionToLPBlockOwner"); 94 } else { 95 Console.WriteLine ("FAILED: PersistentPlayerList.positionToLPBlockOwner"); 96 } 67 97 68 98 … … 78 108 79 109 110 // Fields in PlayerDataFile 80 111 fd = getFieldInType (mainModule.GetType ("PlayerDataFile"), (field, fieldType) => { 81 112 return field.Name.Equals ("inventory") && fieldType.IsArray; } … … 109 140 110 141 142 // Fields in AdminTools 111 143 fd = getFieldInType (mainModule.GetType ("AdminTools"), (field, fieldType) => { 112 144 return fieldType.FullName.Contains ("List") && fieldType.FullName.Contains ("AdminToolsCommandPermissions"); } … … 120 152 121 153 154 // Fields and methods in World 122 155 fd = getFieldInType (mainModule.GetType ("World"), (field, fieldType) => { 123 156 return fieldType.FullName.Equals ("System.UInt64"); } … … 130 163 131 164 165 md = getMethodInType (mainModule.GetType ("World"), (method, isConstructor, retType, paramCount, paramList) => { 166 return !isConstructor && paramCount == 1 && paramList [0].ParameterType.Name.Equals ("PersistentPlayerData") && method.IsPrivate && retType.Name.Equals ("Boolean"); 167 } 168 ); 169 if (md != null) { 170 md.IsPrivate = false; 171 md.IsPublic = true; 172 renameMember (md, "LandClaimIsActive"); 173 } else { 174 Console.WriteLine ("FAILED: World.LandClaimIsActive()"); 175 } 176 177 178 md = getMethodInType (mainModule.GetType ("World"), (method, isConstructor, retType, paramCount, paramList) => { 179 return !isConstructor && paramCount == 1 && paramList [0].ParameterType.Name.Equals ("PersistentPlayerData") && method.IsPrivate && retType.Name.Equals ("Single"); 180 } 181 ); 182 if (md != null) { 183 md.IsPrivate = false; 184 md.IsPublic = true; 185 renameMember (md, "LandClaimPower"); 186 } else { 187 Console.WriteLine ("FAILED: World.LandClaimPower()"); 188 } 189 190 191 // Fields in GameManager 132 192 fd = getFieldInType (mainModule.GetType ("GameManager"), (field, fieldType) => { 133 193 return fieldType.FullName.Equals ("ConnectionManager"); } … … 141 201 142 202 203 // Fields in ConnectionManager 143 204 fd = getFieldInType (mainModule.GetType ("ConnectionManager"), (field, fieldType) => { 144 205 return fieldType.FullName.Equals ("GameManager"); } … … 176 237 TypeDefinition typeConsole = null; 177 238 239 // Fields in NetTelnetServer 178 240 fd = getFieldInType (mainModule.GetType ("NetTelnetServer"), (field, fieldType) => { 179 241 return NameNormalizer.makeValidName (fieldType.Name) != null; }
Note:
See TracChangeset
for help on using the changeset viewer.