mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Fixed a search/replace bug and a new class bug
This commit is contained in:
1 parent
a773480a23
commit
d492b79a8f
3 files changed
+12
-3
No files matched your search
@@ -4,6 +4,7 @@ import java.awt.Toolkit;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@@ -111,7 +112,8 @@ public class SearchBox extends JFrame {
|
|||||||
: Main.txtByteEditView.getText().substring(startPos).toLowerCase();
|
: Main.txtByteEditView.getText().substring(startPos).toLowerCase();
|
||||||
int index = txt.indexOf(chckbxCaseSensitive.isSelected() ? toFind : toFind.toLowerCase());
|
int index = txt.indexOf(chckbxCaseSensitive.isSelected() ? toFind : toFind.toLowerCase());
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
txt = chckbxCaseSensitive.isSelected() ? Main.txtByteEditView.getText() : Main.txtByteEditView.getText().toLowerCase();
|
txt = chckbxCaseSensitive.isSelected() ? Main.txtByteEditView.getText()
|
||||||
|
: Main.txtByteEditView.getText().toLowerCase();
|
||||||
index = txt.indexOf(chckbxCaseSensitive.isSelected() ? toFind : toFind.toLowerCase());
|
index = txt.indexOf(chckbxCaseSensitive.isSelected() ? toFind : toFind.toLowerCase());
|
||||||
startPos = 0;
|
startPos = 0;
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
@@ -141,7 +143,9 @@ public class SearchBox extends JFrame {
|
|||||||
if (chckbxCaseSensitive.isSelected()) {
|
if (chckbxCaseSensitive.isSelected()) {
|
||||||
Main.txtByteEditView.replaceRange(txt.replace(toFind, toReplace), 0, txt.length());
|
Main.txtByteEditView.replaceRange(txt.replace(toFind, toReplace), 0, txt.length());
|
||||||
} else {
|
} else {
|
||||||
Main.txtByteEditView.replaceRange(txt.replaceAll("(?i)" + Pattern.quote(toFind), toReplace), 0, txt.length());
|
Main.txtByteEditView.replaceRange(
|
||||||
|
txt.replaceAll("(?i)" + Pattern.quote(toFind), Matcher.quoteReplacement(toReplace)), 0,
|
||||||
|
txt.length());
|
||||||
}
|
}
|
||||||
Main.txtByteEditView.setCaretPosition(prev);
|
Main.txtByteEditView.setCaretPosition(prev);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -422,10 +422,10 @@ public class Assembler {
|
|||||||
System.err.println("Error at line: " + read.currentLine);
|
System.err.println("Error at line: " + read.currentLine);
|
||||||
try {
|
try {
|
||||||
Main.txtByteEditView.setCaretPosition(Main.txtByteEditView.getLineStartOffset(read.currentLine));
|
Main.txtByteEditView.setCaretPosition(Main.txtByteEditView.getLineStartOffset(read.currentLine));
|
||||||
Main.showError(e.getMessage());
|
|
||||||
} catch (BadLocationException e1) {
|
} catch (BadLocationException e1) {
|
||||||
System.err.println("Can't show line!");
|
System.err.println("Can't show line!");
|
||||||
}
|
}
|
||||||
|
Main.showError(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -667,7 +667,12 @@ public class Main extends JFrame {
|
|||||||
} else {
|
} else {
|
||||||
model = (ArchiveTreeModel) tree.getModel();
|
model = (ArchiveTreeModel) tree.getModel();
|
||||||
}
|
}
|
||||||
|
if (node.name.contains("/") ? (!node.name.split("/")[node.name.split("/").length - 1].contains("$"))
|
||||||
|
: (!node.name.contains("$"))) {
|
||||||
model.paths.add(node.name + ".class");
|
model.paths.add(node.name + ".class");
|
||||||
|
} else if (node.name.startsWith("$") || node.name.contains("$$") || node.name.endsWith("$")) { // obfuscated
|
||||||
|
model.paths.add(node.name + ".class");
|
||||||
|
}
|
||||||
model.refresh();
|
model.refresh();
|
||||||
model.reload();
|
model.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user