Settings Cleanup

This commit is contained in:
Konloch 2021-06-29 02:41:29 -07:00
parent 9438079ac1
commit 65341c642f
6 changed files with 650 additions and 589 deletions

View file

@ -11,6 +11,8 @@ import java.util.List;
import java.util.Objects;
import javax.swing.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import me.konloch.kontainer.io.HTTPRequest;
import org.apache.commons.io.FileUtils;
import org.objectweb.asm.tree.ClassNode;
@ -32,6 +34,8 @@ import the.bytecode.club.bytecodeviewer.util.*;
import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource;
import static the.bytecode.club.bytecodeviewer.Constants.*;
import static the.bytecode.club.bytecodeviewer.Settings.addRecentPlugin;
import static the.bytecode.club.bytecodeviewer.util.MiscUtils.guessLanguage;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -110,6 +114,7 @@ public class BytecodeViewer
public static List<FileContainer> files = new ArrayList<>(); //all of BCV's loaded files/classes/etc
public static List<Process> createdProcesses = new ArrayList<>();
public static final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", true);
public static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
public static final boolean EXPERIMENTAL_TAB_CODE = false;
/**
@ -165,7 +170,7 @@ public class BytecodeViewer
try {
//precache settings file
Settings.preloadSettingsFile();
SettingsSerializer.preloadSettingsFile();
//setup look and feel
Configuration.lafTheme.setLAF();
@ -176,7 +181,9 @@ public class BytecodeViewer
viewer = new MainViewerGUI();
SwingUtilities.updateComponentTreeUI(viewer);
Settings.loadSettings();
SettingsSerializer.loadSettings();
if(!Settings.hasSetLanguageAsSystemLanguage)
MiscUtils.setLanguage(guessLanguage());
int CLI = CommandLineInput.parseCommandLine(args);
@ -211,12 +218,12 @@ public class BytecodeViewer
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
for (Process proc : createdProcesses)
proc.destroy();
Settings.saveSettings();
SettingsSerializer.saveSettings();
cleanup();
}));
viewer.calledAfterLoad();
Constants.resetRecentFilesMenu();
Settings.resetRecentFilesMenu();
if (!Configuration.pingback) {
pingBack.start();
@ -517,7 +524,7 @@ public class BytecodeViewer
if (recentFiles)
for (File f : files)
if (f.exists())
Constants.addRecentFile(f);
Settings.addRecentFile(f);
BytecodeViewer.viewer.updateBusyStatus(true);
Configuration.needsReDump = true;

View file

@ -45,100 +45,6 @@ public class Constants
public static String enjarifyWorkingDirectory = getBCVDirectory() + fs + "enjarify_" + enjarifyVersion;
public static final String[] SUPPORTED_FILE_EXTENSIONS = new String[]{"jar", "zip", "class", "apk", "dex", "war", "jsp"};
private static List<String> recentPlugins;
private static List<String> recentFiles;
public static Gson gson;
static
{
try
{
gson = new GsonBuilder().setPrettyPrinting().create();
if (new File(filesName).exists())
recentFiles = gson.fromJson(DiskReader.loadAsString(filesName), new TypeToken<ArrayList<String>>() {}.getType());
else
recentFiles = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentfiles.bcv", false);
if (new File(pluginsName).exists())
recentPlugins = gson.fromJson(DiskReader.loadAsString(pluginsName), new TypeToken<ArrayList<String>>() {}.getType());
else
recentPlugins = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentplugins.bcv", false);
MiscUtils.deduplicateAndTrim(recentFiles, 25);
MiscUtils.deduplicateAndTrim(recentPlugins, 25);
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Add the recent file
*
* @param f the recent file
*/
public static void addRecentFile(File f)
{
recentFiles.remove(f.getAbsolutePath()); // already added on the list
recentFiles.add(0, f.getAbsolutePath());
MiscUtils.deduplicateAndTrim(recentFiles, 25);
DiskWriter.replaceFile(filesName, MiscUtils.listToString(recentFiles), false);
resetRecentFilesMenu();
}
/**
* Add to the recent plugin list
*
* @param f the plugin file
*/
public static void addRecentPlugin(File f)
{
recentPlugins.remove(f.getAbsolutePath()); // already added on the list
recentPlugins.add(0, f.getAbsolutePath());
MiscUtils.deduplicateAndTrim(recentPlugins, 25);
DiskWriter.replaceFile(pluginsName, MiscUtils.listToString(recentPlugins), false);
resetRecentFilesMenu();
}
/**
* resets the recent files menu
*/
protected static void resetRecentFilesMenu()
{
//build recent files
BytecodeViewer.viewer.recentFilesSecondaryMenu.removeAll();
for (String s : recentFiles)
{
if (!s.isEmpty())
{
JMenuItem m = new JMenuItem(s);
m.addActionListener(e ->
{
JMenuItem m12 = (JMenuItem) e.getSource();
BytecodeViewer.openFiles(new File[]{new File(m12.getText())}, true);
});
BytecodeViewer.viewer.recentFilesSecondaryMenu.add(m);
}
}
//build recent plugins
BytecodeViewer.viewer.recentPluginsSecondaryMenu.removeAll();
for (String s : recentPlugins)
{
if (!s.isEmpty())
{
JMenuItem m = new JMenuItem(s);
m.addActionListener(e ->
{
JMenuItem m1 = (JMenuItem) e.getSource();
BytecodeViewer.startPlugin(new File(m1.getText()));
});
BytecodeViewer.viewer.recentPluginsSecondaryMenu.add(m);
}
}
}
/**
* Returns the BCV directory
*

View file

@ -1,496 +1,115 @@
package the.bytecode.club.bytecodeviewer;
import javax.swing.JFrame;
import com.google.gson.reflect.TypeToken;
import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.gui.theme.RSTATheme;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import javax.swing.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import static the.bytecode.club.bytecodeviewer.BytecodeViewer.gson;
import static the.bytecode.club.bytecodeviewer.Constants.*;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
/**
* Used to handle loading/saving the GUI (options).
*
* @author Konloch
* @since 6/29/2021
*/
public class Settings {
public static void saveSettings() {
try {
DiskWriter.replaceFile(settingsName,
"BCV: " + VERSION, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rbr.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rsy.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.din.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.dc4.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.das.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hes.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hdc.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.dgs.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.ner.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.den.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rgn.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.bto.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.nns.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.uto.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.udv.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rer.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.fdi.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.asc.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeEnumSwitch.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.sugarEnums.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeStringSwitch.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.collectioniter.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.innerClasses.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeBoilerPlate.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeInnerClassSynthetics.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeLambdas.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideBridgeMethods.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.liftConstructorInit.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeDeadMethods.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeBadGenerics.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.sugarAsserts.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.sugarBoxing.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showVersion.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeFinally.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.tidyMonitors.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.lenient.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.dumpClassPath.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.comments.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceTopSort.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceTopSortAggress.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.stringBuffer.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.stringBuilder.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.silent.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.recover.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.eclipse.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.override.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showInferrable.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceCondPropagate.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideUTF.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideLongStrings.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.commentMonitor.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.allowCorrecting.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.labelledBlocks.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.j14ClassOBJ.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideLangImports.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.recoveryTypeClash.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.recoveryTypehInts.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceTurningIFs.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forLoopAGGCapture.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceExceptionPrune.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showDebugLineNumbers.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.simplifyMemberReferences.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.mergeVariables.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.unicodeOutputEnabled.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.retainPointlessSwitches.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.includeLineNumbersInBytecode.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.includeErrorDiagnostics.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.retainRedunantCasts.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.alwaysGenerateExceptionVars.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showSyntheticMembers.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceExplicitTypeArguments.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceExplicitImports.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.flattenSwitchBlocks.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.excludeNestedTypes.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.appendBracketsToLabels.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.debugHelpers.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
"deprecated", false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.updateCheck.isSelected()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(BytecodeViewer.viewer.viewPane1.getSelectedViewer()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(BytecodeViewer.viewer.viewPane2.getSelectedViewer()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(BytecodeViewer.viewer.viewPane3.getSelectedViewer()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.refreshOnChange.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.isMaximized), false);
DiskWriter.writeNewLine(settingsName,
"deprecated", false);
DiskWriter.writeNewLine(settingsName,
"deprecated", false);
DiskWriter.writeNewLine(settingsName,
Configuration.lastDirectory, false);
DiskWriter.writeNewLine(settingsName,
Configuration.python, false);
DiskWriter.writeNewLine(settingsName,
Configuration.rt, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getProcyon().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getCFR().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getFern().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getKrakatau().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getSmali().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getProcyon().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getCFR().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getFern().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getKrakatau().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getSmali().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getProcyon().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getCFR().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getFern().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getKrakatau().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getSmali().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeAPKResources.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
Configuration.library, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(Configuration.pingback), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getJD().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getJD().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getJD().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.fontSpinner.getValue()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(Configuration.deleteForeignLibraries), false);
if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel()))
DiskWriter.writeNewLine(settingsName, "0", false);
else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel()))
DiskWriter.writeNewLine(settingsName, "1", false);
DiskWriter.writeNewLine(settingsName,
Configuration.python3, false);
DiskWriter.writeNewLine(settingsName,
Configuration.javac, false);
DiskWriter.writeNewLine(settingsName,
Configuration.java, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.compileOnSave.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(Configuration.warnForEditing), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showFileInTabTitle.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forcePureAsciiAsText.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.synchronizedViewing.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showClassMethods.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.ren.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getJADX().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
Configuration.lafTheme.name(), false);
DiskWriter.writeNewLine(settingsName,
Configuration.rstaTheme.name(), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.simplifyNameInTabTitle.isSelected()), false);
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
public static void preloadSettingsFile()
{
try
{
//precache the file
DiskReader.loadString(settingsName, 0, true);
//process the cached file
Configuration.lafTheme = LAFTheme.valueOf(asString(127));
Configuration.rstaTheme = RSTATheme.valueOf(asString(128));
}
catch (Exception e)
{
//ignore because errors are expected, first start up and outdated settings.
//e.printStackTrace();
}
}
public static void loadSettings() { //utilizes the Disk Reader's caching system.
try {
//parse the cached file from memory
BytecodeViewer.viewer.rbr.setSelected(asBoolean(1));
BytecodeViewer.viewer.rsy.setSelected(asBoolean(2));
BytecodeViewer.viewer.din.setSelected(asBoolean(3));
BytecodeViewer.viewer.dc4.setSelected(asBoolean(4));
BytecodeViewer.viewer.das.setSelected(asBoolean(5));
BytecodeViewer.viewer.hes.setSelected(asBoolean(6));
BytecodeViewer.viewer.hdc.setSelected(asBoolean(7));
BytecodeViewer.viewer.dgs.setSelected(asBoolean(8));
BytecodeViewer.viewer.ner.setSelected(asBoolean(9));
BytecodeViewer.viewer.den.setSelected(asBoolean(10));
BytecodeViewer.viewer.rgn.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 11, false)));
BytecodeViewer.viewer.bto.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 12, false)));
BytecodeViewer.viewer.nns.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 13, false)));
BytecodeViewer.viewer.uto.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 14, false)));
BytecodeViewer.viewer.udv.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 15, false)));
BytecodeViewer.viewer.rer.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 16, false)));
BytecodeViewer.viewer.fdi.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 17, false)));
BytecodeViewer.viewer.asc.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 18, false)));
BytecodeViewer.viewer.decodeEnumSwitch.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 19, false)));
BytecodeViewer.viewer.sugarEnums.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 20, false)));
BytecodeViewer.viewer.decodeStringSwitch.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 21, false)));
BytecodeViewer.viewer.arrayiter.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 22, false)));
BytecodeViewer.viewer.collectioniter.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 23, false)));
BytecodeViewer.viewer.innerClasses.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 24, false)));
BytecodeViewer.viewer.removeBoilerPlate.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 25, false)));
BytecodeViewer.viewer.removeInnerClassSynthetics.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 26, false)));
BytecodeViewer.viewer.decodeLambdas.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 27, false)));
BytecodeViewer.viewer.hideBridgeMethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 28, false)));
BytecodeViewer.viewer.liftConstructorInit.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 29, false)));
BytecodeViewer.viewer.removeDeadMethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 30, false)));
BytecodeViewer.viewer.removeBadGenerics.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 31, false)));
BytecodeViewer.viewer.sugarAsserts.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 32, false)));
BytecodeViewer.viewer.sugarBoxing.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 33, false)));
BytecodeViewer.viewer.showVersion.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 34, false)));
BytecodeViewer.viewer.decodeFinally.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 35, false)));
BytecodeViewer.viewer.tidyMonitors.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 36, false)));
BytecodeViewer.viewer.lenient.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 37, false)));
BytecodeViewer.viewer.dumpClassPath.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 38, false)));
BytecodeViewer.viewer.comments.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 39, false)));
BytecodeViewer.viewer.forceTopSort.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 40, false)));
BytecodeViewer.viewer.forceTopSortAggress.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 41, false)));
BytecodeViewer.viewer.stringBuffer.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 42, false)));
BytecodeViewer.viewer.stringBuilder.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 43, false)));
BytecodeViewer.viewer.silent.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 44, false)));
BytecodeViewer.viewer.recover.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 45, false)));
BytecodeViewer.viewer.eclipse.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 46, false)));
BytecodeViewer.viewer.override.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 47, false)));
BytecodeViewer.viewer.showInferrable.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 48, false)));
BytecodeViewer.viewer.aexagg.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 49, false)));
BytecodeViewer.viewer.forceCondPropagate.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 50, false)));
BytecodeViewer.viewer.hideUTF.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 51, false)));
BytecodeViewer.viewer.hideLongStrings.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 52, false)));
BytecodeViewer.viewer.commentMonitor.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 53, false)));
BytecodeViewer.viewer.allowCorrecting.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 54, false)));
BytecodeViewer.viewer.labelledBlocks.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 55, false)));
BytecodeViewer.viewer.j14ClassOBJ.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 56, false)));
BytecodeViewer.viewer.hideLangImports.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 57, false)));
BytecodeViewer.viewer.recoveryTypeClash.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 58, false)));
BytecodeViewer.viewer.recoveryTypehInts.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 59, false)));
BytecodeViewer.viewer.forceTurningIFs.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 60, false)));
BytecodeViewer.viewer.forLoopAGGCapture.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 61, false)));
BytecodeViewer.viewer.forceExceptionPrune.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 62, false)));
BytecodeViewer.viewer.showDebugLineNumbers.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 63, false)));
BytecodeViewer.viewer.simplifyMemberReferences.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 64, false)));
BytecodeViewer.viewer.mergeVariables.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 65, false)));
BytecodeViewer.viewer.unicodeOutputEnabled.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 66, false)));
BytecodeViewer.viewer.retainPointlessSwitches.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 67, false)));
BytecodeViewer.viewer.includeLineNumbersInBytecode.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 68, false)));
BytecodeViewer.viewer.includeErrorDiagnostics.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 69, false)));
BytecodeViewer.viewer.retainRedunantCasts.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 70, false)));
BytecodeViewer.viewer.alwaysGenerateExceptionVars.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 71, false)));
BytecodeViewer.viewer.showSyntheticMembers.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 72, false)));
BytecodeViewer.viewer.forceExplicitTypeArguments.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 73, false)));
BytecodeViewer.viewer.forceExplicitImports.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 74, false)));
BytecodeViewer.viewer.flattenSwitchBlocks.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 75, false)));
BytecodeViewer.viewer.excludeNestedTypes.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 76, false)));
BytecodeViewer.viewer.appendBracketsToLabels.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 77, false)));
BytecodeViewer.viewer.debugHelpers.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 78, false)));
//79 is deprecated
BytecodeViewer.viewer.updateCheck.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 80, false)));
BytecodeViewer.viewer.viewPane1.setSelectedViewer(asInt(81));
BytecodeViewer.viewer.viewPane2.setSelectedViewer(asInt(82));
BytecodeViewer.viewer.viewPane3.setSelectedViewer(asInt(83));
BytecodeViewer.viewer.refreshOnChange.setSelected(asBoolean(84));
boolean bool = Boolean.parseBoolean(asString(85));
if (bool) {
BytecodeViewer.viewer.setExtendedState(JFrame.MAXIMIZED_BOTH);
BytecodeViewer.viewer.isMaximized = true;
}
//86 is deprecated
//87 is deprecated
Configuration.lastDirectory = asString(88);
Configuration.python = asString(89);
Configuration.rt = asString(90);
BytecodeViewer.viewer.viewPane1.getProcyon().getEditable().setSelected(asBoolean(91));
BytecodeViewer.viewer.viewPane1.getCFR().getEditable().setSelected(asBoolean(92));
BytecodeViewer.viewer.viewPane1.getFern().getEditable().setSelected(asBoolean(93));
BytecodeViewer.viewer.viewPane1.getKrakatau().getEditable().setSelected(asBoolean(94));
BytecodeViewer.viewer.viewPane1.getSmali().getEditable().setSelected(asBoolean(95));
BytecodeViewer.viewer.viewPane2.getProcyon().getEditable().setSelected(asBoolean(96));
BytecodeViewer.viewer.viewPane2.getCFR().getEditable().setSelected(asBoolean(97));
BytecodeViewer.viewer.viewPane2.getFern().getEditable().setSelected(asBoolean(98));
BytecodeViewer.viewer.viewPane2.getKrakatau().getEditable().setSelected(asBoolean(99));
BytecodeViewer.viewer.viewPane2.getSmali().getEditable().setSelected(asBoolean(100));
BytecodeViewer.viewer.viewPane3.getProcyon().getEditable().setSelected(asBoolean(101));
BytecodeViewer.viewer.viewPane3.getCFR().getEditable().setSelected(asBoolean(102));
BytecodeViewer.viewer.viewPane3.getFern().getEditable().setSelected(asBoolean(103));
BytecodeViewer.viewer.viewPane3.getKrakatau().getEditable().setSelected(asBoolean(104));
BytecodeViewer.viewer.viewPane3.getSmali().getEditable().setSelected(asBoolean(105));
BytecodeViewer.viewer.decodeAPKResources.setSelected(asBoolean(106));
Configuration.library = asString(107);
Configuration.pingback = asBoolean(108);
BytecodeViewer.viewer.viewPane1.getJD().getEditable().setSelected(asBoolean(109));
BytecodeViewer.viewer.viewPane2.getJD().getEditable().setSelected(asBoolean(110));
BytecodeViewer.viewer.viewPane3.getJD().getEditable().setSelected(asBoolean(111));
BytecodeViewer.viewer.fontSpinner.setValue(asInt(112));
Configuration.deleteForeignLibraries = asBoolean(113);
//APK Decompiler
switch(asInt(114))
{
case 0:
BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionDex.getModel(), true);
break;
case 1:
BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel(), true);
break;
}
Configuration.python3 = asString(115);
Configuration.javac = asString(116);
Configuration.java = asString(117);
BytecodeViewer.viewer.compileOnSave.setSelected(asBoolean(118));
BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(asBoolean(119));
Configuration.warnForEditing = asBoolean(120);
BytecodeViewer.viewer.showFileInTabTitle.setSelected(asBoolean(121));
Configuration.displayParentInTab = BytecodeViewer.viewer.showFileInTabTitle.isSelected();
BytecodeViewer.viewer.forcePureAsciiAsText.setSelected(asBoolean(122));
BytecodeViewer.viewer.synchronizedViewing.setSelected(asBoolean(123));
BytecodeViewer.viewer.showClassMethods.setSelected(asBoolean(124));
BytecodeViewer.viewer.ren.setSelected(asBoolean(125));
BytecodeViewer.viewer.viewPane1.getJADX().getEditable().setSelected(asBoolean(126));
//line 127 is used for theme on preload
//line 128 is used for theme on preload
BytecodeViewer.viewer.simplifyNameInTabTitle.setSelected(asBoolean(129));
Configuration.simplifiedTabNames = BytecodeViewer.viewer.simplifyNameInTabTitle.isSelected();
} catch (Exception e) {
//ignore because errors are expected, first start up and outdated settings.
//e.printStackTrace();
}
}
public static String asString(int lineNumber) throws Exception
{
return DiskReader.loadString(settingsName, lineNumber, false);
}
public static boolean asBoolean(int lineNumber) throws Exception
{
return Boolean.parseBoolean(DiskReader.loadString(settingsName, lineNumber, false));
}
public static int asInt(int lineNumber) throws Exception
{
return Integer.parseInt(DiskReader.loadString(settingsName, lineNumber, false));
}
}
public class Settings
{
public static boolean firstBoot = true; //stays true after settings load on first boot
public static boolean hasSetLanguageAsSystemLanguage = false;
private static List<String> recentPlugins;
private static List<String> recentFiles;
static
{
try
{
if (new File(filesName).exists())
recentFiles = gson.fromJson(DiskReader.loadAsString(filesName), new TypeToken<ArrayList<String>>() {}.getType());
else
recentFiles = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentfiles.bcv", false);
if (new File(pluginsName).exists())
recentPlugins = gson.fromJson(DiskReader.loadAsString(pluginsName), new TypeToken<ArrayList<String>>() {}.getType());
else
recentPlugins = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentplugins.bcv", false);
MiscUtils.deduplicateAndTrim(recentFiles, 25);
MiscUtils.deduplicateAndTrim(recentPlugins, 25);
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Add the recent file
*
* @param f the recent file
*/
public static void addRecentFile(File f)
{
recentFiles.remove(f.getAbsolutePath()); // already added on the list
recentFiles.add(0, f.getAbsolutePath());
MiscUtils.deduplicateAndTrim(recentFiles, 25);
DiskWriter.replaceFile(filesName, MiscUtils.listToString(recentFiles), false);
resetRecentFilesMenu();
}
/**
* Add to the recent plugin list
*
* @param f the plugin file
*/
public static void addRecentPlugin(File f)
{
recentPlugins.remove(f.getAbsolutePath()); // already added on the list
recentPlugins.add(0, f.getAbsolutePath());
MiscUtils.deduplicateAndTrim(recentPlugins, 25);
DiskWriter.replaceFile(pluginsName, MiscUtils.listToString(recentPlugins), false);
resetRecentFilesMenu();
}
/**
* resets the recent files menu
*/
protected static void resetRecentFilesMenu()
{
//build recent files
BytecodeViewer.viewer.recentFilesSecondaryMenu.removeAll();
for (String s : recentFiles)
{
if (!s.isEmpty())
{
JMenuItem m = new JMenuItem(s);
m.addActionListener(e ->
{
JMenuItem m12 = (JMenuItem) e.getSource();
BytecodeViewer.openFiles(new File[]{new File(m12.getText())}, true);
});
BytecodeViewer.viewer.recentFilesSecondaryMenu.add(m);
}
}
//build recent plugins
BytecodeViewer.viewer.recentPluginsSecondaryMenu.removeAll();
for (String s : recentPlugins)
{
if (!s.isEmpty())
{
JMenuItem m = new JMenuItem(s);
m.addActionListener(e ->
{
JMenuItem m1 = (JMenuItem) e.getSource();
BytecodeViewer.startPlugin(new File(m1.getText()));
});
BytecodeViewer.viewer.recentPluginsSecondaryMenu.add(m);
}
}
}
}

View file

@ -0,0 +1,531 @@
package the.bytecode.club.bytecodeviewer;
import javax.swing.JFrame;
import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const;
import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.gui.theme.RSTATheme;
import the.bytecode.club.bytecodeviewer.translation.Language;
import java.io.File;
import static the.bytecode.club.bytecodeviewer.Constants.*;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
/**
* Used to handle loading/saving the GUI (options).
*
* @author Konloch
*/
public class SettingsSerializer
{
private static boolean settingsFileExists;
public static void saveSettings() {
try {
DiskWriter.replaceFile(settingsName,
"BCV: " + VERSION, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rbr.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rsy.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.din.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.dc4.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.das.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hes.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hdc.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.dgs.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.ner.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.den.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rgn.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.bto.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.nns.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.uto.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.udv.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.rer.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.fdi.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.asc.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeEnumSwitch.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.sugarEnums.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeStringSwitch.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.collectioniter.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.innerClasses.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeBoilerPlate.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeInnerClassSynthetics.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeLambdas.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideBridgeMethods.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.liftConstructorInit.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeDeadMethods.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.removeBadGenerics.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.sugarAsserts.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.sugarBoxing.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showVersion.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeFinally.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.tidyMonitors.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.lenient.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.dumpClassPath.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.comments.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceTopSort.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceTopSortAggress.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.stringBuffer.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.stringBuilder.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.silent.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.recover.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.eclipse.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.override.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showInferrable.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceCondPropagate.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideUTF.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideLongStrings.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.commentMonitor.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.allowCorrecting.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.labelledBlocks.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.j14ClassOBJ.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.hideLangImports.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.recoveryTypeClash.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.recoveryTypehInts.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceTurningIFs.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forLoopAGGCapture.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceExceptionPrune.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showDebugLineNumbers.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.simplifyMemberReferences.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.mergeVariables.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.unicodeOutputEnabled.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.retainPointlessSwitches.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.includeLineNumbersInBytecode.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.includeErrorDiagnostics.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.retainRedunantCasts.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.alwaysGenerateExceptionVars.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showSyntheticMembers.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceExplicitTypeArguments.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forceExplicitImports.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.flattenSwitchBlocks.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.excludeNestedTypes.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.appendBracketsToLabels.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.debugHelpers.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
"deprecated", false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.updateCheck.isSelected()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(BytecodeViewer.viewer.viewPane1.getSelectedViewer()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(BytecodeViewer.viewer.viewPane2.getSelectedViewer()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(BytecodeViewer.viewer.viewPane3.getSelectedViewer()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.refreshOnChange.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.isMaximized), false);
DiskWriter.writeNewLine(settingsName,
"deprecated", false);
DiskWriter.writeNewLine(settingsName,
"deprecated", false);
DiskWriter.writeNewLine(settingsName,
Configuration.lastDirectory, false);
DiskWriter.writeNewLine(settingsName,
Configuration.python, false);
DiskWriter.writeNewLine(settingsName,
Configuration.rt, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getProcyon().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getCFR().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getFern().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getKrakatau().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getSmali().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getProcyon().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getCFR().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getFern().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getKrakatau().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getSmali().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getProcyon().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getCFR().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getFern().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getKrakatau().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getSmali().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.decodeAPKResources.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
Configuration.library, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(Configuration.pingback), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getJD().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane2.getJD().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane3.getJD().getJava().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.fontSpinner.getValue()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(Configuration.deleteForeignLibraries), false);
if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel()))
DiskWriter.writeNewLine(settingsName, "0", false);
else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel()))
DiskWriter.writeNewLine(settingsName, "1", false);
DiskWriter.writeNewLine(settingsName,
Configuration.python3, false);
DiskWriter.writeNewLine(settingsName,
Configuration.javac, false);
DiskWriter.writeNewLine(settingsName,
Configuration.java, false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.compileOnSave.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(Configuration.warnForEditing), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showFileInTabTitle.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.forcePureAsciiAsText.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.synchronizedViewing.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.showClassMethods.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.ren.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.viewPane1.getJADX().getEditable().isSelected()), false);
DiskWriter.writeNewLine(settingsName,
Configuration.lafTheme.name(), false);
DiskWriter.writeNewLine(settingsName,
Configuration.rstaTheme.name(), false);
DiskWriter.writeNewLine(settingsName,
String.valueOf(BytecodeViewer.viewer.simplifyNameInTabTitle.isSelected()), false);
DiskWriter.writeNewLine(settingsName,
Configuration.language.name(), false);
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
//utilizes the Disk Reader's caching system.
public static void loadSettings()
{
if(!settingsFileExists)
return;
Settings.firstBoot = false;
try
{
//parse the cached file from memory (from preload)
BytecodeViewer.viewer.rbr.setSelected(asBoolean(1));
BytecodeViewer.viewer.rsy.setSelected(asBoolean(2));
BytecodeViewer.viewer.din.setSelected(asBoolean(3));
BytecodeViewer.viewer.dc4.setSelected(asBoolean(4));
BytecodeViewer.viewer.das.setSelected(asBoolean(5));
BytecodeViewer.viewer.hes.setSelected(asBoolean(6));
BytecodeViewer.viewer.hdc.setSelected(asBoolean(7));
BytecodeViewer.viewer.dgs.setSelected(asBoolean(8));
BytecodeViewer.viewer.ner.setSelected(asBoolean(9));
BytecodeViewer.viewer.den.setSelected(asBoolean(10));
BytecodeViewer.viewer.rgn.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 11, false)));
BytecodeViewer.viewer.bto.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 12, false)));
BytecodeViewer.viewer.nns.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 13, false)));
BytecodeViewer.viewer.uto.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 14, false)));
BytecodeViewer.viewer.udv.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 15, false)));
BytecodeViewer.viewer.rer.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 16, false)));
BytecodeViewer.viewer.fdi.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 17, false)));
BytecodeViewer.viewer.asc.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 18, false)));
BytecodeViewer.viewer.decodeEnumSwitch.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 19, false)));
BytecodeViewer.viewer.sugarEnums.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 20, false)));
BytecodeViewer.viewer.decodeStringSwitch.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 21, false)));
BytecodeViewer.viewer.arrayiter.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 22, false)));
BytecodeViewer.viewer.collectioniter.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 23, false)));
BytecodeViewer.viewer.innerClasses.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 24, false)));
BytecodeViewer.viewer.removeBoilerPlate.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 25, false)));
BytecodeViewer.viewer.removeInnerClassSynthetics.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 26, false)));
BytecodeViewer.viewer.decodeLambdas.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 27, false)));
BytecodeViewer.viewer.hideBridgeMethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 28, false)));
BytecodeViewer.viewer.liftConstructorInit.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 29, false)));
BytecodeViewer.viewer.removeDeadMethods.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 30, false)));
BytecodeViewer.viewer.removeBadGenerics.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 31, false)));
BytecodeViewer.viewer.sugarAsserts.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 32, false)));
BytecodeViewer.viewer.sugarBoxing.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 33, false)));
BytecodeViewer.viewer.showVersion.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 34, false)));
BytecodeViewer.viewer.decodeFinally.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 35, false)));
BytecodeViewer.viewer.tidyMonitors.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 36, false)));
BytecodeViewer.viewer.lenient.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 37, false)));
BytecodeViewer.viewer.dumpClassPath.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 38, false)));
BytecodeViewer.viewer.comments.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 39, false)));
BytecodeViewer.viewer.forceTopSort.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 40, false)));
BytecodeViewer.viewer.forceTopSortAggress.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 41, false)));
BytecodeViewer.viewer.stringBuffer.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 42, false)));
BytecodeViewer.viewer.stringBuilder.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 43, false)));
BytecodeViewer.viewer.silent.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 44, false)));
BytecodeViewer.viewer.recover.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 45, false)));
BytecodeViewer.viewer.eclipse.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 46, false)));
BytecodeViewer.viewer.override.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 47, false)));
BytecodeViewer.viewer.showInferrable.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 48, false)));
BytecodeViewer.viewer.aexagg.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 49, false)));
BytecodeViewer.viewer.forceCondPropagate.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 50, false)));
BytecodeViewer.viewer.hideUTF.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 51, false)));
BytecodeViewer.viewer.hideLongStrings.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 52, false)));
BytecodeViewer.viewer.commentMonitor.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 53, false)));
BytecodeViewer.viewer.allowCorrecting.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 54, false)));
BytecodeViewer.viewer.labelledBlocks.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 55, false)));
BytecodeViewer.viewer.j14ClassOBJ.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 56, false)));
BytecodeViewer.viewer.hideLangImports.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 57, false)));
BytecodeViewer.viewer.recoveryTypeClash.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 58, false)));
BytecodeViewer.viewer.recoveryTypehInts.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 59, false)));
BytecodeViewer.viewer.forceTurningIFs.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 60, false)));
BytecodeViewer.viewer.forLoopAGGCapture.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 61, false)));
BytecodeViewer.viewer.forceExceptionPrune.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 62, false)));
BytecodeViewer.viewer.showDebugLineNumbers.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 63, false)));
BytecodeViewer.viewer.simplifyMemberReferences.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 64, false)));
BytecodeViewer.viewer.mergeVariables.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 65, false)));
BytecodeViewer.viewer.unicodeOutputEnabled.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 66, false)));
BytecodeViewer.viewer.retainPointlessSwitches.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 67, false)));
BytecodeViewer.viewer.includeLineNumbersInBytecode.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 68, false)));
BytecodeViewer.viewer.includeErrorDiagnostics.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 69, false)));
BytecodeViewer.viewer.retainRedunantCasts.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 70, false)));
BytecodeViewer.viewer.alwaysGenerateExceptionVars.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 71, false)));
BytecodeViewer.viewer.showSyntheticMembers.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 72, false)));
BytecodeViewer.viewer.forceExplicitTypeArguments.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 73, false)));
BytecodeViewer.viewer.forceExplicitImports.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 74, false)));
BytecodeViewer.viewer.flattenSwitchBlocks.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 75, false)));
BytecodeViewer.viewer.excludeNestedTypes.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 76, false)));
BytecodeViewer.viewer.appendBracketsToLabels.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 77, false)));
BytecodeViewer.viewer.debugHelpers.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 78, false)));
//79 is deprecated
BytecodeViewer.viewer.updateCheck.setSelected(Boolean.parseBoolean(DiskReader.loadString(settingsName, 80, false)));
BytecodeViewer.viewer.viewPane1.setSelectedViewer(asInt(81));
BytecodeViewer.viewer.viewPane2.setSelectedViewer(asInt(82));
BytecodeViewer.viewer.viewPane3.setSelectedViewer(asInt(83));
BytecodeViewer.viewer.refreshOnChange.setSelected(asBoolean(84));
boolean bool = Boolean.parseBoolean(asString(85));
if (bool) {
BytecodeViewer.viewer.setExtendedState(JFrame.MAXIMIZED_BOTH);
BytecodeViewer.viewer.isMaximized = true;
}
//86 is deprecated
//87 is deprecated
Configuration.lastDirectory = asString(88);
Configuration.python = asString(89);
Configuration.rt = asString(90);
BytecodeViewer.viewer.viewPane1.getProcyon().getEditable().setSelected(asBoolean(91));
BytecodeViewer.viewer.viewPane1.getCFR().getEditable().setSelected(asBoolean(92));
BytecodeViewer.viewer.viewPane1.getFern().getEditable().setSelected(asBoolean(93));
BytecodeViewer.viewer.viewPane1.getKrakatau().getEditable().setSelected(asBoolean(94));
BytecodeViewer.viewer.viewPane1.getSmali().getEditable().setSelected(asBoolean(95));
BytecodeViewer.viewer.viewPane2.getProcyon().getEditable().setSelected(asBoolean(96));
BytecodeViewer.viewer.viewPane2.getCFR().getEditable().setSelected(asBoolean(97));
BytecodeViewer.viewer.viewPane2.getFern().getEditable().setSelected(asBoolean(98));
BytecodeViewer.viewer.viewPane2.getKrakatau().getEditable().setSelected(asBoolean(99));
BytecodeViewer.viewer.viewPane2.getSmali().getEditable().setSelected(asBoolean(100));
BytecodeViewer.viewer.viewPane3.getProcyon().getEditable().setSelected(asBoolean(101));
BytecodeViewer.viewer.viewPane3.getCFR().getEditable().setSelected(asBoolean(102));
BytecodeViewer.viewer.viewPane3.getFern().getEditable().setSelected(asBoolean(103));
BytecodeViewer.viewer.viewPane3.getKrakatau().getEditable().setSelected(asBoolean(104));
BytecodeViewer.viewer.viewPane3.getSmali().getEditable().setSelected(asBoolean(105));
BytecodeViewer.viewer.decodeAPKResources.setSelected(asBoolean(106));
Configuration.library = asString(107);
Configuration.pingback = asBoolean(108);
BytecodeViewer.viewer.viewPane1.getJD().getEditable().setSelected(asBoolean(109));
BytecodeViewer.viewer.viewPane2.getJD().getEditable().setSelected(asBoolean(110));
BytecodeViewer.viewer.viewPane3.getJD().getEditable().setSelected(asBoolean(111));
BytecodeViewer.viewer.fontSpinner.setValue(asInt(112));
Configuration.deleteForeignLibraries = asBoolean(113);
//APK Decompiler
switch(asInt(114))
{
case 0:
BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionDex.getModel(), true);
break;
case 1:
BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel(), true);
break;
}
Configuration.python3 = asString(115);
Configuration.javac = asString(116);
Configuration.java = asString(117);
BytecodeViewer.viewer.compileOnSave.setSelected(asBoolean(118));
BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(asBoolean(119));
Configuration.warnForEditing = asBoolean(120);
BytecodeViewer.viewer.showFileInTabTitle.setSelected(asBoolean(121));
Configuration.displayParentInTab = BytecodeViewer.viewer.showFileInTabTitle.isSelected();
BytecodeViewer.viewer.forcePureAsciiAsText.setSelected(asBoolean(122));
BytecodeViewer.viewer.synchronizedViewing.setSelected(asBoolean(123));
BytecodeViewer.viewer.showClassMethods.setSelected(asBoolean(124));
BytecodeViewer.viewer.ren.setSelected(asBoolean(125));
BytecodeViewer.viewer.viewPane1.getJADX().getEditable().setSelected(asBoolean(126));
//line 127 is used for theme on preload
//line 128 is used for theme on preload
BytecodeViewer.viewer.simplifyNameInTabTitle.setSelected(asBoolean(129));
Configuration.simplifiedTabNames = BytecodeViewer.viewer.simplifyNameInTabTitle.isSelected();
//line 130 is used for preload
if(Configuration.language != Language.ENGLISH)
{
Language.ENGLISH.loadLanguage(); //load english first incase the translation file is missing anything
Configuration.language.loadLanguage(); //load translation file and swap as needed
}
Settings.hasSetLanguageAsSystemLanguage = true;
} catch (Exception e) {
e.printStackTrace();
//ignore because errors are expected, first start up and outdated settings.
//e.printStackTrace();
}
}
/**
* Preload data used to configure the looks and components of the application
*/
public static void preloadSettingsFile()
{
try
{
settingsFileExists = new File(settingsName).exists();
if(!settingsFileExists)
return;
//precache the file
DiskReader.loadString(settingsName, 0, true);
//process the cached file
Configuration.lafTheme = LAFTheme.valueOf(asString(127));
Configuration.rstaTheme = RSTATheme.valueOf(asString(128));
//line 129 is used normal loading
Configuration.language = Language.valueOf(asString(130));
}
catch (Exception e)
{
//ignore because errors are expected, first start up and outdated settings.
//e.printStackTrace();
}
}
public static String asString(int lineNumber) throws Exception
{
return DiskReader.loadString(settingsName, lineNumber, false);
}
public static boolean asBoolean(int lineNumber) throws Exception
{
return Boolean.parseBoolean(DiskReader.loadString(settingsName, lineNumber, false));
}
public static int asInt(int lineNumber) throws Exception
{
return Integer.parseInt(DiskReader.loadString(settingsName, lineNumber, false));
}
}

View file

@ -6,7 +6,6 @@ import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.HashMap;
import java.util.HashSet;
import javax.swing.JButton;
import javax.swing.JMenuItem;

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.ResourcePanelCompileMode;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.ResourceViewPanel;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane;
import the.bytecode.club.bytecodeviewer.gui.hexviewer.JHexEditor;
import java.awt.BorderLayout;
import java.awt.Container;
@ -26,7 +25,7 @@ import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Settings;
import the.bytecode.club.bytecodeviewer.SettingsSerializer;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.util.MethodParser;
@ -198,7 +197,7 @@ public class ClassViewer extends ResourceViewer
+ "test or export your changes.\nYou can set compile automatically on refresh or on save "
+ "in the settings menu.");
Settings.saveSettings();
SettingsSerializer.saveSettings();
}
}
}