From 41e9e58c31986a3c58f4577063b36109eaa802c6 Mon Sep 17 00:00:00 2001 From: Honfika Date: Wed, 22 Jan 2014 17:29:16 +0100 Subject: [PATCH] format code --- .../cache/chrome/HttpResponseInfo.java | 1 - .../decompiler/flash/ApplicationInfo.java | 4 +- .../jpexs/decompiler/flash/BaseLocalData.java | 2 +- .../decompiler/flash/BinarySWFBundle.java | 13 +- .../flash/FinalProcessLocalData.java | 4 +- trunk/src/com/jpexs/decompiler/flash/SWC.java | 3 +- trunk/src/com/jpexs/decompiler/flash/SWF.java | 126 ++++--- .../com/jpexs/decompiler/flash/SWFBundle.java | 5 +- .../decompiler/flash/SWFInputStream.java | 3 +- .../com/jpexs/decompiler/flash/SWFSearch.java | 16 +- .../jpexs/decompiler/flash/SWFSourceInfo.java | 6 +- .../decompiler/flash/ZippedSWFBundle.java | 30 +- .../com/jpexs/decompiler/flash/abc/ABC.java | 11 +- .../decompiler/flash/abc/ABCInputStream.java | 1 - .../decompiler/flash/abc/AVM2LocalData.java | 8 +- .../decompiler/flash/abc/ScriptPack.java | 6 +- .../decompiler/flash/abc/avm2/AVM2Code.java | 16 +- .../flash/abc/avm2/AVM2Deobfuscation.java | 6 +- .../flash/abc/avm2/graph/AVM2Graph.java | 6 - .../abc/avm2/model/NewFunctionAVM2Item.java | 4 +- .../avm2/model/clauses/ForEachInAVM2Item.java | 4 +- .../abc/avm2/model/clauses/ForInAVM2Item.java | 4 +- .../flash/abc/avm2/parser/ASM3Parser.java | 2 - .../flash/abc/types/MethodBody.java | 4 +- .../flash/abc/types/traits/Trait.java | 1 - .../flash/abc/types/traits/TraitClass.java | 4 +- .../abc/usages/MethodMultinameUsage.java | 4 +- .../jpexs/decompiler/flash/action/Action.java | 14 +- .../flash/action/ActionDeobfuscation.java | 2 +- .../decompiler/flash/action/ActionGraph.java | 9 - .../flash/action/ActionListReader.java | 43 +-- .../flash/action/ActionLocalData.java | 2 +- .../action/model/CallMethodActionItem.java | 2 +- .../action/model/NewMethodActionItem.java | 2 +- .../action/model/StoreRegisterActionItem.java | 2 +- .../action/model/clauses/ClassActionItem.java | 1 - .../action/model/clauses/ForInActionItem.java | 4 +- .../parser/script/ActionScriptParser.java | 5 +- .../parser/script/ActionSourceGenerator.java | 4 - .../flash/action/swf4/ActionPush.java | 1 - .../flash/action/swf4/ActionSetVariable.java | 1 - .../action/swf5/ActionDefineFunction.java | 2 - .../action/swf7/ActionDefineFunction2.java | 1 - .../flash/action/swf7/ActionTry.java | 1 - .../flash/configuration/Configuration.java | 31 +- .../ConfigurationDefaultBoolean.java | 4 +- .../ConfigurationDefaultInt.java | 4 +- .../ConfigurationDefaultString.java | 4 +- .../ConfigurationDescription.java | 4 +- .../configuration/ConfigurationItem.java | 4 +- .../configuration/ConfigurationName.java | 4 +- .../console/CommandLineArgumentParser.java | 17 +- .../flash/console/ContextMenuTools.java | 14 +- .../decompiler/flash/gui/AboutDialog.java | 9 - .../flash/gui/AdvancedSettingsDialog.java | 34 +- .../decompiler/flash/gui/BinaryPanel.java | 4 +- .../flash/gui/EachRowRendererEditor.java | 3 +- .../decompiler/flash/gui/ErrorLogFrame.java | 12 +- .../decompiler/flash/gui/ErrorState.java | 1 + .../decompiler/flash/gui/FontEmbedDialog.java | 5 +- .../jpexs/decompiler/flash/gui/FontPanel.java | 10 +- .../flash/gui/FontPreviewDialog.java | 2 +- .../flash/gui/GuiAbortRetryIgnoreHandler.java | 2 +- .../decompiler/flash/gui/HeaderLabel.java | 1 - .../decompiler/flash/gui/ImagePanel.java | 2 +- .../decompiler/flash/gui/LicenseUpdater.java | 2 +- .../jpexs/decompiler/flash/gui/LinkLabel.java | 3 +- .../flash/gui/LoadFromCacheFrame.java | 2 - .../flash/gui/LoadFromMemoryFrame.java | 11 +- .../decompiler/flash/gui/LogFormatter.java | 3 +- .../com/jpexs/decompiler/flash/gui/Main.java | 70 ++-- .../jpexs/decompiler/flash/gui/MainFrame.java | 6 +- .../flash/gui/MainFrameClassic.java | 6 +- .../flash/gui/MainFrameClassicMenu.java | 91 +++-- .../decompiler/flash/gui/MainFrameMenu.java | 2 +- .../decompiler/flash/gui/MainFrameRibbon.java | 92 ++--- .../flash/gui/MainFrameRibbonMenu.java | 135 ++++---- .../flash/gui/MainFrameStatusPanel.java | 12 +- .../jpexs/decompiler/flash/gui/MainPanel.java | 270 +++++++-------- .../decompiler/flash/gui/MyProgressBarUI.java | 1 - .../gui/MyRibbonApplicationMenuButtonUI.java | 3 +- .../MyRibbonApplicationMenuPopupPanelUI.java | 101 +++--- .../decompiler/flash/gui/OpenFileResult.java | 2 +- .../flash/gui/RecentFilesButton.java | 4 +- .../jpexs/decompiler/flash/gui/SWFList.java | 1 - .../decompiler/flash/gui/SWFPreviwPanel.java | 1 - .../decompiler/flash/gui/SaveFileMode.java | 3 +- .../decompiler/flash/gui/SearchDialog.java | 6 +- .../decompiler/flash/gui/SearchListener.java | 1 - .../decompiler/flash/gui/SearchPanel.java | 20 +- .../flash/gui/SelectLanguageDialog.java | 5 +- .../decompiler/flash/gui/SwfInMemory.java | 5 +- .../jpexs/decompiler/flash/gui/TagTree.java | 2 +- .../decompiler/flash/gui/TagTreeModel.java | 8 +- .../com/jpexs/decompiler/flash/gui/View.java | 25 +- .../decompiler/flash/gui/abc/ABCPanel.java | 17 +- .../flash/gui/abc/ABCPanelSearchResult.java | 3 +- .../flash/gui/abc/ASMSourceEditorPane.java | 4 +- .../flash/gui/abc/ClassesListTreeModel.java | 8 +- .../flash/gui/abc/DecompiledEditorPane.java | 2 - .../flash/gui/abc/DeobfuscationDialog.java | 2 - .../flash/gui/abc/IconListRenderer.java | 8 +- .../flash/gui/abc/MethodCodePanel.java | 6 +- .../flash/gui/abc/NewTraitDialog.java | 3 - .../flash/gui/abc/RootABCContainerTag.java | 2 +- .../jpexs/decompiler/flash/gui/abc/Tree.java | 2 +- .../flash/gui/abc/UndoFixedEditorPane.java | 8 +- .../abc/tablemodels/DecimalTableModel.java | 42 +-- .../gui/abc/tablemodels/DoubleTableModel.java | 42 +-- .../gui/abc/tablemodels/IntTableModel.java | 42 +-- .../abc/tablemodels/MultinameTableModel.java | 42 +-- .../tablemodels/NamespaceSetTableModel.java | 42 +-- .../abc/tablemodels/NamespaceTableModel.java | 42 +-- .../gui/abc/tablemodels/StringTableModel.java | 42 +-- .../gui/abc/tablemodels/UIntTableModel.java | 42 +-- .../gui/abc/treenodes/AS3PackageNode.java | 2 +- .../gui/abc/treenodes/ClassesListNode.java | 2 +- .../gui/abc/treenodes/ScriptPackNode.java | 2 +- .../flash/gui/action/ActionPanel.java | 22 +- .../flash/gui/helpers/CheckResources.java | 11 +- .../flash/gui/player/FlashPlayerPanel.java | 16 +- .../flash/gui/proxy/ProxyFrame.java | 11 +- .../flash/gui/treenodes/SWFBundleNode.java | 3 +- .../flash/gui/treenodes/SWFContainerNode.java | 3 +- .../flash/gui/treenodes/StringNode.java | 2 +- .../flash/gui/treenodes/TagTreeRoot.java | 2 +- .../flash/helpers/FileTextWriter.java | 12 +- .../jpexs/decompiler/flash/helpers/Freed.java | 1 + .../helpers/GraphSourceItemPosition.java | 2 +- .../flash/helpers/GraphTextWriter.java | 34 +- .../decompiler/flash/helpers/HilightType.java | 4 +- .../flash/helpers/HilightedText.java | 2 +- .../flash/helpers/HilightedTextWriter.java | 44 +-- .../flash/helpers/LoopWithType.java | 4 +- .../decompiler/flash/helpers/NulWriter.java | 18 +- .../flash/helpers/hilight/Highlighting.java | 6 +- .../flash/tags/DefineEditTextTag.java | 314 +++++++++--------- .../decompiler/flash/tags/DefineFont2Tag.java | 2 - .../decompiler/flash/tags/DefineFont3Tag.java | 1 - .../decompiler/flash/tags/DefineText2Tag.java | 230 ++++++------- .../decompiler/flash/tags/DefineTextTag.java | 2 +- .../com/jpexs/decompiler/flash/tags/Tag.java | 246 +++++++------- .../decompiler/flash/tags/UnknownTag.java | 2 +- .../flash/tags/base/ContainerItem.java | 2 +- .../decompiler/flash/tags/base/FontTag.java | 12 +- .../flash/tags/gfx/DefineCompactedFont.java | 2 +- .../flash/treeitems/AS2PackageNodeItem.java | 2 +- .../flash/treeitems/AS3PackageNodeItem.java | 2 +- .../flash/treeitems/StringItem.java | 10 +- .../flash/treeitems/TreeElementItem.java | 2 +- .../decompiler/flash/treeitems/TreeItem.java | 2 +- .../flash/treenodes/AS2PackageNode.java | 2 +- .../flash/treenodes/ContainerNode.java | 2 +- .../decompiler/flash/treenodes/FrameNode.java | 2 +- .../decompiler/flash/treenodes/TreeNode.java | 4 +- .../flash/types/CLIPACTIONRECORD.java | 6 +- .../decompiler/flash/types/MORPHGRADIENT.java | 3 - .../flash/types/filters/BlendComposite.java | 4 +- .../flash/types/filters/Filtering.java | 10 - .../decompiler/flash/types/gfx/EdgeType.java | 2 - .../flash/types/shaperecords/SHAPERECORD.java | 15 +- .../decompiler/flash/xfl/XFLConverter.java | 13 +- .../jpexs/decompiler/graph/ExportMode.java | 16 +- .../src/com/jpexs/decompiler/graph/Graph.java | 24 +- .../com/jpexs/decompiler/graph/GraphPart.java | 2 +- .../com/jpexs/decompiler/graph/GraphPath.java | 1 - .../decompiler/graph/GraphTargetItem.java | 4 +- .../decompiler/graph/TranslateException.java | 2 +- .../decompiler/graph/model/BreakItem.java | 2 +- .../decompiler/graph/model/CommentItem.java | 2 +- .../decompiler/graph/model/ContinueItem.java | 2 +- .../decompiler/graph/model/DoWhileItem.java | 8 +- .../jpexs/decompiler/graph/model/ForItem.java | 4 +- .../decompiler/graph/model/LocalData.java | 2 +- .../decompiler/graph/model/SwitchItem.java | 4 +- .../decompiler/graph/model/UnaryOpItem.java | 2 +- .../graph/model/UniversalLoopItem.java | 4 +- .../decompiler/graph/model/WhileItem.java | 4 +- trunk/src/com/jpexs/helpers/Callback.java | 2 +- .../com/jpexs/helpers/CancellableWorker.java | 24 +- trunk/src/com/jpexs/helpers/Helper.java | 51 ++- .../com/jpexs/helpers/MemoryInputStream.java | 6 +- .../jpexs/helpers/ReReadableInputStream.java | 2 +- trunk/src/com/jpexs/helpers/Searchable.java | 11 +- trunk/src/com/jpexs/helpers/Stopwatch.java | 8 +- trunk/src/com/jpexs/helpers/StreamSearch.java | 7 +- .../com/jpexs/helpers/utf8/Utf8Helper.java | 4 +- .../helpers/utf8/Utf8InputStreamReader.java | 2 +- .../helpers/utf8/Utf8OutputStreamWriter.java | 2 +- .../jpexs/helpers/utf8/Utf8PrintWriter.java | 2 +- trunk/src/com/jpexs/process/Process.java | 8 +- .../com/jpexs/process/win32/Win32Process.java | 6 +- .../process/win32/Win32ProcessTools.java | 7 - .../src/com/sun/jna/platform/win32/Gdi32.java | 5 +- .../com/sun/jna/platform/win32/Kernel32.java | 9 +- .../jna/platform/win32/SHELLEXECUTEINFO.java | 2 +- .../com/sun/jna/platform/win32/User32.java | 2 +- .../com/sun/jna/platform/win32/WinBase.java | 24 +- .../com/sun/jna/platform/win32/WinGDI.java | 2 +- 199 files changed, 1479 insertions(+), 1742 deletions(-) diff --git a/trunk/src/com/jpexs/browsers/cache/chrome/HttpResponseInfo.java b/trunk/src/com/jpexs/browsers/cache/chrome/HttpResponseInfo.java index 1a12be1b2..8195a4fe2 100644 --- a/trunk/src/com/jpexs/browsers/cache/chrome/HttpResponseInfo.java +++ b/trunk/src/com/jpexs/browsers/cache/chrome/HttpResponseInfo.java @@ -103,6 +103,5 @@ public class HttpResponseInfo { } //TODO: Read SSL info - } } diff --git a/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java b/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java index 10314ba41..bac25812a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java @@ -24,7 +24,7 @@ import java.util.Properties; * @author JPEXS */ public class ApplicationInfo { - + public static final String APPLICATION_NAME = "JPEXS Free Flash Decompiler"; public static final String SHORT_APPLICATION_NAME = "FFDec"; public static final String VENDOR = "JPEXS"; @@ -40,7 +40,7 @@ public class ApplicationInfo { static { loadProperties(); } - + private static void loadProperties() { Properties prop = new Properties(); try { diff --git a/trunk/src/com/jpexs/decompiler/flash/BaseLocalData.java b/trunk/src/com/jpexs/decompiler/flash/BaseLocalData.java index 455f3b4f8..27abba1a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/BaseLocalData.java +++ b/trunk/src/com/jpexs/decompiler/flash/BaseLocalData.java @@ -21,5 +21,5 @@ package com.jpexs.decompiler.flash; * @author JPEXS */ public abstract class BaseLocalData { - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java b/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java index e71ddf489..2ea2d85d3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java +++ b/trunk/src/com/jpexs/decompiler/flash/BinarySWFBundle.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash; import com.jpexs.helpers.StreamSearch; @@ -31,8 +30,10 @@ import java.util.Set; * @author JPEXS */ public class BinarySWFBundle implements SWFBundle { + private final SWFSearch search; - public BinarySWFBundle(InputStream is){ + + public BinarySWFBundle(InputStream is) { search = new SWFSearch(new StreamSearch(is)); search.process(); } @@ -53,17 +54,17 @@ public class BinarySWFBundle implements SWFBundle { @Override public SeekableInputStream getSWF(String key) { - if(!key.startsWith("[")){ + if (!key.startsWith("[")) { return null; } - if(!key.endsWith("]")){ + if (!key.endsWith("]")) { return null; } key = key.substring(1, key.length() - 1); try { int address = Integer.parseInt(key); return search.get(null, address); - } catch(IOException | NumberFormatException iex){ + } catch (IOException | NumberFormatException iex) { return null; } } @@ -71,7 +72,7 @@ public class BinarySWFBundle implements SWFBundle { @Override public Map getAll() { Map ret = new HashMap<>(); - for(String key : getKeys()){ + for (String key : getKeys()) { ret.put(key, getSWF(key)); } return ret; diff --git a/trunk/src/com/jpexs/decompiler/flash/FinalProcessLocalData.java b/trunk/src/com/jpexs/decompiler/flash/FinalProcessLocalData.java index 97b5a0110..d5860b78b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/FinalProcessLocalData.java +++ b/trunk/src/com/jpexs/decompiler/flash/FinalProcessLocalData.java @@ -23,9 +23,9 @@ import java.util.HashSet; * @author JPEXS */ public class FinalProcessLocalData { - + public final HashSet temporaryRegisters; - + public FinalProcessLocalData() { temporaryRegisters = new HashSet<>(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWC.java b/trunk/src/com/jpexs/decompiler/flash/SWC.java index 17ed20ea1..04a327b7a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWC.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWC.java @@ -75,6 +75,5 @@ public class SWC extends ZippedSWFBundle { public String getExtension() { return "swc"; } - - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 592ec6940..67eacf61c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -226,7 +226,7 @@ public final class SWF implements TreeItem { public List abcList; public JPEGTablesTag jtt; public Map sourceFontsMap = new HashMap<>(); - + /** * Gets all tags with specified id * @@ -351,19 +351,19 @@ public final class SWF implements TreeItem { is.read(hdr); String shdr = new String(hdr, 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(shdr)) { + "FWS", //Uncompressed Flash + "CWS", //ZLib compressed Flash + "ZWS", //LZMA compressed Flash + "GFX", //Uncompressed ScaleForm GFx + "CFX" //Compressed ScaleForm GFx + ).contains(shdr)) { throw new IOException("Invalid SWF file"); } version = is.read(); SWFInputStream sis = new SWFInputStream(is, version, 4); fileSize = sis.readUI32(); - if(hdr[1] == 'F' && hdr[2] == 'X'){ + if (hdr[1] == 'F' && hdr[2] == 'X') { gfx = true; } if (hdr[0] == 'C') { @@ -400,7 +400,6 @@ public final class SWF implements TreeItem { lzma = true; } - if (listener != null) { sis.addPercentListener(listener); } @@ -421,7 +420,7 @@ public final class SWF implements TreeItem { } else { boolean hasNonUnknownTag = false; for (Tag tag : tags) { - if(tag.getData(version).length > 0 && Tag.getRequiredTags().contains(tag.getId())) { + if (tag.getData(version).length > 0 && Tag.getRequiredTags().contains(tag.getId())) { hasNonUnknownTag = true; } } @@ -435,7 +434,7 @@ public final class SWF implements TreeItem { public SWF getSwf() { return this; } - + /** * Get title of the file * @@ -547,56 +546,54 @@ public final class SWF implements TreeItem { fis.read(hdr); String shdr = new String(hdr, Utf8Helper.charset); switch (shdr) { - case "CWS": - { - int version = fis.read(); - SWFInputStream sis = new SWFInputStream(fis, version, 4); - long fileSize = sis.readUI32(); - SWFOutputStream sos = new SWFOutputStream(fos, version); + case "CWS": { + int version = fis.read(); + SWFInputStream sis = new SWFInputStream(fis, version, 4); + long fileSize = sis.readUI32(); + SWFOutputStream sos = new SWFOutputStream(fos, version); + sos.write(Utf8Helper.getBytes("FWS")); + sos.writeUI8(version); + sos.writeUI32(fileSize); + InflaterInputStream iis = new InflaterInputStream(fis); + int i; + try { + while ((i = iis.read()) != -1) { + fos.write(i); + } + } catch (EOFException ex) { + } + fis.close(); + fos.close(); + break; + } + case "ZWS": { + int version = fis.read(); + SWFInputStream sis = new SWFInputStream(fis, version, 4); + long fileSize = sis.readUI32(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + sis.readUI32(); + int propertiesSize = 5; + byte[] lzmaProperties = new byte[propertiesSize]; + if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) { + throw new IOException("LZMA:input .lzma file is too short"); + } + SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder(); + if (!decoder.SetDecoderProperties(lzmaProperties)) { + throw new IOException("LZMA:Incorrect stream properties"); + } + if (!decoder.Code(sis, baos, fileSize - 8)) { + throw new IOException("LZMA:Error in data stream"); + } + try (SWFOutputStream sos = new SWFOutputStream(fos, version)) { sos.write(Utf8Helper.getBytes("FWS")); - sos.writeUI8(version); + sos.write(version); sos.writeUI32(fileSize); - InflaterInputStream iis = new InflaterInputStream(fis); - int i; - try { - while ((i = iis.read()) != -1) { - fos.write(i); - } - } catch (EOFException ex) { - } - fis.close(); - fos.close(); - break; - } - case "ZWS": - { - int version = fis.read(); - SWFInputStream sis = new SWFInputStream(fis, version, 4); - long fileSize = sis.readUI32(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - sis.readUI32(); - int propertiesSize = 5; - byte[] lzmaProperties = new byte[propertiesSize]; - if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) { - throw new IOException("LZMA:input .lzma file is too short"); - } - SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder(); - if (!decoder.SetDecoderProperties(lzmaProperties)) { - throw new IOException("LZMA:Incorrect stream properties"); - } - if (!decoder.Code(sis, baos, fileSize - 8)) { - throw new IOException("LZMA:Error in data stream"); - } - try (SWFOutputStream sos = new SWFOutputStream(fos, version)) { - sos.write(Utf8Helper.getBytes("FWS")); - sos.write(version); - sos.writeUI32(fileSize); - sos.write(baos.toByteArray()); - } - fis.close(); - fos.close(); - break; + sos.write(baos.toByteArray()); } + fis.close(); + fos.close(); + break; + } default: return false; } @@ -620,7 +617,7 @@ public final class SWF implements TreeItem { } return true; } - + public boolean exportAS3Class(String className, String outdir, ExportMode exportMode, boolean parallel) throws Exception { List abcTags = new ArrayList<>(); @@ -801,7 +798,7 @@ public final class SWF implements TreeItem { } } } - + return ret; } @@ -1140,7 +1137,6 @@ public final class SWF implements TreeItem { writeLE(chunks, subChunk1DataBytes.length, 4); chunks.write(subChunk1DataBytes); - chunks.write(Utf8Helper.getBytes("data")); writeLE(chunks, pcmData.length, 4); chunks.write(pcmData); @@ -1173,7 +1169,6 @@ public final class SWF implements TreeItem { id = ((DefineSoundTag) t).soundId; } - if (t instanceof DefineSoundTag) { final DefineSoundTag st = (DefineSoundTag) t; @@ -1287,9 +1282,7 @@ public final class SWF implements TreeItem { return new byte[0]; } - //double ms = 1000.0f / ((float) frameRate); - ByteArrayOutputStream fos = new ByteArrayOutputStream(); //CopyOutputStream cos = new CopyOutputStream(fos, new FileInputStream("f:\\trunk\\testdata\\xfl\\xfl\\_obj\\streamvideo 7.flv")); OutputStream tos = fos; @@ -1877,7 +1870,6 @@ public final class SWF implements TreeItem { } } - List vars = new ArrayList<>(); for (MyEntry item : cti.vars) { vars.add(item.key); @@ -1905,7 +1897,6 @@ public final class SWF implements TreeItem { } } - if (name != null) { int pos = 0; while (name instanceof GetMemberActionItem) { @@ -2096,8 +2087,6 @@ public final class SWF implements TreeItem { ret.Ymin = rect.Ymin; ret.Ymax = rect.Ymax; - - if (ret.Xmax <= 0) { ret.Xmax = ret.getWidth(); ret.Xmin = 0; @@ -2299,7 +2288,6 @@ public final class SWF implements TreeItem { stopFrame -= totalFrameCount; } - HashMap characters = new HashMap<>(); for (Tag t : allTags) { if (t instanceof CharacterTag) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFBundle.java b/trunk/src/com/jpexs/decompiler/flash/SWFBundle.java index 5e0102e55..769dfae07 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFBundle.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFBundle.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash; import com.jpexs.helpers.streams.SeekableInputStream; @@ -29,8 +28,12 @@ import java.util.Set; public interface SWFBundle { public int length(); + public Set getKeys(); + public SeekableInputStream getSWF(String key) throws IOException; + public Map getAll() throws IOException; + public String getExtension(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 90c1523de..8d31eb678 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -175,8 +175,7 @@ public class SWFInputStream extends InputStream { if (is instanceof SeekableInputStream) { SeekableInputStream sis = (SeekableInputStream) is; sis.seek(pos); - } - else { + } else { throw new IOException("Underlying stream is not a SeekableInputStream"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java b/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java index 00f2e7db0..6f36cbccf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java @@ -63,12 +63,12 @@ public class SWFSearch { public void progress(int p) { setProgress(p); } - }, - "FWS".getBytes(), //Uncompressed Flash - "CWS".getBytes(), //ZLib compressed Flash - "ZWS".getBytes(), //LZMA compressed Flash - "GFX".getBytes(), //Uncompressed ScaleForm GFx - "CFX".getBytes()); //Compressed ScaleForm GFx + }, + "FWS".getBytes(), //Uncompressed Flash + "CWS".getBytes(), //ZLib compressed Flash + "ZWS".getBytes(), //LZMA compressed Flash + "GFX".getBytes(), //Uncompressed ScaleForm GFx + "CFX".getBytes()); //Compressed ScaleForm GFx int pos = 0; for (Long addr : ret.keySet()) { setProgress(pos * 100 / ret.size()); @@ -95,7 +95,7 @@ public class SWFSearch { } public MemoryInputStream get(ProgressListener listener, long address) throws IOException { - if(!processed){ + if (!processed) { return null; } if (!swfStreams.containsKey(address)) { @@ -107,7 +107,7 @@ public class SWFSearch { public Set getAddresses() { return swfStreams.keySet(); } - + public int length() { if (!processed) { return 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java b/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java index 699a32442..7eb513617 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFSourceInfo.java @@ -32,13 +32,13 @@ public class SWFSourceInfo { private final InputStream inputStream; private final String file; private final String fileTitle; - + public SWFSourceInfo(InputStream inputStream, String file, String fileTitle) { this.inputStream = inputStream; this.file = file; this.fileTitle = fileTitle; } - + public InputStream getInputStream() { return inputStream; } @@ -70,7 +70,7 @@ public class SWFSourceInfo { } return false; } - + public SWFBundle getBundle() throws IOException { if (!isBundle()) { return null; diff --git a/trunk/src/com/jpexs/decompiler/flash/ZippedSWFBundle.java b/trunk/src/com/jpexs/decompiler/flash/ZippedSWFBundle.java index c9ec0e669..f51f868f3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/ZippedSWFBundle.java +++ b/trunk/src/com/jpexs/decompiler/flash/ZippedSWFBundle.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash; import com.jpexs.helpers.Helper; @@ -37,20 +36,19 @@ import java.util.zip.ZipInputStream; * @author JPEXS */ public class ZippedSWFBundle implements SWFBundle { + protected Set keySet = new HashSet<>(); private final Map cachedSWFs = new HashMap<>(); protected ReReadableInputStream is; - - public ZippedSWFBundle(InputStream is){ + public ZippedSWFBundle(InputStream is) { this.is = new ReReadableInputStream(is); ZipInputStream zip = new ZipInputStream(this.is); ZipEntry entry; try { - while((entry = zip.getNextEntry()) != null) - { - if(entry.getName().toLowerCase().endsWith(".swf") - || entry.getName().toLowerCase().endsWith(".gfx")){ + while ((entry = zip.getNextEntry()) != null) { + if (entry.getName().toLowerCase().endsWith(".swf") + || entry.getName().toLowerCase().endsWith(".gfx")) { keySet.add(entry.getName()); } //streamMap.put(, is) @@ -59,7 +57,7 @@ public class ZippedSWFBundle implements SWFBundle { Logger.getLogger(ZippedSWFBundle.class.getName()).log(Level.SEVERE, null, ex); } } - + @Override public int length() { return keySet.size(); @@ -72,18 +70,17 @@ public class ZippedSWFBundle implements SWFBundle { @Override public SeekableInputStream getSWF(String key) throws IOException { - if(!keySet.contains(key)){ + if (!keySet.contains(key)) { return null; } - if(!cachedSWFs.containsKey(key)){ - + if (!cachedSWFs.containsKey(key)) { + this.is.reset(); ZipInputStream zip = new ZipInputStream(this.is); ZipEntry entry; try { - while((entry = zip.getNextEntry()) != null) - { - if(entry.getName().equals(key)){ + while ((entry = zip.getNextEntry()) != null) { + if (entry.getName().equals(key)) { MemoryInputStream mis = new MemoryInputStream(Helper.readStream(zip)); cachedSWFs.put(key, mis); break; @@ -93,15 +90,14 @@ public class ZippedSWFBundle implements SWFBundle { } catch (IOException ex) { Logger.getLogger(ZippedSWFBundle.class.getName()).log(Level.SEVERE, null, ex); } - - + } return cachedSWFs.get(key); } @Override public Map getAll() throws IOException { - for(String key : getKeys()){ //cache everything first + for (String key : getKeys()) { //cache everything first getSWF(key); } return cachedSWFs; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index d4a362341..ed41434b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -241,8 +241,8 @@ public class ABC { if (instance_info[i].name_index != 0) { constants.getMultiname(instance_info[i].name_index).name_index = deobfuscation.deobfuscateName(stringUsageTypes, stringUsages, namespaceUsages, namesMap, constants.getMultiname(instance_info[i].name_index).name_index, true, renameType); if (constants.getMultiname(instance_info[i].name_index).namespace_index != 0) { - constants.getNamespace(constants.getMultiname(instance_info[i].name_index).namespace_index).name_index = - deobfuscation.deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, constants.getNamespace(constants.getMultiname(instance_info[i].name_index).namespace_index).name_index, renameType); + constants.getNamespace(constants.getMultiname(instance_info[i].name_index).namespace_index).name_index + = deobfuscation.deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, constants.getNamespace(constants.getMultiname(instance_info[i].name_index).namespace_index).name_index, renameType); } } if (instance_info[i].super_index != 0) { @@ -344,7 +344,6 @@ public class ABC { constants.addDouble(ais.readDouble()); } - //constant decimal if (minor_version >= MINORwithDECIMAL) { int constant_decimal_pool_count = ais.readU30(); @@ -397,10 +396,6 @@ public class ABC { } } - - - - //constant multiname int constant_multiname_pool_count = ais.readU30(); constants.constant_multiname = new ArrayList<>(constant_multiname_pool_count); @@ -411,7 +406,6 @@ public class ABC { constants.addMultiname(ais.readMultiname()); } - //method info int methods_count = ais.readU30(); method_info = new MethodInfo[methods_count]; @@ -648,7 +642,6 @@ public class ABC { } } - return null; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index 36d4952c8..dad4f7b2f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -247,7 +247,6 @@ public class ABCInputStream extends InputStream { int flags = read(); //// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames - ValueKind[] optional = new ValueKind[0]; if ((flags & 8) == 8) { //if has_optional int optional_count = readU30(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java b/trunk/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java index 75c031105..298d3239c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java @@ -33,7 +33,7 @@ import java.util.Stack; * @author JPEXS */ public class AVM2LocalData extends BaseLocalData { - + public Boolean isStatic; public Integer classIndex; public HashMap localRegs; @@ -52,11 +52,11 @@ public class AVM2LocalData extends BaseLocalData { public Integer ip; public HashMap> refs; public AVM2Code code; - + public AVM2LocalData() { - + } - + public AVM2LocalData(AVM2LocalData localData) { isStatic = localData.isStatic; classIndex = localData.classIndex; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index d323c41c2..37807380f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -57,7 +57,7 @@ public class ScriptPack implements TreeElementItem { public SWF getSwf() { return abc.swf; } - + public ClassPath getPath() { return path; } @@ -134,7 +134,7 @@ public class ScriptPack implements TreeElementItem { } } } - + public void appendTo(GraphTextWriter writer, List abcList, Trait[] traits, ExportMode exportMode, boolean parallel) throws InterruptedException { for (int t : traitIndices) { Trait trait = traits[t]; @@ -173,7 +173,7 @@ public class ScriptPack implements TreeElementItem { appendTo(writer, abcList, traits, exportMode, parallel); } - + public File export(String directory, List abcList, ExportMode exportMode, boolean parallel) throws IOException { String scriptName = getPathScriptName(); String packageName = getPathPackage(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 52d42e2fe..b38f5b4b8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -867,7 +867,6 @@ public class AVM2Code implements Serializable { writer.appendNoHilight(body.max_scope_depth); writer.newLine(); - List offsets = new ArrayList<>(); for (int e = 0; e < body.exceptions.length; e++) { writer.appendNoHilight("try"); @@ -917,7 +916,7 @@ public class AVM2Code implements Serializable { int ip = 0; int largeLimit = 20000; boolean markOffsets = code.size() <= largeLimit; - + if (exportMode == ExportMode.HEX) { Helper.byteArrayToHexWithHeader(writer, getBytes()); } else { @@ -1430,7 +1429,6 @@ public class AVM2Code implements Serializable { int regCount = getRegisterCount(); //try { - list = AVM2Graph.translateViaGraph(path, this, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames, staticOperation, localRegAssigmentIps, refs); if (initTraits != null) { @@ -1554,7 +1552,6 @@ public class AVM2Code implements Serializable { } } - for (int i = 0; i < pos; i++) { if (code.get(i).definition instanceof LookupSwitchIns) { long target = code.get(i).offset + code.get(i).operands[0]; @@ -2242,7 +2239,6 @@ public class AVM2Code implements Serializable { getReachableIps(code, branches.get(i), r); } - int commonLevel; Map levelMap = new HashMap<>(); for (List first : reachable) { @@ -2481,8 +2477,6 @@ public class AVM2Code implements Serializable { }*/ } - - if (((AVM2Instruction) ins).definition instanceof NewFunctionIns) { stack.push(new BooleanAVM2Item(null, true)); } else { @@ -2490,7 +2484,6 @@ public class AVM2Code implements Serializable { ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, path); } - if (ins.definition instanceof SetLocalTypeIns) { SetLocalTypeIns slt = (SetLocalTypeIns) ins.definition; int regId = slt.getRegisterId(ins); @@ -2507,13 +2500,12 @@ public class AVM2Code implements Serializable { break; } - if (ins.isBranch() || ins.isJump()) { List branches = ins.getBranches(code); if (((AVM2Instruction) ins).definition instanceof IfTypeIns - && (!(((AVM2Instruction) ins).definition instanceof JumpIns)) - && (!stack.isEmpty()) - && (stack.peek().isCompileTime()) + && (!(((AVM2Instruction) ins).definition instanceof JumpIns)) + && (!stack.isEmpty()) + && (stack.peek().isCompileTime()) && (!stack.peek().hasSideEffect())) { boolean condition = EcmaScript.toBoolean(stack.peek().getResult()); if (debugMode) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java index 9211720fd..1ba0c22d1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java @@ -47,11 +47,11 @@ public class AVM2Deobfuscation { private final ConstantPool constants; private final Map usageTypesCount = new HashMap<>(); - + public AVM2Deobfuscation(ConstantPool constants) { this.constants = constants; } - + private static boolean isReserved(String s) { for (String rw : reservedWords) { if (rw.equals(s.trim())) { @@ -151,7 +151,7 @@ public class AVM2Deobfuscation { deobfuscated.put(orig, ret); return ret; } - + public int deobfuscatePackageName(Map stringUsageTypes, Set stringUsages, HashMap namesMap, int strIndex, RenameType renameType) { if (strIndex <= 0) { return strIndex; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index dd23e4aef..c69d16e85 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -208,7 +208,6 @@ public class AVM2Graph extends Graph { int endpos = code.adr2pos(this.avm2code.fixAddrAfterDebugLine(catchedExceptions.get(0).end)); int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end); - List> catchedCommands = new ArrayList<>(); if (this.avm2code.code.get(endpos).definition instanceof JumpIns) { int afterCatchAddr = this.avm2code.pos2adr(endpos + 1) + this.avm2code.code.get(endpos).operands[0]; @@ -221,7 +220,6 @@ public class AVM2Graph extends Graph { } }); - List finallyCommands = new ArrayList<>(); int returnPos = afterCatchPos; for (int e = 0; e < body.exceptions.length; e++) { @@ -447,7 +445,6 @@ public class AVM2Graph extends Graph { GraphPart switchLoc = part.nextParts.get(reversed ? 0 : 1).nextParts.get(0); - while ((this.avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (this.avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) { part = part.nextParts.get(reversed ? 1 : 0); @@ -641,7 +638,6 @@ public class AVM2Graph extends Graph { return ret; } - int pos = next.start; int addr = this.avm2code.fixAddrAfterDebugLine(avm2code.pos2adr(pos)); for (int e = 0; e < body.exceptions.length; e++) { @@ -733,8 +729,6 @@ public class AVM2Graph extends Graph { } }*/ - - List ret = avm2code.clearTemporaryRegisters(list); if (ret != list) { list.clear(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java index c07c6fbab..f3d542562 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java @@ -39,7 +39,7 @@ public class NewFunctionAVM2Item extends AVM2Item { public ABC abc; public List fullyQualifiedNames; public ConstantPool constants; - public MethodInfo[] methodInfo; + public MethodInfo[] methodInfo; public int methodIndex; public NewFunctionAVM2Item(AVM2Instruction instruction, String functionName, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, List fullyQualifiedNames, ConstantPool constants, MethodInfo[] methodInfo, int methodIndex) { @@ -52,7 +52,7 @@ public class NewFunctionAVM2Item extends AVM2Item { this.abc = abc; this.fullyQualifiedNames = fullyQualifiedNames; this.constants = constants; - this.methodInfo = methodInfo; + this.methodInfo = methodInfo; this.methodIndex = methodIndex; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java index fc0ea6d4e..6eef6c17a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java @@ -74,7 +74,7 @@ public class ForEachInAVM2Item extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -92,7 +92,7 @@ public class ForEachInAVM2Item extends LoopItem implements Block { writer.unindent(); writer.append("}"); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java index 64f78fa9e..7a69e2a93 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java @@ -74,7 +74,7 @@ public class ForInAVM2Item extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -92,7 +92,7 @@ public class ForInAVM2Item extends LoopItem implements Block { writer.unindent(); writer.append("}"); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java index 90d63b190..a11c11170 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java @@ -104,7 +104,6 @@ public class ASM3Parser { ParsedSymbol symb = lexer.lex(); - int flags = 0; while (symb.type == ParsedSymbol.TYPE_KEYWORD_FLAG) { symb = lexer.lex(); @@ -482,7 +481,6 @@ public class ASM3Parser { List exceptionIndices = new ArrayList<>(); int offset = 0; - Flasm3Lexer lexer = new Flasm3Lexer(reader); ParsedSymbol symb; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 3487211cd..c27e81f32 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -57,7 +57,7 @@ public class MethodBody implements Cloneable, Serializable { public Traits traits = new Traits(); public transient List convertedItems; public transient Exception convertException; - + public List getExceptionEntries() { List ret = new ArrayList<>(); for (ABCException e : exceptions) { @@ -143,7 +143,7 @@ public class MethodBody implements Cloneable, Serializable { callable.call(); } } catch (InterruptedException ex) { - throw ex; + throw ex; } catch (Exception ex) { Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex); convertException = ex; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index 01b932275..c7d4d8bb3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -79,7 +79,6 @@ public abstract class Trait implements Serializable { nsname = ""; } - if ((!nsname.isEmpty()) && (!nsname.equals("-"))) { } else { if (ns != null) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 570883f22..0e525a2c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -46,7 +46,7 @@ public class TraitClass extends Trait implements TraitWithSlot { public int slot_id; public int class_info; private static final String[] builtInClasses = {"ArgumentError", "arguments", "Array", "Boolean", "Class", "Date", "DefinitionError", "Error", "EvalError", "Function", "int", "JSON", "Math", "Namespace", "Number", "Object", "QName", "RangeError", "ReferenceError", "RegExp", "SecurityError", "String", "SyntaxError", "TypeError", "uint", "URIError", "VerifyError", "XML", "XMLList"}; - + private boolean classInitializerIsEmpty; @Override @@ -298,7 +298,6 @@ public class TraitClass extends Trait implements TraitWithSlot { private List getImportsUsages(List abcTags, ABC abc, List imports, List uses, List fullyQualifiedNames) { //constructor - String packageName = abc.instance_info[class_info].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants); parseImportsUsagesFromMultiname(abcTags, abc, imports, uses, abc.constants.getMultiname(abc.instance_info[class_info].name_index), packageName, fullyQualifiedNames); @@ -319,7 +318,6 @@ public class TraitClass extends Trait implements TraitWithSlot { //instance parseImportsUsagesFromTraits(abcTags, abc, abc.instance_info[class_info].instance_traits, imports, uses, packageName, fullyQualifiedNames); - //instance initializer parseImportsUsagesFromMethodInfo(abcTags, abc, abc.instance_info[class_info].iinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList()); return imports; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java b/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java index e89855f5c..df6718bb2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java @@ -48,7 +48,7 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage { NulWriter nulWriter = new NulWriter(); if (!isInitializer) { if (parentTraitIndex > -1) { - if (isStatic){ + if (isStatic) { ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false); } else { ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false); @@ -68,7 +68,7 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage { } } else { if (parentTraitIndex > -1) { - if (isStatic){ + if (isStatic) { ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false); } else { ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 9f56c31c0..1259434e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -547,7 +547,7 @@ public class Action implements GraphSourceItem { fixBranch = 1; } } - + if (fixBranch > -1) { writer.appendNoHilight("FFDec_DeobfuscatePop").newLine(); if (fixBranch == 0) { //jump @@ -712,7 +712,7 @@ public class Action implements GraphSourceItem { @Override public List call() throws Exception { int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC; - List tree = actionsToTree(new HashMap(), new HashMap(), new HashMap(), actions, version, staticOperation, path); + List tree = actionsToTree(new HashMap(), new HashMap(), new HashMap(), actions, version, staticOperation, path); Graph.graphToString(tree, new NulWriter(), new LocalData()); return tree; } @@ -876,12 +876,12 @@ public class Action implements GraphSourceItem { System.gc(); } out = new ArrayList<>(); - out.add(new CommentItem(new String[] { - "", + out.add(new CommentItem(new String[]{ + "", " * " + AppStrings.translate("decompilationError"), " * " + AppStrings.translate("decompilationError.obfuscated"), - " * " + AppStrings.translate("decompilationError.errorType") + ": " + - ex2.getClass().getSimpleName(), + " * " + AppStrings.translate("decompilationError.errorType") + ": " + + ex2.getClass().getSimpleName(), ""})); } outs.add(out); @@ -1196,7 +1196,7 @@ public class Action implements GraphSourceItem { List ret = actions; if (true) { //return ret; - } + } String s = null; try { HilightedTextWriter writer = new HilightedTextWriter(false); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionDeobfuscation.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionDeobfuscation.java index 18f0aced7..a526b027a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionDeobfuscation.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionDeobfuscation.java @@ -33,7 +33,7 @@ import java.util.regex.Pattern; * @author JPEXS */ public class ActionDeobfuscation { - + private final Random rnd = new Random(); private final int DEFAULT_FOO_SIZE = 10; public HashSet allVariableNamesStr = new HashSet<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index beaf54898..885b62ebf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -301,8 +301,6 @@ public class ActionGraph extends Graph { GraphPart defaultPart = part; //21-21 //caseBodyParts.add(defaultPart); - - List defaultAndLastPart = new ArrayList<>(); defaultAndLastPart.add(defaultPart); defaultAndLastPart.add(caseBodyParts.get(caseBodyParts.size() - 1)); @@ -314,7 +312,6 @@ public class ActionGraph extends Graph { stopPart2.add(defaultPart2); defaultCommands = printGraph(localData, stack, allParts, null, defaultPart, stopPart2, loops, staticOperation, path); - List loopContinues = new ArrayList<>(); for (Loop l : loops) { if (l.loopContinue != null) { @@ -352,7 +349,6 @@ public class ActionGraph extends Graph { defaultPart = defaultPart2; } - List caseValues = new ArrayList<>(); for (int i = 0; i < caseBodyParts.size(); i++) { if (caseValuesMap.containsKey(i)) { @@ -365,8 +361,6 @@ public class ActionGraph extends Graph { List> caseCommands = new ArrayList<>(); GraphPart next = null; - - next = breakPart; GraphTargetItem ti = checkLoop(next, stopPart, loops); @@ -384,9 +378,6 @@ public class ActionGraph extends Graph { valuesMapping.add(caseBodies.indexOf(cur)); } - - - if (defaultPart == breakPart) { defaultPart = null; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java index a479e421a..973a132b6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -72,10 +72,10 @@ public class ActionListReader { private static final Logger logger = Logger.getLogger(SWFInputStream.class.getName()); - /** * Reads list of actions from the stream. Reading ends with * ActionEndFlag(=0) or end of the stream. + * * @param listeners * @param containerSWFOffset * @param mis @@ -107,9 +107,11 @@ public class ActionListReader { } return new ArrayList<>(); } + /** * Reads list of actions from the stream. Reading ends with * ActionEndFlag(=0) or end of the stream. + * * @param listeners * @param containerSWFOffset * @param mis @@ -130,7 +132,7 @@ public class ActionListReader { // List of the actions. N. item contains the action which starts in offset N. List actionMap = new ArrayList<>(); List nextOffsets = new ArrayList<>(); - Action entryAction = readActionListAtPos(listeners, containerSWFOffset, cpool, + Action entryAction = readActionListAtPos(listeners, containerSWFOffset, cpool, sis, actionMap, nextOffsets, ip, ip, endIp, version, path, false, new ArrayList()); @@ -203,10 +205,10 @@ public class ActionListReader { return actions; } - /** * Reads list of actions from the stream. Reading ends with * ActionEndFlag(=0) or end of the stream. + * * @param listeners * @param containerSWFOffset * @param actions @@ -220,7 +222,7 @@ public class ActionListReader { if (actions.isEmpty()) { return actions; } - + Action lastAction = actions.get(actions.size() - 1); int endIp = (int) lastAction.getAddress(); @@ -237,7 +239,7 @@ public class ActionListReader { for (Action a : actions) { actionMap.set((int) a.getAddress(), a); } - + ConstantPool cpool = new ConstantPool(); Stack stack = new Stack<>(); @@ -256,7 +258,7 @@ public class ActionListReader { aif.jumpUsed = false; } } - + deobfustaceActionListAtPosRecursive(listeners, new ArrayList(), new HashMap>(), containerSWFOffset, localData, stack, cpool, actionMap, ip, retdups, ip, endIp, path, new HashMap(), false, new HashMap>(), version, 0, maxRecursionLevel); if (!retdups.isEmpty()) { @@ -508,7 +510,7 @@ public class ActionListReader { for (int i = 0; i < actions.size(); i++) { Action a = actions.get(i); if (a instanceof ActionJump) { - ActionJump aJump = (ActionJump)a; + ActionJump aJump = (ActionJump) a; if (aJump.getJumpOffset() == 0) { if (removeAction(actions, i, version, false)) { i--; @@ -520,20 +522,21 @@ public class ActionListReader { /** * Removes an action from the action list, and updates all references + * * @param actions - * @param index + * @param index */ public static boolean removeAction(List actions, int index, int version, boolean removeWhenLast) { - + if (index < 0 || actions.size() <= index) { return false; } - + long startIp = actions.get(0).getAddress(); Action lastAction = actions.get(actions.size() - 1); int lastIdx = (int) lastAction.getAddress(); long endAddress = lastAction.getAddress() + getTotalActionLength(lastAction); - + List actionMap = new ArrayList<>(lastIdx); for (int i = 0; i <= lastIdx; i++) { actionMap.add(null); @@ -541,13 +544,13 @@ public class ActionListReader { for (Action a : actions) { actionMap.set((int) a.getAddress(), a); } - + Map> containerLastActions = new HashMap<>(); getContainerLastActions(actionMap, containerLastActions); Map jumps = new HashMap<>(); getJumps(actions, jumps); - + Action prevAction = index > 0 ? actions.get(index - 1) : null; Action nextAction = index + 1 < actions.size() ? actions.get(index + 1) : null; Action actionToRemove = actions.get(index); @@ -574,7 +577,7 @@ public class ActionListReader { if (jumps.containsKey(actionToRemove)) { jumps.remove(actionToRemove); } - + actions.remove(index); updateAddresses(actions, startIp, version); @@ -582,10 +585,10 @@ public class ActionListReader { updateActionStores(actions, jumps); updateContainerSizes(actions, containerLastActions); updateActionLengths(actions, version); - + return true; } - + private static Action readActionListAtPos(List listeners, long containerSWFOffset, ConstantPool cpool, SWFInputStream sis, List actions, List nextOffsets, long ip, long startIp, long endIp, int version, String path, boolean indeterminate, List visitedContainers) throws IOException { @@ -708,7 +711,7 @@ public class ActionListReader { if (recursionLevel > maxRecursionLevel + 1) { throw new TranslateException("deobfustaceActionListAtPosRecursive max recursion level reached."); } - + Action a; Scanner sc = new Scanner(System.in); loopip: @@ -716,7 +719,7 @@ public class ActionListReader { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } - + int actionLen = getTotalActionLength(a); if (!visited.containsKey(ip)) { visited.put(ip, 0); @@ -953,8 +956,8 @@ public class ActionListReader { } private static ActionLocalData prepareLocalBranch(ActionLocalData localData) { - - return new ActionLocalData(new HashMap<>(localData.regNames), + + return new ActionLocalData(new HashMap<>(localData.regNames), new HashMap<>(localData.variables), new HashMap<>(localData.functions)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionLocalData.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionLocalData.java index 257dfc9fb..0fe4c0d1b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionLocalData.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionLocalData.java @@ -29,7 +29,7 @@ public class ActionLocalData extends BaseLocalData { public final HashMap regNames; public final HashMap variables; public final HashMap functions; - + public ActionLocalData() { regNames = new HashMap<>(); variables = new HashMap<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java index e85dd805d..60d5771f0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java @@ -83,7 +83,7 @@ public class CallMethodActionItem extends ActionItem { } arguments.get(t).toStringNL(writer, localData); } - + return writer.append(")"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java index a9c21c790..1c2776150 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java @@ -85,7 +85,7 @@ public class NewMethodActionItem extends ActionItem { } arguments.get(t).toString(writer, localData); } - return writer.append(")"); + return writer.append(")"); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java index 8a0978cac..82ac61cbe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java @@ -77,7 +77,7 @@ public class StoreRegisterActionItem extends ActionItem implements SetTypeAction if (define) { writer.append("var "); } - writer.append(register.translate() + " = "); + writer.append(register.translate() + " = "); value.toString(writer, localData); } return writer; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java index e48b6e61e..20b1ce4af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java @@ -202,7 +202,6 @@ public class ClassActionItem extends ActionItem implements Block { writer.append(";").newLine(); } - for (GraphTargetItem f : functions) { f.toString(writer, localData).newLine(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java index d602e2937..6daa12a8c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java @@ -74,7 +74,7 @@ public class ForInActionItem extends LoopActionItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -95,7 +95,7 @@ public class ForInActionItem extends LoopActionItem implements Block { writer.unindent(); writer.append("}"); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index b37bcb1b8..a4b6bec5d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -395,7 +395,6 @@ public class ActionScriptParser { globalClassTypeStr.add("_global"); globalClassTypeStr.addAll(nameStr);*/ - ParsedSymbol s = null; FunctionActionItem constr = null; List staticFunctions = new ArrayList<>(); @@ -798,8 +797,6 @@ public class ActionScriptParser { expectedType(SymbolType.COMMA); GraphTargetItem targetOrNum = (expression(registerVars, inFunction, inMethod, true)); - - s = lex(); expected(s, lexer.yyline(), SymbolType.PARENT_CLOSE, SymbolType.COMMA); int lvmethod = 1; @@ -1832,7 +1829,7 @@ public class ActionScriptParser { List ret = new ArrayList<>(); SourceGeneratorLocalData localData = new SourceGeneratorLocalData( new HashMap(), Boolean.FALSE, Boolean.FALSE, 0); - List srcList = gen.generate(localData, tree); + List srcList = gen.generate(localData, tree); for (GraphSourceItem s : srcList) { if (s instanceof Action) { ret.add((Action) s); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java index 5e54013ff..7c4b22025 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java @@ -298,7 +298,6 @@ public class ActionSourceGenerator implements SourceGenerator { ret.addAll(toActionList(item.switchedObject.toSource(localData, this))); - boolean firstCase = true; List> caseIfs = new ArrayList<>(); List> caseCmds = new ArrayList<>(); @@ -647,12 +646,9 @@ public class ActionSourceGenerator implements SourceGenerator { globalClassTypeStr.add("_global"); globalClassTypeStr.addAll(nameStr); - ParsedSymbol s = null; List constr = new ArrayList<>(); - - if (constructor == null) { List val = new ArrayList<>(); val.add(new ActionDefineFunction("", new ArrayList(), 0, SWF.DEFAULT_VERSION)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index 6d1ef9d17..fb99513c8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -71,7 +71,6 @@ public class ActionPush extends Action { } } - } public ActionPush(int actionLength, SWFInputStream sis, int version) throws IOException { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java index 9e5df869b..3faadf58b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java @@ -112,7 +112,6 @@ public class ActionSetVariable extends Action implements StoreTypeAction { ((SetVariableActionItem) ret).setValue(sr); } - variables.put("__register" + sr.register.number, new TemporaryRegister(sr.register.number, ret)); return; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java index 7fd8f1922..86b075f38 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java @@ -99,7 +99,6 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta sos.writeUI16(0); sos.close(); - baos2.write(surroundWithAction(baos.toByteArray(), version)); } catch (IOException e) { } @@ -121,7 +120,6 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta sos.writeUI16(codeSize); //codeBytes.length); sos.close(); - baos2.write(surroundWithAction(baos.toByteArray(), version)); //baos2.write(codeBytes); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java index 592b78cfd..52e09a668 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java @@ -187,7 +187,6 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont sos.writeUI16(codeSize);//codeBytes.length); sos.close(); - baos2.write(surroundWithAction(baos.toByteArray(), version)); //baos2.write(codeBytes); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java index 979b2350a..c88487ef2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java @@ -300,7 +300,6 @@ public class ActionTry extends Action implements GraphSourceItemContainer { List finallyCommands = contents.get(2); output.add(new TryActionItem(tryCommands, catchExceptions, catchCommands, finallyCommands)); - } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index fa4a053c8..985df6f7e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -127,7 +127,8 @@ public class Configuration { @ConfigurationDescription("Decompilation timeout in seconds for a single file") public static final ConfigurationItem decompilationTimeoutFile = null; /** - * Using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices + * Using parameter names in decompiling may cause problems because official + * programs like Flash CS 5.5 inserts wrong parameter names indices */ @ConfigurationDefaultBoolean(false) @ConfigurationDescription("Using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices") @@ -159,7 +160,7 @@ public class Configuration { public static final ConfigurationItem maxRecentFileCount = null; public static final ConfigurationItem recentFiles = null; public static final ConfigurationItem fontPairing = null; - + public static final ConfigurationItem lastUpdatesCheckDate = null; @ConfigurationDefaultInt(1000) @@ -197,7 +198,7 @@ public class Configuration { public static final ConfigurationItem guiFontPreviewPosX = null; @ConfigurationName("gui.fontPreviewWindow.posY") public static final ConfigurationItem guiFontPreviewPosY = null; - + private enum OSId { WINDOWS, OSX, UNIX @@ -284,13 +285,13 @@ public class Configuration { } return Arrays.asList(files.split("::")); } - + public static void addRecentFile(String path) { List recentFilesArray = new ArrayList<>(getRecentFiles()); int idx = recentFilesArray.indexOf(path); if (idx != -1) { recentFilesArray.remove(idx); - } + } recentFilesArray.add(path); while (recentFilesArray.size() >= maxRecentFileCount.get()) { recentFilesArray.remove(0); @@ -303,10 +304,10 @@ public class Configuration { int idx = recentFilesArray.indexOf(path); if (idx != -1) { recentFilesArray.remove(idx); - } + } recentFiles.set(Helper.joinStrings(recentFilesArray, "::")); } - + public static Map getFontPairs() { String fonts = fontPairing.get(); if (fonts == null) { @@ -320,7 +321,7 @@ public class Configuration { } return result; } - + public static void addFontPair(String fileName, int fontId, String fontName, String systemFontName) { String key = fileName + "_" + fontId + "_" + fontName; Map fontPairs = getFontPairs(); @@ -337,7 +338,7 @@ public class Configuration { } fontPairing.set(sb.toString()); } - + /** * Saves replacements to file for future use */ @@ -409,7 +410,7 @@ public class Configuration { return config; } - private static void saveToFile(String file, String replacementsFile) { + private static void saveToFile(String file, String replacementsFile) { HashMap config = new HashMap<>(); for (Entry entry : getConfigurationFields().entrySet()) { try { @@ -454,7 +455,7 @@ public class Configuration { logLevel = Level.WARNING; } } - + @SuppressWarnings("unchecked") public static void setConfigurationFields() { try { @@ -472,7 +473,7 @@ public class Configuration { if (config.containsKey(name)) { value = config.get(name); } - + if (value != null) { field.set(null, new ConfigurationItem(name, defaultValue, value)); } else { @@ -486,7 +487,7 @@ public class Configuration { Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); } } - + public static Object getDefaultValue(Field field) { Object defaultValue = null; ConfigurationDefaultBoolean aBool = (ConfigurationDefaultBoolean) field.getAnnotation(ConfigurationDefaultBoolean.class); @@ -503,7 +504,7 @@ public class Configuration { } return defaultValue; } - + public static String getDescription(Field field) { ConfigurationDescription a = (ConfigurationDescription) field.getAnnotation(ConfigurationDescription.class); if (a != null) { @@ -511,7 +512,7 @@ public class Configuration { } return null; } - + public static Map getConfigurationFields() { Field[] fields = Configuration.class.getFields(); Map result = new HashMap<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java index c24de8d27..ad5752d87 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java @@ -28,7 +28,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ConfigurationDefaultBoolean { - + boolean value(); - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java index ec89a876f..cf78ec820 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java @@ -28,7 +28,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ConfigurationDefaultInt { - + int value(); - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java index 860f1f201..a1878f3a4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java @@ -28,7 +28,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ConfigurationDefaultString { - + String value(); - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java index 38fbf8d7c..a3e25f9b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java @@ -28,7 +28,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ConfigurationDescription { - + String value(); - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationItem.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationItem.java index 15a87a7bb..bfb7e3958 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationItem.java @@ -21,7 +21,7 @@ package com.jpexs.decompiler.flash.configuration; * @author JPEXS */ public class ConfigurationItem { - + private final String name; protected boolean hasValue; @@ -48,7 +48,7 @@ public class ConfigurationItem { public String getName() { return name; } - + public T get() { if (!hasValue) { return defaultValue; diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java index ba2d23afc..bab103e47 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java @@ -28,7 +28,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ConfigurationName { - + String value(); - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index f4ee1df91..09c825351 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -121,6 +121,7 @@ public class CommandLineArgumentParser { /** * Parses the console arguments + * * @return path to the file which should be opened or null */ public static String parseArguments(String[] arguments) throws IOException { @@ -202,7 +203,7 @@ public class CommandLineArgumentParser { } else { badArguments(); } - + return null; } @@ -280,7 +281,7 @@ public class CommandLineArgumentParser { return ExportMode.SOURCE; } } - + private static void parseConfig(Queue args) { if (args.isEmpty()) { System.err.println("Config values expected"); @@ -319,7 +320,7 @@ public class CommandLineArgumentParser { errorMode = AbortRetryIgnoreHandler.IGNORE; break; } - + return new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount); } @@ -583,10 +584,10 @@ public class CommandLineArgumentParser { if (args.size() < 2) { badArguments(); } - + try { try (InputStream fis = new BufferedInputStream(new FileInputStream(args.remove())); - OutputStream fos = new BufferedOutputStream(new FileOutputStream(args.remove()))) { + OutputStream fos = new BufferedOutputStream(new FileOutputStream(args.remove()))) { if (SWF.fws2cws(fis, fos)) { System.out.println("OK"); } else { @@ -598,7 +599,7 @@ public class CommandLineArgumentParser { } catch (IOException ex) { Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex); } - + System.exit(0); } @@ -609,7 +610,7 @@ public class CommandLineArgumentParser { try { try (InputStream fis = new BufferedInputStream(new FileInputStream(args.remove())); - OutputStream fos = new BufferedOutputStream(new FileOutputStream(args.remove()))) { + OutputStream fos = new BufferedOutputStream(new FileOutputStream(args.remove()))) { if (SWF.decompress(fis, fos)) { System.out.println("OK"); System.exit(0); @@ -649,7 +650,7 @@ public class CommandLineArgumentParser { try { try (InputStream fis = new BufferedInputStream(new FileInputStream(args.remove())); - OutputStream fos = new BufferedOutputStream(new FileOutputStream(args.remove()))) { + OutputStream fos = new BufferedOutputStream(new FileOutputStream(args.remove()))) { if (SWF.renameInvalidIdentifiers(renameType, fis, fos)) { System.out.println("OK"); System.exit(0); diff --git a/trunk/src/com/jpexs/decompiler/flash/console/ContextMenuTools.java b/trunk/src/com/jpexs/decompiler/flash/console/ContextMenuTools.java index 86e5ab31b..0b933a52d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/ContextMenuTools.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/ContextMenuTools.java @@ -35,7 +35,7 @@ import java.util.logging.Logger; * @author JPEXS */ public class ContextMenuTools { - + public static String getAppDir() { String path = Utf8Helper.urlDecode(ContextMenuTools.class.getProtectionDomain().getCodeSource().getLocation().getPath()); String appDir = new File(path).getParentFile().getAbsolutePath(); @@ -72,17 +72,17 @@ public class ContextMenuTools { String exeName32 = "ffdec.exe"; String exeName64 = "ffdec64.exe"; - + if (add) { String exeName = Platform.is64Bit() ? exeName64 : exeName32; return addToContextMenu(add, fromCommandLine, exeName); } else { // remove both 32 and 64 bit references - return addToContextMenu(add, fromCommandLine, exeName32) && - addToContextMenu(add, fromCommandLine, exeName64); + return addToContextMenu(add, fromCommandLine, exeName32) + && addToContextMenu(add, fromCommandLine, exeName64); } } - + private static boolean addToContextMenu(boolean add, boolean fromCommandLine, String exeName) { final String extensions[] = new String[]{"swf", "gfx"}; @@ -120,7 +120,7 @@ public class ContextMenuTools { Advapi32Util.registryCreateKey(REG_CLASSES_HKEY, REG_CLASSES_PATH + clsName); Advapi32Util.registrySetStringValue(REG_CLASSES_HKEY, REG_CLASSES_PATH + clsName, "", "Flash Movie"); } - + if (!Advapi32Util.registryKeyExists(REG_CLASSES_HKEY, REG_CLASSES_PATH + clsName + "\\shell")) { Advapi32Util.registryCreateKey(REG_CLASSES_HKEY, REG_CLASSES_PATH + clsName + "\\shell"); } @@ -220,7 +220,7 @@ public class ContextMenuTools { } return false; } - + private static void registryDeleteKey(WinReg.HKEY hKey, String keyName) { boolean exists = Advapi32Util.registryKeyExists(hKey, keyName); if (exists) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java index c2d7780a2..b42b8200a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java @@ -52,7 +52,6 @@ public class AboutDialog extends AppDialog { setSize(new Dimension(300, 320)); setTitle(translate("dialog.title")); - Container cnt = getContentPane(); JPanel cp = new JPanel(); cp.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); @@ -90,7 +89,6 @@ public class AboutDialog extends AppDialog { verLabel.setHorizontalAlignment(SwingConstants.CENTER); cp.add(verLabel); - JLabel byLabel = new JLabel(translate("by")); byLabel.setAlignmentX(0.5f); byLabel.setHorizontalAlignment(SwingConstants.CENTER); @@ -104,18 +102,12 @@ public class AboutDialog extends AppDialog { authorLabel.setHorizontalAlignment(SwingConstants.CENTER); cp.add(authorLabel); - - - JLabel dateLabel = new JLabel("2010-2014"); dateLabel.setAlignmentX(0.5f); //dateLabel.setPreferredSize(new Dimension(300, 10)); dateLabel.setHorizontalAlignment(SwingConstants.CENTER); cp.add(dateLabel); - - - JLabel transAuthorLabel = new JLabel(translate("translation.author.label")); transAuthorLabel.setAlignmentX(0.5f); //transAuthorLabel.setPreferredSize(new Dimension(300, 20)); @@ -127,7 +119,6 @@ public class AboutDialog extends AppDialog { cp.add(transAuthorLabel); cp.add(transAuthor); - JLabel contributorsLabel = new JLabel(translate("contributors")); contributorsLabel.setAlignmentX(0.5f); contributorsLabel.setHorizontalAlignment(SwingConstants.CENTER); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java index 8447bb575..56dfdccd1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -41,14 +41,14 @@ public class AdvancedSettingsDialog extends AppDialog { View.centerScreen(this); View.setWindowIcon(this); pack(); - + configurationTable.setCellEditor(configurationTable.getDefaultEditor(null)); - + Map fields = Configuration.getConfigurationFields(); String[] keys = new String[fields.size()]; keys = fields.keySet().toArray(keys); Arrays.sort(keys); - + for (String name : keys) { Field field = fields.get(name); DefaultTableModel model = (DefaultTableModel) configurationTable.getModel(); @@ -72,32 +72,32 @@ public class AdvancedSettingsDialog extends AppDialog { private DefaultTableModel getModel() { return new javax.swing.table.DefaultTableModel( - new Object [][] { }, - new String [] { - translate("advancedSettings.columns.name"), - translate("advancedSettings.columns.value"), - translate("advancedSettings.columns.description") - } + new Object[][]{}, + new String[]{ + translate("advancedSettings.columns.name"), + translate("advancedSettings.columns.value"), + translate("advancedSettings.columns.description") + } ) { - Class[] types = new Class [] { + Class[] types = new Class[]{ String.class, Object.class, String.class }; - boolean[] canEdit = new boolean [] { + boolean[] canEdit = new boolean[]{ false, true, false }; @Override public Class getColumnClass(int columnIndex) { - return types [columnIndex]; + return types[columnIndex]; } @Override public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; + return canEdit[columnIndex]; } - }; + }; } - + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -224,7 +224,7 @@ public class AdvancedSettingsDialog extends AppDialog { } Configuration.saveConfig(); setVisible(false); - showRestartConfirmDialod(); + showRestartConfirmDialod(); }//GEN-LAST:event_btnResetActionPerformed private void showRestartConfirmDialod() { @@ -232,7 +232,7 @@ public class AdvancedSettingsDialog extends AppDialog { SelectLanguageDialog.reloadUi(); } } - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOk; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java index 6d624197f..8e5b097c0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/BinaryPanel.java @@ -32,7 +32,7 @@ public final class BinaryPanel extends JPanel implements ActionListener, Compone public LineMarkedEditorPane hexEditor = new LineMarkedEditorPane(); private byte[] data; - + public BinaryPanel() { super(new BorderLayout()); @@ -68,7 +68,7 @@ public final class BinaryPanel extends JPanel implements ActionListener, Compone public void componentResized(ComponentEvent e) { setBinaryData(data); } - + @Override public void componentMoved(ComponentEvent ce) { } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/EachRowRendererEditor.java b/trunk/src/com/jpexs/decompiler/flash/gui/EachRowRendererEditor.java index 3bbaa0e72..c0ccbeb69 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/EachRowRendererEditor.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/EachRowRendererEditor.java @@ -25,7 +25,7 @@ import javax.swing.table.TableCellRenderer; * @author JPEXS */ public class EachRowRendererEditor extends JTable { - + private static final long serialVersionUID = 1L; private Class editingClass; @@ -58,7 +58,6 @@ public class EachRowRendererEditor extends JTable { // This method is also invoked by the editor when the value in the editor // component is saved in the TableModel. The class was saved when the // editor was invoked so the proper class can be created. - @Override public Class getColumnClass(int column) { return editingClass != null ? editingClass : super.getColumnClass(column); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java index 0d2c3edc2..643dde571 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java @@ -138,7 +138,7 @@ public class ErrorLogFrame extends AppFrame { cnt.add(new JScrollPane(logView), BorderLayout.CENTER); handler = new Handler() { SimpleFormatter formatter = new SimpleFormatter(); - + @Override public void publish(LogRecord record) { if (getLevel().intValue() <= record.getLevel().intValue()) { @@ -164,7 +164,7 @@ public class ErrorLogFrame extends AppFrame { mainFrame.getPanel().setErrorState(errorState); } } - + private void notifyMainFrame(Level level) { boolean stateChanged = false; if (level.intValue() >= Level.SEVERE.intValue()) { @@ -190,13 +190,13 @@ public class ErrorLogFrame extends AppFrame { } } } - + private void log(final Level level, final String msg, final String detail) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { notifyMainFrame(level); - + JPanel pan = new JPanel(); pan.setBackground(Color.white); pan.setLayout(new BoxLayout(pan, BoxLayout.Y_AXIS)); @@ -253,7 +253,6 @@ public class ErrorLogFrame extends AppFrame { scrollPane = null; } - if (detailComponent != null) { expandButton.addActionListener(new ActionListener() { @Override @@ -266,7 +265,6 @@ public class ErrorLogFrame extends AppFrame { }); } - if (detailComponent != null) { header.add(expandButton); } @@ -275,7 +273,6 @@ public class ErrorLogFrame extends AppFrame { dateLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); header.add(dateLabel); - JLabel levelLabel = new JLabel(level.getName()); levelLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); header.add(levelLabel); @@ -301,7 +298,6 @@ public class ErrorLogFrame extends AppFrame { } }); - } public void log(Level level, String msg) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorState.java b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorState.java index 303bb1184..8e2181543 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorState.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorState.java @@ -21,5 +21,6 @@ package com.jpexs.decompiler.flash.gui; * @author JPEXS */ public enum ErrorState { + NO_ERROR, INFO, WARNING, ERROR } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java index 6d3e17354..c7fc84612 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java @@ -50,9 +50,9 @@ public class FontEmbedDialog extends AppDialog implements ActionListener { private static final String ACTION_OK = "OK"; private static final String ACTION_CANCEL = "CANCEL"; - + private static final int SAMPLE_MAX_LENGTH = 50; - + private final JComboBox sourceFont; private final JCheckBox[] rangeCheckboxes; private final String rangeNames[]; @@ -121,7 +121,6 @@ public class FontEmbedDialog extends AppDialog implements ActionListener { } cnt.add(new JScrollPane(rangesPanel)); - JPanel specialPanel = new JPanel(); specialPanel.setLayout(new BoxLayout(specialPanel, BoxLayout.X_AXIS)); specialPanel.add(new JLabel(translate("label.individual"))); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java index 01826414e..0be6e6850 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java @@ -38,7 +38,7 @@ public class FontPanel extends javax.swing.JPanel { private final MainPanel mainPanel; private FontTag fontTag; - + /** * Creates new form FontPanel */ @@ -70,7 +70,7 @@ public class FontPanel extends javax.swing.JPanel { fontIsItalicCheckBox.setEnabled(false); } } - + private String translate(String key) { return mainPanel.translate(key); } @@ -121,7 +121,7 @@ public class FontPanel extends javax.swing.JPanel { f.addCharacter(swf.tags, c, fontSelection.getSelectedItem().toString()); oldchars += c; } - + int fontId = ft.getFontId(); if (updateTextsCheckBox.isSelected()) { for (Tag tag : swf.tags) { @@ -154,7 +154,7 @@ public class FontPanel extends javax.swing.JPanel { fontDisplayNameTextArea.setText(fontNameTag.fontName); fontCopyrightTextArea.setText(fontNameTag.fontCopyright); } - + fontIsBoldCheckBox.setSelected(ft.isBold()); fontIsItalicCheckBox.setSelected(ft.isItalic()); fontDescentLabel.setText(ft.getDescent() == -1 ? translate("value.unknown") : "" + ft.getDescent()); @@ -174,7 +174,7 @@ public class FontPanel extends javax.swing.JPanel { } setEditable(false); } - + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java index 3656944a2..9ac91eeec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java @@ -65,7 +65,7 @@ public class FontPreviewDialog extends AppDialog { setText((String) comboBoxSampleTexts.getSelectedItem()); labelFontName.setText(font.getFontName()); } - + private void setText(String text) { labelSample12.setText(text); labelSample18.setText(text); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java b/trunk/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java index 2e1fa3ac5..7efde1f89 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java @@ -39,5 +39,5 @@ public class GuiAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler { // there are no non-static field in this class, so return the original instance return this; } - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java b/trunk/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java index 1fc16c293..5ffbcfc70 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java @@ -61,7 +61,6 @@ public class HeaderLabel extends JLabel { return false; } });*/ - } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 5bb5f3e3b..338085e1d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -40,7 +40,7 @@ import javax.swing.JPanel; public final class ImagePanel extends JPanel implements ActionListener, FlashDisplay { static final String ACTION_SELECT_COLOR = "SELECTCOLOR"; - + public JLabel label = new JLabel(); public DrawableTag drawable; private Timer timer; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java b/trunk/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java index 40b3a9e49..80d36c9c8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java @@ -32,7 +32,7 @@ import java.util.regex.Pattern; * @author JPEXS */ public class LicenseUpdater { - + public static void updateLicense() { updateLicenseInDir(new File(".\\src\\")); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LinkLabel.java b/trunk/src/com/jpexs/decompiler/flash/gui/LinkLabel.java index 4bab5db5b..e72256e90 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LinkLabel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LinkLabel.java @@ -26,8 +26,7 @@ import javax.swing.JLabel; * An extension of JLabel which looks like a link and responds appropriately * when clicked. Note that this class will only work with Swing 1.1.1 and later. * Note that because of the way this class is implemented, getText() will not - * return correct values, user - * getNormalText instead. + * return correct values, user getNormalText instead. */ public class LinkLabel extends JLabel { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java index 0a744bd37..2a6a417b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java @@ -182,7 +182,6 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener { } filter(); - return null; } @@ -195,7 +194,6 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener { } }.execute(); - } private void filter() { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java index fdac07b91..e95f7673d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java @@ -164,14 +164,13 @@ public class LoadFromMemoryFrame extends AppFrame implements ActionListener { private void addResultRow(SwfInMemory swf) { if (swf != null) { com.jpexs.process.Process process = swf.process; - resTableModel.addRow(new Object[] {swf.version, swf.fileSize, process.getPid(), process.getFileName()}); - } - else { + resTableModel.addRow(new Object[]{swf.version, swf.fileSize, process.getPid(), process.getFileName()}); + } else { String notFound = translate("notfound"); - resTableModel.addRow(new Object[] {notFound, 0, "", ""}); + resTableModel.addRow(new Object[]{notFound, 0, "", ""}); } } - + private void refreshList() { model.clear(); processlist = ProcessTools.listProcesses(); @@ -386,8 +385,6 @@ public class LoadFromMemoryFrame extends AppFrame implements ActionListener { progress.setVisible(false); rightPanel.add(statePanel, BorderLayout.NORTH); - - cnt.add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel), BorderLayout.CENTER); View.setWindowIcon(this); View.centerScreen(this); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LogFormatter.java b/trunk/src/com/jpexs/decompiler/flash/gui/LogFormatter.java index 4ee8c871c..3a34db4ad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LogFormatter.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LogFormatter.java @@ -38,8 +38,9 @@ public class LogFormatter extends Formatter { public String format(LogRecord record) { StringBuilder buf = new StringBuilder(180); - if (dateFormat == null) + if (dateFormat == null) { dateFormat = new SimpleDateFormat("HH:mm:ss.SSS"); + } buf.append(dateFormat.format(new Date(record.getMillis()))); buf.append(" > "); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 0332a9b1a..03e08bde8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -144,7 +144,7 @@ public class Main { addTrayIcon(); switchProxy(); } - + public static void showProxy() { if (proxyFrame == null) { proxyFrame = new ProxyFrame(mainFrame); @@ -211,14 +211,14 @@ public class Main { public static SWFList parseSWF(SWFSourceInfo sourceInfo) throws Exception { SWFList result = new SWFList(); - + InputStream inputStream = sourceInfo.getInputStream(); SWFBundle bundle = null; if (inputStream == null) { inputStream = new BufferedInputStream(new FileInputStream(sourceInfo.getFile())); bundle = sourceInfo.getBundle(); logger.log(Level.INFO, "Load file: {0}", sourceInfo.getFile()); - } else if (inputStream instanceof SeekableInputStream + } else if (inputStream instanceof SeekableInputStream || inputStream instanceof BufferedInputStream) { try { inputStream.reset(); @@ -227,7 +227,7 @@ public class Main { } logger.log(Level.INFO, "Load stream: {0}", sourceInfo.getFileTitle()); } - + Stopwatch sw = Stopwatch.startNew(); if (bundle != null) { result.isBundle = true; @@ -256,7 +256,7 @@ public class Main { swf.fileTitle = sourceInfo.getFileTitle(); result.add(swf); } - + if (inputStream instanceof FileInputStream) { logger.log(Level.INFO, "File loaded in {0} seconds.", (sw.getElapsedMilliseconds() / 1000)); inputStream.close(); @@ -294,14 +294,14 @@ public class Main { } }); } - + return result; } public static void saveFile(SWF swf, String outfile) throws IOException { saveFile(swf, outfile, SaveFileMode.SAVE); } - + public static void saveFile(SWF swf, String outfile, SaveFileMode mode) throws IOException { if (mode == SaveFileMode.SAVEAS) { swf.file = outfile; @@ -311,9 +311,9 @@ public class Main { FileOutputStream fos = new FileOutputStream(tmpFile); if (mode == SaveFileMode.EXE) { InputStream exeStream = View.class.getClassLoader().getResourceAsStream("com/jpexs/helpers/resource/Swf2Exe.bin"); - byte [] buffer = new byte[4096]; + byte[] buffer = new byte[4096]; int bytesRead = 0; - while((bytesRead = exeStream.read(buffer)) != -1) { + while ((bytesRead = exeStream.read(buffer)) != -1) { fos.write(buffer, 0, bytesRead); } int width = swf.displayRect.Xmax - swf.displayRect.Xmin; @@ -345,9 +345,9 @@ public class Main { private static class OpenFileWorker extends SwingWorker { private final SWFSourceInfo[] sourceInfos; - + public OpenFileWorker(SWFSourceInfo sourceInfo) { - this.sourceInfos = new SWFSourceInfo[] { sourceInfo }; + this.sourceInfos = new SWFSourceInfo[]{sourceInfo}; } public OpenFileWorker(SWFSourceInfo[] sourceInfos) { @@ -468,9 +468,9 @@ public class Main { } public static OpenFileResult openFile(SWFSourceInfo sourceInfo) { - return openFile(new SWFSourceInfo[] { sourceInfo }); + return openFile(new SWFSourceInfo[]{sourceInfo}); } - + public static OpenFileResult openFile(SWFSourceInfo[] newSourceInfos) { if (mainFrame != null && !Configuration.openMultipleFiles.get()) { sourceInfos.clear(); @@ -495,17 +495,17 @@ public class Main { sourceInfos.addAll(Arrays.asList(newSourceInfos)); return OpenFileResult.OK; } - + public static void closeFile(SWFList swf) { - sourceInfos.remove(swf.sourceInfo); - mainFrame.getPanel().close(swf); + sourceInfos.remove(swf.sourceInfo); + mainFrame.getPanel().close(swf); } - + public static void closeAll() { - sourceInfos.clear(); - mainFrame.getPanel().closeAll(); + sourceInfos.clear(); + mainFrame.getPanel().closeAll(); } - + public static boolean saveFileDialog(SWF swf, final SaveFileMode mode) { JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(Configuration.lastSaveDir.get())); @@ -589,8 +589,8 @@ public class Main { JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get())); FileFilter allSupportedFilter = new FileFilter() { - private final String[] supportedExtensions = new String[] { ".swf", ".gfx", ".swc", ".zip" }; - + private final String[] supportedExtensions = new String[]{".swf", ".gfx", ".swc", ".zip"}; + @Override public boolean accept(File f) { String name = f.getName().toLowerCase(); @@ -621,7 +621,7 @@ public class Main { } }; fc.addChoosableFileFilter(swfFilter); - + FileFilter swcFilter = new FileFilter() { @Override public boolean accept(File f) { @@ -634,7 +634,7 @@ public class Main { } }; fc.addChoosableFileFilter(swcFilter); - + FileFilter gfxFilter = new FileFilter() { @Override public boolean accept(File f) { @@ -645,10 +645,9 @@ public class Main { public String getDescription() { return AppStrings.translate("filter.gfx"); } - }; + }; fc.addChoosableFileFilter(gfxFilter); - - + FileFilter zipFilter = new FileFilter() { @Override public boolean accept(File f) { @@ -661,7 +660,7 @@ public class Main { } }; fc.addChoosableFileFilter(zipFilter); - + FileFilter binaryFilter = new FileFilter() { @Override public boolean accept(File f) { @@ -674,7 +673,7 @@ public class Main { } }; fc.addChoosableFileFilter(binaryFilter); - + fc.setAcceptAllFileFilterUsed(false); JFrame f = new JFrame(); View.setWindowIcon(f); @@ -743,7 +742,7 @@ public class Main { } catch (Throwable ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } - + UIManager.put("OptionPane.okButtonText", AppStrings.translate("button.ok")); UIManager.put("OptionPane.yesButtonText", AppStrings.translate("button.yes")); UIManager.put("OptionPane.noButtonText", AppStrings.translate("button.no")); @@ -871,7 +870,7 @@ public class Main { } if (args.length == 0) { - initGui(); + initGui(); showModeFrame(); } else { String fileToOpen = CommandLineArgumentParser.parseArguments(args); @@ -926,7 +925,6 @@ public class Main { trayIcon.setImageAutoSize(true); PopupMenu trayPopup = new PopupMenu(); - ActionListener trayListener = new ActionListener() { /** * Invoked when an action occurs. @@ -945,7 +943,6 @@ public class Main { } }; - MenuItem showMenuItem = new MenuItem(AppStrings.translate("proxy.show")); showMenuItem.setActionCommand("SHOW"); showMenuItem.addActionListener(trayListener); @@ -1102,10 +1099,10 @@ public class Main { fileTxt.close(); logger.removeHandler(fileTxt); } - + String fileName; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); - + try { fileName = Configuration.getFFDecHome() + File.separator + "logs" + File.separator; if (Configuration.useDetailedLogging.get()) { @@ -1122,13 +1119,12 @@ public class Main { logger.log(Level.SEVERE, null, ex); } - Formatter formatterTxt = new LogFormatter(); fileTxt.setFormatter(formatterTxt); logger.addHandler(fileTxt); ErrorLogFrame.getInstance().clearErrorState(); - + sdf = new SimpleDateFormat("yyyy-MM-dd"); logger.log(Level.INFO, "Date: {0}", sdf.format(new Date())); logger.log(Level.INFO, ApplicationInfo.applicationVerName); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 7c983ab75..a22940d33 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -21,10 +21,14 @@ package com.jpexs.decompiler.flash.gui; * @author JPEXS */ public interface MainFrame { - + public void setTitle(String string); + public String translate(String key); + public MainPanel getPanel(); + public boolean isVisible(); + public void setVisible(boolean b); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java index 6be7ca1d6..ddbc641ad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassic.java @@ -35,7 +35,7 @@ public final class MainFrameClassic extends AppFrame implements MainFrame { public MainPanel panel; private MainFrameMenu mainMenu; - + public MainFrameClassic() { super(); @@ -128,9 +128,9 @@ public final class MainFrameClassic extends AppFrame implements MainFrame { super.setVisible(b); panel.setVisible(b); } - + @Override public MainPanel getPanel() { return panel; } - } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java index bf806aa5c..6cc47835c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java @@ -99,7 +99,7 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { private JMenuItem exportAllCommandButton; private JMenuItem exportFlaCommandButton; private JMenuItem exportSelectionCommandButton; - + private JMenuItem reloadCommandButton; private JMenuItem renameinvalidCommandButton; private JMenuItem globalrenameCommandButton; @@ -117,7 +117,7 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { public boolean isInternalFlashViewerSelected() { return miInternalViewer.isSelected(); } - + private String translate(String key) { return mainFrame.translate(key); } @@ -176,8 +176,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { menuExportAll.setIcon(View.getIcon("export16")); menuExportSel.setIcon(View.getIcon("exportsel16")); - - menuFile.add(miOpen); menuFile.add(miSave); menuFile.add(miSaveAs); @@ -212,7 +210,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { miRenameIdentifiers.setActionCommand(ACTION_RENAME_IDENTIFIERS); miRenameIdentifiers.addActionListener(this); - menuDeobfuscation.add(miRenameOneIdentifier); menuDeobfuscation.add(miRenameIdentifiers); menuDeobfuscation.add(miDeobfuscation); @@ -242,7 +239,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { miParallelSpeedUp.setActionCommand(ACTION_PARALLEL_SPEED_UP); miParallelSpeedUp.addActionListener(this); - menuTools.add(miProxy); menuTools.add(menuDeobfuscation); @@ -286,7 +282,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { miAssociate.addActionListener(this); miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu()); - JMenuItem miLanguage = new JMenuItem(translate("menu.settings.language")); miLanguage.setActionCommand(ACTION_SET_LANGUAGE); miLanguage.addActionListener(this); @@ -325,7 +320,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { miHomepage.setIcon(View.getIcon("homepage16")); miHomepage.addActionListener(this); - menuHelp.add(miCheckUpdates); menuHelp.add(miHelpUs); menuHelp.add(miHomepage); @@ -333,34 +327,34 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { menuBar.add(menuHelp); mainFrame.setJMenuBar(menuBar); - + //if (hasAbc) { menuTools.add(miGotoDocumentClass); //} } - + @Override public void updateComponets(SWF swf, List abcList) { boolean swfLoaded = swf != null; boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty(); - + /*saveCommandButton.setEnabled(swfLoaded); - saveasCommandButton.setEnabled(swfLoaded); - saveasexeCommandButton.setEnabled(swfLoaded); - exportAllCommandButton.setEnabled(swfLoaded); - exportFlaCommandButton.setEnabled(swfLoaded); - exportSelectionCommandButton.setEnabled(swfLoaded); - reloadCommandButton.setEnabled(swfLoaded); + saveasCommandButton.setEnabled(swfLoaded); + saveasexeCommandButton.setEnabled(swfLoaded); + exportAllCommandButton.setEnabled(swfLoaded); + exportFlaCommandButton.setEnabled(swfLoaded); + exportSelectionCommandButton.setEnabled(swfLoaded); + reloadCommandButton.setEnabled(swfLoaded); - renameinvalidCommandButton.setEnabled(swfLoaded); - globalrenameCommandButton.setEnabled(swfLoaded); - deobfuscationCommandButton.setEnabled(swfLoaded); - searchCommandButton.setEnabled(swfLoaded); + renameinvalidCommandButton.setEnabled(swfLoaded); + globalrenameCommandButton.setEnabled(swfLoaded); + deobfuscationCommandButton.setEnabled(swfLoaded); + searchCommandButton.setEnabled(swfLoaded); - gotoDocumentClassCommandButton.setEnabled(hasAbc); - deobfuscationCommandButton.setEnabled(hasAbc);*/ + gotoDocumentClassCommandButton.setEnabled(hasAbc); + deobfuscationCommandButton.setEnabled(hasAbc);*/ } - + private void saveAs(SWF swf, SaveFileMode mode) { if (Main.saveFileDialog(swf, mode)) { swf.fileTitle = null; @@ -368,7 +362,7 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { saveCommandButton.setEnabled(mainFrame.panel.getCurrentSwf() != null); } } - + @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { @@ -482,33 +476,30 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { Main.setSubLimiter(((JCheckBoxMenuItem) e.getSource()).getState()); } break; - case ACTION_SAVE: - { - SWF swf = mainFrame.panel.getCurrentSwf(); - if (swf.file == null) { - saveAs(swf, SaveFileMode.SAVEAS); - } else { - try { - Main.saveFile(swf, swf.file); - } catch (IOException ex) { - Logger.getLogger(MainFrameClassicMenu.class.getName()).log(Level.SEVERE, null, ex); - View.showMessageDialog(null, translate("error.file.save"), translate("error"), JOptionPane.ERROR_MESSAGE); - } + case ACTION_SAVE: { + SWF swf = mainFrame.panel.getCurrentSwf(); + if (swf.file == null) { + saveAs(swf, SaveFileMode.SAVEAS); + } else { + try { + Main.saveFile(swf, swf.file); + } catch (IOException ex) { + Logger.getLogger(MainFrameClassicMenu.class.getName()).log(Level.SEVERE, null, ex); + View.showMessageDialog(null, translate("error.file.save"), translate("error"), JOptionPane.ERROR_MESSAGE); } } - break; - case ACTION_SAVE_AS: - { - SWF swf = mainFrame.panel.getCurrentSwf(); - saveAs(swf, SaveFileMode.SAVEAS); - } - break; - case ACTION_SAVE_AS_EXE: - { - SWF swf = mainFrame.panel.getCurrentSwf(); - saveAs(swf, SaveFileMode.EXE); - } - break; + } + break; + case ACTION_SAVE_AS: { + SWF swf = mainFrame.panel.getCurrentSwf(); + saveAs(swf, SaveFileMode.SAVEAS); + } + break; + case ACTION_SAVE_AS_EXE: { + SWF swf = mainFrame.panel.getCurrentSwf(); + saveAs(swf, SaveFileMode.EXE); + } + break; case ACTION_OPEN: Main.openFileDialog(); break; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 668c1351f..30de55b5c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -25,7 +25,7 @@ import java.util.List; * @author JPEXS */ public interface MainFrameMenu { - + public boolean isInternalFlashViewerSelected(); public void updateComponets(SWF swf, List abcList); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java index 9236c8a9e..ace5c75fb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java @@ -50,7 +50,7 @@ public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame { public MainPanel panel; private MainFrameMenu mainMenu; - + public MainFrameRibbon() { super(); @@ -170,53 +170,53 @@ public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame { mbutton.setIcon(View.getResizableIcon("buttonicon_256")); mbutton.setDisplayState(new CommandButtonDisplayState( "My Ribbon Application Menu Button", mbutton.getSize().width) { - @Override - public CommandButtonLayoutManager createLayoutManager( - AbstractCommandButton commandButton) { - return new CommandButtonLayoutManager() { @Override - public int getPreferredIconSize() { - return mbutton.getSize().width; - } - - @Override - public CommandButtonLayoutManager.CommandButtonLayoutInfo getLayoutInfo( - AbstractCommandButton commandButton, Graphics g) { - CommandButtonLayoutManager.CommandButtonLayoutInfo result = new CommandButtonLayoutManager.CommandButtonLayoutInfo(); - result.actionClickArea = new Rectangle(0, 0, 0, 0); - result.popupClickArea = new Rectangle(0, 0, commandButton - .getWidth(), commandButton.getHeight()); - result.popupActionRect = new Rectangle(0, 0, 0, 0); - ResizableIcon icon = commandButton.getIcon(); - icon.setDimension(new Dimension(commandButton.getWidth(), commandButton.getHeight())); - result.iconRect = new Rectangle( - 0, - 0, - commandButton.getWidth(), commandButton.getHeight()); - result.isTextInActionArea = false; - return result; - } - - @Override - public Dimension getPreferredSize( + public CommandButtonLayoutManager createLayoutManager( AbstractCommandButton commandButton) { - return new Dimension(40, 40); - } + return new CommandButtonLayoutManager() { + @Override + public int getPreferredIconSize() { + return mbutton.getSize().width; + } - @Override - public void propertyChange(PropertyChangeEvent evt) { - } + @Override + public CommandButtonLayoutManager.CommandButtonLayoutInfo getLayoutInfo( + AbstractCommandButton commandButton, Graphics g) { + CommandButtonLayoutManager.CommandButtonLayoutInfo result = new CommandButtonLayoutManager.CommandButtonLayoutInfo(); + result.actionClickArea = new Rectangle(0, 0, 0, 0); + result.popupClickArea = new Rectangle(0, 0, commandButton + .getWidth(), commandButton.getHeight()); + result.popupActionRect = new Rectangle(0, 0, 0, 0); + ResizableIcon icon = commandButton.getIcon(); + icon.setDimension(new Dimension(commandButton.getWidth(), commandButton.getHeight())); + result.iconRect = new Rectangle( + 0, + 0, + commandButton.getWidth(), commandButton.getHeight()); + result.isTextInActionArea = false; + return result; + } - @Override - public Point getKeyTipAnchorCenterPoint( - AbstractCommandButton commandButton) { - // dead center - return new Point(commandButton.getWidth() / 2, - commandButton.getHeight() / 2); - } - }; - } - }); + @Override + public Dimension getPreferredSize( + AbstractCommandButton commandButton) { + return new Dimension(40, 40); + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + } + + @Override + public Point getKeyTipAnchorCenterPoint( + AbstractCommandButton commandButton) { + // dead center + return new Point(commandButton.getWidth() / 2, + commandButton.getHeight() / 2); + } + }; + } + }); MyRibbonApplicationMenuButtonUI mui = (MyRibbonApplicationMenuButtonUI) mbutton.getUI(); mui.setHoverIcon(View.getResizableIcon("buttonicon_hover_256")); @@ -225,7 +225,7 @@ public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame { } } }); - + panel.setVisible(b); } @@ -233,4 +233,4 @@ public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame { public MainPanel getPanel() { return panel; } - } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index 119a5e34a..d87c1b09d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -121,7 +121,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { private JCommandButton exportAllCommandButton; private JCommandButton exportFlaCommandButton; private JCommandButton exportSelectionCommandButton; - + private JCommandButton reloadCommandButton; private JCommandButton renameinvalidCommandButton; private JCommandButton globalrenameCommandButton; @@ -135,7 +135,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { RibbonApplicationMenuEntryPrimary exportSelMenu; RibbonApplicationMenuEntryPrimary closeFileMenu; RibbonApplicationMenuEntryPrimary closeAllFilesMenu; - + public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) { this.mainFrame = mainFrame; @@ -155,7 +155,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { public boolean isInternalFlashViewerSelected() { return miInternalViewer.isSelected(); } - + private String translate(String key) { return mainFrame.translate(key); } @@ -192,38 +192,38 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { openFileMenu.setRolloverCallback(new RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback() { @Override public void menuEntryActivated(JPanel targetPanel) { - targetPanel.removeAll(); - JCommandButtonPanel openHistoryPanel = new JCommandButtonPanel(CommandButtonDisplayState.MEDIUM); - String groupName = translate("menu.recentFiles"); - openHistoryPanel.addButtonGroup(groupName); - List recentFiles = Configuration.getRecentFiles(); - int j = 0; - for (int i = recentFiles.size() - 1; i >= 0; i--) { - String path = recentFiles.get(i); - RecentFilesButton historyButton = new RecentFilesButton(j + " " + path, null); - historyButton.fileName = path; - historyButton.addActionListener(new ActionListener() { + targetPanel.removeAll(); + JCommandButtonPanel openHistoryPanel = new JCommandButtonPanel(CommandButtonDisplayState.MEDIUM); + String groupName = translate("menu.recentFiles"); + openHistoryPanel.addButtonGroup(groupName); + List recentFiles = Configuration.getRecentFiles(); + int j = 0; + for (int i = recentFiles.size() - 1; i >= 0; i--) { + String path = recentFiles.get(i); + RecentFilesButton historyButton = new RecentFilesButton(j + " " + path, null); + historyButton.fileName = path; + historyButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent ae) { - RecentFilesButton source = (RecentFilesButton) ae.getSource(); - if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) { - if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) { - Configuration.removeRecentFile(source.fileName); - } - } - } - }); - j++; - historyButton.setHorizontalAlignment(SwingUtilities.LEFT); - openHistoryPanel.addButtonToLastGroup(historyButton); - } - openHistoryPanel.setMaxButtonColumns(1); - targetPanel.setLayout(new BorderLayout()); - targetPanel.add(openHistoryPanel, BorderLayout.CENTER); + @Override + public void actionPerformed(ActionEvent ae) { + RecentFilesButton source = (RecentFilesButton) ae.getSource(); + if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) { + if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) { + Configuration.removeRecentFile(source.fileName); + } + } + } + }); + j++; + historyButton.setHorizontalAlignment(SwingUtilities.LEFT); + openHistoryPanel.addButtonToLastGroup(historyButton); + } + openHistoryPanel.setMaxButtonColumns(1); + targetPanel.setLayout(new BorderLayout()); + targetPanel.add(openHistoryPanel, BorderLayout.CENTER); } }); - + RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), new ActionRedirector(this, "EXIT")); mainMenu.addMenuEntry(openFileMenu); @@ -248,7 +248,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { resizePolicies.add(new IconRibbonBandResizePolicy(ribbonBand.getControlPanel())); return resizePolicies; } - + private List getIconBandResizePolicies(JRibbonBand ribbonBand) { List resizePolicies = new ArrayList<>(); resizePolicies.add(new BaseRibbonBandResizePolicy(ribbonBand.getControlPanel()) { @@ -264,7 +264,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { resizePolicies.add(new IconRibbonBandResizePolicy(ribbonBand.getControlPanel())); return resizePolicies; } - + private RibbonTask createFileRibbonTask() { JRibbonBand editBand = new JRibbonBand(translate("menu.general"), null); editBand.setResizePolicies(getResizePolicies(editBand)); @@ -301,10 +301,10 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { return new RibbonTask(translate("menu.file"), editBand, exportBand); } - + private RibbonTask createToolsRibbonTask() { //----------------------------------------- TOOLS ----------------------------------- - + JRibbonBand toolsBand = new JRibbonBand(translate("menu.tools"), null); toolsBand.setResizePolicies(getResizePolicies(toolsBand)); @@ -354,10 +354,10 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand, otherToolsBand); } - + private RibbonTask createSettingsRibbonTask(boolean externalFlashPlayerUnavailable) { //----------------------------------------- SETTINGS ----------------------------------- - + JRibbonBand settingsBand = new JRibbonBand(translate("menu.settings"), null); settingsBand.setResizePolicies(getResizePolicies(settingsBand)); @@ -428,10 +428,10 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { JCommandButton advancedSettingsCommandButton = new JCommandButton(fixCommandTitle(translate("menu.advancedsettings.advancedsettings")), View.getResizableIcon("settings32")); assignListener(advancedSettingsCommandButton, ACTION_ADVANCED_SETTINGS); advancedSettingsBand.addCommandButton(advancedSettingsCommandButton, RibbonElementPriority.TOP); - + return new RibbonTask(translate("menu.settings"), settingsBand, languageBand, advancedSettingsBand); } - + private RibbonTask createHelpRibbonTask() { //----------------------------------------- HELP ----------------------------------- @@ -453,7 +453,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { helpBand.addCommandButton(helpUsUpdatesCommandButton, RibbonElementPriority.TOP); return new RibbonTask(translate("menu.help"), helpBand); } - + private RibbonTask createDebugRibbonTask() { //----------------------------------------- DEBUG ----------------------------------- @@ -475,7 +475,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { public void updateComponets(SWF swf, List abcList) { boolean swfLoaded = swf != null; boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty(); - + exportAllMenu.setEnabled(swfLoaded); exportFlaMenu.setEnabled(swfLoaded); exportSelMenu.setEnabled(swfLoaded); @@ -498,7 +498,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { gotoDocumentClassCommandButton.setEnabled(hasAbc); deobfuscationCommandButton.setEnabled(hasAbc); } - + private void saveAs(SWF swf, SaveFileMode mode) { if (Main.saveFileDialog(swf, mode)) { swf.fileTitle = null; @@ -506,7 +506,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { saveCommandButton.setEnabled(mainFrame.panel.getCurrentSwf() != null); } } - + @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { @@ -623,33 +623,30 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { Main.setSubLimiter(((JCheckBoxMenuItem) e.getSource()).getState()); } break; - case ACTION_SAVE: - { - SWF swf = mainFrame.panel.getCurrentSwf(); - if (swf.file == null) { - saveAs(swf, SaveFileMode.SAVEAS); - } else { - try { - Main.saveFile(swf, swf.file); - } catch (IOException ex) { - Logger.getLogger(MainFrameRibbonMenu.class.getName()).log(Level.SEVERE, null, ex); - View.showMessageDialog(null, translate("error.file.save"), translate("error"), JOptionPane.ERROR_MESSAGE); - } + case ACTION_SAVE: { + SWF swf = mainFrame.panel.getCurrentSwf(); + if (swf.file == null) { + saveAs(swf, SaveFileMode.SAVEAS); + } else { + try { + Main.saveFile(swf, swf.file); + } catch (IOException ex) { + Logger.getLogger(MainFrameRibbonMenu.class.getName()).log(Level.SEVERE, null, ex); + View.showMessageDialog(null, translate("error.file.save"), translate("error"), JOptionPane.ERROR_MESSAGE); } } - break; - case ACTION_SAVE_AS: - { - SWF swf = mainFrame.panel.getCurrentSwf(); - saveAs(swf, SaveFileMode.SAVEAS); - } - break; - case ACTION_SAVE_AS_EXE: - { - SWF swf = mainFrame.panel.getCurrentSwf(); - saveAs(swf, SaveFileMode.EXE); - } - break; + } + break; + case ACTION_SAVE_AS: { + SWF swf = mainFrame.panel.getCurrentSwf(); + saveAs(swf, SaveFileMode.SAVEAS); + } + break; + case ACTION_SAVE_AS_EXE: { + SWF swf = mainFrame.panel.getCurrentSwf(); + saveAs(swf, SaveFileMode.EXE); + } + break; case ACTION_OPEN: Main.openFileDialog(); break; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameStatusPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameStatusPanel.java index c9e5f1362..d5257314c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameStatusPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameStatusPanel.java @@ -38,11 +38,11 @@ import javax.swing.border.BevelBorder; * @author JPEXS */ public class MainFrameStatusPanel extends JPanel implements ActionListener { - + static final String ACTION_SHOW_ERROR_LOG = "SHOWERRORLOG"; private final MainPanel mainPanel; - + private final LoadingPanel loadingPanel = new LoadingPanel(20, 20); private final JLabel statusLabel = new JLabel(""); private final JButton cancelButton = new JButton(); @@ -58,7 +58,7 @@ public class MainFrameStatusPanel extends JPanel implements ActionListener { this.mainPanel = mainPanel; createStatusPanel(); } - + private void createStatusPanel() { JPanel statusLeftPanel = new JPanel(); statusLeftPanel.setLayout(new BoxLayout(statusLeftPanel, BoxLayout.X_AXIS)); @@ -109,7 +109,7 @@ public class MainFrameStatusPanel extends JPanel implements ActionListener { break; } } - + private String translate(String key) { return mainPanel.translate(key); } @@ -154,9 +154,9 @@ public class MainFrameStatusPanel extends JPanel implements ActionListener { errorNotificationButton.setToolTipText(translate("errors.present")); break; } - + errorNotificationButton.setIcon(currentIcon); - + if (errorState != ErrorState.NO_ERROR) { if (blinkTimer != null) { blinkTimer.cancel(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 17b7d8bb9..6f4a6cb35 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -190,7 +190,7 @@ import javax.swing.tree.TreeSelectionModel; * @author JPEXS */ public final class MainPanel extends JPanel implements ActionListener, TreeSelectionListener, SearchListener, Freed { - + private final MainFrame mainFrame; private final List swfs; private ABCPanel abcPanel; @@ -261,7 +261,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec private static final String ACTION_CANCEL_TEXT = "CANCELTEXT"; private static final String ACTION_SAVE_TEXT = "SAVETEXT"; private static final String ACTION_CLOSE_SWF = "CLOSESWF"; - + private static final Logger logger = Logger.getLogger(MainPanel.class.getName()); public void setPercent(int percent) { @@ -314,17 +314,17 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec exportSelectionMenuItem.setActionCommand(MainFrameRibbonMenu.ACTION_EXPORT_SEL); exportSelectionMenuItem.addActionListener(this); contextPopupMenu.add(exportSelectionMenuItem); - + final JMenuItem replaceImageSelectionMenuItem = new JMenuItem(translate("button.replace")); replaceImageSelectionMenuItem.setActionCommand(ACTION_REPLACE_IMAGE); replaceImageSelectionMenuItem.addActionListener(this); contextPopupMenu.add(replaceImageSelectionMenuItem); - + final JMenuItem replaceBinarySelectionMenuItem = new JMenuItem(translate("button.replace")); replaceBinarySelectionMenuItem.setActionCommand(ACTION_REPLACE_BINARY); replaceBinarySelectionMenuItem.addActionListener(this); contextPopupMenu.add(replaceBinarySelectionMenuItem); - + final JMenuItem closeSelectionMenuItem = new JMenuItem(translate("contextmenu.closeSwf")); closeSelectionMenuItem.setActionCommand(ACTION_CLOSE_SWF); closeSelectionMenuItem.addActionListener(this); @@ -368,7 +368,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec replaceBinarySelectionMenuItem.setVisible(false); closeSelectionMenuItem.setVisible(false); moveTagMenu.setVisible(false); - + if (paths.length == 1) { TreeNode treeNode = (TreeNode) paths[0].getLastPathComponent(); @@ -409,7 +409,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec moveTagMenu.setVisible(true); } } - + removeMenuItem.setVisible(allSelectedIsTag); exportSelectionMenuItem.setEnabled(hasExportableNodes()); contextPopupMenu.show(e.getComponent(), e.getX(), e.getY()); @@ -417,7 +417,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } }); } - + private JPanel createWelcomePanel() { JPanel welcomePanel = new JPanel(); welcomePanel.setLayout(new BoxLayout(welcomePanel, BoxLayout.Y_AXIS)); @@ -471,7 +471,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec imagesCard.add(imageButtonsPanel, BorderLayout.SOUTH); return imagesCard; } - + private JPanel createBinaryCard() { JPanel binaryCard = new JPanel(new BorderLayout()); binaryPanel = new BinaryPanel(); @@ -487,19 +487,19 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec binaryCard.add(binaryButtonsPanel, BorderLayout.SOUTH); return binaryCard; } - + private void showHideImageReplaceButton(boolean show) { imageReplaceButton.setVisible(show); setImageButtonPanelVisibility(); } - + private void setImageButtonPanelVisibility() { // hide button panel when no button is visible // now there is only one button, later add here the other buttons boolean visible = imageReplaceButton.isVisible(); imageButtonsPanel.setVisible(visible); } - + public String translate(String key) { return mainFrame.translate(key); } @@ -510,9 +510,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec this.mainFrame = mainFrame; this.mainMenu = mainMenu; this.flashPanel = flashPanel; - + mainFrame.setTitle(ApplicationInfo.applicationVerName); - + setLayout(new BorderLayout()); swfs = new ArrayList<>(); @@ -611,7 +611,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec }); createContextMenu(); - + statusPanel = new MainFrameStatusPanel(this); add(statusPanel, BorderLayout.SOUTH); @@ -623,11 +623,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec textValue.setEditable(false); //textValue.setFont(UIManager.getFont("TextField.font")); - JPanel textButtonsPanel = new JPanel(); textButtonsPanel.setLayout(new FlowLayout()); - textSaveButton = new JButton(translate("button.save"), View.getIcon("save16")); textSaveButton.setMargin(new Insets(3, 3, 3, 10)); textSaveButton.setActionCommand(ACTION_SAVE_TEXT); @@ -659,10 +657,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec fontPanel = new FontPanel(this); displayWithPreview.add(fontPanel, CARDFONTPANEL); - Component leftComponent; - displayPanel = new JPanel(new CardLayout()); if (flashPanel != null) { @@ -687,7 +683,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } }); - + JPanel pan = new JPanel(new BorderLayout()); JLabel prevLabel = new HeaderLabel(translate("swfpreview")); prevLabel.setHorizontalAlignment(SwingConstants.CENTER); @@ -755,7 +751,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec swfPreviewPanel = new SWFPreviwPanel(); displayPanel.add(swfPreviewPanel, CARDSWFPREVIEWPANEL); - displayPanel.add(new JPanel(), CARDEMPTYPANEL); CardLayout cl = (CardLayout) (displayPanel.getLayout()); cl.show(displayPanel, CARDEMPTYPANEL); @@ -807,7 +802,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pan1, detailPanel); splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitPane2, displayPanel); - welcomePanel = createWelcomePanel(); add(welcomePanel, BorderLayout.CENTER); @@ -835,7 +829,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec contentPanel.add(splitPane1, SPLIT_PANE1); add(contentPanel); cl3.show(contentPanel, WELCOME_PANEL); - + tagTree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -848,11 +842,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec detailPanel.setVisible(false); updateUi(); - + //Opening files with drag&drop to main window enableDrop(true); } - + public void load(SWFList newSwfs, boolean first) { swfs.add(newSwfs); @@ -927,7 +921,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : "")); List abcList = swf.abcList; - + boolean hasAbc = !abcList.isEmpty(); if (hasAbc) { @@ -939,21 +933,21 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec cl.show(contentPanel, SPLIT_PANE1); isWelcomeScreen = false; } - + mainMenu.updateComponets(swf, abcList); } - + private void updateUi() { if (!isWelcomeScreen && swfs.isEmpty()) { CardLayout cl = (CardLayout) (contentPanel.getLayout()); cl.show(contentPanel, WELCOME_PANEL); isWelcomeScreen = true; } - + mainFrame.setTitle(ApplicationInfo.applicationVerName); mainMenu.updateComponets(null, null); } - + public void closeAll() { swfs.clear(); oldNode = null; @@ -985,7 +979,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec updateUi(); updateTagTree(); } - + private void updateTagTree() { tagTree.setModel(new TagTreeModel(mainFrame, swfs)); expandSwfNodes(); @@ -1022,9 +1016,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec updateNeeded = true; } } - + refreshTree(); - + if (updateNeeded) { View.execInEventDispatch(new Runnable() { @Override @@ -1044,7 +1038,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec updateNeeded = true; } } - + if (updateNeeded) { View.execInEventDispatch(new Runnable() { @Override @@ -1084,7 +1078,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } }); - } } @@ -1338,7 +1331,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec if (d instanceof ContainerNode) { ContainerNode n = (ContainerNode) d; TreeNodeType nodeType = TagTree.getTreeNodeType(n.getItem()); - if (nodeType == TreeNodeType.IMAGE + if (nodeType == TreeNodeType.IMAGE || nodeType == TreeNodeType.SHAPE || nodeType == TreeNodeType.AS || nodeType == TreeNodeType.MOVIE @@ -1356,12 +1349,12 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } return false; } - + public List exportSelection(AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException { final ExportMode exportMode = ExportMode.get(export.getOption(ExportDialog.OPTION_ACTIONSCRIPT)); final boolean isMp3OrWav = export.getOption(ExportDialog.OPTION_SOUNDS) == 0; final boolean isFormatted = export.getOption(ExportDialog.OPTION_TEXTS) == 1; - + List ret = new ArrayList<>(); List sel = getAllSelected(tagTree); @@ -1444,27 +1437,27 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec if (swf == null) { return null; } - + return swf.swfList; } - + public SWF getCurrentSwf() { if (swfs == null || swfs.isEmpty()) { return null; } - + TreeNode treeNode = (TreeNode) tagTree.getLastSelectedPathComponent(); if (treeNode == null) { return swfs.get(0).get(0); } - + if (treeNode instanceof SWFBundleNode) { return null; } - + return treeNode.getItem().getSwf(); } - + private void clearCache() { if (abcPanel != null) { abcPanel.decompiledTextArea.clearScriptCache(); @@ -1507,7 +1500,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec reload(true); updateClassesList(); } - + public void searchAs() { if (searchDialog == null) { searchDialog = new SearchDialog(); @@ -1517,7 +1510,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec final String txt = searchDialog.searchField.getText(); if (!txt.isEmpty()) { final SWF swf = getCurrentSwf(); - + new CancellableWorker() { @Override protected Void doInBackground() throws Exception { @@ -1550,18 +1543,18 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec found = true; } } - + if (!found) { View.showMessageDialog(null, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE); } - + return null; } }.execute(); } } } - + private boolean searchText(String txt, boolean ignoreCase, boolean regexp, SWF swf) { if ((txt != null) && (!txt.isEmpty())) { textSearchPanel.setOptions(ignoreCase, regexp); @@ -1585,7 +1578,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } return false; } - + @Override public void updateSearchPos(TextTag item) { TagTreeModel ttm = (TagTreeModel) tagTree.getModel(); @@ -1605,7 +1598,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec reload(true); updateClassesList(); } - + public void renameOneIdentifier(final SWF swf) { if (swf.fileAttributes.actionScript3) { final int multiName = abcPanel.decompiledTextArea.getMultinameUnderCursor(); @@ -1653,7 +1646,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } } - + public void exportFla(final SWF swf) { JFileChooser fc = new JFileChooser(); String selDir = Configuration.lastOpenDir.get(); @@ -1735,7 +1728,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec }.execute(); } } - + public void export(final boolean onlySel) { final ExportDialog export = new ExportDialog(); export.setVisible(true); @@ -1795,7 +1788,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } } - + public void restoreControlFlow(final boolean all) { Main.startWork(translate("work.restoringControlFlow")); if ((!all) || confirmExperimental()) { @@ -1834,7 +1827,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec }.execute(); } } - + public void renameIdentifiers(final SWF swf) { if (confirmExperimental()) { final RenameType renameType = new RenameDialog().display(); @@ -1876,7 +1869,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } } - + public void deobfuscate() { if (deobfuscationDialog == null) { deobfuscationDialog = new DeobfuscationDialog(); @@ -1938,7 +1931,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec }.execute(); } } - + public void removeNonScripts(SWF swf) { List tags = new ArrayList<>(swf.tags); for (Tag tag : tags) { @@ -1950,7 +1943,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec showCard(CARDEMPTYPANEL); refreshTree(); } - + public void refreshDecompiled() { clearCache(); if (abcPanel != null) { @@ -1959,7 +1952,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec reload(true); updateClassesList(); } - + public boolean saveText(TextTag textTag, String text) { try { if (textTag.setFormattedText(new MissingCharacterHandler() { @@ -1987,7 +1980,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } return false; } - + @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { @@ -1998,72 +1991,36 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec reload(true); } break; - case ACTION_REPLACE_IMAGE: - { - Object tagObj = tagTree.getLastSelectedPathComponent(); - if (tagObj == null) { - return; - } - - TreeItem item = null; - if (tagObj instanceof TreeNode) { - item = ((TreeNode) tagObj).getItem(); - } - if (item instanceof ImageTag) { - ImageTag it = (ImageTag) item; - if (it.importSupported()) { - JFileChooser fc = new JFileChooser(); - fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get())); - fc.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return (f.getName().toLowerCase().endsWith(".jpg")) - || (f.getName().toLowerCase().endsWith(".jpeg")) - || (f.getName().toLowerCase().endsWith(".gif")) - || (f.getName().toLowerCase().endsWith(".png")) - || (f.isDirectory()); - } - - @Override - public String getDescription() { - return translate("filter.images"); - } - }); - JFrame f = new JFrame(); - View.setWindowIcon(f); - int returnVal = fc.showOpenDialog(f); - if (returnVal == JFileChooser.APPROVE_OPTION) { - Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); - File selfile = Helper.fixDialogFile(fc.getSelectedFile()); - byte[] data = Helper.readFile(selfile.getAbsolutePath()); - try { - it.setImage(data); - it.getSwf().clearImageCache(); - } catch (IOException ex) { - Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, "Invalid image", ex); - View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); - } - reload(true); - } - } - } + case ACTION_REPLACE_IMAGE: { + Object tagObj = tagTree.getLastSelectedPathComponent(); + if (tagObj == null) { + return; } - break; - case ACTION_REPLACE_BINARY: - { - Object tagObj = tagTree.getLastSelectedPathComponent(); - if (tagObj == null) { - return; - } - TreeItem item = null; - if (tagObj instanceof TreeNode) { - item = ((TreeNode) tagObj).getItem(); - } - if (tagObj instanceof DefineBinaryDataTag) { - DefineBinaryDataTag bt = (DefineBinaryDataTag) item; + TreeItem item = null; + if (tagObj instanceof TreeNode) { + item = ((TreeNode) tagObj).getItem(); + } + if (item instanceof ImageTag) { + ImageTag it = (ImageTag) item; + if (it.importSupported()) { JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get())); + fc.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return (f.getName().toLowerCase().endsWith(".jpg")) + || (f.getName().toLowerCase().endsWith(".jpeg")) + || (f.getName().toLowerCase().endsWith(".gif")) + || (f.getName().toLowerCase().endsWith(".png")) + || (f.isDirectory()); + } + + @Override + public String getDescription() { + return translate("filter.images"); + } + }); JFrame f = new JFrame(); View.setWindowIcon(f); int returnVal = fc.showOpenDialog(f); @@ -2071,12 +2028,46 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); File selfile = Helper.fixDialogFile(fc.getSelectedFile()); byte[] data = Helper.readFile(selfile.getAbsolutePath()); - bt.binaryData = data; + try { + it.setImage(data); + it.getSwf().clearImageCache(); + } catch (IOException ex) { + Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, "Invalid image", ex); + View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); + } reload(true); } } } - break; + } + break; + case ACTION_REPLACE_BINARY: { + Object tagObj = tagTree.getLastSelectedPathComponent(); + if (tagObj == null) { + return; + } + + TreeItem item = null; + if (tagObj instanceof TreeNode) { + item = ((TreeNode) tagObj).getItem(); + } + if (tagObj instanceof DefineBinaryDataTag) { + DefineBinaryDataTag bt = (DefineBinaryDataTag) item; + JFileChooser fc = new JFileChooser(); + fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get())); + JFrame f = new JFrame(); + View.setWindowIcon(f); + int returnVal = fc.showOpenDialog(f); + if (returnVal == JFileChooser.APPROVE_OPTION) { + Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); + File selfile = Helper.fixDialogFile(fc.getSelectedFile()); + byte[] data = Helper.readFile(selfile.getAbsolutePath()); + bt.binaryData = data; + reload(true); + } + } + } + break; case ACTION_REMOVE_ITEM: List sel = getSelected(tagTree); @@ -2119,10 +2110,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } break; - case ACTION_CLOSE_SWF: - { - Main.closeFile(getCurrentSwfList()); - } + case ACTION_CLOSE_SWF: { + Main.closeFile(getCurrentSwfList()); + } } if (Main.isWorking()) { return; @@ -2210,7 +2200,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec oldNode = treeNode; - TreeItem tagObj = treeNode.getItem(); + TreeItem tagObj = treeNode.getItem(); oldTag = tagObj; @@ -2272,7 +2262,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec setSourceWorker = worker; Main.startWork(translate("work.decompiling") + "...", worker); } - + showDetail(DETAILCARDAS3NAVIGATOR); showCard(CARDACTIONSCRIPT3PANEL); return; @@ -2280,7 +2270,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec showDetail(DETAILCARDEMPTYPANEL); } - if (treeNode instanceof SWFNode) { SWFNode swfNode = (SWFNode) treeNode; SWF swf = swfNode.getItem(); @@ -2356,7 +2345,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } else if (((tagObj instanceof FrameNodeItem) && ((FrameNodeItem) tagObj).isDisplayed()) || ((tagObj instanceof CharacterTag) || (tagObj instanceof FontTag)) && (tagObj instanceof Tag)) { ((CardLayout) viewerCards.getLayout()).show(viewerCards, FLASH_VIEWER_CARD); createAndShowTempSwf(tagObj); - + if (tagObj instanceof TextTag) { TextTag textTag = (TextTag) tagObj; parametersPanel.setVisible(true); @@ -2375,7 +2364,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec showCard(CARDEMPTYPANEL); } } - + private void createAndShowTempSwf(Object tagObj) { SWF swf; try { @@ -2386,7 +2375,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec tempFile.deleteOnExit(); Color backgroundColor = View.swfBackgroundColor; - + if (tagObj instanceof FontTag) { //Fonts are always black on white backgroundColor = View.DEFAULT_BACKGROUND_COLOR; } @@ -2596,7 +2585,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec List actions; DoActionTag doa; - doa = new DoActionTag(null, new byte[]{}, SWF.DEFAULT_VERSION, 0); actions = ASMParser.parse(0, 0, false, "ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\"\n" @@ -2617,7 +2605,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); - actions = ASMParser.parse(0, 0, false, "ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\" \"start\"\n" + "StopSounds\n" @@ -2689,7 +2676,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); - actions = ASMParser.parse(0, 0, false, "StopSounds\n" + "Stop", SWF.DEFAULT_VERSION, false); @@ -2697,7 +2683,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); - sos2.writeTag(new ShowFrameTag(null)); if (flashPanel != null) { flashPanel.specialPlayback = true; @@ -2728,7 +2713,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec sos2.writeTag(new ShowFrameTag(null)); } - }//not showframe sos2.writeTag(new EndTag(null)); @@ -2743,7 +2727,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec sos.write(data); fos.flush(); } - + showCard(CARDFLASHPANEL); if (flashPanel != null) { flashPanel.displaySWF(tempFile.getAbsolutePath(), backgroundColor, frameRate); @@ -2775,14 +2759,14 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec expandSwfNodes(); expandTreeNodes(tagTree, expandedNodes); } - + public void expandSwfNodes() { TreeModel model = tagTree.getModel(); Object node = model.getRoot(); int childCount = model.getChildCount(node); for (int j = 0; j < childCount; j++) { Object child = model.getChild(node, j); - tagTree.expandPath(new TreePath(new Object[] {node, child})); + tagTree.expandPath(new TreePath(new Object[]{node, child})); } } @@ -2854,7 +2838,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } private boolean isFreeing; - + @Override public boolean isFreeing() { return isFreeing; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java b/trunk/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java index ff64dfd0b..98b02dd4c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java @@ -67,7 +67,6 @@ public class MyProgressBarUI extends SubstanceProgressBarUI { displayTimeline.setEase(new Spline(0.4f)); AnimationConfigurationManager.getInstance().configureTimeline( displayTimeline);*/ - boolean isInCellRenderer = (SwingUtilities.getAncestorOfClass( CellRendererPane.class, progressBar) != null); if (false) {//currValue > 0 && !isInCellRenderer && Math.abs(pixelDelta) > 5) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java b/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java index 2efa136cd..97e052b3b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java @@ -155,7 +155,7 @@ public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuB .getBorderPainter(commandButton); BufferedImage fullAlphaBackground = RibbonApplicationMenuButtonBackgroundDelegate .getFullAlphaBackground(b, fillPainter, borderPainter, - commandButton.getWidth(), commandButton.getHeight()); + commandButton.getWidth(), commandButton.getHeight()); g2d.drawImage(fullAlphaBackground, 0, 0, null); // Paint the icon @@ -166,7 +166,6 @@ public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuB iw.setDimension(b.getSize()); }*/ - if (icon != null) { int iconWidth = icon.getIconWidth(); int iconHeight = icon.getIconHeight(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuPopupPanelUI.java b/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuPopupPanelUI.java index 42d13ce7d..23be2c937 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuPopupPanelUI.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuPopupPanelUI.java @@ -55,67 +55,66 @@ public class MyRibbonApplicationMenuPopupPanelUI extends BasicRibbonApplicationM super.installComponents(); Border newBorder = new CompoundBorder(new SubstanceBorder(new Insets(2, 2, 2, 2)), new Border() { - @Override - public boolean isBorderOpaque() { - return true; - } + @Override + public boolean isBorderOpaque() { + return true; + } - @Override - public Insets getBorderInsets(Component c) { - return new Insets(18, 0, 0, 0); - } + @Override + public Insets getBorderInsets(Component c) { + return new Insets(18, 0, 0, 0); + } - @Override - public void paintBorder(Component c, Graphics g, int x, int y, - int width, int height) { - SubstanceColorScheme bgFillScheme = SubstanceColorSchemeUtilities + @Override + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) { + SubstanceColorScheme bgFillScheme = SubstanceColorSchemeUtilities .getColorScheme(c, - ColorSchemeAssociationKind.HIGHLIGHT, - ComponentState.ENABLED); - SubstanceColorScheme bgBorderScheme = SubstanceColorSchemeUtilities + ColorSchemeAssociationKind.HIGHLIGHT, + ComponentState.ENABLED); + SubstanceColorScheme bgBorderScheme = SubstanceColorSchemeUtilities .getColorScheme(c, - ColorSchemeAssociationKind.HIGHLIGHT_BORDER, - ComponentState.ENABLED); - HighlightPainterUtils.paintHighlight(g, null, c, new Rectangle( - x, y, width, height), 0.0f, null, bgFillScheme, - bgBorderScheme); + ColorSchemeAssociationKind.HIGHLIGHT_BORDER, + ComponentState.ENABLED); + HighlightPainterUtils.paintHighlight(g, null, c, new Rectangle( + x, y, width, height), 0.0f, null, bgFillScheme, + bgBorderScheme); - // draw the application menu button - JRibbonApplicationMenuButton rendererButton = new JRibbonApplicationMenuButton( - applicationMenuPopupPanel.getAppMenuButton() - .getRibbon()); + // draw the application menu button + JRibbonApplicationMenuButton rendererButton = new JRibbonApplicationMenuButton( + applicationMenuPopupPanel.getAppMenuButton() + .getRibbon()); - JRibbonApplicationMenuButton appMenuButton = applicationMenuPopupPanel + JRibbonApplicationMenuButton appMenuButton = applicationMenuPopupPanel .getAppMenuButton(); - rendererButton.applyComponentOrientation(appMenuButton - .getComponentOrientation()); + rendererButton.applyComponentOrientation(appMenuButton + .getComponentOrientation()); - rendererButton.setPopupKeyTip(appMenuButton.getPopupKeyTip()); - rendererButton.getPopupModel().setPopupShowing(true); - rendererButton.setDisplayState(appMenuButton.getDisplayState()); - rendererButton.setIcon(((MyRibbonApplicationMenuButtonUI) appMenuButton.getUI()).getClickIcon()); + rendererButton.setPopupKeyTip(appMenuButton.getPopupKeyTip()); + rendererButton.getPopupModel().setPopupShowing(true); + rendererButton.setDisplayState(appMenuButton.getDisplayState()); + rendererButton.setIcon(((MyRibbonApplicationMenuButtonUI) appMenuButton.getUI()).getClickIcon()); - rendererButton.getPopupModel().setRollover(false); - rendererButton.getPopupModel().setPressed(true); - rendererButton.getPopupModel().setArmed(true); + rendererButton.getPopupModel().setRollover(false); + rendererButton.getPopupModel().setPressed(true); + rendererButton.getPopupModel().setArmed(true); + CellRendererPane buttonRendererPane = new CellRendererPane(); + Point buttonLoc = appMenuButton.getLocationOnScreen(); + Point panelLoc = c.getLocationOnScreen(); - CellRendererPane buttonRendererPane = new CellRendererPane(); - Point buttonLoc = appMenuButton.getLocationOnScreen(); - Point panelLoc = c.getLocationOnScreen(); + buttonRendererPane.setBounds(panelLoc.x - buttonLoc.x, + panelLoc.y - buttonLoc.y, appMenuButton.getWidth(), + appMenuButton.getHeight()); - buttonRendererPane.setBounds(panelLoc.x - buttonLoc.x, - panelLoc.y - buttonLoc.y, appMenuButton.getWidth(), - appMenuButton.getHeight()); - - buttonRendererPane.paintComponent(g, rendererButton, - (Container) c, -panelLoc.x + buttonLoc.x, -panelLoc.y - + buttonLoc.y, appMenuButton.getWidth(), - appMenuButton.getHeight(), true); - /*g.setColor(Color.red); - g.fillRect(0, 0, width,height);*/ - } - }); + buttonRendererPane.paintComponent(g, rendererButton, + (Container) c, -panelLoc.x + buttonLoc.x, -panelLoc.y + + buttonLoc.y, appMenuButton.getWidth(), + appMenuButton.getHeight(), true); + /*g.setColor(Color.red); + g.fillRect(0, 0, width,height);*/ + } + }); this.applicationMenuPopupPanel.setBorder(newBorder); this.panelLevel2.setBorder(new Border() { @@ -143,8 +142,8 @@ public class MyRibbonApplicationMenuPopupPanelUI extends BasicRibbonApplicationM Graphics2D g2d = (Graphics2D) g.create(); SubstanceColorScheme scheme = SubstanceColorSchemeUtilities .getColorScheme(applicationMenuPopupPanel, - ColorSchemeAssociationKind.BORDER, - ComponentState.ENABLED); + ColorSchemeAssociationKind.BORDER, + ComponentState.ENABLED); g2d.setColor(scheme.getMidColor()); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/OpenFileResult.java b/trunk/src/com/jpexs/decompiler/flash/gui/OpenFileResult.java index 44b6a73f0..d4ec9ba0f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/OpenFileResult.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/OpenFileResult.java @@ -21,7 +21,7 @@ package com.jpexs.decompiler.flash.gui; * @author JPEXS */ public enum OpenFileResult { - + OK, NOT_FOUND, ERROR diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/RecentFilesButton.java b/trunk/src/com/jpexs/decompiler/flash/gui/RecentFilesButton.java index 3a3ee30da..c7b8f4df5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/RecentFilesButton.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/RecentFilesButton.java @@ -26,9 +26,9 @@ import org.pushingpixels.flamingo.api.common.icon.ResizableIcon; public class RecentFilesButton extends JCommandButton { public String fileName; - + public RecentFilesButton(String title, ResizableIcon icon) { super(title, icon); } - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SWFList.java b/trunk/src/com/jpexs/decompiler/flash/gui/SWFList.java index fc2386354..0e74108da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SWFList.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SWFList.java @@ -14,7 +14,6 @@ * 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; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java index bae1cf15c..0e5de583f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SWFPreviwPanel.java @@ -71,7 +71,6 @@ public class SWFPreviwPanel extends JPanel implements FlashDisplay { } }.start(); - } public void stop() { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SaveFileMode.java b/trunk/src/com/jpexs/decompiler/flash/gui/SaveFileMode.java index 883d20fe0..424bc647d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SaveFileMode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SaveFileMode.java @@ -14,7 +14,6 @@ * 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; /** @@ -22,6 +21,6 @@ package com.jpexs.decompiler.flash.gui; * @author JPEXS */ public enum SaveFileMode { - + SAVE, SAVEAS, EXE } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SearchDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/SearchDialog.java index 1205fa3a3..c1996c9cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SearchDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SearchDialog.java @@ -69,7 +69,7 @@ public class SearchDialog extends AppDialog implements ActionListener { panField.add(new JLabel(translate("label.searchtext"))); panField.add(searchField); cnt.add(panField); - + JPanel checkPanel = new JPanel(new FlowLayout()); checkPanel.add(ignoreCaseCheckBox); checkPanel.add(regexpCheckBox); @@ -78,14 +78,14 @@ public class SearchDialog extends AppDialog implements ActionListener { ButtonGroup group = new ButtonGroup(); group.add(searchInASRadioButton); group.add(searchInTextsRadioButton); - + JPanel rbPanel = new JPanel(new FlowLayout()); searchInASRadioButton.setSelected(true); searchInTextsRadioButton.setSelected(false); rbPanel.add(searchInASRadioButton); rbPanel.add(searchInTextsRadioButton); cnt.add(rbPanel); - + cnt.add(panButtons); getRootPane().setDefaultButton(okButton); View.centerScreen(this); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SearchListener.java b/trunk/src/com/jpexs/decompiler/flash/gui/SearchListener.java index 8b236ffd0..d45e8d2c1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SearchListener.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SearchListener.java @@ -14,7 +14,6 @@ * 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; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SearchPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/SearchPanel.java index e6f4c8029..8a722487b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SearchPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SearchPanel.java @@ -14,7 +14,6 @@ * 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.AppStrings; @@ -36,12 +35,13 @@ import jsyntaxpane.actions.DocumentSearchData; * @author JPEXS */ public class SearchPanel extends JPanel implements ActionListener { + static final String ACTION_SEARCH_PREV = "SEARCHPREV"; static final String ACTION_SEARCH_NEXT = "SEARCHNEXT"; static final String ACTION_SEARCH_CANCEL = "SEARCHCANCEL"; private final SearchListener listener; - + private final JLabel searchPos; private int foundPos = 0; private final JLabel searchForLabel; @@ -54,7 +54,7 @@ public class SearchPanel extends JPanel implements ActionListener { super(lm); this.listener = listener; - + JButton prevSearchButton = new JButton(View.getIcon("prev16")); prevSearchButton.setMargin(new Insets(3, 3, 3, 3)); prevSearchButton.addActionListener(this); @@ -77,7 +77,7 @@ public class SearchPanel extends JPanel implements ActionListener { add(cancelSearchButton); setVisible(false); } - + public void showQuickFindDialog(JTextComponent editor) { DocumentSearchData dsd = DocumentSearchData.getFromEditor(editor); dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); @@ -88,7 +88,7 @@ public class SearchPanel extends JPanel implements ActionListener { searchFor = txt; searchForLabel.setText(AppStrings.translate("search.info").replace("%text%", txt) + " "); } - + public boolean setResults(List results) { found = results; if (found.isEmpty()) { @@ -100,22 +100,22 @@ public class SearchPanel extends JPanel implements ActionListener { return true; } } - + public void setOptions(boolean ignoreCase, boolean regExp) { searchIgnoreCase = ignoreCase; searchRegexp = regExp; } - + public void setPos(int pos) { foundPos = pos; doUpdate(); } - + public void clear() { foundPos = 0; found.clear(); } - + private void doUpdate() { SwingUtilities.invokeLater(new Runnable() { @Override @@ -125,7 +125,7 @@ public class SearchPanel extends JPanel implements ActionListener { } }); } - + @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java index f8069552c..17a0f3780 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java @@ -53,7 +53,6 @@ public class SelectLanguageDialog extends AppDialog implements ActionListener { cnt1.setLayout(new BorderLayout()); cnt1.add(cnt, BorderLayout.CENTER); - String currentLanguage = Configuration.locale.get(Locale.getDefault().getLanguage()); boolean found = false; int enIndex = 0; @@ -138,11 +137,11 @@ public class SelectLanguageDialog extends AppDialog implements ActionListener { } }); } - + public static String[] getAvailableLanguages() { return languages; } - + public String display() { setVisible(true); return languageCode; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java b/trunk/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java index 31a2dca6a..a3c0127b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java @@ -30,19 +30,20 @@ public class SwfInMemory { public int version; public long fileSize; public com.jpexs.process.Process process; - + public SwfInMemory(ReReadableInputStream is, int version, long fileSize, com.jpexs.process.Process process) { this.is = is; this.version = version; this.fileSize = fileSize; this.process = process; } - + private static final ResourceBundle resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(LoadFromMemoryFrame.class)); public String translate(String key) { return resourceBundle.getString(key); } + @Override public String toString() { String p = translate("swfitem").replace("%version%", "" + version).replace("%size%", "" + fileSize); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagTree.java b/trunk/src/com/jpexs/decompiler/flash/gui/TagTree.java index e7da67426..6fbbd09d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/TagTree.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/TagTree.java @@ -112,7 +112,7 @@ public class TagTree extends JTree { //setBackground(Color.green); setBackgroundNonSelectionColor(Color.white); //setBackgroundSelectionColor(Color.ORANGE); - + if (treeNode instanceof TreeNode) { if (treeNode.getItem() instanceof Tag) { Tag tag = (Tag) treeNode.getItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java index 9b79a2bd0..756472063 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java @@ -80,7 +80,7 @@ public class TagTreeModel implements TreeModel { swfToSwfNode.put(swf, swfNode); return swfNode; } - + private String translate(String key) { return mainFrame.translate(key); } @@ -152,14 +152,12 @@ public class TagTreeModel implements TreeModel { StringNode soundsNode = new StringNode(new StringItem(translate("node.sounds"), swf)); soundsNode.subNodes.addAll(sounds); - StringNode binaryDataNode = new StringNode(new StringItem(translate("node.binaryData"), swf)); binaryDataNode.subNodes.addAll(binaryData); StringNode fontsNode = new StringNode(new StringItem(translate("node.fonts"), swf)); fontsNode.subNodes.addAll(fonts); - StringNode spritesNode = new StringNode(new StringItem(translate("node.sprites"), swf)); spritesNode.subNodes.addAll(sprites); @@ -240,7 +238,7 @@ public class TagTreeModel implements TreeModel { if (obj == it) { return newPath; } - } + } if (n instanceof TreeNode) { TreeNode nd = (TreeNode) n; if (nd.getItem() == obj) { @@ -339,7 +337,7 @@ public class TagTreeModel implements TreeModel { return clt.getIndexOfChild(clt.getRoot(), child); } return parentNode.subNodes.indexOf(child); - } + } } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/View.java b/trunk/src/com/jpexs/decompiler/flash/gui/View.java index e4e683ab6..6187cc9d3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/View.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/View.java @@ -93,16 +93,16 @@ public class View { //Restore default font for chinese characters SubstanceLookAndFeel.setFontPolicy(new FontPolicy() { - + private final FontSet fontSet = new FontSet() { - - private FontUIResource controlFont; - private FontUIResource menuFont; - private FontUIResource titleFont; - private FontUIResource windowTitleFont; - private FontUIResource smallFont; - private FontUIResource messageFont; - + + private FontUIResource controlFont; + private FontUIResource menuFont; + private FontUIResource titleFont; + private FontUIResource windowTitleFont; + private FontUIResource smallFont; + private FontUIResource messageFont; + @Override public FontUIResource getControlFont() { if (controlFont == null) { @@ -157,7 +157,7 @@ public class View { return messageFont; } }; - + @Override public FontSet getFontSet(String string, UIDefaults uid) { return fontSet; @@ -169,11 +169,8 @@ public class View { } }); - UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL); - - JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); } @@ -212,7 +209,7 @@ public class View { centerScreen(f, 0); // todo, set screen to the currently active screen instead of the first screen in a multi screen setup, (maybe by using the screen where the main window is now classic or ribbon?) } - public static void centerScreen(Window f,int screen) { + public static void centerScreen(Window f, int screen) { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] allDevices = env.getScreenDevices(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 386f0ae39..9948a191f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -102,7 +102,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se public JLabel scriptNameLabel; static final String ACTION_ADD_TRAIT = "ADDTRAIT"; - + public boolean search(String txt, boolean ignoreCase, boolean regexp) { if ((txt != null) && (!txt.isEmpty())) { searchPanel.setOptions(ignoreCase, regexp); @@ -112,9 +112,9 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se if (scriptsNode.getItem() instanceof ClassesListTreeModel) { ClassesListTreeModel clModel = (ClassesListTreeModel) scriptsNode.getItem(); List> allpacks = clModel.getList(); - final Pattern pat = regexp ? - Pattern.compile(txt, ignoreCase ? Pattern.CASE_INSENSITIVE : 0) : - Pattern.compile(Pattern.quote(txt), ignoreCase ? Pattern.CASE_INSENSITIVE : 0); + final Pattern pat = regexp + ? Pattern.compile(txt, ignoreCase ? Pattern.CASE_INSENSITIVE : 0) + : Pattern.compile(Pattern.quote(txt), ignoreCase ? Pattern.CASE_INSENSITIVE : 0); int pos = 0; for (final MyEntry item : allpacks) { pos++; @@ -207,7 +207,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se } }); - return table; } @@ -254,7 +253,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se abcComboBox.setModel(new ABCComboBoxModel(new ArrayList())); navigator.clearABC(); } - + public void setSwf(SWF swf) { if (this.swf != swf) { this.swf = swf; @@ -268,7 +267,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se navigator.setABC(swf.abcList, abc); } } - + public void switchAbc(int index) { listIndex = index; @@ -292,7 +291,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se Logger.getLogger(ABCPanel.class.getName()).log(Level.SEVERE, null, ex); } - splitPane.setDividerLocation(Configuration.guiAvm2SplitPaneDividerLocation.get(splitPane.getWidth() * 1 / 2)); } @@ -334,7 +332,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se newTraitButton.setToolTipText(AppStrings.translate("button.addtrait")); iconsPanel.add(newTraitButton); - scriptNameLabel = new JLabel("-"); scriptNameLabel.setAlignmentX(0); iconsPanel.setAlignmentX(0); @@ -367,14 +364,12 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se decompiledTextArea.setContentType("text/actionscript"); decompiledTextArea.setFont(new Font("Monospaced", Font.PLAIN, decompiledTextArea.getFont().getSize())); - JPanel pan2 = new JPanel(); pan2.setLayout(new BorderLayout()); pan2.add((abcComboBox = new JComboBox<>(new ABCComboBoxModel(new ArrayList()))), BorderLayout.NORTH); navigator = new TraitsList(this); - navPanel = new JPanel(new BorderLayout()); JPanel navIconsPanel = new JPanel(); navIconsPanel.setLayout(new BoxLayout(navIconsPanel, BoxLayout.X_AXIS)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanelSearchResult.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanelSearchResult.java index 4513105bc..f2434b4b5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanelSearchResult.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanelSearchResult.java @@ -14,7 +14,6 @@ * 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.abc; import com.jpexs.decompiler.flash.abc.ClassPath; @@ -25,7 +24,7 @@ import com.jpexs.decompiler.flash.abc.ScriptPack; * @author JPEXS */ public class ABCPanelSearchResult { - + public ScriptPack scriptPack; public ClassPath classPath; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index e75bf99b7..1cb3c9fb7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -70,7 +70,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi abc.bodies[bodyIndex].code.toASMSource(abc.constants, trait, abc.method_info[abc.bodies[bodyIndex].method_info], abc.bodies[bodyIndex], exportMode, writer); return new HilightedText(writer); } - + public void setHex(ExportMode exportMode, boolean force) { if (this.exportMode == exportMode & !force) { return; @@ -250,7 +250,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi bodyIndex = -1; setCaretPosition(0); } - + public void selectInstruction(int pos) { String text = getText(); int lineCnt = 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java index 8fa248e89..96bcf0d9d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -95,18 +95,18 @@ public class ClassesListTreeModel implements TreeModel, TreeElementItem { public ClassesListTreeModel(SWF swf) { this(swf, null); } - + public ClassesListTreeModel(SWF swf, String filter) { this.swf = swf; this.list = swf.getAS3Packs(); setFilter(filter); } - + @Override public SWF getSwf() { return swf; } - + public final void update() { this.list = swf.getAS3Packs(); TreeModelEvent event = new TreeModelEvent(this, new TreePath(classTree.getRoot())); @@ -114,7 +114,7 @@ public class ClassesListTreeModel implements TreeModel, TreeElementItem { listener.treeStructureChanged(event); } } - + public final void setFilter(String filter) { classTree = new Tree(); filter = (filter == null || filter.isEmpty()) ? null : filter.toLowerCase(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index f79d8a441..288104225 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -420,8 +420,6 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL } } - - setCaretPosition(0); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java index 81939beba..b4da99644 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DeobfuscationDialog.java @@ -76,8 +76,6 @@ public class DeobfuscationDialog extends AppDialog implements ActionListener { codeProcessingLevel.setAlignmentX(Component.CENTER_ALIGNMENT); //codeProcessingLevel.setSize(300, 200); - - //codeProcessingLevel.setBounds(30, 25, getWidth() - 60, 125); codeProcessingLevel.setAlignmentX(0.5f); add(codeProcessingLevel); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java index 1ac9ad524..5a3af3ceb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java @@ -44,13 +44,11 @@ public class IconListRenderer extends DefaultListCellRenderer { boolean isSelected, boolean cellHasFocus) { // Get the renderer component from parent class - - JLabel label = - (JLabel) super.getListCellRendererComponent(list, - value, index, isSelected, cellHasFocus); + JLabel label + = (JLabel) super.getListCellRendererComponent(list, + value, index, isSelected, cellHasFocus); // Get icon to use for the list item value - TraitsListItem tli = (TraitsListItem) value; if (tli.getType() == TraitsListItem.Type.CONST) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java index 03baeb3fd..5e0fc938d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java @@ -156,11 +156,11 @@ public class MethodCodePanel extends JPanel implements ActionListener { } private ExportMode getExportMode() { - ExportMode exportMode = hexOnlyButton.isSelected() ? ExportMode.HEX : - (hexButton.isSelected() ? ExportMode.PCODEWITHHEX : ExportMode.PCODE); + ExportMode exportMode = hexOnlyButton.isSelected() ? ExportMode.HEX + : (hexButton.isSelected() ? ExportMode.PCODEWITHHEX : ExportMode.PCODE); return exportMode; } - + public void setEditMode(boolean val) { ExportMode exportMode = getExportMode(); if (val) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java index c8e44fe17..0fde53eff 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java @@ -107,16 +107,13 @@ public class NewTraitDialog extends AppDialog implements ActionListener { accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")"; } - //optionsPanel.add(new JLabel(translate("label.access"))); accessComboBox = new JComboBox<>(accessStrings); optionsPanel.add(accessComboBox); optionsPanel.add(typeComboBox); - //optionsPanel.add(new JLabel(translate("label.name"))); - nameField = new JTextField(); nameField.setPreferredSize(new Dimension(300, nameField.getPreferredSize().height)); optionsPanel.add(nameField); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/RootABCContainerTag.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/RootABCContainerTag.java index a98126f35..cfb17286b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/RootABCContainerTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/RootABCContainerTag.java @@ -37,7 +37,7 @@ public class RootABCContainerTag implements ABCContainerTag { } return -1; } - + @Override public String toString() { return " - all - "; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/Tree.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/Tree.java index 64c75bc56..94b1c8af3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/Tree.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/Tree.java @@ -24,7 +24,7 @@ import java.util.StringTokenizer; public class Tree { private final TreeElement ROOT = new AS3PackageNode("", "", null, null); - + public void add(String name, String path, ScriptPack item) { StringTokenizer st = new StringTokenizer(path, "."); TreeElement parent = ROOT; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java index b1cafd441..2242b075e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java @@ -40,7 +40,7 @@ public class UndoFixedEditorPane extends JEditorPane { if (getText() != t) { // OK to check reference equals, because the string object should be the same super.setText(null); - if(t.length() > Configuration.syntaxHighlightLimit.get()){ + if (t.length() > Configuration.syntaxHighlightLimit.get()) { setContentType("text/plain"); } else { if (!getContentType().equals(contentType)) { @@ -57,12 +57,12 @@ public class UndoFixedEditorPane extends JEditorPane { if (!isEditable()) { // disable Ctrl-E: delete line // and Ctrl-H: Search and replace - if ((ke.getKeyCode() == KeyEvent.VK_E && ke.isControlDown()) || - (ke.getKeyCode() == KeyEvent.VK_H && ke.isControlDown())) { + if ((ke.getKeyCode() == KeyEvent.VK_E && ke.isControlDown()) + || (ke.getKeyCode() == KeyEvent.VK_H && ke.isControlDown())) { return; } } - + super.processKeyEvent(ke); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DecimalTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DecimalTableModel.java index f420f3158..dfb777749 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DecimalTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DecimalTableModel.java @@ -31,10 +31,9 @@ public class DecimalTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class DecimalTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class DecimalTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class DecimalTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class DecimalTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class DecimalTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -124,10 +118,8 @@ public class DecimalTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DoubleTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DoubleTableModel.java index 50cc6117a..310ee46dc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DoubleTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/DoubleTableModel.java @@ -31,10 +31,9 @@ public class DoubleTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class DoubleTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class DoubleTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class DoubleTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class DoubleTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class DoubleTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -126,10 +120,8 @@ public class DoubleTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/IntTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/IntTableModel.java index 07856709e..cbdc6d854 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/IntTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/IntTableModel.java @@ -31,10 +31,9 @@ public class IntTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class IntTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class IntTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class IntTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class IntTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class IntTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -124,10 +118,8 @@ public class IntTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java index a1d8d4a12..e87d8bd5f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java @@ -32,10 +32,9 @@ public class MultinameTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -49,9 +48,9 @@ public class MultinameTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -62,10 +61,9 @@ public class MultinameTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -77,9 +75,8 @@ public class MultinameTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -90,11 +87,9 @@ public class MultinameTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -107,8 +102,7 @@ public class MultinameTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -155,10 +149,8 @@ public class MultinameTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceSetTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceSetTableModel.java index aa6ad6860..35bbe175d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceSetTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceSetTableModel.java @@ -31,10 +31,9 @@ public class NamespaceSetTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class NamespaceSetTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class NamespaceSetTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class NamespaceSetTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class NamespaceSetTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class NamespaceSetTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -130,10 +124,8 @@ public class NamespaceSetTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java index 9315bf786..89734272a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java @@ -31,10 +31,9 @@ public class NamespaceTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class NamespaceTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class NamespaceTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class NamespaceTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class NamespaceTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class NamespaceTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -135,10 +129,8 @@ public class NamespaceTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/StringTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/StringTableModel.java index 5103448fc..0dacf8e3b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/StringTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/StringTableModel.java @@ -31,10 +31,9 @@ public class StringTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class StringTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class StringTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class StringTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class StringTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class StringTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -124,10 +118,8 @@ public class StringTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/UIntTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/UIntTableModel.java index 5350d474d..e28765faa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/UIntTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/UIntTableModel.java @@ -31,10 +31,9 @@ public class UIntTableModel implements TableModel { } /** - * Returns the number of rows in the model. A - * JTable uses this method to determine how many rows it should - * display. This method should be quick, as it is called frequently during - * rendering. + * Returns the number of rows in the model. A JTable uses this + * method to determine how many rows it should display. This method should + * be quick, as it is called frequently during rendering. * * @return the number of rows in the model * @see #getColumnCount @@ -48,9 +47,9 @@ public class UIntTableModel implements TableModel { } /** - * Returns the number of columns in the model. A - * JTable uses this method to determine how many columns it - * should create and display by default. + * Returns the number of columns in the model. A JTable uses + * this method to determine how many columns it should create and display by + * default. * * @return the number of columns in the model * @see #getRowCount @@ -61,10 +60,9 @@ public class UIntTableModel implements TableModel { } /** - * Returns the name of the column at - * columnIndex. This is used to initialize the table's column - * header name. Note: this name does not need to be unique; two columns in a - * table can have the same name. + * Returns the name of the column at columnIndex. This is used + * to initialize the table's column header name. Note: this name does not + * need to be unique; two columns in a table can have the same name. * * @param columnIndex the index of the column * @return the name of the column @@ -76,9 +74,8 @@ public class UIntTableModel implements TableModel { /** * Returns the most specific superclass for all the cell values in the - * column. This is used by the - * JTable to set up a default renderer and editor for the - * column. + * column. This is used by the JTable to set up a default + * renderer and editor for the column. * * @param columnIndex the index of the column * @return the common ancestor class of the object values in the model. @@ -89,11 +86,9 @@ public class UIntTableModel implements TableModel { } /** - * Returns true if the cell at - * rowIndex and - * columnIndex is editable. Otherwise, - * setValueAt on the cell will not change the value of that - * cell. + * Returns true if the cell at rowIndex and + * columnIndex is editable. Otherwise, setValueAt + * on the cell will not change the value of that cell. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried @@ -106,8 +101,7 @@ public class UIntTableModel implements TableModel { } /** - * Returns the value for the cell at - * columnIndex and + * Returns the value for the cell at columnIndex and * rowIndex. * * @param rowIndex the row whose value is to be queried @@ -124,10 +118,8 @@ public class UIntTableModel implements TableModel { } /** - * Sets the value in the cell at - * columnIndex and - * rowIndex to - * aValue. + * Sets the value in the cell at columnIndex and + * rowIndex to aValue. * * @param aValue the new value * @param rowIndex the row whose value is to be changed diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/AS3PackageNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/AS3PackageNode.java index 8a650a7e7..f23c1238c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/AS3PackageNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/AS3PackageNode.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.treeitems.AS3PackageNodeItem; * @author JPEXS */ public class AS3PackageNode extends TreeElement { - + public AS3PackageNode(String name, String path, AS3PackageNodeItem item, TreeElement parent) { super(name, path, item, parent); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ClassesListNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ClassesListNode.java index 7ab22e75d..f8ea60a15 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ClassesListNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ClassesListNode.java @@ -24,7 +24,7 @@ import com.jpexs.decompiler.flash.treenodes.TreeNode; * @author JPEXS */ public class ClassesListNode extends TreeNode { - + public ClassesListNode(ClassesListTreeModel item) { super(item); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ScriptPackNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ScriptPackNode.java index 42d27467b..4b2134c6c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ScriptPackNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/treenodes/ScriptPackNode.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.abc.ScriptPack; * @author JPEXS */ public class ScriptPackNode extends TreeElement { - + public ScriptPackNode(String name, String path, ScriptPack item, TreeElement parent) { super(name, path, item, parent); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index b47426811..7960a1821 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -121,7 +121,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene public SearchPanel searchPanel; private Cache cache = Cache.getInstance(true); private CancellableWorker setSourceWorker; - + public void clearSource() { lastCode = null; lastASM = null; @@ -265,7 +265,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene } }); } - + private void setEditorText(final String text, final String contentType) { View.execInEventDispatch(new Runnable() { @@ -277,7 +277,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene } }); } - + private void setText(final HilightedText text, final String contentType) { View.execInEventDispatch(new Runnable() { @@ -318,7 +318,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene asm.removeDisassemblyListener(listener); return new HilightedText(writer); } - + public void setHex(ExportMode exportMode) { if (exportMode != ExportMode.HEX) { if (exportMode == ExportMode.PCODE) { @@ -362,7 +362,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene }; return listener; } - + public void setSource(final ASMSource src, final boolean useCache) { if (setSourceWorker != null) { setSourceWorker.cancel(true); @@ -371,7 +371,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene this.src = src; final ASMSource asm = (ASMSource) src; - + CancellableWorker worker = new CancellableWorker() { @Override @@ -482,7 +482,6 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene panB.add(asmLabel, BorderLayout.NORTH); panB.add(panCode, BorderLayout.CENTER); - JPanel buttonsPan = new JPanel(); buttonsPan.setLayout(new FlowLayout()); buttonsPan.add(editButton); @@ -493,7 +492,6 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene saveButton.setMargin(new Insets(3, 3, 3, 10)); cancelButton.setMargin(new Insets(3, 3, 3, 10)); - JPanel decButtonsPan = new JPanel(new FlowLayout()); decButtonsPan.add(editDecompiledButton); decButtonsPan.add(experimentalLabel); @@ -517,7 +515,6 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene saveButton.setVisible(false); cancelButton.setVisible(false); - saveDecompiledButton.addActionListener(this); saveDecompiledButton.setActionCommand(ACTION_SAVE_DECOMPILED); editDecompiledButton.addActionListener(this); @@ -540,7 +537,6 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene decLabel.setHorizontalAlignment(SwingConstants.CENTER); //decLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); - setLayout(new BorderLayout()); add(splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panA, panB), BorderLayout.CENTER); splitPane.setResizeWeight(0.5); @@ -767,11 +763,11 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene } private ExportMode getExportMode() { - ExportMode exportMode = hexOnlyButton.isSelected() ? ExportMode.HEX : - (hexButton.isSelected() ? ExportMode.PCODEWITHHEX : ExportMode.PCODE); + ExportMode exportMode = hexOnlyButton.isSelected() ? ExportMode.HEX + : (hexButton.isSelected() ? ExportMode.PCODEWITHHEX : ExportMode.PCODE); return exportMode; } - + @Override public void updateSearchPos(ASMSource item) { TagTreeModel ttm = (TagTreeModel) mainPanel.tagTree.getModel(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java b/trunk/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java index 1714d8428..c77a13b62 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/helpers/CheckResources.java @@ -50,9 +50,9 @@ import java.util.logging.Logger; public class CheckResources { public static void checkResources() { - Class[] classes = new Class[] { - AboutDialog.class, - AdvancedSettingsDialog.class, + Class[] classes = new Class[]{ + AboutDialog.class, + AdvancedSettingsDialog.class, ErrorLogFrame.class, ExportDialog.class, FontEmbedDialog.class, @@ -70,8 +70,7 @@ public class CheckResources { ProxyFrame.class, DeobfuscationDialog.class, NewTraitDialog.class, - UsageFrame.class, - }; + UsageFrame.class,}; for (Class clazz : classes) { checkResources(clazz); } @@ -117,7 +116,7 @@ public class CheckResources { Logger.getLogger(CheckResources.class.getName()).log(Level.SEVERE, null, ex); } } - + private static String getResourcePath(Class cls, String lang) { String name = cls.getName(); if (name.startsWith("com.jpexs.decompiler.flash.gui.")) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index 842c0ea36..fb67fa8ad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -226,7 +226,7 @@ public class FlashPlayerPanel extends Panel implements FlashDisplay { } String exePath = appDir + "lib\\FlashPlayer.exe"; File f = new File(exePath); - if(!f.exists()) { + if (!f.exists()) { return; } @@ -267,12 +267,12 @@ public class FlashPlayerPanel extends Panel implements FlashDisplay { if (!executed) { execute(); /* - //How about commenting this out? Will it work? Let's try... - try { - Thread.sleep(1000); - } catch (InterruptedException ex) { - Logger.getLogger(FlashPlayerPanel.class.getName()).log(Level.SEVERE, null, ex); - }*/ + //How about commenting this out? Will it work? Let's try... + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + Logger.getLogger(FlashPlayerPanel.class.getName()).log(Level.SEVERE, null, ex); + }*/ } if (bgColor != null) { setBackground(bgColor); @@ -283,7 +283,7 @@ public class FlashPlayerPanel extends Panel implements FlashDisplay { Kernel32.INSTANCE.WriteFile(pipe, new byte[]{CMD_PLAY}, 1, ibr, null); Kernel32.INSTANCE.WriteFile(pipe, new byte[]{(byte) flash.getBytes().length}, 1, ibr, null); Kernel32.INSTANCE.WriteFile(pipe, flash.getBytes(), flash.getBytes().length, ibr, null); - } + } stopped = false; specialPlaying = false; specialPosition = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java index 9dfda81e6..8783fcfe9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -100,7 +100,6 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe cnt.setLayout(new BorderLayout()); cnt.add(new JScrollPane(swfList), BorderLayout.CENTER); - portField.setPreferredSize(new Dimension(80, portField.getPreferredSize().height)); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new FlowLayout()); @@ -112,7 +111,6 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe JPanel buttonsPanel23 = new JPanel(); buttonsPanel23.setLayout(new BoxLayout(buttonsPanel23, BoxLayout.Y_AXIS)); - JPanel buttonsPanel2 = new JPanel(); buttonsPanel2.setLayout(new FlowLayout()); JButton openButton = new JButton(translate("open")); @@ -132,7 +130,6 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe removeButton.addActionListener(this); buttonsPanel2.add(removeButton); - JPanel buttonsPanel3 = new JPanel(); buttonsPanel3.setLayout(new FlowLayout()); buttonsPanel3.add(new JLabel(translate("sniff"))); @@ -388,10 +385,10 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe * hides the {@code Window}. If the {@code Window} and/or its owner are not * yet displayable, both are made displayable. The {@code Window} will be * validated prior to being made visible. If the {@code Window} is already - * visible, this will bring the {@code Window} to the front.

