blob: 775bd3ea158d06b1b23814dbc921b8744176e2a3 (
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
|
package cuchaz.enigma.command;
import cuchaz.enigma.throwables.MappingParseException;
import cuchaz.enigma.translation.mapping.EntryMapping;
import cuchaz.enigma.translation.mapping.tree.EntryTree;
import cuchaz.enigma.utils.Utils;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ConvertMappingsCommand extends Command {
public ConvertMappingsCommand() {
super("convert-mappings");
}
@Override
public String getUsage() {
return "<source-format> <source> <result-format> <result>";
}
@Override
public boolean isValidArgument(int length) {
return length == 4;
}
@Override
public void run(String... args) throws IOException, MappingParseException {
EntryTree<EntryMapping> mappings = MappingCommandsUtil.read(args[0], Paths.get(args[1]));
Path output = Paths.get(args[3]);
Utils.delete(output);
MappingCommandsUtil.write(mappings, args[2], output);
}
}
|