mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65235c6b5b | ||
|
|
d8096a4ec5 |
No files matched your search
@@ -53,7 +53,7 @@ import me.ByteEdit.utils.UnicodeUtils;
|
|||||||
|
|
||||||
public class Assembler {
|
public class Assembler {
|
||||||
|
|
||||||
private static final Pattern SPACE = Pattern.compile(" ");
|
public static final Pattern SPACE = Pattern.compile(" ");
|
||||||
|
|
||||||
public static ClassNode assemble(String input) {
|
public static ClassNode assemble(String input) {
|
||||||
Main.txtByteEditView.removeAllLineHighlights();
|
Main.txtByteEditView.removeAllLineHighlights();
|
||||||
@@ -691,11 +691,8 @@ public class Assembler {
|
|||||||
int frameType = ClassUtil.getFrameTypeByName(asd);
|
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||||
if (frameType != -1)
|
if (frameType != -1)
|
||||||
arr.add(new Integer(frameType));
|
arr.add(new Integer(frameType));
|
||||||
else {
|
else
|
||||||
String frame = UnicodeUtils.unescape(hsr, asd);
|
arr.add(UnicodeUtils.unescape(hsr, asd.substring(1, asd.length() - 1)));
|
||||||
frame = frame.substring(1, frame.length() - 1);
|
|
||||||
arr.add(frame);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (asd.startsWith("(label) ")) {
|
if (asd.startsWith("(label) ")) {
|
||||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||||
@@ -737,11 +734,8 @@ public class Assembler {
|
|||||||
int frameType = ClassUtil.getFrameTypeByName(asd);
|
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||||
if (frameType != -1)
|
if (frameType != -1)
|
||||||
arr.add(new Integer(frameType));
|
arr.add(new Integer(frameType));
|
||||||
else {
|
else
|
||||||
String frame = UnicodeUtils.unescape(hsr, asd);
|
arr.add(UnicodeUtils.unescape(hsr, asd.substring(1, asd.length() - 1)));
|
||||||
frame = frame.substring(1, frame.length() - 1);
|
|
||||||
arr.add(frame);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (asd.startsWith("(label) ")) {
|
if (asd.startsWith("(label) ")) {
|
||||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||||
@@ -847,7 +841,9 @@ public class Assembler {
|
|||||||
UnicodeUtils.unescape(hsr, split2[3].substring(6, split2[3].length() - 1)),
|
UnicodeUtils.unescape(hsr, split2[3].substring(6, split2[3].length() - 1)),
|
||||||
Integer.parseInt(split2[1].substring(7)), Integer.parseInt(split2[2].substring(5)));
|
Integer.parseInt(split2[1].substring(7)), Integer.parseInt(split2[2].substring(5)));
|
||||||
} else if (str.startsWith("\"") && str.endsWith("\"")) {
|
} else if (str.startsWith("\"") && str.endsWith("\"")) {
|
||||||
val = UnicodeUtils.unescape(hsr, str.substring(1, str.length() - 1));
|
val = UnicodeUtils.unescape(hsr, str.substring(1, str.length() - 1), true);
|
||||||
|
} else if (str.startsWith("#")) {
|
||||||
|
val = UnicodeUtils.unescape(hsr, str);
|
||||||
} else if (str.endsWith("l")) {
|
} else if (str.endsWith("l")) {
|
||||||
val = Long.parseLong(str.substring(0, str.length() - 1));
|
val = Long.parseLong(str.substring(0, str.length() - 1));
|
||||||
} else if (str.endsWith("f")) {
|
} else if (str.endsWith("f")) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.FutureTask;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.objectweb.asm.Handle;
|
import org.objectweb.asm.Handle;
|
||||||
@@ -40,6 +41,7 @@ import org.objectweb.asm.tree.TryCatchBlockNode;
|
|||||||
import org.objectweb.asm.tree.TypeInsnNode;
|
import org.objectweb.asm.tree.TypeInsnNode;
|
||||||
import org.objectweb.asm.tree.VarInsnNode;
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
|
import me.ByteEdit.main.Main;
|
||||||
import me.ByteEdit.utils.ClassUtil;
|
import me.ByteEdit.utils.ClassUtil;
|
||||||
import me.ByteEdit.utils.OpcodesReverse;
|
import me.ByteEdit.utils.OpcodesReverse;
|
||||||
import me.ByteEdit.utils.UnicodeUtils;
|
import me.ByteEdit.utils.UnicodeUtils;
|
||||||
@@ -215,10 +217,11 @@ public class Disassembler {
|
|||||||
|
|
||||||
private static String doMethods(List<MethodNode> methods, String className, Object nodeToFind,
|
private static String doMethods(List<MethodNode> methods, String className, Object nodeToFind,
|
||||||
AtomicInteger lineFound, HugeStrings hs) throws InterruptedException, ExecutionException {
|
AtomicInteger lineFound, HugeStrings hs) throws InterruptedException, ExecutionException {
|
||||||
|
boolean multithreaded = Main.INSTANCE.mntmMultithreaded.isSelected();
|
||||||
Future<String>[] futures = new Future[methods.size()];
|
Future<String>[] futures = new Future[methods.size()];
|
||||||
for (int i = 0; i < futures.length; i++) {
|
for (int i = 0; i < futures.length; i++) {
|
||||||
MethodNode mn = methods.get(i);
|
MethodNode mn = methods.get(i);
|
||||||
futures[i] = exec.submit(new Callable<String>() {
|
Callable<String> callable = new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception {
|
public String call() throws Exception {
|
||||||
String ms = "";
|
String ms = "";
|
||||||
@@ -318,10 +321,13 @@ public class Disassembler {
|
|||||||
}
|
}
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
futures[i] = multithreaded ? exec.submit(callable) : new FutureTask<>(callable);
|
||||||
}
|
}
|
||||||
StringContext ctx = new StringContext(futures.length);
|
StringContext ctx = new StringContext(futures.length);
|
||||||
for (Future<String> f : futures) {
|
for (Future<String> f : futures) {
|
||||||
|
if (f instanceof FutureTask)
|
||||||
|
((FutureTask) f).run();
|
||||||
ctx.next(f.get());
|
ctx.next(f.get());
|
||||||
}
|
}
|
||||||
String s = ctx.finish();
|
String s = ctx.finish();
|
||||||
@@ -613,8 +619,14 @@ public class Disassembler {
|
|||||||
s += "\n\t\t]\n";
|
s += "\n\t\t]\n";
|
||||||
return s;
|
return s;
|
||||||
} else {
|
} else {
|
||||||
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " "
|
String decomp = ClassUtil.getDecompiledValue(node.cst, "", hs);
|
||||||
+ ClassUtil.getDecompiledValue(node.cst, "", hs) + "\n";
|
if (node.cst instanceof String) {
|
||||||
|
if (decomp.startsWith("\"#") && decomp.endsWith("\""))
|
||||||
|
decomp = decomp.substring(1, decomp.length() - 1);
|
||||||
|
else if (decomp.startsWith("\"\\u0023"))
|
||||||
|
decomp = "\"#" + decomp.substring(7);
|
||||||
|
}
|
||||||
|
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + decomp + "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
iiMap.put(VarInsnNode.class, (n, labels, hs) -> {
|
iiMap.put(VarInsnNode.class, (n, labels, hs) -> {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import me.ByteEdit.utils.UnicodeUtils;
|
|||||||
|
|
||||||
public class HugeStrings {
|
public class HugeStrings {
|
||||||
|
|
||||||
public static final int THRESHOLD = 1000;
|
public static int THRESHOLD = 1000;
|
||||||
private final HashMap<String, HugeData> map = new HashMap<>();
|
private final HashMap<String, HugeData> map = new HashMap<>();
|
||||||
|
|
||||||
public String onString(String s) {
|
public String onString(String s) {
|
||||||
|
|||||||
+165
-26
@@ -17,11 +17,14 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.StringReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -37,6 +40,8 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.swing.ButtonGroup;
|
||||||
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
@@ -46,6 +51,7 @@ import javax.swing.JMenuBar;
|
|||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JRadioButtonMenuItem;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
@@ -72,7 +78,9 @@ import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
|||||||
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
||||||
import org.fife.ui.rsyntaxtextarea.folding.CurlyFoldParser;
|
import org.fife.ui.rsyntaxtextarea.folding.CurlyFoldParser;
|
||||||
import org.fife.ui.rsyntaxtextarea.folding.FoldParserManager;
|
import org.fife.ui.rsyntaxtextarea.folding.FoldParserManager;
|
||||||
|
import org.fife.ui.rtextarea.RTextArea;
|
||||||
import org.fife.ui.rtextarea.RTextScrollPane;
|
import org.fife.ui.rtextarea.RTextScrollPane;
|
||||||
|
import org.fife.ui.rtextarea.ToolTipSupplier;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
@@ -81,7 +89,6 @@ import org.objectweb.asm.tree.MethodNode;
|
|||||||
|
|
||||||
import me.ByteEdit.boxes.CompilationBox;
|
import me.ByteEdit.boxes.CompilationBox;
|
||||||
import me.ByteEdit.boxes.GlobalSearchBox;
|
import me.ByteEdit.boxes.GlobalSearchBox;
|
||||||
import me.ByteEdit.boxes.OptionBox;
|
|
||||||
import me.ByteEdit.boxes.RenameBox;
|
import me.ByteEdit.boxes.RenameBox;
|
||||||
import me.ByteEdit.boxes.SearchBox;
|
import me.ByteEdit.boxes.SearchBox;
|
||||||
import me.ByteEdit.boxes.ThemeBox;
|
import me.ByteEdit.boxes.ThemeBox;
|
||||||
@@ -90,6 +97,7 @@ import me.ByteEdit.boxes.UnicodeBox;
|
|||||||
import me.ByteEdit.edit.Assembler;
|
import me.ByteEdit.edit.Assembler;
|
||||||
import me.ByteEdit.edit.Disassembler;
|
import me.ByteEdit.edit.Disassembler;
|
||||||
import me.ByteEdit.edit.Disassembler.DisassembleTuple;
|
import me.ByteEdit.edit.Disassembler.DisassembleTuple;
|
||||||
|
import me.ByteEdit.edit.HugeStrings;
|
||||||
import me.ByteEdit.utils.ClassUtil;
|
import me.ByteEdit.utils.ClassUtil;
|
||||||
import me.ByteEdit.utils.OpcodesReverse;
|
import me.ByteEdit.utils.OpcodesReverse;
|
||||||
import me.ByteEdit.utils.UnicodeUtils;
|
import me.ByteEdit.utils.UnicodeUtils;
|
||||||
@@ -107,7 +115,6 @@ public class Main extends JFrame {
|
|||||||
public static GlobalSearchBox globalSearchBox;
|
public static GlobalSearchBox globalSearchBox;
|
||||||
public static SearchBox searchBox;
|
public static SearchBox searchBox;
|
||||||
public static TypeOpenBox typeOpenBox;
|
public static TypeOpenBox typeOpenBox;
|
||||||
public static OptionBox optionBox;
|
|
||||||
public static UnicodeBox unicodeBox;
|
public static UnicodeBox unicodeBox;
|
||||||
public static RenameBox renameBox;
|
public static RenameBox renameBox;
|
||||||
public static CompilationBox compilationBox;
|
public static CompilationBox compilationBox;
|
||||||
@@ -116,6 +123,32 @@ public class Main extends JFrame {
|
|||||||
public static RTextScrollPane scrollPane_ByteEdit;
|
public static RTextScrollPane scrollPane_ByteEdit;
|
||||||
public static File saveFolder;
|
public static File saveFolder;
|
||||||
|
|
||||||
|
private static final Pattern SLASH = Pattern.compile("/");
|
||||||
|
private JMenuBar menuBar;
|
||||||
|
private JMenu mnFile;
|
||||||
|
private JMenuItem mntmOpenJar;
|
||||||
|
private JMenuItem mntmSaveBytecode;
|
||||||
|
private JMenuItem mntmSaveJar;
|
||||||
|
private JMenu mnWindow;
|
||||||
|
private JMenuItem mntmThemes;
|
||||||
|
private JMenuItem mntmSearchMembers;
|
||||||
|
private JMenuItem mntmSearch;
|
||||||
|
private JMenuItem mntmOpenType;
|
||||||
|
private JMenuItem mntmUnicode;
|
||||||
|
private JMenuItem mntmCompiler;
|
||||||
|
private JMenu mnSearch;
|
||||||
|
private JMenu mnOptions;
|
||||||
|
private JCheckBoxMenuItem mntmComputeFrames;
|
||||||
|
private JCheckBoxMenuItem mntmComputeMax;
|
||||||
|
private JMenu mnStringLimit;
|
||||||
|
private JRadioButtonMenuItem rdbtnmntm0;
|
||||||
|
private JMenuItem rdbtnmntm100;
|
||||||
|
private JMenuItem rdbtnmntm1000;
|
||||||
|
private JMenuItem rdbtnmntm500;
|
||||||
|
private JMenuItem rdbtnmntm5000;
|
||||||
|
private JMenuItem rdbtnmntm10000;
|
||||||
|
public JCheckBoxMenuItem mntmMultithreaded;
|
||||||
|
|
||||||
public static final Object treeLock = new Object();
|
public static final Object treeLock = new Object();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +242,6 @@ public class Main extends JFrame {
|
|||||||
globalSearchBox = new GlobalSearchBox();
|
globalSearchBox = new GlobalSearchBox();
|
||||||
searchBox = new SearchBox();
|
searchBox = new SearchBox();
|
||||||
typeOpenBox = new TypeOpenBox();
|
typeOpenBox = new TypeOpenBox();
|
||||||
optionBox = new OptionBox();
|
|
||||||
unicodeBox = new UnicodeBox();
|
unicodeBox = new UnicodeBox();
|
||||||
renameBox = new RenameBox();
|
renameBox = new RenameBox();
|
||||||
compilationBox = new CompilationBox();
|
compilationBox = new CompilationBox();
|
||||||
@@ -217,7 +249,6 @@ public class Main extends JFrame {
|
|||||||
ThemeManager.registerFrames(globalSearchBox);
|
ThemeManager.registerFrames(globalSearchBox);
|
||||||
ThemeManager.registerFrames(searchBox);
|
ThemeManager.registerFrames(searchBox);
|
||||||
ThemeManager.registerFrames(typeOpenBox);
|
ThemeManager.registerFrames(typeOpenBox);
|
||||||
ThemeManager.registerFrames(optionBox);
|
|
||||||
ThemeManager.registerFrames(unicodeBox);
|
ThemeManager.registerFrames(unicodeBox);
|
||||||
ThemeManager.registerFrames(renameBox);
|
ThemeManager.registerFrames(renameBox);
|
||||||
ThemeManager.registerFrames(compilationBox);
|
ThemeManager.registerFrames(compilationBox);
|
||||||
@@ -278,7 +309,6 @@ public class Main extends JFrame {
|
|||||||
globalSearchBox.setVisible(false);
|
globalSearchBox.setVisible(false);
|
||||||
searchBox.setVisible(false);
|
searchBox.setVisible(false);
|
||||||
typeOpenBox.setVisible(false);
|
typeOpenBox.setVisible(false);
|
||||||
optionBox.setVisible(false);
|
|
||||||
unicodeBox.setVisible(false);
|
unicodeBox.setVisible(false);
|
||||||
renameBox.setVisible(false);
|
renameBox.setVisible(false);
|
||||||
compilationBox.setVisible(false);
|
compilationBox.setVisible(false);
|
||||||
@@ -336,6 +366,56 @@ public class Main extends JFrame {
|
|||||||
mntmCompiler = new JMenuItem("Compiler");
|
mntmCompiler = new JMenuItem("Compiler");
|
||||||
mntmCompiler.addActionListener(e -> compilationBox.setVisible(true));
|
mntmCompiler.addActionListener(e -> compilationBox.setVisible(true));
|
||||||
mnWindow.add(mntmCompiler);
|
mnWindow.add(mntmCompiler);
|
||||||
|
|
||||||
|
mnOptions = new JMenu("Options");
|
||||||
|
menuBar.add(mnOptions);
|
||||||
|
|
||||||
|
mntmComputeFrames = new JCheckBoxMenuItem("Compute Frames");
|
||||||
|
mnOptions.add(mntmComputeFrames);
|
||||||
|
|
||||||
|
mntmComputeMax = new JCheckBoxMenuItem("Compute Max");
|
||||||
|
mnOptions.add(mntmComputeMax);
|
||||||
|
|
||||||
|
mntmMultithreaded = new JCheckBoxMenuItem("Multithreaded");
|
||||||
|
mntmMultithreaded.setSelected(true);
|
||||||
|
mnOptions.add(mntmMultithreaded);
|
||||||
|
|
||||||
|
mnStringLimit = new JMenu("Huge String Limit");
|
||||||
|
mnOptions.add(mnStringLimit);
|
||||||
|
|
||||||
|
rdbtnmntm0 = new JRadioButtonMenuItem("0");
|
||||||
|
rdbtnmntm0.addActionListener(e -> HugeStrings.THRESHOLD = 0);
|
||||||
|
mnStringLimit.add(rdbtnmntm0);
|
||||||
|
|
||||||
|
rdbtnmntm100 = new JRadioButtonMenuItem("100");
|
||||||
|
rdbtnmntm100.addActionListener(e -> HugeStrings.THRESHOLD = 100);
|
||||||
|
mnStringLimit.add(rdbtnmntm100);
|
||||||
|
|
||||||
|
rdbtnmntm500 = new JRadioButtonMenuItem("500");
|
||||||
|
rdbtnmntm500.addActionListener(e -> HugeStrings.THRESHOLD = 500);
|
||||||
|
mnStringLimit.add(rdbtnmntm500);
|
||||||
|
|
||||||
|
rdbtnmntm1000 = new JRadioButtonMenuItem("1000");
|
||||||
|
rdbtnmntm1000.addActionListener(e -> HugeStrings.THRESHOLD = 1000);
|
||||||
|
rdbtnmntm1000.setSelected(true);
|
||||||
|
mnStringLimit.add(rdbtnmntm1000);
|
||||||
|
|
||||||
|
rdbtnmntm5000 = new JRadioButtonMenuItem("5000");
|
||||||
|
rdbtnmntm5000.addActionListener(e -> HugeStrings.THRESHOLD = 5000);
|
||||||
|
mnStringLimit.add(rdbtnmntm5000);
|
||||||
|
|
||||||
|
rdbtnmntm10000 = new JRadioButtonMenuItem("10000");
|
||||||
|
rdbtnmntm10000.addActionListener(e -> HugeStrings.THRESHOLD = 10000);
|
||||||
|
mnStringLimit.add(rdbtnmntm10000);
|
||||||
|
|
||||||
|
ButtonGroup group = new ButtonGroup();
|
||||||
|
group.add(rdbtnmntm0);
|
||||||
|
group.add(rdbtnmntm100);
|
||||||
|
group.add(rdbtnmntm500);
|
||||||
|
group.add(rdbtnmntm1000);
|
||||||
|
group.add(rdbtnmntm5000);
|
||||||
|
group.add(rdbtnmntm10000);
|
||||||
|
|
||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
setContentPane(contentPane);
|
setContentPane(contentPane);
|
||||||
@@ -472,7 +552,6 @@ public class Main extends JFrame {
|
|||||||
globalSearchBox.setVisible(false);
|
globalSearchBox.setVisible(false);
|
||||||
searchBox.setVisible(false);
|
searchBox.setVisible(false);
|
||||||
typeOpenBox.setVisible(false);
|
typeOpenBox.setVisible(false);
|
||||||
optionBox.setVisible(false);
|
|
||||||
unicodeBox.setVisible(false);
|
unicodeBox.setVisible(false);
|
||||||
renameBox.setVisible(false);
|
renameBox.setVisible(false);
|
||||||
compilationBox.setVisible(false);
|
compilationBox.setVisible(false);
|
||||||
@@ -520,6 +599,84 @@ public class Main extends JFrame {
|
|||||||
txtByteEditView = new RSyntaxTextArea();
|
txtByteEditView = new RSyntaxTextArea();
|
||||||
ac.install(txtByteEditView);
|
ac.install(txtByteEditView);
|
||||||
txtByteEditView.setCodeFoldingEnabled(true);
|
txtByteEditView.setCodeFoldingEnabled(true);
|
||||||
|
// ToolTips for HugeStrings
|
||||||
|
txtByteEditView.setToolTipSupplier(new ToolTipSupplier() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToolTipText(RTextArea textArea, MouseEvent e) {
|
||||||
|
int idx = textArea.viewToModel(e.getPoint());
|
||||||
|
if (idx < 0)
|
||||||
|
return null;
|
||||||
|
int subIdx = Math.max(idx - 15, 0);
|
||||||
|
int subLen = Math.min(30, textArea.getDocument().getLength() - subIdx);
|
||||||
|
if (subLen <= 0)
|
||||||
|
return null;
|
||||||
|
try {
|
||||||
|
String cut = textArea.getText(subIdx, subLen);
|
||||||
|
int hashIdx = -1;
|
||||||
|
for (int off = idx - subIdx; off >= 0; off--) {
|
||||||
|
if (cut.charAt(off) == '#') {
|
||||||
|
hashIdx = off;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hashIdx < 0) {
|
||||||
|
for (int off = idx - subIdx; off < cut.length(); off++) {
|
||||||
|
if (cut.charAt(off) == '#') {
|
||||||
|
hashIdx = off;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hashIdx < 0)
|
||||||
|
return null;
|
||||||
|
if (hashIdx >= 5 && cut.substring(hashIdx - 5, hashIdx).equals("ldc \"")) // ldc "#..."
|
||||||
|
return null;
|
||||||
|
int numLen = 1;
|
||||||
|
for (int i = hashIdx + 1; i < cut.length(); i++) {
|
||||||
|
if (!(cut.charAt(i) - '0' >= 0 && cut.charAt(i) - '0' <= 9)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
numLen++;
|
||||||
|
}
|
||||||
|
if (numLen < 2 || hashIdx > idx - subIdx || idx - subIdx - numLen >= hashIdx)
|
||||||
|
return null;
|
||||||
|
String hashNum = cut.substring(hashIdx, hashIdx + numLen);
|
||||||
|
|
||||||
|
String txt = txtByteEditView.getText();
|
||||||
|
int len = 0;
|
||||||
|
for (String asm : txt.split("\\/\\/ #Annotations:\n")) {
|
||||||
|
len += 19; // "\\/\\/ #Annotations:\n".length()
|
||||||
|
if (asm.isEmpty())
|
||||||
|
continue;
|
||||||
|
if (idx >= len && idx < len + asm.length()) {
|
||||||
|
try (BufferedReader reader = new BufferedReader(new StringReader(asm))) {
|
||||||
|
String s;
|
||||||
|
while (!(s = reader.readLine()).startsWith("// #SourceFile: ")) {
|
||||||
|
}
|
||||||
|
while (!(s = reader.readLine()).equals("// #Fields")) {
|
||||||
|
if (s.startsWith("#")) {
|
||||||
|
String[] split = Assembler.SPACE.split(s, 2);
|
||||||
|
if (hashNum.equals(split[0].substring(0, split[0].length() - 1))) {
|
||||||
|
String toolTip = split[1];
|
||||||
|
if (toolTip.length() > 500)
|
||||||
|
toolTip = toolTip.substring(0, 500) + "...";
|
||||||
|
return toolTip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e1) {
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
len += asm.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (BadLocationException e1) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
txtByteEditView.addKeyListener(new KeyAdapter() {
|
txtByteEditView.addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -551,7 +708,6 @@ public class Main extends JFrame {
|
|||||||
KeyStroke ctrlT = KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_DOWN_MASK);
|
KeyStroke ctrlT = KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_DOWN_MASK);
|
||||||
KeyStroke ctrlS = KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK);
|
KeyStroke ctrlS = KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK);
|
||||||
KeyStroke ctrlG = KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_DOWN_MASK);
|
KeyStroke ctrlG = KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_DOWN_MASK);
|
||||||
KeyStroke ctrlO = KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK);
|
|
||||||
KeyStroke ctrlU = KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_DOWN_MASK);
|
KeyStroke ctrlU = KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_DOWN_MASK);
|
||||||
KeyStroke ctrlR = KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_DOWN_MASK);
|
KeyStroke ctrlR = KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_DOWN_MASK);
|
||||||
KeyStroke ctrlE = KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK);
|
KeyStroke ctrlE = KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK);
|
||||||
@@ -574,8 +730,6 @@ public class Main extends JFrame {
|
|||||||
typeOpenBox.txtSearch.requestFocusInWindow();
|
typeOpenBox.txtSearch.requestFocusInWindow();
|
||||||
typeOpenBox.txtSearch.select(0, typeOpenBox.txtSearch.getText().length());
|
typeOpenBox.txtSearch.select(0, typeOpenBox.txtSearch.getText().length());
|
||||||
}, ctrlT, JComponent.WHEN_IN_FOCUSED_WINDOW);
|
}, ctrlT, JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||||
txtByteEditView.registerKeyboardAction(e -> optionBox.setVisible(true), ctrlO,
|
|
||||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
||||||
txtByteEditView.registerKeyboardAction(e -> unicodeBox.setVisible(true), ctrlU,
|
txtByteEditView.registerKeyboardAction(e -> unicodeBox.setVisible(true), ctrlU,
|
||||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||||
txtByteEditView.registerKeyboardAction(e -> compilationBox.setVisible(true), ctrlE,
|
txtByteEditView.registerKeyboardAction(e -> compilationBox.setVisible(true), ctrlE,
|
||||||
@@ -901,10 +1055,10 @@ public class Main extends JFrame {
|
|||||||
output.closeEntry();
|
output.closeEntry();
|
||||||
}
|
}
|
||||||
int computeFlags = 0;
|
int computeFlags = 0;
|
||||||
if (optionBox.chckbxComputeFrames.isSelected()) {
|
if (mntmComputeFrames.isSelected()) {
|
||||||
computeFlags |= ClassWriter.COMPUTE_FRAMES;
|
computeFlags |= ClassWriter.COMPUTE_FRAMES;
|
||||||
}
|
}
|
||||||
if (optionBox.chckbxComputeMax.isSelected()) {
|
if (mntmComputeMax.isSelected()) {
|
||||||
computeFlags |= ClassWriter.COMPUTE_MAXS;
|
computeFlags |= ClassWriter.COMPUTE_MAXS;
|
||||||
}
|
}
|
||||||
for (ClassNode node : classes) {
|
for (ClassNode node : classes) {
|
||||||
@@ -941,21 +1095,6 @@ public class Main extends JFrame {
|
|||||||
return s + ".class";
|
return s + ".class";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern SLASH = Pattern.compile("/");
|
|
||||||
private JMenuBar menuBar;
|
|
||||||
private JMenu mnFile;
|
|
||||||
private JMenuItem mntmOpenJar;
|
|
||||||
private JMenuItem mntmSaveBytecode;
|
|
||||||
private JMenuItem mntmSaveJar;
|
|
||||||
private JMenu mnWindow;
|
|
||||||
private JMenuItem mntmThemes;
|
|
||||||
private JMenuItem mntmSearchMembers;
|
|
||||||
private JMenuItem mntmSearch;
|
|
||||||
private JMenuItem mntmOpenType;
|
|
||||||
private JMenuItem mntmUnicode;
|
|
||||||
private JMenuItem mntmCompiler;
|
|
||||||
private JMenu mnSearch;
|
|
||||||
|
|
||||||
class ArchiveTreeModel extends DefaultTreeModel {
|
class ArchiveTreeModel extends DefaultTreeModel {
|
||||||
|
|
||||||
public ArrayList<String> paths = new ArrayList<>();
|
public ArrayList<String> paths = new ArrayList<>();
|
||||||
|
|||||||
Reference in new issue
Block a user