Skip to content

Commit

Permalink
Beta 1.3.1 (Lightweight and Speed updates)
Browse files Browse the repository at this point in the history
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes
the search feature inside of source/bytecode files, I'll implement a
search function soon.
10/29/2014 - Added a new decompiler option to append brackets to labels.
10/31/2014 - Fixed an issue with the decompiler still running when the
source code pane isn't toggled.

This update removes JSyntaxPane and replaces it with RSyntaxAreaPane,
this change improves speed greatly for bigger class files, there is
literally zero delay for syntax highlighting now.
  • Loading branch information
Konloch committed Nov 1, 2014
1 parent 7baee5d commit 2175437
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 54 deletions.
Binary file added BytecodeViewer Beta 1.3.1.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,8 @@ Changelog:
10/29/2014 - When saving as jars or zips, it'll automatically append the file extension if it's not added.
10/29/2014 - All the built in plugins no longer set the cursor to busy.
10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
10/29/2014 - Sped up start up time
10/29/2014 - Sped up start up time
--- Beta 1.3.1 ---:
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
10/29/2014 - Added a new decompiler option to append brackets to labels.
10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Beta 1.3
Beta 1.3.1
8 changes: 6 additions & 2 deletions src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
* 10/29/2014 - All the built in plugins no longer set the cursor to busy.
* 10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
* 10/29/2014 - Sped up start up time.
* ----Beta 1.3.1-----:
* 10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
* 10/29/2014 - Added a new decompiler option to append brackets to labels.
* 10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
*
* @author Konloch
*
Expand All @@ -155,7 +159,7 @@ public class BytecodeViewer {
public static String tempDirectory = "bcv_temp";
public static String fs = System.getProperty("file.separator");
public static String nl = System.getProperty("line.separator");
public static String version = "Beta 1.3";
public static String version = "Beta 1.3.1";

public static void main(String[] args) {
cleanup();
Expand All @@ -176,7 +180,7 @@ public void run() {
String version = reader.readLine();
reader.close();
if(!BytecodeViewer.version.equals(version))
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version);
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version+nl+nl+"https://github.com/Konloch/bytecode-viewer");
} catch(Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public InstructionPrinter(MethodNode m, InstructionPattern pattern, TypeAndName[
public ArrayList<String> createPrint() {
ArrayList<String> info = new ArrayList<String>();
ListIterator<?> it = mNode.instructions.iterator();
boolean firstLabel = false;
while (it.hasNext()) {
AbstractInsnNode ain = (AbstractInsnNode) it.next();
String line = "";
Expand All @@ -103,7 +104,16 @@ public ArrayList<String> createPrint() {
} else if (ain instanceof LineNumberNode) {
line = printLineNumberNode((LineNumberNode) ain, it);
} else if (ain instanceof LabelNode) {
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
info.add("}");

line = printLabelnode((LabelNode) ain);

if(BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()) {
if(!firstLabel)
firstLabel = true;
line += " {";
}
} else if (ain instanceof TypeInsnNode) {
line = printTypeInsnNode((TypeInsnNode) ain);
} else if (ain instanceof FrameNode) {
Expand All @@ -125,6 +135,8 @@ public ArrayList<String> createPrint() {
info.add(line);
}
}
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
info.add("}");
return info;
}

Expand Down
4 changes: 2 additions & 2 deletions src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class AboutWindow extends JFrame {
public AboutWindow() {
setSize(new Dimension(403, 484));
setSize(new Dimension(403, 374));
setType(Type.UTILITY);
setTitle("Bytecode Viewer - About");
getContentPane().setLayout(new CardLayout(0, 0));
Expand All @@ -17,7 +17,7 @@ public AboutWindow() {
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
txtrBytecodeViewerIs.setWrapStyleWord(true);
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
txtrBytecodeViewerIs.setText("Bytecode Viewer is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n JSyntaxPane by Ayman Al\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nLimitations:\r\n Syntax highlighting on files that are\r\nbigger than 10K lines can take a while to\r\nload, you may want to disable the syntax\r\nhighlighting for large files.\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
txtrBytecodeViewerIs.setText("Bytecode Viewer is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n JSyntaxPane by Ayman Al\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
txtrBytecodeViewerIs.setEnabled(false);
this.setResizable(false);
this.setLocationRelativeTo(null);
Expand Down
63 changes: 31 additions & 32 deletions src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import static javax.swing.ScrollPaneConstants.*;

import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
Expand All @@ -27,6 +26,9 @@
import javax.swing.text.ViewFactory;
import javax.swing.text.html.ParagraphView;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
Expand Down Expand Up @@ -101,8 +103,6 @@ public ClassViewer(final String name, final ClassNode cn) {
sourcePane = BytecodeViewer.viewer.sourcePane.isSelected();
bytecodePane = BytecodeViewer.viewer.bytecodePane.isSelected();
hexPane = BytecodeViewer.viewer.hexPane.isSelected();
boolean bytecodeSyntax = BytecodeViewer.viewer.bycSyntax.isSelected();
boolean sourcecodeSyntax = BytecodeViewer.viewer.srcSyntax.isSelected();
this.name = name;
this.cn = cn;
this.setName(name);
Expand All @@ -127,8 +127,6 @@ public ClassViewer(final String name, final ClassNode cn) {
resetDivider();
BytecodeViewer.viewer.setIcon(true);

//

startPaneUpdater();
this.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
Expand Down Expand Up @@ -166,38 +164,39 @@ public void startPaneUpdater() {
public void doShit() {
final String b = ClassNodeDecompiler.decompile(cn);

if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
s = ff_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
s = proc_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
s = cfr_dc.decompileClassNode(cn);
if(BytecodeViewer.viewer.sourcePane.isSelected()) {
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
s = ff_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
s = proc_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
s = cfr_dc.decompileClassNode(cn);
}

SwingUtilities.invokeLater(new Runnable() {
public void run() {
JEditorPane
bytecode = new JEditorPane(),
decomp = new JEditorPane();
JScrollPane
bytecodeScroll = new JScrollPane(bytecode),
decompScroll = new JScrollPane(decomp);

if(bytecodePane && BytecodeViewer.viewer.bycSyntax.isSelected())
bytecode.setContentType("text/java");
if(sourcePane && BytecodeViewer.viewer.srcSyntax.isSelected())
decomp.setContentType("text/java");

if(bytecodePane)
bytecode.setText(b);
if(sourcePane)
decomp.setText(s);
RSyntaxTextArea bytecodeArea = new RSyntaxTextArea();
bytecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
bytecodeArea.setCodeFoldingEnabled(true);
bytecodeArea.setAntiAliasingEnabled(true);
RTextScrollPane bytecodeSPane = new RTextScrollPane(bytecodeArea);
bytecodeArea.setText(b);

bytePanel.add(bytecodeScroll);
decompPanel.add(decompScroll);
RSyntaxTextArea sourcecodeArea = new RSyntaxTextArea();
sourcecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
sourcecodeArea.setCodeFoldingEnabled(true);
sourcecodeArea.setAntiAliasingEnabled(true);
RTextScrollPane sourcecodeSPane = new RTextScrollPane(sourcecodeArea);
sourcecodeArea.setText(s);

if(BytecodeViewer.viewer.bytecodePane.isSelected())
bytePanel.add(bytecodeSPane);
if(BytecodeViewer.viewer.sourcePane.isSelected())
decompPanel.add(sourcecodeSPane);

bytecodeArea.setCaretPosition(0);
sourcecodeArea.setCaretPosition(0);

bytecode.setCaretPosition(0);
decomp.setCaretPosition(0);

BytecodeViewer.viewer.setIcon(false);
}
});
Expand Down
8 changes: 7 additions & 1 deletion src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
private final JMenuItem mntmShowMainMethods = new JMenuItem("Show Main Methods");
private final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Jar..");
private JMenuBar menuBar = new JMenuBar();
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow Only ASCII Characters In Strings");
private final JMenuItem mntmReplaceStrings = new JMenuItem("Replace Strings");
private final JMenuItem mntmNewMenuItem_4 = new JMenuItem("");
private final JMenu mnNewMenu_2 = new JMenu("Java Decompiler");
Expand Down Expand Up @@ -167,6 +167,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_9 = new JCheckBoxMenuItem("Force Explicit Imports");
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_10 = new JCheckBoxMenuItem("Flatten Switch Blocks");
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem("Exclude Nested Types");
public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem("Append Brackets To Labels");


public void setC(boolean busy) {
Expand Down Expand Up @@ -308,6 +309,9 @@ public MainViewerGUI() {
forceturningifs.setSelected(true);
forloopaggcapture.setSelected(true);
//procyon
/*none*/
//other
chckbxmntmAppendBrackets.setSelected(true);

setJMenuBar(menuBar);

Expand Down Expand Up @@ -600,6 +604,8 @@ public void actionPerformed(ActionEvent arg0) {

mnBytecodeDecompilerSettings.add(debugHelpers);

mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets);

mnBytecodeDecompilerSettings.add(chckbxmntmNewCheckItem);

menuBar.add(mnNewMenu_1);
Expand Down
15 changes: 0 additions & 15 deletions src/the/bytecode/club/bytecodeviewer/gui/WorkPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.lang.reflect.Field;
import java.util.HashMap;

import javax.swing.JButton;
Expand All @@ -17,8 +15,6 @@
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import jsyntaxpane.DefaultSyntaxKit;

import org.objectweb.asm.tree.ClassNode;

import the.bytecode.club.bytecodeviewer.BytecodeViewer;
Expand Down Expand Up @@ -51,17 +47,6 @@ public WorkPane(final FileChangeNotifier fcn) {
super("WorkPanel");
setTitle("Work Space");

DefaultSyntaxKit.initKit();
Font defFont = null;
try {
final Field defFontField = DefaultSyntaxKit.class.getDeclaredField("DEFAULT_FONT");
defFontField.setAccessible(true);
defFont = (Font) defFontField.get(null);
} catch (final Exception e) {
e.printStackTrace();
}
SyntaxFontHeight = defFont.getSize();

this.tabs = new JTabbedPane();
this.fcn = fcn;

Expand Down

0 comments on commit 2175437

Please sign in to comment.