summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/config
diff options
context:
space:
mode:
authorGravatar Runemoro2020-03-09 06:04:08 -0400
committerGravatar GitHub2020-03-09 10:04:08 +0000
commit58c0aeb15a65324de08a914dfa62cc68a516a4e3 (patch)
treef45e8141c0864692051149a478c5a0a6bbe68686 /src/main/java/cuchaz/enigma/config
parentMade Enigma gui translatable (#193) (diff)
downloadenigma-fork-58c0aeb15a65324de08a914dfa62cc68a516a4e3.tar.gz
enigma-fork-58c0aeb15a65324de08a914dfa62cc68a516a4e3.tar.xz
enigma-fork-58c0aeb15a65324de08a914dfa62cc68a516a4e3.zip
CFR support (#192)
* Add decompiler API * Add CFR support
Diffstat (limited to 'src/main/java/cuchaz/enigma/config')
-rw-r--r--src/main/java/cuchaz/enigma/config/Config.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java
index a00fe2d..15a974c 100644
--- a/src/main/java/cuchaz/enigma/config/Config.java
+++ b/src/main/java/cuchaz/enigma/config/Config.java
@@ -3,6 +3,8 @@ package cuchaz.enigma.config;
3import com.bulenkov.darcula.DarculaLaf; 3import com.bulenkov.darcula.DarculaLaf;
4import com.google.common.io.Files; 4import com.google.common.io.Files;
5import com.google.gson.*; 5import com.google.gson.*;
6import cuchaz.enigma.source.DecompilerService;
7import cuchaz.enigma.source.Decompilers;
6 8
7import cuchaz.enigma.utils.I18n; 9import cuchaz.enigma.utils.I18n;
8 10
@@ -137,6 +139,19 @@ public class Config {
137 } 139 }
138 } 140 }
139 141
142 public enum Decompiler {
143 PROCYON("Procyon", Decompilers.PROCYON),
144 CFR("CFR", Decompilers.CFR);
145
146 public final DecompilerService service;
147 public final String name;
148
149 Decompiler(String name, DecompilerService service) {
150 this.name = name;
151 this.service = service;
152 }
153 }
154
140 private static final File DIR_HOME = new File(System.getProperty("user.home")); 155 private static final File DIR_HOME = new File(System.getProperty("user.home"));
141 private static final File ENIGMA_DIR = new File(DIR_HOME, ".enigma"); 156 private static final File ENIGMA_DIR = new File(DIR_HOME, ".enigma");
142 private static final File CONFIG_FILE = new File(ENIGMA_DIR, "config.json"); 157 private static final File CONFIG_FILE = new File(ENIGMA_DIR, "config.json");
@@ -167,11 +182,13 @@ public class Config {
167 public Integer lineNumbersBackground; 182 public Integer lineNumbersBackground;
168 public Integer lineNumbersSelected; 183 public Integer lineNumbersSelected;
169 public Integer lineNumbersForeground; 184 public Integer lineNumbersForeground;
170 185
171 public String language = I18n.DEFAULT_LANGUAGE; 186 public String language = I18n.DEFAULT_LANGUAGE;
172 187
173 public LookAndFeel lookAndFeel = LookAndFeel.DEFAULT; 188 public LookAndFeel lookAndFeel = LookAndFeel.DEFAULT;
174 189
190 public Decompiler decompiler = Decompiler.PROCYON;
191
175 private Config() { 192 private Config() {
176 gson = new GsonBuilder() 193 gson = new GsonBuilder()
177 .registerTypeAdapter(Integer.class, new IntSerializer()) 194 .registerTypeAdapter(Integer.class, new IntSerializer())
@@ -217,6 +234,7 @@ public class Config {
217 public void reset() throws IOException { 234 public void reset() throws IOException {
218 this.lookAndFeel = LookAndFeel.DEFAULT; 235 this.lookAndFeel = LookAndFeel.DEFAULT;
219 this.lookAndFeel.apply(this); 236 this.lookAndFeel.apply(this);
237 this.decompiler = Decompiler.PROCYON;
220 this.language = I18n.DEFAULT_LANGUAGE; 238 this.language = I18n.DEFAULT_LANGUAGE;
221 this.saveConfig(); 239 this.saveConfig();
222 } 240 }