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); 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)) if ((he.buff[n] < 20) || (he.buff[n] > 126))
s = "" + (char) 16; s = ".";//"" + (char) 16;
he.printString(g, s, (x++), y); he.printString(g, s, (x++), y);
if (x == 16) { if (x == 16) {
x = 0; x = 0;

View file

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

View file

@ -48,12 +48,12 @@ public class JavaCompiler extends Compiler {
tempD.mkdirs(); tempD.mkdirs();
new File(fileStart2).mkdirs(); new File(fileStart2).mkdirs();
if (BytecodeViewer.javac.equals("")) { 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/JRE_xx/bin/javac.exe)"); 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(); BytecodeViewer.viewer.javac();
} }
if (BytecodeViewer.javac.equals("")) { if (BytecodeViewer.javac.equals("") || !new File(BytecodeViewer.javac).exists()) {
BytecodeViewer.showMessage("You need to set Javac!"); BytecodeViewer.showMessage("You need to set Javac!");
return null; return null;
} }

View file

@ -112,7 +112,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
@Override @Override
public String getDescription() { 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); fc.setFileHidingEnabled(false);
@ -137,7 +137,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
@Override @Override
public String getDescription() { 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); fc.setFileHidingEnabled(false);

View file

@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
import java.util.ArrayList; import java.util.ArrayList;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode; 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[]) * Simply shows all classes that have a public static void main(String[])
* *
* @author Konloch * @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 @Override
public void execute(ArrayList<ClassNode> classNodeList) { public void execute(ArrayList<ClassNode> classNodeList) {
PluginConsole frame = new PluginConsole("Show Main Methods"); PluginConsole frame = new PluginConsole("Show Main Methods");
StringBuilder sb = new StringBuilder();
for (ClassNode classNode : classNodeList) { for (ClassNode classNode : classNodeList) {
for (Object o : classNode.methods.toArray()) { for (Object o : classNode.methods.toArray()) {
MethodNode m = (MethodNode) o; MethodNode m = (MethodNode) o;
if (m.name.equals("main") if ((m.access & (PUBLIC_STATIC)) == PUBLIC_STATIC)
&& m.desc.equals("([Ljava/lang/String;)V")) {
frame.appendText(classNode.name + "." + m.name + "" if (m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V"))
+ m.desc); {
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); frame.setVisible(true);
} }
} }