diff options
| author | 2020-03-17 23:28:47 +0000 | |
|---|---|---|
| committer | 2020-03-17 23:28:47 +0000 | |
| commit | bfd7bfd739968af5b7bad17134783deedd424f1f (patch) | |
| tree | a9dc7906c88c1c8c40c98f0f97632cd7dd269e25 /src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java | |
| parent | Fix documenting constructors (#201) (diff) | |
| download | enigma-fork-bfd7bfd739968af5b7bad17134783deedd424f1f.tar.gz enigma-fork-bfd7bfd739968af5b7bad17134783deedd424f1f.tar.xz enigma-fork-bfd7bfd739968af5b7bad17134783deedd424f1f.zip | |
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
Diffstat (limited to 'src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/command/MapSpecializedMethodsCommand.java | 10 |
1 files changed, 6 insertions, 4 deletions
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 { | |||
| 36 | 36 | ||
| 37 | @Override | 37 | @Override |
| 38 | public void run(String... args) throws IOException, MappingParseException { | 38 | public void run(String... args) throws IOException, MappingParseException { |
| 39 | run(Paths.get(args[0]), args[1], Paths.get(args[2]), args[3], Paths.get(args[4])); | ||
| 40 | } | ||
| 41 | |||
| 42 | public static void run(Path jar, String sourceFormat, Path sourcePath, String resultFormat, Path output) throws IOException, MappingParseException { | ||
| 39 | MappingSaveParameters saveParameters = new MappingSaveParameters(MappingFileNameFormat.BY_DEOBF); | 43 | MappingSaveParameters saveParameters = new MappingSaveParameters(MappingFileNameFormat.BY_DEOBF); |
| 40 | EntryTree<EntryMapping> source = MappingCommandsUtil.read(args[1], Paths.get(args[2]), saveParameters); | 44 | EntryTree<EntryMapping> source = MappingCommandsUtil.read(sourceFormat, sourcePath, saveParameters); |
| 41 | EntryTree<EntryMapping> result = new HashEntryTree<>(); | 45 | EntryTree<EntryMapping> result = new HashEntryTree<>(); |
| 42 | Path jar = Paths.get(args[0]); | ||
| 43 | ClassCache classCache = ClassCache.of(jar); | 46 | ClassCache classCache = ClassCache.of(jar); |
| 44 | JarIndex jarIndex = classCache.index(ProgressListener.none()); | 47 | JarIndex jarIndex = classCache.index(ProgressListener.none()); |
| 45 | BridgeMethodIndex bridgeMethodIndex = jarIndex.getBridgeMethodIndex(); | 48 | BridgeMethodIndex bridgeMethodIndex = jarIndex.getBridgeMethodIndex(); |
| @@ -60,8 +63,7 @@ public class MapSpecializedMethodsCommand extends Command { | |||
| 60 | result.insert(specialized, new EntryMapping(name)); | 63 | result.insert(specialized, new EntryMapping(name)); |
| 61 | } | 64 | } |
| 62 | 65 | ||
| 63 | Path output = Paths.get(args[4]); | ||
| 64 | Utils.delete(output); | 66 | Utils.delete(output); |
| 65 | MappingCommandsUtil.write(result, args[3], output, saveParameters); | 67 | MappingCommandsUtil.write(result, resultFormat, output, saveParameters); |
| 66 | } | 68 | } |
| 67 | } | 69 | } |