Optimize various stuff
This commit is contained in:
parent
dac8dcc6c7
commit
86fb69f694
|
@ -14,35 +14,35 @@
|
|||
<lib>w32api/libshell32.a</lib>
|
||||
<jar>H:\Repo\BCV\bytecode-viewer\BytecodeViewer 2.9.8.jar</jar>
|
||||
<outfile>H:\Repo\BCV\bytecode-viewer\BytecodeViewer.exe</outfile>
|
||||
<errTitle></errTitle>
|
||||
<cmdLine></cmdLine>
|
||||
<errTitle/>
|
||||
<cmdLine/>
|
||||
<chdir>.</chdir>
|
||||
<priority>normal</priority>
|
||||
<downloadUrl>http://java.com/download</downloadUrl>
|
||||
<supportUrl></supportUrl>
|
||||
<downloadUrl>https://java.com/de/download/</downloadUrl>
|
||||
<supportUrl/>
|
||||
<stayAlive>false</stayAlive>
|
||||
<restartOnCrash>false</restartOnCrash>
|
||||
<manifest></manifest>
|
||||
<manifest/>
|
||||
<icon>H:\Repo\BCV\bytecode-viewer\BCV Icon.ico</icon>
|
||||
<jre>
|
||||
<path></path>
|
||||
<path/>
|
||||
<bundledJre64Bit>false</bundledJre64Bit>
|
||||
<bundledJreAsFallback>false</bundledJreAsFallback>
|
||||
<minVersion>1.7.0_00</minVersion>
|
||||
<maxVersion></maxVersion>
|
||||
<maxVersion/>
|
||||
<jdkPreference>preferJre</jdkPreference>
|
||||
<runtimeBits>64/32</runtimeBits>
|
||||
</jre>
|
||||
<versionInfo>
|
||||
<fileVersion>0.2.9.7</fileVersion>
|
||||
<txtFileVersion>http://the.bytecode.club</txtFileVersion>
|
||||
<txtFileVersion>https://the.bytecode.club/</txtFileVersion>
|
||||
<fileDescription>Bytecode Viewer</fileDescription>
|
||||
<copyright>http://bytecodeviewer.com</copyright>
|
||||
<copyright>https://bytecodeviewer.com/</copyright>
|
||||
<productVersion>0.2.9.6</productVersion>
|
||||
<txtProductVersion>http://the.bytecode.club</txtProductVersion>
|
||||
<txtProductVersion>https://the.bytecode.club/</txtProductVersion>
|
||||
<productName>Bytecode Viewer</productName>
|
||||
<companyName></companyName>
|
||||
<companyName/>
|
||||
<internalName>BCV</internalName>
|
||||
<originalFilename>Bytecode_Viewer.exe</originalFilename>
|
||||
</versionInfo>
|
||||
</launch4jConfig>
|
||||
</launch4jConfig>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import the.bytecode.club.bytecodeviewer.api.*;
|
||||
import java.util.ArrayList;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import the.bytecode.club.bytecodeviewer.decompilers.*;
|
||||
import org.objectweb.asm.tree.ClassNode
|
||||
import the.bytecode.club.bytecodeviewer.api.Plugin
|
||||
import the.bytecode.club.bytecodeviewer.api.PluginConsole
|
||||
|
||||
public class Skeleton extends Plugin {
|
||||
class Skeleton extends Plugin {
|
||||
|
||||
@Override
|
||||
public void execute(ArrayList<ClassNode> classNodesList) {
|
||||
PluginConsole gui = new PluginConsole("Skeleton");
|
||||
gui.setVisible(true);
|
||||
gui.appendText("executed skeleton");
|
||||
void execute(List<ClassNode> classNodesList) {
|
||||
PluginConsole gui = new PluginConsole("Skeleton")
|
||||
gui.setVisible(true)
|
||||
gui.appendText("executed skeleton")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,52 +1,54 @@
|
|||
import the.bytecode.club.bytecodeviewer.api.*
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.lang.reflect.Field;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.ClassNode
|
||||
import org.objectweb.asm.tree.FieldNode
|
||||
import the.bytecode.club.bytecodeviewer.api.BCV
|
||||
import the.bytecode.club.bytecodeviewer.api.Plugin
|
||||
import the.bytecode.club.bytecodeviewer.api.PluginConsole
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.nl;
|
||||
import java.lang.reflect.Field
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.nl
|
||||
|
||||
/**
|
||||
* This is an example of a string decrypter plugin
|
||||
*/
|
||||
public class ExampleStringDecrypter extends Plugin {
|
||||
class ExampleStringDecrypter extends Plugin {
|
||||
|
||||
@Override
|
||||
public void execute(ArrayList<ClassNode> classNodesList) {
|
||||
PluginConsole gui = new PluginConsole("Example String Decrypter");
|
||||
void execute(List<ClassNode> classNodesList) {
|
||||
PluginConsole gui = new PluginConsole("Example String Decrypter")
|
||||
|
||||
MultipleChoiceDialog dialog = new MultipleChoiceDialog("Bytecode Viewer - WARNING",
|
||||
"WARNING: This will load the classes into the JVM and execute the initialize function"
|
||||
+ nl + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.",
|
||||
new String[]{"Continue", "Cancel"});
|
||||
new String[]{"Continue", "Cancel"})
|
||||
|
||||
if(dialog.promptChoice() == 0)
|
||||
{
|
||||
for(ClassNode cn : classNodesList)
|
||||
{
|
||||
BCV.getClassNodeLoader().addClass(cn);
|
||||
BCV.getClassNodeLoader().addClass(cn)
|
||||
|
||||
for(Object o : cn.fields.toArray())
|
||||
{
|
||||
FieldNode f = (FieldNode) o;
|
||||
if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
|
||||
FieldNode f = (FieldNode) o
|
||||
if(f.name == "z") {// && f.desc.equals("([Ljava/lang/String;)V")) {
|
||||
try
|
||||
{
|
||||
for(Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields())
|
||||
{
|
||||
String s = f2.get(null);
|
||||
if(s != null && !s.empty())
|
||||
gui.appendText(cn+":"+s);
|
||||
String s = f2.get(null)
|
||||
if(s != null && !s.empty)
|
||||
gui.appendText(cn + ":" + s)
|
||||
}
|
||||
} catch(Exception | StackOverflowError e) {}
|
||||
} catch(Exception | StackOverflowError ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gui.setVisible(true);
|
||||
gui.setVisible(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ public class BCV
|
|||
{
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) { }
|
||||
} catch (InterruptedException ignored) { }
|
||||
}
|
||||
|
||||
frame.setVisible(false);
|
||||
|
|
|
@ -296,7 +296,7 @@ public class Boot {
|
|||
public static void dropKrakatau() {
|
||||
File temp = new File(getBCVDirectory() + fs + "krakatau_" + krakatauVersion + ".zip");
|
||||
File krakatauDirectory = new File(krakatauWorkingDirectory);
|
||||
Constants.krakatauWorkingDirectory = krakatauWorkingDirectory + fs + "Krakatau-master";
|
||||
krakatauWorkingDirectory += fs + "Krakatau-master";
|
||||
if (!krakatauDirectory.exists() || temp.exists()) {
|
||||
if (temp.exists())
|
||||
temp.delete();
|
||||
|
@ -308,7 +308,7 @@ public class Boot {
|
|||
temp.delete();
|
||||
|
||||
try (InputStream is = BytecodeViewer.class.getClassLoader().getResourceAsStream("Krakatau-"
|
||||
+ Constants.krakatauVersion + ".zip");
|
||||
+ krakatauVersion + ".zip");
|
||||
FileOutputStream baos = new FileOutputStream(temp)) {
|
||||
int r;
|
||||
byte[] buffer = new byte[8192];
|
||||
|
@ -329,7 +329,7 @@ public class Boot {
|
|||
public static void dropEnjarify() {
|
||||
File temp = new File(getBCVDirectory() + fs + "enjarify" + Constants.enjarifyVersion + ".zip");
|
||||
File enjarifyDirectory = new File(Constants.enjarifyWorkingDirectory);
|
||||
Constants.enjarifyWorkingDirectory = Constants.enjarifyWorkingDirectory + fs + "enjarify-master";
|
||||
Constants.enjarifyWorkingDirectory += fs + "enjarify-master";
|
||||
if (!enjarifyDirectory.exists() || temp.exists()) {
|
||||
if (temp.exists())
|
||||
temp.delete();
|
||||
|
@ -359,7 +359,7 @@ public class Boot {
|
|||
}
|
||||
}
|
||||
|
||||
public static void downloadZipsOnly() throws Exception {
|
||||
public static void downloadZipsOnly() {
|
||||
for (String s : urlList) {
|
||||
String fileName = s.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length()
|
||||
);
|
||||
|
|
|
@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.bootloader.classtree;
|
|||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -45,8 +44,6 @@ public class ClassHelper {
|
|||
}
|
||||
|
||||
public static <T, K> void copy(Map<T, K> src, Map<T, K> dst) {
|
||||
for (Entry<T, K> e : src.entrySet()) {
|
||||
dst.put(e.getKey(), e.getValue());
|
||||
}
|
||||
dst.putAll(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package the.bytecode.club.bytecodeviewer.bootloader.resource.external;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -38,7 +37,7 @@ public class EmptyExternalResource<T> extends ExternalResource<T> {
|
|||
* @see the.bytecode.club.bootloader.resource.ExternalResource#load()
|
||||
*/
|
||||
@Override
|
||||
public T load() throws IOException {
|
||||
public T load() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,8 +162,6 @@ public class ClassNodeDecompiler
|
|||
if (!tokens.contains("interface") && !tokens.contains("enum")
|
||||
&& !tokens.contains("annotation"))
|
||||
tokens.add("class");
|
||||
if (tokens.size() == 0)
|
||||
return "[Error parsing]";
|
||||
|
||||
// hackery delimeters
|
||||
StringBuilder sb = new StringBuilder(tokens.get(0));
|
||||
|
|
|
@ -316,7 +316,6 @@ public class CFRDecompiler extends InternalDecompiler
|
|||
fuck.delete();
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public void zip(File directory, File zipFile) throws IOException {
|
||||
java.net.URI base = directory.toURI();
|
||||
Deque<File> queue = new LinkedList<>();
|
||||
|
|
|
@ -226,7 +226,7 @@ public class KrakatauDecompiler extends InternalDecompiler
|
|||
}
|
||||
|
||||
int exitValue = process.waitFor();
|
||||
log.append(nl).append(nl).append(TranslatedStrings.EXIT_VALUE_IS + " ").append(exitValue);
|
||||
log.append(nl).append(nl).append(TranslatedStrings.EXIT_VALUE_IS).append(" ").append(exitValue);
|
||||
s = log.toString();
|
||||
|
||||
//if the motherfucker failed this'll fail, aka wont set.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package the.bytecode.club.bytecodeviewer.decompilers.jdgui;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import org.jd.core.v1.api.printer.Printer;
|
||||
|
||||
|
@ -230,7 +229,7 @@ public class PlainTextPrinter implements Printer, Closeable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
if (this.printStream != null)
|
||||
this.printStream.close();
|
||||
}
|
||||
|
|
|
@ -119,9 +119,7 @@ public class ExtendedJOptionPane
|
|||
|
||||
int style = styleFromMessageType(messageType);
|
||||
JDialog dialog = createNewJDialog(parentComponent, pane, title, style, (d)->
|
||||
{
|
||||
pane.selectInitialValue();
|
||||
});
|
||||
pane.selectInitialValue());
|
||||
|
||||
pane.selectInitialValue();
|
||||
|
||||
|
@ -163,9 +161,7 @@ public class ExtendedJOptionPane
|
|||
|
||||
int style = styleFromMessageType(messageType);
|
||||
JDialog dialog = createNewJDialog(parentComponent, pane, title, style, (d)->
|
||||
{
|
||||
pane.selectInitialValue();
|
||||
});
|
||||
pane.selectInitialValue());
|
||||
|
||||
pane.selectInitialValue();
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package the.bytecode.club.bytecodeviewer.gui.components;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import javax.swing.JTextArea;
|
||||
|
@ -65,7 +64,7 @@ public class JTextAreaOutputStream extends OutputStream implements Closeable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
if (og != null)
|
||||
og.close();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
|||
*/
|
||||
public class ContextMenu
|
||||
{
|
||||
private static ContextMenu SINGLETON = new ContextMenu();
|
||||
private static final ContextMenu SINGLETON = new ContextMenu();
|
||||
private final List<ContextMenuItem> contextMenuItems = new ArrayList<>();
|
||||
|
||||
static
|
||||
|
@ -85,11 +85,11 @@ public class ContextMenu
|
|||
switch(item.getMenuType())
|
||||
{
|
||||
case CONTAINER:
|
||||
if(!isContainerSelected || searchBoxPane)
|
||||
if(!isContainerSelected)
|
||||
continue;
|
||||
break;
|
||||
case RESOURCE:
|
||||
if(!isResourceSelected || isContainerSelected || searchBoxPane)
|
||||
if(!isResourceSelected || isContainerSelected)
|
||||
continue;
|
||||
break;
|
||||
case DIRECTORY:
|
||||
|
|
|
@ -34,15 +34,13 @@ public class Collapse extends ContextMenuItem
|
|||
public Collapse()
|
||||
{
|
||||
super(ContextMenuType.DIRECTORY, ((tree, selPath, result, menu) ->
|
||||
{
|
||||
menu.add(new AbstractAction(TranslatedStrings.COLLAPSE.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.expandAll(tree, selPath, false);
|
||||
}
|
||||
});
|
||||
}));
|
||||
menu.add(new AbstractAction(TranslatedStrings.COLLAPSE.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.expandAll(tree, selPath, false);
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,15 +34,13 @@ public class Delete extends ContextMenuItem
|
|||
public Delete()
|
||||
{
|
||||
super(ContextMenuType.CONTAINER, ((tree, selPath, result, menu) ->
|
||||
{
|
||||
menu.add(new AbstractAction(TranslatedStrings.DELETE.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.removeNode(tree, selPath);
|
||||
}
|
||||
});
|
||||
}));
|
||||
menu.add(new AbstractAction(TranslatedStrings.DELETE.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.removeNode(tree, selPath);
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,15 +34,13 @@ public class Expand extends ContextMenuItem
|
|||
public Expand()
|
||||
{
|
||||
super(ContextMenuType.DIRECTORY, ((tree, selPath, result, menu) ->
|
||||
{
|
||||
menu.add(new AbstractAction(TranslatedStrings.EXPAND.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.expandAll(tree, selPath, true);
|
||||
}
|
||||
});
|
||||
}));
|
||||
menu.add(new AbstractAction(TranslatedStrings.EXPAND.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.expandAll(tree, selPath, true);
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,8 +77,7 @@ public class New extends ContextMenuItem
|
|||
return;
|
||||
|
||||
byte[] contents = new byte[0];
|
||||
String resourcePath = newPath;
|
||||
|
||||
|
||||
switch(fileType)
|
||||
{
|
||||
case CLASS:
|
||||
|
@ -89,7 +88,7 @@ public class New extends ContextMenuItem
|
|||
|
||||
//TODO santize newPath and remove extension if added
|
||||
cn.name = newPath;
|
||||
String oldResourcePath = resourcePath.replace(".", "/");
|
||||
String oldResourcePath = newPath.replace(".", "/");
|
||||
String newResourcePath = oldResourcePath + ".class";
|
||||
|
||||
contents = ASMUtil.nodeToBytes(cn);
|
||||
|
@ -100,7 +99,7 @@ public class New extends ContextMenuItem
|
|||
|
||||
break;
|
||||
case FILE:
|
||||
BytecodeViewer.resourceContainers.get(containerName).resourceFiles.put(resourcePath, contents);
|
||||
BytecodeViewer.resourceContainers.get(containerName).resourceFiles.put(newPath, contents);
|
||||
searchAndInsert(firstPath + separator +newPath, BytecodeViewer.resourceContainers.get(containerName).treeNode, separator);
|
||||
break;
|
||||
}
|
||||
|
@ -115,7 +114,7 @@ public class New extends ContextMenuItem
|
|||
{
|
||||
StringBuilder tempSpot = new StringBuilder();
|
||||
|
||||
for(int counter = startsAt, maxCounter = max;counter < maxCounter; counter++)
|
||||
for(int counter = startsAt; counter < max; counter++)
|
||||
{
|
||||
if(counter > startsAt)
|
||||
tempSpot.append(separator);
|
||||
|
@ -129,7 +128,7 @@ public class New extends ContextMenuItem
|
|||
{
|
||||
StringBuilder tempSpot = new StringBuilder();
|
||||
|
||||
for(int counter = startsAt, maxCounter = max;counter < maxCounter; counter++)
|
||||
for(int counter = startsAt; counter < max; counter++)
|
||||
{
|
||||
if(counter > startsAt)
|
||||
tempSpot.append(separator);
|
||||
|
@ -140,6 +139,7 @@ public class New extends ContextMenuItem
|
|||
}
|
||||
|
||||
//TODO this needs to be rewritten to support creating parent nodes that don't exist
|
||||
@SuppressWarnings("unchecked")
|
||||
public static boolean searchAndInsert(String path, DefaultMutableTreeNode treeNode, String separator)
|
||||
{
|
||||
Enumeration<TreeNode> children = treeNode.children();
|
||||
|
|
|
@ -34,15 +34,13 @@ public class Open extends ContextMenuItem
|
|||
public Open()
|
||||
{
|
||||
super(ContextMenuType.RESOURCE, ((tree, selPath, result, menu) ->
|
||||
{
|
||||
menu.add(new AbstractAction(TranslatedStrings.OPEN_UNSTYLED.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.openPath(selPath);
|
||||
}
|
||||
});
|
||||
}));
|
||||
menu.add(new AbstractAction(TranslatedStrings.OPEN_UNSTYLED.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.resourcePane.openPath(selPath);
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,15 +34,13 @@ public class Open extends ContextMenuItem
|
|||
public Open()
|
||||
{
|
||||
super(ContextMenuType.SEARCH_BOX_RESULT, ((tree, selPath, result, menu) ->
|
||||
{
|
||||
menu.add(new AbstractAction(TranslatedStrings.OPEN_UNSTYLED.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.workPane.addClassResource(result.container, result.resourceWorkingName);
|
||||
}
|
||||
});
|
||||
}));
|
||||
menu.add(new AbstractAction(TranslatedStrings.OPEN_UNSTYLED.toString())
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
BytecodeViewer.viewer.workPane.addClassResource(result.container, result.resourceWorkingName);
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,6 @@ public class BaseSwitchableSpinnerPanel extends javax.swing.JPanel {
|
|||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
|
@ -79,29 +78,17 @@ public class BaseSwitchableSpinnerPanel extends javax.swing.JPanel {
|
|||
|
||||
octalMenuItem.setText("OCT");
|
||||
octalMenuItem.setToolTipText("Octal");
|
||||
octalMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
octalMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
octalMenuItem.addActionListener(this::octalMenuItemActionPerformed);
|
||||
baseSwitchPopupMenu.add(octalMenuItem);
|
||||
|
||||
decimalMenuItem.setText("DEC");
|
||||
decimalMenuItem.setToolTipText("Decimal");
|
||||
decimalMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
decimalMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
decimalMenuItem.addActionListener(this::decimalMenuItemActionPerformed);
|
||||
baseSwitchPopupMenu.add(decimalMenuItem);
|
||||
|
||||
hexadecimalMenuItem.setText("HEX");
|
||||
hexadecimalMenuItem.setToolTipText("Hexadecimal");
|
||||
hexadecimalMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
hexadecimalMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
hexadecimalMenuItem.addActionListener(this::hexadecimalMenuItemActionPerformed);
|
||||
baseSwitchPopupMenu.add(hexadecimalMenuItem);
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(400, 300));
|
||||
|
@ -109,11 +96,7 @@ public class BaseSwitchableSpinnerPanel extends javax.swing.JPanel {
|
|||
baseSwitchButton.setText("DEC");
|
||||
baseSwitchButton.setToolTipText("Decimal");
|
||||
baseSwitchButton.setComponentPopupMenu(baseSwitchPopupMenu);
|
||||
baseSwitchButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
baseSwitchButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
baseSwitchButton.addActionListener(this::baseSwitchButtonActionPerformed);
|
||||
|
||||
spinner.setModel(new javax.swing.SpinnerNumberModel(0L, null, null, 1L));
|
||||
|
||||
|
@ -302,9 +285,7 @@ public class BaseSwitchableSpinnerPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
JSpinner sourceSpinner = (JSpinner) (e.getSource());
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
textField.setText(getPositionAsString((Long) sourceSpinner.getValue()));
|
||||
});
|
||||
SwingUtilities.invokeLater(() -> textField.setText(getPositionAsString((Long) sourceSpinner.getValue())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,11 +35,11 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
public static final String DECIMAL_CODE_TYPE_LABEL = "DEC";
|
||||
public static final String HEXADECIMAL_CODE_TYPE_LABEL = "HEX";
|
||||
|
||||
private StatusCursorPositionFormat cursorPositionFormat = new StatusCursorPositionFormat();
|
||||
private StatusDocumentSizeFormat documentSizeFormat = new StatusDocumentSizeFormat();
|
||||
private int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE;
|
||||
private int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
|
||||
private int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
|
||||
private final StatusCursorPositionFormat cursorPositionFormat = new StatusCursorPositionFormat();
|
||||
private final StatusDocumentSizeFormat documentSizeFormat = new StatusDocumentSizeFormat();
|
||||
private final int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE;
|
||||
private final int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
|
||||
private final int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
|
||||
|
||||
private EditOperation editOperation;
|
||||
private CodeAreaCaretPosition caretPosition;
|
||||
|
@ -164,32 +164,20 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
cursorPositionModeButtonGroup.add(octalCursorPositionModeRadioButtonMenuItem);
|
||||
octalCursorPositionModeRadioButtonMenuItem.setText("Show as octal");
|
||||
octalCursorPositionModeRadioButtonMenuItem.setName("octalCursorPositionModeRadioButtonMenuItem");
|
||||
octalCursorPositionModeRadioButtonMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
octalCursorPositionModeRadioButtonMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
octalCursorPositionModeRadioButtonMenuItem.addActionListener(this::octalCursorPositionModeRadioButtonMenuItemActionPerformed);
|
||||
cursorPositionCodeTypeMenu.add(octalCursorPositionModeRadioButtonMenuItem);
|
||||
|
||||
cursorPositionModeButtonGroup.add(decimalCursorPositionModeRadioButtonMenuItem);
|
||||
decimalCursorPositionModeRadioButtonMenuItem.setSelected(true);
|
||||
decimalCursorPositionModeRadioButtonMenuItem.setText("Show as decimal");
|
||||
decimalCursorPositionModeRadioButtonMenuItem.setName("decimalCursorPositionModeRadioButtonMenuItem");
|
||||
decimalCursorPositionModeRadioButtonMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
decimalCursorPositionModeRadioButtonMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
decimalCursorPositionModeRadioButtonMenuItem.addActionListener(this::decimalCursorPositionModeRadioButtonMenuItemActionPerformed);
|
||||
cursorPositionCodeTypeMenu.add(decimalCursorPositionModeRadioButtonMenuItem);
|
||||
|
||||
cursorPositionModeButtonGroup.add(hexadecimalCursorPositionModeRadioButtonMenuItem);
|
||||
hexadecimalCursorPositionModeRadioButtonMenuItem.setText("Show as hexadecimal");
|
||||
hexadecimalCursorPositionModeRadioButtonMenuItem.setName("hexadecimalCursorPositionModeRadioButtonMenuItem");
|
||||
hexadecimalCursorPositionModeRadioButtonMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
hexadecimalCursorPositionModeRadioButtonMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
hexadecimalCursorPositionModeRadioButtonMenuItem.addActionListener(this::hexadecimalCursorPositionModeRadioButtonMenuItemActionPerformed);
|
||||
cursorPositionCodeTypeMenu.add(hexadecimalCursorPositionModeRadioButtonMenuItem);
|
||||
|
||||
positionPopupMenu.add(cursorPositionCodeTypeMenu);
|
||||
|
@ -197,11 +185,7 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
cursorPositionShowOffsetCheckBoxMenuItem.setSelected(true);
|
||||
cursorPositionShowOffsetCheckBoxMenuItem.setText("Show offset");
|
||||
cursorPositionShowOffsetCheckBoxMenuItem.setName("cursorPositionShowOffsetCheckBoxMenuItem");
|
||||
cursorPositionShowOffsetCheckBoxMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cursorPositionShowOffsetCheckBoxMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cursorPositionShowOffsetCheckBoxMenuItem.addActionListener(this::cursorPositionShowOffsetCheckBoxMenuItemActionPerformed);
|
||||
positionPopupMenu.add(cursorPositionShowOffsetCheckBoxMenuItem);
|
||||
|
||||
jSeparator2.setName("jSeparator2");
|
||||
|
@ -209,21 +193,13 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
|
||||
positionCopyMenuItem.setText("Copy");
|
||||
positionCopyMenuItem.setName("positionCopyMenuItem");
|
||||
positionCopyMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
positionCopyMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
positionCopyMenuItem.addActionListener(this::positionCopyMenuItemActionPerformed);
|
||||
positionPopupMenu.add(positionCopyMenuItem);
|
||||
|
||||
positionGoToMenuItem.setText("Go To...");
|
||||
positionGoToMenuItem.setEnabled(false);
|
||||
positionGoToMenuItem.setName("positionGoToMenuItem");
|
||||
positionGoToMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
positionGoToMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
positionGoToMenuItem.addActionListener(this::positionGoToMenuItemActionPerformed);
|
||||
positionPopupMenu.add(positionGoToMenuItem);
|
||||
|
||||
documentSizePopupMenu.setName("documentSizePopupMenu");
|
||||
|
@ -234,31 +210,19 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
documentSizeModeButtonGroup.add(octalDocumentSizeModeRadioButtonMenuItem);
|
||||
octalDocumentSizeModeRadioButtonMenuItem.setText("Show as octal");
|
||||
octalDocumentSizeModeRadioButtonMenuItem.setName("octalDocumentSizeModeRadioButtonMenuItem");
|
||||
octalDocumentSizeModeRadioButtonMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
octalDocumentSizeModeRadioButtonMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
octalDocumentSizeModeRadioButtonMenuItem.addActionListener(this::octalDocumentSizeModeRadioButtonMenuItemActionPerformed);
|
||||
documentSizeCodeTypeMenu.add(octalDocumentSizeModeRadioButtonMenuItem);
|
||||
|
||||
documentSizeModeButtonGroup.add(decimalDocumentSizeModeRadioButtonMenuItem);
|
||||
decimalDocumentSizeModeRadioButtonMenuItem.setText("Show as decimal");
|
||||
decimalDocumentSizeModeRadioButtonMenuItem.setName("decimalDocumentSizeModeRadioButtonMenuItem");
|
||||
decimalDocumentSizeModeRadioButtonMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
decimalDocumentSizeModeRadioButtonMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
decimalDocumentSizeModeRadioButtonMenuItem.addActionListener(this::decimalDocumentSizeModeRadioButtonMenuItemActionPerformed);
|
||||
documentSizeCodeTypeMenu.add(decimalDocumentSizeModeRadioButtonMenuItem);
|
||||
|
||||
documentSizeModeButtonGroup.add(hexadecimalDocumentSizeModeRadioButtonMenuItem);
|
||||
hexadecimalDocumentSizeModeRadioButtonMenuItem.setText("Show as hexadecimal");
|
||||
hexadecimalDocumentSizeModeRadioButtonMenuItem.setName("hexadecimalDocumentSizeModeRadioButtonMenuItem");
|
||||
hexadecimalDocumentSizeModeRadioButtonMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
hexadecimalDocumentSizeModeRadioButtonMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
hexadecimalDocumentSizeModeRadioButtonMenuItem.addActionListener(this::hexadecimalDocumentSizeModeRadioButtonMenuItemActionPerformed);
|
||||
documentSizeCodeTypeMenu.add(hexadecimalDocumentSizeModeRadioButtonMenuItem);
|
||||
|
||||
documentSizePopupMenu.add(documentSizeCodeTypeMenu);
|
||||
|
@ -266,11 +230,7 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
documentSizeShowRelativeCheckBoxMenuItem.setSelected(true);
|
||||
documentSizeShowRelativeCheckBoxMenuItem.setText("Show relative size");
|
||||
documentSizeShowRelativeCheckBoxMenuItem.setName("documentSizeShowRelativeCheckBoxMenuItem");
|
||||
documentSizeShowRelativeCheckBoxMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
documentSizeShowRelativeCheckBoxMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
documentSizeShowRelativeCheckBoxMenuItem.addActionListener(this::documentSizeShowRelativeCheckBoxMenuItemActionPerformed);
|
||||
documentSizePopupMenu.add(documentSizeShowRelativeCheckBoxMenuItem);
|
||||
|
||||
jSeparator1.setName("jSeparator1");
|
||||
|
@ -278,11 +238,7 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
|
||||
documentSizeCopyMenuItem.setText("Copy");
|
||||
documentSizeCopyMenuItem.setName("documentSizeCopyMenuItem");
|
||||
documentSizeCopyMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
documentSizeCopyMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
documentSizeCopyMenuItem.addActionListener(this::documentSizeCopyMenuItemActionPerformed);
|
||||
documentSizePopupMenu.add(documentSizeCopyMenuItem);
|
||||
|
||||
setName("Form");
|
||||
|
@ -627,7 +583,7 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
return "0";
|
||||
}
|
||||
|
||||
int spaceGroupSize = 0;
|
||||
int spaceGroupSize;
|
||||
switch (codeType) {
|
||||
case OCTAL: {
|
||||
spaceGroupSize = octalSpaceGroupSize;
|
||||
|
@ -660,7 +616,7 @@ public class BinaryStatusPanel extends javax.swing.JPanel implements BinaryStatu
|
|||
}
|
||||
|
||||
int digit = (int) (remainder % base);
|
||||
remainder = remainder / base;
|
||||
remainder /= base;
|
||||
builder.insert(0, CodeAreaUtils.UPPER_HEX_CODES[digit]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package the.bytecode.club.bytecodeviewer.gui.hexviewer;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import org.exbin.bined.CodeAreaUtils;
|
||||
|
||||
|
@ -18,10 +16,8 @@ public class GoToBinaryPanel extends javax.swing.JPanel {
|
|||
public GoToBinaryPanel() {
|
||||
initComponents();
|
||||
|
||||
baseSwitchableSpinnerPanel.setMinimum(0l);
|
||||
baseSwitchableSpinnerPanel.addChangeListener((javax.swing.event.ChangeEvent evt) -> {
|
||||
updateTargetPosition();
|
||||
});
|
||||
baseSwitchableSpinnerPanel.setMinimum(0L);
|
||||
baseSwitchableSpinnerPanel.addChangeListener((javax.swing.event.ChangeEvent evt) -> updateTargetPosition());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +25,6 @@ public class GoToBinaryPanel extends javax.swing.JPanel {
|
|||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
|
@ -55,27 +50,15 @@ public class GoToBinaryPanel extends javax.swing.JPanel {
|
|||
positionTypeButtonGroup.add(fromStartRadioButton);
|
||||
fromStartRadioButton.setSelected(true);
|
||||
fromStartRadioButton.setText("Position from start");
|
||||
fromStartRadioButton.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
fromStartRadioButtonItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
fromStartRadioButton.addItemListener(this::fromStartRadioButtonItemStateChanged);
|
||||
|
||||
positionTypeButtonGroup.add(fromEndRadioButton);
|
||||
fromEndRadioButton.setText("Position from end");
|
||||
fromEndRadioButton.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
fromEndRadioButtonItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
fromEndRadioButton.addItemListener(this::fromEndRadioButtonItemStateChanged);
|
||||
|
||||
positionTypeButtonGroup.add(fromCursorRadioButton);
|
||||
fromCursorRadioButton.setText("Position relative to cursor");
|
||||
fromCursorRadioButton.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
fromCursorRadioButtonItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
fromCursorRadioButton.addItemListener(this::fromCursorRadioButtonItemStateChanged);
|
||||
|
||||
positionLabel.setText("Position");
|
||||
|
||||
|
@ -250,22 +233,16 @@ public class GoToBinaryPanel extends javax.swing.JPanel {
|
|||
long absolutePosition = getTargetPosition();
|
||||
this.goToMode = goToMode;
|
||||
switch (goToMode) {
|
||||
case FROM_START: {
|
||||
setPositionValue(0l);
|
||||
baseSwitchableSpinnerPanel.setMinimum(0l);
|
||||
case FROM_START:
|
||||
case FROM_END: {
|
||||
setPositionValue(0L);
|
||||
baseSwitchableSpinnerPanel.setMinimum(0L);
|
||||
baseSwitchableSpinnerPanel.setMaximum(maxPosition);
|
||||
baseSwitchableSpinnerPanel.revalidateSpinner();
|
||||
break;
|
||||
}
|
||||
case FROM_END: {
|
||||
setPositionValue(0l);
|
||||
baseSwitchableSpinnerPanel.setMinimum(0l);
|
||||
baseSwitchableSpinnerPanel.setMaximum(maxPosition);
|
||||
baseSwitchableSpinnerPanel.revalidateSpinner();
|
||||
break;
|
||||
}
|
||||
case FROM_CURSOR: {
|
||||
setPositionValue(0l);
|
||||
case FROM_CURSOR: {
|
||||
setPositionValue(0L);
|
||||
baseSwitchableSpinnerPanel.setMinimum(-cursorPosition);
|
||||
baseSwitchableSpinnerPanel.setMaximum(maxPosition - cursorPosition);
|
||||
baseSwitchableSpinnerPanel.revalidateSpinner();
|
||||
|
@ -278,7 +255,7 @@ public class GoToBinaryPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private long getPositionValue() {
|
||||
return (Long) baseSwitchableSpinnerPanel.getValue();
|
||||
return baseSwitchableSpinnerPanel.getValue();
|
||||
}
|
||||
|
||||
private void setPositionValue(long value) {
|
||||
|
|
|
@ -30,7 +30,6 @@ public class HexViewer extends JPanel {
|
|||
private boolean valuesPanelVisible = false;
|
||||
|
||||
private final AbstractAction cycleCodeTypesAction;
|
||||
private javax.swing.JToggleButton lineWrappingToggleButton;
|
||||
private JButton cycleCodeTypeButton;
|
||||
private BinaryStatusApi binaryStatus;
|
||||
private final AbstractAction goToAction;
|
||||
|
@ -114,18 +113,16 @@ public class HexViewer extends JPanel {
|
|||
cycleCodeTypeButton.setAction(cycleCodeTypesAction);
|
||||
updateCycleButtonState();
|
||||
toolBar.add(cycleCodeTypeButton);
|
||||
lineWrappingToggleButton = new javax.swing.JToggleButton();
|
||||
JToggleButton lineWrappingToggleButton = new JToggleButton();
|
||||
lineWrappingToggleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/the/bytecode/club/bytecodeviewer/gui/hexviewer/resources/bined-linewrap.png")));
|
||||
lineWrappingToggleButton.setToolTipText("Toggle line wrapping");
|
||||
lineWrappingToggleButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (codeArea.getRowWrapping() == RowWrappingMode.WRAPPING) {
|
||||
codeArea.setMaxBytesPerRow(16);
|
||||
codeArea.setRowWrapping(RowWrappingMode.NO_WRAPPING);
|
||||
} else {
|
||||
codeArea.setMaxBytesPerRow(0);
|
||||
codeArea.setRowWrapping(RowWrappingMode.WRAPPING);
|
||||
}
|
||||
lineWrappingToggleButton.addActionListener(evt -> {
|
||||
if (codeArea.getRowWrapping() == RowWrappingMode.WRAPPING) {
|
||||
codeArea.setMaxBytesPerRow(16);
|
||||
codeArea.setRowWrapping(RowWrappingMode.NO_WRAPPING);
|
||||
} else {
|
||||
codeArea.setMaxBytesPerRow(0);
|
||||
codeArea.setRowWrapping(RowWrappingMode.WRAPPING);
|
||||
}
|
||||
});
|
||||
toolBar.add(lineWrappingToggleButton);
|
||||
|
@ -137,15 +134,8 @@ public class HexViewer extends JPanel {
|
|||
codeArea.setComponentPopupMenu(new JPopupMenu() {
|
||||
@Override
|
||||
public void show(Component invoker, int x, int y) {
|
||||
int clickedX = x;
|
||||
int clickedY = y;
|
||||
if (invoker instanceof JViewport) {
|
||||
clickedX += ((JViewport) invoker).getParent().getX();
|
||||
clickedY += ((JViewport) invoker).getParent().getY();
|
||||
}
|
||||
|
||||
removeAll();
|
||||
final JPopupMenu menu = createPopupMenu(clickedX, clickedY);
|
||||
final JPopupMenu menu = createPopupMenu();
|
||||
menu.show(invoker, x, y);
|
||||
}
|
||||
});
|
||||
|
@ -187,15 +177,9 @@ public class HexViewer extends JPanel {
|
|||
|
||||
public void registerBinaryStatus(BinaryStatusApi binaryStatusApi) {
|
||||
this.binaryStatus = binaryStatusApi;
|
||||
codeArea.addCaretMovedListener((CodeAreaCaretPosition caretPosition) -> {
|
||||
binaryStatus.setCursorPosition(caretPosition);
|
||||
});
|
||||
codeArea.addSelectionChangedListener(() -> {
|
||||
binaryStatus.setSelectionRange(codeArea.getSelection());
|
||||
});
|
||||
codeArea.addDataChangedListener(() -> {
|
||||
binaryStatus.setCurrentDocumentSize(codeArea.getDataSize(), codeArea.getDataSize());
|
||||
});
|
||||
codeArea.addCaretMovedListener((CodeAreaCaretPosition caretPosition) -> binaryStatus.setCursorPosition(caretPosition));
|
||||
codeArea.addSelectionChangedListener(() -> binaryStatus.setSelectionRange(codeArea.getSelection()));
|
||||
codeArea.addDataChangedListener(() -> binaryStatus.setCurrentDocumentSize(codeArea.getDataSize(), codeArea.getDataSize()));
|
||||
binaryStatus.setCurrentDocumentSize(codeArea.getDataSize(), codeArea.getDataSize());
|
||||
|
||||
codeArea.addEditModeChangedListener(binaryStatus::setEditMode);
|
||||
|
@ -207,7 +191,6 @@ public class HexViewer extends JPanel {
|
|||
*
|
||||
* @return down mask for meta keys
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static int getMetaMask() {
|
||||
try {
|
||||
switch (java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) {
|
||||
|
@ -226,7 +209,7 @@ public class HexViewer extends JPanel {
|
|||
}
|
||||
|
||||
@Nonnull
|
||||
private JPopupMenu createPopupMenu(int x, int y) {
|
||||
private JPopupMenu createPopupMenu() {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
|
||||
JMenu viewMenu = new JMenu("View");
|
||||
|
@ -311,22 +294,18 @@ public class HexViewer extends JPanel {
|
|||
final JMenuItem copyMenuItem = new JMenuItem("Copy");
|
||||
copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, HexViewer.getMetaMask()));
|
||||
copyMenuItem.setEnabled(codeArea.hasSelection());
|
||||
copyMenuItem.addActionListener((ActionEvent e) -> {
|
||||
codeArea.copy();
|
||||
});
|
||||
copyMenuItem.addActionListener((ActionEvent e) -> codeArea.copy());
|
||||
menu.add(copyMenuItem);
|
||||
|
||||
final JMenuItem selectAllMenuItem = new JMenuItem("Select All");
|
||||
selectAllMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, HexViewer.getMetaMask()));
|
||||
selectAllMenuItem.addActionListener((ActionEvent e) -> {
|
||||
codeArea.selectAll();
|
||||
});
|
||||
selectAllMenuItem.addActionListener((ActionEvent e) -> codeArea.selectAll());
|
||||
menu.add(selectAllMenuItem);
|
||||
menu.addSeparator();
|
||||
|
||||
final JMenuItem goToMenuItem = new JMenuItem("Go To...");
|
||||
goToMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, HexViewer.getMetaMask()));
|
||||
goToMenuItem.addActionListener(goToAction::actionPerformed);
|
||||
goToMenuItem.addActionListener(goToAction);
|
||||
menu.add(goToMenuItem);
|
||||
|
||||
return menu;
|
||||
|
|
|
@ -14,7 +14,6 @@ public class OkCancelPanel extends javax.swing.JPanel {
|
|||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
|
@ -22,18 +21,10 @@ public class OkCancelPanel extends javax.swing.JPanel {
|
|||
okButton = new javax.swing.JButton();
|
||||
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
||||
|
||||
okButton.setText("Ok");
|
||||
okButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
okButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
okButton.addActionListener(this::okButtonActionPerformed);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
public static final int SWORD_MIN_VALUE = -32768;
|
||||
public static final int SWORD_MAX_VALUE = 32767;
|
||||
public static final int UWORD_MAX_VALUE = 65535;
|
||||
public static final long UINT_MAX_VALUE = 4294967295l;
|
||||
public static final long UINT_MAX_VALUE = 4294967295L;
|
||||
public static final BigInteger ULONG_MAX_VALUE = new BigInteger("4294967295");
|
||||
public static final BigInteger BIG_INTEGER_BYTE_MASK = BigInteger.valueOf(255);
|
||||
public static final String VALUE_OUT_OF_RANGE = "Value is out of range";
|
||||
|
@ -86,7 +86,6 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
|
@ -128,53 +127,21 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
|
||||
binaryLabel.setText("Binary");
|
||||
|
||||
binaryCheckBox0.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox0ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox0.addActionListener(this::binaryCheckBox0ActionPerformed);
|
||||
|
||||
binaryCheckBox1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox1.addActionListener(this::binaryCheckBox1ActionPerformed);
|
||||
|
||||
binaryCheckBox2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox2.addActionListener(this::binaryCheckBox2ActionPerformed);
|
||||
|
||||
binaryCheckBox3.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox3ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox3.addActionListener(this::binaryCheckBox3ActionPerformed);
|
||||
|
||||
binaryCheckBox4.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox4ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox4.addActionListener(this::binaryCheckBox4ActionPerformed);
|
||||
|
||||
binaryCheckBox5.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox5ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox5.addActionListener(this::binaryCheckBox5ActionPerformed);
|
||||
|
||||
binaryCheckBox6.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox6ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox6.addActionListener(this::binaryCheckBox6ActionPerformed);
|
||||
|
||||
binaryCheckBox7.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
binaryCheckBox7ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
binaryCheckBox7.addActionListener(this::binaryCheckBox7ActionPerformed);
|
||||
|
||||
byteLabel.setText("Byte");
|
||||
|
||||
|
@ -254,39 +221,23 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
bigEndianRadioButton.setSelected(true);
|
||||
bigEndianRadioButton.setText("BE");
|
||||
bigEndianRadioButton.setToolTipText("Big Endian");
|
||||
bigEndianRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
bigEndianRadioButtonStateChanged(evt);
|
||||
}
|
||||
});
|
||||
bigEndianRadioButton.addChangeListener(this::bigEndianRadioButtonStateChanged);
|
||||
|
||||
endianButtonGroup.add(littleEndianRadioButton);
|
||||
littleEndianRadioButton.setText("LE");
|
||||
littleEndianRadioButton.setToolTipText("Little Endian");
|
||||
littleEndianRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
littleEndianRadioButtonStateChanged(evt);
|
||||
}
|
||||
});
|
||||
littleEndianRadioButton.addChangeListener(this::littleEndianRadioButtonStateChanged);
|
||||
|
||||
integerSignButtonGroup.add(signedRadioButton);
|
||||
signedRadioButton.setSelected(true);
|
||||
signedRadioButton.setText("Sig");
|
||||
signedRadioButton.setToolTipText("Signed Integers");
|
||||
signedRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
signedRadioButtonStateChanged(evt);
|
||||
}
|
||||
});
|
||||
signedRadioButton.addChangeListener(this::signedRadioButtonStateChanged);
|
||||
|
||||
integerSignButtonGroup.add(unsignedRadioButton);
|
||||
unsignedRadioButton.setText("Uns");
|
||||
unsignedRadioButton.setToolTipText("Unsigned Integers");
|
||||
unsignedRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
unsignedRadioButtonStateChanged(evt);
|
||||
}
|
||||
});
|
||||
unsignedRadioButton.addChangeListener(this::unsignedRadioButtonStateChanged);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
|
@ -482,7 +433,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
private void byteTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_byteTextFieldKeyReleased
|
||||
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable()) {
|
||||
try {
|
||||
Integer intValue = Integer.valueOf(byteTextField.getText());
|
||||
int intValue = Integer.parseInt(byteTextField.getText());
|
||||
if (isSigned()) {
|
||||
if (intValue < Byte.MIN_VALUE || intValue > Byte.MAX_VALUE) {
|
||||
throw new NumberFormatException(VALUE_OUT_OF_RANGE);
|
||||
|
@ -493,7 +444,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
valuesCache[0] = intValue.byteValue();
|
||||
valuesCache[0] = (byte) intValue;
|
||||
modifyValues(1);
|
||||
updateValues();
|
||||
} catch (NumberFormatException ex) {
|
||||
|
@ -505,7 +456,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
private void wordTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_wordTextFieldKeyReleased
|
||||
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable()) {
|
||||
try {
|
||||
Integer intValue = Integer.valueOf(wordTextField.getText());
|
||||
int intValue = Integer.parseInt(wordTextField.getText());
|
||||
if (isSigned()) {
|
||||
if (intValue < SWORD_MIN_VALUE || intValue > SWORD_MAX_VALUE) {
|
||||
throw new NumberFormatException(VALUE_OUT_OF_RANGE);
|
||||
|
@ -534,7 +485,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
private void intTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_intTextFieldKeyReleased
|
||||
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable()) {
|
||||
try {
|
||||
Long longValue = Long.valueOf(intTextField.getText());
|
||||
long longValue = Long.parseLong(intTextField.getText());
|
||||
if (isSigned()) {
|
||||
if (longValue < Integer.MIN_VALUE || longValue > Integer.MAX_VALUE) {
|
||||
throw new NumberFormatException(VALUE_OUT_OF_RANGE);
|
||||
|
@ -569,7 +520,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
ByteOrder byteOrder = getByteOrder();
|
||||
if (isSigned()) {
|
||||
Long longValue = Long.valueOf(longTextField.getText());
|
||||
long longValue = Long.parseLong(longTextField.getText());
|
||||
|
||||
byteBuffer.rewind();
|
||||
if (byteBuffer.order() != byteOrder) {
|
||||
|
@ -579,7 +530,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
byteBuffer.putLong(longValue);
|
||||
} else {
|
||||
BigInteger bigInteger = new BigInteger(longTextField.getText());
|
||||
if (bigInteger.compareTo(BigInteger.ZERO) == -1 || bigInteger.compareTo(ULONG_MAX_VALUE) == 1) {
|
||||
if (bigInteger.signum() == -1 || bigInteger.compareTo(ULONG_MAX_VALUE) > 0) {
|
||||
throw new NumberFormatException(VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
|
@ -610,7 +561,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable()) {
|
||||
try {
|
||||
ByteOrder byteOrder = getByteOrder();
|
||||
Float floatValue = Float.valueOf(floatTextField.getText());
|
||||
float floatValue = Float.parseFloat(floatTextField.getText());
|
||||
|
||||
byteBuffer.rewind();
|
||||
if (byteBuffer.order() != byteOrder) {
|
||||
|
@ -631,7 +582,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable()) {
|
||||
try {
|
||||
ByteOrder byteOrder = getByteOrder();
|
||||
Double doubleValue = Double.valueOf(doubleTextField.getText());
|
||||
double doubleValue = Double.parseDouble(doubleTextField.getText());
|
||||
|
||||
byteBuffer.rewind();
|
||||
if (byteBuffer.order() != byteOrder) {
|
||||
|
@ -703,9 +654,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
updateValues();
|
||||
};
|
||||
codeArea.addDataChangedListener(dataChangedListener);
|
||||
caretMovedListener = (CodeAreaCaretPosition caretPosition) -> {
|
||||
updateValues();
|
||||
};
|
||||
caretMovedListener = (CodeAreaCaretPosition caretPosition) -> updateValues();
|
||||
codeArea.addCaretMovedListener(caretMovedListener);
|
||||
updateEditMode();
|
||||
updateValues();
|
||||
|
@ -815,9 +764,7 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void scheduleNextStep(final ValuesPanelField valuesPanelField) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
updateValue(valuesPanelField);
|
||||
});
|
||||
SwingUtilities.invokeLater(() -> updateValue(valuesPanelField));
|
||||
}
|
||||
|
||||
public boolean isUpdateInProgress() {
|
||||
|
@ -913,11 +860,11 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
case INTEGER: {
|
||||
long intValue = signed
|
||||
? (byteOrder == ByteOrder.LITTLE_ENDIAN
|
||||
? (values[0] & 0xffl) | ((values[1] & 0xffl) << 8) | ((values[2] & 0xffl) << 16) | (values[3] << 24)
|
||||
: (values[3] & 0xffl) | ((values[2] & 0xffl) << 8) | ((values[1] & 0xffl) << 16) | (values[0] << 24))
|
||||
? (values[0] & 0xffL) | ((values[1] & 0xffL) << 8) | ((values[2] & 0xffL) << 16) | (values[3] << 24)
|
||||
: (values[3] & 0xffL) | ((values[2] & 0xffL) << 8) | ((values[1] & 0xffL) << 16) | (values[0] << 24))
|
||||
: (byteOrder == ByteOrder.LITTLE_ENDIAN
|
||||
? (values[0] & 0xffl) | ((values[1] & 0xffl) << 8) | ((values[2] & 0xffl) << 16) | ((values[3] & 0xffl) << 24)
|
||||
: (values[3] & 0xffl) | ((values[2] & 0xffl) << 8) | ((values[1] & 0xffl) << 16) | ((values[0] & 0xffl) << 24));
|
||||
? (values[0] & 0xffL) | ((values[1] & 0xffL) << 8) | ((values[2] & 0xffL) << 16) | ((values[3] & 0xffL) << 24)
|
||||
: (values[3] & 0xffL) | ((values[2] & 0xffL) << 8) | ((values[1] & 0xffL) << 16) | ((values[0] & 0xffL) << 24));
|
||||
intTextField.setText(String.valueOf(intValue));
|
||||
break;
|
||||
}
|
||||
|
@ -931,11 +878,11 @@ public class ValuesPanel extends javax.swing.JPanel {
|
|||
longTextField.setText(String.valueOf(byteBuffer.getLong()));
|
||||
} else {
|
||||
long longValue = byteOrder == ByteOrder.LITTLE_ENDIAN
|
||||
? (values[0] & 0xffl) | ((values[1] & 0xffl) << 8) | ((values[2] & 0xffl) << 16) | ((values[3] & 0xffl) << 24)
|
||||
| ((values[4] & 0xffl) << 32) | ((values[5] & 0xffl) << 40) | ((values[6] & 0xffl) << 48)
|
||||
: (values[7] & 0xffl) | ((values[6] & 0xffl) << 8) | ((values[5] & 0xffl) << 16) | ((values[4] & 0xffl) << 24)
|
||||
| ((values[3] & 0xffl) << 32) | ((values[2] & 0xffl) << 40) | ((values[1] & 0xffl) << 48);
|
||||
BigInteger bigInt1 = BigInteger.valueOf(values[byteOrder == ByteOrder.LITTLE_ENDIAN ? 7 : 0] & 0xffl);
|
||||
? (values[0] & 0xffL) | ((values[1] & 0xffL) << 8) | ((values[2] & 0xffL) << 16) | ((values[3] & 0xffL) << 24)
|
||||
| ((values[4] & 0xffL) << 32) | ((values[5] & 0xffL) << 40) | ((values[6] & 0xffL) << 48)
|
||||
: (values[7] & 0xffL) | ((values[6] & 0xffL) << 8) | ((values[5] & 0xffL) << 16) | ((values[4] & 0xffL) << 24)
|
||||
| ((values[3] & 0xffL) << 32) | ((values[2] & 0xffL) << 40) | ((values[1] & 0xffL) << 48);
|
||||
BigInteger bigInt1 = BigInteger.valueOf(values[byteOrder == ByteOrder.LITTLE_ENDIAN ? 7 : 0] & 0xffL);
|
||||
BigInteger bigInt2 = bigInt1.shiftLeft(56);
|
||||
BigInteger bigInt3 = bigInt2.add(BigInteger.valueOf(longValue));
|
||||
longTextField.setText(bigInt3.toString());
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File
|
|||
//used to remove resources from the resource list
|
||||
public void removeFile(ResourceContainer resourceContainer)
|
||||
{
|
||||
BytecodeViewer.resourceContainers.remove(resourceContainer);
|
||||
while (BytecodeViewer.resourceContainers.values().remove(resourceContainer));
|
||||
LazyNameUtil.removeName(resourceContainer.name);
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,6 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void removeNode(final JTree tree, final TreePath nodePath) {
|
||||
MutableTreeNode node = findNodeByPath(nodePath);
|
||||
if (node == null)
|
||||
|
@ -274,7 +273,6 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File
|
|||
tree.updateUI();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private MutableTreeNode findNodeByPath(TreePath path) {
|
||||
MutableTreeNode node = treeRoot;
|
||||
for (int pathStep = 1; pathStep < path.getPathCount(); pathStep++) {
|
||||
|
|
|
@ -55,9 +55,7 @@ class PerformSearch extends BackgroundSearchThread
|
|||
}
|
||||
|
||||
for (ResourceContainer container : BytecodeViewer.resourceContainers.values())
|
||||
container.resourceClasses.forEach((key,cn)->{
|
||||
searchBoxPane.searchType.panel.search(container, key, cn, searchBoxPane.exact.isSelected());
|
||||
});
|
||||
container.resourceClasses.forEach((key,cn)-> searchBoxPane.searchType.panel.search(container, key, cn, searchBoxPane.exact.isSelected()));
|
||||
|
||||
BytecodeViewer.viewer.searchBoxPane.search.setEnabled(true);
|
||||
BytecodeViewer.viewer.searchBoxPane.search.setText(TranslatedStrings.SEARCH.toString());
|
||||
|
|
|
@ -65,13 +65,12 @@ public class SearchBoxPane extends TranslatedVisibleComponent
|
|||
public final JComboBox<SearchType> typeBox;
|
||||
|
||||
public SearchType searchType = null;
|
||||
public final JComboBox searchRadiusBox;
|
||||
public final JComboBox<SearchRadius> searchRadiusBox;
|
||||
public final JPopupMenu rightClickMenu = new JPopupMenu();
|
||||
|
||||
public JButton search = new TranslatedJButton("Search", TranslatedComponents.SEARCH);
|
||||
public BackgroundSearchThread performSearchThread;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SearchBoxPane()
|
||||
{
|
||||
super("Search", TranslatedComponents.SEARCH);
|
||||
|
@ -82,20 +81,20 @@ public class SearchBoxPane extends TranslatedVisibleComponent
|
|||
|
||||
searchRadiusOpt.add(new TranslatedJLabel("Search from ", TranslatedComponents.SEARCH_FROM), BorderLayout.WEST);
|
||||
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
||||
DefaultComboBoxModel<SearchRadius> radiusModel = new DefaultComboBoxModel<>();
|
||||
|
||||
for (final SearchRadius st : SEARCH_RADII)
|
||||
model.addElement(st);
|
||||
radiusModel.addElement(st);
|
||||
|
||||
searchRadiusBox = new JComboBox(model);
|
||||
searchRadiusBox = new JComboBox<>(radiusModel);
|
||||
searchRadiusOpt.add(searchRadiusBox, BorderLayout.CENTER);
|
||||
searchOpts.add(searchRadiusOpt);
|
||||
|
||||
model = new DefaultComboBoxModel();
|
||||
DefaultComboBoxModel<SearchType> typeModel = new DefaultComboBoxModel<>();
|
||||
for (final SearchType st : SEARCH_TYPES)
|
||||
model.addElement(st);
|
||||
typeModel.addElement(st);
|
||||
|
||||
typeBox = new JComboBox<SearchType>(model);
|
||||
typeBox = new JComboBox<>(typeModel);
|
||||
final JPanel searchOptPanel = new JPanel();
|
||||
|
||||
final ItemListener il = arg0 -> {
|
||||
|
|
|
@ -80,8 +80,8 @@ public class BytecodeViewPanel extends JPanel
|
|||
return true;
|
||||
|
||||
SystemConsole errConsole = new SystemConsole(TranslatedStrings.JAVA_COMPILE_FAILED.toString());
|
||||
errConsole.setText(TranslatedStrings.ERROR_COMPILING_CLASS.toString() + " " + viewer.resource.getResourceClassNode().name +
|
||||
nl + TranslatedStrings.COMPILER_TIP.toString() +
|
||||
errConsole.setText(TranslatedStrings.ERROR_COMPILING_CLASS + " " + viewer.resource.getResourceClassNode().name +
|
||||
nl + TranslatedStrings.COMPILER_TIP +
|
||||
nl + nl + TranslatedStrings.SUGGESTED_FIX_COMPILER_ERROR +
|
||||
nl + nl);
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ public class DecompilerSelectionPane
|
|||
{
|
||||
this.paneID = paneID;
|
||||
if(paneID == 1)
|
||||
this.menu = new TranslatedJMenu("Pane " + paneID, TranslatedComponents.PANE_1);
|
||||
this.menu = new TranslatedJMenu("Pane " + 1, TranslatedComponents.PANE_1);
|
||||
else if(paneID == 2)
|
||||
this.menu = new TranslatedJMenu("Pane " + paneID, TranslatedComponents.PANE_2);
|
||||
this.menu = new TranslatedJMenu("Pane " + 2, TranslatedComponents.PANE_2);
|
||||
else
|
||||
this.menu = new TranslatedJMenu("Pane " + paneID, TranslatedComponents.PANE_3);
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ public class TabbedPane extends JPanel
|
|||
|
||||
//define the right click pop-up menu
|
||||
JPopupMenu rightClickMenu = new JPopupMenu();
|
||||
JMenuItem closeAllTabs = new JMenuItem(TranslatedStrings.CLOSE_ALL_BUT_THIS.toString() + ": " + name);
|
||||
JMenuItem closeTab = new JMenuItem(TranslatedStrings.CLOSE_TAB.toString() + ": " + name);
|
||||
JMenuItem closeAllTabs = new JMenuItem(TranslatedStrings.CLOSE_ALL_BUT_THIS + ": " + name);
|
||||
JMenuItem closeTab = new JMenuItem(TranslatedStrings.CLOSE_TAB + ": " + name);
|
||||
|
||||
rightClickMenu.add(closeAllTabs);
|
||||
rightClickMenu.add(closeTab);
|
||||
|
|
|
@ -119,8 +119,8 @@ public class Workspace extends TranslatedVisibleComponent
|
|||
if (c != null && bounds.intersects(c.getBounds()))
|
||||
{
|
||||
popUp.setVisible(true);
|
||||
closeAllTabs.setText(TranslatedStrings.CLOSE_TAB.toString() + ": " + ((TabbedPane) c).tabName);
|
||||
closeTab.setText(TranslatedStrings.CLOSE_TAB.toString() + ": " + ((TabbedPane) c).tabName);
|
||||
closeAllTabs.setText(TranslatedStrings.CLOSE_TAB + ": " + ((TabbedPane) c).tabName);
|
||||
closeTab.setText(TranslatedStrings.CLOSE_TAB + ": " + ((TabbedPane) c).tabName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ import the.bytecode.club.bytecodeviewer.resources.Resource;
|
|||
|
||||
public class ComponentViewer extends ResourceViewer
|
||||
{
|
||||
private Component component;
|
||||
private final Component component;
|
||||
private static final String containerName = "internalComponent.";
|
||||
|
||||
public ComponentViewer(String title, Component component)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.synchronizedscroll;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -28,18 +29,20 @@ import org.objectweb.asm.Type;
|
|||
public class MethodData
|
||||
{
|
||||
public String name, desc;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o)
|
||||
{
|
||||
return equals((MethodData) o);
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MethodData)) return false;
|
||||
MethodData that = (MethodData) o;
|
||||
return Objects.equals(name, that.name) && Objects.equals(desc, that.desc);
|
||||
}
|
||||
|
||||
public boolean equals(final MethodData md)
|
||||
{
|
||||
return this.name.equals(md.name) && this.desc.equals(md.desc);
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, desc);
|
||||
}
|
||||
|
||||
|
||||
public String constructPattern()
|
||||
{
|
||||
final StringBuilder pattern = new StringBuilder();
|
||||
|
|
|
@ -119,7 +119,7 @@ public class BytecodeViewPanelUpdater implements Runnable
|
|||
{
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class RemappingSignatureAdapter extends SignatureVisitor {
|
|||
@Override
|
||||
public void visitInnerClassType(String name) {
|
||||
String remappedOuter = remapper.mapType(className) + '$';
|
||||
className = className + '$' + name;
|
||||
className += '$' + name;
|
||||
String remappedName = remapper.mapType(className);
|
||||
int index = remappedName.startsWith(remappedOuter) ? remappedOuter
|
||||
.length() : remappedName.lastIndexOf('$') + 1;
|
||||
|
|
|
@ -55,7 +55,7 @@ public final class PluginManager
|
|||
{
|
||||
private static final Map<String, PluginLaunchStrategy> launchStrategies = new HashMap<>();
|
||||
private static final PluginFileFilter filter = new PluginFileFilter();
|
||||
private static List<Plugin> pluginInstances = new ArrayList<>();
|
||||
private static final List<Plugin> pluginInstances = new ArrayList<>();
|
||||
|
||||
//TODO this system needs to be redone, currently it will conflict if more than one plugin is ran at the same time
|
||||
// the solution is to tie the plugin object into the plugin console,
|
||||
|
@ -155,8 +155,8 @@ public final class PluginManager
|
|||
return;
|
||||
}
|
||||
|
||||
final String name = (activePlugin == null || activePlugin.activeContainer == null)
|
||||
? ("#" + (activeTabbedException.getTabbedPane().getTabCount() + 1)) : activePlugin.activeContainer.name;
|
||||
final String name = activePlugin.activeContainer == null
|
||||
? "#" + (activeTabbedException.getTabbedPane().getTabCount() + 1) : activePlugin.activeContainer.name;
|
||||
|
||||
ExceptionUI existingUI = exceptionTabs.get(name);
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ public class PluginWriter extends JFrame
|
|||
|
||||
//auto append extension
|
||||
if (!path.endsWith("." + ext))
|
||||
path = path + "." + ext;
|
||||
path += "." + ext;
|
||||
|
||||
if (!DialogUtils.canOverwriteFile(path))
|
||||
return;
|
||||
|
|
|
@ -226,7 +226,7 @@ public class AllatoriStringDecrypter extends Plugin
|
|||
{
|
||||
InsnList iList = decryptermethodnode.instructions;
|
||||
|
||||
AbstractInsnNode insn = null, removeInsn = null;
|
||||
AbstractInsnNode insn = null, removeInsn;
|
||||
for (AbstractInsnNode i : iList.toArray())
|
||||
{
|
||||
if (i instanceof MethodInsnNode)
|
||||
|
@ -292,7 +292,7 @@ public class AllatoriStringDecrypter extends Plugin
|
|||
|
||||
public static class AllatoriStringDecrypterOptionsFrame extends JFrame
|
||||
{
|
||||
private JTextField textField;
|
||||
private final JTextField textField;
|
||||
|
||||
public AllatoriStringDecrypterOptionsFrame()
|
||||
{
|
||||
|
|
|
@ -62,9 +62,7 @@ public class ExternalResources
|
|||
return Configuration.java;
|
||||
|
||||
//check CLI for java
|
||||
testCommand(new String[]{"java", "-version"}, "java version", ()->{
|
||||
Configuration.java = "java";
|
||||
});
|
||||
testCommand(new String[]{"java", "-version"}, "java version", ()-> Configuration.java = "java");
|
||||
if(!Configuration.java.isEmpty())
|
||||
return Configuration.java;
|
||||
|
||||
|
@ -137,9 +135,7 @@ public class ExternalResources
|
|||
return Configuration.python2;
|
||||
|
||||
//check if 'python' command is bound as python 2.X
|
||||
testCommand(new String[]{"python", "--version"}, "python 2", ()->{
|
||||
Configuration.python2 = "python";
|
||||
});
|
||||
testCommand(new String[]{"python", "--version"}, "python 2", ()-> Configuration.python2 = "python");
|
||||
if(!Configuration.python2.isEmpty())
|
||||
return Configuration.python2;
|
||||
|
||||
|
@ -178,17 +174,13 @@ public class ExternalResources
|
|||
|
||||
|
||||
//check if 'python3' command is bound as python 3.X
|
||||
testCommand(new String[]{"python3", "--version"}, "python 3", ()->{
|
||||
Configuration.python3 = "python3";
|
||||
});
|
||||
testCommand(new String[]{"python3", "--version"}, "python 3", ()-> Configuration.python3 = "python3");
|
||||
if(!Configuration.python3.isEmpty())
|
||||
return Configuration.python3;
|
||||
|
||||
|
||||
//check if 'python' command is bound as python 3.X
|
||||
testCommand(new String[]{"python", "--version"}, "python 3", ()->{
|
||||
Configuration.python3 = "python";
|
||||
});
|
||||
testCommand(new String[]{"python", "--version"}, "python 3", ()-> Configuration.python3 = "python");
|
||||
if(!Configuration.python3.isEmpty())
|
||||
return Configuration.python3;
|
||||
|
||||
|
|
|
@ -104,9 +104,9 @@ public class APKExport implements Exporter
|
|||
final File file = fc.getSelectedFile();
|
||||
String output = file.getAbsolutePath();
|
||||
|
||||
//auto appened .apk
|
||||
//auto append .apk
|
||||
if (!output.endsWith(".apk"))
|
||||
output = output + ".apk";
|
||||
output += ".apk";
|
||||
|
||||
final File file2 = new File(output);
|
||||
if (!DialogUtils.canOverwriteFile(file2))
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DexExport implements Exporter
|
|||
|
||||
//auto append .dex
|
||||
if (!output.endsWith(".dex"))
|
||||
output = output + ".dex";
|
||||
output += ".dex";
|
||||
|
||||
File outputPath = new File(output);
|
||||
if (!DialogUtils.canOverwriteFile(outputPath))
|
||||
|
|
|
@ -59,7 +59,7 @@ public class RunnableJarExporter implements Exporter
|
|||
|
||||
//auto append .jar
|
||||
if (!path.endsWith(".jar"))
|
||||
path = path + ".jar";
|
||||
path += ".jar";
|
||||
|
||||
if (!DialogUtils.canOverwriteFile(path))
|
||||
return;
|
||||
|
|
|
@ -54,7 +54,6 @@ public class ImportResource implements Runnable
|
|||
if (file.isDirectory())
|
||||
{
|
||||
Import.DIRECTORY.getImporter().open(file);
|
||||
continue;
|
||||
}
|
||||
//everything else import as a resource
|
||||
else if(!importKnownFile(file))
|
||||
|
|
|
@ -132,7 +132,7 @@ public enum Language
|
|||
try {
|
||||
TranslatedStrings str = TranslatedStrings.valueOf(text.key);
|
||||
str.setText(text.value);
|
||||
} catch (IllegalArgumentException e) { }
|
||||
} catch (IllegalArgumentException ignored) { }
|
||||
|
||||
//check if translation key has been assigned to a component,
|
||||
//on fail print an error alerting the devs
|
||||
|
|
|
@ -82,7 +82,7 @@ public class Enjarify {
|
|||
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) { }
|
||||
} catch (InterruptedException ignored) { }
|
||||
}
|
||||
}, "Enjarify Fail Safe Thread").start();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ import static the.bytecode.club.bytecodeviewer.BytecodeViewer.gson;
|
|||
|
||||
public class MiscUtils
|
||||
{
|
||||
private static CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder(); // or "ISO-8859-1" for ISO Latin 1
|
||||
private static final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder(); // or "ISO-8859-1" for ISO Latin 1
|
||||
private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
private static final Random rnd = new Random();
|
||||
|
@ -186,7 +186,7 @@ public class MiscUtils
|
|||
public static String append(File file, String extension) {
|
||||
String path = file.getAbsolutePath();
|
||||
if (!path.endsWith(extension))
|
||||
path = path + extension;
|
||||
path += extension;
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,26 +37,26 @@ class SeqAndCount
|
|||
|
||||
public SeqAndCount incrSeq()
|
||||
{
|
||||
seq = seq + 1;
|
||||
seq++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SeqAndCount incrCount()
|
||||
{
|
||||
count = count + 1;
|
||||
count++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SeqAndCount decrCount()
|
||||
{
|
||||
count = count - 1;
|
||||
count--;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SeqAndCount incrSeqAndCount()
|
||||
{
|
||||
seq = seq + 1;
|
||||
count = count + 1;
|
||||
seq++;
|
||||
count++;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<html>
|
||||
<html lang="en">
|
||||
<h2>About</h2>
|
||||
|
||||
Bytecode Viewer (BCV) is an easy to use Java & Android Reverse Engineering Suite!<br>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<html>
|
||||
<html lang="en">
|
||||
<h2>About</h2>
|
||||
|
||||
Bytecode Viewer (BCV) was designed to be extremely user and beginner friendly, because of this almost everything
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<html>
|
||||
<html lang="de">
|
||||
<h2>Über uns</h2>
|
||||
|
||||
Der Bytecode Viewer (BCV) wurde extrem benutzer- und einsteigerfreundlich gestaltet, deshalb ist fast alles
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<html>
|
||||
<html lang="zh">
|
||||
<h2>关于</h2>
|
||||
|
||||
Bytecode Viewer (BCV)被设计成对用户和初学者非常友好,因此,几乎所有的东西都可以通过界面、设置、工具等方式进行访问。
|
||||
|
||||
<br>将Jar/APK/Class文件拖到资源列表中。</br>
|
||||
<br><br>将Jar/APK/Class文件拖到资源列表中。
|
||||
|
||||
<h2>设置</h2>
|
||||
<ul>
|
||||
|
@ -118,4 +118,4 @@ Bytecode Viewer (BCV)被设计成对用户和初学者非常友好,因此,
|
|||
<li>Bytecode Viewer的主页是 <a href="https://bytecodeviewer.com">https://bytecodeviewer.com</a></li>
|
||||
</ul>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user