diff options
| author | 2022-10-10 13:25:02 +0200 | |
|---|---|---|
| committer | 2023-10-09 11:55:07 +0200 | |
| commit | cc4154d610adf7aee7816279171a50fe074aa675 (patch) | |
| tree | a68ff74ab7fc543c7476eb651d3cb59a8633ad76 /enigma-swing/src/main/java | |
| parent | Add Mapping-IO import support; small cleanup (diff) | |
| download | enigma-cc4154d610adf7aee7816279171a50fe074aa675.tar.gz enigma-cc4154d610adf7aee7816279171a50fe074aa675.tar.xz enigma-cc4154d610adf7aee7816279171a50fe074aa675.zip | |
Add progress listener to Mapping-IO conversion; deduplicate lang files
Diffstat (limited to 'enigma-swing/src/main/java')
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java index 73472ca9..5b04f3cf 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java | |||
| @@ -157,9 +157,18 @@ public class GuiController implements ClientPacketHandler { | |||
| 157 | EntryTree<EntryMapping> mappings; | 157 | EntryTree<EntryMapping> mappings; |
| 158 | 158 | ||
| 159 | if (useMappingIo) { | 159 | if (useMappingIo) { |
| 160 | String loadingMessage; | ||
| 161 | |||
| 162 | if (format.getMappingIoCounterpart().hasSingleFile()) { | ||
| 163 | loadingMessage = I18n.translate("progress.mappings.loading_file"); | ||
| 164 | } else { | ||
| 165 | loadingMessage = I18n.translate("progress.mappings.loading_directory"); | ||
| 166 | } | ||
| 167 | |||
| 168 | progress.init(1, loadingMessage); | ||
| 160 | MemoryMappingTree mappingTree = new MemoryMappingTree(); | 169 | MemoryMappingTree mappingTree = new MemoryMappingTree(); |
| 161 | MappingReader.read(path, format.getMappingIoCounterpart(), mappingTree); | 170 | MappingReader.read(path, format.getMappingIoCounterpart(), mappingTree); |
| 162 | mappings = MappingIoConverter.fromMappingIo(mappingTree); | 171 | mappings = MappingIoConverter.fromMappingIo(mappingTree, progress); |
| 163 | } else { | 172 | } else { |
| 164 | mappings = format.read(path, progress, saveParameters); | 173 | mappings = format.read(path, progress, saveParameters); |
| 165 | } | 174 | } |
| @@ -219,10 +228,13 @@ public class GuiController implements ClientPacketHandler { | |||
| 219 | loadedMappingPath = path; | 228 | loadedMappingPath = path; |
| 220 | 229 | ||
| 221 | if (useMappingIo) { | 230 | if (useMappingIo) { |
| 222 | MemoryMappingTree mappingTree = MappingIoConverter.toMappingIo(mapper.getObfToDeobf()); | 231 | MemoryMappingTree mappingTree = MappingIoConverter.toMappingIo(mapper.getObfToDeobf(), progress); |
| 232 | |||
| 233 | progress.init(1, I18n.translate("progress.mappings.writing")); | ||
| 223 | MappingWriter writer = MappingWriter.create(path, format.getMappingIoCounterpart()); | 234 | MappingWriter writer = MappingWriter.create(path, format.getMappingIoCounterpart()); |
| 224 | mappingTree.accept(writer); | 235 | mappingTree.accept(writer); |
| 225 | writer.close(); | 236 | writer.close(); |
| 237 | progress.step(1, I18n.translate("progress.done")); | ||
| 226 | } else if (saveAll) { | 238 | } else if (saveAll) { |
| 227 | format.write(mapper.getObfToDeobf(), path, progress, saveParameters); | 239 | format.write(mapper.getObfToDeobf(), path, progress, saveParameters); |
| 228 | } else { | 240 | } else { |