From 91d7f2b91993caf821160a71666c2ce27d77ed71 Mon Sep 17 00:00:00 2001 From: Honfika Date: Tue, 5 Nov 2013 22:34:53 +0100 Subject: [PATCH 1/8] some warnings fixed --- .../jpexs/decompiler/flash/action/Action.java | 5 ++--- .../flash/helpers/GraphTextWriter.java | 18 +++++++++--------- .../flash/helpers/HilightedTextWriter.java | 2 +- .../flash/helpers/hilight/Highlighting.java | 1 - .../decompiler/flash/tags/base/ASMSource.java | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 5600e600f..7ad9f7173 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -386,7 +386,7 @@ public class Action implements GraphSourceItem { * @param list List of actions * @param importantOffsets List of important offsets to mark as labels * @param version SWF version - * @param hex Add hexadecimal? + * @param exportMode PCode or hex? * @param swfPos * @param path * @return HilightedTextWriter @@ -599,7 +599,7 @@ public class Action implements GraphSourceItem { * @param knownAddreses List of important offsets to mark as labels * @param constantPool Constant pool * @param version SWF version - * @param hex Add hexadecimal + * @param exportMode PCode or hex? * @return String of P-code source */ public String getASMSource(List container, List knownAddreses, List constantPool, int version, ExportMode exportMode) { @@ -696,7 +696,6 @@ public class Action implements GraphSourceItem { * @param actions List of actions * @param version SWF version * @param path - * @return String with Source code */ public static void actionsToSource(ASMSource asm, final List actions, final int version, final String path, GraphTextWriter writer) { writer.suspendMeasure(); diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java index d99491c4f..a657b6aed 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java @@ -39,10 +39,10 @@ public class GraphTextWriter { } /** - * Highlights specified text as instruction by adding special tags + * Highlights specified text as instruction * - * @param offset Offset of instruction - * @return HilightedTextWriter + * @param pos Offset of instruction + * @return GraphTextWriter */ public GraphTextWriter startOffset(GraphSourceItem src, int pos) { return this; @@ -53,10 +53,10 @@ public class GraphTextWriter { } /** - * Highlights specified text as method by adding special tags + * Highlights specified text as method * * @param index MethodInfo index - * @return HilightedTextWriter + * @return GraphTextWriter */ public GraphTextWriter startMethod(long index) { return this; @@ -67,10 +67,10 @@ public class GraphTextWriter { } /** - * Highlights specified text as class by adding special tags + * Highlights specified text as class * * @param index Class index - * @return HilightedTextWriter + * @return GraphTextWriter */ public GraphTextWriter startClass(long index) { return this; @@ -81,10 +81,10 @@ public class GraphTextWriter { } /** - * Highlights specified text as trait by adding special tags + * Highlights specified text as trait * * @param index Trait index - * @return HilightedTextWriter + * @return GraphTextWriter */ public GraphTextWriter startTrait(long index) { return this; diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java index 65592bbf2..49cfacb95 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java @@ -65,7 +65,7 @@ public class HilightedTextWriter extends GraphTextWriter { /** * Highlights specified text as instruction by adding special tags * - * @param offset Offset of instruction + * @param pos Offset of instruction * @return HilightedTextWriter */ @Override 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 8c06719ff..3e8741941 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/hilight/Highlighting.java @@ -126,7 +126,6 @@ public class Highlighting implements Serializable { /** * * @param startPos Starting position - * @param len Length of highlighted text * @param data Highlighting data * @param type Highlighting type */ diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java index 8b44efa11..a419e25aa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java @@ -33,7 +33,7 @@ public interface ASMSource { * Converts actions to ASM source * * @param version SWF version - * @param hex Add hexadecimal? + * @param exportMode PCode or hex? * @return ASM source */ public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions); From 62e97826a9defc89e49548ca9cdd927065f4338a Mon Sep 17 00:00:00 2001 From: Honfika Date: Tue, 5 Nov 2013 23:29:26 +0100 Subject: [PATCH 2/8] throw interrupted exception when Thread.isInterrupted() => timed out threads will abort --- trunk/src/com/jpexs/decompiler/flash/SWF.java | 8 ++-- .../com/jpexs/decompiler/flash/abc/ABC.java | 2 +- .../decompiler/flash/abc/avm2/AVM2Code.java | 8 ++-- .../flash/abc/avm2/graph/AVM2Graph.java | 4 +- .../flash/abc/types/MethodBody.java | 4 +- .../flash/abc/types/ScriptInfo.java | 2 +- .../flash/abc/types/traits/Trait.java | 2 +- .../flash/abc/types/traits/TraitClass.java | 2 +- .../flash/abc/types/traits/TraitFunction.java | 2 +- .../types/traits/TraitMethodGetterSetter.java | 2 +- .../flash/abc/types/traits/Traits.java | 2 +- .../jpexs/decompiler/flash/action/Action.java | 10 ++--- .../decompiler/flash/action/ActionGraph.java | 4 +- .../flash/action/ActionGraphSource.java | 2 +- .../flash/action/ActionListReader.java | 10 +++-- .../flash/action/swf3/ActionWaitForFrame.java | 2 +- .../action/swf4/ActionWaitForFrame2.java | 2 +- .../decompiler/flash/gui/GraphFrame.java | 4 +- .../jpexs/decompiler/flash/gui/MainFrame.java | 8 +++- .../flash/gui/abc/ASMSourceEditorPane.java | 10 ++++- .../flash/gui/action/ActionPanel.java | 8 +++- .../src/com/jpexs/decompiler/graph/Graph.java | 39 ++++++++++--------- .../com/jpexs/decompiler/graph/GraphPart.java | 8 +++- .../jpexs/decompiler/graph/GraphSource.java | 2 +- .../decompiler/graph/GraphSourceItem.java | 2 +- 25 files changed, 87 insertions(+), 62 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 9816c25e7..5eafd49d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -1913,7 +1913,7 @@ public class SWF { } HashMap typeCounts = new HashMap<>(); - public int deobfuscateIdentifiers(RenameType renameType) { + public int deobfuscateIdentifiers(RenameType renameType) throws InterruptedException { findFileAttributes(); if (fileAttributes == null) { int cnt = 0; @@ -1929,17 +1929,17 @@ public class SWF { } } - public void renameAS2Identifier(String identifier, String newname) { + public void renameAS2Identifier(String identifier, String newname) throws InterruptedException { Map selected = new HashMap<>(); selected.put(identifier, newname); renameAS2Identifiers(null, selected); } - public int deobfuscateAS2Identifiers(RenameType renameType) { + public int deobfuscateAS2Identifiers(RenameType renameType) throws InterruptedException { return renameAS2Identifiers(renameType, null); } - private int renameAS2Identifiers(RenameType renameType, Map selected) { + private int renameAS2Identifiers(RenameType renameType, Map selected) throws InterruptedException { actionsMap = new HashMap<>(); allFunctions = new ArrayList<>(); allVariableNames = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index b6054b171..109a934ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -99,7 +99,7 @@ public class ABC { } } - public int removeTraps() { + public int removeTraps() throws InterruptedException { int rem = 0; for (int s = 0; s < script_info.length; s++) { rem += script_info[s].removeTraps(s, this, ""); 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 e3f62e753..96b55b363 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -1405,7 +1405,7 @@ public class AVM2Code implements Serializable { ignoredIns = new ArrayList<>(); } - public List toGraphTargetItems(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo[] method_info, MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) { + public List toGraphTargetItems(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo[] method_info, MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) throws InterruptedException { initToSource(); List list; HashMap localRegs = new HashMap<>(); @@ -1654,7 +1654,7 @@ public class AVM2Code implements Serializable { return ret; } - public int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) { + public int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { removeDeadCode(constants, trait, info, body); List localData = new ArrayList<>(); localData.add((Boolean) isStatic); //isStatic @@ -2360,7 +2360,7 @@ public class AVM2Code implements Serializable { } @SuppressWarnings("unchecked") - private static int removeTraps(HashMap> refs, boolean secondPass, boolean indeterminate, List localData, Stack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions, String path) { + private static int removeTraps(HashMap> refs, boolean secondPass, boolean indeterminate, List localData, Stack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions, String path) throws InterruptedException { boolean debugMode = false; int ret = 0; iploop: @@ -2615,7 +2615,7 @@ public class AVM2Code implements Serializable { return ret; } - public static int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List localData, AVM2GraphSource code, int addr, String path, HashMap> refs) { + public static int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List localData, AVM2GraphSource code, int addr, String path, HashMap> refs) throws InterruptedException { HashMap decisions = new HashMap<>(); removeTraps(refs, false, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), new HashMap(), new HashMap>(), decisions, path); int cnt = 0; 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 064b52d72..823779865 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 @@ -113,7 +113,7 @@ public class AVM2Graph extends Graph { public static final int DATA_FINALLYJUMPS = 11; public static final int DATA_IGNOREDSWITCHES = 12; - public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) { + public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) throws InterruptedException { AVM2Graph g = new AVM2Graph(code, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames, localRegAssigmentIps, refs); List localData = new ArrayList<>(); @@ -186,7 +186,7 @@ public class AVM2Graph extends Graph { } @Override - protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) { + protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) throws InterruptedException { List ret = null; @SuppressWarnings("unchecked") 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 b363cdce1..c4243ff42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -84,7 +84,7 @@ public class MethodBody implements Cloneable, Serializable { code.restoreControlFlow(constants, trait, info, this); } - public int removeTraps(ConstantPool constants, ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) { + public int removeTraps(ConstantPool constants, ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { return code.removeTraps(constants, trait, abc.method_info[method_info], this, abc, scriptIndex, classIndex, isStatic, path); } @@ -130,7 +130,7 @@ public class MethodBody implements Cloneable, Serializable { try { Callable callable = new Callable() { @Override - public Void call() { + public Void call() throws InterruptedException { MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits); HashMap localRegNames = getLocalRegNames(abc); convertedItems = converted.code.toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap(), converted.code.visitCode(converted)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java index da0566f24..eb25e1dd7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java @@ -65,7 +65,7 @@ public class ScriptInfo { return ret; } - public int removeTraps(int scriptIndex, ABC abc, String path) { + public int removeTraps(int scriptIndex, ABC abc, String path) throws InterruptedException { return traits.removeTraps(scriptIndex, -1, true, abc, path); } 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 f25e98423..dabc290d2 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 @@ -161,7 +161,7 @@ public abstract class Trait implements Serializable { } } - public abstract int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path); + public abstract int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException; public String getPath(ABC abc) { Multiname name = getName(abc); 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 300067554..2c4a1cc39 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 @@ -529,7 +529,7 @@ public class TraitClass extends Trait implements TraitWithSlot { } @Override - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int iInitializer = abc.findBodyIndex(abc.instance_info[class_info].iinit_index); int ret = 0; if (iInitializer != -1) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java index c4a45b3ae..6c1c0403b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java @@ -96,7 +96,7 @@ public class TraitFunction extends Trait implements TraitWithSlot { } @Override - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { return abc.bodies[bodyIndex].removeTraps(abc.constants, abc, this, scriptIndex, classIndex, isStatic, path); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java index f7eb82a0c..909c5c253 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java @@ -101,7 +101,7 @@ public class TraitMethodGetterSetter extends Trait { } @Override - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { return abc.bodies[bodyIndex].removeTraps(abc.constants, abc, this, scriptIndex, classIndex, isStatic, path); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java index 9c0873e7e..657cb4590 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java @@ -43,7 +43,7 @@ public class Traits implements Serializable { return traits.length - 1; } - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int ret = 0; for (Trait t : traits) { ret += t.removeTraps(scriptIndex, classIndex, isStatic, abc, path); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 7ad9f7173..68879f3a4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -617,7 +617,7 @@ public class Action implements GraphSourceItem { * @param staticOperation the value of staticOperation * @param path the value of path */ - public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) throws InterruptedException { } /** @@ -686,7 +686,7 @@ public class Action implements GraphSourceItem { return -1; } - public static List actionsToTree(List actions, int version, int staticOperation, String path) { + public static List actionsToTree(List actions, int version, int staticOperation, String path) throws InterruptedException { return actionsToTree(new HashMap(), new HashMap(), new HashMap(), actions, version, staticOperation, path); } @@ -755,7 +755,7 @@ public class Action implements GraphSourceItem { * @param path * @return List of treeItems */ - public static List actionsToTree(HashMap regNames, HashMap variables, HashMap functions, List actions, int version, int staticOperation, String path) { + public static List actionsToTree(HashMap regNames, HashMap variables, HashMap functions, List actions, int version, int staticOperation, String path) throws InterruptedException { //Stack stack = new Stack(); return ActionGraph.translateViaGraph(regNames, variables, functions, actions, version, staticOperation, path); //return actionsToTree(regNames, stack, actions, 0, actions.size() - 1, version); @@ -763,7 +763,7 @@ public class Action implements GraphSourceItem { @Override @SuppressWarnings("unchecked") - public void translate(List localData, Stack stack, List output, int staticOperation, String path) { + public void translate(List localData, Stack stack, List output, int staticOperation, String path) throws InterruptedException { translate(stack, output, (HashMap) localData.get(0), (HashMap) localData.get(1), (HashMap) localData.get(2), staticOperation, path); } @@ -824,7 +824,7 @@ public class Action implements GraphSourceItem { logger.fine(s); } - public static List actionsPartToTree(HashMap registerNames, HashMap variables, HashMap functions, Stack stack, List actions, int start, int end, int version, int staticOperation, String path) { + public static List actionsPartToTree(HashMap registerNames, HashMap variables, HashMap functions, Stack stack, List actions, int start, int end, int version, int staticOperation, String path) throws InterruptedException { if (start < actions.size() && (end > 0) && (start > 0)) { log("Entering " + start + "-" + end + (actions.size() > 0 ? (" (" + actions.get(start).toString() + " - " + actions.get(end == actions.size() ? end - 1 : end) + ")") : "")); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 422a369b4..c9a9f54c2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -69,7 +69,7 @@ public class ActionGraph extends Graph { }*/ } - public static List translateViaGraph(HashMap registerNames, HashMap variables, HashMap functions, List code, int version, int staticOperation, String path) { + public static List translateViaGraph(HashMap registerNames, HashMap variables, HashMap functions, List code, int version, int staticOperation, String path) throws InterruptedException { ActionGraph g = new ActionGraph(code, registerNames, variables, functions, version); List localData = new ArrayList<>(); @@ -253,7 +253,7 @@ public class ActionGraph extends Graph { } @Override - protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) { + protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) throws InterruptedException { if (!output.isEmpty()) { if (output.get(output.size() - 1) instanceof StoreRegisterActionItem) { StoreRegisterActionItem str = (StoreRegisterActionItem) output.get(output.size() - 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java index 1d6795a58..2f81e6455 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java @@ -56,7 +56,7 @@ public class ActionGraphSource extends GraphSource { } @Override - public List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path) { + public List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path) throws InterruptedException { return (Action.actionsPartToTree(registerNames, variables, functions, stack, actions, start, end, version, staticOperation, path)); } private List posCache = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 388f6fda9..21f47d2d0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -150,7 +150,11 @@ public class ActionListReader { updateActionLengths(actions, version); if (deobfuscate) { - actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path); + try { + actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path); + } catch (InterruptedException ex) { + Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, ex); + } updateActionLengths(actions, version); removeZeroJumps(actions, version); } @@ -171,7 +175,7 @@ public class ActionListReader { * @return List of actions * @throws IOException */ - public static List deobfuscateActionList(List listeners, long containerSWFOffset, List actions, int version, int ip, String path) throws IOException { + public static List deobfuscateActionList(List listeners, long containerSWFOffset, List actions, int version, int ip, String path) throws IOException, InterruptedException { if (actions.isEmpty()) { return actions; } @@ -645,7 +649,7 @@ public class ActionListReader { } @SuppressWarnings("unchecked") - private static void deobfustaceActionListAtPosRecursive(List listeners, List output, HashMap> containers, long containerSWFOffset, List localData, Stack stack, ConstantPool cpool, List actions, int pos, int ip, List ret, int startIp, int endip, String path, Map visited, boolean indeterminate, Map> decisionStates, int version) throws IOException { + private static void deobfustaceActionListAtPosRecursive(List listeners, List output, HashMap> containers, long containerSWFOffset, List localData, Stack stack, ConstantPool cpool, List actions, int pos, int ip, List ret, int startIp, int endip, String path, Map visited, boolean indeterminate, Map> decisionStates, int version) throws IOException, InterruptedException { boolean debugMode = false; boolean decideBranch = false; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java index 1db2c55e9..f87c06a42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java @@ -125,7 +125,7 @@ public class ActionWaitForFrame extends Action implements ActionStore { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) throws InterruptedException { GraphTargetItem frameTi = new DirectValueActionItem(null, 0, new Long(frame), new ArrayList()); List body = ActionGraph.translateViaGraph(regNames, variables, functions, skipped, SWF.DEFAULT_VERSION, staticOperation, path); output.add(new IfFrameLoadedActionItem(frameTi, body, this)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java index c67a2ecac..2dcec2e10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java @@ -129,7 +129,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) throws InterruptedException { GraphTargetItem frame = stack.pop(); List body = ActionGraph.translateViaGraph(regNames, variables, functions, skipped, SWF.DEFAULT_VERSION, staticOperation, path); output.add(new IfFrameLoadedActionItem(frame, body, this)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java index 44bbb868d..88226886c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java @@ -47,7 +47,7 @@ public class GraphFrame extends AppFrame { private int backLinksRight = 0; private GraphPart head; - public GraphPanel(Graph graph) { + public GraphPanel(Graph graph) throws InterruptedException { graph.init(new ArrayList<>()); size = getPartPositions(head = graph.heads.get(0), SPACE_VERTICAL + SPACE_VERTICAL + BLOCK_HEIGHT / 2, getPartWidth(graph.heads.get(0), new HashSet()) * (BLOCK_WIDTH + SPACE_HORIZONTAL) / 2 - SPACE_HORIZONTAL, partPos, true); backLinksLeft = 1; @@ -240,7 +240,7 @@ public class GraphFrame extends AppFrame { int frameWidthDiff; int frameHeightDiff; - public GraphFrame(Graph graph, String name) { + public GraphFrame(Graph graph, String name) throws InterruptedException { setSize(500, 500); Container cnt = getContentPane(); cnt.setLayout(new BorderLayout()); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index a0e34211e..72b34173e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -1873,7 +1873,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel return ret; } - public void renameIdentifier(String identifier) { + public void renameIdentifier(String identifier) throws InterruptedException { String oldName = identifier; String newName = View.showInputDialog(translate("rename.enternew"), oldName); if (newName != null) { @@ -2602,7 +2602,11 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel @Override public void run() { Main.startWork(translate("work.renaming") + "..."); - renameIdentifier(identifier); + try { + renameIdentifier(identifier); + } catch (InterruptedException ex) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); + } Main.stopWork(); } }).start(); 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 75a88428e..70b8bbd15 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -38,6 +38,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Stack; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; @@ -156,8 +158,12 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } public void graph() { - AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, -1, -1, new HashMap(), new Stack(), new HashMap(), new ArrayList(), new HashMap(), abc.bodies[bodyIndex].code.visitCode(abc.bodies[bodyIndex])); - (new GraphFrame(gr, name)).setVisible(true); + try { + AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, -1, -1, new HashMap(), new Stack(), new HashMap(), new ArrayList(), new HashMap(), abc.bodies[bodyIndex].code.visitCode(abc.bodies[bodyIndex])); + (new GraphFrame(gr, name)).setVisible(true); + } catch (InterruptedException ex) { + Logger.getLogger(ASMSourceEditorPane.class.getName()).log(Level.SEVERE, null, ex); + } } public void exec() { 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 7bb2b7b65..954687cf6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -704,8 +704,12 @@ public class ActionPanel extends JPanel implements ActionListener { } if (e.getActionCommand().equals("GRAPH")) { if (lastCode != null) { - GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); - gf.setVisible(true); + try { + GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); + gf.setVisible(true); + } catch (InterruptedException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + } } } else if (e.getActionCommand().equals("EDITACTION")) { setEditMode(true); diff --git a/trunk/src/com/jpexs/decompiler/graph/Graph.java b/trunk/src/com/jpexs/decompiler/graph/Graph.java index df4f1960f..58feca16a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/graph/Graph.java @@ -64,7 +64,7 @@ public class Graph { } - public void init(List localData) { + public void init(List localData) throws InterruptedException { if (heads != null) { return; } @@ -89,17 +89,20 @@ public class Graph { } } - private void fixGraph(List localData, GraphPart part) { + private void fixGraph(List localData, GraphPart part) throws InterruptedException { //if(true) return; try { while (fixGraphOnce(localData, part, new ArrayList(), false)) { } + } catch (InterruptedException ex) { + throw ex; } catch (Exception | Error ex) { + String s = ex.toString(); //ignore } } - private boolean fixGraphOnce(List localData, GraphPart part, List visited, boolean doChildren) { + private boolean fixGraphOnce(List localData, GraphPart part, List visited, boolean doChildren) throws InterruptedException { if (visited.contains(part)) { return false; } @@ -371,11 +374,11 @@ public class Graph { /* public GraphPart getNextCommonPart(GraphPart part, List loops) { return getNextCommonPart(part, new ArrayList(),loops); }*/ - public GraphPart getNextCommonPart(List localData, GraphPart part, List loops) { + public GraphPart getNextCommonPart(List localData, GraphPart part, List loops) throws InterruptedException { return getCommonPart(localData, part.nextParts, loops); } - public GraphPart getCommonPart(List localData, List parts, List loops) { + public GraphPart getCommonPart(List localData, List parts, List loops) throws InterruptedException { if (parts.isEmpty()) { return null; } @@ -435,7 +438,7 @@ public class Graph { return null; } - public GraphPart getMostCommonPart(List localData, List parts, List loops) { + public GraphPart getMostCommonPart(List localData, List parts, List loops) throws InterruptedException { if (parts.isEmpty()) { return null; } @@ -576,13 +579,13 @@ public class Graph { return part; } - public static List translateViaGraph(List localData, String path, GraphSource code, List alternateEntries, int staticOperation) { + public static List translateViaGraph(List localData, String path, GraphSource code, List alternateEntries, int staticOperation) throws InterruptedException { Graph g = new Graph(code, alternateEntries); g.init(localData); return g.translate(localData, staticOperation, path); } - public List translate(List localData, int staticOperation, String path) { + public List translate(List localData, int staticOperation, String path) throws InterruptedException { List allParts = new ArrayList<>(); for (GraphPart head : heads) { populateParts(head, allParts); @@ -778,7 +781,7 @@ public class Graph { return false; } - protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) { + protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) throws InterruptedException { return null; } @@ -787,13 +790,13 @@ public class Graph { } @SuppressWarnings("unchecked") - protected GraphTargetItem translatePartGetStack(List localData, GraphPart part, Stack stack, int staticOperation) { + protected GraphTargetItem translatePartGetStack(List localData, GraphPart part, Stack stack, int staticOperation) throws InterruptedException { stack = (Stack) stack.clone(); translatePart(localData, part, stack, staticOperation, null); return stack.pop(); } - protected List translatePart(List localData, GraphPart part, Stack stack, int staticOperation, String path) { + protected List translatePart(List localData, GraphPart part, Stack stack, int staticOperation, String path) throws InterruptedException { List sub = part.getSubParts(); List ret = new ArrayList<>(); int end; @@ -854,7 +857,7 @@ public class Graph { list.remove(list.size() - 1); } - protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, int staticOperation, String path) { + protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, int staticOperation, String path) throws InterruptedException { return printGraph(visited, localData, stack, allParts, parent, part, stopPart, loops, null, staticOperation, path); } @@ -862,7 +865,7 @@ public class Graph { return loopItem; } - private void getPrecontinues(List localData, GraphPart parent, GraphPart part, List loops, List stopPart) { + private void getPrecontinues(List localData, GraphPart parent, GraphPart part, List loops, List stopPart) throws InterruptedException { markLevels(localData, part, loops); //Note: this also marks part as precontinue when there is if /* @@ -914,13 +917,13 @@ public class Graph { clearLoops(loops);*/ } - private void markLevels(List localData, GraphPart part, List loops) { + private void markLevels(List localData, GraphPart part, List loops) throws InterruptedException { clearLoops(loops); markLevels(localData, part, loops, new ArrayList(), 1, new ArrayList()); clearLoops(loops); } - private void markLevels(List localData, GraphPart part, List loops, List stopPart, int level, List visited) { + private void markLevels(List localData, GraphPart part, List loops, List stopPart, int level, List visited) throws InterruptedException { boolean debugMode = false; if (stopPart == null) { stopPart = new ArrayList<>(); @@ -1062,13 +1065,13 @@ public class Graph { } } - private void getLoops(List localData, GraphPart part, List loops, List stopPart) { + private void getLoops(List localData, GraphPart part, List loops, List stopPart) throws InterruptedException { clearLoops(loops); getLoops(localData, part, loops, stopPart, true, 1, new ArrayList()); clearLoops(loops); } - private void getLoops(List localData, GraphPart part, List loops, List stopPart, boolean first, int level, List visited) { + private void getLoops(List localData, GraphPart part, List loops, List stopPart, boolean first, int level, List visited) throws InterruptedException { boolean debugMode = false; if (stopPart == null) { @@ -1349,7 +1352,7 @@ public class Graph { } } - protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, List ret, int staticOperation, String path) { + protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, List ret, int staticOperation, String path) throws InterruptedException { if (stopPart == null) { stopPart = new ArrayList<>(); } diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphPart.java b/trunk/src/com/jpexs/decompiler/graph/GraphPart.java index ed04b0955..a21275278 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphPart.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphPart.java @@ -60,7 +60,11 @@ public class GraphPart implements Serializable { return time; } - private boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List visited, List loops) { + private boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List visited, List loops) throws InterruptedException { + if (Thread.currentThread().isInterrupted()) { + throw new InterruptedException(); + } + GraphPart tpart = gr.checkPart(null, localData, this, null); if (tpart == null) { return false; @@ -121,7 +125,7 @@ public class GraphPart implements Serializable { return false; } - public boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List loops) { + public boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List loops) throws InterruptedException { for (Loop l : loops) { l.leadsToMark = 0; } diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphSource.java b/trunk/src/com/jpexs/decompiler/graph/GraphSource.java index ee5e3eb38..c0682b10a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphSource.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphSource.java @@ -35,7 +35,7 @@ public abstract class GraphSource implements Serializable { public abstract boolean isEmpty(); - public abstract List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path); + public abstract List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path) throws InterruptedException; private void visitCode(int ip, int lastIp, HashMap> refs, int endIp) { boolean debugMode = false; diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java b/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java index bd4a42850..d571403bc 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java @@ -26,7 +26,7 @@ import java.util.Stack; */ public interface GraphSourceItem extends Serializable { - public void translate(List localData, Stack stack, List output, int staticOperation, String path); + public void translate(List localData, Stack stack, List output, int staticOperation, String path) throws InterruptedException; public boolean isJump(); From c00c13e9d7988b3513700a7c0b527e27d1cec08e Mon Sep 17 00:00:00 2001 From: Honfika Date: Wed, 6 Nov 2013 15:24:30 +0100 Subject: [PATCH 3/8] spanish translation improved --- .../decompiler/flash/gui/locales/ExportDialog_es.properties | 4 +++- .../decompiler/flash/gui/locales/MainFrame_es.properties | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_es.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_es.properties index cf8856208..af18a5abf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_es.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_es.properties @@ -31,7 +31,9 @@ sounds.flv = FLV (Solo audio) actionscript = ActionScript actionscript.as = AS -actionscript.pcode = PCODE +actionscript.pcode = P-code +actionscript.pcodehex = P-code con Hexadecimal +actionscript.hex = Hexadecimal dialog.title = Exportar... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties index 9196463f6..a62b44194 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties @@ -371,6 +371,8 @@ message.font.add.exists = El caracter %char% ya existe en la etiqueta de la fuen filter.gfx = Archivos ScaleForm GFx (*.gfx) filter.supported = Todos los tipos de archivo soportados (*.swf, *.gfx) +work.canceled = Cancelado +work.restoringControlFlow = Restaurando control de flujo actionscript.pcode = P-code actionscript.pcodehex = P-code con Hexadecimal From 72a9f59da633c5b0ee598ec5bc9d038424b45f77 Mon Sep 17 00:00:00 2001 From: Honfika Date: Wed, 6 Nov 2013 21:39:43 +0100 Subject: [PATCH 4/8] hexedit AS3 code --- .../flash/gui/abc/ASMSourceEditorPane.java | 62 ++++++++++++------- .../flash/gui/abc/MethodCodePanel.java | 13 ++-- .../flash/gui/action/ActionPanel.java | 39 ++++-------- .../flash/helpers/HilightedText.java | 6 ++ trunk/src/com/jpexs/helpers/Helper.java | 20 ++++++ 5 files changed, 86 insertions(+), 54 deletions(-) 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 70b8bbd15..47c59e692 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -19,10 +19,12 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; +import com.jpexs.decompiler.flash.abc.avm2.UnknownInstructionCode; import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph; import com.jpexs.decompiler.flash.abc.avm2.parser.ASM3Parser; import com.jpexs.decompiler.flash.abc.avm2.parser.MissingSymbolHandler; import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException; +import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.gui.GraphFrame; import com.jpexs.decompiler.flash.gui.View; @@ -86,9 +88,11 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi setText(textWithHex); } else { if (textHexOnly == null) { - textHexOnly = new HilightedText(Helper.byteArrToString(abc.bodies[bodyIndex].code.getBytes())); + HilightedTextWriter writer = new HilightedTextWriter(true); + Helper.byteArrayToHex(writer, abc.bodies[bodyIndex].code.getBytes()); + textHexOnly = new HilightedText(writer); } - setText(textWithHex); + setText(textHexOnly); } hilighOffset(oldOffset); } @@ -176,30 +180,44 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi public boolean save(ConstantPool constants) { try { - AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(getText().getBytes("UTF-8")), constants, trait, new MissingSymbolHandler() { - //no longer ask for adding new constants - @Override - public boolean missingString(String value) { - return true; + String text = getText(); + if (text.trim().startsWith("#hexdata")) { + byte[] data = Helper.getBytesFromHexaText(text); + MethodBody mb = abc.bodies[bodyIndex]; + mb.codeBytes = data; + try { + mb.code = new AVM2Code(new ByteArrayInputStream(mb.codeBytes)); + } catch (UnknownInstructionCode re) { + mb.code = new AVM2Code(); + Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, re); } + mb.code.compact(); + } else { + AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(text.getBytes("UTF-8")), constants, trait, new MissingSymbolHandler() { + //no longer ask for adding new constants + @Override + public boolean missingString(String value) { + return true; + } - @Override - public boolean missingInt(long value) { - return true; - } + @Override + public boolean missingInt(long value) { + return true; + } - @Override - public boolean missingUInt(long value) { - return true; - } + @Override + public boolean missingUInt(long value) { + return true; + } - @Override - public boolean missingDouble(double value) { - return true; - } - }, abc.bodies[bodyIndex], abc.method_info[abc.bodies[bodyIndex].method_info]); - acode.getBytes(abc.bodies[bodyIndex].codeBytes); - abc.bodies[bodyIndex].code = acode; + @Override + public boolean missingDouble(double value) { + return true; + } + }, abc.bodies[bodyIndex], abc.method_info[abc.bodies[bodyIndex].method_info]); + acode.getBytes(abc.bodies[bodyIndex].codeBytes); + abc.bodies[bodyIndex].code = acode; + } } catch (IOException ex) { } catch (ParseException ex) { View.showMessageDialog(this, (ex.text + " on line " + ex.line)); 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 55baa8ce4..024d08117 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java @@ -108,14 +108,12 @@ public class MethodCodePanel extends JPanel implements ActionListener { hexButton.setToolTipText(AppStrings.translate("button.viewhex")); hexButton.setMargin(new Insets(3, 3, 3, 3)); - // todo: find icon, and set visible + // todo: find icon hexOnlyButton = new JToggleButton(View.getIcon("hex16")); hexOnlyButton.setActionCommand("HEXONLY"); hexOnlyButton.addActionListener(this); hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex")); hexOnlyButton.setMargin(new Insets(3, 3, 3, 3)); - hexOnlyButton.setVisible(false); - buttonsPanel.add(graphButton); buttonsPanel.add(hexButton); @@ -137,6 +135,11 @@ public class MethodCodePanel extends JPanel implements ActionListener { } if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) { + if (e.getActionCommand().equals("HEX")) { + hexOnlyButton.setSelected(false); + } else { + hexButton.setSelected(false); + } sourceTextArea.setHex(getExportMode(), false); } } @@ -148,10 +151,10 @@ public class MethodCodePanel extends JPanel implements ActionListener { } public void setEditMode(boolean val) { + ExportMode exportMode = getExportMode(); if (val) { - sourceTextArea.setHex(ExportMode.PCODE, false); + sourceTextArea.setHex(exportMode == ExportMode.HEX ? ExportMode.HEX : ExportMode.PCODE, false); } else { - ExportMode exportMode = getExportMode(); if (exportMode != ExportMode.PCODE) { sourceTextArea.setHex(exportMode, false); } 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 954687cf6..e02018c7a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -306,7 +306,9 @@ public class ActionPanel extends JPanel implements ActionListener { } } else { if (srcHexOnly == null) { - srcHexOnly = new HilightedText(Helper.byteArrToString(src.getActionBytes())); + HilightedTextWriter writer = new HilightedTextWriter(true); + Helper.byteArrayToHex(writer, src.getActionBytes()); + srcHexOnly = new HilightedText(writer); } setText(srcHexOnly); } @@ -443,13 +445,12 @@ public class ActionPanel extends JPanel implements ActionListener { hexButton.setToolTipText(AppStrings.translate("button.viewhex")); hexButton.setMargin(new Insets(3, 3, 3, 3)); - // todo: find icon, and set visible + // todo: find icon hexOnlyButton = new JToggleButton(View.getIcon("hex16")); hexOnlyButton.setActionCommand("HEXONLY"); hexOnlyButton.addActionListener(this); hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex")); hexOnlyButton.setMargin(new Insets(3, 3, 3, 3)); - //hexOnlyButton.setVisible(false); topButtonsPan = new JPanel(); topButtonsPan.setLayout(new BoxLayout(topButtonsPan, BoxLayout.X_AXIS)); @@ -618,8 +619,7 @@ public class ActionPanel extends JPanel implements ActionListener { } public void setEditMode(boolean val) { - // todo: create UI for editing raw data - final boolean rawEdit = false; + boolean rawEdit = hexOnlyButton.isSelected(); if (val) { setText(rawEdit ? srcHexOnly : srcNoHex); @@ -630,7 +630,7 @@ public class ActionPanel extends JPanel implements ActionListener { editor.getCaret().setVisible(true); asmLabel.setIcon(View.getIcon("editing16")); } else { - setText(hexButton.isSelected() ? srcWithHex : srcNoHex); + setHex(getExportMode()); editor.setEditable(false); saveButton.setVisible(false); editButton.setVisible(true); @@ -714,6 +714,11 @@ public class ActionPanel extends JPanel implements ActionListener { } else if (e.getActionCommand().equals("EDITACTION")) { setEditMode(true); } else if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) { + if (e.getActionCommand().equals("HEX")) { + hexOnlyButton.setSelected(false); + } else { + hexButton.setSelected(false); + } setHex(getExportMode()); } else if (e.getActionCommand().equals("CANCELACTION")) { setEditMode(false); @@ -722,7 +727,7 @@ public class ActionPanel extends JPanel implements ActionListener { try { String text = editor.getText(); if (text.trim().startsWith("#hexdata")) { - src.setActionBytes(getBytesFromHexaText(text)); + src.setActionBytes(Helper.getBytesFromHexaText(text)); } else { src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION); } @@ -763,26 +768,6 @@ public class ActionPanel extends JPanel implements ActionListener { return exportMode; } - public byte[] getBytesFromHexaText(String text) { - Scanner scanner = new Scanner(text); - scanner.nextLine(); // ignore first line - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - while (scanner.hasNextLine()) { - String line = scanner.nextLine().trim(); - if (line.startsWith(";")) { - continue; - } - line = line.replace(" ", ""); - for (int i = 0; i < line.length() / 2; i++) { - String hexStr = line.substring(i * 2, (i + 1) * 2); - byte b = (byte) Integer.parseInt(hexStr, 16); - baos.write(b); - } - } - byte[] data = baos.toByteArray(); - return data; - } - public void updateSearchPos() { searchPos.setText((foundPos + 1) + "/" + found.size()); setSource(found.get(foundPos), true); diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java index 8136ade7a..91b7fa28d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedText.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.helpers; import com.jpexs.decompiler.flash.helpers.hilight.Highlighting; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -61,5 +62,10 @@ public class HilightedText implements Serializable { public HilightedText(String text) { this.text = text; + this.traitHilights = new ArrayList<>(); + this.classHilights = new ArrayList<>(); + this.methodHilights = new ArrayList<>(); + this.instructionHilights = new ArrayList<>(); + this.specialHilights = new ArrayList<>(); } } diff --git a/trunk/src/com/jpexs/helpers/Helper.java b/trunk/src/com/jpexs/helpers/Helper.java index 5db7df549..5d1c84edf 100644 --- a/trunk/src/com/jpexs/helpers/Helper.java +++ b/trunk/src/com/jpexs/helpers/Helper.java @@ -604,6 +604,26 @@ public class Helper { return writer.toString(); } + public static byte[] getBytesFromHexaText(String text) { + Scanner scanner = new Scanner(text); + scanner.nextLine(); // ignore first line + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + while (scanner.hasNextLine()) { + String line = scanner.nextLine().trim(); + if (line.startsWith(";")) { + continue; + } + line = line.replace(" ", ""); + for (int i = 0; i < line.length() / 2; i++) { + String hexStr = line.substring(i * 2, (i + 1) * 2); + byte b = (byte) Integer.parseInt(hexStr, 16); + baos.write(b); + } + } + byte[] data = baos.toByteArray(); + return data; + } + public static T timedCall(Callable c, long timeout, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { FutureTask task = new FutureTask<>(c); THREAD_POOL.execute(task); From 9870157b6bb09897ebfd5731fb64529a165d1978 Mon Sep 17 00:00:00 2001 From: Honfika Date: Wed, 6 Nov 2013 23:06:16 +0100 Subject: [PATCH 5/8] Command line parsing refactored, Advanced Settings dialog --- .../console/CommandLineArgumentParser.java | 573 ++++++++++++++++++ .../flash/gui/AdvancedSettingsDialog.form | 36 ++ .../flash/gui/AdvancedSettingsDialog.java | 63 ++ .../com/jpexs/decompiler/flash/gui/Main.java | 505 +-------------- .../jpexs/decompiler/flash/gui/MainFrame.java | 14 +- .../flash/gui/graphics/settings16.png | Bin 0 -> 512 bytes .../locales/AdvancedSettingsDialog.properties | 15 + .../flash/gui/locales/MainFrame.properties | 1 + .../flash/gui/locales/MainFrame_hu.properties | 1 + 9 files changed, 710 insertions(+), 498 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form create mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/graphics/settings16.png create mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java new file mode 100644 index 000000000..5d5f01c18 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -0,0 +1,573 @@ +/* + * 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.console; + +import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; +import com.jpexs.decompiler.flash.Configuration; +import com.jpexs.decompiler.flash.ConsoleAbortRetryIgnoreHandler; +import com.jpexs.decompiler.flash.EventListener; +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.gui.Main; +import com.jpexs.decompiler.flash.gui.View; +import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame; +import com.jpexs.decompiler.graph.ExportMode; +import com.jpexs.helpers.Helper; +import com.sun.jna.Platform; +import com.sun.jna.platform.win32.Kernel32; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.Queue; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author JPEXS + */ +public class CommandLineArgumentParser { + + private static boolean commandLineMode = false; + + private static String[] commandlineConfigBoolean = new String[]{ + "decompile", + "parallelSpeedUp", + "internalFlashViewer", + "autoDeobfuscate", + "cacheOnDisk"}; + + public static boolean isCommandLineMode() { + return commandLineMode; + } + + public static void printCmdLineUsage() { + System.out.println("Commandline arguments:"); + System.out.println(" 1) -help | --help | /?"); + System.out.println(" ...shows commandline arguments (this help)"); + System.out.println(" 2) infile"); + System.out.println(" ...opens SWF file with the decompiler GUI"); + System.out.println(" 3) -proxy (-PXXX)"); + System.out.println(" ...auto start proxy in the tray. Optional parameter -P specifies port for proxy. Defaults to 55555. "); + System.out.println(" 4) -export (as|pcode|pcodehex|hex|image|shape|movie|sound|binaryData|text|textplain|all|all_as|all_pcode|all_pcodehex|all_hex) outdirectory infile [-selectas3class class1 class2 ...]"); + System.out.println(" ...export infile sources to outdirectory as AsctionScript code (\"as\" argument) or as PCode (\"pcode\" argument), images, shapes, movies, binaryData, text with formatting, plain text or all."); + System.out.println(" When \"as\" or \"pcode\" type specified, optional \"-selectas3class\" parameter can be passed to export only selected classes (ActionScript 3 only)"); + System.out.println(" 5) -dumpSWF infile"); + System.out.println(" ...dumps list of SWF tags to console"); + System.out.println(" 6) -compress infile outfile"); + System.out.println(" ...Compress SWF infile and save it to outfile"); + System.out.println(" 7) -decompress infile outfile"); + System.out.println(" ...Decompress infile and save it to outfile"); + System.out.println(" 8) -config key=value[,key2=value2][,key3=value3...] [other parameters]"); + System.out.print(" ...Sets configuration values. Available keys[current setting]:"); + for (String key : commandlineConfigBoolean) { + System.out.print(" " + key + "[" + Configuration.getConfig(key) + "]"); + } + System.out.println(""); + System.out.println(" Values are boolean, you can use 0/1, true/false, on/off or yes/no."); + System.out.println(" If no other parameters passed, configuration is saved. Otherwise it is used only once."); + System.out.println(" DO NOT PUT space between comma (,) and next value."); + System.out.println(" 9) -onerror (abort|retryN|ignore)"); + System.out.println(" ...error handling mode. \"abort\" stops the exporting, \"retry\" tries the exporting N times, \"ignore\" ignores the current file"); + System.out.println(" 10) -timeout N"); + System.out.println(" ...decompilation timeout for a single method in AS3 or single action in AS1/2 in seconds"); + System.out.println(); + System.out.println("Examples:"); + System.out.println("java -jar ffdec.jar myfile.swf"); + System.out.println("java -jar ffdec.jar -proxy"); + System.out.println("java -jar ffdec.jar -proxy -P1234"); + System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf"); + System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf -selectas3class com.example.MyClass com.example.SecondClass"); + System.out.println("java -jar ffdec.jar -export pcode \"C:\\decompiled\\\" myfile.swf"); + System.out.println("java -jar ffdec.jar -dumpSWF myfile.swf"); + System.out.println("java -jar ffdec.jar -compress myfile.swf myfiledec.swf"); + System.out.println("java -jar ffdec.jar -decompress myfiledec.swf myfile.swf"); + System.out.println("java -jar ffdec.jar -onerror ignore -export as \"C:\\decompiled\\\" myfile.swf"); + System.out.println("java -jar ffdec.jar -onerror retry 5 -export as \"C:\\decompiled\\\" myfile.swf"); + System.out.println("java -jar ffdec.jar -config autoDeobfuscate=1,parallelSpeedUp=0 -export as \"C:\\decompiled\\\" myfile.swf"); + System.out.println(""); + System.out.println("Instead of \"java -jar ffdec.jar\" you can use ffdec.bat on Windows, ffdec.sh on Linux/MacOs"); + } + + /** + * Parses the console arguments + * @return path to the file which should be opened or null + */ + public static String parseArguments(String[] arguments) throws IOException { + Level traceLevel = Level.WARNING; + Queue args = new LinkedList<>(Arrays.asList(arguments)); + AbortRetryIgnoreHandler handler = null; + + String nextParam; + while (true) { + nextParam = args.remove(); + if (nextParam.equals("-config")) { + parseConfig(args); + if (args.isEmpty()) { + Main.saveConfig(); + System.out.println("Configuration saved"); + return null; + } + } else if (nextParam.equals("-onerror")) { + handler = parseOnError(args); + } else if (nextParam.equals("-timeout")) { + parseTimeout(args); + } else if (nextParam.equals("-affinity")) { + parseAffinity(args); + } else if (nextParam.equals("-priority")) { + parsePriority(args); + } else if (nextParam.equals("-verbose")) { + traceLevel = Level.FINE; + } else if (nextParam.equals("-debug")) { + Configuration.debugMode = true; + } else { + break; + } + + if (args.isEmpty()) { + return null; + } + } + if (nextParam.equals("-removefromcontextmenu")) { + Main.addToContextMenu(false); + System.exit(0); + } else if (nextParam.equals("-addtocontextmenu")) { + Main.addToContextMenu(true); + System.exit(0); + } else if (nextParam.equals("-proxy")) { + parseProxy(args); + } else if (nextParam.equals("-export")) { + parseExport(args, handler, traceLevel); + } else if (nextParam.equals("-compress")) { + parseCompress(args); + } else if (nextParam.equals("-decompress")) { + parseDecompress(args); + } else if (nextParam.equals("-dumpSWF")) { + parseDumpSwf(args); + } else if (nextParam.equals("-help") || nextParam.equals("--help") || nextParam.equals("/?")) { + printHeader(); + printCmdLineUsage(); + System.exit(0); + } else if (args.size() == 1) { + return args.remove(); + } else { + badArguments(); + } + + return null; + } + + public static void printHeader() { + System.out.println(Main.applicationVerName); + for (int i = 0; i < Main.applicationVerName.length(); i++) { + System.out.print("-"); + } + System.out.println(); + } + + public static void badArguments() { + System.err.println("Error: Bad Commandline Arguments!"); + printCmdLineUsage(); + System.exit(1); + } + + private static void setConfigurations(String cfgStr) { + String[] cfgs; + if (cfgStr.contains(",")) { + cfgs = cfgStr.split(","); + } else { + cfgs = new String[]{cfgStr}; + } + + for (String c : cfgs) { + String[] cp; + if (c.contains("=")) { + cp = c.split("="); + } else { + cp = new String[]{c, "1"}; + } + String key = cp[0]; + String value = cp[1]; + if (key.toLowerCase().equals("paralelSpeedUp".toLowerCase())) { + key = "parallelSpeedUp"; + } + for (String bk : commandlineConfigBoolean) { + if (key.toLowerCase().equals(bk.toLowerCase())) { + Boolean bValue = parseBooleanConfigValue(value); + if (bValue != null) { + System.out.println("Config " + bk + " set to " + bValue); + Configuration.setConfig(bk, bValue); + } + } + } + } + } + + private static Boolean parseBooleanConfigValue(String value) { + if (value == null) { + return null; + } + + Boolean bValue = null; + value = value.toLowerCase(); + if (value.equals("0") || value.equals("false") || value.equals("no") || value.equals("off")) { + bValue = false; + } + if (value.equals("1") || value.equals("true") || value.equals("yes") || value.equals("on")) { + bValue = true; + } + return bValue; + } + + private static ExportMode strToExportFormat(String exportFormatStr) { + if (exportFormatStr.equals("pcode")) { + return ExportMode.PCODE; + } else if (exportFormatStr.equals("pcodehex")) { + return ExportMode.PCODEWITHHEX; + } else if (exportFormatStr.equals("hex")) { + return ExportMode.HEX; + } else { + return ExportMode.SOURCE; + } + } + + private static void parseConfig(Queue args) { + if (args.isEmpty()) { + System.err.println("Config values expected"); + badArguments(); + } + setConfigurations(args.remove()); + } + + private static AbortRetryIgnoreHandler parseOnError(Queue args) { + int errorMode = AbortRetryIgnoreHandler.UNDEFINED; + int retryCount = 0; + + if (args.isEmpty()) { + System.err.println("onerror parameter expected"); + badArguments(); + } + String errorModeParameter = args.remove(); + switch (errorModeParameter) { + case "abort": + errorMode = AbortRetryIgnoreHandler.ABORT; + break; + case "retry": + errorMode = AbortRetryIgnoreHandler.RETRY; + if (args.isEmpty()) { + System.err.println("onerror retry count parameter expected"); + badArguments(); + } + + try { + retryCount = Integer.parseInt(args.remove()); + } catch (NumberFormatException nex) { + System.err.println("Bad retry count number"); + } + break; + case "ignore": + errorMode = AbortRetryIgnoreHandler.IGNORE; + break; + } + + return new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount); + } + + private static void parseTimeout(Queue args) { + if (args.isEmpty()) { + System.err.println("timeout parameter expected"); + badArguments(); + } + try { + int timeout = Integer.parseInt(args.remove()); + Configuration.setConfig("decompilationTimeoutSingleMethod", timeout); + } catch (NumberFormatException nex) { + System.err.println("Bad timeout value"); + } + } + + private static void parseAffinity(Queue args) { + if (Platform.isWindows()) { + if (args.isEmpty()) { + System.err.println("affinity parameter expected"); + badArguments(); + } + try { + int affinityMask = Integer.parseInt(args.remove()); + Kernel32.INSTANCE.SetProcessAffinityMask(Kernel32.INSTANCE.GetCurrentProcess(), affinityMask); + } catch (NumberFormatException nex) { + System.err.println("Bad affinityMask value"); + } + } else { + System.err.println("Process affinity setting is only available on Windows platform."); + } + } + + private static void parsePriority(Queue args) { + if (Platform.isWindows()) { + if (args.isEmpty()) { + System.err.println("priority parameter expected"); + badArguments(); + } + String priority = args.remove(); + int priorityClass = 0; + switch (priority) { + case "low": + priorityClass = Kernel32.IDLE_PRIORITY_CLASS; + break; + case "belownormal": + priorityClass = Kernel32.BELOW_NORMAL_PRIORITY_CLASS; + break; + case "normal": + priorityClass = Kernel32.NORMAL_PRIORITY_CLASS; + break; + case "abovenormal": + priorityClass = Kernel32.ABOVE_NORMAL_PRIORITY_CLASS; + break; + case "high": + priorityClass = Kernel32.HIGH_PRIORITY_CLASS; + break; + case "realtime": + priorityClass = Kernel32.REALTIME_PRIORITY_CLASS; + break; + default: + System.err.println("Bad affinityMask value"); + } + if (priorityClass != 0) { + Kernel32.INSTANCE.SetPriorityClass(Kernel32.INSTANCE.GetCurrentProcess(), priorityClass); + } + } else { + System.err.println("Process priority setting is only available on Windows platform."); + } + } + + private static void parseProxy(Queue args) { + int port = 55555; + String portStr = args.peek(); + if (portStr != null && portStr.startsWith("-P")) { + args.remove(); + try { + port = Integer.parseInt(portStr.substring(2)); + } catch (NumberFormatException nex) { + System.err.println("Bad port number"); + } + } + View.execInEventDispatch(new Runnable() { + @Override + public void run() { + if (Main.proxyFrame == null) { + Main.proxyFrame = new ProxyFrame(); + } + } + }); + Main.proxyFrame.setPort(port); + Main.addTrayIcon(); + Main.switchProxy(); + } + + private static void parseExport(Queue args, AbortRetryIgnoreHandler handler, Level traceLevel) { + if (args.size() < 3) { + badArguments(); + } + String[] validExportFormats = new String[]{ + "as", + "pcode", + "image", + "shape", + "movie", + "sound", + "binarydata", + "text", + "textplain", + "all", + "fla", + "xfl" + }; + + if (handler == null) { + handler = new ConsoleAbortRetryIgnoreHandler(AbortRetryIgnoreHandler.UNDEFINED, 0); + } + String exportFormat = args.remove().toLowerCase(); + if (!Arrays.asList(validExportFormats).contains(exportFormat)) { + System.err.println("Invalid export format:" + exportFormat); + badArguments(); + } + File outDir = new File(args.remove()); + File inFile = new File(args.remove()); + if (!inFile.exists()) { + System.err.println("Input SWF file does not exist!"); + badArguments(); + } + commandLineMode = true; + long startTime = System.currentTimeMillis(); + boolean exportOK; + try { + printHeader(); + SWF exfile = new SWF(new FileInputStream(inFile), Configuration.getConfig("parallelSpeedUp", true)); + final Level level = traceLevel; + exfile.addEventListener(new EventListener() { + @Override + public void handleEvent(String event, Object data) { + if (level.intValue() <= Level.FINE.intValue() && event.equals("exporting")) { + System.out.println((String) data); + } + if (event.equals("exported")) { + System.out.println((String) data); + } + } + }); + + switch (exportFormat) { + case "all": + case "all_as": + case "all_pcode": + case "all_pcodehex": + case "all_hex": + ExportMode allExportMode = strToExportFormat(exportFormat.substring(3)); + System.out.println("Exporting images..."); + exfile.exportImages(handler, outDir.getAbsolutePath() + File.separator + "images"); + System.out.println("Exporting shapes..."); + exfile.exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes"); + System.out.println("Exporting scripts..."); + exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", allExportMode, Configuration.getConfig("parallelSpeedUp", true)); + System.out.println("Exporting movies..."); + exfile.exportMovies(handler, outDir.getAbsolutePath() + File.separator + "movies"); + System.out.println("Exporting sounds..."); + exfile.exportSounds(handler, outDir.getAbsolutePath() + File.separator + "sounds", true, true); + System.out.println("Exporting binaryData..."); + exfile.exportBinaryData(handler, outDir.getAbsolutePath() + File.separator + "binaryData"); + System.out.println("Exporting texts..."); + exfile.exportTexts(handler, outDir.getAbsolutePath() + File.separator + "texts", true); + exportOK = true; + break; + case "image": + exfile.exportImages(handler, outDir.getAbsolutePath()); + exportOK = true; + break; + case "shape": + exfile.exportShapes(handler, outDir.getAbsolutePath()); + exportOK = true; + break; + case "as": + case "pcode": + case "pcodehex": + case "hex": + ExportMode exportMode = strToExportFormat(exportFormat); + boolean parallel = Configuration.getConfig("parallelSpeedUp", true); + if (!args.isEmpty() && args.peek().equals("-selectas3class")) { + args.remove(); + exportOK = true; + while (!args.isEmpty()) { + exportOK = exportOK && exfile.exportAS3Class(args.remove(), outDir.getAbsolutePath(), exportMode, parallel); + } + } else { + exportOK = exfile.exportActionScript(handler, outDir.getAbsolutePath(), exportMode, parallel) != null; + } + break; + case "movie": + exfile.exportMovies(handler, outDir.getAbsolutePath()); + exportOK = true; + break; + case "sound": + exfile.exportSounds(handler, outDir.getAbsolutePath(), true, true); + exportOK = true; + break; + case "binarydata": + exfile.exportBinaryData(handler, outDir.getAbsolutePath()); + exportOK = true; + break; + case "text": + exfile.exportTexts(handler, outDir.getAbsolutePath(), true); + exportOK = true; + break; + case "textplain": + exfile.exportTexts(handler, outDir.getAbsolutePath(), false); + exportOK = true; + break; + case "fla": + exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + exportOK = true; + break; + case "xfl": + exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + exportOK = true; + break; + default: + exportOK = false; + } + } catch (OutOfMemoryError | Exception ex) { + exportOK = false; + System.err.print("FAIL: Exporting Failed on Exception - "); + Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); + System.exit(1); + } + long stopTime = System.currentTimeMillis(); + long time = stopTime - startTime; + System.out.println("Export finished. Total export time: " + Helper.formatTimeSec(time)); + if (exportOK) { + System.out.println("OK"); + System.exit(0); + } else { + System.err.println("FAIL"); + System.exit(1); + } + } + + private static void parseCompress(Queue args) throws FileNotFoundException { + if (args.size() < 2) { + badArguments(); + } + + if (SWF.fws2cws(new FileInputStream(args.remove()), new FileOutputStream(args.remove()))) { + System.out.println("OK"); + } else { + System.err.println("FAIL"); + } + } + + private static void parseDecompress(Queue args) throws FileNotFoundException { + if (args.size() < 2) { + badArguments(); + } + + if (SWF.decompress(new FileInputStream(args.remove()), new FileOutputStream(args.remove()))) { + System.out.println("OK"); + System.exit(0); + } else { + System.err.println("FAIL"); + System.exit(1); + } + } + + private static void parseDumpSwf(Queue args) { + if (args.isEmpty()) { + badArguments(); + } + try { + Configuration.dump_tags = true; + Configuration.setConfig("parallelSpeedUp", false); + SWF swf = Main.parseSWF(args.remove()); + } catch (Exception ex) { + Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); + System.exit(1); + } + System.exit(0); + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form new file mode 100644 index 000000000..f040e67b3 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.form @@ -0,0 +1,36 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java new file mode 100644 index 000000000..52375b335 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 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.gui; + +/** + * + * @author JPEXS + */ +public class AdvancedSettingsDialog extends AppDialog { + + /** + * Creates new form AdvancedSettingsDialog + */ + public AdvancedSettingsDialog() { + initComponents(); + View.centerScreen(this); + View.setWindowIcon(this); + pack(); + } + + /** + * 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 + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + + pack(); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + // 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 5d5a0f333..8328f955c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -16,16 +16,14 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; import com.jpexs.decompiler.flash.Configuration; -import com.jpexs.decompiler.flash.ConsoleAbortRetryIgnoreHandler; import com.jpexs.decompiler.flash.EventListener; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.Version; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; +import com.jpexs.decompiler.flash.console.CommandLineArgumentParser; import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame; -import com.jpexs.decompiler.graph.ExportMode; import com.jpexs.helpers.Cache; import com.jpexs.helpers.Helper; import com.jpexs.helpers.ProgressListener; @@ -51,7 +49,6 @@ import java.net.URLDecoder; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Locale; import java.util.Properties; @@ -97,7 +94,6 @@ public class Main { private static boolean working = false; private static TrayIcon trayIcon; private static MenuItem stopMenuItem; - private static boolean commandLineMode = false; public static MainFrame mainFrame; private static final int UPDATE_SYSTEM_MAJOR = 1; private static final int UPDATE_SYSTEM_MINOR = 0; @@ -119,12 +115,6 @@ public class Main { } loadFromMemoryFrame.setVisible(true); } - private static String[] commandlineConfigBoolean = new String[]{ - "decompile", - "parallelSpeedUp", - "internalFlashViewer", - "autoDeobfuscate", - "cacheOnDisk"}; private static void loadProperties() { Properties prop = new Properties(); @@ -140,10 +130,6 @@ public class Main { } } - public static boolean isCommandLineMode() { - return commandLineMode; - } - /** * Get title of the file * @@ -209,7 +195,7 @@ public class Main { loadingDialog.setPercent(percent); } } - if (Main.isCommandLineMode()) { + if (CommandLineArgumentParser.isCommandLineMode()) { System.out.println(name); } } @@ -694,68 +680,6 @@ public class Main { } - public static void badArguments() { - System.err.println("Error: Bad Commandline Arguments!"); - printCmdLineUsage(); - System.exit(1); - } - - public static void printHeader() { - System.out.println(applicationVerName); - for (int i = 0; i < applicationVerName.length(); i++) { - System.out.print("-"); - } - System.out.println(); - } - - public static void printCmdLineUsage() { - System.out.println("Commandline arguments:"); - System.out.println(" 1) -help | --help | /?"); - System.out.println(" ...shows commandline arguments (this help)"); - System.out.println(" 2) infile"); - System.out.println(" ...opens SWF file with the decompiler GUI"); - System.out.println(" 3) -proxy (-PXXX)"); - System.out.println(" ...auto start proxy in the tray. Optional parameter -P specifies port for proxy. Defaults to 55555. "); - System.out.println(" 4) -export (as|pcode|pcodehex|hex|image|shape|movie|sound|binaryData|text|textplain|all|all_as|all_pcode|all_pcodehex|all_hex) outdirectory infile [-selectas3class class1 class2 ...]"); - System.out.println(" ...export infile sources to outdirectory as AsctionScript code (\"as\" argument) or as PCode (\"pcode\" argument), images, shapes, movies, binaryData, text with formatting, plain text or all."); - System.out.println(" When \"as\" or \"pcode\" type specified, optional \"-selectas3class\" parameter can be passed to export only selected classes (ActionScript 3 only)"); - System.out.println(" 5) -dumpSWF infile"); - System.out.println(" ...dumps list of SWF tags to console"); - System.out.println(" 6) -compress infile outfile"); - System.out.println(" ...Compress SWF infile and save it to outfile"); - System.out.println(" 7) -decompress infile outfile"); - System.out.println(" ...Decompress infile and save it to outfile"); - System.out.println(" 8) -config key=value[,key2=value2][,key3=value3...] [other parameters]"); - System.out.print(" ...Sets configuration values. Available keys[current setting]:"); - for (String key : commandlineConfigBoolean) { - System.out.print(" " + key + "[" + Configuration.getConfig(key) + "]"); - } - System.out.println(""); - System.out.println(" Values are boolean, you can use 0/1, true/false, on/off or yes/no."); - System.out.println(" If no other parameters passed, configuration is saved. Otherwise it is used only once."); - System.out.println(" DO NOT PUT space between comma (,) and next value."); - System.out.println(" 9) -onerror (abort|retryN|ignore)"); - System.out.println(" ...error handling mode. \"abort\" stops the exporting, \"retry\" tries the exporting N times, \"ignore\" ignores the current file"); - System.out.println(" 10) -timeout N"); - System.out.println(" ...decompilation timeout for a single method in AS3 or single action in AS1/2 in seconds"); - System.out.println(); - System.out.println("Examples:"); - System.out.println("java -jar ffdec.jar myfile.swf"); - System.out.println("java -jar ffdec.jar -proxy"); - System.out.println("java -jar ffdec.jar -proxy -P1234"); - System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf"); - System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf -selectas3class com.example.MyClass com.example.SecondClass"); - System.out.println("java -jar ffdec.jar -export pcode \"C:\\decompiled\\\" myfile.swf"); - System.out.println("java -jar ffdec.jar -dumpSWF myfile.swf"); - System.out.println("java -jar ffdec.jar -compress myfile.swf myfiledec.swf"); - System.out.println("java -jar ffdec.jar -decompress myfiledec.swf myfile.swf"); - System.out.println("java -jar ffdec.jar -onerror ignore -export as \"C:\\decompiled\\\" myfile.swf"); - System.out.println("java -jar ffdec.jar -onerror retry 5 -export as \"C:\\decompiled\\\" myfile.swf"); - System.out.println("java -jar ffdec.jar -config autoDeobfuscate=1,parallelSpeedUp=0 -export as \"C:\\decompiled\\\" myfile.swf"); - System.out.println(""); - System.out.println("Instead of \"java -jar ffdec.jar\" you can use ffdec.bat on Windows, ffdec.sh on Linux/MacOs"); - } - private static void offerAssociation() { boolean offered = Configuration.getConfig("offeredAssociation"); if (!offered) { @@ -891,13 +815,6 @@ public class Main { startFreeMemThread(); loadProperties(); Configuration.loadFromFile(getConfigFile(), getReplacementsFile()); - int pos = 0; - if (args.length > 0) { - if (args[0].equals("-debug")) { - Configuration.debugMode = true; - pos++; - } - } initLogging(Configuration.debugMode); initLang(); @@ -910,424 +827,18 @@ public class Main { Cache.setStorageType(Cache.STORAGE_MEMORY); } - int errorMode = AbortRetryIgnoreHandler.UNDEFINED; - int retryCount = 0; - Level traceLevel = Level.WARNING; - - if (args.length < pos + 1) { + if (args.length == 0) { initGui(); showModeFrame(); } else { - boolean parameterProcessed = true; - while (parameterProcessed) { - parameterProcessed = false; - if (args[pos].equals("-config")) { - parameterProcessed = true; - pos++; - if (args.length <= pos) { - System.err.println("Config values expected"); - badArguments(); - } - setConfigurations(args[pos]); - pos++; - if (args.length <= pos) { - saveConfig(); - System.out.println("Configuration saved"); - return; - } - } else if (args[pos].equals("-onerror")) { - parameterProcessed = true; - pos++; - if (args.length <= pos) { - System.err.println("onerror parameter expected"); - badArguments(); - } - String errorModeParameter = args[pos]; - switch (errorModeParameter) { - case "abort": - errorMode = AbortRetryIgnoreHandler.ABORT; - break; - case "retry": - errorMode = AbortRetryIgnoreHandler.RETRY; - pos++; - if (args.length <= pos) { - System.err.println("onerror retry count parameter expected"); - badArguments(); - } - - try { - retryCount = Integer.parseInt(args[pos]); - } catch (NumberFormatException nex) { - System.err.println("Bad retry count number"); - } - break; - case "ignore": - errorMode = AbortRetryIgnoreHandler.IGNORE; - break; - } - - pos++; - } else if (args[pos].equals("-timeout")) { - parameterProcessed = true; - pos++; - if (args.length <= pos) { - System.err.println("timeout parameter expected"); - badArguments(); - } - try { - int timeout = Integer.parseInt(args[pos]); - Configuration.setConfig("decompilationTimeoutSingleMethod", timeout); - } catch (NumberFormatException nex) { - System.err.println("Bad timeout value"); - } - - pos++; - } else if (args[pos].equals("-affinity")) { - parameterProcessed = true; - pos++; - if (Platform.isWindows()) { - if (args.length <= pos) { - System.err.println("affinity parameter expected"); - badArguments(); - } - try { - int affinityMask = Integer.parseInt(args[pos]); - Kernel32.INSTANCE.SetProcessAffinityMask(Kernel32.INSTANCE.GetCurrentProcess(), affinityMask); - } catch (NumberFormatException nex) { - System.err.println("Bad affinityMask value"); - } - - pos++; - } else { - System.err.println("Process affinity setting is only available on Windows platform."); - } - } else if (args[pos].equals("-priority")) { - parameterProcessed = true; - pos++; - if (Platform.isWindows()) { - if (args.length <= pos) { - System.err.println("priority parameter expected"); - badArguments(); - } - String priority = args[pos]; - int priorityClass = 0; - switch (priority) { - case "low": - priorityClass = Kernel32.IDLE_PRIORITY_CLASS; - break; - case "belownormal": - priorityClass = Kernel32.BELOW_NORMAL_PRIORITY_CLASS; - break; - case "normal": - priorityClass = Kernel32.NORMAL_PRIORITY_CLASS; - break; - case "abovenormal": - priorityClass = Kernel32.ABOVE_NORMAL_PRIORITY_CLASS; - break; - case "high": - priorityClass = Kernel32.HIGH_PRIORITY_CLASS; - break; - case "realtime": - priorityClass = Kernel32.REALTIME_PRIORITY_CLASS; - break; - default: - System.err.println("Bad affinityMask value"); - } - if (priorityClass != 0) { - Kernel32.INSTANCE.SetPriorityClass(Kernel32.INSTANCE.GetCurrentProcess(), priorityClass); - } - - pos++; - } else { - System.err.println("Process priority setting is only available on Windows platform."); - } - } else if (args[pos].equals("-verbose")) { - parameterProcessed = true; - pos++; - traceLevel = Level.FINE; - } - } - if (args[pos].equals("-removefromcontextmenu")) { - addToContextMenu(false); - System.exit(0); - } else if (args[pos].equals("-addtocontextmenu")) { - addToContextMenu(true); - System.exit(0); - } else if (args[pos].equals("-proxy")) { - int port = 55555; - for (int i = pos; i < args.length; i++) { - if (args[i].startsWith("-P")) { - try { - port = Integer.parseInt(args[pos].substring(2)); - } catch (NumberFormatException nex) { - System.err.println("Bad port number"); - } - } - } - View.execInEventDispatch(new Runnable() { - @Override - public void run() { - if (proxyFrame == null) { - proxyFrame = new ProxyFrame(); - } - } - }); - proxyFrame.setPort(port); - addTrayIcon(); - switchProxy(); - - } else if (args[pos].equals("-export")) { - if (args.length < pos + 4) { - badArguments(); - } - String[] validExportFormats = new String[]{ - "as", - "pcode", - "image", - "shape", - "movie", - "sound", - "binarydata", - "text", - "textplain", - "all", - "fla", - "xfl" - }; - - AbortRetryIgnoreHandler handler = new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount); - String exportFormat = args[pos + 1].toLowerCase(); - if (!Arrays.asList(validExportFormats).contains(exportFormat)) { - System.err.println("Invalid export format:" + exportFormat); - badArguments(); - } - File outDir = new File(args[pos + 2]); - File inFile = new File(args[pos + 3]); - if (!inFile.exists()) { - System.err.println("Input SWF file does not exist!"); - badArguments(); - } - commandLineMode = true; - long startTime = System.currentTimeMillis(); - boolean exportOK; - try { - printHeader(); - SWF exfile = new SWF(new FileInputStream(inFile), Configuration.getConfig("parallelSpeedUp", true)); - final Level level = traceLevel; - exfile.addEventListener(new EventListener() { - @Override - public void handleEvent(String event, Object data) { - if (level.intValue() <= Level.FINE.intValue() && event.equals("exporting")) { - System.out.println((String) data); - } - if (event.equals("exported")) { - System.out.println((String) data); - } - } - }); - - switch (exportFormat) { - case "all": - case "all_as": - case "all_pcode": - case "all_pcodehex": - case "all_hex": - ExportMode allExportMode = strToExportFormat(exportFormat.substring(3)); - System.out.println("Exporting images..."); - exfile.exportImages(handler, outDir.getAbsolutePath() + File.separator + "images"); - System.out.println("Exporting shapes..."); - exfile.exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes"); - System.out.println("Exporting scripts..."); - exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", allExportMode, Configuration.getConfig("parallelSpeedUp", true)); - System.out.println("Exporting movies..."); - exfile.exportMovies(handler, outDir.getAbsolutePath() + File.separator + "movies"); - System.out.println("Exporting sounds..."); - exfile.exportSounds(handler, outDir.getAbsolutePath() + File.separator + "sounds", true, true); - System.out.println("Exporting binaryData..."); - exfile.exportBinaryData(handler, outDir.getAbsolutePath() + File.separator + "binaryData"); - System.out.println("Exporting texts..."); - exfile.exportTexts(handler, outDir.getAbsolutePath() + File.separator + "texts", true); - exportOK = true; - break; - case "image": - exfile.exportImages(handler, outDir.getAbsolutePath()); - exportOK = true; - break; - case "shape": - exfile.exportShapes(handler, outDir.getAbsolutePath()); - exportOK = true; - break; - case "as": - case "pcode": - case "pcodehex": - case "hex": - ExportMode exportMode = strToExportFormat(exportFormat); - boolean parallel = Configuration.getConfig("parallelSpeedUp", true); - if ((pos + 5 < args.length) && (args[pos + 4].equals("-selectas3class"))) { - exportOK = true; - for (int i = pos + 5; i < args.length; i++) { - exportOK = exportOK && exfile.exportAS3Class(args[i], outDir.getAbsolutePath(), exportMode, parallel); - } - } else { - exportOK = exfile.exportActionScript(handler, outDir.getAbsolutePath(), exportMode, parallel) != null; - } - break; - case "movie": - exfile.exportMovies(handler, outDir.getAbsolutePath()); - exportOK = true; - break; - case "sound": - exfile.exportSounds(handler, outDir.getAbsolutePath(), true, true); - exportOK = true; - break; - case "binarydata": - exfile.exportBinaryData(handler, outDir.getAbsolutePath()); - exportOK = true; - break; - case "text": - exfile.exportTexts(handler, outDir.getAbsolutePath(), true); - exportOK = true; - break; - case "textplain": - exfile.exportTexts(handler, outDir.getAbsolutePath(), false); - exportOK = true; - break; - case "fla": - exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, Configuration.getConfig("parallelSpeedUp", true)); - exportOK = true; - break; - case "xfl": - exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, Configuration.getConfig("parallelSpeedUp", true)); - exportOK = true; - break; - default: - exportOK = false; - } - } catch (OutOfMemoryError | Exception ex) { - exportOK = false; - System.err.print("FAIL: Exporting Failed on Exception - "); - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); - System.exit(1); - } - long stopTime = System.currentTimeMillis(); - long time = stopTime - startTime; - System.out.println("Export finished. Total export time: " + Helper.formatTimeSec(time)); - if (exportOK) { - System.out.println("OK"); - System.exit(0); - } else { - System.err.println("FAIL"); - System.exit(1); - } - } else if (args[pos].equals("-compress")) { - if (args.length < pos + 3) { - badArguments(); - } - - if (SWF.fws2cws(new FileInputStream(args[pos + 1]), new FileOutputStream(args[pos + 2]))) { - System.out.println("OK"); - } else { - System.err.println("FAIL"); - } - } else if (args[pos].equals("-decompress")) { - if (args.length < pos + 3) { - badArguments(); - } - - if (SWF.decompress(new FileInputStream(args[pos + 1]), new FileOutputStream(args[pos + 2]))) { - System.out.println("OK"); - System.exit(0); - } else { - System.err.println("FAIL"); - System.exit(1); - } - } else if (args[pos].equals("-dumpSWF")) { - if (args.length < pos + 2) { - badArguments(); - } - try { - Configuration.dump_tags = true; - Configuration.setConfig("parallelSpeedUp", false); - SWF swf = parseSWF(args[pos + 1]); - } catch (Exception ex) { - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); - System.exit(1); - } - System.exit(0); - } else if (args[pos].equals("-help") || args[pos].equals("--help") || args[pos].equals("/?")) { - printHeader(); - printCmdLineUsage(); - System.exit(0); - } else if (args.length == pos + 1) { - + String fileToOpen = CommandLineArgumentParser.parseArguments(args); + if (fileToOpen != null) { initGui(); - openFile(args[pos]); - } else { - badArguments(); + openFile(fileToOpen); } } } - private static ExportMode strToExportFormat(String exportFormatStr) { - if (exportFormatStr.equals("pcode")) { - return ExportMode.PCODE; - } else if (exportFormatStr.equals("pcodehex")) { - return ExportMode.PCODEWITHHEX; - } else if (exportFormatStr.equals("hex")) { - return ExportMode.HEX; - } else { - return ExportMode.SOURCE; - } - } - - private static void setConfigurations(String cfgStr) { - String[] cfgs; - if (cfgStr.contains(",")) { - cfgs = cfgStr.split(","); - } else { - cfgs = new String[]{cfgStr}; - } - - for (String c : cfgs) { - String[] cp; - if (c.contains("=")) { - cp = c.split("="); - } else { - cp = new String[]{c, "1"}; - } - String key = cp[0]; - String value = cp[1]; - if (key.toLowerCase().equals("paralelSpeedUp".toLowerCase())) { - key = "parallelSpeedUp"; - } - for (String bk : commandlineConfigBoolean) { - if (key.toLowerCase().equals(bk.toLowerCase())) { - Boolean bValue = parseBooleanConfigValue(value); - if (bValue != null) { - System.out.println("Config " + bk + " set to " + bValue); - Configuration.setConfig(bk, bValue); - } - } - } - } - } - - private static Boolean parseBooleanConfigValue(String value) { - if (value == null) { - return null; - } - - Boolean bValue = null; - value = value.toLowerCase(); - if (value.equals("0") || value.equals("false") || value.equals("no") || value.equals("off")) { - bValue = false; - } - if (value.equals("1") || value.equals("true") || value.equals("yes") || value.equals("on")) { - bValue = true; - } - return bValue; - } - public static String tempFile(String url) throws IOException { File f = new File(getFFDecHome() + "saved" + File.separator); if (!f.exists()) { @@ -1443,6 +954,10 @@ public class Main { (new AboutDialog()).setVisible(true); } + public static void advancedSettings() { + (new AdvancedSettingsDialog()).setVisible(true); + } + public static void autoCheckForUpdates() { Calendar lastUpdatesCheckDate = Configuration.getConfig("lastUpdatesCheckDate", null); if ((lastUpdatesCheckDate == null) || (lastUpdatesCheckDate.getTime().getTime() < Calendar.getInstance().getTime().getTime() - 1000 * 60 * 60 * 24)) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 72b34173e..bef3a05a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -391,7 +391,6 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel JCommandButton reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16")); assignListener(reloadCommandButton, "RELOAD"); - editBand.addCommandButton(openCommandButton, RibbonElementPriority.TOP); editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP); editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.MEDIUM); @@ -477,7 +476,6 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel miGotoMainClassOnStartup = new JCheckBox(translate("menu.settings.gotoMainClassOnStartup")); //assignListener(miGotoMainClassOnStartup,"GOTODOCUMENTCLASSONSTARTUP"); - settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation)); settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer)); settingsBand.addRibbonComponent(new JRibbonComponent(miParallelSpeedUp)); @@ -500,8 +498,15 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel JCommandButton setLanguageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.settings.language")), View.getResizableIcon("setlanguage32")); assignListener(setLanguageCommandButton, "SETLANGUAGE"); languageBand.addCommandButton(setLanguageCommandButton, RibbonElementPriority.TOP); - RibbonTask settingsTask = new RibbonTask(translate("menu.settings"), settingsBand, languageBand); + JRibbonBand advancedSettingsBand = new JRibbonBand(translate("menu.advancedsettings.advancedsettings"), null); + advancedSettingsBand.setResizePolicies((List) Arrays.asList(new CoreRibbonResizePolicies.Mirror(advancedSettingsBand.getControlPanel()), new IconRibbonBandResizePolicy(advancedSettingsBand.getControlPanel()))); + JCommandButton advancedSettingsCommandButton = new JCommandButton(fixCommandTitle(translate("menu.advancedsettings.advancedsettings")), View.getResizableIcon("settings16")); + assignListener(advancedSettingsCommandButton, "ADVANCEDSETTINGS"); + + advancedSettingsBand.addCommandButton(advancedSettingsCommandButton, RibbonElementPriority.MEDIUM); + + RibbonTask settingsTask = new RibbonTask(translate("menu.settings"), settingsBand, languageBand, advancedSettingsBand); //----------------------------------------- HELP ----------------------------------- @@ -2313,6 +2318,9 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel Main.reloadSWF(); } break; + case "ADVANCEDSETTINGS": + Main.advancedSettings(); + break; case "LOADMEMORY": Main.loadFromMemory(); break; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/settings16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/settings16.png new file mode 100644 index 0000000000000000000000000000000000000000..67de2c6ccbeac17742f56cf7391e72b2bf5033ba GIT binary patch literal 512 zcmV+b0{{JqP)CQDsH?WF>AIFt zQuJ}i;w2$ZUU#3SZ6RY0Gw;kZ&ol1~2ky^QZ(fom$=jNJZt!z7w_pH~wdQ;R)Gh%BbQFCx+Nm!4SuS-vkr`vhhrX zM*>w%e+v~?m@q~ImPAgtLkR_3U<2F8LP3W5=LJ*ZN|S5p#sf4YFr$p~Q~Z*0Ngxf2 zjk#J#<7EAlhzlrV53~GF&pIzcCN_lz9@05UeoUXiK%N z#x+4o*i_c|6_Uu1+&TIho?3@y4k-#b8Y_o94zW*B3a1ne2-Y5s0uke$$|@=}OP-i= zNYZQA=>PrZu0MfSL=b8UhD_={W4IY1{b{)U)*gc45xtL%IYLY&hF;d`@GzI&7H&D# zh;z_BX$#hqh@q?AY3sJTod2%*Yd)_>YM0#q&ixGuh+PQsneK)F0000. + diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 6a5c3bec7..5e8dcbf10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -368,3 +368,4 @@ filter.gfx = ScaleForm GFx files (*.gfx) filter.supported = All supported filetypes (*.swf, *.gfx) work.canceled = Canceled work.restoringControlFlow = Restoring control flow +menu.advancedsettings.advancedsettings = Advanced Settings 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 038bd6cab..926319a3e 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 @@ -372,3 +372,4 @@ filter.gfx = ScaleForm GFx f\u00e1jlok (*.gfx) filter.supported = Minden t\u00e1mogatott f\u00e1jlt\u00edpus (*.swf, *.gfx) work.canceled = Megszak\u00edtva work.restoringControlFlow = Vez\u00e9rl\u00e9si-folyam helyre\u00e1ll\u00edt\u00e1s +menu.advancedsettings.advancedsettings = Halad\u00f3 be\u00e1ll\u00edt\u00e1sok From bef5f0ae675418416a268efd218d9a6a045946d4 Mon Sep 17 00:00:00 2001 From: Honfika Date: Thu, 7 Nov 2013 00:26:49 +0100 Subject: [PATCH 6/8] cleanup with "Inspect and Transform" --- .../browsers/cache/chrome/ChromeCache.java | 2 +- trunk/src/com/jpexs/decompiler/flash/SWF.java | 119 +++---- .../decompiler/flash/SWFInputStream.java | 2 +- .../decompiler/flash/SWFOutputStream.java | 6 +- .../com/jpexs/decompiler/flash/TagNode.java | 2 +- .../com/jpexs/decompiler/flash/abc/ABC.java | 14 +- .../decompiler/flash/abc/ABCInputStream.java | 10 +- .../decompiler/flash/abc/ABCOutputStream.java | 12 +- .../jpexs/decompiler/flash/abc/ClassPath.java | 2 +- .../decompiler/flash/abc/ScriptPack.java | 2 +- .../avm2/instructions/AVM2Instruction.java | 2 +- .../instructions/other/SetPropertyIns.java | 2 +- .../avm2/instructions/types/ConvertBIns.java | 2 +- .../abc/avm2/model/FullMultinameAVM2Item.java | 2 +- .../abc/avm2/model/NewFunctionAVM2Item.java | 2 +- .../methodinfo_parser/MethodInfoParser.java | 8 +- .../flash/abc/types/InstanceInfo.java | 4 +- .../decompiler/flash/abc/types/Multiname.java | 2 +- .../decompiler/flash/abc/types/Namespace.java | 2 +- .../flash/abc/types/traits/Trait.java | 8 +- .../flash/abc/types/traits/TraitClass.java | 28 +- .../flash/abc/types/traits/Traits.java | 2 +- .../jpexs/decompiler/flash/action/Action.java | 2 +- .../decompiler/flash/action/ActionGraph.java | 2 +- .../flash/action/ActionListReader.java | 21 +- .../action/model/FunctionActionItem.java | 4 +- .../parser/script/ActionScriptLexer.java | 2 +- .../flash/action/swf3/ActionGetURL.java | 6 +- .../flash/action/swf4/RegisterNumber.java | 4 +- .../console/CommandLineArgumentParser.java | 69 ++-- .../decompiler/flash/ecma/EcmaScript.java | 4 +- .../decompiler/flash/gui/ImagePanel.java | 2 +- .../flash/gui/LoadFromCacheFrame.java | 6 +- .../com/jpexs/decompiler/flash/gui/Main.java | 10 +- .../jpexs/decompiler/flash/gui/MainFrame.java | 20 +- .../decompiler/flash/gui/abc/ABCPanel.java | 2 +- .../flash/gui/abc/ClassesListTree.java | 2 +- .../flash/gui/abc/ClassesListTreeModel.java | 2 +- .../flash/gui/abc/NewTraitDialog.java | 4 +- .../flash/gui/abc/TraitsListModel.java | 2 +- .../flash/gui/action/ActionPanel.java | 122 +++---- .../flash/gui/player/PlayerControls.java | 6 +- .../flash/gui/proxy/ProxyFrame.java | 2 +- .../flash/tags/DefineBitsLossless2Tag.java | 2 +- .../flash/tags/DefineBitsLosslessTag.java | 2 +- .../flash/tags/DefineEditTextTag.java | 300 ++++++++++-------- .../decompiler/flash/tags/DefineText2Tag.java | 213 +++++++------ .../decompiler/flash/tags/DefineTextTag.java | 228 ++++++------- .../flash/tags/DoInitActionTag.java | 4 +- .../flash/tags/base/CharacterIdTag.java | 4 +- .../decompiler/flash/tags/base/FontTag.java | 4 +- .../flash/tags/gfx/DefineCompactedFont.java | 2 +- .../flash/types/filters/Filtering.java | 5 +- .../flash/types/gfx/ContourType.java | 4 +- .../decompiler/flash/types/gfx/EdgeType.java | 1 - .../flash/types/gfx/GFxInputStream.java | 12 +- .../flash/types/shaperecords/SHAPERECORD.java | 4 +- .../decompiler/flash/xfl/XFLConverter.java | 173 +++++----- .../jpexs/decompiler/graph/ExportMode.java | 5 +- trunk/src/com/jpexs/helpers/Helper.java | 21 +- trunk/src/com/jpexs/process/Process.java | 1 - trunk/src/com/jpexs/process/ProcessTools.java | 1 - .../process/win32/Win32ProcessTools.java | 4 +- .../sun/jna/platform/win32/Advapi32Util.java | 10 +- .../com/sun/jna/platform/win32/BaseTSD.java | 2 +- .../com/sun/jna/platform/win32/WinDef.java | 22 +- .../src/com/sun/jna/platform/win32/WinNT.java | 2 +- .../com/sun/jna/platform/win32/WinReg.java | 2 +- .../flash/generators/AS2Generator.java | 2 +- 69 files changed, 821 insertions(+), 738 deletions(-) diff --git a/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java b/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java index aa7a096a0..acf225885 100644 --- a/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java +++ b/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java @@ -56,7 +56,7 @@ public class ChromeCache implements CacheImplementation { for (EntryStore en : entries) { if (en.state == EntryStore.ENTRY_NORMAL) { String key = en.getKey(); - if (key != null && !key.trim().equals("")) { + if (key != null && !key.trim().isEmpty()) { ret.add(en); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 5eafd49d8..7c4c23512 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -141,7 +141,7 @@ import javax.imageio.ImageIO; * * @author JPEXS */ -public class SWF { +public final class SWF { /** * Default version of SWF file format @@ -479,52 +479,56 @@ public class SWF { byte[] hdr = new byte[3]; fis.read(hdr); String shdr = new String(hdr, "utf-8"); - if (shdr.equals("CWS")) { - int version = fis.read(); - SWFInputStream sis = new SWFInputStream(fis, version, 4); - long fileSize = sis.readUI32(); - SWFOutputStream sos = new SWFOutputStream(fos, version); - sos.write("FWS".getBytes("utf-8")); - sos.writeUI8(version); - sos.writeUI32(fileSize); - InflaterInputStream iis = new InflaterInputStream(fis); - int i; - while ((i = iis.read()) != -1) { - fos.write(i); - } - - fis.close(); - fos.close(); - } else if (shdr.equals("ZWS")) { - int version = fis.read(); - SWFInputStream sis = new SWFInputStream(fis, version, 4); - long fileSize = sis.readUI32(); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - sis.readUI32(); //outSize - 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("FWS".getBytes("utf-8")); - sos.write(version); - sos.writeUI32(fileSize); - sos.write(baos.toByteArray()); - } - fis.close(); - fos.close(); - } else { - return false; + 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); + sos.write("FWS".getBytes("utf-8")); + sos.writeUI8(version); + sos.writeUI32(fileSize); + InflaterInputStream iis = new InflaterInputStream(fis); + int i; + while ((i = iis.read()) != -1) { + fos.write(i); + } + 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("FWS".getBytes("utf-8")); + sos.write(version); + sos.writeUI32(fileSize); + sos.write(baos.toByteArray()); + } + fis.close(); + fos.close(); + break; + } + default: + return false; } } catch (FileNotFoundException ex) { return false; @@ -842,7 +846,7 @@ public class SWF { expName = ""; } if (expName.contains(".")) { - expName = expName.substring(expName.lastIndexOf(".") + 1); + expName = expName.substring(expName.lastIndexOf('.') + 1); } if ((ct.getClass().getName() + "_" + expName).compareTo(addNode.tag.getClass().getName() + "_" + pathParts[pos]) > 0) { break; @@ -1023,7 +1027,7 @@ public class SWF { private static void writeLE(OutputStream os, long val, int size) throws IOException { for (int i = 0; i < size; i++) { os.write((int) (val & 0xff)); - val = val >> 8; + val >>= 8; } } @@ -1528,17 +1532,17 @@ public class SWF { } if (allVariableNamesStr.contains(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue loopfoo; } if (isReserved(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } if (deobfuscated.containsValue(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } } while (exists); @@ -1856,13 +1860,13 @@ public class SWF { String pkg = null; String name = ""; if (n.contains(".")) { - pkg = n.substring(0, n.lastIndexOf(".")); - name = n.substring(n.lastIndexOf(".") + 1); + pkg = n.substring(0, n.lastIndexOf('.')); + name = n.substring(n.lastIndexOf('.') + 1); } else { name = n; } boolean changed = false; - if ((pkg != null) && (!pkg.equals(""))) { + if ((pkg != null) && (!pkg.isEmpty())) { String changedPkg = deobfuscatePackage(pkg, renameType, selected); if (changedPkg != null) { changed = true; @@ -2092,7 +2096,7 @@ public class SWF { informListeners("rename", "function " + fc + "/" + allFunctions.size()); if (fun instanceof ActionDefineFunction) { ActionDefineFunction f = (ActionDefineFunction) fun; - if (f.functionName.equals("")) { //anonymous function, leave as is + if (f.functionName.isEmpty()) { //anonymous function, leave as is continue; } String changed = deobfuscateName(f.functionName, false, "function", renameType, selected); @@ -2103,7 +2107,7 @@ public class SWF { } if (fun instanceof ActionDefineFunction2) { ActionDefineFunction2 f = (ActionDefineFunction2) fun; - if (f.functionName.equals("")) { //anonymous function, leave as is + if (f.functionName.isEmpty()) { //anonymous function, leave as is continue; } String changed = deobfuscateName(f.functionName, false, "function", renameType, selected); @@ -2524,7 +2528,6 @@ public class SWF { f++; } } - return; } public void removeTagFromTimeline(Tag toRemove, List timeline) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index f07d642a9..a163a31b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -471,7 +471,7 @@ public class SWFInputStream extends InputStream { } for (int bit = 0; bit < nBits; bit++) { int nb = (tempByte >> (7 - bitPos)) & 1; - ret = ret + (nb << (nBits - 1 - bit)); + ret += (nb << (nBits - 1 - bit)); bitPos++; if (bitPos == 8) { bitPos = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index a13c16192..2f0f84e05 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -236,7 +236,7 @@ public class SWFOutputStream extends OutputStream { int sign = bits >> 31; int exponent = (bits >> 22) & 0xff; int mantisa = bits & 0x3FFFFF; - mantisa = mantisa >> 13; + mantisa >>= 13; writeUI16((sign << 15) + (exponent << 10) + mantisa); } @@ -248,7 +248,7 @@ public class SWFOutputStream extends OutputStream { */ public void writeEncodedU32(long value) throws IOException { boolean loop = true; - value = value & 0xFFFFFFFF; + value &= 0xFFFFFFFF; do { int ret = (int) (value & 0x7F); if (value < 0x80) { @@ -258,7 +258,7 @@ public class SWFOutputStream extends OutputStream { ret += 0x80; } write(ret); - value = value >> 7; + value >>= 7; } while (loop); } diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index ac3384e32..2e77ef927 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -277,7 +277,7 @@ public class TagNode { File dir = new File(outdir); List ret = new ArrayList<>(); if (!outdir.endsWith(File.separator)) { - outdir = outdir + File.separator; + outdir += File.separator; } List existingNames = new ArrayList<>(); for (TagNode node : nodeList) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index 109a934ee..80fba2add 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -274,10 +274,10 @@ public class ABC { String pkg = ""; String name = fullname; if (fullname.contains(".")) { - pkg = fullname.substring(0, fullname.lastIndexOf(".")); - name = fullname.substring(fullname.lastIndexOf(".") + 1); + pkg = fullname.substring(0, fullname.lastIndexOf('.')); + name = fullname.substring(fullname.lastIndexOf('.') + 1); } - if (!pkg.equals("")) { + if (!pkg.isEmpty()) { int pkgStrIndex = constants.getStringId(pkg, true); pkgStrIndex = deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, pkgStrIndex, renameType); pkg = constants.constant_string[pkgStrIndex]; @@ -286,7 +286,7 @@ public class ABC { nameStrIndex = deobfuscateName(stringUsageTypes, stringUsages, namespaceUsages, namesMap, nameStrIndex, true, renameType); name = constants.constant_string[nameStrIndex]; String fullChanged = ""; - if (!pkg.equals("")) { + if (!pkg.isEmpty()) { fullChanged = pkg + "."; } fullChanged += name; @@ -823,18 +823,18 @@ public class ABC { for (int i = 1; i < constants.constant_string.length; i++) { if (constants.constant_string[i].equals(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue loopfoo; } } if (isReserved(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } if (deobfuscated.containsValue(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } } while (exists); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index c4a985adc..8b76d9fd9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -109,8 +109,8 @@ public class ABCInputStream extends InputStream { do { i = read(); nextByte = (i >> 7) == 1; - i = i & 0x7f; - ret = ret + (i << bytePos); + i &= 0x7f; + ret += (i << bytePos); byteCount++; bytePos += 7; } while (nextByte); @@ -125,7 +125,7 @@ public class ABCInputStream extends InputStream { int ret = (read()) + (read() << 8) + (read() << 16); if ((ret >> 23) == 1) { - ret = ret | 0xff000000; + ret |= 0xff000000; } return ret; @@ -144,8 +144,8 @@ public class ABCInputStream extends InputStream { do { i = read(); nextByte = (i >> 7) == 1; - i = i & 0x7f; - ret = ret + (i << bytePos); + i &= 0x7f; + ret += (i << bytePos); byteCount++; bytePos += 7; if (bytePos == 35) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java index c928c85a9..cfda6c601 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java @@ -60,7 +60,7 @@ public class ABCOutputStream extends OutputStream { public void writeU32(long value) throws IOException { boolean loop = true; - value = value & 0xFFFFFFFF; + value &= 0xFFFFFFFF; do { int ret = (int) (value & 0x7F); if (value < 0x80) { @@ -70,17 +70,17 @@ public class ABCOutputStream extends OutputStream { ret += 0x80; } write(ret); - value = value >> 7; + value >>= 7; } while (loop); } public void writeS24(long value) throws IOException { int ret = (int) (value & 0xff); write(ret); - value = value >> 8; + value >>= 8; ret = (int) (value & 0xff); write(ret); - value = value >> 8; + value >>= 8; ret = (int) (value & 0xff); write(ret); } @@ -107,13 +107,13 @@ public class ABCOutputStream extends OutputStream { } if (bitcount == 35) { - ret = ret & 0xf; + ret &= 0xf; } write(ret); if (bitcount == 35) { break; } - value = value >> 7; + value >>= 7; } while (loop); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java b/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java index 5ae2f7f19..7d1b8c737 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java @@ -34,7 +34,7 @@ public class ClassPath { @Override public String toString() { - return (packageStr == null || packageStr.equals("")) ? className : packageStr + "." + className; + return (packageStr == null || packageStr.isEmpty()) ? className : packageStr + "." + className; } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 1372a67fc..bf4edbadb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -99,7 +99,7 @@ public class ScriptPack { return packageName.equals("") ? scriptName : packageName + "." + scriptName; }*/ private static String makeDirPath(String packageName) { - if (packageName.equals("")) { + if (packageName.isEmpty()) { return ""; } String[] pathParts; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 5762a2b96..ee9767126 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -254,7 +254,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { if (ignored) { return " ;ignored"; } - if ((comment == null) || comment.equals("")) { + if ((comment == null) || comment.isEmpty()) { return ""; } return " ;" + comment; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java index f278df007..86a8212bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java @@ -123,7 +123,7 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns int multinameIndex = ins.operands[0]; String multiname = resolveMultinameNoPop(0, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames); GraphTargetItem obj = stack.get(1 + resolvedCount(abc.constants, multinameIndex)); //pod vrcholem - if ((!obj.toString().equals(""))) { + if ((!obj.toString().isEmpty())) { multiname = "." + multiname; } return obj + multiname; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java index 360e5869e..826bf5c00 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java @@ -45,7 +45,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver } else if (value instanceof Long) { bval = ((Long) value).longValue() != 0; } else if (value instanceof String) { - bval = !((String) value).equals(""); + bval = !((String) value).isEmpty(); } else { bval = true; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java index 18fec9854..9a9d4a9b0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java @@ -72,7 +72,7 @@ public class FullMultinameAVM2Item extends AVM2Item { cns = ns.getName(constants); } } - return cname.equals("XML") && cns.equals(""); + return cname.equals("XML") && cns.isEmpty(); } @Override 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 7f9000c13..f108b346c 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 @@ -62,7 +62,7 @@ public class NewFunctionAVM2Item extends AVM2Item { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { MethodBody body = abc.findBody(methodIndex); - writer.append("function" + (!functionName.equals("") ? " " + functionName : "")); + writer.append("function" + (!functionName.isEmpty() ? " " + functionName : "")); writer.startMethod(methodIndex); writer.appendNoHilight("("); methodInfo[methodIndex].getParamStr(writer, constants, body, abc, fullyQualifiedNames); 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 cbe8de8b3..9ad2487d7 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 @@ -56,7 +56,7 @@ public class MethodInfoParser { nstype = nstype + symbValue.type + ":"; } } while (symbValue.type >= 8 && symbValue.type <= 13); - if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { + if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { throw new ParseException("Namespace expected", lexer.yyline()); } int id = 0; @@ -95,7 +95,7 @@ public class MethodInfoParser { value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs); } else if (nstype.equals("8:")) { value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs); - } else if (nstype.equals("")) { + } else if (nstype.isEmpty()) { value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace); } else { throw new ParseException("Invalid type of namespace", lexer.yyline()); @@ -194,7 +194,7 @@ public class MethodInfoParser { nstype = nstype + symbValue.type + ":"; } } while (symbValue.type >= 8 && symbValue.type <= 13); - if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { + if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { throw new ParseException("Namespace expected", lexer.yyline()); } int id = 0; @@ -233,7 +233,7 @@ public class MethodInfoParser { optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs)); } else if (nstype.equals("8:")) { optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs)); - } else if (nstype.equals("")) { + } else if (nstype.isEmpty()) { optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace)); } else { throw new ParseException("Invalid type of namespace", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java index 63ffe7ea7..cc0096ba0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java @@ -72,7 +72,7 @@ public class InstanceInfo { String modifiers; Namespace ns = abc.constants.constant_multiname[name_index].getNamespace(abc.constants); modifiers = ns.getPrefix(abc); - if (!modifiers.equals("")) { + if (!modifiers.isEmpty()) { modifiers += " "; } @@ -80,7 +80,7 @@ public class InstanceInfo { modifiers += "final "; } if (isDynamic()) { - modifiers = modifiers + "dynamic "; + modifiers += "dynamic "; } String objType = "class "; if (isInterface()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java index 4153a3cc0..8fa58538c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java @@ -257,7 +257,7 @@ public class Multiname { Namespace ns = getNamespace(constants); if (ns != null) { String nsname = ns.getName(constants); - if (!nsname.equals("")) { + if (!nsname.isEmpty()) { ret += nsname + "."; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java index 172a1cf60..08de189c9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java @@ -81,7 +81,7 @@ public class Namespace { public String getNameWithKind(ConstantPool constants) { String kindStr = getKindStr(); String nameStr = constants.constant_string[name_index]; - return kindStr + (nameStr.equals("") ? "" : " " + nameStr); + return kindStr + (nameStr.isEmpty() ? "" : " " + nameStr); } public String getPrefix(ABC abc) { 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 dabc290d2..262862f42 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 @@ -63,9 +63,9 @@ public abstract class Trait implements Serializable { break; } if (nsname.contains(".")) { - nsname = nsname.substring(nsname.lastIndexOf(".") + 1); + nsname = nsname.substring(nsname.lastIndexOf('.') + 1); } - if (!nsname.equals("")) { + if (!nsname.isEmpty()) { break; } } @@ -77,7 +77,7 @@ public abstract class Trait implements Serializable { } - if ((!nsname.equals("")) && (!nsname.equals("-"))) { + if ((!nsname.isEmpty()) && (!nsname.equals("-"))) { } else { if (ns != null) { if (ns.kind == Namespace.KIND_NAMESPACE) { @@ -86,7 +86,7 @@ public abstract class Trait implements Serializable { } } - if ((!nsname.contains(":")) && (!nsname.equals(""))) { + if ((!nsname.contains(":")) && (!nsname.isEmpty())) { ret += " " + nsname; } 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 2c4a1cc39..fe8e128b9 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 @@ -70,7 +70,7 @@ public class TraitClass extends Trait implements TraitWithSlot { private boolean parseUsagesFromNS(List abcTags, ABC abc, List imports, List uses, int namespace_index, String ignorePackage, String name) { Namespace ns = abc.constants.constant_namespace[namespace_index]; - if (name.equals("")) { + if (name.isEmpty()) { name = "*"; } String newimport = ns.getName(abc.constants); @@ -87,7 +87,7 @@ public class TraitClass extends Trait implements TraitWithSlot { if (newname.equals("-")) { return true; } - if (!newname.equals("")) { + if (!newname.isEmpty()) { newimport = newname; break; } @@ -96,7 +96,7 @@ public class TraitClass extends Trait implements TraitWithSlot { newimport = oldimport; newimport += "." + name; } - if (newimport.equals("")) { + if (newimport.isEmpty()) { newimport = null; } if (newimport != null) { @@ -110,11 +110,11 @@ public class TraitClass extends Trait implements TraitWithSlot { } String pkg = ""; if (newimport.contains(".")) { - pkg = newimport.substring(0, newimport.lastIndexOf(".")); + pkg = newimport.substring(0, newimport.lastIndexOf('.')); } String usname = newimport; if (usname.contains(".")) { - usname = usname.substring(usname.lastIndexOf(".") + 1); + usname = usname.substring(usname.lastIndexOf('.') + 1); } if (ns.kind == Namespace.KIND_PACKAGE) { if (!pkg.equals(ignorePackage)) { @@ -140,7 +140,7 @@ public class TraitClass extends Trait implements TraitWithSlot { private void parseImportsUsagesFromNS(List abcTags, ABC abc, List imports, List uses, int namespace_index, String ignorePackage, String name) { Namespace ns = abc.constants.constant_namespace[namespace_index]; - if (name.equals("")) { + if (name.isEmpty()) { name = "*"; } String newimport = ns.getName(abc.constants); @@ -158,7 +158,7 @@ public class TraitClass extends Trait implements TraitWithSlot { return; } if (!imports.contains(newimport)) { - String pkg = newimport.substring(0, newimport.lastIndexOf(".")); + String pkg = newimport.substring(0, newimport.lastIndexOf('.')); if (!pkg.equals(ignorePackage)) { imports.add(newimport); } @@ -348,8 +348,8 @@ public class TraitClass extends Trait implements TraitWithSlot { String pkg = ""; String name = spath; if (spath.contains(".")) { - pkg = spath.substring(0, spath.lastIndexOf(".")); - name = spath.substring(spath.lastIndexOf(".") + 1); + pkg = spath.substring(0, spath.lastIndexOf('.')); + name = spath.substring(spath.lastIndexOf('.') + 1); } if (pkg.equals(packageName)) { namesInThisPackage.add(name); @@ -371,10 +371,10 @@ public class TraitClass extends Trait implements TraitWithSlot { String name = ipath; String pkg = ""; if (name.contains(".")) { - pkg = name.substring(0, name.lastIndexOf(".")); - name = name.substring(name.lastIndexOf(".") + 1); + pkg = name.substring(0, name.lastIndexOf('.')); + name = name.substring(name.lastIndexOf('.') + 1); } - if (importnames.contains(name) || ((!pkg.equals("")) && isBuiltInClass(name))) { + if (importnames.contains(name) || ((!pkg.isEmpty()) && isBuiltInClass(name))) { fullyQualifiedNames.add(name); } else { importnames.add(name); @@ -397,8 +397,8 @@ public class TraitClass extends Trait implements TraitWithSlot { for (int i = 0; i < imports.size(); i++) { String imp = imports.get(i); - String pkg = imp.substring(0, imp.lastIndexOf(".")); - String name = imp.substring(imp.lastIndexOf(".") + 1); + String pkg = imp.substring(0, imp.lastIndexOf('.')); + String name = imp.substring(imp.lastIndexOf('.') + 1); if (name.equals("*")) { continue; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java index 657cb4590..14e6f31c2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java @@ -128,7 +128,7 @@ public class Traits implements Serializable { int h = t; if (classIndex != -1) { if (!isStatic) { - h = h + abc.class_info[classIndex].static_traits.traits.length; + h += abc.class_info[classIndex].static_traits.traits.length; } } if (trait instanceof TraitClass) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 68879f3a4..2e91b7a9f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -123,7 +123,7 @@ public class Action implements GraphSourceItem { "_ymouse" }; public static final List propertyNamesList = Arrays.asList(propertyNames); - private static Logger logger = Logger.getLogger(Action.class.getName()); + private static final Logger logger = Logger.getLogger(Action.class.getName()); /** * Constructor diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index c9a9f54c2..99d52b1eb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -120,7 +120,7 @@ public class ActionGraph extends Graph { GraphTargetItem it = list.get(t); if (it instanceof SetTargetActionItem) { SetTargetActionItem st = (SetTargetActionItem) it; - if (st.target.equals("")) { + if (st.target.isEmpty()) { if (targetStart > -1) { targetEnd = t; break; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 21f47d2d0..3319c7c75 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -627,7 +627,7 @@ public class ActionListReader { } } - ip = ip + actionLengthWithHeader; + ip += actionLengthWithHeader; if (a.isExit()) { break; @@ -731,13 +731,16 @@ public class ActionListReader { System.out.print("newip " + nip + ", "); System.out.print("Action: jump(j),ignore(i),compute(c)?"); String next = sc.next(); - if (next.equals("j")) { - newip = pos + aif.getJumpOffset(); - pos = newip; - - } else if (next.equals("i")) { - } else if (next.equals("c")) { - goaif = true; + switch (next) { + case "j": + newip = pos + aif.getJumpOffset(); + pos = newip; + break; + case "i": + break; + case "c": + goaif = true; + break; } } else if (top.isCompileTime() && (!top.hasSideEffect())) { ((ActionIf) a).compileTime = true; @@ -843,7 +846,7 @@ public class ActionListReader { if (newip > -1) { ip = newip; } else { - ip = ip + info; + ip += info; } pos = ip; if (goaif) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index 0f5e7820c..e33217774 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -81,7 +81,7 @@ public class FunctionActionItem extends ActionItem { if (calculatedFunctionName != null) { writer.append(" "); calculatedFunctionName.toStringNoQuotes(writer, localData); - } else if (!functionName.equals("")) { + } else if (!functionName.isEmpty()) { writer.append(" "); writer.append(functionName); } @@ -91,7 +91,7 @@ public class FunctionActionItem extends ActionItem { writer.append(", "); } String pname = paramNames.get(p); - if (pname == null || pname.equals("")) { + if (pname == null || pname.isEmpty()) { pname = new RegisterNumber(regStart + p).translate(); } writer.append(pname); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java index 5d1972620..96655f55f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java @@ -1413,7 +1413,7 @@ public final class ActionScriptLexer { String s = yytext(); s = s.substring(1, s.length() - 1); if (s.contains(" ")) { - s = s.substring(0, s.indexOf(" ")); + s = s.substring(0, s.indexOf(' ')); } xmlTagName = s; string.append(yytext()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java index ec5bfaebd..1fcec7ff8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java @@ -82,7 +82,7 @@ public class ActionGetURL extends Action { @Override public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { String fsCommandPrefix = "FSCommand:"; - if (urlString.startsWith(fsCommandPrefix) && targetString.equals("")) { + if (urlString.startsWith(fsCommandPrefix) && targetString.isEmpty()) { String command = urlString.substring(fsCommandPrefix.length()); output.add(new FSCommandActionItem(this, command)); return; @@ -91,7 +91,7 @@ public class ActionGetURL extends Action { if (targetString.startsWith(levelPrefix)) { try { int num = Integer.valueOf(targetString.substring(levelPrefix.length())); - if (urlString.equals("")) { + if (urlString.isEmpty()) { output.add(new UnLoadMovieNumActionItem(this, new DirectValueActionItem((Long) (long) (int) num))); } else { DirectValueActionItem urlStringDi = new DirectValueActionItem(null, 0, urlString, new ArrayList()); @@ -103,7 +103,7 @@ public class ActionGetURL extends Action { } - if (urlString.equals("")) { + if (urlString.isEmpty()) { DirectValueActionItem targetStringDi = new DirectValueActionItem(null, 0, targetString, new ArrayList()); output.add(new UnLoadMovieActionItem(this, targetStringDi)); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java index 258be8d07..308592ac5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java @@ -51,7 +51,7 @@ public class RegisterNumber implements Serializable { @Override public String toString() { - if (name == null || name.trim().equals("")) { + if (name == null || name.trim().isEmpty()) { return toStringNoName(); } return name; @@ -62,7 +62,7 @@ public class RegisterNumber implements Serializable { } public String translate() { - if (name == null || name.trim().equals("")) { + if (name == null || name.trim().isEmpty()) { return "_loc" + number + "_"; } return name; diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 5d5f01c18..755c35dbd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -116,31 +116,39 @@ public class CommandLineArgumentParser { AbortRetryIgnoreHandler handler = null; String nextParam; + OUTER: while (true) { nextParam = args.remove(); - if (nextParam.equals("-config")) { - parseConfig(args); - if (args.isEmpty()) { - Main.saveConfig(); - System.out.println("Configuration saved"); - return null; - } - } else if (nextParam.equals("-onerror")) { - handler = parseOnError(args); - } else if (nextParam.equals("-timeout")) { - parseTimeout(args); - } else if (nextParam.equals("-affinity")) { - parseAffinity(args); - } else if (nextParam.equals("-priority")) { - parsePriority(args); - } else if (nextParam.equals("-verbose")) { - traceLevel = Level.FINE; - } else if (nextParam.equals("-debug")) { - Configuration.debugMode = true; - } else { - break; + switch (nextParam) { + case "-config": + parseConfig(args); + if (args.isEmpty()) { + Main.saveConfig(); + System.out.println("Configuration saved"); + return null; + } + break; + case "-onerror": + handler = parseOnError(args); + break; + case "-timeout": + parseTimeout(args); + break; + case "-affinity": + parseAffinity(args); + break; + case "-priority": + parsePriority(args); + break; + case "-verbose": + traceLevel = Level.FINE; + break; + case "-debug": + Configuration.debugMode = true; + break; + default: + break OUTER; } - if (args.isEmpty()) { return null; } @@ -237,14 +245,15 @@ public class CommandLineArgumentParser { } private static ExportMode strToExportFormat(String exportFormatStr) { - if (exportFormatStr.equals("pcode")) { - return ExportMode.PCODE; - } else if (exportFormatStr.equals("pcodehex")) { - return ExportMode.PCODEWITHHEX; - } else if (exportFormatStr.equals("hex")) { - return ExportMode.HEX; - } else { - return ExportMode.SOURCE; + switch (exportFormatStr) { + case "pcode": + return ExportMode.PCODE; + case "pcodehex": + return ExportMode.PCODEWITHHEX; + case "hex": + return ExportMode.HEX; + default: + return ExportMode.SOURCE; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java b/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java index da24e3b16..00a8a5226 100644 --- a/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java +++ b/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java @@ -269,7 +269,7 @@ public class EcmaScript { } if (o instanceof String) { String s = (String) o; - return !s.equals(""); + return !s.isEmpty(); } return true; //other Object } @@ -289,7 +289,7 @@ public class EcmaScript { return 0L; } Long posInt = (long) (double) (Math.signum(n) * Math.floor(Math.abs(n))); - posInt = posInt % (1 << 32); + posInt %= (1 << 32); return posInt; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index abb19226a..b1862bf58 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -36,7 +36,7 @@ import javax.swing.JColorChooser; import javax.swing.JLabel; import javax.swing.JPanel; -public class ImagePanel extends JPanel implements ActionListener, FlashDisplay { +public final class ImagePanel extends JPanel implements ActionListener, FlashDisplay { public JLabel label = new JLabel(); public DrawableTag drawable; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java index 5118616ed..6e1cdbe51 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java @@ -197,7 +197,7 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener { String search = searchField.getText(); List filtered = new ArrayList<>(); for (CacheEntry en : entries) { - if (search.equals("") || en.getRequestURL().contains(search)) { + if (search.isEmpty() || en.getRequestURL().contains(search)) { filtered.add(en); } } @@ -208,11 +208,11 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener { String ret = en.getRequestURL(); //Strip parameters if (ret.contains("?")) { - ret = ret.substring(0, ret.indexOf("?")); + ret = ret.substring(0, ret.indexOf('?')); } //Strip path if (ret.contains("/")) { - ret = ret.substring(ret.lastIndexOf("/") + 1); + ret = ret.substring(ret.lastIndexOf('/') + 1); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 8328f955c..03babe603 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -993,8 +993,8 @@ public class Main { } } else { if (s.contains("=")) { - String key = s.substring(0, s.indexOf("=")); - String val = s.substring(s.indexOf("=") + 1); + String key = s.substring(0, s.indexOf('=')); + String val = s.substring(s.indexOf('=') + 1); if ("updateSystem".equals(header)) { if (key.equals("majorVersion")) { updateMajor = Integer.parseInt(val); @@ -1029,8 +1029,8 @@ public class Main { ver.updateLink = val; } if (key.equals("change[]")) { - String changeType = val.substring(0, val.indexOf("|")); - String change = val.substring(val.indexOf("|") + 1); + String changeType = val.substring(0, val.indexOf('|')); + String change = val.substring(val.indexOf('|') + 1); if (!ver.changes.containsKey(changeType)) { ver.changes.put(changeType, new ArrayList()); } @@ -1041,7 +1041,7 @@ public class Main { } } } - if (s.equals("")) { + if (s.isEmpty()) { start = true; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index bef3a05a3..08c525a11 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -231,7 +231,7 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationM * * @author Jindra */ -public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed { +public final class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed { private SWF swf; public ABCPanel abcPanel; @@ -340,7 +340,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } public void setWorkStatus(String s, Runnable cancelCallback) { - if (s.equals("")) { + if (s.isEmpty()) { loadingPanel.setVisible(false); } else { loadingPanel.setVisible(true); @@ -573,10 +573,10 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel int state = 0; if (maximizedHorizontal) { - state = state | JFrame.MAXIMIZED_HORIZ; + state |= JFrame.MAXIMIZED_HORIZ; } if (maximizedVertical) { - state = state | JFrame.MAXIMIZED_VERT; + state |= JFrame.MAXIMIZED_VERT; } setExtendedState(state); @@ -914,9 +914,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel files.clear(); File[] fs = ftemp.listFiles(); - for (File f : fs) { - files.add(f); - } + files.addAll(Arrays.asList(fs)); Main.stopWork(); } catch (IOException ex) { @@ -2188,7 +2186,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel ret.addAll(swf.exportTexts(handler, selFile + File.separator + "texts", texts, isFormatted)); ret.addAll(swf.exportMovies(handler, selFile + File.separator + "movies", movies)); ret.addAll(swf.exportSounds(handler, selFile + File.separator + "sounds", sounds, isMp3OrWav, isMp3OrWav)); - ret.addAll(swf.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData)); + ret.addAll(SWF.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData)); if (abcPanel != null) { for (int i = 0; i < tlsList.size(); i++) { ScriptPack tls = tlsList.get(i); @@ -2406,7 +2404,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel searchDialog.setVisible(true); if (searchDialog.result) { final String txt = searchDialog.searchField.getText(); - if (!txt.equals("")) { + if (!txt.isEmpty()) { if (abcPanel != null) { (new Thread() { @Override @@ -3241,8 +3239,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2; mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2; } else { - mat.translateX = mat.translateX + width / 2; - mat.translateY = mat.translateY + height / 2; + mat.translateX += width / 2; + mat.translateY += height / 2; } sos2.writeTag(new PlaceObject2Tag(null, false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null)); 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 6b5e7704e..04d3a40d3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -109,7 +109,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr public JLabel scriptNameLabel; public boolean search(String txt, boolean ignoreCase, boolean regexp) { - if ((txt != null) && (!txt.equals(""))) { + if ((txt != null) && (!txt.isEmpty())) { searchIgnoreCase = ignoreCase; searchRegexp = regexp; ClassesListTreeModel clModel = (ClassesListTreeModel) classTree.getModel(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java index bebd73295..0b06cbe8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java @@ -35,7 +35,7 @@ import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -public class ClassesListTree extends JTree implements TreeSelectionListener { +public final class ClassesListTree extends JTree implements TreeSelectionListener { private List abcList; public List> treeList; 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 159e976b7..580eadc2b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -91,7 +91,7 @@ public class ClassesListTreeModel implements TreeModel { public ClassesListTreeModel(List> list, String filter) { for (MyEntry item : list) { if (filter != null) { - if (!filter.equals("")) { + if (!filter.isEmpty()) { if (!item.key.toString().contains(filter)) { continue; } 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 f26bda0d7..2a47798df 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java @@ -101,7 +101,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener { for (int i = 0; i < accessStrings.length; i++) { String pref = Namespace.kindToPrefix(modifiers[i]); String name = Namespace.kindToStr(modifiers[i]); - accessStrings[i] = (pref.equals("") ? "" : pref + " ") + "(" + name + ")"; + accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")"; } @@ -162,7 +162,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener { public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case "OK": - if (nameField.getText().trim().equals("")) { + if (nameField.getText().trim().isEmpty()) { View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); return; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java index 71f7f0f5a..1464ee86d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java @@ -25,7 +25,7 @@ import java.util.List; import javax.swing.ListModel; import javax.swing.event.ListDataListener; -public class TraitsListModel implements ListModel { +public final class TraitsListModel implements ListModel { private List items; private List abcTags; 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 e02018c7a..af8c4f48d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -53,14 +53,12 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Scanner; import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; import java.util.logging.Level; @@ -208,10 +206,10 @@ public class ActionPanel extends JPanel implements ActionListener { } public boolean search(String txt, boolean ignoreCase, boolean regexp) { - if ((txt != null) && (!txt.equals(""))) { + if ((txt != null) && (!txt.isEmpty())) { searchIgnoreCase = ignoreCase; searchRegexp = regexp; - List list = Main.swf.createASTagList(Main.swf.tags, null); + List list = SWF.createASTagList(Main.swf.tags, null); Map asms = getASMs("", list); found = new ArrayList<>(); Pattern pat = null; @@ -293,7 +291,7 @@ public class ActionPanel extends JPanel implements ActionListener { public void setHex(ExportMode exportMode) { if (exportMode != ExportMode.HEX) { - if (exportMode == exportMode.PCODE) { + if (exportMode == ExportMode.PCODE) { if (srcNoHex == null) { srcNoHex = getHilightedText(exportMode); } @@ -702,63 +700,73 @@ public class ActionPanel extends JPanel implements ActionListener { foundPos = (foundPos + 1) % found.size(); updateSearchPos(); } - if (e.getActionCommand().equals("GRAPH")) { - if (lastCode != null) { - try { - GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); - gf.setVisible(true); - } catch (InterruptedException ex) { - Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + switch (e.getActionCommand()) { + case "GRAPH": + if (lastCode != null) { + try { + GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); + gf.setVisible(true); + } catch (InterruptedException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + } } - } - } else if (e.getActionCommand().equals("EDITACTION")) { - setEditMode(true); - } else if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) { - if (e.getActionCommand().equals("HEX")) { - hexOnlyButton.setSelected(false); - } else { - hexButton.setSelected(false); - } - setHex(getExportMode()); - } else if (e.getActionCommand().equals("CANCELACTION")) { - setEditMode(false); - setHex(getExportMode()); - } else if (e.getActionCommand().equals("SAVEACTION")) { - try { - String text = editor.getText(); - if (text.trim().startsWith("#hexdata")) { - src.setActionBytes(Helper.getBytesFromHexaText(text)); + break; + case "EDITACTION": + setEditMode(true); + break; + case "HEX": + case "HEXONLY": + if (e.getActionCommand().equals("HEX")) { + hexOnlyButton.setSelected(false); } else { - src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION); + hexButton.setSelected(false); } - setSource(this.src, false); - View.showMessageDialog(this, AppStrings.translate("message.action.saved")); - saveButton.setVisible(false); - cancelButton.setVisible(false); - editButton.setVisible(true); - editor.setEditable(false); - editMode = false; - } catch (IOException ex) { - } catch (ParseException ex) { - View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); - } - } else if (e.getActionCommand().equals("EDITDECOMPILED")) { - setDecompiledEditMode(true); - } else if (e.getActionCommand().equals("CANCELDECOMPILED")) { - setDecompiledEditMode(false); - } else if (e.getActionCommand().equals("SAVEDECOMPILED")) { - try { - ActionScriptParser par = new ActionScriptParser(); - src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION); - setSource(this.src, false); - View.showMessageDialog(this, AppStrings.translate("message.action.saved")); + setHex(getExportMode()); + break; + case "CANCELACTION": + setEditMode(false); + setHex(getExportMode()); + break; + case "SAVEACTION": + try { + String text = editor.getText(); + if (text.trim().startsWith("#hexdata")) { + src.setActionBytes(Helper.getBytesFromHexaText(text)); + } else { + src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION); + } + setSource(this.src, false); + View.showMessageDialog(this, AppStrings.translate("message.action.saved")); + saveButton.setVisible(false); + cancelButton.setVisible(false); + editButton.setVisible(true); + editor.setEditable(false); + editMode = false; + } catch (IOException ex) { + } catch (ParseException ex) { + View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + } + break; + case "EDITDECOMPILED": + setDecompiledEditMode(true); + break; + case "CANCELDECOMPILED": setDecompiledEditMode(false); - } catch (IOException ex) { - Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex); - } catch (ParseException ex) { - View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); - } + break; + case "SAVEDECOMPILED": + try { + ActionScriptParser par = new ActionScriptParser(); + src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION); + setSource(this.src, false); + View.showMessageDialog(this, AppStrings.translate("message.action.saved")); + setDecompiledEditMode(false); + } catch (IOException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex); + } catch (ParseException ex) { + View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + } + break; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java b/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java index 7e9e362ca..8387dc468 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java @@ -102,11 +102,11 @@ public class PlayerControls extends JPanel implements ActionListener { private String formatMs(long ms) { long s = ms / 1000; - ms = ms % 1000; + ms %= 1000; long m = s / 60; - s = s % 60; + s %= 60; long h = m / 60; - m = m % 60; + m %= 60; return "" + (h > 0 ? h + ":" : "") + pad(m) + ":" + pad(s) + "." + pad(ms / 10); } 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 2fd00569b..bb3a31bab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -330,7 +330,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe public void catched(String contentType, String url, InputStream data) { boolean swfOnly = false; if (contentType.contains(";")) { - contentType = contentType.substring(0, contentType.indexOf(";")); + contentType = contentType.substring(0, contentType.indexOf(';')); } if ((!sniffSWFCheckBox.isSelected()) && (contentType.equals("application/x-shockwave-flash"))) { return; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java index 5c2af0c99..a8f135702 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java @@ -66,7 +66,7 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag { int a = (argb >> 24) & 0xff; int r = (argb >> 16) & 0xff; int g = (argb >> 8) & 0xff; - int b = (argb >> 0) & 0xff; + int b = (argb) & 0xff; r = r * a / 255; g = g * a / 255; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java index 837548d06..cadabc045 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java @@ -66,7 +66,7 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag { //int a = (argb >> 24) & 0xff; int r = (argb >> 16) & 0xff; int g = (argb >> 8) & 0xff; - int b = (argb >> 0) & 0xff; + int b = (argb) & 0xff; bitmapData.bitmapPixelDataPix24[pos] = new PIX24(); bitmapData.bitmapPixelDataPix24[pos].red = r; bitmapData.bitmapPixelDataPix24[pos].green = g; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 2e24adb5c..26f8ce7e5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -112,7 +112,7 @@ public class DefineEditTextTag extends TextTag { continue; } if (!intag) { - outp = outp + inp.charAt(i); + outp += inp.charAt(i); } } return outp; @@ -154,8 +154,8 @@ public class DefineEditTextTag extends TextTag { + (hasFontClass ? "fontclass " + fontClass + "\r\n" : "") + (hasMaxLength ? "maxlength " + maxLength + "\r\n" : "") + "align " + alignValues[align] + "\r\n" + (hasLayout ? "leftmargin " + leftMargin + "\r\nrightmargin " + rightMargin + "\r\nindent " + indent + "\r\nleading " + leading + "\r\n" : "") - + (!variableName.equals("") ? "variablename " + variableName + "\r\n" : ""); - ret = ret + "]"; + + (!variableName.isEmpty() ? "variablename " + variableName + "\r\n" : ""); + ret += "]"; if (hasText) { ret += initialText.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]"); } @@ -196,140 +196,170 @@ public class DefineEditTextTag extends TextTag { case PARAMETER: String paramName = (String) s.values[0]; String paramValue = (String) s.values[1]; - if (paramName.equals("xmin")) { - try { - bounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymin")) { - try { - bounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmax")) { - try { - bounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymax")) { - try { - bounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("wordwrap")) { - if (paramValue.equals("1")) { - wordWrap = true; - } - } else if (paramName.equals("multiline")) { - if (paramValue.equals("1")) { - multiline = true; - } - } else if (paramName.equals("password")) { - if (paramValue.equals("1")) { - password = true; - } - } else if (paramName.equals("readonly")) { - if (paramValue.equals("1")) { - readOnly = true; - } - } else if (paramName.equals("autosize")) { - if (paramValue.equals("1")) { - autoSize = true; - } - } else if (paramName.equals("noselect")) { - if (paramValue.equals("1")) { - noSelect = true; - } - } else if (paramName.equals("border")) { - if (paramValue.equals("1")) { - border = true; - } - } else if (paramName.equals("wasstatic")) { - if (paramValue.equals("1")) { - wasStatic = true; - } - } else if (paramName.equals("html")) { - if (paramValue.equals("1")) { - html = true; - } - } else if (paramName.equals("useoutlines")) { - if (paramValue.equals("1")) { - useOutlines = true; - } - } else if (paramName.equals("font")) { - try { - fontId = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid font value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("fontclass")) { - fontClass = paramValue; - } else if (paramName.equals("height")) { - try { - fontHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid height value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("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()); - } - } else if (paramName.equals("maxlength")) { - try { - maxLength = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("align")) { - if (paramValue.equals("left")) { - align = 0; - } else if (paramValue.equals("right")) { - align = 1; - } else if (paramValue.equals("center")) { - align = 2; - } else if (paramValue.equals("justify")) { - align = 3; - } else { - throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline()); - } - - } else if (paramName.equals("leftmargin")) { - try { - leftMargin = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("rightmargin")) { - try { - rightMargin = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("indent")) { - try { - indent = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid indent value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("leading")) { - try { - leading = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid leading value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("variablename")) { - variableName = paramValue; - } else { - throw new ParseException("Unrecognized parameter name", lexer.yyline()); + 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; + 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("Unrecognized parameter name", lexer.yyline()); + } + break; case TEXT: text += (String) s.values[0]; break; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 533a2686d..39a5a1c1f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -96,7 +96,7 @@ public class DefineText2Tag extends TextTag implements DrawableTag { } } if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) { - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret += "\r\n"; } } @@ -189,112 +189,125 @@ public class DefineText2Tag extends TextTag implements DrawableTag { throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); } } - if (paramName.equals("font")) { - try { - fontId = Integer.parseInt(paramValue); + switch (paramName) { + case "font": + try { + fontId = Integer.parseInt(paramValue); - for (Tag t : tags) { - if (t instanceof FontTag) { - if (((FontTag) t).getFontId() == fontId) { - font = (FontTag) t; - break; - } + for (Tag t : tags) { + if (t instanceof FontTag) { + if (((FontTag) t).getFontId() == fontId) { + font = (FontTag) t; + 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()); } - } else if (paramName.equals("height")) { - try { - textHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font height - number expected.", lexer.yyline()); - } - } else if (paramName.equals("x")) { - - try { - x = Integer.parseInt(paramValue); - currentX = x; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid x position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("y")) { - - try { - y = Integer.parseInt(paramValue); - currentY = y; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid y position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmin")) { - try { - textBounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmax")) { - try { - textBounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymin")) { - try { - textBounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymax")) { - try { - textBounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scalex")) { - try { - textMatrix.scaleX = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scaley")) { - try { - textMatrix.scaleY = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew0")) { - try { - textMatrix.rotateSkew0 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew1")) { - try { - textMatrix.rotateSkew1 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatex")) { - try { - textMatrix.translateX = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatey")) { - try { - textMatrix.translateY = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatey value - 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 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 3fa21cb56..dca4cae55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -96,7 +96,7 @@ public class DefineTextTag extends TextTag implements DrawableTag { } } if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) { - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret += "\r\n"; } } @@ -181,119 +181,133 @@ public class DefineTextTag extends TextTag implements DrawableTag { case PARAMETER: String paramName = (String) s.values[0]; String paramValue = (String) s.values[1]; - if (paramName.equals("color")) { - Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); - if (m.matches()) { - color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16)); - } else { - throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline()); - } - } else if (paramName.equals("font")) { - try { - fontId = Integer.parseInt(paramValue); + switch (paramName) { + case "color": + Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); + if (m.matches()) { + color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16)); + } else { + throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline()); + } + break; + case "font": + try { + fontId = Integer.parseInt(paramValue); - for (Tag t : tags) { - if (t instanceof FontTag) { - if (((FontTag) t).getFontId() == fontId) { - font = (FontTag) t; - break; - } + for (Tag t : tags) { + if (t instanceof FontTag) { + if (((FontTag) t).getFontId() == fontId) { + font = (FontTag) t; + 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()); } - } else if (paramName.equals("height")) { - try { - textHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font height - number expected.", lexer.yyline()); - } - } else if (paramName.equals("x")) { - - try { - x = Integer.parseInt(paramValue); - currentX = x; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid x position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("y")) { - - try { - y = Integer.parseInt(paramValue); - currentY = y; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid y position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmin")) { - try { - textBounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmax")) { - try { - textBounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymin")) { - try { - textBounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymax")) { - try { - textBounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scalex")) { - try { - textMatrix.scaleX = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scaley")) { - try { - textMatrix.scaleY = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew0")) { - try { - textMatrix.rotateSkew0 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew1")) { - try { - textMatrix.rotateSkew1 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatex")) { - try { - textMatrix.translateX = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatey")) { - try { - textMatrix.translateY = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatey value - 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 TEXT: if (font == null) { throw new ParseException("Font not defined", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 161b9236c..c938f1a5d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -176,7 +176,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { @Override public String getExportFileName(List tags) { String expName = getExportName(); - if ((expName == null) || expName.equals("")) { + if ((expName == null) || expName.isEmpty()) { return super.toString(); } String[] pathParts; @@ -191,7 +191,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { @Override public String toString() { String expName = getExportName(); - if ((expName == null) || expName.equals("")) { + if ((expName == null) || expName.isEmpty()) { return super.toString(); } String[] pathParts; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java index 51e224dc8..c04b90713 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java @@ -66,11 +66,11 @@ public abstract class CharacterIdTag extends Tag { @Override public String getExportFileName(List tags) { - return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : ""); + return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : ""); } public String getCharacterExportFileName() { - return getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : ""); + return getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : ""); } public String getExportName() { 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 860c5e848..6a8b63e61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -163,7 +163,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable return fontName; } if (fontName.contains("_")) { - String beforeUnderscore = fontName.substring(0, fontName.indexOf("_")); + String beforeUnderscore = fontName.substring(0, fontName.indexOf('_')); if (fontNames.contains(beforeUnderscore)) { return beforeUnderscore; } @@ -176,7 +176,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable return fontName; } if (fontName.contains("_")) { - String beforeUnderscore = fontName.substring(0, fontName.indexOf("_")); + String beforeUnderscore = fontName.substring(0, fontName.indexOf('_')); if (fontNames.contains(beforeUnderscore)) { return beforeUnderscore; } 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 f51e2dea0..e49e13ec4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java @@ -65,7 +65,7 @@ import javax.swing.JPanel; * * @author JPEXS */ -public class DefineCompactedFont extends FontTag implements DrawableTag { +public final class DefineCompactedFont extends FontTag implements DrawableTag { public static final int ID = 1005; public int fontId; 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 f535c3610..c0cc6aea3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java @@ -96,10 +96,7 @@ public class Filtering { } } } - - for (int x = 0; x < w; x++) { - pixels[index + x] = newColors[x]; - } + System.arraycopy(newColors, 0, pixels, index, w); index += w; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java index 1e97e4176..03f379707 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java @@ -74,12 +74,12 @@ public class ContourType { moveToY = sis.readSI15(); long numEdgesRef = sis.readUI30(); isReference = (numEdgesRef & 1) == 1; - numEdgesRef = numEdgesRef >> 1; + numEdgesRef >>= 1; long oldPos = sis.getPos(); if (isReference) { sis.setPos(numEdgesRef); numEdgesRef = sis.readUI30(); - numEdgesRef = numEdgesRef >> 1; + numEdgesRef >>= 1; } edges = new EdgeType[(int) numEdgesRef]; 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 b327e5d86..07d78431d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java @@ -455,7 +455,6 @@ public class EdgeType { sos.writeUI8((((ax >> 14) & m5) | (ay << 5))); sos.writeUI8(((ay >> 3))); sos.writeUI8(((ay >> 11))); - return; } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java index 165e7f899..4540bdef5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java @@ -88,18 +88,18 @@ public class GFxInputStream extends InputStream { return v; case 1: - t = t >> 2; + t >>= 2; v = t | (readUI8() << 6); return v; case 2: - t = t >> 2; - t = t | (readUI8() << 6); + t >>= 2; + t |= (readUI8() << 6); v = t | (readUI8() << 14); return v; } - t = t >> 2; - t = t | (readUI8() << 6); - t = t | (readUI8() << 14); + t >>= 2; + t |= (readUI8() << 6); + t |= (readUI8() << 14); v = t | (readUI8() << 22); return v; } 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 03185ee64..19ba5a0dd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java @@ -857,8 +857,8 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali maxh = r.getHeight(); } } - maxw = maxw / 20; - maxh = maxh / 20; + maxw /= 20; + maxh /= 20; int cols = (int) Math.ceil(Math.sqrt(shapes.size())); diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 8c2e3e2e6..58d44346f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -711,7 +711,7 @@ public class XFLConverter { edges.clear(); fillsStr += ""; strokesStr += ""; - if (!currentLayer.equals("")) { + if (!currentLayer.isEmpty()) { currentLayer += ""; currentLayer += ""; currentLayer += ""; @@ -1301,10 +1301,14 @@ public class XFLConverter { String symbolFile = "bitmap" + symbol.getCharacterId() + "." + imageTag.getImageFormat(); files.put(symbolFile, baos.toByteArray()); String mediaLinkStr = " 0) { @@ -1912,7 +1916,7 @@ public class XFLConverter { frame++; } } - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret = "" + "" + ret @@ -1936,7 +1940,7 @@ public class XFLConverter { } if (t instanceof ShowFrameTag) { - if (frameLabel.equals("")) { + if (frameLabel.isEmpty()) { duration++; } else { if (duration > 0) { @@ -1967,7 +1971,7 @@ public class XFLConverter { frame++; } } - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret = "" + "" + ret @@ -2015,7 +2019,7 @@ public class XFLConverter { } ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, duration, "", ""); } - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret = "" + "" + ret + "" + ""; @@ -2100,7 +2104,7 @@ public class XFLConverter { layerPrev += ">"; String layerAfter = ""; String cf = convertFrames(layerPrev, layerAfter, oneInstanceShapes, tags, timelineTags, characters, d); - if (cf.equals("")) { + if (cf.isEmpty()) { index--; } ret += cf; @@ -2395,7 +2399,7 @@ public class XFLConverter { if (det.hasMaxLength) { ret += " maxCharacters=\"" + det.maxLength + "\""; } - if (!det.variableName.equals("")) { + if (!det.variableName.isEmpty()) { ret += " variableName=\"" + det.variableName + "\""; } ret += ">"; @@ -2520,7 +2524,7 @@ public class XFLConverter { File f = new File(baseName); baseName = f.getName(); if (baseName.contains(".")) { - baseName = baseName.substring(0, baseName.lastIndexOf(".")); + baseName = baseName.substring(0, baseName.lastIndexOf('.')); } final HashMap files = new HashMap<>(); final HashMap datfiles = new HashMap<>(); @@ -2586,7 +2590,7 @@ public class XFLConverter { } String expDir = ""; if (expPath.contains(".")) { - expDir = expPath.substring(0, expPath.lastIndexOf(".")); + expDir = expPath.substring(0, expPath.lastIndexOf('.')); expDir = expDir.replace(".", File.separator); } expPath = expPath.replace(".", File.separator); @@ -3121,75 +3125,82 @@ public class XFLConverter { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - if (qName.equals("a")) { - String href = attributes.getValue("href"); - if (href != null) { - url = href; - } - String t = attributes.getValue("target"); - if (t != null) { - target = t; - } - } else if (qName.equals("b")) { - bold = true; - } else if (qName.equals("i")) { - italic = true; - } else if (qName.equals("u")) { - underline = true; - } else if (qName.equals("li")) { - li = true; - } else if (qName.equals("p")) { - String a = attributes.getValue("align"); - if (a != null) { - alignment = a; - } - if (!result.equals("")) { - putText("\r\n"); - } - } else if (qName.equals("font")) { - //kerning ? - String ls = attributes.getValue("letterSpacing"); - if (ls != null) { - letterSpacing = Double.parseDouble(ls); - } - String s = attributes.getValue("size"); - if (s != null) { - size = Integer.parseInt(s); - } - String c = attributes.getValue("color"); - if (c != null) { - color = c; - } - String f = attributes.getValue("face"); - if (f != null) { - for (Tag t : tags) { - if (t instanceof FontTag) { - FontTag ft = (FontTag) t; - String fontName = null; - if (f.equals(ft.getFontName(tags))) { - for (Tag u : tags) { - if (u instanceof DefineFontNameTag) { - if (((DefineFontNameTag) u).fontId == ft.getFontId()) { - fontName = ((DefineFontNameTag) u).fontName; + switch (qName) { + case "a": + String href = attributes.getValue("href"); + if (href != null) { + url = href; + } + String t = attributes.getValue("target"); + if (t != null) { + target = t; + } + break; + case "b": + bold = true; + break; + case "i": + italic = true; + break; + case "u": + underline = true; + break; + case "li": + li = true; + break; + case "p": + String a = attributes.getValue("align"); + if (a != null) { + alignment = a; + } + if (!result.isEmpty()) { + putText("\r\n"); + } + break; + case "font": + //kerning ? + String ls = attributes.getValue("letterSpacing"); + if (ls != null) { + letterSpacing = Double.parseDouble(ls); + } + String s = attributes.getValue("size"); + if (s != null) { + size = Integer.parseInt(s); + } + String c = attributes.getValue("color"); + if (c != null) { + color = c; + } + String f = attributes.getValue("face"); + if (f != null) { + for (Tag tag : tags) { + if (tag instanceof FontTag) { + FontTag ft = (FontTag) tag; + String fontName = null; + if (f.equals(ft.getFontName(tags))) { + for (Tag u : tags) { + if (u instanceof DefineFontNameTag) { + if (((DefineFontNameTag) u).fontId == ft.getFontId()) { + fontName = ((DefineFontNameTag) u).fontName; + } } } + if (fontName == null) { + fontName = ft.getFontName(tags); + } + String installedFont; + if ((installedFont = FontTag.isFontInstalled(fontName)) != null) { + fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName(); + } else { + fontFace = fontName; + } + break; } - if (fontName == null) { - fontName = ft.getFontName(tags); - } - String installedFont; - if ((installedFont = FontTag.isFontInstalled(fontName)) != null) { - fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName(); - } else { - fontFace = fontName; - } - break; } } } - } + break; } - //textformat,tab,br } @Override @@ -3268,7 +3279,7 @@ public class XFLConverter { @Override public void endDocument() { - if (this.result.equals("")) { + if (this.result.isEmpty()) { putText(""); } } diff --git a/trunk/src/com/jpexs/decompiler/graph/ExportMode.java b/trunk/src/com/jpexs/decompiler/graph/ExportMode.java index 1c8850156..07293f1ca 100644 --- a/trunk/src/com/jpexs/decompiler/graph/ExportMode.java +++ b/trunk/src/com/jpexs/decompiler/graph/ExportMode.java @@ -32,8 +32,9 @@ 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 int code; diff --git a/trunk/src/com/jpexs/helpers/Helper.java b/trunk/src/com/jpexs/helpers/Helper.java index 5d1c84edf..2e50e2288 100644 --- a/trunk/src/com/jpexs/helpers/Helper.java +++ b/trunk/src/com/jpexs/helpers/Helper.java @@ -34,6 +34,7 @@ import java.io.ObjectOutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; import java.util.BitSet; import java.util.Collection; import java.util.List; @@ -72,7 +73,7 @@ public class Helper { if (i > 0) { s += ","; } - s = s + array[i]; + s += array[i]; } s += "]"; return s; @@ -90,7 +91,7 @@ public class Helper { if (i > 0) { s += " "; } - s = s + padZeros(Integer.toHexString(array[i] & 0xff), 2); + s += padZeros(Integer.toHexString(array[i] & 0xff), 2); } s += "]"; return s; @@ -353,9 +354,7 @@ public class Helper { public static List toList(Object... rest) { List ret = new ArrayList<>(); - for (Object o : rest) { - ret.add(o); - } + ret.addAll(Arrays.asList(rest)); return ret; } @@ -483,7 +482,7 @@ public class Helper { str = Pattern.compile("\\." + Pattern.quote(inv) + "\\.", Pattern.CASE_INSENSITIVE).matcher(str).replaceAll("._" + inv + "."); } str = str.substring(1, str.length() - 1); //remove dots - if (str.equals("")) { + if (str.isEmpty()) { str = "unnamed"; } return str; @@ -527,11 +526,11 @@ public class Helper { public static String formatTimeSec(long timeMs) { long timeS = timeMs / 1000; - timeMs = timeMs % 1000; + timeMs %= 1000; long timeM = timeS / 60; - timeS = timeS % 60; + timeS %= 60; long timeH = timeM / 60; - timeM = timeM % 60; + timeM %= 60; String timeStr = ""; if (timeH > 0) { timeStr += Helper.padZeros(timeH, 2) + ":"; @@ -548,9 +547,9 @@ public class Helper { public static String formatTimeToText(int timeS) { long timeM = timeS / 60; - timeS = timeS % 60; + timeS %= 60; long timeH = timeM / 60; - timeM = timeM % 60; + timeM %= 60; String timeStr = ""; if (timeH > 0) { diff --git a/trunk/src/com/jpexs/process/Process.java b/trunk/src/com/jpexs/process/Process.java index c57d51294..255dc15d5 100644 --- a/trunk/src/com/jpexs/process/Process.java +++ b/trunk/src/com/jpexs/process/Process.java @@ -17,7 +17,6 @@ package com.jpexs.process; import com.jpexs.helpers.ProgressListener; -import com.jpexs.process.Process; import java.awt.image.BufferedImage; import java.io.InputStream; import java.util.Map; diff --git a/trunk/src/com/jpexs/process/ProcessTools.java b/trunk/src/com/jpexs/process/ProcessTools.java index 0dc6aacf8..07d1452b4 100644 --- a/trunk/src/com/jpexs/process/ProcessTools.java +++ b/trunk/src/com/jpexs/process/ProcessTools.java @@ -16,7 +16,6 @@ */ package com.jpexs.process; -import com.jpexs.process.Process; import com.jpexs.process.win32.Win32ProcessTools; import com.sun.jna.Platform; import java.util.List; diff --git a/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java b/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java index 75ff7f240..d50aa25fd 100644 --- a/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java +++ b/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java @@ -200,7 +200,7 @@ public class Win32ProcessTools extends ProcessTools { int rgb = Gdi32.INSTANCE.GetPixel(hdcMem, x, y).intValue(); int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; - int b = (rgb >> 0) & 0xff; + int b = (rgb) & 0xff; rgb = (b << 16) + (g << 8) + r; ret.setRGB(x, y, rgb); } @@ -226,7 +226,7 @@ public class Win32ProcessTools extends ProcessTools { int rgb = image.getRGB(x, y); int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; - int b = (rgb >> 0) & 0xff; + int b = (rgb) & 0xff; r = r * alpha / 255; g = g * alpha / 255; b = b * alpha / 255; diff --git a/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java b/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java index f4fc27151..54a9845bc 100644 --- a/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java +++ b/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java @@ -253,7 +253,7 @@ public abstract class Advapi32Util { offset += Native.WCHAR_SIZE; result.add(s); } - return result.toArray(new String[0]); + return result.toArray(new String[result.size()]); } finally { rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue()); if (rc != W32Errors.ERROR_SUCCESS) { @@ -700,7 +700,7 @@ public abstract class Advapi32Util { } keys.add(Native.toString(name)); } - return keys.toArray(new String[0]); + return keys.toArray(new String[keys.size()]); } /** @@ -784,7 +784,7 @@ public abstract class Advapi32Util { offset += Native.WCHAR_SIZE; result.add(s); } - keyValues.put(nameString, result.toArray(new String[0])); + keyValues.put(nameString, result.toArray(new String[result.size()])); break; } default: @@ -830,7 +830,7 @@ public abstract class Advapi32Util { StringBuilder out = new StringBuilder(); for (Entry entry : environment.entrySet()) { if (entry.getValue() != null) { - out.append(entry.getKey() + "=" + entry.getValue() + "\0"); + out.append(entry.getKey()).append("=").append(entry.getValue()).append("\0"); } } return out.toString() + "\0"; @@ -975,7 +975,7 @@ public abstract class Advapi32Util { offset += Native.WCHAR_SIZE; count--; } - _strings = strings.toArray(new String[0]); + _strings = strings.toArray(new String[strings.size()]); } } } diff --git a/trunk/src/com/sun/jna/platform/win32/BaseTSD.java b/trunk/src/com/sun/jna/platform/win32/BaseTSD.java index df2a9c7b5..c6d65229f 100644 --- a/trunk/src/com/sun/jna/platform/win32/BaseTSD.java +++ b/trunk/src/com/sun/jna/platform/win32/BaseTSD.java @@ -79,7 +79,7 @@ public interface BaseTSD extends StdCallLibrary { /** * PULONG_PTR */ - public static class ULONG_PTRByReference extends ByReference { + public static final class ULONG_PTRByReference extends ByReference { public ULONG_PTRByReference() { this(new ULONG_PTR(0)); diff --git a/trunk/src/com/sun/jna/platform/win32/WinDef.java b/trunk/src/com/sun/jna/platform/win32/WinDef.java index 5b1e61af7..f20cab86e 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinDef.java +++ b/trunk/src/com/sun/jna/platform/win32/WinDef.java @@ -61,7 +61,7 @@ public interface WinDef extends StdCallLibrary { } } - public class WORDbyReference extends ByReference { + public static final class WORDbyReference extends ByReference { public WORDbyReference() { this(new WORD(0)); @@ -123,7 +123,7 @@ public interface WinDef extends StdCallLibrary { } } - public class DWORDbyReference extends ByReference { + public static final class DWORDbyReference extends ByReference { public DWORDbyReference() { this(new DWORD(0)); @@ -156,7 +156,7 @@ public interface WinDef extends StdCallLibrary { } } - public class LONGbyReference extends ByReference { + public static final class LONGbyReference extends ByReference { public LONGbyReference() { this(new LONG(0)); @@ -189,7 +189,7 @@ public interface WinDef extends StdCallLibrary { } } - public class LONGLONGbyReference extends ByReference { + public static final class LONGLONGbyReference extends ByReference { public LONGLONGbyReference() { this(new LONGLONG(0)); @@ -658,7 +658,7 @@ public interface WinDef extends StdCallLibrary { } } - public class ULONGbyReference extends ByReference { + public static final class ULONGbyReference extends ByReference { public ULONGbyReference() { this(new ULONG(0)); @@ -691,7 +691,7 @@ public interface WinDef extends StdCallLibrary { } } - public class ULONGLONGbyReference extends ByReference { + public static final class ULONGLONGbyReference extends ByReference { public ULONGLONGbyReference() { this(new ULONGLONG(0)); @@ -899,7 +899,7 @@ public interface WinDef extends StdCallLibrary { } } - public class USHORTbyReference extends ByReference { + public static final class USHORTbyReference extends ByReference { public USHORTbyReference() { this(new USHORT(0)); @@ -967,7 +967,7 @@ public interface WinDef extends StdCallLibrary { } } - public class UINTbyReference extends ByReference { + public static final class UINTbyReference extends ByReference { public UINTbyReference() { this(new UINT(0)); @@ -1009,7 +1009,7 @@ public interface WinDef extends StdCallLibrary { } } - public static class SCODEbyReference extends ByReference { + public static final class SCODEbyReference extends ByReference { public SCODEbyReference() { this(new SCODE(0)); @@ -1053,7 +1053,7 @@ public interface WinDef extends StdCallLibrary { } } - public static class BOOLbyReference extends ByReference { + public static final class BOOLbyReference extends ByReference { public BOOLbyReference() { this(new BOOL(0)); @@ -1110,7 +1110,7 @@ public interface WinDef extends StdCallLibrary { } } - public static class CHARbyReference extends ByReference { + public static final class CHARbyReference extends ByReference { public CHARbyReference() { this(new CHAR(0)); diff --git a/trunk/src/com/sun/jna/platform/win32/WinNT.java b/trunk/src/com/sun/jna/platform/win32/WinNT.java index 362444c8b..ddc9597e7 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinNT.java +++ b/trunk/src/com/sun/jna/platform/win32/WinNT.java @@ -808,7 +808,7 @@ public interface WinNT extends WinError, WinDef, WinBase, BaseTSD { /** * LPHANDLE */ - public static class HANDLEByReference extends ByReference { + public static final class HANDLEByReference extends ByReference { public HANDLEByReference() { this(null); diff --git a/trunk/src/com/sun/jna/platform/win32/WinReg.java b/trunk/src/com/sun/jna/platform/win32/WinReg.java index cd93e6dca..5cefc0b41 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinReg.java +++ b/trunk/src/com/sun/jna/platform/win32/WinReg.java @@ -40,7 +40,7 @@ public interface WinReg extends StdCallLibrary { } } - public static class HKEYByReference extends ByReference { + public static final class HKEYByReference extends ByReference { public HKEYByReference() { this(null); diff --git a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java index 1f714991a..52aed3b36 100644 --- a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java +++ b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java @@ -38,7 +38,7 @@ public class AS2Generator { HilightedTextWriter writer = new HilightedTextWriter(false); Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer); String src = writer.toString(); - if (src.trim().equals("")) { + if (src.trim().isEmpty()) { doa = null; continue; } From d99f8943b729da286ec563e7ea23d31275f5828b Mon Sep 17 00:00:00 2001 From: Honfika Date: Thu, 7 Nov 2013 11:07:49 +0100 Subject: [PATCH 7/8] application releated constants moved to applicationinfo class (name, version, urls), 1000th source file:) --- .../decompiler/flash/ApplicationInfo.java | 56 +++++++ .../jpexs/decompiler/flash/Configuration.java | 114 ++++++++++++-- .../console/CommandLineArgumentParser.java | 15 +- .../decompiler/flash/gui/AboutDialog.java | 5 +- .../decompiler/flash/gui/LoadingDialog.java | 3 +- .../com/jpexs/decompiler/flash/gui/Main.java | 146 ++---------------- .../jpexs/decompiler/flash/gui/MainFrame.java | 19 +-- .../jpexs/decompiler/flash/gui/ModeFrame.java | 3 +- .../flash/gui/NewVersionDialog.java | 5 +- 9 files changed, 197 insertions(+), 169 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java diff --git a/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java b/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java new file mode 100644 index 000000000..dd33cd89e --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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; + +import java.io.IOException; +import java.util.Properties; + +/** + * + * @author JPEXS + */ +public class ApplicationInfo { + + public static final String applicationName = "JPEXS Free Flash Decompiler"; + public static final String shortApplicationName = "FFDec"; + public static final String vendor = "JPEXS"; + public static String version = ""; + public static String applicationVerName; + public static String shortApplicationVerName; + public static final String projectPage = "http://www.free-decompiler.com/flash"; + public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion="; + public static String updatePage; + + static { + loadProperties(); + } + + private static void loadProperties() { + Properties prop = new Properties(); + try { + prop.load(ApplicationInfo.class.getResourceAsStream("/project.properties")); + version = prop.getProperty("version"); + applicationVerName = applicationName + " v." + version; + updatePage = updatePageStub + version; + shortApplicationVerName = shortApplicationName + " v." + version; + } catch (IOException ex) { + //ignore + version = "unknown"; + } + } + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/Configuration.java index b7aff0ea5..6e2b7de80 100644 --- a/trunk/src/com/jpexs/decompiler/flash/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/Configuration.java @@ -18,16 +18,22 @@ package com.jpexs.decompiler.flash; import com.jpexs.proxy.Replacement; import java.io.*; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; public class Configuration { + private static final String CONFIG_NAME = "config.bin"; + private static final String REPLACEMENTS_NAME = "replacements.cfg"; + 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; @@ -92,6 +98,85 @@ public class Configuration { } }; + private enum OSId { + + WINDOWS, OSX, UNIX + } + + private static OSId getOSId() { + PrivilegedAction doGetOSName = new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("os.name"); + } + }; + OSId id = OSId.UNIX; + String osName = AccessController.doPrivileged(doGetOSName); + if (osName != null) { + if (osName.toLowerCase().startsWith("mac os x")) { + id = OSId.OSX; + } else if (osName.contains("Windows")) { + id = OSId.WINDOWS; + } + } + return id; + } + + public static String getFFDecHome() throws IOException { + if (directory == unspecifiedFile) { + directory = null; + String userHome = null; + try { + userHome = System.getProperty("user.home"); + } catch (SecurityException ignore) { + } + if (userHome != null) { + String applicationId = ApplicationInfo.shortApplicationName; + OSId osId = getOSId(); + if (osId == OSId.WINDOWS) { + File appDataDir = null; + try { + String appDataEV = System.getenv("APPDATA"); + if ((appDataEV != null) && (appDataEV.length() > 0)) { + appDataDir = new File(appDataEV); + } + } catch (SecurityException ignore) { + } + String vendorId = ApplicationInfo.vendor; + if ((appDataDir != null) && appDataDir.isDirectory()) { + // ${APPDATA}\{vendorId}\${applicationId} + String path = vendorId + "\\" + applicationId + "\\"; + directory = new File(appDataDir, path); + } else { + // ${userHome}\Application Data\${vendorId}\${applicationId} + String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\"; + directory = new File(userHome, path); + } + } else if (osId == OSId.OSX) { + // ${userHome}/Library/Application Support/${applicationId} + String path = "Library/Application Support/" + applicationId + "/"; + directory = new File(userHome, path); + } else { + // ${userHome}/.${applicationId}/ + String path = "." + applicationId + "/"; + directory = new File(userHome, path); + } + } + } + if (!directory.exists()) { + if (!directory.mkdirs()) { + if (!directory.exists()) { + throw new IOException("cannot create directory " + directory); + } + } + } + String ret = directory.getAbsolutePath(); + if (!ret.endsWith(File.separator)) { + ret += File.separator; + } + return ret; + } + /** * Saves replacements to file for future use */ @@ -166,13 +251,12 @@ public class Configuration { return result; } - public static void unsetConfig(String cfg) { - config.remove(cfg); + private static String getReplacementsFile() throws IOException { + return getFFDecHome() + REPLACEMENTS_NAME; } - public static void loadFromMap(Map map) { - config.clear(); - config.putAll(map); + private static String getConfigFile() throws IOException { + return getFFDecHome() + CONFIG_NAME; } @SuppressWarnings("unchecked") @@ -189,16 +273,16 @@ public class Configuration { } if (containsConfig("paralelSpeedUp")) { setConfig("parallelSpeedUp", getConfig("paralelSpeedUp")); - unsetConfig("paralelSpeedUp"); + config.remove("paralelSpeedUp"); } } - public static void saveToFile(String file, String replacementsFile) { + private static void saveToFile(String file, String replacementsFile) { try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) { oos.writeObject(config); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE); - Logger.getLogger(SWFInputStream.class.getName()).severe("Configuration directory is read only."); + Logger.getLogger(Configuration.class.getName()).severe("Configuration directory is read only."); } if (replacementsFile != null) { saveReplacements(replacementsFile); @@ -208,4 +292,16 @@ public class Configuration { public static List getReplacements() { return replacements; } + + public static void loadConfig() throws IOException { + loadFromFile(getConfigFile(), getReplacementsFile()); + } + + public static void saveConfig() { + try { + saveToFile(getConfigFile(), getReplacementsFile()); + } catch (IOException ex) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); + } + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 755c35dbd..1f55dada2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.console; import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.ConsoleAbortRetryIgnoreHandler; import com.jpexs.decompiler.flash.EventListener; @@ -123,7 +124,7 @@ public class CommandLineArgumentParser { case "-config": parseConfig(args); if (args.isEmpty()) { - Main.saveConfig(); + Configuration.saveConfig(); System.out.println("Configuration saved"); return null; } @@ -183,8 +184,8 @@ public class CommandLineArgumentParser { } public static void printHeader() { - System.out.println(Main.applicationVerName); - for (int i = 0; i < Main.applicationVerName.length(); i++) { + System.out.println(ApplicationInfo.applicationVerName); + for (int i = 0; i < ApplicationInfo.applicationVerName.length(); i++) { System.out.print("-"); } System.out.println(); @@ -511,11 +512,11 @@ public class CommandLineArgumentParser { exportOK = true; break; case "fla": - exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); exportOK = true; break; case "xfl": - exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); exportOK = true; break; default: @@ -524,7 +525,7 @@ public class CommandLineArgumentParser { } catch (OutOfMemoryError | Exception ex) { exportOK = false; System.err.print("FAIL: Exporting Failed on Exception - "); - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } long stopTime = System.currentTimeMillis(); @@ -574,7 +575,7 @@ public class CommandLineArgumentParser { Configuration.setConfig("parallelSpeedUp", false); SWF swf = Main.parseSWF(args.remove()); } catch (Exception ex) { - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } System.exit(0); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java index b2d80c204..54d2399b0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -77,7 +78,7 @@ public class AboutDialog extends AppDialog { appNamePanel.setAlignmentX(0.5f); cp.add(appNamePanel); - JLabel verLabel = new JLabel(translate("version") + " " + Main.version); + JLabel verLabel = new JLabel(translate("version") + " " + ApplicationInfo.version); verLabel.setAlignmentX(0.5f); //verLabel.setPreferredSize(new Dimension(300, 15)); verLabel.setFont(new Font("Tahoma", Font.BOLD, 15)); @@ -137,7 +138,7 @@ public class AboutDialog extends AppDialog { cp.add(Box.createVerticalStrut(10)); - LinkLabel wwwLabel = new LinkLabel(Main.projectPage); + LinkLabel wwwLabel = new LinkLabel(ApplicationInfo.projectPage); wwwLabel.setAlignmentX(0.5f); wwwLabel.setForeground(Color.blue); //wwwLabel.setPreferredSize(new Dimension(300, 25)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java index 4fa2a4a30..ea0b0bb95 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; @@ -65,7 +66,7 @@ public class LoadingDialog extends AppDialog implements ImageObserver { */ public LoadingDialog() { setResizable(false); - setTitle(Main.shortApplicationVerName); + setTitle(ApplicationInfo.shortApplicationVerName); Container cntp = getContentPane(); JPanel cnt = new JPanel(); cntp.setLayout(new BorderLayout()); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 03babe603..60a863ddc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.EventListener; import com.jpexs.decompiler.flash.SWF; @@ -46,8 +47,6 @@ import java.awt.event.MouseEvent; import java.io.*; import java.net.Socket; import java.net.URLDecoder; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; @@ -80,15 +79,6 @@ public class Main { public static InputStream inputStream; public static String fileTitle; public static SWF swf; - public static String version = ""; - public static final String applicationName = "JPEXS Free Flash Decompiler"; - public static String applicationVerName; - public static final String shortApplicationName = "FFDec"; - public static String shortApplicationVerName; - public static final String projectPage = "http://www.free-decompiler.com/flash"; - public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion="; - public static String updatePage; - public static final String vendor = "JPEXS"; public static LoadingDialog loadingDialog; public static ModeFrame modeFrame; private static boolean working = false; @@ -116,20 +106,6 @@ public class Main { loadFromMemoryFrame.setVisible(true); } - private static void loadProperties() { - Properties prop = new Properties(); - try { - prop.load(Main.class.getResourceAsStream("/project.properties")); - version = prop.getProperty("version"); - applicationVerName = applicationName + " v." + version; - updatePage = updatePageStub + version; - shortApplicationVerName = shortApplicationName + " v." + version; - } catch (IOException ex) { - //ignore - version = "unknown"; - } - } - /** * Get title of the file * @@ -693,9 +669,7 @@ public class Main { } public static void initLang() { - if (Configuration.containsConfig("locale")) { - Locale.setDefault(Locale.forLanguageTag(Configuration.getConfig("locale", "en"))); - } + Locale.setDefault(Locale.forLanguageTag(Configuration.getConfig("locale", "en"))); UIManager.put("OptionPane.okButtonText", AppStrings.translate("button.ok")); UIManager.put("OptionPane.yesButtonText", AppStrings.translate("button.yes")); UIManager.put("OptionPane.noButtonText", AppStrings.translate("button.no")); @@ -813,8 +787,7 @@ public class Main { */ public static void main(String[] args) throws IOException { startFreeMemThread(); - loadProperties(); - Configuration.loadFromFile(getConfigFile(), getReplacementsFile()); + Configuration.loadConfig(); initLogging(Configuration.debugMode); initLang(); @@ -840,7 +813,7 @@ public class Main { } public static String tempFile(String url) throws IOException { - File f = new File(getFFDecHome() + "saved" + File.separator); + File f = new File(Configuration.getFFDecHome() + "saved" + File.separator); if (!f.exists()) { if (!f.mkdirs()) { if (!f.exists()) { @@ -848,7 +821,7 @@ public class Main { } } } - return getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp"; + return Configuration.getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp"; } @@ -879,7 +852,7 @@ public class Main { } if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); - trayIcon = new TrayIcon(View.loadImage("proxy16"), vendor + " " + shortApplicationName + " " + AppStrings.translate("proxy")); + trayIcon = new TrayIcon(View.loadImage("proxy16"), ApplicationInfo.vendor + " " + ApplicationInfo.shortApplicationName + " " + AppStrings.translate("proxy")); trayIcon.setImageAutoSize(true); PopupMenu trayPopup = new PopupMenu(); @@ -936,16 +909,8 @@ public class Main { } } - public static void saveConfig() { - try { - Configuration.saveToFile(getConfigFile(), getReplacementsFile()); - } catch (IOException ex) { - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); - } - } - public static void exit() { - saveConfig(); + Configuration.saveConfig(); FlashPlayerPanel.unload(); System.exit(0); } @@ -969,7 +934,7 @@ public class Main { try { Socket sock = new Socket("www.free-decompiler.com", 80); OutputStream os = sock.getOutputStream(); - os.write(("GET /flash/update.html?action=check¤tVersion=" + version + " HTTP/1.1\r\nHost: www.free-decompiler.com\r\nUser-Agent: " + shortApplicationVerName + "\r\nConnection: close\r\n\r\n").getBytes()); + os.write(("GET /flash/update.html?action=check¤tVersion=" + ApplicationInfo.version + " HTTP/1.1\r\nHost: www.free-decompiler.com\r\nUser-Agent: " + ApplicationInfo.shortApplicationVerName + "\r\nConnection: close\r\n\r\n").getBytes()); BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream())); String s; boolean start = false; @@ -1068,13 +1033,13 @@ public class Main { logger.removeHandler(fileTxt); } try { - File f = new File(getFFDecHome() + File.separator + "log.txt"); + File f = new File(Configuration.getFFDecHome() + File.separator + "log.txt"); FileOutputStream fos = new FileOutputStream(f); fos.close(); } catch (IOException ex) { } try { - fileTxt = new FileHandler(getFFDecHome() + File.separator + "log.txt"); + fileTxt = new FileHandler(Configuration.getFFDecHome() + File.separator + "log.txt"); } catch (IOException | SecurityException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } @@ -1105,97 +1070,6 @@ public class Main { throw new RuntimeException("Problems with creating the log files"); } } - private static final String CONFIG_NAME = "config.bin"; - private static final String REPLACEMENTS_NAME = "replacements.cfg"; - private static final File unspecifiedFile = new File("unspecified"); - private static File directory = unspecifiedFile; - - private enum OSId { - - WINDOWS, OSX, UNIX - } - - private static OSId getOSId() { - PrivilegedAction doGetOSName = new PrivilegedAction() { - @Override - public String run() { - return System.getProperty("os.name"); - } - }; - OSId id = OSId.UNIX; - String osName = AccessController.doPrivileged(doGetOSName); - if (osName != null) { - if (osName.toLowerCase().startsWith("mac os x")) { - id = OSId.OSX; - } else if (osName.contains("Windows")) { - id = OSId.WINDOWS; - } - } - return id; - } - - public static String getFFDecHome() throws IOException { - if (directory == unspecifiedFile) { - directory = null; - String userHome = null; - try { - userHome = System.getProperty("user.home"); - } catch (SecurityException ignore) { - } - if (userHome != null) { - String applicationId = Main.shortApplicationName; - OSId osId = getOSId(); - if (osId == OSId.WINDOWS) { - File appDataDir = null; - try { - String appDataEV = System.getenv("APPDATA"); - if ((appDataEV != null) && (appDataEV.length() > 0)) { - appDataDir = new File(appDataEV); - } - } catch (SecurityException ignore) { - } - String vendorId = Main.vendor; - if ((appDataDir != null) && appDataDir.isDirectory()) { - // ${APPDATA}\{vendorId}\${applicationId} - String path = vendorId + "\\" + applicationId + "\\"; - directory = new File(appDataDir, path); - } else { - // ${userHome}\Application Data\${vendorId}\${applicationId} - String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\"; - directory = new File(userHome, path); - } - } else if (osId == OSId.OSX) { - // ${userHome}/Library/Application Support/${applicationId} - String path = "Library/Application Support/" + applicationId + "/"; - directory = new File(userHome, path); - } else { - // ${userHome}/.${applicationId}/ - String path = "." + applicationId + "/"; - directory = new File(userHome, path); - } - } - } - if (!directory.exists()) { - if (!directory.mkdirs()) { - if (!directory.exists()) { - throw new IOException("cannot create directory " + directory); - } - } - } - String ret = directory.getAbsolutePath(); - if (!ret.endsWith(File.separator)) { - ret += File.separator; - } - return ret; - } - - private static String getReplacementsFile() throws IOException { - return getFFDecHome() + REPLACEMENTS_NAME; - } - - private static String getConfigFile() throws IOException { - return getFFDecHome() + CONFIG_NAME; - } public static boolean isAddedToContextMenu() { if (!Platform.isWindows()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 08c525a11..31eeecfa7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.FrameNode; import com.jpexs.decompiler.flash.PackageNode; @@ -622,7 +623,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T Main.exit(); } }); - setTitle(Main.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : "")); + setTitle(ApplicationInfo.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : "")); JMenuBar menuBar = new JMenuBar(); @@ -2646,7 +2647,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "SAVEAS": if (Main.saveFileDialog()) { - setTitle(Main.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : "")); + setTitle(ApplicationInfo.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : "")); saveCommandButton.setEnabled(!Main.readOnly); } break; @@ -2709,9 +2710,9 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T Helper.freeMem(); try { if (compressed) { - swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); } else { - swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); } } catch (IOException ex) { View.showMessageDialog(null, translate("error.export") + ": " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE); @@ -2728,11 +2729,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T export.setVisible(true); if (!export.cancelled) { JFileChooser chooser = new JFileChooser(); - if (Configuration.containsConfig("lastExportDir")) { - chooser.setCurrentDirectory(new java.io.File(Configuration.getConfig("lastExportDir", "."))); - } else { - chooser.setCurrentDirectory(new File(".")); - } + chooser.setCurrentDirectory(new File(Configuration.getConfig("lastExportDir", "."))); chooser.setDialogTitle(translate("export.select.directory")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); @@ -2783,7 +2780,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "HELPUS": - String helpUsURL = Main.projectPage + "/help_us.html"; + String helpUsURL = ApplicationInfo.projectPage + "/help_us.html"; if (java.awt.Desktop.isDesktopSupported()) { java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); try { @@ -2797,7 +2794,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "HOMEPAGE": - String homePageURL = Main.projectPage; + String homePageURL = ApplicationInfo.projectPage; if (java.awt.Desktop.isDesktopSupported()) { java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); try { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java index b8d12ddd4..f826854b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import java.awt.Container; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -61,7 +62,7 @@ public class ModeFrame extends AppFrame implements ActionListener { cont.add(exitButton); View.centerScreen(this); View.setWindowIcon(this); - setTitle(Main.shortApplicationVerName); + setTitle(ApplicationInfo.shortApplicationVerName); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java index 62843067f..11b778bc2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Version; import java.awt.Container; import java.awt.Dimension; @@ -115,7 +116,7 @@ public class NewVersionDialog extends AppDialog implements ActionListener { java.net.URI uri = new java.net.URI(latestVersion.updateLink); desktop.browse(uri); } else { - java.net.URI uri = new java.net.URI(Main.updatePage); + java.net.URI uri = new java.net.URI(ApplicationInfo.updatePage); desktop.browse(uri); } Main.exit(); @@ -126,7 +127,7 @@ public class NewVersionDialog extends AppDialog implements ActionListener { } } if (desktop == null) { - View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", Main.shortApplicationName).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", Main.projectPage), translate("newversion"), JOptionPane.INFORMATION_MESSAGE); + View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.shortApplicationName).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", ApplicationInfo.projectPage), translate("newversion"), JOptionPane.INFORMATION_MESSAGE); } } setVisible(false); From 17173aef005336d1566c0c742b6fe513c90742e8 Mon Sep 17 00:00:00 2001 From: Honfika Date: Thu, 7 Nov 2013 12:11:26 +0100 Subject: [PATCH 8/8] small resource fixes --- .../flash/gui/locales/MainFrame.properties | 5 ++++ .../flash/gui/locales/MainFrame_cs.properties | 10 ++++---- .../flash/gui/locales/MainFrame_de.properties | 5 ++++ .../flash/gui/locales/MainFrame_es.properties | 23 ++++++++----------- .../flash/gui/locales/MainFrame_hu.properties | 13 ++++++----- .../flash/gui/locales/MainFrame_pt.properties | 3 +++ .../flash/gui/locales/MainFrame_ru.properties | 6 ++++- .../flash/gui/locales/MainFrame_sv.properties | 21 ++++++++--------- .../flash/gui/locales/MainFrame_zh.properties | 11 +++++---- 9 files changed, 55 insertions(+), 42 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 5e8dcbf10..3af759d2d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -279,6 +279,7 @@ FileChooser.updateButtonText = Update FileChooser.updateButtonToolTipText = Update directory listing #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = Details FileChooser.detailsViewButtonToolTip.textAndMnemonic = Details FileChooser.fileAttrHeader.textAndMnemonic = Attributes @@ -320,6 +321,7 @@ button.ignore = Ignore font.source = Source Font: #after version 1.6.7: + menu.export = Export menu.general = General menu.language = Language @@ -332,6 +334,7 @@ error.font.nocharacter = Selected source font does not contain character "%char% warning.initializers = Static fields and consts are often initialized in initializers.\nEditing value here is usually not enough! #after version 1.7.0u1: + menu.tools.searchmemory = Search SWFs in memory menu.file.reload = Reload message.confirm.reload = This action cancels all unsaved changes and reloads the SWF file again.\nDo you want to continue? @@ -348,6 +351,7 @@ ColorChooser.swatchesRecentText = Recent: ColorChooser.sampleText=Sample Text Sample Text #after version 1.7.1: + preview.play = Play preview.pause = Pause preview.stop = Stop @@ -357,6 +361,7 @@ message.confirm.removemultiple = Are you sure you want to remove %count% items\n menu.tools.searchcache = Search browsers cache #after version 1.7.2u2 + error.trait.exists = Trait with name "%name%" already exists. button.addtrait = Add trait button.font.embed = Embed... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index 429d2205b..9a843f681 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -22,7 +22,6 @@ menu.file.export.all = Exportovat v\u0161e menu.file.export.selection = Exportovat vybran\u00e9 menu.file.exit = Ukon\u010dit - menu.tools = N\u00e1stroje menu.tools.searchas = Prohledat ActionScript... menu.tools.proxy = Proxy @@ -32,7 +31,6 @@ menu.tools.deobfuscation.globalrename = Glob\u00e1ln\u011b p\u0159ejmenovat iden menu.tools.deobfuscation.renameinvalid = P\u0159ejmenovat neplatn\u00e9 identifik\u00e1tory menu.tools.gotodocumentclass = P\u0159ej\u00edt na hlavn\u00ed t\u0159\u00eddu dokumentu - menu.settings = Nastaven\u00ed menu.settings.autodeobfuscation = Automatick\u00e1 deobfuskace menu.settings.internalflashviewer = Pou\u017e\u00edvat vlastn\u00ed prohl\u00ed\u017ee\u010d Flashe @@ -93,7 +91,6 @@ message.confirm.autodeobfuscate = Automatick\u00e1 deobfuskace je zp\u016fsob ja message.parallel = parallelismus message.trait.saved = Vlastnost \u00fasp\u011b\u0161n\u011b ulo\u017eena - message.constant.new.string = \u0158et\u011bzec "%value%" neexistuje v tabulce konstant. Chcete ho p\u0159idat? message.constant.new.string.title = P\u0159idat \u0158et\u011bzec message.constant.new.integer = Cel\u00e9 \u010d\u00edslo "%value%" neexistuje v tabulce konstant. Chcete ho p\u0159idat? @@ -121,7 +118,6 @@ work.buildingscripttree = Vytv\u00e1\u0159en\u00ed stromu skript\u016f work.deobfuscating.complete = Deobfuskace kompletn\u00ed - message.search.notfound = \u0158et\u011bzec "%searchtext%" nenalezen. message.search.notfound.title = Nenalezeno @@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = Typ a Hodnota: error.slotconst.typevalue = Chyba typu a hodnoty SlotConst - message.autofill.failed = Nelze z\u00edskat statistiky k\u00f3du pro automatick\u00e9 parametry body.\r\nOd\u0161krtn\u011bte automatick\u00e9 vypl\u0148ov\u00e1n\u00ed pro zamezen\u00ed t\u00e9to zpr\u00e1vy. info.selecttrait = Vyberte t\u0159\u00eddu a klikn\u011bte na vlastnost v zdrojov\u00e9m ActionScriptu pro \u00fapravy. @@ -284,6 +279,7 @@ FileChooser.updateButtonText = Obnoven\u00ed FileChooser.updateButtonToolTipText = Obnoven\u00ed v\u00fdpisu adres\u00e1\u0159e #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = Detaily FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detaily FileChooser.fileAttrHeader.textAndMnemonic = Vlastnosti @@ -325,6 +321,7 @@ button.ignore = Ignorovat font.source = Zdrojov\u00e9 p\u00edsmo: #after version 1.6.7: + menu.export = Export menu.general = Hlavn\u00ed menu.language = Jazyk @@ -337,6 +334,7 @@ error.font.nocharacter = Vybran\u00e9 zdrojov\u00e9 p\u00edsmo neobsahuje znak " warning.initializers = Statick\u00e9 atributy a konstanty jsou \u010dasto inicializov\u00e1ny pomoc\u00ed inicializ\u00e1tor\u016f.\nPokud to uprav\u00edte zde, obvykle to nesta\u010d\u00ed! #after version 1.7.0u1: + menu.tools.searchmemory = Hledat SWF v pam\u011bti menu.file.reload = Znovu na\u010d\u00edst message.confirm.reload = Tato akce zru\u0161\u00ed v\u0161echny neulo\u017een\u00e9 zm\u011bny a znovu na\u010dte SWF soubor.\nChcete pokra\u010dovat? @@ -353,6 +351,7 @@ ColorChooser.swatchesRecentText = Ned\u00e1vn\u00e9: ColorChooser.sampleText=Vzorov\u00fd Text Vzorov\u00fd Text #after version 1.7.1: + preview.play = P\u0159ehr\u00e1t preview.pause = Pauza preview.stop = Zastavit @@ -362,6 +361,7 @@ message.confirm.removemultiple = Opravdu chcete odebrat %count% polo\u017eek\n a menu.tools.searchcache = Prohledat cache prohl\u00ed\u017ee\u010d\u016f #after version 1.7.2u2 + error.trait.exists = Vlastnost s n\u00e1zvem "%name%" ji\u017e existuje. button.addtrait = P\u0159idat vlastnost button.font.embed = Vlo\u017eit... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties index 7b208d553..59796ead8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_de.properties @@ -280,6 +280,7 @@ FileChooser.updateButtonText = Aktualisieren FileChooser.updateButtonToolTipText = Ordner Aktualisieren #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = Details FileChooser.detailsViewButtonToolTip.textAndMnemonic = Details FileChooser.fileAttrHeader.textAndMnemonic = Attribute @@ -321,6 +322,7 @@ button.ignore = Ignorieren font.source = Quellschriftart: #after version 1.6.7: + menu.export = Export menu.general = Generell menu.language = Sprache @@ -333,6 +335,7 @@ error.font.nocharacter = Die ausgew\u00e4hlte Quellschriftart beinhaltet den Buc warning.initializers = Statische Felder und Konstanten sind h\u00e4uftig in Initializer initailisiert.\nDen Wert hier zu bearbeiten ist meistens nicht genug! #after version 1.7.0u1: + menu.tools.searchmemory = SWFs Dateien im Speicher suchen menu.file.reload = Erneut laden message.confirm.reload = Diese Aktion bricht alle nicht gespeicherten \u00c4nderungen ab und l\u00e4dt die Datei erneut.\nWollen Sie fortfahren? @@ -349,6 +352,7 @@ ColorChooser.swatchesRecentText = Letzte: ColorChooser.sampleText=Beispieltext Beispieltext #after version 1.7.1: + preview.play = Start preview.pause = Pause preview.stop = Stopp @@ -358,6 +362,7 @@ message.confirm.removemultiple = Wollen sie wirklich %count% Elemente entfernen\ menu.tools.searchcache = Browsercache suchen #after version 1.7.2u2 + error.trait.exists = Eigenschaft mit dem Namen "%name%" existiert bereits. button.addtrait = Eigenschaft hinzuf\u00fcgen button.font.embed = Eingebettet... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties index a62b44194..73dbc311e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties @@ -22,7 +22,6 @@ menu.file.export.all = Exportar todas las partes menu.file.export.selection = Exportar selecci\u00f3n menu.file.exit = Salir - menu.tools = Herramientas menu.tools.searchas = Buscar todo el ActionScript... menu.tools.proxy = Proxy @@ -92,7 +91,6 @@ message.confirm.autodeobfuscate = La desofuscaci\u00f3n autom\u00e1tica es una m message.parallel = Paralelismo message.trait.saved = Rasgo guardado existosamente - message.constant.new.string = La cadena "%value%" no est\u00e1 presente en la tabla de constantes. Desea agregarla? message.constant.new.string.title = Agregar cadena message.constant.new.integer = El entero "%value%" no est\u00e1 presente en la tabla de constantes. Desea agregarlo? @@ -120,7 +118,6 @@ work.buildingscripttree = Generando \u00e1rbol de script Building script tree work.deobfuscating.complete = Desofuscaci\u00f3n completada - message.search.notfound = Cadena "%searchtext%" no encontrada. message.search.notfound.title = No encontrado @@ -187,7 +184,6 @@ abc.detail.methodinfo.returnvalue = Tipo de valor de retorno: error.methodinfo.params = Error de pa\u0155ametro MethodInfo error.methodinfo.returnvalue = Error de retorno de tipo MethodInfo - abc.detail.methodinfo = MethodInfo abc.detail.body.code = C\u00f3digo de MethodBody abc.detail.body.params = Par\u00e1metros de MethodBody @@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = Tipo y valor: error.slotconst.typevalue = Error de valor de tipo SlotConst - message.autofill.failed = No se puede obtener las estad\u00edsticas de c\u00f3digo para los par\u00e1metros de cuerpo autom\u00e1ticos.\r\nDestilde auto-llenado para evitar este mensaje. info.selecttrait = Seleccione la clase y clickee un atributo en el c\u00f3digo Actionscript para editarlo. @@ -248,7 +243,7 @@ FileChooser.openButtonToolTipText = Abrir FileChooser.lookInLabelText = Mirar en: FileChooser.acceptAllFileFilterText = Todos los archivos FileChooser.filesOfTypeLabelText = Archivos de tipo: -FileChooser.fileNameLabelText = Nombre del archivo: +FileChooser.fileNameLabelText = Nombre de archivo: FileChooser.listViewButtonToolTipText = Lista FileChooser.listViewButtonAccessibleName = Lista FileChooser.detailsViewButtonToolTipText = Detales @@ -267,7 +262,6 @@ FileChooser.directoryDescriptionText = Directorio FileChooser.directoryOpenButtonText = Abrir FileChooser.directoryOpenButtonToolTipText = Abrir el directorio seleccionado FileChooser.fileDescriptionText = Archivo gen\u00e9rico -FileChooser.fileNameLabelText = Nombre de archivo: FileChooser.helpButtonText = Ayuda FileChooser.helpButtonToolTipText = Ayuda de FileChooser FileChooser.newFolderAccessibleName = Nueva carpeta @@ -285,6 +279,7 @@ FileChooser.updateButtonText = Actualizar FileChooser.updateButtonToolTipText = Actualizar listado de directorio #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = Detalles FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detalles FileChooser.fileAttrHeader.textAndMnemonic = Atributos @@ -318,7 +313,6 @@ FileChooser.fileSizeMegaBytes = {0} MB FileChooser.fileSizeGigaBytes = {0} GB FileChooser.folderNameLabelText = Nombre de carpeta: - error.occured = Ocurri\u00f3 un error : %error% button.abort = Abortar button.retry = Reintentar @@ -327,6 +321,7 @@ button.ignore = Ignorar font.source = Origen de la fuente: #after version 1.6.7: + menu.export = Exportar menu.general = General menu.language = Lenguaje @@ -345,7 +340,8 @@ message.confirm.reload = Esta acci\u00f3n eliminar\u00e1 todos lo cambios no gua dialog.selectcolor.title = Seleccionar color de fondo para la visualizaci\u00f3n del SWF button.selectcolor.hint = Seleccionar color de fondo -ColorChooser.okText = OK + +ColorChooser.okText = OK ColorChooser.cancelText = Cancelar ColorChooser.resetText = Reiniciar ColorChooser.previewText = Vista previa @@ -353,15 +349,18 @@ ColorChooser.swatchesNameText = Muestras ColorChooser.swatchesRecentText = Reciente: ColorChooser.sampleText=Texto de muestra Texto de muestra -#after version 1.7.1: +#after version 1.7.1: + preview.play = Reproducir preview.pause = Pausar preview.stop = Detener + message.confirm.removemultiple = Est\u00e1 seguro que desea eliminar %count% art\u00edculos\n y todos los objetos que dependen de el? menu.tools.searchcache = Buscar cache del navegador #after version 1.7.2u2 + error.trait.exists = La caracter\u00edstica con nombre "%name%" ya existe. button.addtrait = Agregar caracter\u00edstica button.font.embed = Incrustar... @@ -374,7 +373,3 @@ filter.supported = Todos los tipos de archivo soportados (*.swf, *.gfx) work.canceled = Cancelado work.restoringControlFlow = Restaurando control de flujo -actionscript.pcode = P-code -actionscript.pcodehex = P-code con Hexadecimal -actionscript.hex = Hexadecimal - 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 926319a3e..ca0577273 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 @@ -22,7 +22,6 @@ menu.file.export.all = Minden r\u00e9sz export\u00e1l\u00e1sa menu.file.export.selection = Kijel\u00f6ltek export\u00e1l\u00e1sa menu.file.exit = Kil\u00e9p\u00e9s - menu.tools = Eszk\u00f6z\u00f6k menu.tools.searchas = Keres\u00e9s az \u00f6sszes ActionScriptben... menu.tools.proxy = Proxy @@ -92,7 +91,6 @@ message.confirm.autodeobfuscate = Automatikus deobfuszk\u00e1l\u00e1s egy m\u00f message.parallel = P\u00e1rhuzamos\u00edt\u00e1s message.trait.saved = Jellemz\u0151 sikeresen lementve - message.constant.new.string = Karakterl\u00e1nc "%value%" nem tal\u00e1lhat\u00f3 a konstans t\u00e1bl\u00e1ban. Szeretn\u00e9 hozz\u00e1adni? message.constant.new.string.title = Karakterl\u00e1nc hozz\u00e1ad\u00e1sa message.constant.new.integer = Eg\u00e9sz \u00e9rt\u00e9k "%value%" nem tal\u00e1lhat\u00f3 a konstans t\u00e1bl\u00e1ban. Szeretn\u00e9 hozz\u00e1adni? @@ -120,7 +118,6 @@ work.buildingscripttree = Szkript fa \u00e9p\u00edt\u00e9se work.deobfuscating.complete = Deobfuszk\u00e1l\u00e1s k\u00e9sz - message.search.notfound = Karakterl\u00e1nc "%searchtext%" nem tal\u00e1lhat\u00f3. message.search.notfound.title = Nem tal\u00e1lhat\u00f3 @@ -187,7 +184,6 @@ abc.detail.methodinfo.returnvalue = Visszat\u00e9r\u00e9si \u00e9rt\u00e9k t\u00 error.methodinfo.params = MethodInfo Param\u00e9ter Hiba error.methodinfo.returnvalue = MethodInfo Visszat\u00e9r\u00e9si \u00e9rt\u00e9k Hiba - abc.detail.methodinfo = MethodInfo abc.detail.body.code = MethodBody K\u00f3d abc.detail.body.params = MethodBody param\u00e9terek @@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = T\u00edpus \u00e9s \u00c9rt\u00e9k: error.slotconst.typevalue = SlotConst t\u00edpus\u00e9rt\u00e9k Hiba - message.autofill.failed = K\u00f3d statisztika nem el\u00e9rhet\u0151 az automatikus t\u00f6rzs param\u00e9terekhez.\r\nVegye ki a pip\u00e1t az az automatikus kit\u00f6lt\u00e9s mell\u0151l ennek az \u00fczenetnek az elket\u00fcl\u00e9s\u00e9hez. info.selecttrait = V\u00e1lasszon ki egy oszt\u00e1lyt \u00e9s kattintson egy jellemz\u0151re az ActionScript forr\u00e1sban a szerkeszt\u00e9shez. @@ -228,6 +223,7 @@ font.leading = Sork\u00f6z: font.characters = Karakterek: font.characters.add = Karakter hozz\u00e1ad\u00e1sa: value.unknown = ? + yes = igen no = nem @@ -266,7 +262,6 @@ FileChooser.directoryDescriptionText = K\u00f6nyvt\u00e1r FileChooser.directoryOpenButtonText = Megnyit\u00e1s FileChooser.directoryOpenButtonToolTipText = A kiv\u00e1lasztott k\u00f6nyvt\u00e1r megnyit\u00e1sa FileChooser.fileDescriptionText = \u00c1ltal\u00e1nos f\u00e1jl -FileChooser.fileNameLabelText = F\u00e1jln\u00e9v: FileChooser.helpButtonText = S\u00fag\u00f3 FileChooser.helpButtonToolTipText = FileChooser s\u00fag\u00f3 FileChooser.newFolderAccessibleName = \u00daj mappa @@ -284,6 +279,7 @@ FileChooser.updateButtonText = Friss\u00edt\u00e9s FileChooser.updateButtonToolTipText = K\u00f6nyvt\u00e1r lista friss\u00edt\u00e9se #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = R\u00e9szletek FileChooser.detailsViewButtonToolTip.textAndMnemonic = R\u00e9szletek FileChooser.fileAttrHeader.textAndMnemonic = Attrib\u00fatumok @@ -325,6 +321,7 @@ button.ignore = Mell\u0151z font.source = Forr\u00e1s bet\u0171t\u00edpus: #after version 1.6.7: + menu.export = Export\u00e1l\u00e1s menu.general = \u00c1ltal\u00e1nos menu.language = Nyelv @@ -337,6 +334,7 @@ error.font.nocharacter = A kiv\u00e1lasztott forr\u00e1s bet\u0171t\u00edpus nem warning.initializers = A statikus mez\u0151k \u00e9s konstansok gyakram az initializerekben vannak inicializ\u00e1lva.\nAz \u00e9rt\u00e9k szerkeszt\u00e9se csak itt \u00e1ltal\u00e1ban nem elegend\u0151! #after version 1.7.0u1: + menu.tools.searchmemory = SWF-ek keres\u00e9se a mem\u00f3ri\u00e1ban menu.file.reload = \u00dajrat\u00f6lt\u00e9s message.confirm.reload = Ez a m\u0171velet visszavonja az \u00f6sszes nem mentett v\u00e1ltoz\u00e1st, \u00e9s \u00fajrat\u00f6lti az SWF f\u00e1jlt.\nSzeretn\u00e9 folytatni? @@ -353,14 +351,17 @@ ColorChooser.swatchesRecentText = El\u0151zm\u00e9nyek: ColorChooser.sampleText=Minta Sz\u00f6veg Minta Sz\u00f6veg #after version 1.7.1: + preview.play = Lej\u00e1tsz\u00e1s preview.pause = Sz\u00fcnet preview.stop = Meg\u00e1ll\u00edt\u00e1s message.confirm.removemultiple = Biztos benne, hogy t\u00f6r\u00f6lni k\u00edv\u00e1nja a %count% elemet\n \u00e9s az \u00f6sszes t\u0151le f\u00fcgg\u0151 objektumot ? + menu.tools.searchcache = Keres\u00e9s a b\u00f6ng\u00e9sz\u0151 gyors\u00edt\u00f3t\u00e1r\u00e1ban #after version 1.7.2u2 + error.trait.exists = "%name%" nev\u0171 jellemz\u0151 m\u00e1r l\u00e9tezik. button.addtrait = Jellemz\u0151 hozz\u00e1ad\u00e1sa button.font.embed = Be\u00e1gyaz... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties index eb97baab4..8a800be01 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_pt.properties @@ -279,6 +279,7 @@ FileChooser.updateButtonText = Actualizar FileChooser.updateButtonToolTipText = Actualizar listagem do directorio #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = Detalhes FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detalhes FileChooser.fileAttrHeader.textAndMnemonic = Atributos @@ -320,6 +321,7 @@ button.ignore = Ignorar font.source = Fonte inicial: #after version 1.6.7: + menu.export = Exportar menu.general = Geral menu.language = Lingua @@ -332,6 +334,7 @@ error.font.nocharacter = A fonte seleccionada n\u00e3o contem o caracter "%char% warning.initializers = Campos est\u00e1ticos e constantes regularmente sao inicializades em inicializadores.\nEditar valores aqui pode n\u00e3o ser o suficiente! #after version 1.7.0u1: + menu.tools.searchmemory = Procurar SWFs em mem\u00f3ria menu.file.reload = Carregar de novo message.confirm.reload = Esta acc\u00e7\u00e3o cancela todas as altera\u00e7\u00f5es N\u00c3O salvas e carrega de novo o ficheiro swf.\nDeseja continuar? diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties index 9ccb3979e..0bd325dd4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties @@ -220,6 +220,7 @@ font.leading = \u0418\u043d\u0442\u0435\u0440\u043b\u0438\u043d\u044c\u044f\u043 font.characters = \u0421\u0438\u043c\u0432\u043e\u043b\u044b: font.characters.add = \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b: value.unknown = ? + yes = \u0434\u0430 no = \u043d\u0435\u0442 @@ -258,7 +259,6 @@ FileChooser.directoryDescriptionText = \u041f\u0430\u043f\u043a\u0430 FileChooser.directoryOpenButtonText = \u041e\u0442\u043a\u0440\u044b\u0442\u044c FileChooser.directoryOpenButtonToolTipText = \u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 FileChooser.fileDescriptionText = \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b -FileChooser.fileNameLabelText = \u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430: FileChooser.helpButtonText = \u041f\u043e\u043c\u043e\u0449\u044c FileChooser.helpButtonToolTipText = \u041f\u043e\u043c\u043e\u0449\u044c \u043f\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0443 \u0432\u044b\u0431\u043e\u0440\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 FileChooser.newFolderAccessibleName = \u041d\u043e\u0432\u0430\u044f \u043f\u0430\u043f\u043a\u0430 @@ -331,6 +331,7 @@ error.font.nocharacter = \u0421\u0438\u043c\u0432\u043e\u043b "%char%" \u043e\u0 warning.initializers = \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445.\n\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0445 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0434\u0435\u0441\u044c, \u043d\u043e \u0438 \u0442\u0430\u043c! #after version 1.7.0u1: + menu.tools.searchmemory = \u0418\u0441\u043a\u0430\u0442\u044c SWF \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 menu.file.reload = \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c message.confirm.reload = \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u043d\u0435\u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 SWF \u0444\u0430\u0439\u043b.\n \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c? @@ -347,14 +348,17 @@ ColorChooser.swatchesRecentText = \u041d\u0435\u0434\u0430\u0432\u043d\u0435\u04 ColorChooser.sampleText = \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 #after version 1.7.1: + preview.play = \u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 preview.pause = \u041f\u0430\u0443\u0437\u0430 preview.stop = \u0421\u0442\u043e\u043f message.confirm.removemultiple = \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435:%count%\n \u0438 \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u043e\u0442 \u043d\u0438\u0445? + menu.tools.searchcache = \u041f\u043e\u0438\u0441\u043a \u0432 \u043a\u044d\u0448\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432 #after version 1.7.2u2 + error.trait.exists = Trait \u0441 \u0438\u043c\u0435\u043d\u0435\u043c "%name%" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. button.addtrait = \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c trait button.font.embed = \u0412\u0441\u0442\u0440\u043e\u0438\u0442\u044c... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties index 8f84861a7..80243b106 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties @@ -22,7 +22,6 @@ menu.file.export.all = Exportera alla delar menu.file.export.selection = Exportera markering menu.file.exit = St\u00e4ng - menu.tools = Verktyg menu.tools.searchas = S\u00f6k igenom alla ActionSkript... menu.tools.proxy = Proxy @@ -92,7 +91,6 @@ message.confirm.autodeobfuscate = Automatiskt avl\u00e4gsning av obfuskering \u0 message.parallel = parallellitet message.trait.saved = Egenskap har sparats - message.constant.new.string = Str\u00e4ng "%value%" finns inte i konstant tabellen. Vill du l\u00e4gga till det? message.constant.new.string.title = L\u00e4gg till Str\u00e4ng message.constant.new.integer = Heltal v\u00e4rde "%value%" finns inte i konstant tabellen. Vill du l\u00e4gga till det? @@ -120,7 +118,6 @@ work.buildingscripttree = Bygger skript tr\u00e4 work.deobfuscating.complete = Avl\u00e4gsning utav obfuskering \u00e4r nu f\u00e4rdig - message.search.notfound = Str\u00e4ng "%searchtext%" hittades inte. message.search.notfound.title = Hittades inte @@ -187,7 +184,6 @@ abc.detail.methodinfo.returnvalue = \u00c5terl\u00e4mna v\u00e4rde: error.methodinfo.params = MetodInfo Parameter fel error.methodinfo.returnvalue = MetodInfo \u00e5terl\u00e4mmnings typ Fel - abc.detail.methodinfo = MetodInfo abc.detail.body.code = MetodInfo Kod abc.detail.body.params = MetodKropp parametrar @@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = Typ och V\u00e4rde: error.slotconst.typevalue = SlotConst typv\u00e4rde felaktighet - message.autofill.failed = Kan inte f\u00e5 statistik koden f\u00f6r automatisk kropps-parametrar.\r\nAvmarkera automatisk ifyllnad f\u00f6r att undvika det h\u00e4r meddelandet. info.selecttrait = V\u00e4lj klass och klicka p\u00e5 en egenskap i Actionskript k\u00e4llan f\u00f6r att redigera den. @@ -214,9 +209,7 @@ error.action.save = %error% p\u00e5 rad %line% message.confirm.remove = \u00c4r du s\u00e4ker p\u00e5 att du vill ta bort %item% \n och alla objekt som \u00e4r beroende av den? - - -#since version 1.6.6: +#after version 1.6.5u1: button.ok = Godk\u00e4nn button.cancel = Avbryt @@ -269,7 +262,6 @@ FileChooser.directoryDescriptionText = Katalog FileChooser.directoryOpenButtonText = \u00d6ppna FileChooser.directoryOpenButtonToolTipText = \u00d6ppna vald katalog FileChooser.fileDescriptionText = Generic File -FileChooser.fileNameLabelText = Filnamn: FileChooser.helpButtonText = Hj\u00e4lp FileChooser.helpButtonToolTipText = FileChooser help FileChooser.newFolderAccessibleName = Ny mapp @@ -287,6 +279,7 @@ FileChooser.updateButtonText = Uppdatera FileChooser.updateButtonToolTipText = Uppdatera kataloglistning #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = Detaljer FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detaljer FileChooser.fileAttrHeader.textAndMnemonic = Egenskaper @@ -328,6 +321,7 @@ button.ignore = Ignorera font.source = Typsnitts k\u00e4lla: #after version 1.6.7: + menu.export = Exportera menu.general = Allm\u00e4nt menu.language = Spr\u00e5k start. @@ -340,12 +334,14 @@ error.font.nocharacter = Vald teckensnitt-k\u00e4lla inneh\u00e5ller inte boksta warning.initializers = Statiska f\u00e4lt och consts initieras i initierare ofta.\nRedigera v\u00e4rdet h\u00e4r \u00e4r oftast inte tillr\u00e4ckligt! #after version 1.7.0u1: + menu.tools.searchmemory = S\u00f6k efter SWFs i minnet menu.file.reload = Ladda om message.confirm.reload = Denna \u00e5tg\u00e4rd avbryter alla \u00e4ndringar som inte sparats och laddar om SWF filen igen.\nVill du forts\u00e4tta? dialog.selectcolor.title = V\u00e4lj bakgrundsf\u00e4rg f\u00f6r SWF display button.selectcolor.hint = V\u00e4lj bakgrundsf\u00e4rg + ColorChooser.okText = Acceptera ColorChooser.cancelText = Avbryt ColorChooser.resetText = \u00c5terst\u00e4ll @@ -354,15 +350,18 @@ ColorChooser.swatchesNameText = F\u00e4rgrutor ColorChooser.swatchesRecentText = Nyligen: ColorChooser.sampleText=Exempel Text Exempel Text -#after version 1.7.1: +#after version 1.7.1: + preview.play = Spela preview.pause = Pausa preview.stop = Stoppa message.confirm.removemultiple = \u00c4r du s\u00e4ker p\u00e5 att du vill ta bort %count% objekt\noch alla andra objekt som \u00e4r beroende av objektet? + menu.tools.searchcache = S\u00f6k i webbl\u00e4sarens cache -#after version 1.7.2u2 +#after version 1.7.2u2 + error.trait.exists = Egenskap med namnet "%name%" finns redan. button.addtrait = L\u00e4gg till egenskap button.font.embed = Inb\u00e4dda... diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties index d3eaee78c..7de58c8d5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties @@ -22,7 +22,6 @@ menu.file.export.all = \u5bfc\u51fa\u6240\u6709 menu.file.export.selection = \u5bfc\u51fa\u6240\u9009 menu.file.exit = \u9000\u51fa - menu.tools = \u5de5\u5177 menu.tools.searchas = \u5728\u6240\u6709AS\u4ee3\u7801\u4e2d\u641c\u7d22... menu.tools.proxy = \u4ee3\u7406 @@ -187,7 +186,6 @@ abc.detail.methodinfo.returnvalue = \u8fd4\u56de\u503c\u7c7b\u578b: error.methodinfo.params = \u65b9\u6cd5\u4fe1\u606f\u7684\u53c2\u6570\u9519\u8bef error.methodinfo.returnvalue = \u65b9\u6cd5\u4fe1\u606f\u7684\u8fd4\u56de\u503c\u7c7b\u578b\u9519\u8bef - abc.detail.methodinfo = \u65b9\u6cd5\u4fe1\u606f abc.detail.body.code = \u65b9\u6cd5\u4e3b\u4f53\u4ee3\u7801 abc.detail.body.params = \u65b9\u6cd5\u4e3b\u4f53\u53c2\u6570 @@ -196,7 +194,6 @@ abc.detail.slotconst.typevalue = \u7c7b\u578b\u548c\u503c: error.slotconst.typevalue = SlotConst\u7c7b\u578b\u503c\u9519\u8bef - message.autofill.failed = \u65e0\u6cd5\u81ea\u52a8\u83b7\u5f97\u4e3b\u4f53\u53c2\u6570\u72b6\u6001\u4ee3\u7801\u3002\r\n\u8bf7\u5173\u95ed\u81ea\u52a8\u586b\u5145\u529f\u80fd\u540e\u518d\u8bd5\u4e00\u6b21. info.selecttrait = \u8bf7\u9009\u62e9\u7c7b\uff0c\u7136\u540e\u70b9\u51fb\u8fdb\u884cActionScript\u6e90\u7684\u7f16\u8f91. @@ -285,6 +282,7 @@ FileChooser.updateButtonText = \u5237\u65b0 FileChooser.updateButtonToolTipText = \u5237\u65b0\u76ee\u5f55\u5217\u8868 #after version 1.6.6u2: + FileChooser.detailsViewActionLabel.textAndMnemonic = \u8be6\u7ec6\u4fe1\u606f FileChooser.detailsViewButtonToolTip.textAndMnemonic = \u8be6\u7ec6\u4fe1\u606f FileChooser.fileAttrHeader.textAndMnemonic = \u5c5e\u6027 @@ -318,7 +316,6 @@ FileChooser.fileSizeMegaBytes = {0} MB FileChooser.fileSizeGigaBytes = {0} GB FileChooser.folderNameLabelText = \u76ee\u5f55\u540d: - error.occured = \u53d1\u751f\u9519\u8bef : %error% button.abort = \u7ec8\u6b62 button.retry = \u91cd\u8bd5 @@ -327,6 +324,7 @@ button.ignore = \u5ffd\u7565 font.source = \u6e90\u5b57\u4f53: #after version 1.6.7: + menu.export = \u5bfc\u51fa menu.general = \u901a\u7528 menu.language = \u8bed\u8a00 @@ -339,8 +337,8 @@ error.font.nocharacter = \u9009\u62e9\u7684\u6e90\u5b57\u4f53\u4e0d\u5305\u542b\ warning.initializers = \u9759\u6001\u5b57\u6bb5\u548c\u5e38\u91cf\u901a\u5e38\u5728\u521d\u59cb\u5316\u65f6\u88ab\u521d\u59cb\u5316\uff0c\n\u5728\u6b64\u7f16\u8f91\u901a\u5e38\u662f\u4e0d\u591f\u7684\uff01 #after version 1.7.0u1: -menu.tools.searchmemory = \u641c\u7d22\u5185\u5b58\u4e2d\u7684SWF +menu.tools.searchmemory = \u641c\u7d22\u5185\u5b58\u4e2d\u7684SWF menu.file.reload = \u91cd\u8f7d message.confirm.reload = \u8be5\u52a8\u4f5c\u5c06\u4f1a\u4e22\u5931\u6240\u6709\u672a\u4fdd\u5b58\u7684\u6539\u52a8\uff0c\u5e76\u91cd\u65b0\u52a0\u8f7d\u5f53\u524dSWF\u6587\u4ef6\u3002\n\u662f\u5426\u7ee7\u7eed\uff1f @@ -356,14 +354,17 @@ ColorChooser.swatchesRecentText = \u6700\u8fd1: ColorChooser.sampleText=\u793a\u4f8b\u6587\u5b57 Sample Text #after version 1.7.1: + preview.play = \u64ad\u653e preview.pause = \u6682\u505c preview.stop = \u505c\u6b62 + message.confirm.removemultiple = \u60a8\u786e\u5b9a\u8981\u79fb\u9664 %count% \u4e2a\u9879\u76ee\uff0c\n\u4ee5\u53ca\u5176\u6240\u6709\u7684\u4f9d\u8d56\u5bf9\u8c61\u5417\uff1f menu.tools.searchcache = \u641c\u7d22\u6d4f\u89c8\u5668\u7f13\u5b58 #after version 1.7.2u2 + error.trait.exists = Trait \u6240\u7528\u7684\u540d\u79f0 \u201c%name%\u201d\u5df2\u5b58\u5728\u3002 button.addtrait = \u6dfb\u52a0 Trait button.font.embed = \u5d4c\u5165...