summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/command/DecompileCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cuchaz/enigma/command/DecompileCommand.java')
-rw-r--r--src/main/java/cuchaz/enigma/command/DecompileCommand.java33
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 @@
1package cuchaz.enigma.command;
2
3import cuchaz.enigma.Deobfuscator;
4
5import java.io.File;
6import java.nio.file.Path;
7import java.util.jar.JarFile;
8
9public 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}