diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 742b3af4..04908a5a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -10,7 +10,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import me.konloch.kontainer.io.DiskReader; import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bootloader.Boot; import the.bytecode.club.bytecodeviewer.api.ExceptionUI; @@ -20,7 +19,6 @@ import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer; import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer; -import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.PluginWriter; import the.bytecode.club.bytecodeviewer.util.*; import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource; @@ -199,12 +197,12 @@ public class BytecodeViewer { bootCheck.start(); - Boot.boot(args, CLI != CommandLineInput.OPEN_FILE); + Boot.boot(args, CLI != CommandLineInput.GUI); } else installFatJar.start(); - if (CLI == CommandLineInput.OPEN_FILE) + if (CLI == CommandLineInput.GUI) BytecodeViewer.boot(false); else { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java b/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java index 9d62ed00..2675c30d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/CommandLineInput.java @@ -9,6 +9,7 @@ import org.apache.commons.cli.Options; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.decompilers.Decompiler; +import the.bytecode.club.bytecodeviewer.translation.Language; import the.bytecode.club.bytecodeviewer.util.JarUtils; import the.bytecode.club.bytecodeviewer.util.MiscUtils; @@ -45,7 +46,7 @@ public class CommandLineInput { /*BECAUSE WHO DOESN'T LOVE MAGIC NUMBERS*/ public static int STOP = -1; - public static int OPEN_FILE = 0; + public static int GUI = 0; public static int CLI = 1; static { @@ -66,6 +67,8 @@ public class CommandLineInput { CommandLine cmd = parser.parse(options, args); if ( cmd.hasOption("help") || + cmd.hasOption("clean") || + cmd.hasOption("english") || cmd.hasOption("list") || cmd.hasOption("decompiler") || cmd.hasOption("i") || @@ -84,7 +87,7 @@ public class CommandLineInput { public static int parseCommandLine(String[] args) { if (!containsCommand(args)) - return OPEN_FILE; + return GUI; try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("list")) { @@ -96,15 +99,24 @@ public class CommandLineInput { System.out.println("JD-GUI"); System.out.println("Smali"); return STOP; + } else if (cmd.hasOption("clean")) { + new File(Constants.getBCVDirectory()).delete(); + if(cmd.getOptionValue("i") == null && cmd.getOptionValue("o") == null + && cmd.getOptionValue("t") == null) + return GUI; + } else if (cmd.hasOption("english")) { + Configuration.language = Language.ENGLISH; + return GUI; } else if (cmd.hasOption("help")) { for (String s : new String[]{ "-help Displays the help menu", + "-clean Deletes BCV directory", + "-english Forces English language translations", "-list Displays the available decompilers", "-decompiler Selects the decompiler, procyon by default", "-i Selects the input file", "-o Selects the output file", - "-t Must either be the fully qualified classname or \"all\" to " - + "decompile all as zip", + "-t Must either be the fully qualified classname or \"all\" to decompile all as zip", "-nowait Doesn't wait for the user to read the CLI messages" }) System.out.println(s); @@ -165,7 +177,7 @@ public class CommandLineInput { BytecodeViewer.handleException(e); } - return OPEN_FILE; + return GUI; } public static void executeCommandLine(String[] args) { @@ -344,8 +356,7 @@ public class CommandLineInput { } System.out.println("Finished."); - System.out.println("Bytecode Viewer CLI v" + VERSION + " by @Konloch - " - + "https://bytecodeviewer.com"); + System.out.println("Bytecode Viewer " + VERSION + " [CLI] - Created by @Konloch - https://bytecodeviewer.com"); Configuration.canExit = true; System.exit(0); } catch (Exception e) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/BootCheck.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/BootCheck.java index bc65a08a..b6bfe169 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/BootCheck.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/BootCheck.java @@ -122,7 +122,10 @@ public class BootCheck implements Runnable Boot.globalstop = false; Boot.hide(); - if (CommandLineInput.parseCommandLine(BytecodeViewer.launchArgs) == CommandLineInput.OPEN_FILE) + int CLI = CommandLineInput.parseCommandLine(BytecodeViewer.launchArgs); + + + if (CLI == CommandLineInput.GUI) BytecodeViewer.boot(false); else { BytecodeViewer.boot(true);