Small cleanups

This commit is contained in:
Konloch 2021-06-21 04:32:07 -07:00
parent 00a1bb539f
commit 1fc480ac2f
4 changed files with 13 additions and 11 deletions

View file

@ -14,6 +14,7 @@ import org.apache.commons.io.FileUtils;
import the.bytecode.club.bootloader.resource.EmptyExternalResource;
import the.bytecode.club.bootloader.resource.ExternalResource;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.util.ZipUtils;
@ -179,7 +180,7 @@ public class Boot {
System.out.println("Jar or Zip" + file.getAbsolutePath() + " is corrupt, redownloading.");
file.delete();
}
} else if (BytecodeViewer.verify) { //verify its not corrupt each boot (adds 3 seconds boot time)
} else if (Configuration.verifyCorruptedStateOnBoot) { //verify its not corrupt each boot (adds 3 seconds boot time)
try {
setState("Bytecode Viewer Boot Screen - Verifying " + fileName + "...");
System.out.println("Verifying " + fileName + "...");

View file

@ -97,7 +97,6 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
public class BytecodeViewer
{
public static boolean verify = false; //eventually may be a setting
public static String[] args;
public static MainViewerGUI viewer = null;
public static ClassNodeLoader loader = new ClassNodeLoader(); //might be insecure due to assholes targeting BCV,
@ -114,7 +113,7 @@ public class BytecodeViewer
/**
* Pings back to bytecodeviewer.com to be added into the total running statistics
*/
private static final Thread PingBack = new Thread(() -> {
private static final Thread pingBack = new Thread(() -> {
try {
new HTTPRequest(new URL("https://bytecodeviewer.com/add.php")).read();
} catch (Exception e) {
@ -125,7 +124,7 @@ public class BytecodeViewer
/**
* Downloads & installs the krakatau & enjarify zips
*/
private static final Thread InstallFatJar = new Thread(() -> {
private static final Thread installFatJar = new Thread(() -> {
try {
if (OFFLINE_MODE) {
Boot.dropKrakatau();
@ -196,12 +195,12 @@ public class BytecodeViewer
Boot.boot(args, CLI != CommandLineInput.OPEN_FILE);
} else
InstallFatJar.start();
installFatJar.start();
if (CLI == CommandLineInput.OPEN_FILE)
BytecodeViewer.BOOT(false);
BytecodeViewer.boot(false);
else {
BytecodeViewer.BOOT(true);
BytecodeViewer.boot(true);
CommandLineInput.executeCommandLine(args);
}
} catch (Exception e) {
@ -214,7 +213,7 @@ public class BytecodeViewer
*
* @param cli is it running CLI mode or not
*/
public static void BOOT(boolean cli) {
public static void boot(boolean cli) {
cleanup();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
for (Process proc : createdProcesses)
@ -227,7 +226,7 @@ public class BytecodeViewer
resetRecentFilesMenu();
if (!Configuration.pingback) {
PingBack.start();
pingBack.start();
Configuration.pingback = true;
}

View file

@ -27,5 +27,7 @@ public class Configuration
public static boolean deleteForeignLibraries = true;
public static boolean canExit = false;
public static boolean verifyCorruptedStateOnBoot = false; //eventually may be a setting
public static long lastHotKeyExecuted = System.currentTimeMillis();
}

View file

@ -83,9 +83,9 @@ public class BootCheck implements Runnable
Boot.hide();
if (CommandLineInput.parseCommandLine(BytecodeViewer.args) == CommandLineInput.OPEN_FILE)
BytecodeViewer.BOOT(false);
BytecodeViewer.boot(false);
else {
BytecodeViewer.BOOT(true);
BytecodeViewer.boot(true);
CommandLineInput.executeCommandLine(BytecodeViewer.args);
}
}