If - * {@code false}, hides this {@code Window}, its subcomponents, and all of - * its owned children. The {@code Window} and its subcomponents can be made - * visible again with a call to {@code #setVisible(true)}. + * visible, this will bring the {@code Window} to the front.

+ * If {@code false}, hides this {@code Window}, its subcomponents, and all + * of its owned children. The {@code Window} and its subcomponents can be + * made visible again with a call to {@code #setVisible(true)}. * @see java.awt.Component#isDisplayable * @see java.awt.Component#setVisible * @see java.awt.Window#toFront diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFBundleNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFBundleNode.java index 0c5abf639..3aa8f93a8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFBundleNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFBundleNode.java @@ -14,7 +14,6 @@ * 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.treenodes; import com.jpexs.decompiler.flash.gui.SWFList; @@ -26,7 +25,7 @@ import java.util.List; * @author JPEXS */ public class SWFBundleNode extends SWFContainerNode { - + private final String name; public List swfs = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFContainerNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFContainerNode.java index 7e12486c7..811c65e0e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFContainerNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/SWFContainerNode.java @@ -14,7 +14,6 @@ * 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.treenodes; import com.jpexs.decompiler.flash.treeitems.TreeItem; @@ -29,5 +28,5 @@ public abstract class SWFContainerNode extends TreeNode { public SWFContainerNode(TreeItem item) { super(item); } - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/StringNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/StringNode.java index 2294f2b68..de733283d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/StringNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/StringNode.java @@ -24,7 +24,7 @@ import com.jpexs.decompiler.flash.treenodes.TreeNode; * @author JPEXS */ public class StringNode extends TreeNode { - + public StringNode(StringItem item) { super(item); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/TagTreeRoot.java b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/TagTreeRoot.java index 97c38f3d6..cf7a4bc2a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/TagTreeRoot.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/treenodes/TagTreeRoot.java @@ -24,7 +24,7 @@ import com.jpexs.decompiler.flash.treenodes.TreeNode; * @author JPEXS */ public class TagTreeRoot extends TreeNode { - + public TagTreeRoot() { super(new StringItem("root", null)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java index 3bdd597b3..5b184e8b4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java @@ -30,7 +30,7 @@ import java.util.logging.Logger; * @author JPEXS */ public class FileTextWriter extends GraphTextWriter implements AutoCloseable { - + private final Writer writer; private boolean newLine = true; private int indent; @@ -45,13 +45,13 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable { writeToFile(text); return this; } - + @Override public FileTextWriter hilightSpecial(String text, String type, int index) { writeToFile(text); return this; } - + @Override public FileTextWriter append(String str) { writeToFile(str); @@ -99,12 +99,12 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable { public int getLength() { return writtenBytes; } - + @Override public int getIndent() { return indent; } - + private void writeToFile(String str) { if (newLine) { newLine = false; @@ -117,7 +117,7 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable { Logger.getLogger(FileTextWriter.class.getName()).log(Level.SEVERE, null, ex); } } - + private void appendIndent() { for (int i = 0; i < indent; i++) { writeToFile(INDENT_STRING); diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/Freed.java b/trunk/src/com/jpexs/decompiler/flash/helpers/Freed.java index 78bafa4d1..ea7e7e72a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/Freed.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/Freed.java @@ -23,5 +23,6 @@ package com.jpexs.decompiler.flash.helpers; public interface Freed { public boolean isFreeing(); + public void free(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphSourceItemPosition.java b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphSourceItemPosition.java index 3b2c0563d..bd5b2fcfd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphSourceItemPosition.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphSourceItemPosition.java @@ -27,5 +27,5 @@ public class GraphSourceItemPosition { public GraphSourceItem graphSourceItem; public int position; - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java index a657b6aed..1daa93245 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java @@ -24,7 +24,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem; * @author JPEXS */ public class GraphTextWriter { - + public static final String INDENT_STRING = " "; public static final String NEW_LINE = "\r\n"; protected long startTime; @@ -47,11 +47,11 @@ public class GraphTextWriter { public GraphTextWriter startOffset(GraphSourceItem src, int pos) { return this; } - + public GraphTextWriter endOffset() { return this; } - + /** * Highlights specified text as method * @@ -61,11 +61,11 @@ public class GraphTextWriter { public GraphTextWriter startMethod(long index) { return this; } - + public GraphTextWriter endMethod() { return this; } - + /** * Highlights specified text as class * @@ -75,11 +75,11 @@ public class GraphTextWriter { public GraphTextWriter startClass(long index) { return this; } - - public GraphTextWriter endClass() { + + public GraphTextWriter endClass() { return this; } - + /** * Highlights specified text as trait * @@ -89,19 +89,19 @@ public class GraphTextWriter { public GraphTextWriter startTrait(long index) { return this; } - + public GraphTextWriter endTrait() { return this; } - + public GraphTextWriter hilightSpecial(String text, String type) { return this; } - + public GraphTextWriter hilightSpecial(String text, String type, int index) { return this; } - + public static String hilighOffset(String text, long offset) { return ""; } @@ -137,24 +137,24 @@ public class GraphTextWriter { public GraphTextWriter stripSemicolon() { return this; } - + public int getLength() { return 0; } - + public int getIndent() { return 0; } - + public void suspendMeasure() { suspendTime = System.currentTimeMillis(); } - + public void continueMeasure() { long time = System.currentTimeMillis(); startTime += time - suspendTime; } - + @Override public String toString() { return ""; diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightType.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightType.java index 56484a938..ac0d3551a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightType.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightType.java @@ -22,7 +22,7 @@ package com.jpexs.decompiler.flash.helpers; * @author JPEXS */ public enum HilightType { - + TRAIT, CLASS, METHOD, OFFSET, SPECIAL - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java index 91b7fa28d..6b7aca326 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java @@ -59,7 +59,7 @@ public class HilightedText implements Serializable { this.instructionHilights = writer.instructionHilights; this.specialHilights = writer.specialHilights; } - + public HilightedText(String text) { this.text = text; this.traitHilights = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java index ec4797e85..59d1537bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java @@ -32,7 +32,7 @@ import java.util.Stack; * @author JPEXS */ public class HilightedTextWriter extends GraphTextWriter { - + private final StringBuilder sb = new StringBuilder(); private final boolean hilight; private boolean newLine = true; @@ -47,7 +47,7 @@ public class HilightedTextWriter extends GraphTextWriter { public List methodHilights = new ArrayList<>(); public List instructionHilights = new ArrayList<>(); public List specialHilights = new ArrayList<>(); - + public HilightedTextWriter(boolean hilight) { this.hilight = hilight; } @@ -76,13 +76,13 @@ public class HilightedTextWriter extends GraphTextWriter { offsets.add(itemPos); return this; } - + @Override public HilightedTextWriter endOffset() { offsets.pop(); return this; } - + /** * Highlights specified text as method by adding special tags * @@ -95,12 +95,12 @@ public class HilightedTextWriter extends GraphTextWriter { data.put("index", Long.toString(index)); return start(data, HilightType.METHOD); } - + @Override public HilightedTextWriter endMethod() { return end(HilightType.METHOD); } - + /** * Highlights specified text as class by adding special tags * @@ -113,12 +113,12 @@ public class HilightedTextWriter extends GraphTextWriter { data.put("index", Long.toString(index)); return start(data, HilightType.CLASS); } - + @Override - public HilightedTextWriter endClass() { + public HilightedTextWriter endClass() { return end(HilightType.CLASS); } - + /** * Highlights specified text as trait by adding special tags * @@ -131,17 +131,17 @@ public class HilightedTextWriter extends GraphTextWriter { data.put("index", Long.toString(index)); return start(data, HilightType.TRAIT); } - + @Override public HilightedTextWriter endTrait() { return end(HilightType.TRAIT); } - + @Override public HilightedTextWriter hilightSpecial(String text, String type) { return hilightSpecial(text, type, 0); } - + @Override public HilightedTextWriter hilightSpecial(String text, String type, int index) { Map data = new HashMap<>(); @@ -151,7 +151,7 @@ public class HilightedTextWriter extends GraphTextWriter { appendNoHilight(text); return end(HilightType.SPECIAL); } - + @Override public HilightedTextWriter append(String str) { GraphSourceItemPosition itemPos = offsets.peek(); @@ -229,17 +229,17 @@ public class HilightedTextWriter extends GraphTextWriter { } return this; } - + @Override public int getLength() { return sb.length(); } - + @Override public int getIndent() { return indent; } - + @Override public String toString() { if (toStringCalled) { @@ -255,7 +255,7 @@ public class HilightedTextWriter extends GraphTextWriter { toStringCalled = true; return sb.toString(); } - + private HilightedTextWriter start(Map data, HilightType type) { if (hilight) { Highlighting h = new Highlighting(sb.length() - newLineCount, data, type, null); @@ -263,16 +263,16 @@ public class HilightedTextWriter extends GraphTextWriter { } return this; } - + private HilightedTextWriter end(HilightType expectedType) { if (hilight) { Highlighting h = hilightStack.pop(); h.len = sb.length() - newLineCount - h.startPos; - + if (!expectedType.equals(h.type)) { throw new Error("Hilighting mismatch."); } - + switch (h.type) { case CLASS: classHilights.add(h); @@ -293,7 +293,7 @@ public class HilightedTextWriter extends GraphTextWriter { } return this; } - + private void appendToSb(String str) { if (newLine) { newLine = false; @@ -301,7 +301,7 @@ public class HilightedTextWriter extends GraphTextWriter { } sb.append(str); } - + private void appendIndent() { for (int i = 0; i < indent; i++) { appendNoHilight(INDENT_STRING); diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/LoopWithType.java b/trunk/src/com/jpexs/decompiler/flash/helpers/LoopWithType.java index 7c70bdd7d..626581911 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/LoopWithType.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/LoopWithType.java @@ -25,9 +25,9 @@ public class LoopWithType { public static int LOOP_TYPE_LOOP = 0; public static int LOOP_TYPE_SWITCH = 1; - + public long loopId; public int type; public boolean used; - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java index e550449f6..3c075129b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java @@ -24,7 +24,7 @@ import java.util.Stack; * @author JPEXS */ public class NulWriter extends GraphTextWriter { - + private final Stack loopStack = new Stack<>(); private final Stack stringAddedStack = new Stack<>(); private boolean stringAdded = false; @@ -38,22 +38,22 @@ public class NulWriter extends GraphTextWriter { loop.type = loopType; loopStack.add(loop); } - - public LoopWithType endLoop(long loopId) { + + public LoopWithType endLoop(long loopId) { LoopWithType loopIdInStack = loopStack.pop(); if (loopId != loopIdInStack.loopId) { throw new Error("LoopId mismatch"); } return loopIdInStack; } - + public long getLoop() { if (loopStack.isEmpty()) { return -1; } return loopStack.peek().loopId; } - + public long getNonSwitchLoop() { if (loopStack.isEmpty()) { return -1; @@ -84,7 +84,7 @@ public class NulWriter extends GraphTextWriter { loop = loopStack.get(pos); pos--; } while ((pos >= 0) && (loop.loopId != loopId)); - + if (loop.loopId == loopId) { loop.used = true; } @@ -95,13 +95,13 @@ public class NulWriter extends GraphTextWriter { stringAdded = true; return this; } - + @Override public NulWriter hilightSpecial(String text, String type, int index) { stringAdded = true; return this; } - + @Override public NulWriter append(String str) { stringAdded = true; @@ -130,7 +130,7 @@ public class NulWriter extends GraphTextWriter { stringAddedStack.add(stringAdded); stringAdded = false; } - + public boolean getMark() { boolean result = stringAdded; stringAdded = stringAddedStack.pop() || result; diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java b/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java index 1e5a00766..f9685262e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java @@ -103,13 +103,13 @@ public class Highlighting implements Serializable { return ret; } } - + if (Configuration.debugMode.get()) { if (ret != null) { System.out.println("Highlight found: " + ret.hilightedText); } } - + return ret; } @@ -122,7 +122,7 @@ public class Highlighting implements Serializable { public String toString() { return startPos + "-" + (startPos + len) + " type:" + type; } - + /** * * @param startPos Starting position diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index e71c04f11..19536758b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -204,170 +204,170 @@ public class DefineEditTextTag extends TextTag { case PARAMETER: String paramName = (String) s.values[0]; String paramValue = (String) s.values[1]; - switch (paramName) { - case "xmin": - try { - bounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline()); - } - break; - case "ymin": - try { - bounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline()); - } - break; - case "xmax": - try { - bounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline()); - } - break; - case "ymax": - try { - bounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline()); - } - break; - case "wordwrap": - if (paramValue.equals("1")) { - wordWrap = true; - } - break; - case "multiline": - if (paramValue.equals("1")) { - multiline = true; - } - break; - case "password": - if (paramValue.equals("1")) { - password = true; - } - break; - case "readonly": - if (paramValue.equals("1")) { - readOnly = true; - } - break; - case "autosize": - if (paramValue.equals("1")) { - autoSize = true; - } - break; - case "noselect": - if (paramValue.equals("1")) { - noSelect = true; - } - break; - case "border": - if (paramValue.equals("1")) { - border = true; - } - break; - case "wasstatic": - if (paramValue.equals("1")) { - wasStatic = true; - } - break; - case "html": - if (paramValue.equals("1")) { - html = true; - } - break; - case "useoutlines": - if (paramValue.equals("1")) { - useOutlines = true; - } - break; - case "font": - try { - fontId = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid font value. Number expected.", lexer.yyline()); - } - break; - case "fontclass": - fontClass = paramValue; - break; - case "height": - try { - fontHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid height value. Number expected.", lexer.yyline()); - } - break; - case "color": - Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); - if (m.matches()) { - textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16)); - } else { - throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); - } - break; - case "maxlength": - try { - maxLength = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline()); - } - break; - case "align": - switch (paramValue) { - case "left": - align = 0; + switch (paramName) { + case "xmin": + try { + bounds.Xmin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline()); + } break; - case "right": - align = 1; + case "ymin": + try { + bounds.Ymin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline()); + } break; - case "center": - align = 2; + case "xmax": + try { + bounds.Xmax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline()); + } break; - case "justify": - align = 3; + case "ymax": + try { + bounds.Ymax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline()); + } + break; + case "wordwrap": + if (paramValue.equals("1")) { + wordWrap = true; + } + break; + case "multiline": + if (paramValue.equals("1")) { + multiline = true; + } + break; + case "password": + if (paramValue.equals("1")) { + password = true; + } + break; + case "readonly": + if (paramValue.equals("1")) { + readOnly = true; + } + break; + case "autosize": + if (paramValue.equals("1")) { + autoSize = true; + } + break; + case "noselect": + if (paramValue.equals("1")) { + noSelect = true; + } + break; + case "border": + if (paramValue.equals("1")) { + border = true; + } + break; + case "wasstatic": + if (paramValue.equals("1")) { + wasStatic = true; + } + break; + case "html": + if (paramValue.equals("1")) { + html = true; + } + break; + case "useoutlines": + if (paramValue.equals("1")) { + useOutlines = true; + } + break; + case "font": + try { + fontId = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid font value. Number expected.", lexer.yyline()); + } + break; + case "fontclass": + fontClass = paramValue; + break; + case "height": + try { + fontHeight = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid height value. Number expected.", lexer.yyline()); + } + break; + case "color": + Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); + if (m.matches()) { + textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16)); + } else { + throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); + } + break; + case "maxlength": + try { + maxLength = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline()); + } + break; + case "align": + switch (paramValue) { + case "left": + align = 0; + break; + case "right": + align = 1; + break; + case "center": + align = 2; + break; + case "justify": + align = 3; + break; + default: + throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline()); + } + break; + case "leftmargin": + try { + leftMargin = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline()); + } + break; + case "rightmargin": + try { + rightMargin = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline()); + } + break; + case "indent": + try { + indent = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid indent value. Number expected.", lexer.yyline()); + } + break; + case "leading": + try { + leading = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid leading value. Number expected.", lexer.yyline()); + } + break; + case "variablename": + variableName = paramValue; break; default: - throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline()); + throw new ParseException("Unrecognized parameter name", lexer.yyline()); } break; - case "leftmargin": - try { - leftMargin = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline()); - } - break; - case "rightmargin": - try { - rightMargin = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline()); - } - break; - case "indent": - try { - indent = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid indent value. Number expected.", lexer.yyline()); - } - break; - case "leading": - try { - leading = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid leading value. Number expected.", lexer.yyline()); - } - break; - case "variablename": - variableName = paramValue; - break; - default: - throw new ParseException("Unrecognized parameter name", lexer.yyline()); - } - break; case TEXT: text += (String) s.values[0]; break; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index 2f2a94eb3..68ed5dcfa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -133,7 +133,6 @@ public class DefineFont2Tag extends FontTag { } sos.write(baGlyphShapes); - for (int i = 0; i < numGlyphs; i++) { if (fontFlagsWideCodes) { sos.writeUI16(codeTable.get(i)); @@ -374,7 +373,6 @@ public class DefineFont2Tag extends FontTag { glyphShapeTable.set(pos, shp); } - if (fontFlagsHasLayout) { Font fnt = new Font(fontName, fontStyle, 1024); if (!exists) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index 51297db7c..09e8921d7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -208,7 +208,6 @@ public class DefineFont3Tag extends FontTag { } sos.write(baGlyphShapes); - for (int i = 0; i < numGlyphs; i++) { if (fontFlagsWideCodes) { sos.writeUI16(codeTable.get(i)); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 6f4adb310..585a219dd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -198,126 +198,126 @@ public class DefineText2Tag extends TextTag implements DrawableTag { throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); } } - switch (paramName) { - case "font": - try { - fontId = Integer.parseInt(paramValue); + switch (paramName) { + case "font": + try { + fontId = Integer.parseInt(paramValue); - for (Tag t : swf.tags) { - if (t instanceof FontTag) { - if (((FontTag) t).getFontId() == fontId) { - font = (FontTag) t; - fontName = font.getSystemFontName(); - break; + for (Tag t : swf.tags) { + if (t instanceof FontTag) { + if (((FontTag) t).getFontId() == fontId) { + font = (FontTag) t; + fontName = font.getSystemFontName(); + break; + } + } } + if (font == null) { + throw new ParseException("Font not found", lexer.yyline()); + } + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid font id - number expected.", lexer.yyline()); } - } - if (font == null) { - throw new ParseException("Font not found", lexer.yyline()); - } - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font id - number expected.", lexer.yyline()); + break; + case "height": + try { + textHeight = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid font height - number expected.", lexer.yyline()); + } + break; + case "x": + try { + x = Integer.parseInt(paramValue); + currentX = x; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid x position - number expected.", lexer.yyline()); + } + break; + case "y": + try { + y = Integer.parseInt(paramValue); + currentY = y; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid y position - number expected.", lexer.yyline()); + } + break; + case "xmin": + try { + textBounds.Xmin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); + } + break; + case "xmax": + try { + textBounds.Xmax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); + } + break; + case "ymin": + try { + textBounds.Ymin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); + } + break; + case "ymax": + try { + textBounds.Ymax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); + } + break; + case "scalex": + try { + textMatrix.scaleX = Integer.parseInt(paramValue); + textMatrix.hasScale = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); + } + break; + case "scaley": + try { + textMatrix.scaleY = Integer.parseInt(paramValue); + textMatrix.hasScale = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); + } + break; + case "rotateskew0": + try { + textMatrix.rotateSkew0 = Integer.parseInt(paramValue); + textMatrix.hasRotate = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); + } + break; + case "rotateskew1": + try { + textMatrix.rotateSkew1 = Integer.parseInt(paramValue); + textMatrix.hasRotate = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); + } + break; + case "translatex": + try { + textMatrix.translateX = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); + } + break; + case "translatey": + try { + textMatrix.translateY = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid translatey value - number expected.", lexer.yyline()); + } + break; } break; - case "height": - try { - textHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font height - number expected.", lexer.yyline()); - } - break; - case "x": - try { - x = Integer.parseInt(paramValue); - currentX = x; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid x position - number expected.", lexer.yyline()); - } - break; - case "y": - try { - y = Integer.parseInt(paramValue); - currentY = y; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid y position - number expected.", lexer.yyline()); - } - break; - case "xmin": - try { - textBounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); - } - break; - case "xmax": - try { - textBounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); - } - break; - case "ymin": - try { - textBounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); - } - break; - case "ymax": - try { - textBounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); - } - break; - case "scalex": - try { - textMatrix.scaleX = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - break; - case "scaley": - try { - textMatrix.scaleY = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - break; - case "rotateskew0": - try { - textMatrix.rotateSkew0 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); - } - break; - case "rotateskew1": - try { - textMatrix.rotateSkew1 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); - } - break; - case "translatex": - try { - textMatrix.translateX = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); - } - break; - case "translatey": - try { - textMatrix.translateY = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatey value - number expected.", lexer.yyline()); - } - break; - } - break; case TEXT: if (font == null) { throw new ParseException("Font not defined", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index f156f7d59..780e39a79 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -159,7 +159,7 @@ public class DefineTextTag extends TextTag implements DrawableTag { if (params.length() > 0) { ret += "[" + params + "\r\n]"; } - + if (fnt == null) { ret += AppStrings.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java index d5c499f56..8ee946586 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -99,149 +99,149 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem { private static final Object lockObject = new Object(); private static List knownTagIds; private static List requiredTagIds; - + public static List getKnownTags() { if (knownTagIds == null) { - synchronized(lockObject) { + synchronized (lockObject) { if (knownTagIds == null) { List tagIds = Arrays.asList( - CSMTextSettingsTag.ID, - DebugIDTag.ID, - DefineBinaryDataTag.ID, - DefineBitsJPEG2Tag.ID, - DefineBitsJPEG3Tag.ID, - DefineBitsJPEG4Tag.ID, - DefineBitsLossless2Tag.ID, - DefineBitsLosslessTag.ID, - DefineBitsTag.ID, - DefineButton2Tag.ID, - DefineButtonCxformTag.ID, - DefineButtonSoundTag.ID, - DefineButtonTag.ID, - DefineEditTextTag.ID, - DefineFont2Tag.ID, - DefineFont3Tag.ID, - DefineFont4Tag.ID, - DefineFontAlignZonesTag.ID, - DefineFontInfo2Tag.ID, - DefineFontInfoTag.ID, - DefineFontNameTag.ID, - DefineFontTag.ID, - DefineMorphShape2Tag.ID, - DefineMorphShapeTag.ID, - DefineScalingGridTag.ID, - DefineSceneAndFrameLabelDataTag.ID, - DefineShape2Tag.ID, - DefineShape3Tag.ID, - DefineShape4Tag.ID, - DefineShapeTag.ID, - DefineSoundTag.ID, - DefineSpriteTag.ID, - DefineText2Tag.ID, - DefineTextTag.ID, - DefineVideoStreamTag.ID, - DoABCDefineTag.ID, - DoABCTag.ID, - DoActionTag.ID, - DoInitActionTag.ID, - EnableDebugger2Tag.ID, - EnableDebuggerTag.ID, - EnableTelemetryTag.ID, - EndTag.ID, - ExportAssetsTag.ID, - FileAttributesTag.ID, - FrameLabelTag.ID, - ImportAssets2Tag.ID, - ImportAssetsTag.ID, - JPEGTablesTag.ID, - MetadataTag.ID, - PlaceObject2Tag.ID, - PlaceObject3Tag.ID, - PlaceObject4Tag.ID, - PlaceObjectTag.ID, - ProductInfoTag.ID, - ProtectTag.ID, - RemoveObject2Tag.ID, - RemoveObjectTag.ID, - ScriptLimitsTag.ID, - SetBackgroundColorTag.ID, - SetTabIndexTag.ID, - ShowFrameTag.ID, - SoundStreamBlockTag.ID, - SoundStreamHead2Tag.ID, - SoundStreamHeadTag.ID, - StartSound2Tag.ID, - StartSoundTag.ID, - SymbolClassTag.ID, - TagStub.ID, - VideoFrameTag.ID, - DefineCompactedFont.ID, - DefineExternalGradient.ID, - DefineExternalImage.ID, - DefineExternalImage2.ID, - DefineExternalSound.ID, - DefineExternalStreamSound.ID, - DefineGradientMap.ID, - DefineSubImage.ID, - ExporterInfoTag.ID, - FontTextureInfo.ID); + CSMTextSettingsTag.ID, + DebugIDTag.ID, + DefineBinaryDataTag.ID, + DefineBitsJPEG2Tag.ID, + DefineBitsJPEG3Tag.ID, + DefineBitsJPEG4Tag.ID, + DefineBitsLossless2Tag.ID, + DefineBitsLosslessTag.ID, + DefineBitsTag.ID, + DefineButton2Tag.ID, + DefineButtonCxformTag.ID, + DefineButtonSoundTag.ID, + DefineButtonTag.ID, + DefineEditTextTag.ID, + DefineFont2Tag.ID, + DefineFont3Tag.ID, + DefineFont4Tag.ID, + DefineFontAlignZonesTag.ID, + DefineFontInfo2Tag.ID, + DefineFontInfoTag.ID, + DefineFontNameTag.ID, + DefineFontTag.ID, + DefineMorphShape2Tag.ID, + DefineMorphShapeTag.ID, + DefineScalingGridTag.ID, + DefineSceneAndFrameLabelDataTag.ID, + DefineShape2Tag.ID, + DefineShape3Tag.ID, + DefineShape4Tag.ID, + DefineShapeTag.ID, + DefineSoundTag.ID, + DefineSpriteTag.ID, + DefineText2Tag.ID, + DefineTextTag.ID, + DefineVideoStreamTag.ID, + DoABCDefineTag.ID, + DoABCTag.ID, + DoActionTag.ID, + DoInitActionTag.ID, + EnableDebugger2Tag.ID, + EnableDebuggerTag.ID, + EnableTelemetryTag.ID, + EndTag.ID, + ExportAssetsTag.ID, + FileAttributesTag.ID, + FrameLabelTag.ID, + ImportAssets2Tag.ID, + ImportAssetsTag.ID, + JPEGTablesTag.ID, + MetadataTag.ID, + PlaceObject2Tag.ID, + PlaceObject3Tag.ID, + PlaceObject4Tag.ID, + PlaceObjectTag.ID, + ProductInfoTag.ID, + ProtectTag.ID, + RemoveObject2Tag.ID, + RemoveObjectTag.ID, + ScriptLimitsTag.ID, + SetBackgroundColorTag.ID, + SetTabIndexTag.ID, + ShowFrameTag.ID, + SoundStreamBlockTag.ID, + SoundStreamHead2Tag.ID, + SoundStreamHeadTag.ID, + StartSound2Tag.ID, + StartSoundTag.ID, + SymbolClassTag.ID, + TagStub.ID, + VideoFrameTag.ID, + DefineCompactedFont.ID, + DefineExternalGradient.ID, + DefineExternalImage.ID, + DefineExternalImage2.ID, + DefineExternalSound.ID, + DefineExternalStreamSound.ID, + DefineGradientMap.ID, + DefineSubImage.ID, + ExporterInfoTag.ID, + FontTextureInfo.ID); knownTagIds = tagIds; } } } return knownTagIds; } - + public static List getRequiredTags() { if (requiredTagIds == null) { - synchronized(lockObject) { + synchronized (lockObject) { if (requiredTagIds == null) { List tagIds = Arrays.asList( - DefineBinaryDataTag.ID, - DefineBitsJPEG2Tag.ID, - DefineBitsJPEG3Tag.ID, - DefineBitsJPEG4Tag.ID, - DefineBitsLossless2Tag.ID, - DefineBitsLosslessTag.ID, - DefineBitsTag.ID, - DefineButton2Tag.ID, - DefineButtonCxformTag.ID, - DefineButtonSoundTag.ID, - DefineButtonTag.ID, - DefineEditTextTag.ID, - DefineFont2Tag.ID, - DefineFont3Tag.ID, - DefineFont4Tag.ID, - DefineFontAlignZonesTag.ID, - DefineFontInfo2Tag.ID, - DefineFontInfoTag.ID, - DefineFontNameTag.ID, - DefineFontTag.ID, - DefineMorphShape2Tag.ID, - DefineMorphShapeTag.ID, - DefineScalingGridTag.ID, - DefineSceneAndFrameLabelDataTag.ID, - DefineShape2Tag.ID, - DefineShape3Tag.ID, - DefineShape4Tag.ID, - DefineShapeTag.ID, - DefineSoundTag.ID, - DefineSpriteTag.ID, - DefineText2Tag.ID, - DefineTextTag.ID, - DefineVideoStreamTag.ID, - DoABCDefineTag.ID, - DoABCTag.ID, - DoActionTag.ID, - DoInitActionTag.ID, - ShowFrameTag.ID); + DefineBinaryDataTag.ID, + DefineBitsJPEG2Tag.ID, + DefineBitsJPEG3Tag.ID, + DefineBitsJPEG4Tag.ID, + DefineBitsLossless2Tag.ID, + DefineBitsLosslessTag.ID, + DefineBitsTag.ID, + DefineButton2Tag.ID, + DefineButtonCxformTag.ID, + DefineButtonSoundTag.ID, + DefineButtonTag.ID, + DefineEditTextTag.ID, + DefineFont2Tag.ID, + DefineFont3Tag.ID, + DefineFont4Tag.ID, + DefineFontAlignZonesTag.ID, + DefineFontInfo2Tag.ID, + DefineFontInfoTag.ID, + DefineFontNameTag.ID, + DefineFontTag.ID, + DefineMorphShape2Tag.ID, + DefineMorphShapeTag.ID, + DefineScalingGridTag.ID, + DefineSceneAndFrameLabelDataTag.ID, + DefineShape2Tag.ID, + DefineShape3Tag.ID, + DefineShape4Tag.ID, + DefineShapeTag.ID, + DefineSoundTag.ID, + DefineSpriteTag.ID, + DefineText2Tag.ID, + DefineTextTag.ID, + DefineVideoStreamTag.ID, + DoABCDefineTag.ID, + DoABCTag.ID, + DoActionTag.ID, + DoInitActionTag.ID, + ShowFrameTag.ID); requiredTagIds = tagIds; } } } return requiredTagIds; } - + /** * Gets data bytes * diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java index f2a6f2815..28937e817 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.SWF; * @author JPEXS */ public class UnknownTag extends Tag { - + public UnknownTag(SWF swf, int id, byte[] data, long pos) { super(swf, id, "Unknown", data, pos); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java index 55ca4d141..efb500122 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ContainerItem.java @@ -24,5 +24,5 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem; * @author JPEXS */ public interface ContainerItem extends TreeItem { - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index 39bd50b12..f515802a2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -98,13 +98,13 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable public static String[] fontNamesArray; public static List fontNames; - + public static String defaultFontName; - + static { reload(); } - + public boolean hasLayout() { return false; } @@ -154,7 +154,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable } return defaultFontName; } - + public static void shiftGlyphIndices(int fontId, int startIndex, List tags) { List textRecords = new ArrayList<>(); for (Tag t : tags) { @@ -217,9 +217,9 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable return "Arial"; } //Fallback to DIALOG - return "Dialog"; + return "Dialog"; } - + public static String isFontInstalled(String fontName) { if (fontNames.contains(fontName)) { return fontName; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java index 481ad435c..5d9c304b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java @@ -209,7 +209,6 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag { FontType font = fonts.get(0); SHAPE shp = SHAPERECORD.systemFontCharacterToSHAPE(fontName, fontStyle, 20 * font.nominalSize, character); - int code = (int) character; int pos = -1; boolean exists = false; @@ -448,6 +447,7 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag { kr.fontKerningCode2 = ft.kerning.get(i).char2; ret.fontKerningTable[i] = kr; }*/ + return ret; } catch (IOException ex) { Logger.getLogger(DefineCompactedFont.class.getName()).log(Level.SEVERE, null, ex); diff --git a/trunk/src/com/jpexs/decompiler/flash/treeitems/AS2PackageNodeItem.java b/trunk/src/com/jpexs/decompiler/flash/treeitems/AS2PackageNodeItem.java index 5948b2660..5a3522b52 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treeitems/AS2PackageNodeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/treeitems/AS2PackageNodeItem.java @@ -36,7 +36,7 @@ public class AS2PackageNodeItem implements TreeItem { public SWF getSwf() { return swf; } - + @Override public String toString() { return packageName; diff --git a/trunk/src/com/jpexs/decompiler/flash/treeitems/AS3PackageNodeItem.java b/trunk/src/com/jpexs/decompiler/flash/treeitems/AS3PackageNodeItem.java index 8d6072ace..202f02ce2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treeitems/AS3PackageNodeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/treeitems/AS3PackageNodeItem.java @@ -36,7 +36,7 @@ public class AS3PackageNodeItem implements TreeElementItem { public SWF getSwf() { return swf; } - + @Override public String toString() { return packageName; diff --git a/trunk/src/com/jpexs/decompiler/flash/treeitems/StringItem.java b/trunk/src/com/jpexs/decompiler/flash/treeitems/StringItem.java index 5a5b67f67..63773bd99 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treeitems/StringItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/treeitems/StringItem.java @@ -23,22 +23,22 @@ import com.jpexs.decompiler.flash.SWF; * @author JPEXS */ public class StringItem implements TreeItem { - + public SWF swf; private final String str; - + public StringItem(String str, SWF swf) { this.swf = swf; this.str = str; - } + } @Override public SWF getSwf() { return swf; } - + @Override public String toString() { return str; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeElementItem.java b/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeElementItem.java index 39ff76eec..72a6ce189 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeElementItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeElementItem.java @@ -21,5 +21,5 @@ package com.jpexs.decompiler.flash.treeitems; * @author JPEXS */ public interface TreeElementItem extends TreeItem { - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java index 99699c7a4..8cd523051 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java @@ -23,6 +23,6 @@ import com.jpexs.decompiler.flash.SWF; * @author JPEXS */ public interface TreeItem { - + public SWF getSwf(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/treenodes/AS2PackageNode.java b/trunk/src/com/jpexs/decompiler/flash/treenodes/AS2PackageNode.java index aef96329b..e3d3cd94d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treenodes/AS2PackageNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/treenodes/AS2PackageNode.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.treeitems.AS2PackageNodeItem; * @author JPEXS */ public class AS2PackageNode extends TreeNode { - + public AS2PackageNode(AS2PackageNodeItem item) { super(item); } diff --git a/trunk/src/com/jpexs/decompiler/flash/treenodes/ContainerNode.java b/trunk/src/com/jpexs/decompiler/flash/treenodes/ContainerNode.java index 49deed1d4..36dba6b70 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treenodes/ContainerNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/treenodes/ContainerNode.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.tags.base.ContainerItem; * @author JPEXS */ public class ContainerNode extends TreeNode { - + public ContainerNode(ContainerItem item) { super(item); } diff --git a/trunk/src/com/jpexs/decompiler/flash/treenodes/FrameNode.java b/trunk/src/com/jpexs/decompiler/flash/treenodes/FrameNode.java index 1cbc4d061..4abda8f96 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treenodes/FrameNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/treenodes/FrameNode.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.treeitems.FrameNodeItem; * @author JPEXS */ public class FrameNode extends TreeNode { - + public FrameNode(FrameNodeItem item) { super(item); } diff --git a/trunk/src/com/jpexs/decompiler/flash/treenodes/TreeNode.java b/trunk/src/com/jpexs/decompiler/flash/treenodes/TreeNode.java index be2628034..0b3f5d038 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treenodes/TreeNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/treenodes/TreeNode.java @@ -25,7 +25,7 @@ import java.util.List; * @author JPEXS */ public abstract class TreeNode { - + protected TreeItem item; public boolean export = false; public List subNodes; @@ -34,7 +34,7 @@ public abstract class TreeNode { this.item = item; this.subNodes = new ArrayList<>(); } - + public TreeItem getItem() { return item; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index e704533fc..fc8e8d85e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -84,7 +84,7 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem { null, "" }; - + private final SWF swf; private long pos; private long hdrPos; @@ -205,12 +205,12 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem { public void setActionBytes(byte[] actionBytes) { this.actionBytes = actionBytes; } - + @Override public GraphTextWriter getActionBytesAsHex(GraphTextWriter writer) { return Helper.byteArrayToHexWithHeader(writer, actionBytes); } - + List listeners = new ArrayList<>(); @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java index f5c1761f6..e01dd0c23 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java @@ -58,9 +58,6 @@ public class MORPHGRADIENT { ret.gradientRecords = new GRADRECORD[gradientRecords.length]; for (int m = 0; m < gradientRecords.length; m++) { - - - int gratio = (gradientRecords[m].startRatio + (gradientRecords[m].endRatio - gradientRecords[m].startRatio) * ratio / 65535); ret.gradientRecords[m] = new GRADRECORD(); ret.gradientRecords[m].colorA = morphColor(gradientRecords[m].startColor, gradientRecords[m].endColor, ratio); diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java index 2bec5b192..49b8353a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java @@ -82,7 +82,8 @@ public final class BlendComposite implements Composite { } /** - *

Returns the blending mode of this composite.

+ *

+ * Returns the blending mode of this composite.

* * @return the blending mode used by this object */ @@ -162,7 +163,6 @@ public final class BlendComposite implements Composite { int[] srcPixels = new int[width]; int[] dstPixels = new int[width]; - for (int y = 0; y < height; y++) { src.getDataElements(0, y, width, 1, srcPixels); dstIn.getDataElements(0, y, width, 1, dstPixels); diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java index c0cc6aea3..1f6eb0d1d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java @@ -141,7 +141,6 @@ public class Filtering { g += ((color >> 8) & 0xff); b += ((color) & 0xff); - } hits++; } @@ -342,7 +341,6 @@ public class Filtering { gg.fill(new Rectangle(256, 1)); int[] gradientPixels = getRGB(gradient, 0, 0, gradient.getWidth(), gradient.getHeight()); - double angleRad = angle / 180 * Math.PI; double moveX = (distance * Math.cos(angleRad)); double moveY = (distance * Math.sin(angleRad)); @@ -366,16 +364,11 @@ public class Filtering { Color colorAlpha = new Color(0, 0, 0, 0); shadow = moveRGB(width, height, shadow, moveX, moveY, inner ? colorFirst : colorAlpha); - - - setRGB(retImg, 0, 0, width, height, shadow); - retImg = blur(retImg, blurX, blurY, iterations, inner ? srcPixels : revPixels);//new BoxBlurFilter(blurX, blurY, iterations, inner ? srcPixels : revPixels).filter(ret); shadow = getRGB(retImg, 0, 0, width, height); - for (int i = 0; i < shadow.length; i++) { int a = (shadow[i] >> 24) & 0xff; shadow[i] = gradientPixels[a]; @@ -390,9 +383,6 @@ public class Filtering { shadow[i] = (shadow[i] & 0x00ffffff) + (Math.min(srcA, shadA) << 24); } - - - setRGB(retImg, 0, 0, width, height, shadow); } if (!knockout) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java index 0201da41e..d87353c94 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java @@ -380,8 +380,6 @@ public class EdgeType { maxV = ay; } - - if (minV >= GFxOutputStream.MinSInt5 && maxV <= GFxOutputStream.MaxSInt5) { sos.writeUI8(((cx << 4) | Edge_C5)); sos.writeUI8((((cx >> 4) & m1) | ((cy << 1) & m6) | (ax << 6))); diff --git a/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java index d5c62d29c..9e26d8a8b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java @@ -210,7 +210,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali } } - float[] focRadFractions = new float[ratiosFocRad.size()]; for (int i = 0; i < ratiosFocRad.size(); i++) { focRadFractions[i] = ratiosFocRad.get(i); @@ -240,7 +239,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali cm = CycleMethod.REPEAT; } - g.setPaint(new RadialGradientPaint(new Point(0, 0), 16384, new Point((int) (fillStyle0.focalGradient.focalPoint * 16384), 0), focRadFractions, focRadColors, cm)); g.fill(new Rectangle(-16384 * maxRepeat, -16384 * maxRepeat, 16384 * 2 * maxRepeat, 16384 * 2 * maxRepeat)); g.setTransform(oldAf); @@ -261,8 +259,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali } } - - float[] ratiosRadAr = new float[ratiosRad.size()]; for (int i = 0; i < ratiosRad.size(); i++) { ratiosRadAr[i] = ratiosRad.get(i); @@ -313,8 +309,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali } } - - float[] ratiosAr = new float[ratios.size()]; for (int i = 0; i < ratios.size(); i++) { ratiosAr[i] = ratios.get(i); @@ -338,7 +332,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali cmLin = CycleMethod.REPEAT; } - g.setPaint(new LinearGradientPaint(new Point(-16384, 0), new Point(16384, 0), ratiosAr, colorsArr, cmLin)); g.fill(new Rectangle(-16384 * maxRepeat, -16384 * maxRepeat, 16384 * 2 * maxRepeat, 16384 * 2 * maxRepeat)); g.setTransform(oldAf); @@ -508,7 +501,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali } path = new Path(); - if (scr.stateNewStyles) { fillStyles = scr.fillStyles; lineStylesList = scr.lineStyles; @@ -859,13 +851,11 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali maxw /= 20; maxh /= 20; - int cols = (int) Math.ceil(Math.sqrt(shapes.size())); int pos = 0; int w2 = prevWidth / cols; int h2 = prevHeight / cols; - int mh = maxh * w2 / maxw; int mw; if (mh > h2) { @@ -925,11 +915,11 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali } p.drawTo(tags, -rect.Xmin, -rect.Ymin, g, shapeNum); } - + if (putToCache) { cache.put(key, new SerializableImage(ret)); } - + return ret; } @@ -1054,7 +1044,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali retList.add(0, init); } - retList.add(new EndShapeRecord()); init.stateFillStyle0 = true; init.fillStyle0 = 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index edf4e0581..d4090a801 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -490,7 +490,6 @@ public class XFLConverter { int startEdgeX = 0; int startEdgeY = 0; - LINESTYLEARRAY actualLinestyles = lineStyles; int strokeStyleOrig = 0; fillStyleCount = fillStyles.fillStyles.length; @@ -1788,8 +1787,6 @@ public class XFLConverter { clipActions = po.getClipActions(); } - - } } } @@ -2069,7 +2066,6 @@ public class XFLConverter { } } - boolean hasClipDepth = false; for (Tag t : timelineTags) { if (t instanceof PlaceObjectTypeTag) { @@ -2217,7 +2213,6 @@ public class XFLConverter { textRecords = ((DefineText2Tag) tag).textRecords; } - looprec: for (TEXTRECORD rec : textRecords) { if (rec.styleFlagsHasFont) { @@ -2839,7 +2834,6 @@ public class XFLConverter { } }, handler).run(); - } else { if (!outDir.exists()) { @@ -2956,7 +2950,7 @@ public class XFLConverter { double b, c, h, s; b = (24872168661075.0 * a11 * a11 - 151430415740925.0 * a12 + 341095051289483.0 * a12 * a12 - 15302094789450.0 * a13 + 82428663495404.0 * a12 * a13 - 4592294873812.0 * a13 * a13 + 43556251470.0 * Math.sqrt(216225 * a11 * a11 + 332369 * a12 * a12 - 397828 * a12 * a13 + 281684 * a13 * a13 - - 930 * a11 * (287 * a12 + 178 * a13)) + 2384730956550.0 * a12 * a41 + 240977870700.0 * a13 * a41 + - 930 * a11 * (287 * a12 + 178 * a13)) + 2384730956550.0 * a12 * a41 + 240977870700.0 * a13 * a41 - 685925220 * Math.sqrt(216225 * a11 * a11 + 332369 * a12 * a12 - 397828 * a12 * a13 + 281684 * a13 * a13 - 930 * a11 * (287 * a12 + 178 * a13)) * a41 + 465 * a11 * (466201717582.0 * a12 + 55756962908.0 * a13 + 764132175 * (-127 + 2 * a41))) / (391687695450.0 * a11 * a11 + 5371575610858.0 * a12 * a12 + 1298089188904.0 * a12 * a13 - 72319604312.0 * a13 * a13 @@ -2968,10 +2962,10 @@ public class XFLConverter { - 930 * a11 * (287 * a12 + 178 * a13))) / (500. * (a12 - a13))) + Math.PI/*+ Pi*C(1)*/); s = (1543 * (-103355550 * a11 * a11 - 158872382 * a12 * a12 + 190161784 * a12 * a13 - 134644952 * a13 * a13 + 1661845 * a12 * Math.sqrt(216225 * a11 * a11 + 332369 * a12 * a12 - 397828 * a12 * a13 + 281684 * a13 * a13 - - 930 * a11 * (287 * a12 + 178 * a13)) + 167930 * a13 + - 930 * a11 * (287 * a12 + 178 * a13)) + 167930 * a13 * Math.sqrt(216225 * a11 * a11 + 332369 * a12 * a12 - 397828 * a12 * a13 + 281684 * a13 * a13 - 930 * a11 * (287 * a12 + 178 * a13)) + 465 * a11 * (274372 * a12 + 170168 * a13 + 1065 * Math.sqrt(216225 * a11 * a11 + 332369 * a12 * a12 - 397828 * a12 * a13 - + 281684 * a13 * a13 - 930 * a11 * (287 * a12 + 178 * a13))))) + + 281684 * a13 * a13 - 930 * a11 * (287 * a12 + 178 * a13))))) / (195843847725.0 * a11 * a11 + 2685787805429.0 * a12 * a12 + 649044594452.0 * a12 * a13 - 36159802156.0 * a13 * a13 + 930 * a11 * (1835439833 * a12 + 219515602 * a13)); @@ -3014,7 +3008,6 @@ public class XFLConverter { reader.setEntityResolver(tparser); html = "" + html + ""; reader.parse(new InputSource(new StringReader(html)));*/ - } catch (SAXException | IOException e) { Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, "Error while converting HTML", e); } diff --git a/trunk/src/com/jpexs/decompiler/graph/ExportMode.java b/trunk/src/com/jpexs/decompiler/graph/ExportMode.java index 2a0e51426..6d0cb97e8 100644 --- a/trunk/src/com/jpexs/decompiler/graph/ExportMode.java +++ b/trunk/src/com/jpexs/decompiler/graph/ExportMode.java @@ -32,20 +32,22 @@ public enum ExportMode { private static final Map lookup = new HashMap<>(); static { - for(ExportMode s : EnumSet.allOf(ExportMode.class)) { - lookup.put(s.getCode(), s); - } + for (ExportMode s : EnumSet.allOf(ExportMode.class)) { + lookup.put(s.getCode(), s); + } } private final int code; private ExportMode(int code) { - this.code = code; + this.code = code; } - public int getCode() { return code; } + public int getCode() { + return code; + } - public static ExportMode get(int code) { - return lookup.get(code); + public static ExportMode get(int code) { + return lookup.get(code); } } diff --git a/trunk/src/com/jpexs/decompiler/graph/Graph.java b/trunk/src/com/jpexs/decompiler/graph/Graph.java index f0991e1c6..1f6cf26d6 100644 --- a/trunk/src/com/jpexs/decompiler/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/graph/Graph.java @@ -449,8 +449,6 @@ public class Graph { return null; } - - Set s = new HashSet<>(parts); //unique parts = new ArrayList<>(s); //make local copy @@ -617,7 +615,6 @@ public class Graph { finalProcessAll(ret, 0, new FinalProcessLocalData()); return ret; - } public void finalProcessStack(Stack stack, List output) { @@ -689,8 +686,6 @@ public class Graph { } //Same continues in onTrue and onFalse gets continue on parent level - - } protected List getLoopsContinuesPreAndBreaks(List loops) { @@ -938,7 +933,7 @@ public class Graph { if (recursionLevel > allParts.size() + 1) { throw new TranslateException("markLevels max recursion level reached."); } - + if (debugMode) { System.err.println("markLevels " + part); } @@ -966,7 +961,6 @@ public class Graph { } } - if (visited.contains(part)) { part.level = 0; } else { @@ -985,7 +979,6 @@ public class Graph { } } - List nextParts = checkPrecoNextParts(part); if (nextParts == null) { nextParts = part.nextParts; @@ -1188,7 +1181,6 @@ public class Graph { if (part.nextParts.size() > 2) { GraphPart next = getNextCommonPart(localData, part, loops); - for (GraphPart p : part.nextParts) { List stopPart2 = new ArrayList<>(stopPart); if (next != null) { @@ -1384,7 +1376,6 @@ public class Graph { //try { boolean debugMode = false; - if (debugMode) { System.err.println("PART " + part + " nextsize:" + part.nextParts.size()); } @@ -1401,11 +1392,6 @@ public class Graph { break; } }*/ - - - - - if (part == null) { return ret; } @@ -1479,8 +1465,6 @@ public class Graph { } } - - if (stopPart.contains(part)) { if (currentLoop != null) { currentLoop.phase = 0; @@ -1541,7 +1525,6 @@ public class Graph { part.nextParts.remove(0); } }*/ - if (parseNext) { List retCheck = check(code, localData, allParts, stack, parent, part, stopPart, loops, output, currentLoop, staticOperation, path); if (retCheck != null) { @@ -1666,10 +1649,8 @@ public class Graph { } //********************************END PART DECOMPILING - if (parseNext) { - if (false && part.nextParts.size() > 2) {//alchemy direct switch GraphPart next = getMostCommonPart(localData, part.nextParts, loops); List vis = new ArrayList<>(); @@ -1843,7 +1824,6 @@ public class Graph { if (loopItem.commands.get(0) instanceof IfItem) { IfItem ifi = (IfItem) loopItem.commands.get(0); - List bodyBranch = null; boolean inverted = false; boolean breakpos2 = false; @@ -1907,7 +1887,6 @@ public class Graph { } } - //Loop with condition at the end (Do..While) if (!loopTypeFound && (!loopItem.commands.isEmpty())) { if (loopItem.commands.get(loopItem.commands.size() - 1) instanceof IfItem) { @@ -1942,7 +1921,6 @@ public class Graph { checkContinueAtTheEnd(bodyBranch, currentLoop); - List commands = new ArrayList<>(); if (!bodyBranch.isEmpty()) { diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphPart.java b/trunk/src/com/jpexs/decompiler/graph/GraphPart.java index 9de4319f0..79c68f48f 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphPart.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphPart.java @@ -65,7 +65,7 @@ public class GraphPart implements Serializable { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } - + GraphPart tpart = gr.checkPart(null, localData, this, null); if (tpart == null) { return false; diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphPath.java b/trunk/src/com/jpexs/decompiler/graph/GraphPath.java index beb643cce..1611f55dc 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphPath.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphPath.java @@ -46,7 +46,6 @@ public class GraphPath implements Serializable { return false; } - List otherKeys = new ArrayList<>(p.keys); List otherVals = new ArrayList<>(p.vals); diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java index b1c21366a..fd4e22cda 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -90,7 +90,7 @@ public abstract class GraphTargetItem implements Serializable { public GraphTextWriter toStringSemicoloned(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.startOffset(src, pos); appendTo(writer, localData); - if (needsSemicolon()) { + if (needsSemicolon()) { writer.append(";"); } writer.endOffset(); @@ -120,7 +120,7 @@ public abstract class GraphTargetItem implements Serializable { toString(writer, localData); return writer.toString(); } - + public int getPrecedence() { return precedence; } diff --git a/trunk/src/com/jpexs/decompiler/graph/TranslateException.java b/trunk/src/com/jpexs/decompiler/graph/TranslateException.java index 347bcc9c1..4602adf41 100644 --- a/trunk/src/com/jpexs/decompiler/graph/TranslateException.java +++ b/trunk/src/com/jpexs/decompiler/graph/TranslateException.java @@ -21,7 +21,7 @@ package com.jpexs.decompiler.graph; * @author JPEXS */ public class TranslateException extends RuntimeException { - + public TranslateException(String s) { super(s); } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java b/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java index 0ee81b62f..f417f0cd8 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java @@ -49,7 +49,7 @@ public class BreakItem extends GraphTargetItem { } } if (labelRequired) { - writer.append(" loop" + loopId); + writer.append(" loop" + loopId); } return writer; } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java b/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java index 022f27266..aef544d34 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java @@ -29,7 +29,7 @@ public class CommentItem extends GraphTargetItem { public CommentItem(String comment) { super(null, NOPRECEDENCE); - this.commentLines = new String[] { comment }; + this.commentLines = new String[]{comment}; } public CommentItem(String[] commentLines) { diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java index 24801e379..4d98e5f3c 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java @@ -49,7 +49,7 @@ public class ContinueItem extends GraphTargetItem { } } if (labelRequired) { - writer.append(" loop" + loopId); + writer.append(" loop" + loopId); } return writer; } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java index 29cc7209a..ae6f40a3e 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java @@ -55,7 +55,7 @@ public class DoWhileItem extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -71,7 +71,7 @@ public class DoWhileItem extends LoopItem implements Block { writer.unindent(); writer.append("}").newLine(); writer.append("while("); - + for (int i = 0; i < expression.size(); i++) { if (expression.get(i).isEmpty()) { continue; @@ -81,10 +81,10 @@ public class DoWhileItem extends LoopItem implements Block { } expression.get(i).toString(writer, localData); } - + writer.append(");").newLine(); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java index e7cf6dec2..c3115cdd3 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java @@ -56,7 +56,7 @@ public class ForItem extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -101,7 +101,7 @@ public class ForItem extends LoopItem implements Block { writer.unindent(); writer.append("}"); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/LocalData.java b/trunk/src/com/jpexs/decompiler/graph/model/LocalData.java index eac369229..9a2299266 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/LocalData.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/LocalData.java @@ -31,7 +31,7 @@ public class LocalData { public com.jpexs.decompiler.flash.abc.avm2.ConstantPool constantsAvm2; public HashMap localRegNames; public List fullyQualifiedNames; - + public static LocalData create(ConstantPool constants) { LocalData localData = new LocalData(); localData.constants = constants; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java b/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java index 3554fd6ae..e23c863e0 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java @@ -62,7 +62,7 @@ public class SwitchItem extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_SWITCH); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_SWITCH); } if (labelUsed) { writer.append("loopswitch" + loop.id + ":").newLine(); @@ -104,7 +104,7 @@ public class SwitchItem extends LoopItem implements Block { writer.unindent(); writer.append("}").newLine(); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java b/trunk/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java index 0788820f3..524bcb347 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java @@ -46,7 +46,7 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp { value.toString(writer, localData); } } else { - writer.append("null"); + writer.append("null"); } return writer; } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java b/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java index 3ef77a262..ce488ef56 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java @@ -47,7 +47,7 @@ public class UniversalLoopItem extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -63,7 +63,7 @@ public class UniversalLoopItem extends LoopItem implements Block { writer.unindent(); writer.append("}").newLine(); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java index ccd62f627..52bf278fc 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java @@ -50,7 +50,7 @@ public class WhileItem extends LoopItem implements Block { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (writer instanceof NulWriter) { - ((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); + ((NulWriter) writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP); } if (labelUsed) { writer.append("loop" + loop.id + ":").newLine(); @@ -76,7 +76,7 @@ public class WhileItem extends LoopItem implements Block { writer.unindent(); writer.append("}"); if (writer instanceof NulWriter) { - LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); + LoopWithType loopOjb = ((NulWriter) writer).endLoop(loop.id); labelUsed = loopOjb.used; } return writer; diff --git a/trunk/src/com/jpexs/helpers/Callback.java b/trunk/src/com/jpexs/helpers/Callback.java index 07118190f..665aa9097 100644 --- a/trunk/src/com/jpexs/helpers/Callback.java +++ b/trunk/src/com/jpexs/helpers/Callback.java @@ -21,7 +21,7 @@ package com.jpexs.helpers; * * @author JPEXS */ -public abstract class Callback { +public abstract class Callback { public abstract void call(T arg1); } diff --git a/trunk/src/com/jpexs/helpers/CancellableWorker.java b/trunk/src/com/jpexs/helpers/CancellableWorker.java index 4c1967c65..2e4e23621 100644 --- a/trunk/src/com/jpexs/helpers/CancellableWorker.java +++ b/trunk/src/com/jpexs/helpers/CancellableWorker.java @@ -33,15 +33,15 @@ import java.util.concurrent.TimeoutException; * @author JPEXS */ public abstract class CancellableWorker implements RunnableFuture { - + private static final ExecutorService THREAD_POOL = Executors.newCachedThreadPool(); private static List workers = Collections.synchronizedList(new ArrayList()); private final FutureTask future; - + public CancellableWorker() { super(); - Callable callable = - new Callable() { + Callable callable + = new Callable() { @Override public T call() throws Exception { return doInBackground(); @@ -49,11 +49,11 @@ public abstract class CancellableWorker implements RunnableFuture { }; future = new FutureTask(callable) { - @Override - protected void done() { - workerDone(); - } - }; + @Override + protected void done() { + workerDone(); + } + }; } protected abstract T doInBackground() throws Exception; @@ -66,7 +66,7 @@ public abstract class CancellableWorker implements RunnableFuture { protected void done() { } - + public final void execute() { THREAD_POOL.execute(this); } @@ -93,7 +93,7 @@ public abstract class CancellableWorker implements RunnableFuture { @Override public final T get(long timeout, TimeUnit unit) throws InterruptedException, - ExecutionException, TimeoutException { + ExecutionException, TimeoutException { return future.get(timeout, unit); } @@ -117,7 +117,7 @@ public abstract class CancellableWorker implements RunnableFuture { worker.cancel(true); } } - + public static void cancelBackgroundThreads() { List oldWorkers = workers; workers = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/helpers/Helper.java b/trunk/src/com/jpexs/helpers/Helper.java index 4475650e6..0d6e9619d 100644 --- a/trunk/src/com/jpexs/helpers/Helper.java +++ b/trunk/src/com/jpexs/helpers/Helper.java @@ -236,7 +236,7 @@ public class Helper { } return sb.toString(); } - + public static int getLineCount(String s) { if (s.endsWith("\r\n")) { s = s.substring(0, s.length() - 2); @@ -382,7 +382,8 @@ public class Helper { return ret; } - public static ByteArrayInputStream getInputStream(byte[]... data) { + public static ByteArrayInputStream getInputStream(byte[] + ... data) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { @@ -424,7 +425,8 @@ public class Helper { return baos.toByteArray(); } - public static void writeFile(String file, byte[]... data) { + public static void writeFile(String file, byte[] + ... data) { try (FileOutputStream fos = new FileOutputStream(file)) { for (byte[] d : data) { fos.write(d); @@ -437,11 +439,9 @@ public class Helper { //public static String stripComments(String str) { // return str.replaceAll("[^\r\n]*\r?\n", ""); //} - //public static String hexToComments(String str) { // return str.replaceAll("([^\r\n]*)(\r?\n)", "; $1$2"); //} - public static String stackToString(Stack stack, LocalData localData) throws InterruptedException { String ret = "["; for (int i = stack.size() - 1; i >= 0; i--) { @@ -582,16 +582,16 @@ public class Helper { public static String formatFileSize(long fileSizeLong) { double fileSize = fileSizeLong; if (fileSize < 1024) { - return String.format("%d bytes", fileSizeLong) ; + return String.format("%d bytes", fileSizeLong); } fileSize /= 1024; if (fileSize < 1024) { - return String.format("%.2f KB", fileSize) ; + return String.format("%.2f KB", fileSize); } fileSize /= 1024; - return String.format("%.2f MB", fileSize) ; + return String.format("%.2f MB", fileSize); } - + public static void freeMem() { Cache.clearAll(); System.gc(); @@ -611,7 +611,7 @@ public class Helper { String strMinutes = AppStrings.translate("timeFormat.minutes"); String strSecond = AppStrings.translate("timeFormat.second"); String strSeconds = AppStrings.translate("timeFormat.seconds"); - + if (timeH > 0) { timeStr += timeH + " " + (timeH > 1 ? strHours : strHour); } @@ -636,7 +636,7 @@ public class Helper { writer.appendNoHilight("#hexdata").newLine().newLine(); return byteArrayToHex(writer, data, 8, 8, false, false); } - + public static GraphTextWriter byteArrayToHex(GraphTextWriter writer, byte[] data, int bytesPerRow, int groupSize, boolean addChars, boolean showAddress) { /* // hex data from decompiled actions @@ -649,32 +649,31 @@ public class Helper { result.append(";").append(line).append(nl); } }*/ - int rowCount = data.length / bytesPerRow; if (data.length % bytesPerRow > 0) { rowCount++; } - + long address = 0; for (int row = 0; row < rowCount; row++) { if (row > 0) { writer.newLine(); } - + if (showAddress) { writer.appendNoHilight("0x" + String.format("%08x ", address)); } - + for (int i = 0; i < bytesPerRow; i++) { int idx = row * bytesPerRow + i; if (data.length > idx) { - if (i> 0 && i % groupSize == 0) { + if (i > 0 && i % groupSize == 0) { writer.appendNoHilight(" "); } writer.appendNoHilight(String.format("%02x ", data[idx])); } else { if (addChars) { - if (i> 0 && i % groupSize == 0) { + if (i > 0 && i % groupSize == 0) { writer.appendNoHilight(" "); } writer.appendNoHilight(" "); @@ -682,7 +681,7 @@ public class Helper { } address += bytesPerRow; } - + if (addChars) { writer.appendNoHilight(" "); for (int i = 0; i < bytesPerRow; i++) { @@ -690,11 +689,11 @@ public class Helper { if (data.length == idx) { break; } - if (i> 0 && i % groupSize == 0) { + if (i > 0 && i % groupSize == 0) { writer.appendNoHilight(" "); } byte ch = data[idx]; - if (ch >=0 && ch < 32) { + if (ch >= 0 && ch < 32) { ch = '.'; } writer.appendNoHilight((char) ch + ""); @@ -705,7 +704,7 @@ public class Helper { writer.newLine(); return writer; } - + public static String byteArrayToHex(byte[] data, int bytesPerRow) { HilightedTextWriter writer = new HilightedTextWriter(false); byteArrayToHex(writer, data, bytesPerRow, 8, true, true); @@ -751,23 +750,23 @@ public class Helper { } } } - + /* * Get the extension of a file. - */ + */ public static String getExtension(String fileName) { return getExtension(new File(fileName)); } /* * Get the extension of a file. - */ + */ public static String getExtension(File f) { String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); - if (i > 0 && i < s.length() - 1) { + if (i > 0 && i < s.length() - 1) { ext = s.substring(i).toLowerCase(); } return ext; @@ -782,7 +781,7 @@ public class Helper { appendNoHilight(AppStrings.translate("decompilationError.timeout.description")). appendNoHilight("\");").newLine(); } - + public static void appendErrorComment(GraphTextWriter writer, Throwable ex) { writer.appendNoHilight("/*").newLine(); writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine(); diff --git a/trunk/src/com/jpexs/helpers/MemoryInputStream.java b/trunk/src/com/jpexs/helpers/MemoryInputStream.java index abb4c7877..fdcb8fd46 100644 --- a/trunk/src/com/jpexs/helpers/MemoryInputStream.java +++ b/trunk/src/com/jpexs/helpers/MemoryInputStream.java @@ -76,13 +76,13 @@ public class MemoryInputStream extends SeekableInputStream { public synchronized void reset() throws IOException { seek(0); } - + @Override public int read() throws IOException { if (pos > count) { count = (int) pos; } - + if (pos < getLength()) { int ret = buffer[(int) pos + startPos] & 0xff; pos++; @@ -91,7 +91,7 @@ public class MemoryInputStream extends SeekableInputStream { return -1; } - + private int getLength() { if (maxLength == -1) { return buffer.length - startPos; diff --git a/trunk/src/com/jpexs/helpers/ReReadableInputStream.java b/trunk/src/com/jpexs/helpers/ReReadableInputStream.java index a4781859c..4b6f20d5a 100644 --- a/trunk/src/com/jpexs/helpers/ReReadableInputStream.java +++ b/trunk/src/com/jpexs/helpers/ReReadableInputStream.java @@ -62,7 +62,7 @@ public class ReReadableInputStream extends SeekableInputStream { public synchronized void reset() throws IOException { seek(0); } - + @Override public int read() throws IOException { if (pos < count) { diff --git a/trunk/src/com/jpexs/helpers/Searchable.java b/trunk/src/com/jpexs/helpers/Searchable.java index aa44141ce..06712d2e4 100644 --- a/trunk/src/com/jpexs/helpers/Searchable.java +++ b/trunk/src/com/jpexs/helpers/Searchable.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.helpers; import java.io.InputStream; @@ -25,12 +24,16 @@ import java.util.Map; * @author JPEXS */ public interface Searchable { + /** * Searches for byte sequences + * * @param data * @return Map Position=>Input stream */ - public Map search(byte[]... data); + public Map search(byte[] + + ... data); /** * Searches for byte sequences with progress listener @@ -38,5 +41,7 @@ public interface Searchable { * @param data * @return Map Position=>Input stream */ - public Map search(ProgressListener progListener, byte[]... data); + public Map search(ProgressListener progListener, byte[] + +... data); } diff --git a/trunk/src/com/jpexs/helpers/Stopwatch.java b/trunk/src/com/jpexs/helpers/Stopwatch.java index 48f6eace0..e58e5885a 100644 --- a/trunk/src/com/jpexs/helpers/Stopwatch.java +++ b/trunk/src/com/jpexs/helpers/Stopwatch.java @@ -27,25 +27,25 @@ public class Stopwatch { private long startTime, elapsedTime; private boolean running; public Date startDate, endDate; - + public static Stopwatch startNew() { Stopwatch sw = new Stopwatch(); sw.start(); return sw; } - + public void start() { running = true; startDate = new Date(); startTime = System.nanoTime(); } - + public void stop() { elapsedTime = System.nanoTime() - startTime; endDate = new Date(); running = false; } - + public long getElapsedNanoseconds() { if (running) { return System.nanoTime() - startTime; diff --git a/trunk/src/com/jpexs/helpers/StreamSearch.java b/trunk/src/com/jpexs/helpers/StreamSearch.java index 01722ef46..30e054d24 100644 --- a/trunk/src/com/jpexs/helpers/StreamSearch.java +++ b/trunk/src/com/jpexs/helpers/StreamSearch.java @@ -57,12 +57,13 @@ public class StreamSearch implements Searchable { byte buf[] = new byte[4096]; byte last[] = null; int cnt = 0; - long pos=0; + long pos = 0; while ((cnt = is.read(buf)) > 0) { for (int i = -maxFindLen + 1; i < cnt; i++) { - loopdata:for (byte onedata[] : data) { + loopdata: + for (byte onedata[] : data) { boolean match = true; for (int d = 0; d < onedata.length; d++) { byte b; @@ -94,8 +95,6 @@ public class StreamSearch implements Searchable { pos = pos + cnt; } - - } catch (IOException ex) { Logger.getLogger(StreamSearch.class.getName()).log(Level.SEVERE, null, ex); } diff --git a/trunk/src/com/jpexs/helpers/utf8/Utf8Helper.java b/trunk/src/com/jpexs/helpers/utf8/Utf8Helper.java index 7c35bb232..b2a51da8d 100644 --- a/trunk/src/com/jpexs/helpers/utf8/Utf8Helper.java +++ b/trunk/src/com/jpexs/helpers/utf8/Utf8Helper.java @@ -25,7 +25,7 @@ import java.nio.charset.Charset; * @author JPEXS */ public class Utf8Helper { - + public static Charset charset = Charset.forName("UTF-8"); public static String urlDecode(String s) { @@ -35,7 +35,7 @@ public class Utf8Helper { throw new Error(ex); } } - + public static byte[] getBytes(String string) { return string.getBytes(charset); } diff --git a/trunk/src/com/jpexs/helpers/utf8/Utf8InputStreamReader.java b/trunk/src/com/jpexs/helpers/utf8/Utf8InputStreamReader.java index e752e2ea4..5ef554cf1 100644 --- a/trunk/src/com/jpexs/helpers/utf8/Utf8InputStreamReader.java +++ b/trunk/src/com/jpexs/helpers/utf8/Utf8InputStreamReader.java @@ -24,7 +24,7 @@ import java.io.InputStreamReader; * @author JPEXS */ public class Utf8InputStreamReader extends InputStreamReader { - + public Utf8InputStreamReader(InputStream in) { super(in, Utf8Helper.charset); } diff --git a/trunk/src/com/jpexs/helpers/utf8/Utf8OutputStreamWriter.java b/trunk/src/com/jpexs/helpers/utf8/Utf8OutputStreamWriter.java index 091e39f19..6d2a8cdea 100644 --- a/trunk/src/com/jpexs/helpers/utf8/Utf8OutputStreamWriter.java +++ b/trunk/src/com/jpexs/helpers/utf8/Utf8OutputStreamWriter.java @@ -24,7 +24,7 @@ import java.io.OutputStreamWriter; * @author JPEXS */ public class Utf8OutputStreamWriter extends OutputStreamWriter { - + public Utf8OutputStreamWriter(OutputStream out) { super(out, Utf8Helper.charset); } diff --git a/trunk/src/com/jpexs/helpers/utf8/Utf8PrintWriter.java b/trunk/src/com/jpexs/helpers/utf8/Utf8PrintWriter.java index 17eadd4eb..90f649247 100644 --- a/trunk/src/com/jpexs/helpers/utf8/Utf8PrintWriter.java +++ b/trunk/src/com/jpexs/helpers/utf8/Utf8PrintWriter.java @@ -24,7 +24,7 @@ import java.io.PrintWriter; * @author JPEXS */ public class Utf8PrintWriter extends PrintWriter { - + public Utf8PrintWriter(OutputStream out) { super(new Utf8OutputStreamWriter(out)); } diff --git a/trunk/src/com/jpexs/process/Process.java b/trunk/src/com/jpexs/process/Process.java index 3b98035c0..8cf354221 100644 --- a/trunk/src/com/jpexs/process/Process.java +++ b/trunk/src/com/jpexs/process/Process.java @@ -40,8 +40,12 @@ public interface Process extends Comparable, Searchable { public String getPid(); @Override - public Map search(byte[]... data); + public Map search(byte[] + + ... data); @Override - public Map search(ProgressListener progListener, byte[]... data); + public Map search(ProgressListener progListener, byte[] + +... data); } diff --git a/trunk/src/com/jpexs/process/win32/Win32Process.java b/trunk/src/com/jpexs/process/win32/Win32Process.java index 9010b4ced..2d96da309 100644 --- a/trunk/src/com/jpexs/process/win32/Win32Process.java +++ b/trunk/src/com/jpexs/process/win32/Win32Process.java @@ -81,12 +81,14 @@ public class Win32Process implements Process { } @Override - public Map search(byte[]... data) { + public Map search(byte[] + ... data) { return search(null, data); } @Override - public Map search(ProgressListener progListener, byte[]... data) { + public Map search(ProgressListener progListener, byte[] + ... data) { return Win32ProcessTools.findBytesInProcessMemory(progListener, th32ProcessID, data); } } diff --git a/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java b/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java index dffd0d542..82e58a0bb 100644 --- a/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java +++ b/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java @@ -174,10 +174,8 @@ public class Win32ProcessTools extends ProcessTools { WinDef.HBITMAP bitmap = Gdi32.INSTANCE.CreateCompatibleBitmap(hdcScreen, ret.getWidth(), ret.getHeight()); - WinNT.HANDLE hbmOld = Gdi32.INSTANCE.SelectObject(hdcMem, bitmap); - WinNT.HANDLE hBrush = Gdi32.INSTANCE.CreateSolidBrush(new WinDef.DWORD(0xffffff)); WinDef.RECT rect = new WinDef.RECT(); rect.left = 0; @@ -187,14 +185,12 @@ public class Win32ProcessTools extends ProcessTools { User32.INSTANCE.FillRect(hdcMem, rect, hBrush); Gdi32.INSTANCE.DeleteObject(hBrush); - boolean ok = User32.INSTANCE.DrawIconEx(hdcMem, 0, 0, hIcon, ret.getWidth(), ret.getHeight(), new WinDef.UINT(0), new WinDef.HBRUSH(Pointer.NULL), diFlags); if (!ok) { return false; } - for (int x = 0; x < ret.getWidth(); x++) { for (int y = 0; y < ret.getHeight(); y++) { int rgb = Gdi32.INSTANCE.GetPixel(hdcMem, x, y).intValue(); @@ -274,7 +270,6 @@ public class Win32ProcessTools extends ProcessTools { drawIcon(mask, hIcon, User32.DI_MASK); applyMask(ret, mask); - return ret; } @@ -304,7 +299,6 @@ public class Win32ProcessTools extends ProcessTools { icon = new WinDef.HICON(iconsSmall.getPointer(0)); } - BufferedImage ic = iconToImage(icon); User32.INSTANCE.DestroyIcon(icon); @@ -334,7 +328,6 @@ public class Win32ProcessTools extends ProcessTools { continue; } - try { int rn = Psapi.INSTANCE.GetProcessImageFileNameW(tempProcess, outputnames, 1024); if (rn == 0) { diff --git a/trunk/src/com/sun/jna/platform/win32/Gdi32.java b/trunk/src/com/sun/jna/platform/win32/Gdi32.java index 3f836a055..5bfbf0fa7 100644 --- a/trunk/src/com/sun/jna/platform/win32/Gdi32.java +++ b/trunk/src/com/sun/jna/platform/win32/Gdi32.java @@ -20,8 +20,7 @@ import com.sun.jna.win32.StdCallLibrary; import com.sun.jna.win32.W32APIOptions; /** - * Definition (incomplete) of - * gdi32.dll. + * Definition (incomplete) of gdi32.dll. */ public interface Gdi32 extends StdCallLibrary { @@ -317,4 +316,4 @@ public interface Gdi32 extends StdCallLibrary { DWORD GetPixel(HDC hdc, int nXPos, int nYPos); HANDLE CreateSolidBrush(DWORD crColor); -} \ No newline at end of file +} diff --git a/trunk/src/com/sun/jna/platform/win32/Kernel32.java b/trunk/src/com/sun/jna/platform/win32/Kernel32.java index ee4337229..8fe3131c0 100644 --- a/trunk/src/com/sun/jna/platform/win32/Kernel32.java +++ b/trunk/src/com/sun/jna/platform/win32/Kernel32.java @@ -19,9 +19,8 @@ import com.sun.jna.win32.W32APIOptions; // TODO: Auto-generated Javadoc /** - * Interface definitions for - * kernel32.dll. Includes additional alternate mappings from - * {@link WinNT} which make use of NIO buffers. + * Interface definitions for kernel32.dll. Includes additional + * alternate mappings from {@link WinNT} which make use of NIO buffers. */ public interface Kernel32 extends WinNT { @@ -120,7 +119,7 @@ public interface Kernel32 extends WinNT { public static final int PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000; public static final int PROCESS_MODE_BACKGROUND_END = 0x00200000; public static final int REALTIME_PRIORITY_CLASS = 0x00000100; - + // __out // HANDLE // WINAPI @@ -184,7 +183,7 @@ public interface Kernel32 extends WinNT { HANDLE GetCurrentProcess(); int SetProcessAffinityMask(HANDLE hProcess, int mask); - + int SetPriorityClass(HANDLE hProcess, int dwPriorityClass); /** diff --git a/trunk/src/com/sun/jna/platform/win32/SHELLEXECUTEINFO.java b/trunk/src/com/sun/jna/platform/win32/SHELLEXECUTEINFO.java index fa58929f8..2db28e4ec 100644 --- a/trunk/src/com/sun/jna/platform/win32/SHELLEXECUTEINFO.java +++ b/trunk/src/com/sun/jna/platform/win32/SHELLEXECUTEINFO.java @@ -33,4 +33,4 @@ public class SHELLEXECUTEINFO extends Structure { return Arrays.asList(new String[]{"cbSize", "fMask", "hwnd", "lpVerb", "lpFile", "lpParameters", "lpDirectory", "nShow", "hInstApp", "lpIDList", "lpClass", "hKeyClass", "dwHotKey", "hMonitor", "hProcess"}); } -} \ No newline at end of file +} diff --git a/trunk/src/com/sun/jna/platform/win32/User32.java b/trunk/src/com/sun/jna/platform/win32/User32.java index 19f7fd66d..204965597 100644 --- a/trunk/src/com/sun/jna/platform/win32/User32.java +++ b/trunk/src/com/sun/jna/platform/win32/User32.java @@ -1515,4 +1515,4 @@ public interface User32 extends StdCallLibrary, WinUser { public static final int DI_DEFAULTSIZE = 8; int FillRect(HDC hDC, RECT lprc, HANDLE hbr); -} \ No newline at end of file +} diff --git a/trunk/src/com/sun/jna/platform/win32/WinBase.java b/trunk/src/com/sun/jna/platform/win32/WinBase.java index 94708e69a..be280555c 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinBase.java +++ b/trunk/src/com/sun/jna/platform/win32/WinBase.java @@ -34,9 +34,9 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD { /** * Constant value representing an invalid HANDLE. */ - HANDLE INVALID_HANDLE_VALUE = - new HANDLE(Pointer.createConstant(Pointer.SIZE == 8 - ? -1 : 0xFFFFFFFFL)); + HANDLE INVALID_HANDLE_VALUE + = new HANDLE(Pointer.createConstant(Pointer.SIZE == 8 + ? -1 : 0xFFFFFFFFL)); /** * Maximum computer name length. The value is 15 on Mac, 31 on everything * else. @@ -201,7 +201,8 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD { read(); } /** - *

The difference between the Windows epoch (1601-01-01 00:00:00) and + *

+ * The difference between the Windows epoch (1601-01-01 00:00:00) and * the Unix epoch (1970-01-01 00:00:00) in milliseconds: * 11644473600000L. (Use your favorite spreadsheet program to verify the * correctness of this value. By the way, did you notice that you can @@ -211,12 +212,12 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD { private static final long EPOCH_DIFF = 11644473600000L; /** - *

Converts a Windows FILETIME into a {@link Date}. The Windows - * FILETIME structure holds a date and time associated with a file. The - * structure identifies a 64-bit integer specifying the number of - * 100-nanosecond intervals which have passed since January 1, 1601. - * This 64-bit value is split into the two double words stored in the - * structure.

+ *

+ * Converts a Windows FILETIME into a {@link Date}. The Windows FILETIME + * structure holds a date and time associated with a file. The structure + * identifies a 64-bit integer specifying the number of 100-nanosecond + * intervals which have passed since January 1, 1601. This 64-bit value + * is split into the two double words stored in the structure.

* * @param high The higher double word of the FILETIME structure. * @param low The lower double word of the FILETIME structure. @@ -230,7 +231,8 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD { } /** - *

Converts a {@link Date} into a filetime.

+ *

+ * Converts a {@link Date} into a filetime.

* * @param date The date to be converted * @return The filetime diff --git a/trunk/src/com/sun/jna/platform/win32/WinGDI.java b/trunk/src/com/sun/jna/platform/win32/WinGDI.java index eab6a8742..62e2c51d1 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinGDI.java +++ b/trunk/src/com/sun/jna/platform/win32/WinGDI.java @@ -127,4 +127,4 @@ public interface WinGDI extends StdCallLibrary { } public int DIB_RGB_COLORS = 0; public int DIB_PAL_COLORS = 1; -} \ No newline at end of file +}