diff options
| author | 2019-06-10 18:23:59 +0200 | |
|---|---|---|
| committer | 2019-06-10 18:23:59 +0200 | |
| commit | 54bbafce6a72abcd740a27917b7f6f7b5947167b (patch) | |
| tree | aad1060c4c1db00d62850a00366c9b12a704774d /src/main/java/cuchaz/enigma/command/DecompileCommand.java | |
| parent | Separate JarProcessor and EntryNameProposer (diff) | |
| parent | Method type reference corrections (#142) (diff) | |
| download | enigma-fork-54bbafce6a72abcd740a27917b7f6f7b5947167b.tar.gz enigma-fork-54bbafce6a72abcd740a27917b7f6f7b5947167b.tar.xz enigma-fork-54bbafce6a72abcd740a27917b7f6f7b5947167b.zip | |
Merge remote-tracking branch 'origin/master' into proposal-tweak
Diffstat (limited to 'src/main/java/cuchaz/enigma/command/DecompileCommand.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/command/DecompileCommand.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/java/cuchaz/enigma/command/DecompileCommand.java b/src/main/java/cuchaz/enigma/command/DecompileCommand.java new file mode 100644 index 0000000..a58d908 --- /dev/null +++ b/src/main/java/cuchaz/enigma/command/DecompileCommand.java | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | package cuchaz.enigma.command; | ||
| 2 | |||
| 3 | import cuchaz.enigma.Deobfuscator; | ||
| 4 | |||
| 5 | import java.io.File; | ||
| 6 | import java.nio.file.Path; | ||
| 7 | import java.util.jar.JarFile; | ||
| 8 | |||
| 9 | public class DecompileCommand extends Command { | ||
| 10 | |||
| 11 | public DecompileCommand() { | ||
| 12 | super("decompile"); | ||
| 13 | } | ||
| 14 | |||
| 15 | @Override | ||
| 16 | public String getUsage() { | ||
| 17 | return "<in jar> <out folder> [<mappings file>]"; | ||
| 18 | } | ||
| 19 | |||
| 20 | @Override | ||
| 21 | public boolean isValidArgument(int length) { | ||
| 22 | return length == 2 || length == 3; | ||
| 23 | } | ||
| 24 | |||
| 25 | @Override | ||
| 26 | public void run(String... args) throws Exception { | ||
| 27 | File fileJarIn = getReadableFile(getArg(args, 0, "in jar", true)); | ||
| 28 | File fileJarOut = getWritableFolder(getArg(args, 1, "out folder", true)); | ||
| 29 | Path fileMappings = getReadablePath(getArg(args, 2, "mappings file", false)); | ||
| 30 | Deobfuscator deobfuscator = getDeobfuscator(fileMappings, new JarFile(fileJarIn)); | ||
| 31 | deobfuscator.writeSources(fileJarOut.toPath(), new Command.ConsoleProgressListener()); | ||
| 32 | } | ||
| 33 | } | ||