From 2167801c1f67a5f3ab56612feff9883db20db6e0 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sun, 24 May 2015 21:15:42 +0200 Subject: [PATCH] method for getting the dependent chatacter ids + translation --- .../com/jpexs/decompiler/flash/tags/Tag.java | 32 ++++++++++++++++++- .../flash/gui/locales/MainFrame.properties | 2 ++ .../flash/gui/locales/MainFrame_hu.properties | 9 ++++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java index 6e8c81b1a..7012a5aad 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; +import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Exportable; import com.jpexs.decompiler.flash.tags.base.NeedsCharacters; import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont; @@ -524,6 +525,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable { originalRange = new ByteArrayRange(tagData); } + @Override public boolean isModified() { return modified; } @@ -548,7 +550,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable { getNeededCharacters(needed2); while (visited.size() != needed2.size()) { - for (Integer characterId : needed2) { + for (int characterId : needed2) { if (!visited.contains(characterId)) { visited.add(characterId); if (swf.getCharacters().containsKey(characterId)) { @@ -566,6 +568,21 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable { } } + public void getDependentCharacters(Set dependent) { + for (Tag tag : swf.tags) { + if (tag instanceof CharacterTag) { + Set needed = new HashSet<>(); + tag.getNeededCharactersDeep(needed); + for (int dep : dependent) { + if (needed.contains(dep)) { + dependent.add(((CharacterTag) tag).getCharacterId()); + break; + } + } + } + } + } + public void getTagInfo(TagInfo tagInfo) { tagInfo.addInfo("general", "tagType", String.format("%s (%d)", tagName, id)); @@ -597,5 +614,18 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable { if (needed.size() > 0) { tagInfo.addInfo("general", "neededCharacters", Helper.joinStrings(needed, ", ")); } + + /* todo: add dependent characters, getDependentCharacters method is currently slow + if (this instanceof CharacterTag) { + Set dependent = new LinkedHashSet<>(); + int characterId = ((CharacterTag) this).getCharacterId(); + dependent.add(characterId); + getDependentCharacters(dependent); + dependent.remove(characterId); + + if (dependent.size() > 0) { + tagInfo.addInfo("general", "dependentCharacters", Helper.joinStrings(dependent, ", ")); + } + }*/ } } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index cc0fe2d6a..4378efe79 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -603,3 +603,5 @@ tagInfo.neededCharacters = Needed Characters button.viewhexpcode = View Hex with instructions taginfo.header = Basic tag info + +tagInfo.dependentCharacters = Dependent Characters diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 71a6b8c80..58f7d5e59 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -507,7 +507,7 @@ binarydata.swfInside = \u00dagy n\u00e9z ki, hogy egy SWF van ebben a bin\u00e1r #after version 3.0.0 button.zoomin.hint = Nagy\u00edt\u00e1s -button.zoomout.hint = Kicsiny\u00edt\u00e1s +button.zoomout.hint = Kicsiny\u00edt\u00e9s button.zoomfit.hint = Kit\u00f6lt\u00e9s button.zoomnone.hint = Eredeti m\u00e9ret button.snapshot.hint = Pillanatk\u00e9p k\u00e9sz\u00edt\u00e9se a v\u00e1g\u00f3lapra @@ -598,4 +598,9 @@ tagInfo.length = Hossz tagInfo.bounds = Hat\u00e1rok tagInfo.width = Sz\u00e9less\u00e9g tagInfo.height = Magass\u00e1g -tagInfo.neededCharacters = Sz\u00fcks\u00e9ges karakterek \ No newline at end of file +tagInfo.neededCharacters = Sz\u00fcks\u00e9ges karakterek + +button.viewhexpcode = Hexa mutat\u00e1sa utas\u00edt\u00e1sokkal +taginfo.header = Alap tag info + +tagInfo.dependentCharacters = F\u00fcgg\u0151 karakterek