diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java b/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java index 03d9ab7..8384e4e 100644 --- a/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java +++ b/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | |||
| @@ -5,6 +5,7 @@ import cuchaz.enigma.throwables.MappingParseException; | |||
| 5 | import cuchaz.enigma.translation.MappingTranslator; | 5 | import cuchaz.enigma.translation.MappingTranslator; |
| 6 | import cuchaz.enigma.translation.Translator; | 6 | import cuchaz.enigma.translation.Translator; |
| 7 | import cuchaz.enigma.translation.mapping.EntryMapping; | 7 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 8 | import cuchaz.enigma.translation.mapping.MappingSaveParameters; | ||
| 8 | import cuchaz.enigma.translation.mapping.VoidEntryResolver; | 9 | import cuchaz.enigma.translation.mapping.VoidEntryResolver; |
| 9 | import cuchaz.enigma.translation.mapping.serde.*; | 10 | import cuchaz.enigma.translation.mapping.serde.*; |
| 10 | import cuchaz.enigma.translation.mapping.tree.EntryTree; | 11 | import cuchaz.enigma.translation.mapping.tree.EntryTree; |
| @@ -91,13 +92,13 @@ public final class MappingCommandsUtil { | |||
| 91 | return result; | 92 | return result; |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | public static EntryTree<EntryMapping> read(String type, Path path) throws MappingParseException, IOException { | 95 | public static EntryTree<EntryMapping> read(String type, Path path, MappingSaveParameters saveParameters) throws MappingParseException, IOException { |
| 95 | if (type.equals("enigma")) { | 96 | if (type.equals("enigma")) { |
| 96 | return EnigmaMappingsReader.DIRECTORY.read(path, ProgressListener.none()); | 97 | return EnigmaMappingsReader.DIRECTORY.read(path, ProgressListener.none(), saveParameters); |
| 97 | } | 98 | } |
| 98 | 99 | ||
| 99 | if (type.equals("tiny")) { | 100 | if (type.equals("tiny")) { |
| 100 | return TinyMappingsReader.INSTANCE.read(path, ProgressListener.none()); | 101 | return TinyMappingsReader.INSTANCE.read(path, ProgressListener.none(), saveParameters); |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | MappingFormat format = null; | 104 | MappingFormat format = null; |
| @@ -106,15 +107,15 @@ public final class MappingCommandsUtil { | |||
| 106 | } catch (IllegalArgumentException ignored) {} | 107 | } catch (IllegalArgumentException ignored) {} |
| 107 | 108 | ||
| 108 | if (format != null) { | 109 | if (format != null) { |
| 109 | return format.getReader().read(path, ProgressListener.none()); | 110 | return format.getReader().read(path, ProgressListener.none(), saveParameters); |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | throw new IllegalArgumentException("no reader for " + type); | 113 | throw new IllegalArgumentException("no reader for " + type); |
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | public static void write(EntryTree<EntryMapping> mappings, String type, Path path) { | 116 | public static void write(EntryTree<EntryMapping> mappings, String type, Path path, MappingSaveParameters saveParameters) { |
| 116 | if (type.equals("enigma")) { | 117 | if (type.equals("enigma")) { |
| 117 | EnigmaMappingsWriter.DIRECTORY.write(mappings, path, ProgressListener.none()); | 118 | EnigmaMappingsWriter.DIRECTORY.write(mappings, path, ProgressListener.none(), saveParameters); |
| 118 | return; | 119 | return; |
| 119 | } | 120 | } |
| 120 | 121 | ||
| @@ -125,7 +126,7 @@ public final class MappingCommandsUtil { | |||
| 125 | throw new IllegalArgumentException("specify column names as 'tiny:from_column:to_column'"); | 126 | throw new IllegalArgumentException("specify column names as 'tiny:from_column:to_column'"); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | new TinyMappingsWriter(split[1], split[2]).write(mappings, path, ProgressListener.none()); | 129 | new TinyMappingsWriter(split[1], split[2]).write(mappings, path, ProgressListener.none(), saveParameters); |
| 129 | return; | 130 | return; |
| 130 | } | 131 | } |
| 131 | 132 | ||
| @@ -135,7 +136,7 @@ public final class MappingCommandsUtil { | |||
| 135 | } catch (IllegalArgumentException ignored) {} | 136 | } catch (IllegalArgumentException ignored) {} |
| 136 | 137 | ||
| 137 | if (format != null) { | 138 | if (format != null) { |
| 138 | format.getWriter().write(mappings, path, ProgressListener.none()); | 139 | format.getWriter().write(mappings, path, ProgressListener.none(), saveParameters); |
| 139 | return; | 140 | return; |
| 140 | } | 141 | } |
| 141 | 142 | ||