Search in sources :

Example 1 with ParseException

use of com.eclipsesource.json.ParseException in project bytecode-viewer by Konloch.

the class Settings method loadGUI.

public static void loadGUI() {
    try {
        JsonObject settings = new JsonObject();
        try {
            settings = JsonObject.readFrom(new FileReader(BytecodeViewer.settingsFile));
        } catch (ParseException | UnsupportedOperationException e) {
        }
        Decompiler.CFR.getSettings().loadFrom(settings);
        Decompiler.FERNFLOWER.getSettings().loadFrom(settings);
        Decompiler.PROCYON.getSettings().loadFrom(settings);
        Decompiler.BYTECODE.getSettings().loadFrom(settings);
        if (settings.get("settings") != null) {
            JsonObject rootSettings = settings.get("settings").asObject();
            for (Map.Entry<String, Settings> setting : Settings.ALL_SETTINGS.entrySet()) {
                if (rootSettings.get(setting.getKey()) != null) {
                    setting.getValue().set(rootSettings.get(setting.getKey()).asString());
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) FileReader(java.io.FileReader) ParseException(com.eclipsesource.json.ParseException) Map(java.util.Map) HashMap(java.util.HashMap) ParseException(com.eclipsesource.json.ParseException)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)1 ParseException (com.eclipsesource.json.ParseException)1 FileReader (java.io.FileReader)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1