diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 5c60ee4fb..a0bd68608 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -681,6 +681,10 @@ public final class Configuration { @ConfigurationCategory("script") public static ConfigurationItem warningInitializers = null; + @ConfigurationDefaultBoolean(true) + @ConfigurationCategory("ui") + public static ConfigurationItem parametersPanelInSearchResults = null; + private enum OSId { WINDOWS, OSX, UNIX } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ABCSearchResult.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ABCSearchResult.java index f0b194c1e..847dc3c7d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ABCSearchResult.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ABCSearchResult.java @@ -102,6 +102,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult { oos.writeInt(classIndex); oos.writeInt(traitId); oos.flush(); + oos.close(); } public ABCSearchResult(ScriptPack scriptPack) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ActionSearchResult.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ActionSearchResult.java index 5ec8cfb6f..ebb7e6f8a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ActionSearchResult.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/search/ActionSearchResult.java @@ -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) { diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index e88dd1b92..df99cd5e4 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -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<>()); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index 6380c9700..bd3ffd8c3 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -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<>()); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 7eff736a2..52d88c26b 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -1774,10 +1774,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } } - public void searchInActionScriptOrText(Boolean searchInText, SWF swf) { - View.checkAccess(); + public Set getAllSwfs() { + List allSwfs = new ArrayList<>(); + for (SWFList slist : getSwfs()) { + for (SWF s : slist.swfs) { + allSwfs.add(s); + populateSwfs(s, allSwfs); + } + } + return new LinkedHashSet<>(allSwfs); + } - List allItems = tagTree.getAllSelected(); + public void searchInActionScriptOrText(Boolean searchInText, SWF swf, boolean useSelection) { + View.checkAccess(); Map> scopeAs3 = new LinkedHashMap<>(); Map> swfToAllASMSourceMap = new HashMap<>(); @@ -1785,6 +1794,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se Set swfsUsed = new LinkedHashSet<>(); + List 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 allSwfs = new ArrayList<>(); - for (SWFList slist : getSwfs()) { - for (SWF s : slist.swfs) { - allSwfs.add(s); - populateSwfs(s, allSwfs); - } - } + Set 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 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 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() { @@ -1988,18 +1998,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } public void replaceText() { - - List 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()) { diff --git a/src/com/jpexs/decompiler/flash/gui/SearchDialog.java b/src/com/jpexs/decompiler/flash/gui/SearchDialog.java index 9f24a6fd2..236aaf52e 100644 --- a/src/com/jpexs/decompiler/flash/gui/SearchDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SearchDialog.java @@ -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()); diff --git a/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java b/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java index a3e6cb461..f5cb1f229 100644 --- a/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java @@ -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 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 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); diff --git a/src/com/jpexs/decompiler/flash/gui/SearchResultsStorage.java b/src/com/jpexs/decompiler/flash/gui/SearchResultsStorage.java index a613d0a9d..cc8490512 100644 --- a/src/com/jpexs/decompiler/flash/gui/SearchResultsStorage.java +++ b/src/com/jpexs/decompiler/flash/gui/SearchResultsStorage.java @@ -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 isRegExp = new ArrayList<>(); List isIgnoreCase = new ArrayList<>(); List data = new ArrayList<>(); - Map unpackedData = new HashMap<>(); + Map> unpackedData = new HashMap<>(); + List 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 getIndicesForSwf(SWF swf) { String swfId = getSwfId(swf); List res = new ArrayList<>(); + Set 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 getAbcSearchResultsAt(SWF swf, int index) { + public List getSearchResultsAt(Set allSwfs, int index) { if (unpackedData.containsKey(index)) { - return (List) unpackedData.get(index); + return unpackedData.get(index); } - List result = new ArrayList<>(); - byte[] itemData = data.get(index); + List result = new ArrayList<>(); - try { - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(itemData)); - List resultData = (List) 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 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 getActionSearchResultsAt(SWF swf, int index) { - if (unpackedData.containsKey(index)) { - return (List) unpackedData.get(index); - } - List result = new ArrayList<>(); - byte[] itemData = data.get(index); - - try { - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(itemData)); - List resultData = (List) 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 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) ois.readObject(); isIgnoreCase = (List) ois.readObject(); isRegExp = (List) ois.readObject(); - data = (List) ois.readObject(); + groups = (List) 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 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 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 data) throws IOException { + os.writeInt(data.size()); + for (byte[] d : data) { + os.writeInt(d.length); + os.write(d); + } + } + + private static List readByteList(ObjectInputStream ois) throws IOException { + List 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; + } } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index c5cb5e8ef..067bddc04 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -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 \ No newline at end of file +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 diff --git a/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog.properties index 755fbd846..72458541f 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog.properties @@ -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 \ No newline at end of file +scope.allFiles = All opened SWFs +scope.selection.items = %count% items \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog_cs.properties index 8052967dc..dde7c5eb5 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/SearchDialog_cs.properties @@ -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 \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index efcd28bad..b34b49526 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -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) {