blob: bc23d01dfec23bcc05b514f7c14356fc8f0ee774 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package cuchaz.enigma.command;
import cuchaz.enigma.EnigmaProject;
import cuchaz.enigma.ProgressListener;
import java.nio.file.Path;
public class DecompileCommand extends Command {
public DecompileCommand() {
super("decompile");
}
@Override
public String getUsage() {
return "<in jar> <out folder> [<mappings file>]";
}
@Override
public boolean isValidArgument(int length) {
return length == 2 || length == 3;
}
@Override
public void run(String... args) throws Exception {
Path fileJarIn = getReadableFile(getArg(args, 0, "in jar", true)).toPath();
Path fileJarOut = getWritableFolder(getArg(args, 1, "out folder", true)).toPath();
Path fileMappings = getReadablePath(getArg(args, 2, "mappings file", false));
EnigmaProject project = openProject(fileJarIn, fileMappings);
ProgressListener progress = new ConsoleProgressListener();
EnigmaProject.JarExport jar = project.exportRemappedJar(progress);
EnigmaProject.SourceExport source = jar.decompile(progress);
source.write(fileJarOut, progress);
}
}
|