diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/command/DecompileCommand.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/command/DecompileCommand.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/cuchaz/enigma/command/DecompileCommand.java b/src/main/java/cuchaz/enigma/command/DecompileCommand.java index a58d908..bc23d01 100644 --- a/src/main/java/cuchaz/enigma/command/DecompileCommand.java +++ b/src/main/java/cuchaz/enigma/command/DecompileCommand.java | |||
| @@ -1,10 +1,9 @@ | |||
| 1 | package cuchaz.enigma.command; | 1 | package cuchaz.enigma.command; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.Deobfuscator; | 3 | import cuchaz.enigma.EnigmaProject; |
| 4 | import cuchaz.enigma.ProgressListener; | ||
| 4 | 5 | ||
| 5 | import java.io.File; | ||
| 6 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 7 | import java.util.jar.JarFile; | ||
| 8 | 7 | ||
| 9 | public class DecompileCommand extends Command { | 8 | public class DecompileCommand extends Command { |
| 10 | 9 | ||
| @@ -24,10 +23,17 @@ public class DecompileCommand extends Command { | |||
| 24 | 23 | ||
| 25 | @Override | 24 | @Override |
| 26 | public void run(String... args) throws Exception { | 25 | public void run(String... args) throws Exception { |
| 27 | File fileJarIn = getReadableFile(getArg(args, 0, "in jar", true)); | 26 | Path fileJarIn = getReadableFile(getArg(args, 0, "in jar", true)).toPath(); |
| 28 | File fileJarOut = getWritableFolder(getArg(args, 1, "out folder", true)); | 27 | Path fileJarOut = getWritableFolder(getArg(args, 1, "out folder", true)).toPath(); |
| 29 | Path fileMappings = getReadablePath(getArg(args, 2, "mappings file", false)); | 28 | Path fileMappings = getReadablePath(getArg(args, 2, "mappings file", false)); |
| 30 | Deobfuscator deobfuscator = getDeobfuscator(fileMappings, new JarFile(fileJarIn)); | 29 | |
| 31 | deobfuscator.writeSources(fileJarOut.toPath(), new Command.ConsoleProgressListener()); | 30 | EnigmaProject project = openProject(fileJarIn, fileMappings); |
| 31 | |||
| 32 | ProgressListener progress = new ConsoleProgressListener(); | ||
| 33 | |||
| 34 | EnigmaProject.JarExport jar = project.exportRemappedJar(progress); | ||
| 35 | EnigmaProject.SourceExport source = jar.decompile(progress); | ||
| 36 | |||
| 37 | source.write(fileJarOut, progress); | ||
| 32 | } | 38 | } |
| 33 | } | 39 | } |