diff options
| author | 2019-05-15 22:03:13 -0700 | |
|---|---|---|
| committer | 2019-05-16 07:03:13 +0200 | |
| commit | cb8823eb0b446d5c1b9b580e5578866e691771d8 (patch) | |
| tree | 1e8c1a5b981f3ad42c393f5d7cb75754f25f51ba /src/main/java/cuchaz/enigma/command/DecompileCommand.java | |
| parent | checkmappings command (#137) (diff) | |
| download | enigma-fork-cb8823eb0b446d5c1b9b580e5578866e691771d8.tar.gz enigma-fork-cb8823eb0b446d5c1b9b580e5578866e691771d8.tar.xz enigma-fork-cb8823eb0b446d5c1b9b580e5578866e691771d8.zip | |
Feature/weave (#138)
* Add weave/stitch style command system to enigma
Also fixed divide by zero stupidity
Signed-off-by: liach <liach@users.noreply.github.com>
* Add tests for package access index and command
Signed-off-by: liach <liach@users.noreply.github.com>
* Minor tweaks
Signed-off-by: liach <liach@users.noreply.github.com>
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 | } | ||