More Command Line Options
This commit is contained in:
parent
c4f77bd47b
commit
9ab8ec7f8c
3 changed files with 24 additions and 12 deletions
|
@ -10,7 +10,6 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import me.konloch.kontainer.io.DiskReader;
|
import me.konloch.kontainer.io.DiskReader;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bootloader.Boot;
|
import the.bytecode.club.bootloader.Boot;
|
||||||
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
|
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.MainViewerGUI;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
|
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.plugin.PluginWriter;
|
||||||
import the.bytecode.club.bytecodeviewer.util.*;
|
import the.bytecode.club.bytecodeviewer.util.*;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource;
|
import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource;
|
||||||
|
@ -199,12 +197,12 @@ public class BytecodeViewer
|
||||||
{
|
{
|
||||||
bootCheck.start();
|
bootCheck.start();
|
||||||
|
|
||||||
Boot.boot(args, CLI != CommandLineInput.OPEN_FILE);
|
Boot.boot(args, CLI != CommandLineInput.GUI);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
installFatJar.start();
|
installFatJar.start();
|
||||||
|
|
||||||
if (CLI == CommandLineInput.OPEN_FILE)
|
if (CLI == CommandLineInput.GUI)
|
||||||
BytecodeViewer.boot(false);
|
BytecodeViewer.boot(false);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.commons.cli.Options;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
|
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.JarUtils;
|
||||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ public class CommandLineInput {
|
||||||
|
|
||||||
/*BECAUSE WHO DOESN'T LOVE MAGIC NUMBERS*/
|
/*BECAUSE WHO DOESN'T LOVE MAGIC NUMBERS*/
|
||||||
public static int STOP = -1;
|
public static int STOP = -1;
|
||||||
public static int OPEN_FILE = 0;
|
public static int GUI = 0;
|
||||||
public static int CLI = 1;
|
public static int CLI = 1;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -66,6 +67,8 @@ public class CommandLineInput {
|
||||||
CommandLine cmd = parser.parse(options, args);
|
CommandLine cmd = parser.parse(options, args);
|
||||||
if (
|
if (
|
||||||
cmd.hasOption("help") ||
|
cmd.hasOption("help") ||
|
||||||
|
cmd.hasOption("clean") ||
|
||||||
|
cmd.hasOption("english") ||
|
||||||
cmd.hasOption("list") ||
|
cmd.hasOption("list") ||
|
||||||
cmd.hasOption("decompiler") ||
|
cmd.hasOption("decompiler") ||
|
||||||
cmd.hasOption("i") ||
|
cmd.hasOption("i") ||
|
||||||
|
@ -84,7 +87,7 @@ public class CommandLineInput {
|
||||||
|
|
||||||
public static int parseCommandLine(String[] args) {
|
public static int parseCommandLine(String[] args) {
|
||||||
if (!containsCommand(args))
|
if (!containsCommand(args))
|
||||||
return OPEN_FILE;
|
return GUI;
|
||||||
try {
|
try {
|
||||||
CommandLine cmd = parser.parse(options, args);
|
CommandLine cmd = parser.parse(options, args);
|
||||||
if (cmd.hasOption("list")) {
|
if (cmd.hasOption("list")) {
|
||||||
|
@ -96,15 +99,24 @@ public class CommandLineInput {
|
||||||
System.out.println("JD-GUI");
|
System.out.println("JD-GUI");
|
||||||
System.out.println("Smali");
|
System.out.println("Smali");
|
||||||
return STOP;
|
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")) {
|
} else if (cmd.hasOption("help")) {
|
||||||
for (String s : new String[]{
|
for (String s : new String[]{
|
||||||
"-help Displays the help menu",
|
"-help Displays the help menu",
|
||||||
|
"-clean Deletes BCV directory",
|
||||||
|
"-english Forces English language translations",
|
||||||
"-list Displays the available decompilers",
|
"-list Displays the available decompilers",
|
||||||
"-decompiler <decompiler> Selects the decompiler, procyon by default",
|
"-decompiler <decompiler> Selects the decompiler, procyon by default",
|
||||||
"-i <input file> Selects the input file",
|
"-i <input file> Selects the input file",
|
||||||
"-o <output file> Selects the output file",
|
"-o <output file> Selects the output file",
|
||||||
"-t <target classname> Must either be the fully qualified classname or \"all\" to "
|
"-t <target classname> Must either be the fully qualified classname or \"all\" to decompile all as zip",
|
||||||
+ "decompile all as zip",
|
|
||||||
"-nowait Doesn't wait for the user to read the CLI messages"
|
"-nowait Doesn't wait for the user to read the CLI messages"
|
||||||
})
|
})
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
@ -165,7 +177,7 @@ public class CommandLineInput {
|
||||||
BytecodeViewer.handleException(e);
|
BytecodeViewer.handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OPEN_FILE;
|
return GUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void executeCommandLine(String[] args) {
|
public static void executeCommandLine(String[] args) {
|
||||||
|
@ -344,8 +356,7 @@ public class CommandLineInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Finished.");
|
System.out.println("Finished.");
|
||||||
System.out.println("Bytecode Viewer CLI v" + VERSION + " by @Konloch - "
|
System.out.println("Bytecode Viewer " + VERSION + " [CLI] - Created by @Konloch - https://bytecodeviewer.com");
|
||||||
+ "https://bytecodeviewer.com");
|
|
||||||
Configuration.canExit = true;
|
Configuration.canExit = true;
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -122,7 +122,10 @@ public class BootCheck implements Runnable
|
||||||
Boot.globalstop = false;
|
Boot.globalstop = false;
|
||||||
Boot.hide();
|
Boot.hide();
|
||||||
|
|
||||||
if (CommandLineInput.parseCommandLine(BytecodeViewer.launchArgs) == CommandLineInput.OPEN_FILE)
|
int CLI = CommandLineInput.parseCommandLine(BytecodeViewer.launchArgs);
|
||||||
|
|
||||||
|
|
||||||
|
if (CLI == CommandLineInput.GUI)
|
||||||
BytecodeViewer.boot(false);
|
BytecodeViewer.boot(false);
|
||||||
else {
|
else {
|
||||||
BytecodeViewer.boot(true);
|
BytecodeViewer.boot(true);
|
||||||
|
|
Loading…
Reference in a new issue