diff --git a/CHANGELOG.md b/CHANGELOG.md index c76474bf4..c3c405e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Quick search (Ctrl+F) for tag list view - [#1884] Memory search - show size and adress in hex, show only aligned to N bytes - AS3 - "internal" keyword support +- ProductInfo tag information display ### Fixed - [#1897] Close menu button without selecting specific item diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 8ebe4700d..88b91bc46 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -140,6 +140,7 @@ import com.jpexs.decompiler.flash.tags.JPEGTablesTag; import com.jpexs.decompiler.flash.tags.MetadataTag; import com.jpexs.decompiler.flash.tags.PlaceObject3Tag; import com.jpexs.decompiler.flash.tags.PlaceObjectTag; +import com.jpexs.decompiler.flash.tags.ProductInfoTag; import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.Tag; @@ -4619,6 +4620,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } else if (treeItem instanceof DefineBinaryDataTag) { DefineBinaryDataTag binaryTag = (DefineBinaryDataTag) treeItem; previewPanel.showBinaryPanel(binaryTag); + } else if (treeItem instanceof ProductInfoTag) { + ProductInfoTag productInfoTag = (ProductInfoTag) treeItem; + previewPanel.showProductInfoPanel(productInfoTag); } else if (treeItem instanceof UnknownTag) { UnknownTag unknownTag = (UnknownTag) treeItem; previewPanel.showUnknownPanel(unknownTag); @@ -4936,6 +4940,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } else if (treeItem instanceof PlaceObjectTypeTag) { showPreview(treeItem, previewPanel, getFrameForTreeItem(treeItem), null); showCard(CARDPREVIEWPANEL); + } else if (treeItem instanceof ProductInfoTag) { + showPreview(treeItem, previewPanel, -1, null); + showCard(CARDPREVIEWPANEL); } else if (treeItem instanceof Tag) { showGenericTag((Tag) treeItem); } else if (treeItem instanceof BUTTONRECORD) { diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 94e0856c2..a417a1fea 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.gui.player.MediaDisplay; import com.jpexs.decompiler.flash.gui.player.PlayerControls; import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag; import com.jpexs.decompiler.flash.tags.MetadataTag; +import com.jpexs.decompiler.flash.tags.ProductInfoTag; import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.UnknownTag; @@ -63,6 +64,12 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.StringReader; import java.io.StringWriter; +import java.math.BigInteger; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; @@ -91,6 +98,8 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel private static final String GENERIC_TAG_CARD = "GENERICTAG"; private static final String BINARY_TAG_CARD = "BINARYTAG"; + + private static final String PRODUCTINFO_TAG_CARD = "PRODUCTINFOTAG"; private static final String UNKNOWN_TAG_CARD = "UNKNOWNTAG"; @@ -201,6 +210,13 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel //used only for flash player private TreeItem currentItem; + + private JLabel productValueLabel = new JLabel(); + private JLabel editionValueLabel = new JLabel(); + private JLabel versionValueLabel = new JLabel(); + private JLabel buildValueLabel = new JLabel(); + private JLabel compileDateValueLabel = new JLabel(); + public void setReadOnly(boolean readOnly) { this.readOnly = readOnly; @@ -221,6 +237,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel viewerCards.add(createFlashPlayerPanel(flashPanel), FLASH_VIEWER_CARD); viewerCards.add(createImagesCard(), DRAW_PREVIEW_CARD); viewerCards.add(createBinaryCard(), BINARY_TAG_CARD); + viewerCards.add(createProductInfoCard(), PRODUCTINFO_TAG_CARD); viewerCards.add(createUnknownCard(), UNKNOWN_TAG_CARD); viewerCards.add(createMetadataCard(), METADATA_TAG_CARD); viewerCards.add(createGenericTagCard(), GENERIC_TAG_CARD); @@ -517,6 +534,63 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel binaryCard.add(createBinaryButtonsPanel(), BorderLayout.SOUTH); return binaryCard; } + + private JPanel createProductInfoCard() { + JPanel productInfoCard = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel tablePanel = new JPanel(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.HORIZONTAL; + JLabel productLabel = new JLabel(AppStrings.translate("productinfo.product")); + productLabel.setHorizontalAlignment(JLabel.RIGHT); + JLabel editionLabel = new JLabel(AppStrings.translate("productinfo.edition")); + editionLabel.setHorizontalAlignment(JLabel.RIGHT); + JLabel versionLabel = new JLabel(AppStrings.translate("productinfo.version")); + versionLabel.setHorizontalAlignment(JLabel.RIGHT); + JLabel buildLabel = new JLabel(AppStrings.translate("productinfo.build")); + buildLabel.setHorizontalAlignment(JLabel.RIGHT); + JLabel compileDateLabel = new JLabel(AppStrings.translate("productinfo.compileDate")); + compileDateLabel.setHorizontalAlignment(JLabel.RIGHT); + + c.insets = new Insets(3,3,3,3); + + c.weightx = 1; + c.weighty = 1; + + c.gridy = 0; + + c.gridx = 0; + tablePanel.add(productLabel, c); + c.gridx = 1; + tablePanel.add(productValueLabel, c); + + c.gridy++; + c.gridx = 0; + tablePanel.add(editionLabel, c); + c.gridx = 1; + tablePanel.add(editionValueLabel, c); + + c.gridy++; + c.gridx = 0; + tablePanel.add(versionLabel, c); + c.gridx = 1; + tablePanel.add(versionValueLabel, c); + + c.gridy++; + c.gridx = 0; + tablePanel.add(buildLabel, c); + c.gridx = 1; + tablePanel.add(buildValueLabel, c); + + c.gridy++; + c.gridx = 0; + tablePanel.add(compileDateLabel, c); + c.gridx = 1; + tablePanel.add(compileDateValueLabel, c); + + productInfoCard.add(tablePanel); + + return productInfoCard; + } private JPanel createUnknownCard() { JPanel unknownCard = new JPanel(new BorderLayout()); @@ -742,6 +816,51 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel binaryPanel.setBinaryData(binaryDataTag); parametersPanel.setVisible(false); } + + public void showProductInfoPanel(ProductInfoTag productInfoTag) { + showCardLeft(PRODUCTINFO_TAG_CARD); + if (productInfoTag.productID == 0L) { + productValueLabel.setText(AppStrings.translate("productinfo.product.unknown")); + } else if (productInfoTag.productID == 1L) { + productValueLabel.setText("Macromedia Flex for J2EE"); + } else if (productInfoTag.productID == 2L) { + productValueLabel.setText("Macromedia Flex for .NET"); + } else if (productInfoTag.productID == 3L) { + productValueLabel.setText("Apache/Adobe Flex"); + } else { + productValueLabel.setText("(" + productInfoTag.productID + ")"); + } + + if (productInfoTag.edition == 0L) { + editionValueLabel.setText("Developer Edition"); + } else if (productInfoTag.edition == 1L) { + editionValueLabel.setText("Full Commercial Edition"); + } else if (productInfoTag.edition == 2L) { + editionValueLabel.setText("Non Commercial Edition"); + } else if (productInfoTag.edition == 3L) { + editionValueLabel.setText("Educational Edition"); + } else if (productInfoTag.edition == 4L) { + editionValueLabel.setText("Not For Resale (NFR) Edition"); + } else if (productInfoTag.edition == 5L) { + editionValueLabel.setText("Trial Edition"); + } else if (productInfoTag.edition == 6L) { + editionValueLabel.setText(AppStrings.translate("productinfo.edition.none")); + } else { + editionValueLabel.setText("(" + productInfoTag.productID + ")"); + } + + versionValueLabel.setText("" + productInfoTag.majorVersion + "." + productInfoTag.minorVersion); + BigInteger buildBigInteger = new BigInteger("" + productInfoTag.buildHigh); + buildBigInteger = buildBigInteger.shiftLeft(32).add(new BigInteger("" + productInfoTag.buildLow)); + buildValueLabel.setText("" + buildBigInteger); + + long compilationDate = (productInfoTag.compilationDateHigh << 32) + productInfoTag.compilationDateLow; + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + + compileDateValueLabel.setText(df.format(new Date(compilationDate)) + " UTC"); + parametersPanel.setVisible(false); + } public void showUnknownPanel(UnknownTag unknownTag) { showCardLeft(UNKNOWN_TAG_CARD); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index df35c002c..9e39381ee 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -986,3 +986,12 @@ filter.abc = ActionScript 3 bytecode files (*.abc) contextmenu.exportAbc = Export ABC contextmenu.pin = Pin + +#after 17.0.4 +productinfo.product = Product: +productinfo.product.unknown = Unknown +productinfo.edition = Edition: +productinfo.edition.none = None +productinfo.version = Version: +productinfo.build = Build: +productinfo.compileDate = Compilation date: 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 bafa60249..b4134e3ee 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -971,3 +971,12 @@ filter.abc = ActionScript 3 bytecode soubory (*.abc) contextmenu.exportAbc = Exportovat ABC contextmenu.pin = P\u0159ipnout + +#after 17.0.4 +productinfo.product = Produkt: +productinfo.product.unknown = Nezn\u00e1m\u00fd +productinfo.edition = Edice: +productinfo.edition.none = \u017d\u00e1dn\u00e1 +productinfo.version = Verze: +productinfo.build = Sestaven\u00ed: +productinfo.compileDate = Datum kompilace: \ No newline at end of file