From bfd7bfd739968af5b7bad17134783deedd424f1f Mon Sep 17 00:00:00 2001 From: Chocohead Date: Tue, 17 Mar 2020 23:28:47 +0000 Subject: Add support for reading/writing zipped mappings (#199) * Add support to read/write Enigma mappings from ZIP Takes any path which points to a ZIP as wanting to be read/written as a ZIP Paths from an existing ZIP file system will be correctly handled as directories * Fix deleting a path needing to be from the default file system * Allow calling MapSpecializedMethodsCommand directly * Fix indentation * Missing static--- .../cuchaz/enigma/command/MapSpecializedMethodsCommand.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java') diff --git a/src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java b/src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java index 7696f0f..eb8d5dc 100644 --- a/src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java +++ b/src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java @@ -36,10 +36,13 @@ public class MapSpecializedMethodsCommand extends Command { @Override public void run(String... args) throws IOException, MappingParseException { + run(Paths.get(args[0]), args[1], Paths.get(args[2]), args[3], Paths.get(args[4])); + } + + public static void run(Path jar, String sourceFormat, Path sourcePath, String resultFormat, Path output) throws IOException, MappingParseException { MappingSaveParameters saveParameters = new MappingSaveParameters(MappingFileNameFormat.BY_DEOBF); - EntryTree source = MappingCommandsUtil.read(args[1], Paths.get(args[2]), saveParameters); + EntryTree source = MappingCommandsUtil.read(sourceFormat, sourcePath, saveParameters); EntryTree result = new HashEntryTree<>(); - Path jar = Paths.get(args[0]); ClassCache classCache = ClassCache.of(jar); JarIndex jarIndex = classCache.index(ProgressListener.none()); BridgeMethodIndex bridgeMethodIndex = jarIndex.getBridgeMethodIndex(); @@ -60,8 +63,7 @@ public class MapSpecializedMethodsCommand extends Command { result.insert(specialized, new EntryMapping(name)); } - Path output = Paths.get(args[4]); Utils.delete(output); - MappingCommandsUtil.write(result, args[3], output, saveParameters); + MappingCommandsUtil.write(result, resultFormat, output, saveParameters); } } -- cgit v1.2.3