From 2f49b47e87bc124d9c078aa1a2b77334e7637c9a Mon Sep 17 00:00:00 2001 From: Honfika Date: Fri, 8 Nov 2013 13:17:44 +0100 Subject: [PATCH] every configuration setting is configurable on the ui, reset configuration button, show config descriptions --- trunk/src/com/jpexs/decompiler/flash/SWF.java | 8 +- .../decompiler/flash/SWFInputStream.java | 2 +- .../com/jpexs/decompiler/flash/TagNode.java | 2 +- .../decompiler/flash/abc/ScriptPack.java | 4 +- .../flash/abc/avm2/parser/ASM3Parser.java | 2 +- .../methodinfo_parser/MethodInfoParser.java | 2 +- .../flash/abc/types/MethodBody.java | 2 +- .../flash/abc/types/MethodInfo.java | 2 +- .../flash/action/swf4/ConstantIndex.java | 4 +- .../flash/configuration/Configuration.java | 165 +++++++++++------- .../ConfigurationDefaultBoolean.java | 34 ++++ .../ConfigurationDefaultInt.java | 34 ++++ .../ConfigurationDefaultString.java | 34 ++++ .../ConfigurationDescription.java | 34 ++++ .../configuration/ConfigurationName.java | 2 +- .../console/CommandLineArgumentParser.java | 4 +- .../flash/gui/AdvancedSettingsDialog.form | 29 ++- .../flash/gui/AdvancedSettingsDialog.java | 73 ++++++-- .../com/jpexs/decompiler/flash/gui/Main.java | 4 +- .../jpexs/decompiler/flash/gui/MainFrame.java | 4 +- .../flash/gui/SelectLanguageDialog.java | 14 +- .../flash/gui/locales/MainFrame_hu.properties | 4 +- .../flash/helpers/HilightedTextWriter.java | 2 +- .../flash/helpers/hilight/Highlighting.java | 4 +- .../flash/tags/DefineButton2Tag.java | 12 +- .../flash/tags/DefineButtonTag.java | 4 +- .../decompiler/flash/tags/DefineFont3Tag.java | 2 +- .../flash/tags/DefineSpriteTag.java | 4 +- .../decompiler/flash/tags/DoABCDefineTag.java | 2 +- .../jpexs/decompiler/flash/tags/DoABCTag.java | 2 +- .../flash/tags/PlaceObject2Tag.java | 4 +- .../flash/tags/PlaceObject3Tag.java | 4 +- .../flash/tags/PlaceObject4Tag.java | 4 +- 33 files changed, 373 insertions(+), 134 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 3e196bea4..8b13c55c8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -684,9 +684,9 @@ public final class SWF { } return null; } - }, Configuration.DECOMPILATION_TIMEOUT, TimeUnit.SECONDS); + }, Configuration.exportTimeout.get(), TimeUnit.SECONDS); } catch (TimeoutException ex) { - Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, Helper.formatTimeToText(Configuration.DECOMPILATION_TIMEOUT) + " ActionScript export limit reached", ex); + Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, Helper.formatTimeToText(Configuration.exportTimeout.get()) + " ActionScript export limit reached", ex); } catch (Exception ex) { Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, "Error during ABC export", ex); } @@ -707,10 +707,10 @@ public final class SWF { } try { - executor.awaitTermination(Configuration.DECOMPILATION_TIMEOUT, TimeUnit.SECONDS); + executor.awaitTermination(Configuration.exportTimeout.get(), TimeUnit.SECONDS); executor.shutdownNow(); } catch (InterruptedException ex) { - Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, Helper.formatTimeToText(Configuration.DECOMPILATION_TIMEOUT) + " ActionScript export limit reached", ex); + Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, Helper.formatTimeToText(Configuration.exportTimeout.get()) + " ActionScript export limit reached", ex); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 892e5af83..27de1e4c3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -653,7 +653,7 @@ public class SWFInputStream extends InputStream { if (!parallel) { tags.add(tag); } - if (Configuration.dump_tags && level == 0) { + if (Configuration.dumpTags.get() && level == 0) { dumpTag(System.out, version, tag, level); } tag.previousTag = previousTag; diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index 40102d713..6ac8a1492 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -267,7 +267,7 @@ public class TagNode { int totalCount = TagNode.getTagCountRecursive(nodeList); return exportNodeAS(allTags, handler, nodeList, outdir, exportMode, cnt, totalCount, ev); } - }, Configuration.DECOMPILATION_TIMEOUT, TimeUnit.SECONDS); + }, Configuration.exportTimeout.get(), TimeUnit.SECONDS); return result; } catch (ExecutionException | InterruptedException | TimeoutException ex) { } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 5eb67abd5..8529cb08d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -149,13 +149,13 @@ public class ScriptPack { convert(new NulWriter(), abcList, traits, exportMode, parallel); return null; } - }, Configuration.DECOMPILATION_TIMEOUT_FILE, TimeUnit.SECONDS); + }, Configuration.decompilationTimeoutFile.get(), TimeUnit.SECONDS); } catch (TimeoutException ex) { writer.continueMeasure(); Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex); writer.appendNoHilight("/*").newLine(); writer.appendNoHilight(" * Decompilation error").newLine(); - writer.appendNoHilight(" * Timeout (" + Helper.formatTimeToText(Configuration.DECOMPILATION_TIMEOUT_FILE) + ") was reached").newLine(); + writer.appendNoHilight(" * Timeout (" + Helper.formatTimeToText(Configuration.decompilationTimeoutFile.get()) + ") was reached").newLine(); writer.appendNoHilight(" */").newLine(); writer.appendNoHilight("throw new IllegalOperationError(\"Not decompiled due to timeout\");").newLine(); return; 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 57086094a..4f427566a 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 @@ -476,7 +476,7 @@ public class ASM3Parser { value_index = parseNamespace(constants, lexer); break; default: - if (Configuration.debugMode) { + if (Configuration.debugMode.get()) { throw new ParseException("Not supported valueType.", lexer.yyline()); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java index 189a25402..06c104599 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java @@ -297,7 +297,7 @@ public class MethodInfoParser { useParamNames = true; } } - if (!Configuration.PARAM_NAMES_ENABLE) { + if (!Configuration.paramNamesEnable.get()) { useParamNames = false; } if (useParamNames) { 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 e4c78df9a..9dec150f0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -92,7 +92,7 @@ public class MethodBody implements Cloneable, Serializable { HashMap ret = new HashMap<>(); for (int i = 1; i <= abc.method_info[this.method_info].param_types.length; i++) { String paramName = "param" + i; - if (abc.method_info[this.method_info].flagHas_paramnames() && Configuration.PARAM_NAMES_ENABLE) { + if (abc.method_info[this.method_info].flagHas_paramnames() && Configuration.paramNamesEnable.get()) { paramName = abc.constants.constant_string[abc.method_info[this.method_info].paramNames[i - 1]]; } ret.put(i, paramName); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java index 7206e6ec5..534689a06 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java @@ -253,7 +253,7 @@ public class MethodInfo { } if (!localRegNames.isEmpty()) { writer.appendNoHilight(localRegNames.get(i + 1)); - } else if ((paramNames.length > i) && (paramNames[i] != 0) && Configuration.PARAM_NAMES_ENABLE) { + } else if ((paramNames.length > i) && (paramNames[i] != 0) && Configuration.paramNamesEnable.get()) { writer.appendNoHilight(constants.constant_string[paramNames[i]]); } else { writer.appendNoHilight("param" + (i + 1)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java index 1b9ee883b..baba8c0c4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java @@ -38,7 +38,7 @@ public class ConstantIndex implements Serializable { } public String toStringNoQ() { - if (Configuration.RESOLVE_CONSTANTS) { + if (Configuration.resolveConstants.get()) { if (constantPool != null) { if (index < constantPool.size()) { return constantPool.get(index); @@ -50,7 +50,7 @@ public class ConstantIndex implements Serializable { @Override public String toString() { - if (Configuration.RESOLVE_CONSTANTS) { + if (Configuration.resolveConstants.get()) { if (constantPool != null) { if (index < constantPool.size()) { return "\"" + Helper.escapeString(constantPool.get(index)) + "\""; diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 4262e99a0..b95e7b98e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -40,106 +40,118 @@ public class Configuration { private static final File unspecifiedFile = new File("unspecified"); private static File directory = unspecifiedFile; - public static final boolean DISPLAY_FILENAME = true; - public static boolean DEBUG_COPY = false; - public static boolean dump_tags = false; + /** + * List of replacements + */ + private static List replacements = new ArrayList<>(); + + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem decompile = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem parallelSpeedUp = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem autoDeobfuscate = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem cacheOnDisk = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem internalFlashViewer = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem gotoMainClassOnStartup = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem deobfuscateUsePrevTagOnly = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem offeredAssociation = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem removeNops = null; + /** * Debug mode = throwing an error when comparing original file and * recompiled */ - public static boolean debugMode = false; + @ConfigurationDefaultBoolean(false) + @ConfigurationDescription("Debug mode = throwing an error when comparing original file and recompiled") + public static final ConfigurationItem debugMode = null; /** * Turn off reading unsafe tags (tags which can cause problems with * recompiling) */ - public static boolean DISABLE_DANGEROUS = false; + @ConfigurationDefaultBoolean(false) + @ConfigurationDescription("Turn off reading unsafe tags (tags which can cause problems with recompiling)") + public static final ConfigurationItem disableDangerous = null; /** * Turn off resolving constants in ActionScript 2 */ - public static final boolean RESOLVE_CONSTANTS = true; - /** - * Find latest constant pool in the code - */ - public static final boolean LATEST_CONSTANTPOOL_HACK = false; + @ConfigurationDefaultBoolean(true) + @ConfigurationDescription("Turn off resolving constants in ActionScript 2") + public static final ConfigurationItem resolveConstants = null; /** * Limit of code subs (for obfuscated code) */ - public static final int SUBLIMITER = 500; + @ConfigurationDefaultInt(500) + @ConfigurationDescription("Limit of code subs (for obfuscated code)") + public static final ConfigurationItem sublimiter = null; /** - * Decompilation timeout in seconds + * Total export timeout in seconds */ - public static final int DECOMPILATION_TIMEOUT = 30 * 60; + @ConfigurationDefaultInt(30 * 60) + @ConfigurationDescription("Total export timeout in seconds") + public static final ConfigurationItem exportTimeout = null; /** * Decompilation timeout in seconds for a single file */ - public static final int DECOMPILATION_TIMEOUT_FILE = 5 * 60; - //using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices - public static final boolean PARAM_NAMES_ENABLE = false; + @ConfigurationDefaultInt(5 * 60) + @ConfigurationDescription("Decompilation timeout in seconds for a single file") + public static final ConfigurationItem decompilationTimeoutFile = null; /** - * List of replacements + * Using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices */ - private static java.util.List replacements = new ArrayList<>(); - private static HashMap configDefaults = new HashMap() { - { - put("decompile", true); - put("parallelSpeedUp", true); - put("autoDeobfuscate", true); - put("cacheOnDisk", true); - put("internalFlashViewer", false); - put("gotoMainClassOnStartup", false); - put("deobfuscateUsePrevTagOnly", true); - put("decompilationTimeoutSingleMethod", 60); - put("lastSaveDir", "."); - put("lastOpenDir", "."); - put("offeredAssociation", false); - put("locale", "en"); - put("registerNameFormat", "_loc%d_"); - put("lastUpdatesCheckDate", null); - put("gui.window.width", 1000); - put("gui.window.height", 700); - put("gui.window.maximized.horizontal", false); - put("gui.window.maximized.vertical", false); - put("lastRenameType", 1); - put("removeNops", true); - } - }; + @ConfigurationDefaultBoolean(false) + @ConfigurationDescription("Using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices") + public static final ConfigurationItem paramNamesEnable = null; - public static final ConfigurationItem decompile = null; - public static final ConfigurationItem parallelSpeedUp = null; - public static final ConfigurationItem autoDeobfuscate = null; - public static final ConfigurationItem cacheOnDisk = null; - public static final ConfigurationItem internalFlashViewer = null; - public static final ConfigurationItem gotoMainClassOnStartup = null; - public static final ConfigurationItem deobfuscateUsePrevTagOnly = null; - public static final ConfigurationItem offeredAssociation = null; - public static final ConfigurationItem removeNops = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem displayFileName = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem debugCopy = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem dumpTags = null; + @ConfigurationDefaultInt(60) public static final ConfigurationItem decompilationTimeoutSingleMethod = null; + @ConfigurationDefaultInt(1) public static final ConfigurationItem lastRenameType = null; + @ConfigurationDefaultString(".") public static final ConfigurationItem lastSaveDir = null; + @ConfigurationDefaultString(".") public static final ConfigurationItem lastOpenDir = null; public static final ConfigurationItem lastExportDir = null; + @ConfigurationDefaultString("en") public static final ConfigurationItem locale = null; + @ConfigurationDefaultString("_loc%d_") public static final ConfigurationItem registerNameFormat = null; public static final ConfigurationItem lastUpdatesCheckDate = null; - @ConfigurationName(name = "gui.window.width") + @ConfigurationDefaultInt(1000) + @ConfigurationName("gui.window.width") public static final ConfigurationItem guiWindowWidth = null; - @ConfigurationName(name = "gui.window.height") + @ConfigurationDefaultInt(700) + @ConfigurationName("gui.window.height") public static final ConfigurationItem guiWindowHeight = null; - @ConfigurationName(name = "gui.window.maximized.horizontal") + @ConfigurationDefaultBoolean(false) + @ConfigurationName("gui.window.maximized.horizontal") public static final ConfigurationItem guiWindowMaximizedHorizontal = null; - @ConfigurationName(name = "gui.window.maximized.vertical") + @ConfigurationDefaultBoolean(false) + @ConfigurationName("gui.window.maximized.vertical") public static final ConfigurationItem guiWindowMaximizedVertical = null; - @ConfigurationName(name = "gui.avm2.splitPane.dividerLocation") + @ConfigurationName("gui.avm2.splitPane.dividerLocation") public static final ConfigurationItem guiAvm2SplitPaneDividerLocation = null; - @ConfigurationName(name = "guiActionSplitPaneDividerLocation") + @ConfigurationName("guiActionSplitPaneDividerLocation") public static final ConfigurationItem guiActionSplitPaneDividerLocation = null; - @ConfigurationName(name = "gui.splitPane1.dividerLocation") + @ConfigurationName("gui.splitPane1.dividerLocation") public static final ConfigurationItem guiSplitPane1DividerLocation = null; - @ConfigurationName(name = "gui.splitPane2.dividerLocation") + @ConfigurationName("gui.splitPane2.dividerLocation") public static final ConfigurationItem guiSplitPane2DividerLocation = null; private enum OSId { @@ -345,26 +357,53 @@ public class Configuration { modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - Object defaultValue = configDefaults.get(name); - + Object defaultValue = getDefaultValue(field); if (config.containsKey(name)) { field.set(null, new ConfigurationItem(field.getName(), defaultValue, config.get(name))); } else { field.set(null, new ConfigurationItem(field.getName(), defaultValue)); } } - } catch (IOException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ex) { + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ex) { + // Reflection exceptions. This should never happen + throw new Error(ex.getMessage()); + } catch (IOException ex) { 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); + if (aBool != null) { + defaultValue = aBool.value(); + } + ConfigurationDefaultInt aInt = (ConfigurationDefaultInt) field.getAnnotation(ConfigurationDefaultInt.class); + if (aInt != null) { + defaultValue = aInt.value(); + } + ConfigurationDefaultString aString = (ConfigurationDefaultString) field.getAnnotation(ConfigurationDefaultString.class); + if (aString != null) { + defaultValue = aString.value(); + } + return defaultValue; + } + + public static String getDescription(Field field) { + ConfigurationDescription a = (ConfigurationDescription) field.getAnnotation(ConfigurationDescription.class); + if (a != null) { + return a.value(); + } + return null; + } + public static Map getConfigurationFields() { Field[] fields = Configuration.class.getFields(); Map result = new HashMap<>(); for (Field field : fields) { if (ConfigurationItem.class.isAssignableFrom(field.getType())) { ConfigurationName annotation = (ConfigurationName) field.getAnnotation(ConfigurationName.class); - String name = annotation == null ? field.getName() : annotation.name(); + String name = annotation == null ? field.getName() : annotation.value(); result.put(name, field); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java new file mode 100644 index 000000000..2f419ab39 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultBoolean.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.configuration; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigurationDefaultBoolean { + + boolean value(); + +} \ No newline at end of file diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java new file mode 100644 index 000000000..b410c5331 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultInt.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.configuration; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigurationDefaultInt { + + int value(); + +} \ No newline at end of file diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java new file mode 100644 index 000000000..4ec60d357 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultString.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.configuration; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigurationDefaultString { + + String value(); + +} \ No newline at end of file diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java new file mode 100644 index 000000000..16cd6a043 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationDescription.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.configuration; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigurationDescription { + + String value(); + +} \ No newline at end of file diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java index f9bca8639..efae4d6f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/ConfigurationName.java @@ -29,6 +29,6 @@ import java.lang.annotation.Target; @Target(ElementType.FIELD) public @interface ConfigurationName { - String name(); + String value(); } \ No newline at end of file diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 0ba953dc8..d77365dbf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -148,7 +148,7 @@ public class CommandLineArgumentParser { traceLevel = Level.FINE; break; case "-debug": - Configuration.debugMode = true; + Configuration.debugMode.set(true); break; default: break OUTER; @@ -574,7 +574,7 @@ public class CommandLineArgumentParser { badArguments(); } try { - Configuration.dump_tags = true; + Configuration.dumpTags.set(true); Configuration.parallelSpeedUp.set(false); SWF swf = Main.parseSWF(args.remove()); } catch (Exception ex) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form index 44f553e37..7e2ee9701 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form @@ -3,7 +3,10 @@
- + + + + @@ -29,7 +32,8 @@ - + + @@ -43,11 +47,12 @@ - - + + + @@ -65,9 +70,10 @@ - +
+
@@ -84,6 +90,11 @@ + + + <Editor/> + <Renderer/> + </Column> </TableColumnModel> </Property> <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> @@ -109,5 +120,13 @@ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/> </Events> </Component> + <Component class="javax.swing.JButton" name="btnReset"> + <Properties> + <Property name="text" type="java.lang.String" value="Reset"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnResetActionPerformed"/> + </Events> + </Component> </SubComponents> </Form> diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java index bf536451a..c68d9d2a5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -19,10 +19,9 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.ConfigurationItem; import java.lang.reflect.Field; +import java.util.Arrays; import java.util.Map; import java.util.Map.Entry; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; @@ -44,15 +43,26 @@ public class AdvancedSettingsDialog extends AppDialog { configurationTable.setCellEditor(configurationTable.getDefaultEditor(null)); Map<String, Field> fields = Configuration.getConfigurationFields(); - for (Entry<String, Field> entry : fields.entrySet()) { - String name = entry.getKey(); - Field field = entry.getValue(); + 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(); try { ConfigurationItem item = (ConfigurationItem) field.get(null); - model.addRow(new Object[]{name, item.get()}); + String description = Configuration.getDescription(field); + if (description == null) { + description = ""; + } + Object defaultValue = Configuration.getDefaultValue(field); + if (defaultValue != null) { + description += " (default: " + defaultValue + ")"; + } + model.addRow(new Object[]{name, item.get(), description}); } catch (IllegalArgumentException | IllegalAccessException ex) { - Logger.getLogger(AdvancedSettingsDialog.class.getName()).log(Level.SEVERE, null, ex); + // Reflection exceptions. This should never happen + throw new Error(ex.getMessage()); } } } @@ -70,23 +80,25 @@ public class AdvancedSettingsDialog extends AppDialog { configurationTable = new com.jpexs.decompiler.flash.gui.EachRowRendererEditor(); btnOk = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); + btnReset = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setResizable(false); + setModal(true); + setPreferredSize(new java.awt.Dimension(600, 400)); configurationTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { - "Name", "Value" + "Name", "Value", "Description" } ) { Class[] types = new Class [] { - java.lang.String.class, java.lang.Object.class + java.lang.String.class, java.lang.Object.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { - false, true + false, true, false }; public Class getColumnClass(int columnIndex) { @@ -114,6 +126,13 @@ public class AdvancedSettingsDialog extends AppDialog { } }); + btnReset.setText("Reset"); + btnReset.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnResetActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -123,7 +142,8 @@ public class AdvancedSettingsDialog extends AppDialog { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) + .addComponent(btnReset) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnCancel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnOk))) @@ -133,11 +153,12 @@ public class AdvancedSettingsDialog extends AppDialog { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnOk) - .addComponent(btnCancel)) + .addComponent(btnCancel) + .addComponent(btnReset)) .addContainerGap()) ); @@ -157,7 +178,8 @@ public class AdvancedSettingsDialog extends AppDialog { try { item = (ConfigurationItem) field.get(null); } catch (IllegalArgumentException | IllegalAccessException ex) { - Logger.getLogger(AdvancedSettingsDialog.class.getName()).log(Level.SEVERE, null, ex); + // Reflection exceptions. This should never happen + throw new Error(ex.getMessage()); } if (item.get() != null && !item.get().equals(value)) { item.set(value); @@ -171,9 +193,28 @@ public class AdvancedSettingsDialog extends AppDialog { setVisible(false); }//GEN-LAST:event_btnCancelActionPerformed + private void btnResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResetActionPerformed + Map<String, Field> fields = Configuration.getConfigurationFields(); + for (Entry<String, Field> entry : fields.entrySet()) { + String name = entry.getKey(); + Field field = entry.getValue(); + try { + ConfigurationItem item = (ConfigurationItem) field.get(null); + item.unset(); + } catch (IllegalArgumentException | IllegalAccessException ex) { + // Reflection exceptions. This should never happen + throw new Error(ex.getMessage()); + } + } + Configuration.saveConfig(); + setVisible(false); + SelectLanguageDialog.reloadUi(); + }//GEN-LAST:event_btnResetActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOk; + private javax.swing.JButton btnReset; private com.jpexs.decompiler.flash.gui.EachRowRendererEditor configurationTable; private javax.swing.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 0700cd782..f781aaabf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -119,7 +119,7 @@ public class Main { public static void setSubLimiter(boolean value) { if (value) { - AVM2Code.toSourceLimit = Configuration.SUBLIMITER; + AVM2Code.toSourceLimit = Configuration.sublimiter.get(); } else { AVM2Code.toSourceLimit = -1; } @@ -786,7 +786,7 @@ public class Main { */ public static void main(String[] args) throws IOException { startFreeMemThread(); - initLogging(Configuration.debugMode); + initLogging(Configuration.debugMode.get()); initLang(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index c55de9db9..675ecf4dd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -622,7 +622,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T Main.exit(); } }); - setTitle(ApplicationInfo.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : "")); + setTitle(ApplicationInfo.applicationVerName + ((swf != null && Configuration.displayFileName.get()) ? " - " + Main.getFileTitle() : "")); JMenuBar menuBar = new JMenuBar(); @@ -2646,7 +2646,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "SAVEAS": if (Main.saveFileDialog()) { - setTitle(ApplicationInfo.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : "")); + setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + Main.getFileTitle() : "")); saveCommandButton.setEnabled(!Main.readOnly); } break; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java index 7c51da21b..66fdabaed 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java @@ -112,12 +112,8 @@ public class SelectLanguageDialog extends AppDialog implements ActionListener { newLanguage = ""; } Configuration.locale.set(newLanguage); - Locale.setDefault(Locale.forLanguageTag(newLanguage)); - updateLanguage(); setVisible(false); - AppStrings.updateLanguage(); - DefaultSyntaxKit.reloadConfigs(); - Main.reloadApp(); + reloadUi(); } break; case "CANCEL": @@ -126,6 +122,14 @@ public class SelectLanguageDialog extends AppDialog implements ActionListener { } } + public static void reloadUi() { + Locale.setDefault(Locale.forLanguageTag(Configuration.locale.get())); + AppStrings.updateLanguage(); + DefaultSyntaxKit.reloadConfigs(); + Main.initLang(); + Main.reloadApp(); + } + public String display() { setVisible(true); return languageCode; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index ca0577273..2071f4679 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -240,8 +240,8 @@ button.no = Nem FileChooser.openButtonText = Megnyit\u00e1s FileChooser.openButtonToolTipText = Megnyit\u00e1s -FileChooser.lookInLabelText = Minden f\u00e1jl -FileChooser.acceptAllFileFilterText = Keres\u00e9s ebben: +FileChooser.lookInLabelText = Keres\u00e9s ebben: +FileChooser.acceptAllFileFilterText = Minden f\u00e1jlt\u00edpus FileChooser.filesOfTypeLabelText = A k\u00f6vetkez\u0151 t\u00edpus\u00fa f\u00e1jlok: FileChooser.fileNameLabelText = F\u00e1jln\u00e9v: FileChooser.listViewButtonToolTipText = Lista diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java index 24bf393e4..b4bb2b778 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java @@ -245,7 +245,7 @@ public class HilightedTextWriter extends GraphTextWriter { if (toStringCalled) { throw new Error("HilightedTextWriter.toString() was already called."); } - if (Configuration.debugMode) { + if (Configuration.debugMode.get()) { long stopTime = System.currentTimeMillis(); long time = stopTime - startTime; if (time > 500) { 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 b569d7f4b..32872e5e9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java @@ -104,7 +104,7 @@ public class Highlighting implements Serializable { } } - if (Configuration.debugMode) { + if (Configuration.debugMode.get()) { if (ret != null) { System.out.println("Highlight found: " + ret.hilightedText); } @@ -132,7 +132,7 @@ public class Highlighting implements Serializable { public Highlighting(int startPos, Map<String, String> data, HilightType type, String text) { this.startPos = startPos; this.type = type; - if (Configuration.debugMode) { + if (Configuration.debugMode.get()) { this.hilightedText = text; } this.properties = data; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 44a5d5157..693e2d0af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -113,7 +113,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded */ @Override public byte[] getData(int version) { - if (Configuration.DISABLE_DANGEROUS) { + if (Configuration.disableDangerous.get()) { return super.getData(version); } @@ -121,7 +121,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, bais); } SWFOutputStream sos = new SWFOutputStream(os, version); @@ -133,7 +133,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); OutputStream os2 = baos2; byte[] origbrdata = null; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { SWFInputStream sis = new SWFInputStream(bais, version); int len = sis.readUI16(); if (len != 0) { @@ -145,14 +145,14 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded sos2.writeBUTTONRECORDList(characters, true); } byte[] brdata = baos2.toByteArray(); - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { if (origbrdata != null) { if (origbrdata.length != brdata.length) { /*throw nso*/ } } } - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { sos = new SWFOutputStream(baos, version); } if ((actions == null) || (actions.isEmpty())) { @@ -161,7 +161,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded sos.writeUI16(2 + brdata.length); } sos.write(brdata); - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { sos = new SWFOutputStream(new CopyOutputStream(baos, bais), version); } sos.writeBUTTONCONDACTIONList(actions); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index 57af72f96..a3b70675d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -112,12 +112,12 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT */ @Override public byte[] getData(int version) { - if (Configuration.DISABLE_DANGEROUS) { + if (Configuration.disableDangerous.get()) { return super.getData(version); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } SWFOutputStream sos = new SWFOutputStream(os, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index 587f8012c..9c9741212 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -163,7 +163,7 @@ public class DefineFont3Tag extends FontTag { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { sos = new SWFOutputStream(new CopyOutputStream(sos, new ByteArrayInputStream(data)), 10); } try { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 97d29fd9c..a1372dc10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -209,12 +209,12 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT */ @Override public byte[] getData(int version) { - if (Configuration.DISABLE_DANGEROUS) { + if (Configuration.disableDangerous.get()) { return super.getData(version); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } SWFOutputStream sos = new SWFOutputStream(os, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java index 5ddc42991..ffb9a83de 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java @@ -85,7 +85,7 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream os = bos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } try (SWFOutputStream sos = new SWFOutputStream(os, version)) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java index 3329cf7fb..18d17e913 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java @@ -71,7 +71,7 @@ public class DoABCTag extends Tag implements ABCContainerTag { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream os = bos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } try (SWFOutputStream sos = new SWFOutputStream(os, version)) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 435241247..fcd26ffc2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -134,12 +134,12 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO */ @Override public byte[] getData(int version) { - if (Configuration.DISABLE_DANGEROUS) { + if (Configuration.disableDangerous.get()) { return super.getData(version); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } SWFOutputStream sos = new SWFOutputStream(os, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index b69e71fa1..bf4e3c3cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -198,12 +198,12 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO */ @Override public byte[] getData(int version) { - if (Configuration.DISABLE_DANGEROUS) { + if (Configuration.disableDangerous.get()) { return super.getData(version); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } SWFOutputStream sos = new SWFOutputStream(os, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index 29c594468..e941221a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -199,12 +199,12 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO */ @Override public byte[] getData(int version) { - if (Configuration.DISABLE_DANGEROUS) { + if (Configuration.disableDangerous.get()) { return super.getData(version); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - if (Configuration.DEBUG_COPY) { + if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } SWFOutputStream sos = new SWFOutputStream(os, version);