mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-18 17:52:31 +00:00
Scoped script text search fixes
Parameters panel on Script search can be turned off in settings
This commit is contained in:
@@ -681,6 +681,10 @@ public final class Configuration {
|
||||
@ConfigurationCategory("script")
|
||||
public static ConfigurationItem<Boolean> warningInitializers = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(true)
|
||||
@ConfigurationCategory("ui")
|
||||
public static ConfigurationItem<Boolean> parametersPanelInSearchResults = null;
|
||||
|
||||
private enum OSId {
|
||||
WINDOWS, OSX, UNIX
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
|
||||
oos.writeInt(classIndex);
|
||||
oos.writeInt(traitId);
|
||||
oos.flush();
|
||||
oos.close();
|
||||
}
|
||||
|
||||
public ABCSearchResult(ScriptPack scriptPack) {
|
||||
|
||||
@@ -66,6 +66,7 @@ public class ActionSearchResult implements ScriptSearchResult {
|
||||
oos.writeUTF(path);
|
||||
oos.writeBoolean(pcode);
|
||||
oos.flush();
|
||||
oos.close();
|
||||
}
|
||||
|
||||
public ActionSearchResult(ASMSource src, boolean pcode, String path) {
|
||||
|
||||
@@ -333,7 +333,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
View.checkAccess();
|
||||
|
||||
if (swf != null) {
|
||||
mainFrame.getPanel().searchInActionScriptOrText(searchInText, swf);
|
||||
mainFrame.getPanel().searchInActionScriptOrText(searchInText, swf, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1189,11 +1189,11 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
if (swf.isAS3()) {
|
||||
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
|
||||
sr.setResults(Main.searchResultsStorage.getAbcSearchResultsAt(swf, fi));
|
||||
|
||||
} else {
|
||||
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
|
||||
sr.setResults(Main.searchResultsStorage.getActionSearchResultsAt(swf, fi));
|
||||
}
|
||||
sr.setResults(Main.searchResultsStorage.getSearchResultsAt(mainFrame.getPanel().getAllSwfs(), fi));
|
||||
sr.setVisible(true);
|
||||
if (!Main.getMainFrame().getPanel().searchResultsDialogs.containsKey(swf)) {
|
||||
Main.getMainFrame().getPanel().searchResultsDialogs.put(swf, new ArrayList<>());
|
||||
|
||||
@@ -184,11 +184,10 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
SearchResultsDialog sr;
|
||||
if (swf.isAS3()) {
|
||||
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
|
||||
sr.setResults(Main.searchResultsStorage.getAbcSearchResultsAt(swf, fi));
|
||||
} else {
|
||||
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
|
||||
sr.setResults(Main.searchResultsStorage.getActionSearchResultsAt(swf, fi));
|
||||
}
|
||||
sr.setResults(Main.searchResultsStorage.getSearchResultsAt(Main.getMainFrame().getPanel().getAllSwfs(), fi));
|
||||
sr.setVisible(true);
|
||||
if (!Main.getMainFrame().getPanel().searchResultsDialogs.containsKey(swf)) {
|
||||
Main.getMainFrame().getPanel().searchResultsDialogs.put(swf, new ArrayList<>());
|
||||
|
||||
@@ -1774,10 +1774,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
|
||||
public void searchInActionScriptOrText(Boolean searchInText, SWF swf) {
|
||||
View.checkAccess();
|
||||
public Set<SWF> getAllSwfs() {
|
||||
List<SWF> allSwfs = new ArrayList<>();
|
||||
for (SWFList slist : getSwfs()) {
|
||||
for (SWF s : slist.swfs) {
|
||||
allSwfs.add(s);
|
||||
populateSwfs(s, allSwfs);
|
||||
}
|
||||
}
|
||||
return new LinkedHashSet<>(allSwfs);
|
||||
}
|
||||
|
||||
List<TreeItem> allItems = tagTree.getAllSelected();
|
||||
public void searchInActionScriptOrText(Boolean searchInText, SWF swf, boolean useSelection) {
|
||||
View.checkAccess();
|
||||
|
||||
Map<SWF, List<ScriptPack>> scopeAs3 = new LinkedHashMap<>();
|
||||
Map<SWF, Map<String, ASMSource>> swfToAllASMSourceMap = new HashMap<>();
|
||||
@@ -1785,6 +1794,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
Set<SWF> swfsUsed = new LinkedHashSet<>();
|
||||
|
||||
List<TreeItem> allItems = tagTree.getAllSelected();
|
||||
for (TreeItem t : allItems) {
|
||||
if (t instanceof ScriptPack) {
|
||||
ScriptPack sp = (ScriptPack) t;
|
||||
@@ -1812,6 +1822,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
allSources = swfToAllASMSourceMap.get(s);
|
||||
} else {
|
||||
allSources = s.getASMs(false);
|
||||
swfToAllASMSourceMap.put(s, allSources);
|
||||
}
|
||||
for (String path : allSources.keySet()) {
|
||||
if (allSources.get(path) == as) {
|
||||
@@ -1837,11 +1848,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
} else if (items.isEmpty()) {
|
||||
selected = null;
|
||||
} else {
|
||||
selected = AppDialog.translateForDialog("scope.selection.nodes", SearchDialog.class).replace("%count%", "" + items.size());
|
||||
selected = AppDialog.translateForDialog("scope.selection.items", SearchDialog.class).replace("%count%", "" + items.size());
|
||||
}
|
||||
|
||||
|
||||
SearchDialog searchDialog = new SearchDialog(getMainFrame().getWindow(), false, selected);
|
||||
SearchDialog searchDialog = new SearchDialog(getMainFrame().getWindow(), false, selected, useSelection);
|
||||
if (searchInText != null) {
|
||||
if (searchInText) {
|
||||
searchDialog.searchInTextsRadioButton.setSelected(true);
|
||||
@@ -1853,12 +1863,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (searchDialog.showDialog() == AppDialog.OK_OPTION) {
|
||||
final String txt = searchDialog.searchField.getText();
|
||||
if (!txt.isEmpty()) {
|
||||
if (!scopeAs3.isEmpty()) {
|
||||
getABCPanel();
|
||||
}
|
||||
if (!scopeAs12.isEmpty()) {
|
||||
getActionPanel();
|
||||
}
|
||||
|
||||
if (searchDialog.getCurrentScope() == SearchDialog.SCOPE_CURRENT_FILE) {
|
||||
scopeAs3.clear();
|
||||
@@ -1872,13 +1876,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
swfsUsed.add(swf);
|
||||
}
|
||||
if (searchDialog.getCurrentScope() == SearchDialog.SCOPE_ALL_FILES) {
|
||||
List<SWF> allSwfs = new ArrayList<>();
|
||||
for (SWFList slist : getSwfs()) {
|
||||
for (SWF s : slist.swfs) {
|
||||
allSwfs.add(s);
|
||||
populateSwfs(s, allSwfs);
|
||||
}
|
||||
}
|
||||
Set<SWF> allSwfs = getAllSwfs();
|
||||
|
||||
|
||||
for (SWF s : allSwfs) {
|
||||
if (s.isAS3()) {
|
||||
@@ -1891,6 +1890,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
swfsUsed.addAll(allSwfs);
|
||||
}
|
||||
|
||||
if (!scopeAs3.isEmpty()) {
|
||||
getABCPanel();
|
||||
}
|
||||
if (!scopeAs12.isEmpty()) {
|
||||
getActionPanel();
|
||||
}
|
||||
|
||||
boolean ignoreCase = searchDialog.ignoreCaseCheckBox.isSelected();
|
||||
boolean regexp = searchDialog.regexpCheckBox.isSelected();
|
||||
|
||||
@@ -1907,12 +1913,16 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (scopeAs3.containsKey(s)) {
|
||||
List<ABCSearchResult> abcResult = getABCPanel().search(s, txt, ignoreCase, regexp, pCodeSearch, this, scopeAs3.get(s));
|
||||
fResult.addAll(abcResult);
|
||||
Main.searchResultsStorage.addABCResults(s, txt, ignoreCase, regexp, abcResult);
|
||||
if (!abcResult.isEmpty()) {
|
||||
Main.searchResultsStorage.addABCResults(s, txt, ignoreCase, regexp, abcResult);
|
||||
}
|
||||
}
|
||||
if (scopeAs12.containsKey(s)) {
|
||||
List<ActionSearchResult> actionResult = getActionPanel().search(s, txt, ignoreCase, regexp, pCodeSearch, this, scopeAs12.get(s));
|
||||
fResult.addAll(actionResult);
|
||||
Main.searchResultsStorage.addActionResults(s, txt, ignoreCase, regexp, actionResult);
|
||||
if (!actionResult.isEmpty()) {
|
||||
Main.searchResultsStorage.addActionResults(s, txt, ignoreCase, regexp, actionResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1948,8 +1958,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
Main.stopWork();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}.execute();
|
||||
} else if (searchDialog.searchInTextsRadioButton.isSelected()) {
|
||||
new CancellableWorker<Void>() {
|
||||
@@ -1988,18 +1998,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void replaceText() {
|
||||
|
||||
List<TreeItem> items = tagTree.getSelected();
|
||||
String selected;
|
||||
if (items.size() == 1) {
|
||||
selected = items.get(0).toString();
|
||||
} else if (items.isEmpty()) {
|
||||
selected = null;
|
||||
} else {
|
||||
selected = AppDialog.translateForDialog("scope.selection.nodes", SearchDialog.class).replace("%count%", "" + items.size());
|
||||
}
|
||||
|
||||
SearchDialog replaceDialog = new SearchDialog(getMainFrame().getWindow(), true, selected);
|
||||
SearchDialog replaceDialog = new SearchDialog(getMainFrame().getWindow(), true, null, false);
|
||||
if (replaceDialog.showDialog() == AppDialog.OK_OPTION) {
|
||||
final String txt = replaceDialog.searchField.getText();
|
||||
if (!txt.isEmpty()) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SearchDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
|
||||
public SearchDialog(Window owner, boolean replace, String selection) {
|
||||
public SearchDialog(Window owner, boolean replace, String selection, boolean selectionFirst) {
|
||||
super(owner);
|
||||
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
|
||||
ignoreCaseCheckBox.setSelected(true);
|
||||
@@ -118,6 +118,17 @@ public class SearchDialog extends AppDialog {
|
||||
scopeComboBox = new JComboBox<>(scopeItems.toArray(new String[scopeItems.size()]));
|
||||
panField.add(scopeComboBox);
|
||||
|
||||
if (selection != null && !selectionFirst) {
|
||||
scopeComboBox.setSelectedIndex(1);
|
||||
}
|
||||
|
||||
if (replace) {
|
||||
if (selection != null) {
|
||||
scopeComboBox.setSelectedIndex(1);
|
||||
}
|
||||
scopeComboBox.setEnabled(false);
|
||||
}
|
||||
|
||||
cnt.add(panField);
|
||||
|
||||
JPanel checkPanel = new JPanel(new FlowLayout());
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
@@ -27,6 +28,7 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JButton;
|
||||
@@ -35,6 +37,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -71,13 +74,14 @@ public class SearchResultsDialog<E> extends AppDialog {
|
||||
closeButton.addActionListener(this::closeButtonActionPerformed);
|
||||
|
||||
JPanel paramsPanel = new JPanel();
|
||||
paramsPanel.setLayout(new BoxLayout(paramsPanel, BoxLayout.Y_AXIS));
|
||||
paramsPanel.setLayout(new FlowLayout());
|
||||
JLabel searchTextLabel = new JLabel(AppDialog.translateForDialog("label.searchtext", SearchDialog.class) + text);
|
||||
JLabel ignoreCaseLabel = new JLabel(AppDialog.translateForDialog("checkbox.ignorecase", SearchDialog.class) + ": " + (ignoreCase ? AppStrings.translate("yes") : AppStrings.translate("no")));
|
||||
JLabel regExpLabel = new JLabel(AppDialog.translateForDialog("checkbox.regexp", SearchDialog.class) + ": " + (regExp ? AppStrings.translate("yes") : AppStrings.translate("no")));
|
||||
paramsPanel.add(ignoreCaseLabel);
|
||||
paramsPanel.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||
paramsPanel.add(regExpLabel);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel();
|
||||
buttonsPanel.setLayout(new FlowLayout());
|
||||
buttonsPanel.add(gotoButton);
|
||||
@@ -104,8 +108,18 @@ public class SearchResultsDialog<E> extends AppDialog {
|
||||
JScrollPane sp = new JScrollPane(resultsList);
|
||||
sp.setPreferredSize(new Dimension(300, 300));
|
||||
cnt.add(sp, BorderLayout.CENTER);
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
cnt.add(paramsPanel, BorderLayout.NORTH);
|
||||
|
||||
JPanel bottomPanel = new JPanel();
|
||||
bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS));
|
||||
JPanel searchTextPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
searchTextPanel.add(searchTextLabel);
|
||||
if (Configuration.parametersPanelInSearchResults.get()) {
|
||||
bottomPanel.add(searchTextPanel);
|
||||
bottomPanel.add(paramsPanel);
|
||||
bottomPanel.add(Box.createRigidArea(new Dimension(0, 10)));
|
||||
}
|
||||
bottomPanel.add(buttonsPanel);
|
||||
cnt.add(bottomPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this);
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.search.ABCSearchResult;
|
||||
import com.jpexs.decompiler.flash.search.ActionSearchResult;
|
||||
import com.jpexs.decompiler.flash.search.ScriptNotFoundException;
|
||||
import com.jpexs.decompiler.flash.search.ScriptSearchResult;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
@@ -33,8 +34,10 @@ import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -46,9 +49,12 @@ public class SearchResultsStorage {
|
||||
|
||||
public static final String SEARCH_RESULTS_FILE = "searchresults.bin";
|
||||
|
||||
private static final int SERIAL_VERSION_MAJOR = 1;
|
||||
private static final int SERIAL_VERSION_MAJOR = 2;
|
||||
private static final int SERIAL_VERSION_MINOR = 0;
|
||||
|
||||
private static final int DATA_ABC = 1;
|
||||
private static final int DATA_ACTION = 2;
|
||||
|
||||
private static String getConfigFile() throws IOException {
|
||||
return Configuration.getFFDecHome() + SEARCH_RESULTS_FILE;
|
||||
}
|
||||
@@ -58,7 +64,14 @@ public class SearchResultsStorage {
|
||||
List<Boolean> isRegExp = new ArrayList<>();
|
||||
List<Boolean> isIgnoreCase = new ArrayList<>();
|
||||
List<byte[]> data = new ArrayList<>();
|
||||
Map<Integer, Object> unpackedData = new HashMap<>();
|
||||
Map<Integer, List<ScriptSearchResult>> unpackedData = new HashMap<>();
|
||||
List<Integer> groups = new ArrayList<>();
|
||||
|
||||
private int currentGroupId = 0;
|
||||
|
||||
public void finishGroup() {
|
||||
currentGroupId++;
|
||||
}
|
||||
|
||||
public static String getSwfId(SWF swf) {
|
||||
|
||||
@@ -85,75 +98,89 @@ public class SearchResultsStorage {
|
||||
}
|
||||
|
||||
public String getSearchedValueAt(int index) {
|
||||
return searchedValues.get(index);
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
if (groups.get(j) == index) {
|
||||
return searchedValues.get(j);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isIgnoreCaseAt(int index) {
|
||||
return isIgnoreCase.get(index);
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
if (groups.get(j) == index) {
|
||||
return isIgnoreCase.get(j);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isRegExpAt(int index) {
|
||||
return isRegExp.get(index);
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
if (groups.get(j) == index) {
|
||||
return isRegExp.get(j);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Integer> getIndicesForSwf(SWF swf) {
|
||||
String swfId = getSwfId(swf);
|
||||
List<Integer> res = new ArrayList<>();
|
||||
Set<Integer> foundGroups = new LinkedHashSet<>();
|
||||
for (int i = 0; i < swfIds.size(); i++) {
|
||||
if (swfIds.get(i).equals(swfId)) {
|
||||
res.add(i);
|
||||
foundGroups.add(groups.get(i));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
return new ArrayList<>(foundGroups);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ABCSearchResult> getAbcSearchResultsAt(SWF swf, int index) {
|
||||
public List<ScriptSearchResult> getSearchResultsAt(Set<SWF> allSwfs, int index) {
|
||||
if (unpackedData.containsKey(index)) {
|
||||
return (List<ABCSearchResult>) unpackedData.get(index);
|
||||
return unpackedData.get(index);
|
||||
}
|
||||
List<ABCSearchResult> result = new ArrayList<>();
|
||||
byte[] itemData = data.get(index);
|
||||
List<ScriptSearchResult> result = new ArrayList<>();
|
||||
|
||||
try {
|
||||
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(itemData));
|
||||
List<byte[]> resultData = (List<byte[]>) ois.readObject();
|
||||
for (int i = 0; i < resultData.size(); i++) {
|
||||
try {
|
||||
result.add(new ABCSearchResult(swf, new ByteArrayInputStream(resultData.get(i))));
|
||||
} catch (ScriptNotFoundException | IOException ex) {
|
||||
//ignore
|
||||
Map<String, SWF> swfIdToSwf = new HashMap<>();
|
||||
for (SWF s : allSwfs) {
|
||||
swfIdToSwf.put(getSwfId(s), s);
|
||||
}
|
||||
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
if (groups.get(j) == index) {
|
||||
if (!swfIdToSwf.containsKey(swfIds.get(j))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (IOException | ClassNotFoundException ex) {
|
||||
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
unpackedData.put(index, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ActionSearchResult> getActionSearchResultsAt(SWF swf, int index) {
|
||||
if (unpackedData.containsKey(index)) {
|
||||
return (List<ActionSearchResult>) unpackedData.get(index);
|
||||
}
|
||||
List<ActionSearchResult> result = new ArrayList<>();
|
||||
byte[] itemData = data.get(index);
|
||||
|
||||
try {
|
||||
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(itemData));
|
||||
List<byte[]> resultData = (List<byte[]>) ois.readObject();
|
||||
for (int i = 0; i < resultData.size(); i++) {
|
||||
SWF swf = swfIdToSwf.get(swfIds.get(j));
|
||||
byte[] itemData = data.get(j);
|
||||
try {
|
||||
result.add(new ActionSearchResult(swf, new ByteArrayInputStream(resultData.get(i))));
|
||||
} catch (ScriptNotFoundException | IOException ex) {
|
||||
//ignore
|
||||
ByteArrayInputStream bais1 = new ByteArrayInputStream(itemData);
|
||||
int kind = bais1.read();
|
||||
ObjectInputStream ois = new ObjectInputStream(bais1);
|
||||
List<byte[]> resultData = readByteList(ois);
|
||||
for (int i = 0; i < resultData.size(); i++) {
|
||||
try {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(resultData.get(i));
|
||||
|
||||
if (kind == DATA_ABC) {
|
||||
result.add(new ABCSearchResult(swf, bais));
|
||||
}
|
||||
if (kind == DATA_ACTION) {
|
||||
result.add(new ActionSearchResult(swf, bais));
|
||||
}
|
||||
} catch (ScriptNotFoundException | IOException ex) {
|
||||
ex.printStackTrace();
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
unpackedData.put(j, result);
|
||||
}
|
||||
} catch (IOException | ClassNotFoundException ex) {
|
||||
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
unpackedData.put(index, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -172,7 +199,15 @@ public class SearchResultsStorage {
|
||||
searchedValues = (List<String>) ois.readObject();
|
||||
isIgnoreCase = (List<Boolean>) ois.readObject();
|
||||
isRegExp = (List<Boolean>) ois.readObject();
|
||||
data = (List<byte[]>) ois.readObject();
|
||||
groups = (List<Integer>) ois.readObject();
|
||||
data = readByteList(ois);
|
||||
int maxgroup = -1;
|
||||
for (int g : groups) {
|
||||
if (g > maxgroup) {
|
||||
maxgroup = g;
|
||||
}
|
||||
}
|
||||
currentGroupId = maxgroup + 1;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -189,7 +224,8 @@ public class SearchResultsStorage {
|
||||
oos.writeObject(searchedValues);
|
||||
oos.writeObject(isIgnoreCase);
|
||||
oos.writeObject(isRegExp);
|
||||
oos.writeObject(data);
|
||||
oos.writeObject(groups);
|
||||
writeByteList(oos, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,8 +234,10 @@ public class SearchResultsStorage {
|
||||
searchedValues.add(searchedString);
|
||||
isIgnoreCase.add(ignoreCase);
|
||||
isRegExp.add(regExp);
|
||||
groups.add(currentGroupId);
|
||||
unpackedData.put(data.size(), new ArrayList<>(results));
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
baos.write(DATA_ABC);
|
||||
try {
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
List<byte[]> resultData = new ArrayList<>();
|
||||
@@ -208,7 +246,7 @@ public class SearchResultsStorage {
|
||||
res.save(resultBaos);
|
||||
resultData.add(resultBaos.toByteArray());
|
||||
}
|
||||
oos.writeObject(resultData);
|
||||
writeByteList(oos, resultData);
|
||||
oos.flush();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
@@ -223,8 +261,10 @@ public class SearchResultsStorage {
|
||||
searchedValues.add(searchedString);
|
||||
isIgnoreCase.add(ignoreCase);
|
||||
isRegExp.add(regExp);
|
||||
groups.add(currentGroupId);
|
||||
unpackedData.put(data.size(), new ArrayList<>(results));
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
baos.write(DATA_ACTION);
|
||||
try {
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
List<byte[]> resultData = new ArrayList<>();
|
||||
@@ -233,7 +273,7 @@ public class SearchResultsStorage {
|
||||
res.save(resultBaos);
|
||||
resultData.add(resultBaos.toByteArray());
|
||||
}
|
||||
oos.writeObject(resultData);
|
||||
writeByteList(oos, resultData);
|
||||
oos.flush();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
@@ -246,6 +286,28 @@ public class SearchResultsStorage {
|
||||
searchedValues.clear();
|
||||
isIgnoreCase.clear();
|
||||
isRegExp.clear();
|
||||
groups.clear();
|
||||
data.clear();
|
||||
unpackedData.clear();
|
||||
}
|
||||
|
||||
private static void writeByteList(ObjectOutputStream os, List<byte[]> data) throws IOException {
|
||||
os.writeInt(data.size());
|
||||
for (byte[] d : data) {
|
||||
os.writeInt(d.length);
|
||||
os.write(d);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<byte[]> readByteList(ObjectInputStream ois) throws IOException {
|
||||
List<byte[]> ret = new ArrayList<>();
|
||||
int cnt = ois.readInt();
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
int len = ois.readInt();
|
||||
byte buf[] = new byte[len];
|
||||
ois.readFully(buf);
|
||||
ret.add(buf);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,4 +506,7 @@ config.name.checkForModifications = Check for file modifications outside FFDec
|
||||
config.description.checkForModifications = Check for modifications of files by other applications and ask to reload
|
||||
|
||||
config.name.warning.initializers = Warn on AS3 slot/const editation about initializers
|
||||
config.description.warning.initializers = Show warning on AS3 slot/const editation about initializers
|
||||
config.description.warning.initializers = Show warning on AS3 slot/const editation about initializers
|
||||
|
||||
config.name.parametersPanelInSearchResults = Show parameters panel in search results
|
||||
config.description.parametersPanelInSearchResults = Show panel with parameters like search text / ignore case / regexp in search results window
|
||||
|
||||
@@ -32,7 +32,7 @@ checkbox.searchPCode = Search in P-Code
|
||||
|
||||
label.scope = Scope:
|
||||
|
||||
scope.currentFile = Current file
|
||||
scope.currentFile = Current SWF
|
||||
scope.selection = Selection (%selection%)
|
||||
scope.allFiles = All opened files
|
||||
scope.selection.nodes = %count% nodes
|
||||
scope.allFiles = All opened SWFs
|
||||
scope.selection.items = %count% items
|
||||
@@ -28,3 +28,11 @@ error.invalidregexp = Neplatn\u00fd regul\u00e1rn\u00ed v\u00fdraz
|
||||
checkbox.searchText = Hledat v textech
|
||||
checkbox.searchAS = Hledat v AS
|
||||
checkbox.replaceInParameters = Nahradit v parametrech
|
||||
checkbox.searchPCode = Search v P-k\u00f3du
|
||||
|
||||
label.scope = Rozsah:
|
||||
|
||||
scope.currentFile = Aktu\u00e1ln\u00ed SWF
|
||||
scope.selection = V\u00fdb\u011br (%selection%)
|
||||
scope.allFiles = V\u0161echny otev\u0159en\u00e9 SWF
|
||||
scope.selection.items = %count% polo\u017eek
|
||||
@@ -831,7 +831,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
|
||||
private void textSearchActionPerformed(ActionEvent evt) {
|
||||
Main.getMainFrame().getPanel().searchInActionScriptOrText(null, Main.getMainFrame().getPanel().getCurrentSwf());
|
||||
Main.getMainFrame().getPanel().searchInActionScriptOrText(null, Main.getMainFrame().getPanel().getCurrentSwf(), true);
|
||||
}
|
||||
|
||||
private void addAs3ClassActionPerformed(ActionEvent evt) {
|
||||
|
||||
Reference in New Issue
Block a user