diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 40ffbaa72..f359715b6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -522,7 +522,7 @@ public final class SWF implements SWFContainerItem, Timelined { if (characters.containsKey(characterId)) { logger.log(Level.SEVERE, "SWF already contains characterId={0}", characterId); } - + if (characterId != 0) { characters.put(characterId, (CharacterTag) t); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java index 5b8e064c5..8ecaf6a90 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java @@ -172,7 +172,7 @@ public class ActionScriptParser { } private GraphTargetItem memberOrCall(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem newcmds, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { - if(debugMode){ + if (debugMode) { System.out.println("memberOrCall:"); } ParsedSymbol s = lex(); @@ -213,8 +213,8 @@ public class ActionScriptParser { } lexer.pushback(s); - - if(debugMode){ + + if (debugMode) { System.out.println("/memberOrCall"); } return ret; @@ -248,7 +248,7 @@ public class ActionScriptParser { } private GraphTargetItem member(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { - if(debugMode){ + if (debugMode) { System.out.println("member:"); } GraphTargetItem ret = obj; @@ -307,13 +307,13 @@ public class ActionScriptParser { s = lex(); } } - if(s.type.getPrecedence() == GraphTargetItem.PRECEDENCE_ASSIGMENT){ + if (s.type.getPrecedence() == GraphTargetItem.PRECEDENCE_ASSIGMENT) { ret = expression1(ret, s.type.getPrecedence(), thisType, pkg, needsActivation, importedClasses, openedNamespaces, inMethod, registerVars, inFunction, inMethod, false, variables); - }else{ + } else { lexer.pushback(s); } - - if(debugMode){ + + if (debugMode) { System.out.println("/member"); } return ret; @@ -1390,7 +1390,7 @@ public class ActionScriptParser { if (firstCommand instanceof NameAVM2Item) { NameAVM2Item nai = (NameAVM2Item) firstCommand; if (nai.isDefinition() && nai.getAssignedValue() == null) { //??? WUT - firstCommand = expression1(firstCommand,firstCommand.getPrecedence(),thisType, pkg, needsActivation, importedClasses,openedNamespaces,true, registerVars, inFunction, inMethod, true, variables); + firstCommand = expression1(firstCommand, firstCommand.getPrecedence(), thisType, pkg, needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables); } } InAVM2Item inexpr = null; @@ -1682,9 +1682,9 @@ public class ActionScriptParser { /* fix > : a || b > c => a || (b > c) - + a < 0 || (b > c) + 1 - + */ if (expr instanceof BinaryOp) { BinaryOp bo = (BinaryOp) expr; @@ -1787,7 +1787,7 @@ public class ActionScriptParser { private GraphTargetItem expression(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, boolean allowEmpty, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, AVM2ParseException { GraphTargetItem prim = expressionPrimary(thisType, pkg, needsActivation, importedClasses, openedNamespaces, allowEmpty, registerVars, inFunction, inMethod, allowRemainder, variables); - if(prim==null){ + if (prim == null) { return null; } return expression1(prim, GraphTargetItem.NOPRECEDENCE, thisType, pkg, needsActivation, importedClasses, openedNamespaces, allowEmpty, registerVars, inFunction, inMethod, allowRemainder, variables); @@ -1801,7 +1801,7 @@ public class ActionScriptParser { */ private void xmlToGreaterFix(ParsedSymbol symb) { if (symb.isType(SymbolType.XML_STARTVARTAG_BEGIN, SymbolType.XML_STARTTAG_BEGIN)) { - lexer.yypushbackstr(symb.value.toString().substring(1)); //parse again as GREATER_THAN + lexer.yypushbackstr(symb.value.toString().substring(1)); //parse again as GREATER_THAN symb.type = SymbolType.GREATER_THAN; symb.group = SymbolGroup.OPERATOR; } @@ -2027,7 +2027,7 @@ public class ActionScriptParser { default: if (lhs instanceof ParenthesisItem) { GraphTargetItem coerced = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); - if (coerced!=null && isType(((ParenthesisItem) lhs).value)) { + if (coerced != null && isType(((ParenthesisItem) lhs).value)) { lhs = new CoerceAVM2Item(null, ((ParenthesisItem) lhs).value, coerced); } } @@ -2262,7 +2262,7 @@ public class ActionScriptParser { /*if (allowRemainder && existsRemainder) { GraphTargetItem rem = ret; do { - rem = expressionRemainder(thisType, pkg, needsActivation, openedNamespaces, rem, registerVars, inFunction, inMethod, assocRight, variables, importedClasses); + rem = expressionRemainder(thisType, pkg, needsActivation, openedNamespaces, rem, registerVars, inFunction, inMethod, assocRight, variables, importedClasses); if (rem != null) { ret = rem; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java index 84c2ab57d..2f37ccd59 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java @@ -334,7 +334,7 @@ public class NameAVM2Item extends AssignableAVM2Item { ); } else { return toSourceMerge(localData, generator, - (decrement? ins(isInteger ? new DecLocalIIns() : new DecLocalIns(), regNumber):ins(isInteger ? new IncLocalIIns() : new IncLocalIns(), regNumber))); + (decrement ? ins(isInteger ? new DecLocalIIns() : new DecLocalIns(), regNumber) : ins(isInteger ? new IncLocalIIns() : new IncLocalIns(), regNumber))); } } return toSourceMerge(localData, generator, diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java index 49c4c9813..6e7b0a173 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library 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 * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ @@ -25,116 +25,116 @@ import com.jpexs.decompiler.graph.GraphTargetItem; public enum SymbolType { //Keywords - BREAK , - CASE , - CONTINUE , - DEFAULT , - DO , - WHILE , - ELSE , - FOR , - EACH , - IN (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - IF , - RETURN , - SUPER (GraphTargetItem.PRECEDENCE_PRIMARY,false), - SWITCH , - THROW , - TRY , - CATCH , - FINALLY , - WITH , - DYNAMIC , - INTERNAL , - OVERRIDE , - PRIVATE , - PROTECTED , - PUBLIC , - STATIC , - CLASS , - CONST , - EXTENDS , - FUNCTION (GraphTargetItem.PRECEDENCE_PRIMARY,false), - GET , - IMPLEMENTS , - INTERFACE , - NAMESPACE , - PACKAGE , - SET , - VAR , - IMPORT , - USE , - FALSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - NULL (GraphTargetItem.PRECEDENCE_PRIMARY,false), - THIS (GraphTargetItem.PRECEDENCE_PRIMARY,false), - TRUE (GraphTargetItem.PRECEDENCE_PRIMARY,false), + BREAK, + CASE, + CONTINUE, + DEFAULT, + DO, + WHILE, + ELSE, + FOR, + EACH, + IN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + IF, + RETURN, + SUPER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + SWITCH, + THROW, + TRY, + CATCH, + FINALLY, + WITH, + DYNAMIC, + INTERNAL, + OVERRIDE, + PRIVATE, + PROTECTED, + PUBLIC, + STATIC, + CLASS, + CONST, + EXTENDS, + FUNCTION(GraphTargetItem.PRECEDENCE_PRIMARY, false), + GET, + IMPLEMENTS, + INTERFACE, + NAMESPACE, + PACKAGE, + SET, + VAR, + IMPORT, + USE, + FALSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NULL(GraphTargetItem.PRECEDENCE_PRIMARY, false), + THIS(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TRUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), //Operators - PARENT_OPEN (GraphTargetItem.PRECEDENCE_PRIMARY,false), - PARENT_CLOSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - CURLY_OPEN (GraphTargetItem.PRECEDENCE_PRIMARY,false), - CURLY_CLOSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - BRACKET_OPEN (GraphTargetItem.PRECEDENCE_PRIMARY,false), - BRACKET_CLOSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - SEMICOLON , - COMMA (GraphTargetItem.PRECEDENCE_COMMA,false), - REST , - DOT (GraphTargetItem.PRECEDENCE_PRIMARY,false), - ASSIGN (GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - GREATER_THAN (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - LOWER_THAN (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - NOT(GraphTargetItem.PRECEDENCE_UNARY,false), - NEGATE (GraphTargetItem.PRECEDENCE_UNARY,false), - TERNAR (GraphTargetItem.PRECEDENCE_CONDITIONAL,true,true), /*!! ternar !!!*/ - COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL,false),/*!! ternar !!!*/ - EQUALS (GraphTargetItem.PRECEDENCE_EQUALITY,true), - STRICT_EQUALS (GraphTargetItem.PRECEDENCE_EQUALITY,true), - LOWER_EQUAL (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - GREATER_EQUAL (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - NOT_EQUAL (GraphTargetItem.PRECEDENCE_EQUALITY,true), - STRICT_NOT_EQUAL (GraphTargetItem.PRECEDENCE_EQUALITY,true), - AND(GraphTargetItem.PRECEDENCE_LOGICALAND,true), - OR(GraphTargetItem.PRECEDENCE_LOGICALOR,true), - INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX,false),//OR Unary - DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX,false), //OR Unary - PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE,true), - MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE,true), //OR Unary - MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE,true), - DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE,true), - BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND,true), - BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR,true), - XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR,true), - MODULO(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - AS(GraphTargetItem.PRECEDENCE_RELATIONAL,true), - DELETE(GraphTargetItem.PRECEDENCE_UNARY,false), - INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL,true), - IS(GraphTargetItem.PRECEDENCE_RELATIONAL,true), - NAMESPACE_OP (GraphTargetItem.PRECEDENCE_PRIMARY,false), - NEW(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TYPEOF (GraphTargetItem.PRECEDENCE_UNARY,false), - VOID , + PARENT_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PARENT_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + CURLY_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + CURLY_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + BRACKET_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + BRACKET_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + SEMICOLON, + COMMA(GraphTargetItem.PRECEDENCE_COMMA, false), + REST, + DOT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + ASSIGN(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + GREATER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + LOWER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + NOT(GraphTargetItem.PRECEDENCE_UNARY, false), + NEGATE(GraphTargetItem.PRECEDENCE_UNARY, false), + TERNAR(GraphTargetItem.PRECEDENCE_CONDITIONAL, true, true), /*!! ternar !!!*/ + COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL, false),/*!! ternar !!!*/ + EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true), + STRICT_EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true), + LOWER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + GREATER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true), + STRICT_NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true), + AND(GraphTargetItem.PRECEDENCE_LOGICALAND, true), + OR(GraphTargetItem.PRECEDENCE_LOGICALOR, true), + INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false),//OR Unary + DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false), //OR Unary + PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), + MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), //OR Unary + MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND, true), + BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR, true), + XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR, true), + MODULO(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + AS(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + DELETE(GraphTargetItem.PRECEDENCE_UNARY, false), + INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + IS(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + NAMESPACE_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NEW(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TYPEOF(GraphTargetItem.PRECEDENCE_UNARY, false), + VOID, ATTRIBUTE, //Other - STRING(GraphTargetItem.PRECEDENCE_PRIMARY,false), + STRING(GraphTargetItem.PRECEDENCE_PRIMARY, false), COMMENT, //XML, - IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY,false), - INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY,false), - DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY,false), + IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), EOF, //TRACE, //GETURL, @@ -163,16 +163,16 @@ public enum SymbolType { //STARTDRAG, //SUBSTR, //LENGTH, //string.length - INT(GraphTargetItem.PRECEDENCE_PRIMARY,false), + INT(GraphTargetItem.PRECEDENCE_PRIMARY, false), //TARGETPATH, - NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY,false), + NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), //IFFRAMELOADED, - INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY,false), + INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY, false), //EVAL, - UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY,false), + UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY, false), //NEWLINE, - NAN(GraphTargetItem.PRECEDENCE_PRIMARY,false), + NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false), //GETVERSION, //CALL, //LOADMOVIENUM, @@ -184,31 +184,33 @@ public enum SymbolType { //UNLOADMOVIE, //UNLOADMOVIENUM, FINAL, - XML_STARTTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // - XML_FINISHVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // - XML_STARTFINISHTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY,false), // /> - XML_COMMENT(GraphTargetItem.PRECEDENCE_PRIMARY,false), // - XML_CDATA(GraphTargetItem.PRECEDENCE_PRIMARY,false), // - XML_INSTR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // - XML_VAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // { - XML_ATTRIBUTENAME(GraphTargetItem.PRECEDENCE_PRIMARY,false), // aaa= - XML_ATTRIBUTEVALUE(GraphTargetItem.PRECEDENCE_PRIMARY,false), // "vvv" - XML_TEXT(GraphTargetItem.PRECEDENCE_PRIMARY,false), - XML_ATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // {...}= - XML_ATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // aaa={ - XML_INSTRATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // {...}= - XML_INSTRATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // aaa={ - XML_INSTRVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY,false), // + XML_FINISHVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + XML_STARTFINISHTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // /> + XML_COMMENT(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + XML_CDATA(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + XML_INSTR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + XML_VAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // { + XML_ATTRIBUTENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa= + XML_ATTRIBUTEVALUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), // "vvv" + XML_TEXT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + XML_ATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}= + XML_ATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={ + XML_INSTRATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}= + XML_INSTRATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={ + XML_INSTRVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // fullyQualifiedNames, boolean parallel) throws InterruptedException { - for (int t = 0; t < traits.size(); t++) { + public GraphTextWriter toString(Class[] traitTypes, Trait parent, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException { + for (int t = 0; t < traits.size(); t++) { Trait trait = traits.get(t); - if(traitTypes!=null){ + if (traitTypes != null) { boolean found = false; - for(Class c:traitTypes){ - if(c.isInstance(trait)){ + for (Class c : traitTypes) { + if (c.isInstance(trait)) { found = true; break; } } - if(!found){ + if (!found) { continue; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/SymbolType.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/SymbolType.java index 127046a4b..300251c72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/SymbolType.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/SymbolType.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library 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 * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ @@ -34,10 +34,10 @@ public enum SymbolType { ELSE, FOR, EACH, - IN(GraphTargetItem.PRECEDENCE_RELATIONAL,true), + IN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), IF, RETURN, - SUPER (GraphTargetItem.PRECEDENCE_PRIMARY,false), + SUPER(GraphTargetItem.PRECEDENCE_PRIMARY, false), SWITCH, THROW, TRY, @@ -54,7 +54,7 @@ public enum SymbolType { CLASS, CONST, EXTENDS, - FUNCTION(GraphTargetItem.PRECEDENCE_PRIMARY,false), + FUNCTION(GraphTargetItem.PRECEDENCE_PRIMARY, false), GET, IMPLEMENTS, INTERFACE, @@ -64,131 +64,133 @@ public enum SymbolType { VAR, IMPORT, USE, - FALSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - NULL (GraphTargetItem.PRECEDENCE_PRIMARY,false), - THIS (GraphTargetItem.PRECEDENCE_PRIMARY,false), - TRUE (GraphTargetItem.PRECEDENCE_PRIMARY,false), + FALSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NULL(GraphTargetItem.PRECEDENCE_PRIMARY, false), + THIS(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TRUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), //Operators - PARENT_OPEN (GraphTargetItem.PRECEDENCE_PRIMARY,false), - PARENT_CLOSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - CURLY_OPEN (GraphTargetItem.PRECEDENCE_PRIMARY,false), - CURLY_CLOSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - BRACKET_OPEN (GraphTargetItem.PRECEDENCE_PRIMARY,false), - BRACKET_CLOSE (GraphTargetItem.PRECEDENCE_PRIMARY,false), - SEMICOLON , - COMMA (GraphTargetItem.PRECEDENCE_COMMA,false), - REST , - DOT (GraphTargetItem.PRECEDENCE_PRIMARY,false), - ASSIGN (GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - GREATER_THAN (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - LOWER_THAN (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - NOT(GraphTargetItem.PRECEDENCE_UNARY,false), - NEGATE (GraphTargetItem.PRECEDENCE_UNARY,false), - TERNAR (GraphTargetItem.PRECEDENCE_CONDITIONAL,true,true), /*!! ternar !!!*/ - COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL,false),/*!! ternar !!!*/ - EQUALS (GraphTargetItem.PRECEDENCE_EQUALITY,true), - STRICT_EQUALS (GraphTargetItem.PRECEDENCE_EQUALITY,true), - LOWER_EQUAL (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - GREATER_EQUAL (GraphTargetItem.PRECEDENCE_RELATIONAL,true), - NOT_EQUAL (GraphTargetItem.PRECEDENCE_EQUALITY,true), - STRICT_NOT_EQUAL (GraphTargetItem.PRECEDENCE_EQUALITY,true), - AND(GraphTargetItem.PRECEDENCE_LOGICALAND,true), - OR(GraphTargetItem.PRECEDENCE_LOGICALOR,true), - FULLAND(GraphTargetItem.PRECEDENCE_LOGICALAND,true), - FULLOR(GraphTargetItem.PRECEDENCE_LOGICALOR,true), - INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX,false),//OR Unary - DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX,false), //OR Unary - PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE,true), - MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE,true), //OR Unary - MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE,true), - DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE,true), - BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND,true), - BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR,true), - XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR,true), - MODULO(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT,true), - ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT,true,true), - AS(GraphTargetItem.PRECEDENCE_RELATIONAL,true), - DELETE(GraphTargetItem.PRECEDENCE_UNARY,false), - INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL,true), - IS(GraphTargetItem.PRECEDENCE_RELATIONAL,true), - NAMESPACE_OP (GraphTargetItem.PRECEDENCE_PRIMARY,false), - NEW(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TYPEOF (GraphTargetItem.PRECEDENCE_UNARY,false), - VOID , + PARENT_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PARENT_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + CURLY_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + CURLY_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + BRACKET_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + BRACKET_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + SEMICOLON, + COMMA(GraphTargetItem.PRECEDENCE_COMMA, false), + REST, + DOT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + ASSIGN(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + GREATER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + LOWER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + NOT(GraphTargetItem.PRECEDENCE_UNARY, false), + NEGATE(GraphTargetItem.PRECEDENCE_UNARY, false), + TERNAR(GraphTargetItem.PRECEDENCE_CONDITIONAL, true, true), /*!! ternar !!!*/ + COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL, false),/*!! ternar !!!*/ + EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true), + STRICT_EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true), + LOWER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + GREATER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true), + STRICT_NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true), + AND(GraphTargetItem.PRECEDENCE_LOGICALAND, true), + OR(GraphTargetItem.PRECEDENCE_LOGICALOR, true), + FULLAND(GraphTargetItem.PRECEDENCE_LOGICALAND, true), + FULLOR(GraphTargetItem.PRECEDENCE_LOGICALOR, true), + INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false),//OR Unary + DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false), //OR Unary + PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), + MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), //OR Unary + MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND, true), + BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR, true), + XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR, true), + MODULO(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + AS(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + DELETE(GraphTargetItem.PRECEDENCE_UNARY, false), + INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + IS(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + NAMESPACE_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NEW(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TYPEOF(GraphTargetItem.PRECEDENCE_UNARY, false), + VOID, ATTRIBUTE, //Other - STRING(GraphTargetItem.PRECEDENCE_PRIMARY,false), + STRING(GraphTargetItem.PRECEDENCE_PRIMARY, false), COMMENT, XML, - IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY,false), - INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY,false), - DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY,false), + IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), EOF, - TRACE(GraphTargetItem.PRECEDENCE_PRIMARY,false), - GETURL(GraphTargetItem.PRECEDENCE_PRIMARY,false), - GOTOANDSTOP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - NEXTFRAME(GraphTargetItem.PRECEDENCE_PRIMARY,false), - PLAY(GraphTargetItem.PRECEDENCE_PRIMARY,false), - PREVFRAME(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TELLTARGET(GraphTargetItem.PRECEDENCE_PRIMARY,false), - STOP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - STOPALLSOUNDS(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TOGGLEHIGHQUALITY(GraphTargetItem.PRECEDENCE_PRIMARY,false), - ORD(GraphTargetItem.PRECEDENCE_PRIMARY,false), - CHR(GraphTargetItem.PRECEDENCE_PRIMARY,false), - DUPLICATEMOVIECLIP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - STOPDRAG(GraphTargetItem.PRECEDENCE_PRIMARY,false), - GETTIMER(GraphTargetItem.PRECEDENCE_PRIMARY,false), - LOADVARIABLES(GraphTargetItem.PRECEDENCE_PRIMARY,false), - LOADMOVIE(GraphTargetItem.PRECEDENCE_PRIMARY,false), - GOTOANDPLAY(GraphTargetItem.PRECEDENCE_PRIMARY,false), - MBORD(GraphTargetItem.PRECEDENCE_PRIMARY,false), - MBCHR(GraphTargetItem.PRECEDENCE_PRIMARY,false), - MBLENGTH(GraphTargetItem.PRECEDENCE_PRIMARY,false), - MBSUBSTRING(GraphTargetItem.PRECEDENCE_PRIMARY,false), - RANDOM(GraphTargetItem.PRECEDENCE_PRIMARY,false), - REMOVEMOVIECLIP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - STARTDRAG(GraphTargetItem.PRECEDENCE_PRIMARY,false), - SUBSTR(GraphTargetItem.PRECEDENCE_PRIMARY,false), - LENGTH(GraphTargetItem.PRECEDENCE_PRIMARY,false), //string.length - INT(GraphTargetItem.PRECEDENCE_PRIMARY,false), - TARGETPATH(GraphTargetItem.PRECEDENCE_PRIMARY,false), - NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY,false), + TRACE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + GETURL(GraphTargetItem.PRECEDENCE_PRIMARY, false), + GOTOANDSTOP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NEXTFRAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PLAY(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PREVFRAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TELLTARGET(GraphTargetItem.PRECEDENCE_PRIMARY, false), + STOP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + STOPALLSOUNDS(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TOGGLEHIGHQUALITY(GraphTargetItem.PRECEDENCE_PRIMARY, false), + ORD(GraphTargetItem.PRECEDENCE_PRIMARY, false), + CHR(GraphTargetItem.PRECEDENCE_PRIMARY, false), + DUPLICATEMOVIECLIP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + STOPDRAG(GraphTargetItem.PRECEDENCE_PRIMARY, false), + GETTIMER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + LOADVARIABLES(GraphTargetItem.PRECEDENCE_PRIMARY, false), + LOADMOVIE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + GOTOANDPLAY(GraphTargetItem.PRECEDENCE_PRIMARY, false), + MBORD(GraphTargetItem.PRECEDENCE_PRIMARY, false), + MBCHR(GraphTargetItem.PRECEDENCE_PRIMARY, false), + MBLENGTH(GraphTargetItem.PRECEDENCE_PRIMARY, false), + MBSUBSTRING(GraphTargetItem.PRECEDENCE_PRIMARY, false), + RANDOM(GraphTargetItem.PRECEDENCE_PRIMARY, false), + REMOVEMOVIECLIP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + STARTDRAG(GraphTargetItem.PRECEDENCE_PRIMARY, false), + SUBSTR(GraphTargetItem.PRECEDENCE_PRIMARY, false), + LENGTH(GraphTargetItem.PRECEDENCE_PRIMARY, false), //string.length + INT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + TARGETPATH(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), IFFRAMELOADED, - INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY,false), - EVAL(GraphTargetItem.PRECEDENCE_PRIMARY,false), - UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY,false), - NEWLINE(GraphTargetItem.PRECEDENCE_PRIMARY,false), - NAN(GraphTargetItem.PRECEDENCE_PRIMARY,false), - GETVERSION(GraphTargetItem.PRECEDENCE_PRIMARY,false), - CALL(GraphTargetItem.PRECEDENCE_PRIMARY,false), - LOADMOVIENUM(GraphTargetItem.PRECEDENCE_PRIMARY,false), - LOADVARIABLESNUM(GraphTargetItem.PRECEDENCE_PRIMARY,false), - PRINT(GraphTargetItem.PRECEDENCE_PRIMARY,false), - PRINTNUM(GraphTargetItem.PRECEDENCE_PRIMARY,false), - PRINTASBITMAP(GraphTargetItem.PRECEDENCE_PRIMARY,false), - PRINTASBITMAPNUM(GraphTargetItem.PRECEDENCE_PRIMARY,false), - UNLOADMOVIE(GraphTargetItem.PRECEDENCE_PRIMARY,false), - UNLOADMOVIENUM(GraphTargetItem.PRECEDENCE_PRIMARY,false), - FSCOMMAND(GraphTargetItem.PRECEDENCE_PRIMARY,false); - + INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY, false), + EVAL(GraphTargetItem.PRECEDENCE_PRIMARY, false), + UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NEWLINE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + GETVERSION(GraphTargetItem.PRECEDENCE_PRIMARY, false), + CALL(GraphTargetItem.PRECEDENCE_PRIMARY, false), + LOADMOVIENUM(GraphTargetItem.PRECEDENCE_PRIMARY, false), + LOADVARIABLESNUM(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PRINT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PRINTNUM(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PRINTASBITMAP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + PRINTASBITMAPNUM(GraphTargetItem.PRECEDENCE_PRIMARY, false), + UNLOADMOVIE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + UNLOADMOVIENUM(GraphTargetItem.PRECEDENCE_PRIMARY, false), + FSCOMMAND(GraphTargetItem.PRECEDENCE_PRIMARY, false); + private int precedence = GraphTargetItem.NOPRECEDENCE; + private boolean binary = false; + private boolean rightAssociative = false; public boolean isBinary() { @@ -197,25 +199,24 @@ public enum SymbolType { public boolean isRightAssociative() { return rightAssociative; - } - + } + public int getPrecedence() { return precedence; } - - - private SymbolType(int precedence,boolean binary){ + + private SymbolType(int precedence, boolean binary) { this.precedence = precedence; this.binary = binary; } - - private SymbolType(int precedence,boolean binary, boolean rightAssociative){ + + private SymbolType(int precedence, boolean binary, boolean rightAssociative) { this.precedence = precedence; this.binary = binary; this.rightAssociative = rightAssociative; } - - private SymbolType(){ - + + private SymbolType() { + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java index 2cf7e2e0e..4046acdee 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java @@ -51,7 +51,7 @@ public class BinaryDataExporter { count++; } } - + if (count == 0) { return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java index 1ea7048de..172d6d71c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java @@ -148,7 +148,7 @@ public class FontExporter { String cop = t.getCopyright(); f.getEngine().setCopyrightYear(cop == null ? "" : cop); - if (Configuration.setFFDecVersionInExportedFont.get()){ + if (Configuration.setFFDecVersionInExportedFont.get()) { f.setAuthor(ApplicationInfo.shortApplicationVerName); } else { f.setAuthor(ApplicationInfo.SHORT_APPLICATION_NAME); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java index 86308e5c6..92fb669e9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java @@ -131,12 +131,12 @@ public class DefineBinaryDataTag extends CharacterTag { @Override public boolean isModified() { - if(super.isModified()){ + if (super.isModified()) { return true; } - if(innerSwf!=null){ + if (innerSwf != null) { return innerSwf.isModified(); } return false; - } + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index ef6bd199b..be58a24b2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -267,7 +267,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer { if (timeline != null) { return timeline; } - + timeline = new Timeline(swf, this, new ArrayList(), buttonId, getRect()); int maxDepth = 0; @@ -301,25 +301,25 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer { } } - + timeline.addFrame(frameUp); - + if (frameOver.layers.isEmpty()) { frameOver = frameUp; } - + timeline.addFrame(frameOver); - + if (frameDown.layers.isEmpty()) { frameDown = frameOver; } - + timeline.addFrame(frameDown); - + if (frameHit.layers.isEmpty()) { frameHit = frameUp; } - + timeline.addFrame(frameHit); return timeline; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java index 50d3811c3..1cdcfee46 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java @@ -88,7 +88,7 @@ public class DefineButtonCxformTag extends Tag implements CharacterIdTag { buttonId = sis.readUI16("buttonId"); buttonColorTransform = sis.readCXFORM("buttonColorTransform"); } - + @Override public int getCharacterId() { return buttonId; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index 6157eb9b9..f2d9cfdc0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -98,7 +98,7 @@ public class DefineFontAlignZonesTag extends Tag implements CharacterIdTag { } return baos.toByteArray(); } - + @Override public int getCharacterId() { return fontID; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java index e7bc53774..be58aab80 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java @@ -146,7 +146,7 @@ public class DefineFontInfo2Tag extends Tag implements CharacterIdTag { codeTable.add(sis.readUI16("code")); } } - + @Override public int getCharacterId() { return fontID; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java index 2dd08c224..d5366b8d9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java @@ -147,7 +147,7 @@ public class DefineFontInfoTag extends Tag implements CharacterIdTag { } } } - + @Override public int getCharacterId() { return fontId; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java index 7c9dadf7a..8f637ae88 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java @@ -80,7 +80,7 @@ public class DefineFontNameTag extends Tag implements CharacterIdTag { } return baos.toByteArray(); } - + @Override public int getCharacterId() { return fontId; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java index 6c22cf3fb..c8dae0967 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java @@ -79,7 +79,7 @@ public class DefineScalingGridTag extends Tag implements CharacterIdTag { } return baos.toByteArray(); } - + @Override public int getCharacterId() { return characterId; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java index 87a9c0805..1c84fce43 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java @@ -140,7 +140,7 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { } return 0; } - + @Override public void setModified(boolean value) { super.setModified(value); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java index f07237991..32b1d9649 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java @@ -123,5 +123,4 @@ public class DoABCTag extends Tag implements ABCContainerTag { } } } - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 5f9ecc675..916d3dfc7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; -import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.HideInRawEdit; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -40,7 +39,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -public class DoInitActionTag extends Tag implements CharacterIdTag,ASMSource { +public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource { /** * Identifier of Sprite diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java index 9d76d4564..cac6e2af8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java @@ -80,14 +80,14 @@ public abstract class PlaceObjectTypeTag extends Tag implements CharacterIdTag { if (exportName != null) { nameAppend = ": " + exportName; } - + if (getCharacterId() != -1) { result += " (" + getCharacterId() + nameAppend + ")"; } if (!nameAppend.isEmpty()) { result += " (" + nameAppend + ")"; } - + return result + " Depth: " + getDepth(); } @@ -98,7 +98,7 @@ public abstract class PlaceObjectTypeTag extends Tag implements CharacterIdTag { if (exportName != null) { result += "_" + exportName; } - + result += "_" + getDepth(); return result; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java index bd7263926..6663d092f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library 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 * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ @@ -40,7 +40,7 @@ public abstract class RemoveTag extends Tag { if (exportName != null) { nameAppend = ": " + exportName; } - + if (getCharacterId() != -1) { result += " (" + getCharacterId() + nameAppend + ")"; } @@ -48,7 +48,7 @@ public abstract class RemoveTag extends Tag { if (!nameAppend.isEmpty()) { result += " (" + nameAppend + ")"; } - + return result + " Depth: " + getDepth(); } @@ -63,7 +63,7 @@ public abstract class RemoveTag extends Tag { if (exportName != null) { result += "_" + exportName; } - + result += "_" + getDepth(); return result; } @@ -72,7 +72,7 @@ public abstract class RemoveTag extends Tag { if (this instanceof CharacterIdTag) { return ((CharacterIdTag) this).getCharacterId(); } - + return -1; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java index 408bd7409..8a6827dd1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java @@ -116,18 +116,16 @@ public class AS2Package implements TreeItem { @Override public boolean isModified() { - for(ASMSource s:scripts.values()){ - if(s.isModified()){ + for (ASMSource s : scripts.values()) { + if (s.isModified()) { return true; } } - for(AS2Package p:subPackages.values()){ - if(p.isModified()){ + for (AS2Package p : subPackages.values()) { + if (p.isModified()) { return true; } } return false; } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java index 274be4918..5754ab595 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java @@ -150,20 +150,18 @@ public class AS3Package extends AS3ClassTreeItem { @Override public boolean isModified() { - List sps=getScriptPacks(); - for(ScriptPack sp:sps){ - if(sp.isModified()){ + List sps = getScriptPacks(); + for (ScriptPack sp : sps) { + if (sp.isModified()) { return true; } } - List ps=getSubPackages(); - for(AS3Package p:ps){ - if(p.isModified()){ + List ps = getSubPackages(); + for (AS3Package p : ps) { + if (p.isModified()) { return true; } } return false; } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java index 02f59f66f..36566c1b0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java @@ -90,26 +90,24 @@ public class Frame implements TreeItem, Exportable { @Override public boolean isModified() { - for(Tag t:innerTags){ - if(t.isModified()){ + for (Tag t : innerTags) { + if (t.isModified()) { return true; } } - for(Tag t:actions){ - if(t.isModified()){ + for (Tag t : actions) { + if (t.isModified()) { return true; } } - for(ASMSourceContainer t:actionContainers){ - if(t.isModified()){ + for (ASMSourceContainer t : actionContainers) { + if (t.isModified()) { return true; } } - if(showFrameTag!=null && showFrameTag.isModified()){ + if (showFrameTag != null && showFrameTag.isModified()) { return true; } return false; } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java index 2786ea475..037ee344b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java @@ -58,6 +58,4 @@ public class FrameScript implements TreeItem, Exportable { public boolean isModified() { return frame.isModified(); } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java index 6b58ad636..3382bbdf5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java @@ -79,13 +79,11 @@ public class TagScript implements TreeItem, Exportable { @Override public boolean isModified() { - for(TreeItem f:frames){ - if(f.isModified()){ + for (TreeItem f : frames) { + if (f.isModified()) { return true; } } return tag.isModified(); } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/FolderItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/FolderItem.java index 2bf9f7c56..a90390248 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/FolderItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/FolderItem.java @@ -56,12 +56,11 @@ public class FolderItem implements TreeItem { @Override public boolean isModified() { - for(TreeItem ti:subItems){ - if(ti.isModified()){ + for (TreeItem ti : subItems) { + if (ti.isModified()) { return true; } } return false; } - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java index 71fbdad3f..323c57dbf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java @@ -47,6 +47,4 @@ public class HeaderItem implements TreeItem { public boolean isModified() { return false; //?? } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/SWFList.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/SWFList.java index 7aa4ae364..b77cc387a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/SWFList.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/SWFList.java @@ -175,13 +175,11 @@ public class SWFList implements List, SWFContainerItem { @Override public boolean isModified() { - for(SWF s:swfs){ - if(s.isModified()){ + for (SWF s : swfs) { + if (s.isModified()) { return true; } } return false; } - - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java index 749aa67d0..e41967e26 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/TreeItem.java @@ -25,6 +25,6 @@ import com.jpexs.decompiler.flash.SWF; public interface TreeItem { public SWF getSwf(); - + public boolean isModified(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java index 5f2710425..f3c872ead 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java @@ -145,7 +145,7 @@ public class BUTTONCONDACTION implements ASMSource, Serializable { */ @Internal public ByteArrayRange actionBytes; - + /** * Sets actions associated with this object * @@ -246,8 +246,6 @@ public class BUTTONCONDACTION implements ASMSource, Serializable { } return false; } - - @Override public GraphTextWriter getActionBytesAsHex(GraphTextWriter writer) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index 3dfa2232f..fb333c17c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -43,7 +43,7 @@ import java.util.logging.Logger; * @author JPEXS */ public class CLIPACTIONRECORD implements ASMSource, Serializable { - + public static String keyToString(int key) { if ((key < CLIPACTIONRECORD.KEYNAMES.length) && (key > 0) && (CLIPACTIONRECORD.KEYNAMES[key] != null)) { return CLIPACTIONRECORD.KEYNAMES[key]; @@ -229,19 +229,17 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable { public void setModified() { if (tag != null) { tag.setModified(true); - } + } } @Override public boolean isModified() { if (tag != null) { return tag.isModified(); - } + } return false; } - - @Override public GraphTextWriter getActionBytesAsHex(GraphTextWriter writer) { return Helper.byteArrayToHexWithHeader(writer, actionBytes.getRangeData()); diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index e346a78ac..0fee44ed2 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -1062,12 +1062,12 @@ public class CommandLineArgumentParser { if (singleScriptFile == null) { singleScriptFile = Configuration.scriptExportSingleFile.get(); } - + if (parallel && singleScriptFile) { System.out.println("Single file script export is not supported with enabled parallel speedup"); singleScriptFile = false; } - + ScriptExportSettings scriptExportSettings = new ScriptExportSettings(enumFromStr(formats.get("script"), ScriptExportMode.class), singleScriptFile); if (exportAll || exportFormats.contains("script")) { System.out.println("Exporting scripts..."); diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 0b55476fb..14650e55c 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -124,7 +124,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private static final String GENERIC_TAG_CARD = "GENERICTAG"; private static final String BINARY_TAG_CARD = "BINARYTAG"; - + private static final String METADATA_TAG_CARD = "METADATATAG"; private static final String CARDTEXTPANEL = "Text card"; @@ -140,7 +140,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private static final String ACTION_PREV_FONTS = "PREVFONTS"; private static final String ACTION_NEXT_FONTS = "NEXTFONTS"; - + private static final String ACTION_EDIT_METADATA_TAG = "EDITMETADATATAG"; private static final String ACTION_SAVE_METADATA_TAG = "SAVEMETADATATAG"; @@ -162,7 +162,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private MediaDisplay media; private BinaryPanel binaryPanel; - + private LineMarkedEditorPane metadataEditor; private GenericTagPanel genericTagPanel; @@ -185,7 +185,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private JButton metadataSaveButton; private JButton metadataCancelButton; - + // Generic tag buttons private JButton genericEditButton; @@ -202,7 +202,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private TextPanel textPanel; private boolean splitsInited; - + private MetadataTag metadataTag; public PreviewPanel(MainPanel mainPanel, FlashPlayerPanel flashPanel) { @@ -240,7 +240,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { viewerCards.add(createFlashPlayerPanel(flashPanel), FLASH_VIEWER_CARD); viewerCards.add(createImagesCard(), DRAW_PREVIEW_CARD); viewerCards.add(createBinaryCard(), BINARY_TAG_CARD); - viewerCards.add(createMetadataCard(),METADATA_TAG_CARD); + viewerCards.add(createMetadataCard(), METADATA_TAG_CARD); viewerCards.add(createGenericTagCard(), GENERIC_TAG_CARD); setLeftComponent(viewerCards); @@ -327,7 +327,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { genericTagButtonsPanel.add(genericCancelButton); return genericTagButtonsPanel; } - + private JPanel createMetadataButtonsPanel() { metadataEditButton = new JButton(mainPanel.translate("button.edit"), View.getIcon("edit16")); metadataEditButton.setMargin(new Insets(3, 3, 3, 10)); @@ -410,14 +410,14 @@ public class PreviewPanel extends JSplitPane implements ActionListener { return shapesCard; } - private JPanel createMetadataCard() { - DefaultSyntaxKit.initKit(); + private JPanel createMetadataCard() { + DefaultSyntaxKit.initKit(); JPanel metadataCard = new JPanel(new BorderLayout()); - metadataEditor = new LineMarkedEditorPane(); - metadataCard.add(new JScrollPane(metadataEditor),BorderLayout.CENTER); - //metadataEditor.setContentType("text/xml"); + metadataEditor = new LineMarkedEditorPane(); + metadataCard.add(new JScrollPane(metadataEditor), BorderLayout.CENTER); + //metadataEditor.setContentType("text/xml"); metadataEditor.setEditable(false); - + metadataEditor.setFont(new Font("Monospaced", Font.PLAIN, metadataEditor.getFont().getSize())); metadataEditor.setContentType("text/xml"); metadataEditor.getDocument().addDocumentListener(new DocumentListener() { @@ -437,19 +437,19 @@ public class PreviewPanel extends JSplitPane implements ActionListener { metadataTextChanged(); } }); - + metadataCard.add(createMetadataButtonsPanel(), BorderLayout.SOUTH); return metadataCard; } - + private boolean metadataModified = false; - + private void metadataTextChanged() { metadataModified = true; updateMetadataButtonsVisibility(); } - - private void updateMetadataButtonsVisibility(){ + + private void updateMetadataButtonsVisibility() { boolean edit = metadataEditor.isEditable(); boolean editorMode = Configuration.editorMode.get(); metadataEditButton.setVisible(!edit); @@ -458,7 +458,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { metadataCancelButton.setVisible(edit); metadataCancelButton.setEnabled(metadataModified || !editorMode); } - + private JPanel createBinaryCard() { JPanel binaryCard = new JPanel(new BorderLayout()); binaryPanel = new BinaryPanel(mainPanel); @@ -585,8 +585,6 @@ public class PreviewPanel extends JSplitPane implements ActionListener { textPanel.closeTag(); } - - public static String formatMetadata(String input, int indent) { input = input.replace("> <", "><"); try { @@ -600,25 +598,25 @@ public class PreviewPanel extends JSplitPane implements ActionListener { Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", ""+indent); - transformer.transform(xmlInput, xmlOutput); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "" + indent); + transformer.transform(xmlInput, xmlOutput); return xmlOutput.getWriter().toString(); } catch (IllegalArgumentException | TransformerException e) { return input; } } - - public void showMetaDataPanel(MetadataTag metadataTag){ - showCardLeft(METADATA_TAG_CARD); + + public void showMetaDataPanel(MetadataTag metadataTag) { + showCardLeft(METADATA_TAG_CARD); this.metadataTag = metadataTag; metadataEditor.setEditable(Configuration.editorMode.get()); - metadataEditor.setText(formatMetadata(metadataTag.xmlMetadata,4)); + metadataEditor.setText(formatMetadata(metadataTag.xmlMetadata, 4)); metadataModified = false; updateMetadataButtonsVisibility(); - parametersPanel.setVisible(false); + parametersPanel.setVisible(false); } - + public void showBinaryPanel(DefineBinaryDataTag binaryDataTag) { showCardLeft(BINARY_TAG_CARD); binaryPanel.setBinaryData(binaryDataTag); @@ -1146,12 +1144,12 @@ public class PreviewPanel extends JSplitPane implements ActionListener { } if (item instanceof MetadataTag) { - metadataEditor.setEditable(true); + metadataEditor.setEditable(true); updateMetadataButtonsVisibility(); } } break; - case ACTION_SAVE_METADATA_TAG: { + case ACTION_SAVE_METADATA_TAG: { metadataTag.xmlMetadata = metadataEditor.getText().replaceAll(">\r?\n<", "> <"); metadataTag.setModified(true); metadataEditor.setEditable(Configuration.editorMode.get()); @@ -1160,16 +1158,16 @@ public class PreviewPanel extends JSplitPane implements ActionListener { mainPanel.repaintTree(); } break; - + case ACTION_CANCEL_METADATA_TAG: { - metadataEditor.setEditable(false); - metadataEditor.setText(formatMetadata(metadataTag.xmlMetadata,4)); + metadataEditor.setEditable(false); + metadataEditor.setText(formatMetadata(metadataTag.xmlMetadata, 4)); metadataEditor.setEditable(Configuration.editorMode.get()); - metadataModified = false; + metadataModified = false; updateMetadataButtonsVisibility(); } - break; - + break; + case ACTION_EDIT_GENERIC_TAG: { TreeItem item = mainPanel.tagTree.getCurrentTreeItem(); if (item == null) { @@ -1184,8 +1182,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { } } break; - - + case ACTION_SAVE_GENERIC_TAG: { genericTagPanel.save(); Tag tag = genericTagPanel.getTag(); diff --git a/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/src/com/jpexs/decompiler/flash/gui/TextPanel.java index 4c6d6b089..86112dc4b 100644 --- a/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -44,6 +44,7 @@ import javax.swing.JScrollPane; import javax.swing.SwingConstants; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.text.BadLocationException; import jsyntaxpane.DefaultSyntaxKit; /** @@ -80,6 +81,8 @@ public class TextPanel extends JPanel { private final JButton increaseTranslateXButton; + private final JButton changeCaseButton; + private final JButton undoChangesButton; private TextTag textTag; @@ -129,6 +132,7 @@ public class TextPanel extends JPanel { textAlignJustifyButton = createButton(null, "textalignjustify16", "text.align.justify", e -> textAlign(TextAlign.JUSTIFY)); decreaseTranslateXButton = createButton(null, "textunindent16", "text.align.translatex.decrease", e -> translateX(-(int) SWF.unitDivisor, ((JRepeatButton) e.getSource()).getRepeatCount()), true); increaseTranslateXButton = createButton(null, "textindent16", "text.align.translatex.increase", e -> translateX((int) SWF.unitDivisor, ((JRepeatButton) e.getSource()).getRepeatCount()), true); + changeCaseButton = createButton(null, "textuppercase16", "text.toggleCase", e -> changeCase(0)); undoChangesButton = createButton(null, "reload16", "text.undo", e -> undoChanges()); textButtonsPanel.add(selectPrevousTagButton); @@ -139,6 +143,7 @@ public class TextPanel extends JPanel { textButtonsPanel.add(textAlignJustifyButton); textButtonsPanel.add(decreaseTranslateXButton); textButtonsPanel.add(increaseTranslateXButton); + textButtonsPanel.add(changeCaseButton); textButtonsPanel.add(undoChangesButton); textButtonsPanel.setAlignmentX(0); @@ -197,11 +202,82 @@ public class TextPanel extends JPanel { } } + private void changeCase(int caseMode) { + // todo: use case mode: first letter, capitalize each word, toggle, etc + int selStart = textValue.getSelectionStart(); + int selEnd = textValue.getSelectionEnd(); + if (selEnd > selStart) { + StringBuilder selected = new StringBuilder(textValue.getSelectedText()); + + HighlightedText text = textTag.getFormattedText(); + boolean allUpper = true; + for (Highlighting highlight : text.specialHilights) { + if (highlight.getProperties().subtype == HighlightSpecialType.TEXT) { + int hStart = highlight.startPos; + int hEnd = highlight.startPos + highlight.len; + int start = Math.max(selStart, hStart); + int end = Math.min(selEnd, hEnd); + + if (start < end) { + try { + String str = textValue.getDocument().getText(start, end - start); + if (!str.equals(str.toUpperCase())) { + allUpper = false; + break; + } + } catch (BadLocationException ex) { + Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + } + + for (Highlighting highlight : text.specialHilights) { + if (highlight.getProperties().subtype == HighlightSpecialType.TEXT) { + int hStart = highlight.startPos; + int hEnd = highlight.startPos + highlight.len; + int start = Math.max(selStart, hStart); + int end = Math.min(selEnd, hEnd); + + if (start < end) { + try { + String str = textValue.getDocument().getText(start, end - start); + if (allUpper) { + str = str.toLowerCase(); + } else { + str = str.toUpperCase(); + } + + selected.replace(start - selStart, end - selStart, str); + } catch (BadLocationException ex) { + Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + } + + textValue.replaceSelection(selected.toString()); + saveText(true); + + updateButtonsVisibility(); + textTag.getSwf().clearImageCache(); + mainPanel.repaintTree(); + + textValue.requestFocusInWindow(); + textValue.select(selStart, selEnd); + } + } + public void closeTag() { if (modified && Configuration.autoSaveTagModifications.get()) { - saveText(false); + try { + saveText(false); + } catch (Exception ex) { + Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, "Cannot auto-save text tag.", ex); + } } + modified = false; textTag = null; } @@ -218,6 +294,7 @@ public class TextPanel extends JPanel { textSaveButton.setEnabled(modified); textCancelButton.setVisible(edit); textCancelButton.setEnabled(modified || !editorMode); + changeCaseButton.setEnabled(!modified); boolean alignable = false; if (textTag != null && !(textTag instanceof DefineEditTextTag)) { diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java index 7e2e51a1c..304c18e93 100644 --- a/src/com/jpexs/decompiler/flash/gui/View.java +++ b/src/com/jpexs/decompiler/flash/gui/View.java @@ -644,5 +644,5 @@ public class View { }); return table; - } + } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 8d3965c7b..7e627f909 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -163,7 +163,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se public JButton cancelDecompiledButton = new JButton(AppStrings.translate("button.cancel"), View.getIcon("cancel16")); private static final String ACTION_ADD_TRAIT = "ADDTRAIT"; - + private static List modifiedPacks = new ArrayList<>(); public MainPanel getMainPanel() { @@ -812,7 +812,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se } String as = decompiledTextArea.getText(); - abc.replaceScriptPack(pack, as); + abc.replaceScriptPack(pack, as); lastDecompiled = as; mainPanel.updateClassesList(); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index 8811ed90e..ebbdab26d 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -50,14 +50,13 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi public ABC abc; public int bodyIndex = -1; + private int scriptIndex = -1; public int getScriptIndex() { return scriptIndex; } - - private List disassembledHilights = new ArrayList<>(); private List specialHilights = new ArrayList<>(); @@ -233,7 +232,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } }, abc.bodies.get(bodyIndex), abc.method_info.get(abc.bodies.get(bodyIndex).method_info)); //acode.getBytes(abc.bodies.get(bodyIndex).getCodeBytes()); - abc.bodies.get(bodyIndex).setCode(acode); + abc.bodies.get(bodyIndex).setCode(acode); } ((Tag) abc.parentTag).setModified(true); abc.script_info.get(scriptIndex).setModified(true); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java b/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java index 41e70fcb6..90e0084b6 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -191,6 +191,4 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel public boolean isModified() { return root.isModified(); } - - } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 4c4f868f7..9790969f5 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -450,7 +450,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL if (ch != null) { Highlighting th = Highlighting.searchPos(traitHighlights, pos); if (th != null) { - currentTrait = abc.findTraitByTraitId((int) ch.getProperties().index, (int) th.getProperties().index); + currentTrait = abc.findTraitByTraitId((int) ch.getProperties().index, (int) th.getProperties().index); } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java b/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java index bb418dc1a..d9d6ddfff 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java @@ -58,10 +58,10 @@ public class MethodCodePanel extends JPanel implements ActionListener { sourceTextArea.requestFocusInWindow(); } - public int getScriptIndex(){ + public int getScriptIndex() { return sourceTextArea.getScriptIndex(); } - + public String getTraitName() { return sourceTextArea.getName(); } @@ -79,14 +79,12 @@ public class MethodCodePanel extends JPanel implements ActionListener { } public void setBodyIndex(int bodyIndex, ABC abc, Trait trait, int scriptIndex) { - sourceTextArea.setBodyIndex(bodyIndex, abc, sourceTextArea.getName(), trait,scriptIndex); + sourceTextArea.setBodyIndex(bodyIndex, abc, sourceTextArea.getName(), trait, scriptIndex); } - public void setBodyIndex(int bodyIndex, ABC abc, String name, Trait trait,int scriptIndex) { - sourceTextArea.setBodyIndex(bodyIndex, abc, name, trait,scriptIndex); + public void setBodyIndex(int bodyIndex, ABC abc, String name, Trait trait, int scriptIndex) { + sourceTextArea.setBodyIndex(bodyIndex, abc, name, trait, scriptIndex); } - - public int getBodyIndex() { return sourceTextArea.bodyIndex; diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/textuppercase16.png b/src/com/jpexs/decompiler/flash/gui/graphics/textuppercase16.png new file mode 100644 index 000000000..dbe892db4 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/textuppercase16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 93684941a..0f4cb1c26 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -576,3 +576,4 @@ selectPreviousTag = Select previous tag selectNextTag = Select next tag button.ignoreAll = Ignore All menu.file.import.symbolClass = Import Symbol-Class +text.toggleCase = Toggle case diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 80e6ce53e..020325957 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -574,4 +574,5 @@ text.align.translatex.increase = TranslateX n\u00f6vel\u00e9se selectPreviousTag = El\u0151z\u0151 tag kiv\u00e1laszt\u00e1sa selectNextTag = K\u00f6vetkez\u0151 tag kiv\u00e1laszt\u00e1sa button.ignoreAll = Mell\u0151z mindet -menu.file.import.symbolClass = Szimb\u00f3lum oszt\u00e1ly +menu.file.import.symbolClass = Szimb\u00f3lum oszt\u00e1ly import\u00e1l\u00e1s +text.toggleCase = Kis- nagybet\u0171 v\u00e1ltoztat\u00e1s diff --git a/src/com/jpexs/decompiler/flash/gui/pipes/FirstInstance.java b/src/com/jpexs/decompiler/flash/gui/pipes/FirstInstance.java index 5f6cb6d26..77436c646 100644 --- a/src/com/jpexs/decompiler/flash/gui/pipes/FirstInstance.java +++ b/src/com/jpexs/decompiler/flash/gui/pipes/FirstInstance.java @@ -35,11 +35,15 @@ import java.util.List; public class FirstInstance { private static final String MUTEX_NAME = "FFDEC_MUTEX"; + private static WinNT.HANDLE mutex; public static final int PIPE_MAJOR = 1; + public static final int PIPE_MINOR = 0; + public static final String PIPE_NAME = "ffdec"; + public static final String PIPE_APP_CODE = "ffdec"; private static boolean isRunning() { diff --git a/src/com/jpexs/decompiler/flash/gui/pipes/PipeInputStream.java b/src/com/jpexs/decompiler/flash/gui/pipes/PipeInputStream.java index e42fa06e9..98a35c417 100644 --- a/src/com/jpexs/decompiler/flash/gui/pipes/PipeInputStream.java +++ b/src/com/jpexs/decompiler/flash/gui/pipes/PipeInputStream.java @@ -30,24 +30,25 @@ import java.io.InputStream; public class PipeInputStream extends InputStream { protected HANDLE pipe; + private boolean closed = false; - public PipeInputStream(String pipeName,boolean newpipe) throws IOException { + public PipeInputStream(String pipeName, boolean newpipe) throws IOException { if (!Platform.isWindows()) { throw new IOException("Cannot create Pipe on nonWindows OS"); } String fullPipePath = "\\\\.\\pipe\\" + pipeName; - if(newpipe){ - pipe = Kernel32.INSTANCE.CreateNamedPipe(fullPipePath, Kernel32.PIPE_ACCESS_INBOUND, Kernel32.PIPE_TYPE_BYTE, 1, 4096, 4096, 0, null); + if (newpipe) { + pipe = Kernel32.INSTANCE.CreateNamedPipe(fullPipePath, Kernel32.PIPE_ACCESS_INBOUND, Kernel32.PIPE_TYPE_BYTE, 1, 4096, 4096, 0, null); if (pipe == null || !Kernel32.INSTANCE.ConnectNamedPipe(pipe, null)) { throw new IOException("Cannot connect to the pipe"); - } - }else{ - pipe = Kernel32.INSTANCE.CreateFile(fullPipePath, Kernel32.GENERIC_READ,Kernel32.FILE_SHARE_READ,null,Kernel32.OPEN_EXISTING,Kernel32.FILE_ATTRIBUTE_NORMAL,null); + } + } else { + pipe = Kernel32.INSTANCE.CreateFile(fullPipePath, Kernel32.GENERIC_READ, Kernel32.FILE_SHARE_READ, null, Kernel32.OPEN_EXISTING, Kernel32.FILE_ATTRIBUTE_NORMAL, null); } if (pipe == null) { throw new IOException("Cannot connect to the pipe"); - } + } Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { @@ -58,7 +59,7 @@ public class PipeInputStream extends InputStream { } } - }); + }); } @Override diff --git a/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java b/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java index 47be3cf83..8e4405074 100644 --- a/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java +++ b/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java @@ -30,24 +30,25 @@ import java.io.OutputStream; public class PipeOutputStream extends OutputStream { protected HANDLE pipe; + private boolean closed = false; - public PipeOutputStream(String pipeName,boolean newPipe) throws IOException { + public PipeOutputStream(String pipeName, boolean newPipe) throws IOException { if (!Platform.isWindows()) { throw new IOException("Cannot create Pipe on nonWindows OS"); } String fullPipePath = "\\\\.\\pipe\\" + pipeName; - if(newPipe){ + if (newPipe) { pipe = Kernel32.INSTANCE.CreateNamedPipe(fullPipePath, Kernel32.PIPE_ACCESS_OUTBOUND, Kernel32.PIPE_TYPE_BYTE, 1, 4096, 4096, 0, null); if (pipe == null || !Kernel32.INSTANCE.ConnectNamedPipe(pipe, null)) { throw new IOException("Cannot connect to the pipe. Error " + Kernel32.INSTANCE.GetLastError()); } - }else{ - pipe = Kernel32.INSTANCE.CreateFile(fullPipePath, Kernel32.GENERIC_WRITE,Kernel32.FILE_SHARE_WRITE,null,Kernel32.OPEN_EXISTING,Kernel32.FILE_ATTRIBUTE_NORMAL,null); + } else { + pipe = Kernel32.INSTANCE.CreateFile(fullPipePath, Kernel32.GENERIC_WRITE, Kernel32.FILE_SHARE_WRITE, null, Kernel32.OPEN_EXISTING, Kernel32.FILE_ATTRIBUTE_NORMAL, null); if (pipe == null) { throw new IOException("Cannot connect to the pipe. Error " + Kernel32.INSTANCE.GetLastError()); } - } + } Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index 76406e400..5a02f6822 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -193,13 +193,13 @@ public class TagTree extends JTree { setIcon(icons.get(type)); } - /* boolean isModified = val instanceof Tag && ((Tag) val).isModified(); - if(val instanceof ScriptPack){ - ScriptPack sp=(ScriptPack)val; - if(sp.abc.script_info.get(sp.scriptIndex).isModified()){ - isModified = true; - } - }*/ + /* boolean isModified = val instanceof Tag && ((Tag) val).isModified(); + if(val instanceof ScriptPack){ + ScriptPack sp=(ScriptPack)val; + if(sp.abc.script_info.get(sp.scriptIndex).isModified()){ + isModified = true; + } + }*/ boolean isModified = val.isModified(); if (isModified) { if (boldFont == null) { @@ -338,19 +338,19 @@ public class TagTree extends JTree { } } - if(t instanceof SetBackgroundColorTag){ + if (t instanceof SetBackgroundColorTag) { return TreeNodeType.SET_BACKGROUNDCOLOR; } - if(t instanceof FileAttributesTag){ + if (t instanceof FileAttributesTag) { return TreeNodeType.FILE_ATTRIBUTES; } - if(t instanceof MetadataTag){ + if (t instanceof MetadataTag) { return TreeNodeType.METADATA; } - if(t instanceof PlaceObjectTypeTag){ + if (t instanceof PlaceObjectTypeTag) { return TreeNodeType.PLACE_OBJECT; } - if(t instanceof RemoveTag){ + if (t instanceof RemoveTag) { return TreeNodeType.REMOVE_OBJECT; } if (t instanceof Tag) { diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java index ee4a70ef5..f636724c5 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java @@ -239,7 +239,7 @@ public class TagTreeModel implements TreeModel { if (!mappedTags.containsKey(chit.getCharacterId())) { mappedTags.put(chit.getCharacterId(), new ArrayList<>()); } - mappedTags.get(chit.getCharacterId()).add(t); + mappedTags.get(chit.getCharacterId()).add(t); } } if (!parentFound) { @@ -477,7 +477,7 @@ public class TagTreeModel implements TreeModel { return swfInfo.folders; } - + private List getMappedCharacters(SWF swf, CharacterTag tag) { TagTreeSwfInfo swfInfo = swfInfos.get(swf); if (swfInfo == null) { @@ -486,10 +486,10 @@ public class TagTreeModel implements TreeModel { } List mapped = swfInfo.mappedTags.get(tag.getCharacterId()); - if(mapped == null){ + if (mapped == null) { mapped = new ArrayList<>(); } - + return mapped; } @@ -561,8 +561,8 @@ public class TagTreeModel implements TreeModel { } else { return new ArrayList<>(); } - } else if (parentNode instanceof CharacterTag){ - return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode); + } else if (parentNode instanceof CharacterTag) { + return getMappedCharacters(((CharacterTag) parentNode).getSwf(), (CharacterTag) parentNode); } return new ArrayList<>(); @@ -633,8 +633,8 @@ public class TagTreeModel implements TreeModel { return clt.getChild(clt.getRoot(), index); } else if (parentNode instanceof AS3ClassTreeItem) { return ((AS3Package) parentNode).getChild(index); - } else if (parentNode instanceof CharacterTag){ - return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).get(index); + } else if (parentNode instanceof CharacterTag) { + return getMappedCharacters(((CharacterTag) parentNode).getSwf(), (CharacterTag) parentNode).get(index); } throw new Error("Unsupported parent type: " + parentNode.getClass().getName()); @@ -671,9 +671,9 @@ public class TagTreeModel implements TreeModel { return clt.getChildCount(clt.getRoot()); } else if (parentNode instanceof AS3Package) { return ((AS3Package) parentNode).getChildCount(); - } else if (parentNode instanceof CharacterTag){ + } else if (parentNode instanceof CharacterTag) { SWF swf = ((CharacterTag) parentNode).getSwf(); - return swf == null ? 0 : getMappedCharacters(swf,(CharacterTag)parentNode).size(); + return swf == null ? 0 : getMappedCharacters(swf, (CharacterTag) parentNode).size(); } return 0; @@ -728,8 +728,8 @@ public class TagTreeModel implements TreeModel { return clt.getIndexOfChild(clt.getRoot(), childNode); } else if (parentNode instanceof AS3ClassTreeItem) { return ((AS3Package) parentNode).getIndexOfChild((AS3ClassTreeItem) childNode); - } else if (parentNode instanceof CharacterTag){ - return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).indexOf(childNode); + } else if (parentNode instanceof CharacterTag) { + return getMappedCharacters(((CharacterTag) parentNode).getSwf(), (CharacterTag) parentNode).indexOf(childNode); } throw new Error("Unsupported parent type: " + parentNode.getClass().getName()); diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java index 06eb8589f..d75ead064 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java @@ -29,7 +29,8 @@ import java.util.Map; public class TagTreeSwfInfo { public List folders; - public Map> mappedTags; + + public Map> mappedTags; public Map tagScriptCache; } diff --git a/src/com/sun/jna/platform/win32/Kernel32.java b/src/com/sun/jna/platform/win32/Kernel32.java index 7c0750879..db97fb52a 100644 --- a/src/com/sun/jna/platform/win32/Kernel32.java +++ b/src/com/sun/jna/platform/win32/Kernel32.java @@ -338,11 +338,10 @@ public interface Kernel32 extends WinNT { public static final int LOCALE_SISO639LANGNAME = 89; int GetLocaleInfo(int Locale, int LCType, char[] lpLCData, int cchData); - - public HANDLE CreateMutex(WinBase.SECURITY_ATTRIBUTES sa, boolean initialOwner, String name); - - HANDLE CreateFile(String lpFileName, int dwDesiredAccess, int dwShareMode, - WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, - int dwFlagsAndAttributes, HANDLE hTemplateFile); + public HANDLE CreateMutex(WinBase.SECURITY_ATTRIBUTES sa, boolean initialOwner, String name); + + HANDLE CreateFile(String lpFileName, int dwDesiredAccess, int dwShareMode, + WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, + int dwFlagsAndAttributes, HANDLE hTemplateFile); } diff --git a/src/com/sun/jna/platform/win32/User32.java b/src/com/sun/jna/platform/win32/User32.java index b929d6e7e..dcdc68e74 100644 --- a/src/com/sun/jna/platform/win32/User32.java +++ b/src/com/sun/jna/platform/win32/User32.java @@ -969,7 +969,8 @@ public interface User32 extends StdCallLibrary, WinUser { * function. * Return code: Description * 0: The wait was satisfied successfully. - * WAIT_TIMEOUT: The wait was terminated because the time-out interval elapsed. + * WAIT_TIMEOUT: The wait was terminated because the time-out interval + * elapsed. * WAIT_FAILED: An error occurred. */ DWORD WaitForInputIdle(HANDLE hProcess, DWORD dwMilliseconds); @@ -1315,7 +1316,7 @@ public interface User32 extends StdCallLibrary, WinUser { * information, call GetLastError. * * This function typically fails for one of the following reasons: - * + * * - an invalid parameter value * - the system class was registered by a different module * - The WH_CBT hook is installed and returns a failure code