v2.9.16 changes

This commit is contained in:
Konloch 2019-04-13 15:43:10 -06:00
parent ad876e79a0
commit fbb9ee9b97
5 changed files with 36 additions and 14 deletions

View file

@ -69,9 +69,9 @@ public class JHexEditorASCII extends JComponent implements MouseListener,
g.setColor(Color.black);
}
String s = "" + new Character((char) he.buff[n]);
String s = String.valueOf((char) (he.buff[n] & 0xFF));//"" + new Character((char) he.buff[n]);
if ((he.buff[n] < 20) || (he.buff[n] > 126))
s = "" + (char) 16;
s = ".";//"" + (char) 16;
he.printString(g, s, (x++), y);
if (x == 16) {
x = 0;

View file

@ -122,7 +122,7 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
public class BytecodeViewer
{
/*per version*/
public static String version = "2.9.15";
public static String version = "2.9.16";
public static boolean previewCopy = false;
public static boolean fatJar = true; //could be automatic by checking if it's loaded a class named whatever for a library
/*the rest*/
@ -620,7 +620,7 @@ public class BytecodeViewer
boolean empty = java.isEmpty();
while (empty) {
showMessage("You need to set your Java path, this requires the JRE to be downloaded." + BytecodeViewer.nl +
"(C:/programfiles/Java/JRE_xx/bin/java.exe)");
"(C:/programfiles/Java/JDK_xx/bin/java.exe)");
viewer.java();
empty = java.isEmpty();
}

View file

@ -48,12 +48,12 @@ public class JavaCompiler extends Compiler {
tempD.mkdirs();
new File(fileStart2).mkdirs();
if (BytecodeViewer.javac.equals("")) {
BytecodeViewer.showMessage("You need to set your Javac path, this requires the JDK to be downloaded." + BytecodeViewer.nl + "(C:/programfiles/Java/JRE_xx/bin/javac.exe)");
if (BytecodeViewer.javac.equals("") || !new File(BytecodeViewer.javac).exists()) {
BytecodeViewer.showMessage("You need to set your Javac path, this requires the JDK to be downloaded." + BytecodeViewer.nl + "(C:/programfiles/Java/JDK_xx/bin/javac.exe)");
BytecodeViewer.viewer.javac();
}
if (BytecodeViewer.javac.equals("")) {
if (BytecodeViewer.javac.equals("") || !new File(BytecodeViewer.javac).exists()) {
BytecodeViewer.showMessage("You need to set Javac!");
return null;
}

View file

@ -112,7 +112,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
@Override
public String getDescription() {
return "Javac Executable (Requires JDK 'C:/programfiles/Java/JRE_xx/bin/javac.exe)";
return "Javac Executable (Requires JDK 'C:/programfiles/Java/JDK_xx/bin/javac.exe)";
}
});
fc.setFileHidingEnabled(false);
@ -137,7 +137,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
@Override
public String getDescription() {
return "Java Executable (Inside Of JRE/JDK 'C:/programfiles/Java/JRE_xx/bin/java.exe')";
return "Java Executable (Inside Of JRE/JDK 'C:/programfiles/Java/JDK_xx/bin/java.exe')";
}
});
fc.setFileHidingEnabled(false);

View file

@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
import java.util.ArrayList;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
@ -30,23 +31,44 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole;
* Simply shows all classes that have a public static void main(String[])
*
* @author Konloch
* @author Sh1ftchg
*/
public class ShowMainMethods extends Plugin {
public class ShowMainMethods extends Plugin
{
private static final int PUBLIC_STATIC = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC;
@Override
public void execute(ArrayList<ClassNode> classNodeList) {
PluginConsole frame = new PluginConsole("Show Main Methods");
StringBuilder sb = new StringBuilder();
for (ClassNode classNode : classNodeList) {
for (Object o : classNode.methods.toArray()) {
MethodNode m = (MethodNode) o;
if (m.name.equals("main")
&& m.desc.equals("([Ljava/lang/String;)V"))
frame.appendText(classNode.name + "." + m.name + ""
+ m.desc);
if ((m.access & (PUBLIC_STATIC)) == PUBLIC_STATIC)
{
if (m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V"))
{
sb.append(classNode.name);
sb.append(".");
sb.append(m.name);
sb.append(m.desc);
sb.append("\n");
}
}
}
}
if(sb.length() == 0)
{
frame.appendText("No main methods found.");
}
else
{
frame.appendText(sb.toString());
}
frame.setVisible(true);
}
}