diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/ConvertMain.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/ConvertMain.java | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/src/main/java/cuchaz/enigma/ConvertMain.java b/src/main/java/cuchaz/enigma/ConvertMain.java index a68ab61..caa6154 100644 --- a/src/main/java/cuchaz/enigma/ConvertMain.java +++ b/src/main/java/cuchaz/enigma/ConvertMain.java | |||
| @@ -76,7 +76,7 @@ public class ConvertMain { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | private static void printHelp() { | 78 | private static void printHelp() { |
| 79 | System.out.println(String.format("%s - %s", Constants.Name, Constants.Version)); | 79 | System.out.println(String.format("%s - %s", Constants.NAME, Constants.VERSION)); |
| 80 | System.out.println("Usage:"); | 80 | System.out.println("Usage:"); |
| 81 | System.out.println("\tjava -cp enigma.jar cuchaz.enigma.ConvertMain <command> <old-jar> <new-jar> <old-mappings> <new-mappings> <class-matches> <field-matches> <method-matches>"); | 81 | System.out.println("\tjava -cp enigma.jar cuchaz.enigma.ConvertMain <command> <old-jar> <new-jar> <old-mappings> <new-mappings> <class-matches> <field-matches> <method-matches>"); |
| 82 | System.out.println("\tWhere <command> is one of:"); | 82 | System.out.println("\tWhere <command> is one of:"); |
| @@ -121,14 +121,11 @@ public class ConvertMain { | |||
| 121 | Deobfuscators deobfuscators = new Deobfuscators(sourceJar, destJar); | 121 | Deobfuscators deobfuscators = new Deobfuscators(sourceJar, destJar); |
| 122 | deobfuscators.source.setMappings(mappings); | 122 | deobfuscators.source.setMappings(mappings); |
| 123 | System.out.println("Starting GUI..."); | 123 | System.out.println("Starting GUI..."); |
| 124 | new ClassMatchingGui(classMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(new ClassMatchingGui.SaveListener() { | 124 | new ClassMatchingGui(classMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(matches -> { |
| 125 | @Override | 125 | try { |
| 126 | public void save(ClassMatches matches) { | 126 | MatchesWriter.writeClasses(matches, classMatchesFile); |
| 127 | try { | 127 | } catch (IOException ex) { |
| 128 | MatchesWriter.writeClasses(matches, classMatchesFile); | 128 | throw new Error(ex); |
| 129 | } catch (IOException ex) { | ||
| 130 | throw new Error(ex); | ||
| 131 | } | ||
| 132 | } | 129 | } |
| 133 | }); | 130 | }); |
| 134 | } | 131 | } |
| @@ -185,14 +182,11 @@ public class ConvertMain { | |||
| 185 | checker.dropBrokenMappings(destMappings); | 182 | checker.dropBrokenMappings(destMappings); |
| 186 | deobfuscators.dest.setMappings(destMappings); | 183 | deobfuscators.dest.setMappings(destMappings); |
| 187 | 184 | ||
| 188 | new MemberMatchingGui<>(classMatches, fieldMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(new MemberMatchingGui.SaveListener<FieldEntry>() { | 185 | new MemberMatchingGui<>(classMatches, fieldMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(matches -> { |
| 189 | @Override | 186 | try { |
| 190 | public void save(MemberMatches<FieldEntry> matches) { | 187 | MatchesWriter.writeMembers(matches, fieldMatchesFile); |
| 191 | try { | 188 | } catch (IOException ex) { |
| 192 | MatchesWriter.writeMembers(matches, fieldMatchesFile); | 189 | throw new Error(ex); |
| 193 | } catch (IOException ex) { | ||
| 194 | throw new Error(ex); | ||
| 195 | } | ||
| 196 | } | 190 | } |
| 197 | }); | 191 | }); |
| 198 | } | 192 | } |
| @@ -258,14 +252,11 @@ public class ConvertMain { | |||
| 258 | checker.dropBrokenMappings(destMappings); | 252 | checker.dropBrokenMappings(destMappings); |
| 259 | deobfuscators.dest.setMappings(destMappings); | 253 | deobfuscators.dest.setMappings(destMappings); |
| 260 | 254 | ||
| 261 | new MemberMatchingGui<>(classMatches, methodMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(new MemberMatchingGui.SaveListener<BehaviorEntry>() { | 255 | new MemberMatchingGui<>(classMatches, methodMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(matches -> { |
| 262 | @Override | 256 | try { |
| 263 | public void save(MemberMatches<BehaviorEntry> matches) { | 257 | MatchesWriter.writeMembers(matches, methodMatchesFile); |
| 264 | try { | 258 | } catch (IOException ex) { |
| 265 | MatchesWriter.writeMembers(matches, methodMatchesFile); | 259 | throw new Error(ex); |
| 266 | } catch (IOException ex) { | ||
| 267 | throw new Error(ex); | ||
| 268 | } | ||
| 269 | } | 260 | } |
| 270 | }); | 261 | }); |
| 271 | } | 262 | } |
| @@ -303,11 +294,8 @@ public class ConvertMain { | |||
| 303 | System.out.println("WARNING: Broken behavior entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); | 294 | System.out.println("WARNING: Broken behavior entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); |
| 304 | } | 295 | } |
| 305 | 296 | ||
| 306 | //TODO Fix | ||
| 307 | // write out the converted mappings | 297 | // write out the converted mappings |
| 308 | // try (FileWriter out = new FileWriter(outMappingsFile)) { | 298 | new MappingsWriter().write(outMappingsFile, newMappings); |
| 309 | // new MappingsWriter().write(out, newMappings); | ||
| 310 | // } | ||
| 311 | System.out.println("Wrote converted mappings to:\n\t" + outMappingsFile.getAbsolutePath()); | 299 | System.out.println("Wrote converted mappings to:\n\t" + outMappingsFile.getAbsolutePath()); |
| 312 | } | 300 | } |
| 313 | 301 | ||