From 58c0aeb15a65324de08a914dfa62cc68a516a4e3 Mon Sep 17 00:00:00 2001 From: Runemoro Date: Mon, 9 Mar 2020 06:04:08 -0400 Subject: CFR support (#192) * Add decompiler API * Add CFR support--- src/main/java/cuchaz/enigma/config/Config.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/main/java/cuchaz/enigma/config') 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; import com.bulenkov.darcula.DarculaLaf; import com.google.common.io.Files; import com.google.gson.*; +import cuchaz.enigma.source.DecompilerService; +import cuchaz.enigma.source.Decompilers; import cuchaz.enigma.utils.I18n; @@ -137,6 +139,19 @@ public class Config { } } + public enum Decompiler { + PROCYON("Procyon", Decompilers.PROCYON), + CFR("CFR", Decompilers.CFR); + + public final DecompilerService service; + public final String name; + + Decompiler(String name, DecompilerService service) { + this.name = name; + this.service = service; + } + } + private static final File DIR_HOME = new File(System.getProperty("user.home")); private static final File ENIGMA_DIR = new File(DIR_HOME, ".enigma"); private static final File CONFIG_FILE = new File(ENIGMA_DIR, "config.json"); @@ -167,11 +182,13 @@ public class Config { public Integer lineNumbersBackground; public Integer lineNumbersSelected; public Integer lineNumbersForeground; - + public String language = I18n.DEFAULT_LANGUAGE; public LookAndFeel lookAndFeel = LookAndFeel.DEFAULT; + public Decompiler decompiler = Decompiler.PROCYON; + private Config() { gson = new GsonBuilder() .registerTypeAdapter(Integer.class, new IntSerializer()) @@ -217,6 +234,7 @@ public class Config { public void reset() throws IOException { this.lookAndFeel = LookAndFeel.DEFAULT; this.lookAndFeel.apply(this); + this.decompiler = Decompiler.PROCYON; this.language = I18n.DEFAULT_LANGUAGE; this.saveConfig(); } -- cgit v1.2.3