diff --git a/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java b/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java
index df11b0cfb..e11dabe95 100644
--- a/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java
@@ -1,28 +1,45 @@
/*
* Copyright (C) 2010-2014 JPEXS
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.jpexs.decompiler.flash.gui;
+import com.jpexs.decompiler.flash.SWF;
+import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.hexview.HexView;
+import com.jpexs.decompiler.flash.gui.treenodes.SWFNode;
+import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
+import com.jpexs.decompiler.flash.tags.Tag;
+import com.jpexs.decompiler.flash.treenodes.TagNode;
+import com.jpexs.helpers.utf8.Utf8Helper;
import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
import java.awt.FlowLayout;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import javax.swing.BorderFactory;
+import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.border.BevelBorder;
/**
*
@@ -32,9 +49,13 @@ public final class BinaryPanel extends JPanel implements ComponentListener {
public HexView hexEditor = new HexView();
private byte[] data;
+ private JPanel swfInsidePanel;
+ private TagNode node = null;
+ private MainPanel mainPanel;
- public BinaryPanel() {
+ public BinaryPanel(final MainPanel mainPanel) {
super(new BorderLayout());
+ this.mainPanel = mainPanel;
add(new JScrollPane(hexEditor), BorderLayout.CENTER);
@@ -43,16 +64,57 @@ public final class BinaryPanel extends JPanel implements ComponentListener {
bottomPanel.add(buttonsPanel, BorderLayout.EAST);
add(bottomPanel, BorderLayout.SOUTH);
addComponentListener(this);
+ swfInsidePanel = new JPanel();
+ swfInsidePanel.setBackground(new Color(253,205,137));
+ swfInsidePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ swfInsidePanel.add(new JLabel(AppStrings.translate("binarydata.swfInside")));
+ swfInsidePanel.setFocusable(true);
+ swfInsidePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
+ swfInsidePanel.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ mainPanel.loadFromBinaryTag(node);
+ swfInsidePanel.setVisible(false);
+ }
+
+ });
+ add(swfInsidePanel, BorderLayout.NORTH);
+ swfInsidePanel.setVisible(false);
}
- public void setBinaryData(byte[] data) {
+ public void setBinaryData(byte[] data, TagNode node) {
+ this.node = node;
this.data = data;
if (data != null) {
- int widthInChars = getWidth() / 7 - 3 - 11; // -3: scrollbar, -11: address in hex format
- //int blockCount = widthInChars / 34;
hexEditor.setData(data, null, null);
+
+ if (node != null) {
+ if(node.subNodes.isEmpty() && data.length>8){
+ try {
+ String signature = new String(data, 0, 3, Utf8Helper.charset);
+ if (Arrays.asList(
+ "FWS", //Uncompressed Flash
+ "CWS", //ZLib compressed Flash
+ "ZWS", //LZMA compressed Flash
+ "GFX", //Uncompressed ScaleForm GFx
+ "CFX" //Compressed ScaleForm GFx
+ ).contains(signature)) {
+ swfInsidePanel.setVisible(true);
+ }
+ } catch (Exception ex) {
+ swfInsidePanel.setVisible(false);
+ }
+ }else{
+ swfInsidePanel.setVisible(false);
+ }
+ } else {
+ swfInsidePanel.setVisible(false);
+ }
+
} else {
hexEditor.setData(new byte[0], null, null);
+ swfInsidePanel.setVisible(false);
}
hexEditor.revalidate();
hexEditor.repaint();
@@ -60,7 +122,7 @@ public final class BinaryPanel extends JPanel implements ComponentListener {
@Override
public void componentResized(ComponentEvent e) {
- setBinaryData(data);
+ setBinaryData(data, node);
}
@Override
diff --git a/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java b/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java
index 0827d6ae0..3648c331c 100644
--- a/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java
+++ b/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java
@@ -1,111 +1,113 @@
-/*
- * Copyright (C) 2010-2014 JPEXS
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import com.jpexs.decompiler.flash.ApplicationInfo;
-import java.awt.BorderLayout;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.image.ImageObserver;
-import javax.swing.BorderFactory;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JProgressBar;
-import javax.swing.SwingConstants;
-
-/**
- * Dialog showing loading of SWF file
- *
- * @author JPEXS
- */
-public class LoadingDialog extends AppDialog implements ImageObserver {
-
- private final JLabel detailLabel;
- private LoadingPanel loadingPanel;
- JProgressBar progressBar = new JProgressBar(0, 100);
-
- public void setDetail(String d) {
- detailLabel.setText(d);
- detailLabel.setHorizontalAlignment(SwingConstants.CENTER);
- }
-
- public void setPercent(final int percent) {
- View.execInEventDispatch(new Runnable() {
- @Override
- public void run() {
- progressBar.setIndeterminate(false);
- progressBar.setValue(percent);
- progressBar.setStringPainted(true);
- }
- });
- }
-
- public void hidePercent() {
- progressBar.setIndeterminate(true);
- progressBar.setStringPainted(false);
- }
-
- /**
- * Constructor
- */
- public LoadingDialog() {
- setResizable(false);
- setTitle(ApplicationInfo.shortApplicationVerName);
- Container cntp = getContentPane();
- JPanel cnt = new JPanel();
- cntp.setLayout(new BorderLayout());
- cntp.add(cnt);
- cnt.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- cnt.setLayout(new BorderLayout());
-
- //loadingPanel = new LoadingPanel(50, 50);
- //loadingPanel.setPreferredSize(new Dimension(100, 100));
- //add(loadingPanel, BorderLayout.WEST);
- JPanel pan = new JPanel();
- pan.setLayout(new ListLayout(5));
- //pan.setPreferredSize(new Dimension(120, 150));
- JLabel loadingLabel = new JLabel(translate("loadingpleasewait"));
- //loadingLabel.setBounds(0, 30, 150, 20);
- loadingLabel.setHorizontalAlignment(SwingConstants.CENTER);
- detailLabel = new JLabel("", JLabel.CENTER);
- detailLabel.setPreferredSize(new Dimension(loadingLabel.getPreferredSize()));
- detailLabel.setHorizontalAlignment(SwingConstants.CENTER);
- //detailLabel.setBounds(0, 45, 150, 20);
- //progressBar.setBounds(0, 70, 125, 25);
- pan.add(loadingLabel);
- pan.add(detailLabel);
- pan.add(progressBar);
- cnt.add(pan, BorderLayout.CENTER);
- //progressBar.setVisible(false);
- progressBar.setStringPainted(true);
- //progressBar.setVisible(false);
- View.setWindowIcon(this);
- detailLabel.setHorizontalAlignment(SwingConstants.LEFT);
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- });
- pack();
- Dimension siz = getSize();
- setSize(Math.max(300, 150 + getFontMetrics(new JLabel().getFont()).stringWidth(translate("loadingpleasewait"))), siz.height);
- View.centerScreen(this);
- }
-}
+/*
+ * Copyright (C) 2010-2014 JPEXS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.jpexs.decompiler.flash.gui;
+
+import com.jpexs.decompiler.flash.ApplicationInfo;
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Window;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.ImageObserver;
+import javax.swing.BorderFactory;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.SwingConstants;
+
+/**
+ * Dialog showing loading of SWF file
+ *
+ * @author JPEXS
+ */
+public class LoadingDialog extends AppDialog implements ImageObserver {
+
+ private final JLabel detailLabel;
+ private LoadingPanel loadingPanel;
+ JProgressBar progressBar = new JProgressBar(0, 100);
+
+ public void setDetail(String d) {
+ detailLabel.setText(d);
+ detailLabel.setHorizontalAlignment(SwingConstants.CENTER);
+ }
+
+ public void setPercent(final int percent) {
+ View.execInEventDispatch(new Runnable() {
+ @Override
+ public void run() {
+ progressBar.setIndeterminate(false);
+ progressBar.setValue(percent);
+ progressBar.setStringPainted(true);
+ }
+ });
+ }
+
+ public void hidePercent() {
+ progressBar.setIndeterminate(true);
+ progressBar.setStringPainted(false);
+ }
+
+ /**
+ * Constructor
+ */
+ public LoadingDialog(Window owner) {
+ super(owner);
+ setResizable(false);
+ setTitle(ApplicationInfo.shortApplicationVerName);
+ Container cntp = getContentPane();
+ JPanel cnt = new JPanel();
+ cntp.setLayout(new BorderLayout());
+ cntp.add(cnt);
+ cnt.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ cnt.setLayout(new BorderLayout());
+
+ //loadingPanel = new LoadingPanel(50, 50);
+ //loadingPanel.setPreferredSize(new Dimension(100, 100));
+ //add(loadingPanel, BorderLayout.WEST);
+ JPanel pan = new JPanel();
+ pan.setLayout(new ListLayout(5));
+ //pan.setPreferredSize(new Dimension(120, 150));
+ JLabel loadingLabel = new JLabel(translate("loadingpleasewait"));
+ //loadingLabel.setBounds(0, 30, 150, 20);
+ loadingLabel.setHorizontalAlignment(SwingConstants.CENTER);
+ detailLabel = new JLabel("", JLabel.CENTER);
+ detailLabel.setPreferredSize(new Dimension(loadingLabel.getPreferredSize()));
+ detailLabel.setHorizontalAlignment(SwingConstants.CENTER);
+ //detailLabel.setBounds(0, 45, 150, 20);
+ //progressBar.setBounds(0, 70, 125, 25);
+ pan.add(loadingLabel);
+ pan.add(detailLabel);
+ pan.add(progressBar);
+ cnt.add(pan, BorderLayout.CENTER);
+ //progressBar.setVisible(false);
+ progressBar.setStringPainted(true);
+ //progressBar.setVisible(false);
+ View.setWindowIcon(this);
+ detailLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ pack();
+ Dimension siz = getSize();
+ setSize(Math.max(300, 150 + getFontMetrics(new JLabel().getFont()).stringWidth(translate("loadingpleasewait"))), siz.height);
+ View.centerScreen(this);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java
index 01bee8695..fe6f39d69 100644
--- a/src/com/jpexs/decompiler/flash/gui/Main.java
+++ b/src/com/jpexs/decompiler/flash/gui/Main.java
@@ -78,6 +78,7 @@ import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
@@ -183,7 +184,7 @@ public class Main {
}
public static void startWork(final String name, final int percent, final CancellableWorker worker) {
- working = true;
+ working = true;
View.execInEventDispatchLater(new Runnable() {
@Override
public void run() {
@@ -507,8 +508,8 @@ public class Main {
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
- if (Main.loadingDialog == null) {
- Main.loadingDialog = new LoadingDialog();
+ if (Main.loadingDialog == null || Main.loadingDialog.getOwner() == null) {
+ Main.loadingDialog = new LoadingDialog(mainFrame==null?null:mainFrame.getWindow());
}
}
});
diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java
index 02f1d1ff1..e2a1c1dbc 100644
--- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java
@@ -134,6 +134,7 @@ import com.jpexs.decompiler.flash.xfl.FLAVersion;
import com.jpexs.helpers.CancellableWorker;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.Path;
+import com.jpexs.helpers.ProgressListener;
import com.jpexs.helpers.SerializableImage;
import java.awt.BorderLayout;
import java.awt.CardLayout;
@@ -163,6 +164,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
@@ -647,13 +649,13 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
return abcPanel;
}
- private void ensureActionPanel(){
+ private void ensureActionPanel() {
if (actionPanel == null) {
actionPanel = new ActionPanel(this);
displayPanel.add(actionPanel, CARDACTIONSCRIPTPANEL);
}
}
-
+
private ActionPanel getActionPanel() {
ensureActionPanel();
return actionPanel;
@@ -2221,6 +2223,40 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
showCard(CARDDUMPVIEW);
}
+ public void loadFromBinaryTag(final TagNode node) {
+
+ if (Main.loadingDialog == null || Main.loadingDialog.getOwner() == null) {
+ Main.loadingDialog = new LoadingDialog(mainFrame==null?null:mainFrame.getWindow());
+ }
+ Main.loadingDialog.setVisible(true);
+ Main.startWork(AppStrings.translate("work.reading.swf") + "...");
+ new Thread(){
+
+ @Override
+ public void run() {
+ try {
+ SWF bswf = new SWF(new ByteArrayInputStream(((DefineBinaryDataTag)node.getItem()).binaryData),new ProgressListener() {
+
+ @Override
+ public void progress(int p) {
+ Main.loadingDialog.setPercent(p);
+ }
+ }, Configuration.parallelSpeedUp.get());
+ bswf.fileTitle = "(SWF Data)";
+ SWFNode snode = ((TagTreeModel) tagTree.getModel()).createSwfNode(bswf);
+ snode.binaryData = (DefineBinaryDataTag) node.getItem();
+ node.subNodes.add(snode);
+ } catch (IOException | InterruptedException ex) {
+ //ignore
+ }
+ Main.loadingDialog.setVisible(false);
+ Main.stopWork();
+ }
+
+ }.start();
+
+ }
+
public void reload(boolean forceReload) {
if (Configuration.dumpView.get()) {
dumpViewReload(forceReload);
@@ -2333,7 +2369,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
} else if (tagObj instanceof DefineBinaryDataTag) {
DefineBinaryDataTag binaryTag = (DefineBinaryDataTag) tagObj;
showCard(CARDPREVIEWPANEL);
- previewPanel.showBinaryPanel(binaryTag.binaryData);
+ previewPanel.showBinaryPanel(binaryTag.binaryData, (TagNode) treeNode);
} else if (tagObj instanceof ASMSource) {
ensureActionPanel();
showCard(CARDACTIONSCRIPTPANEL);
diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
index 735521ec4..202c39b65 100644
--- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
@@ -54,6 +54,7 @@ import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.treeitems.FrameNodeItem;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
+import com.jpexs.decompiler.flash.treenodes.TagNode;
import com.jpexs.decompiler.flash.types.GLYPHENTRY;
import com.jpexs.decompiler.flash.types.MATRIX;
import com.jpexs.decompiler.flash.types.RECT;
@@ -318,7 +319,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
private JPanel createBinaryCard() {
JPanel binaryCard = new JPanel(new BorderLayout());
- binaryPanel = new BinaryPanel();
+ binaryPanel = new BinaryPanel(mainPanel);
binaryCard.add(binaryPanel, BorderLayout.CENTER);
binaryCard.add(createBinaryButtonsPanel(), BorderLayout.SOUTH);
return binaryCard;
@@ -424,14 +425,14 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
public void clear() {
imagePanel.stop();
- binaryPanel.setBinaryData(null);
+ binaryPanel.setBinaryData(null,null);
genericTagPanel.clear();
fontPanel.clear();
}
- public void showBinaryPanel(byte[] data) {
+ public void showBinaryPanel(byte[] data,TagNode node) {
showCardLeft(BINARY_TAG_CARD);
- binaryPanel.setBinaryData(data);
+ binaryPanel.setBinaryData(data,node);
parametersPanel.setVisible(false);
}
diff --git a/src/com/jpexs/decompiler/flash/gui/TagTree.java b/src/com/jpexs/decompiler/flash/gui/TagTree.java
index 277c24424..e606f4521 100644
--- a/src/com/jpexs/decompiler/flash/gui/TagTree.java
+++ b/src/com/jpexs/decompiler/flash/gui/TagTree.java
@@ -66,8 +66,10 @@ import com.jpexs.decompiler.flash.treeitems.TreeElementItem;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.decompiler.flash.treenodes.ContainerNode;
import com.jpexs.decompiler.flash.treenodes.FrameNode;
+import com.jpexs.decompiler.flash.treenodes.TagNode;
import com.jpexs.decompiler.flash.treenodes.TreeNode;
import com.jpexs.helpers.Helper;
+import com.jpexs.helpers.utf8.Utf8Helper;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
@@ -77,6 +79,7 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JMenu;
@@ -104,6 +107,7 @@ public class TagTree extends JTree implements ActionListener {
private static final String ACTION_REMOVE_ITEM_WITH_DEPENDENCIES = "REMOVEITEMWITHDEPENDENCIES";
private static final String ACTION_CLOSE_SWF = "CLOSESWF";
private static final String ACTION_EXPAND_RECURSIVE = "EXPANDRECURSIVE";
+ private static final String ACTION_OPEN_SWFINSIDE = "OPENSWFINSIDE";
private final MainPanel mainPanel;
@@ -334,6 +338,11 @@ public class TagTree extends JTree implements ActionListener {
final JMenu moveTagMenu = new JMenu(mainPanel.translate("contextmenu.moveTag"));
contextPopupMenu.add(moveTagMenu);
+ final JMenuItem openSWFInsideTagMenuItem = new JMenuItem(mainPanel.translate("contextmenu.openswfinside"));
+ contextPopupMenu.add(openSWFInsideTagMenuItem);
+ openSWFInsideTagMenuItem.setActionCommand(ACTION_OPEN_SWFINSIDE);
+ openSWFInsideTagMenuItem.addActionListener(this);
+
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@@ -364,6 +373,7 @@ public class TagTree extends JTree implements ActionListener {
closeSelectionMenuItem.setVisible(false);
moveTagMenu.setVisible(false);
expandRecursiveMenuItem.setVisible(false);
+ openSWFInsideTagMenuItem.setVisible(false);
if (paths.length == 1) {
TreeNode treeNode = (TreeNode) paths[0].getLastPathComponent();
@@ -376,6 +386,19 @@ public class TagTree extends JTree implements ActionListener {
if (item instanceof DefineBinaryDataTag) {
replaceSelectionMenuItem.setVisible(true);
+ DefineBinaryDataTag bin = (DefineBinaryDataTag) item;
+ if (bin.binaryData.length > 8) {
+ String signature = new String(bin.binaryData, 0, 3, Utf8Helper.charset);
+ if (Arrays.asList(
+ "FWS", //Uncompressed Flash
+ "CWS", //ZLib compressed Flash
+ "ZWS", //LZMA compressed Flash
+ "GFX", //Uncompressed ScaleForm GFx
+ "CFX" //Compressed ScaleForm GFx
+ ).contains(signature)) {
+ openSWFInsideTagMenuItem.setVisible(true);
+ }
+ }
}
if (item instanceof DefineSoundTag) {
@@ -429,23 +452,32 @@ public class TagTree extends JTree implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
+ case ACTION_OPEN_SWFINSIDE:
+ Object itemo = getLastSelectedPathComponent();
+ if (itemo == null) {
+ return;
+ }
+ if (itemo instanceof TagNode) {
+ mainPanel.loadFromBinaryTag((TagNode) itemo);
+ }
+ break;
case ACTION_RAW_EDIT: {
- TreeItem item = getCurrentTreeItem();
- if (item == null) {
+ TreeItem itemr = getCurrentTreeItem();
+ if (itemr == null) {
return;
}
- mainPanel.showGenericTag((Tag) item);
+ mainPanel.showGenericTag((Tag) itemr);
}
break;
case ACTION_JUMP_TO_CHARACTER: {
- TreeItem item = getCurrentTreeItem();
- if (item == null || !(item instanceof CharacterIdTag)) {
+ TreeItem itemj = getCurrentTreeItem();
+ if (itemj == null || !(itemj instanceof CharacterIdTag)) {
return;
}
- CharacterIdTag characterIdTag = (CharacterIdTag) item;
- mainPanel.setTagTreeSelectedNode(item.getSwf().characters.get(characterIdTag.getCharacterId()));
+ CharacterIdTag characterIdTag = (CharacterIdTag) itemj;
+ mainPanel.setTagTreeSelectedNode(itemj.getSwf().characters.get(characterIdTag.getCharacterId()));
}
break;
case ACTION_EXPAND_RECURSIVE: {
diff --git a/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java
index de1449b1e..dfd0eb3e0 100644
--- a/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java
+++ b/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java
@@ -50,6 +50,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
@@ -92,7 +94,7 @@ public class TagTreeModel implements TreeModel {
}
}
- private SWFNode createSwfNode(SWF swf) {
+ public SWFNode createSwfNode(SWF swf) {
ClassesListTreeModel classTreeModel = new ClassesListTreeModel(swf);
SWFNode swfNode = new SWFNode(swf, swf.getShortFileName());
swfNode.list = createTagList(swf.tags, swf, swfNode, classTreeModel);
@@ -157,19 +159,7 @@ public class TagTreeModel implements TreeModel {
break;
case BINARY_DATA:
TagNode bt;
- binaryData.add(bt = new TagNode(t));
-
- DefineBinaryDataTag b = (DefineBinaryDataTag) t;
-
- try {
- SWF bswf = new SWF(new ByteArrayInputStream(b.binaryData), Configuration.parallelSpeedUp.get());
- bswf.fileTitle = "(SWF Data)";
- SWFNode snode = createSwfNode(bswf);
- snode.binaryData = b;
- bt.subNodes.add(snode);
- } catch (IOException | InterruptedException ex) {
- //ignore
- }
+ binaryData.add(bt = new TagNode(t));
break;
default:
if (!actionScriptTags.contains(t) && t.getId() != ShowFrameTag.ID && !ShowFrameTag.isNestedTagType(t.getId())) {
diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties
index 218406871..bbf178395 100644
--- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties
+++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties
@@ -498,3 +498,6 @@ contextmenu.parseInstructions = Parse AVM2 Instructions
menu.deobfuscation = AS1/2 Deobfuscation
menu.file.deobfuscation.old = Old style
menu.file.deobfuscation.new = New style
+
+contextmenu.openswfinside = Open SWF inside
+binarydata.swfInside = It looks like there is SWF inside this binary data tag. Click here to load it as subtree.
\ No newline at end of file
diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties
index 254e32f3c..977013b2f 100644
--- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties
+++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties
@@ -499,3 +499,6 @@ contextmenu.parseInstructions = Naparsovat AVM2 instrukce
menu.deobfuscation = AS1/2 Deobfuskace
menu.file.deobfuscation.old = Star\u00fd zp\u016fsob
menu.file.deobfuscation.new = Nov\u00fd zp\u016fsob
+
+contextmenu.openswfinside = Otev\u0159\u00edt SWF uvnit\u0159
+binarydata.swfInside = Vypad\u00e1 to, \u017ee uvnit\u0159 v tomto BinaryData tagu se nach\u00e1z\u00ed SWF soubor. Klikn\u011bte zde pro jeho na\u010dten\u00ed jako podstrom.
\ No newline at end of file