diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index cf1396a9c..4db780229 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -2133,7 +2133,7 @@ public final class SWF implements TreeItem { public static SerializableImage frameToImage(int containerId, int frame, List allTags, List controlTags, RECT displayRect, int totalFrameCount, Stack visited, Matrix transformation) { String key = "frame_" + frame + "_" + containerId + "_" + allTags.get(0).getSwf().hashCode(); - SerializableImage image = getFromCache(key); + SerializableImage image = getFromCache(key); if (image != null) { return image; } @@ -2142,11 +2142,11 @@ public final class SWF implements TreeItem { if (frameInfos.isEmpty()) { return new SerializableImage(1, 1, SerializableImage.TYPE_INT_ARGB); } - + FrameInfo fi = frameInfos.get(0); - + RECT rect = displayRect; - image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1, + image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1, (int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB); Matrix m = new Matrix(); m.translate(-rect.Xmin, -rect.Ymin); @@ -2275,15 +2275,15 @@ public final class SWF implements TreeItem { } } } - + return ret; } - + public static void framesToImage(int containerId, List ret, int startFrame, int stopFrame, List allTags, List controlTags, RECT displayRect, int totalFrameCount, Stack visited, Matrix transformation) { List frameInfos = getFrameInfo(startFrame, stopFrame, allTags, controlTags, totalFrameCount); RECT rect = displayRect; for (FrameInfo fi : frameInfos) { - SerializableImage image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1, + SerializableImage image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1, (int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB); Matrix m = new Matrix(); m.translate(-rect.Xmin, -rect.Ymin); @@ -2333,7 +2333,7 @@ public final class SWF implements TreeItem { // needs the whole size because of the filters img = new SerializableImage(image.getWidth(), image.getHeight(), SerializableImage.TYPE_INT_ARGB); } else { - img = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1, + img = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1, (int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB); m.translate(-rect.xMin, -rect.yMin); drawMatrix.translate(rect.xMin, rect.yMin); @@ -2427,7 +2427,7 @@ public final class SWF implements TreeItem { g.drawLine(r.Xmin / div, r.Ymin / div, r.Xmax / div, r.Ymax / div); g.drawLine(r.Xmax / div, r.Ymin / div, r.Xmin / div, r.Ymax / div); g.setComposite(AlphaComposite.Dst); - } + } } g.setTransform(AffineTransform.getScaleInstance(1, 1)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java b/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java index 3da98930f..3d93bcef3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java +++ b/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java @@ -29,7 +29,6 @@ public class SourceGeneratorLocalData implements Serializable { public Integer inFunction; public Boolean inMethod; public Integer forInLevel; - public SourceGeneratorLocalData(HashMap registerVars, Integer inFunction, Boolean inMethod, Integer forInLevel) { this.registerVars = registerVars; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 1f29c3605..e87801973 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -188,7 +188,7 @@ public class ScriptPack implements TreeElementItem { String fileName = outDir.toString() + File.separator + Helper.makeFileName(scriptName) + ".as"; File file = new File(fileName); - try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(),new FileOutputStream(file))) { + try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) { try { toSource(writer, abcList, abc.script_info[scriptIndex].traits.traits, exportMode, parallel); } catch (InterruptedException ex) { 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 d448eaee5..ce4ccc644 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -2247,7 +2247,7 @@ public class AVM2Code implements Serializable { invalidateCache(); try { List outputMap = new ArrayList<>(); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); toASMSource(constants, trait, info, body, outputMap, ExportMode.PCODE, writer); String src = writer.toString(); @@ -2289,7 +2289,7 @@ public class AVM2Code implements Serializable { public void removeIgnored(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body) throws InterruptedException { try { List outputMap = new ArrayList<>(); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); toASMSource(constants, trait, info, body, outputMap, ExportMode.PCODE, writer); String src = writer.toString(); AVM2Code acode = ASM3Parser.parse(new StringReader(src), constants, trait, body, info); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java index 7108f84f5..9ae24f373 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java @@ -41,7 +41,7 @@ public class NewClassIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames, String path, HashMap localRegsAssignmentIps, int ip, HashMap> refs, AVM2Code code) throws InterruptedException { int clsIndex = ins.operands[0]; - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); stack.pop().toString(writer, LocalData.create(constants, localRegNames, fullyQualifiedNames)); String baseType = writer.toString(); stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info[clsIndex].name_index).getName(constants, fullyQualifiedNames) + ".class extends " + baseType)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java index 8d46e72f2..0eaffcb7e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java @@ -55,7 +55,7 @@ public class SetSuperIns extends InstructionDefinition implements SetTypeIns { public String getObject(Stack stack, ABC abc, AVM2Instruction ins, List output, MethodBody body, HashMap localRegNames, List fullyQualifiedNames) throws InterruptedException { int multinameIndex = ins.operands[0]; String multiname = resolveMultinameNoPop(1, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); stack.get(1 + resolvedCount(abc.constants, multinameIndex)).toString(writer, LocalData.create(abc.constants, localRegNames, fullyQualifiedNames)); String obj = writer.toString(); return obj + ".super." + multiname; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/Flasm3Lexer.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/Flasm3Lexer.java index d934776a8..76dbb9988 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/Flasm3Lexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/Flasm3Lexer.java @@ -2742,6 +2742,7 @@ public final class Flasm3Lexer { /** * Closes the input stream. + * * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { @@ -2777,7 +2778,8 @@ public final class Flasm3Lexer { /** * Returns the current lexical state. - * @return + * + * @return */ public final int yystate() { return zzLexicalState; @@ -2794,7 +2796,8 @@ public final class Flasm3Lexer { /** * Returns the text matched by the current regular expression. - * @return + * + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -2816,7 +2819,8 @@ public final class Flasm3Lexer { /** * Returns the length of the matched text region. - * @return + * + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java index 10a0199ff..a14e17588 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java @@ -628,6 +628,7 @@ public final class MethodInfoLexer { /** * Closes the input stream. + * * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { @@ -663,7 +664,8 @@ public final class MethodInfoLexer { /** * Returns the current lexical state. - * @return + * + * @return */ public final int yystate() { return zzLexicalState; @@ -680,7 +682,8 @@ public final class MethodInfoLexer { /** * Returns the text matched by the current regular expression. - * @return + * + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -702,7 +705,8 @@ public final class MethodInfoLexer { /** * Returns the length of the matched text region. - * @return + * + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java b/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java index aadde6a63..b81f6a825 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java @@ -50,7 +50,7 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage { } ((TraitSlotConst) traits.traits[traitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); writer.appendNoHilight(super.toString(abcTags, abc) + " "); if (parentTraitIndex > -1) { if (isStatic) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java b/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java index 2a0c7f73a..4b28ac4c9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java @@ -58,7 +58,7 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage { ((TraitMethodGetterSetter) traits.traits[traitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false); } - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); writer.appendNoHilight(super.toString(abcTags, abc)); writer.appendNoHilight(" "); if (isInitializer) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index e1936196a..33e456484 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -1213,7 +1213,7 @@ public class Action implements GraphSourceItem { } String s = null; try { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); Action.actionsToString(new ArrayList(), address, ret, null, version, ExportMode.PCODE, writer, swfPos, path); s = writer.toString(); ret = ASMParser.parse(address, swfPos, true, s, SWF.DEFAULT_VERSION, false); @@ -1268,12 +1268,12 @@ public class Action implements GraphSourceItem { return 0; } - public static GraphTargetItem gettoset(GraphTargetItem get, GraphTargetItem value,List variables) { + public static GraphTargetItem gettoset(GraphTargetItem get, GraphTargetItem value, List variables) { GraphTargetItem ret = get; boolean boxed = false; - if(get instanceof VariableActionItem){ + if (get instanceof VariableActionItem) { boxed = true; - ret = ((VariableActionItem)ret).getBoxedValue(); + ret = ((VariableActionItem) ret).getBoxedValue(); } if (ret instanceof GetVariableActionItem) { GetVariableActionItem gv = (GetVariableActionItem) ret; @@ -1287,12 +1287,12 @@ public class Action implements GraphSourceItem { GetPropertyActionItem gp = (GetPropertyActionItem) ret; ret = new SetPropertyActionItem(null, gp.target, gp.propertyIndex, value); } - if(boxed){ - GraphTargetItem b=ret; - ret = new VariableActionItem(((VariableActionItem)get).getVariableName(), value,((VariableActionItem)get).isDefinition()); - ((VariableActionItem)ret).setBoxedValue((ActionItem)b); - variables.remove((VariableActionItem)get); - variables.add((VariableActionItem)ret); + if (boxed) { + GraphTargetItem b = ret; + ret = new VariableActionItem(((VariableActionItem) get).getVariableName(), value, ((VariableActionItem) get).isDefinition()); + ((VariableActionItem) ret).setBoxedValue((ActionItem) b); + variables.remove((VariableActionItem) get); + variables.add((VariableActionItem) ret); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 1257a365c..b3ae08e7b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -531,7 +531,7 @@ public class ActionListReader { * @param index * @param version * @param removeWhenLast - * @return + * @return */ public static boolean removeAction(List actions, int index, int version, boolean removeWhenLast) { 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 362202f77..6e78b4d2e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -100,7 +100,7 @@ public class FunctionActionItem extends ActionItem { writer.append(")").startBlock(); Graph.graphToString(actions, writer, localData); - + return writer.endBlock(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java index 60d2750d0..7983cd08c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java @@ -51,8 +51,8 @@ public class InitObjectActionItem extends ActionItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.append("{"); - for (int i = values.size()-1;i>=0; i--) { - if (i < values.size()-1) { + for (int i = values.size() - 1; i >= 0; i--) { + if (i < values.size() - 1) { writer.append(","); } names.get(i).toStringNoQuotes(writer, localData); //AS1/2 do not allow quotes in name here diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java index 4c5ca32d9..fb8fcabf0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java @@ -103,7 +103,7 @@ public class NewMethodActionItem extends ActionItem { public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { return toSourceMerge(localData, generator, toSourceCall(localData, generator, arguments), scriptObject, methodName, new ActionNewMethod()); } - + @Override public boolean hasReturnValue() { return true; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java index 7dcfe7ed8..ecec32cef 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java @@ -56,7 +56,7 @@ public class UnLoadMovieActionItem extends ActionItem { @Override public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return toSourceMerge(localData, generator, new ActionPush(""), targetString, new ActionGetURL2(0, false,true)); + return toSourceMerge(localData, generator, new ActionPush(""), targetString, new ActionGetURL2(0, false, true)); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java index 1ec94e4a9..b48ad7ef0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java @@ -195,7 +195,6 @@ public class ClassActionItem extends ActionItem implements Block { f.toString(writer, localData).newLine(); } - return writer.endBlock(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java index 028cd7452..c8fcb13ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java @@ -50,7 +50,7 @@ public class IfFrameLoadedActionItem extends ActionItem implements Block { writer.append("ifFrameLoaded("); frame.toString(writer, localData); writer.append(")").startBlock(); - Graph.graphToString(actions, writer, localData); + Graph.graphToString(actions, writer, localData); return writer.endBlock(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java index ad828d453..3c9870ef4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java @@ -59,7 +59,7 @@ public class InterfaceActionItem extends ActionItem { Action.getWithoutGlobal(ti).toStringNoQuotes(writer, localData); } writer.newLine(); - return writer.append("{").startBlock(); + return writer.startBlock().endBlock(); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/FlasmLexer.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/FlasmLexer.java index 9c80e498b..e8c32b5b5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/FlasmLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/FlasmLexer.java @@ -632,6 +632,7 @@ public final class FlasmLexer { /** * Closes the input stream. + * * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { @@ -667,7 +668,8 @@ public final class FlasmLexer { /** * Returns the current lexical state. - * @return + * + * @return */ public final int yystate() { return zzLexicalState; @@ -684,7 +686,8 @@ public final class FlasmLexer { /** * Returns the text matched by the current regular expression. - * @return + * + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -706,7 +709,8 @@ public final class FlasmLexer { /** * Returns the length of the matched text region. - * @return + * + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java index 77516c03b..958da9dca 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java @@ -492,8 +492,8 @@ public class ActionSourceGenerator implements SourceGenerator { } private String getName(GraphTargetItem item) { - if(item instanceof VariableActionItem){ - return ((VariableActionItem)item).getVariableName(); + if (item instanceof VariableActionItem) { + return ((VariableActionItem) item).getVariableName(); } if (item instanceof DirectValueActionItem) { DirectValueActionItem dv = (DirectValueActionItem) item; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java index 0723d7f6f..bd445d52a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java @@ -58,7 +58,7 @@ public class VariableActionItem extends ActionItem { public void setBoxedValue(ActionItem it) { this.it = it; - if(it!=null){ + if (it != null) { this.precedence = it.getPrecedence(); } } @@ -111,5 +111,5 @@ public class VariableActionItem extends ActionItem { } return it.needsSemicolon(); } - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java index d5991160d..93ac2cf94 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java @@ -50,7 +50,7 @@ public class ActionGetURL2 extends Action { public boolean loadVariablesFlag; public int reserved; - public ActionGetURL2(int sendVarsMethod, boolean loadVariablesFlag, boolean loadTargetFlag) { + public ActionGetURL2(int sendVarsMethod, boolean loadVariablesFlag, boolean loadTargetFlag) { super(0x9A, 1); this.loadTargetFlag = loadTargetFlag; this.loadVariablesFlag = loadVariablesFlag; @@ -88,7 +88,7 @@ public class ActionGetURL2 extends Action { public ActionGetURL2(FlasmLexer lexer) throws IOException, ParseException { super(0x9A, -1); loadVariablesFlag = lexBoolean(lexer); - loadTargetFlag = lexBoolean(lexer); + loadTargetFlag = lexBoolean(lexer); sendVarsMethod = (int) lexLong(lexer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index 906574c57..116a59b8b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -298,7 +298,7 @@ public class ActionPush extends Action { @Override public String toString() { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); toString(writer); return writer.toString(); } 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 8d8a58e81..2289aaef4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java @@ -46,12 +46,13 @@ public class RegisterNumber implements Serializable { return true; } - public RegisterNumber(int number,String name) { + public RegisterNumber(int number, String name) { this.number = number; this.name = name; } + public RegisterNumber(int number) { - this(number,null); + this(number, null); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java index 2bf06a2d3..5439138db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java @@ -203,7 +203,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta @Override public void translateContainer(List> content, Stack stack, List output, HashMap regNames, HashMap variables, HashMap functions) { - FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, 1,new ArrayList()); + FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, 1, new ArrayList()); //ActionGraph.translateViaGraph(regNames, variables, functions, code, version) stack.push(fti); functions.put(functionName, fti); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java index dda52888f..b1d526b64 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java @@ -342,7 +342,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont @Override public void translateContainer(List> content, Stack stack, List output, HashMap regNames, HashMap variables, HashMap functions) { - FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, getFirstRegister(),new ArrayList()); + FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, getFirstRegister(), new ArrayList()); functions.put(functionName, fti); stack.push(fti); } diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 085efd963..38470bd99 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -49,515 +49,516 @@ 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; + 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; - /** - * List of replacements - */ - private static List replacements = new ArrayList<>(); + /** + * List of replacements + */ + private static List replacements = new ArrayList<>(); - public static final Level logLevel; + public static final Level logLevel; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem openMultipleFiles = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem decompile = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem parallelSpeedUp = null; - @ConfigurationDefaultInt(20) - public static final ConfigurationItem parallelThreadCount = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem autoDeobfuscate = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem cacheOnDisk = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem internalFlashViewer = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem gotoMainClassOnStartup = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem autoRenameIdentifiers = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem deobfuscateUsePrevTagOnly = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem offeredAssociation = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem removeNops = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem showHexOnlyButton = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem decimalAddress = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem showAllAddresses = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem useFrameCache = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem useRibbonInterface = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem openFolderAfterFlaExport = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem useDetailedLogging = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem openMultipleFiles = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem decompile = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem parallelSpeedUp = null; + @ConfigurationDefaultInt(20) + public static final ConfigurationItem parallelThreadCount = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem autoDeobfuscate = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem cacheOnDisk = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem internalFlashViewer = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem gotoMainClassOnStartup = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem autoRenameIdentifiers = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem deobfuscateUsePrevTagOnly = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem offeredAssociation = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem removeNops = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem showHexOnlyButton = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem decimalAddress = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem showAllAddresses = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem useFrameCache = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem useRibbonInterface = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem openFolderAfterFlaExport = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem useDetailedLogging = null; - /** - * Debug mode = throwing an error when comparing original file and recompiled - */ - @ConfigurationDefaultBoolean(false) - @ConfigurationDescription("Debug mode = throwing an error when comparing original file and recompiled") - public static final ConfigurationItem debugMode = null; - /** - * Turn off reading unsafe tags (tags which can cause problems with - * recompiling) - */ - @ConfigurationDefaultBoolean(false) - @ConfigurationDescription("Turn off reading unsafe tags (tags which can cause problems with recompiling)") - public static final ConfigurationItem disableDangerous = null; - /** - * Turn off resolving constants in ActionScript 2 - */ - @ConfigurationDefaultBoolean(true) - @ConfigurationDescription("Turn off resolving constants in ActionScript 2") - public static final ConfigurationItem resolveConstants = null; - /** - * Limit of code subs (for obfuscated code) - */ - @ConfigurationDefaultInt(500) - @ConfigurationDescription("Limit of code subs (for obfuscated code)") - public static final ConfigurationItem sublimiter = null; - /** - * Total export timeout in seconds - */ - @ConfigurationDefaultInt(30 * 60) - @ConfigurationDescription("Total export timeout in seconds") - public static final ConfigurationItem exportTimeout = null; - /** - * Decompilation timeout in seconds for a single file - */ - @ConfigurationDefaultInt(5 * 60) - @ConfigurationDescription("Decompilation timeout in seconds for a single file") - public static final ConfigurationItem decompilationTimeoutFile = null; - /** - * Using parameter names in decompiling may cause problems because official - * programs like Flash CS 5.5 inserts wrong parameter names indices - */ - @ConfigurationDefaultBoolean(false) - @ConfigurationDescription("Using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices") - public static final ConfigurationItem paramNamesEnable = null; + /** + * Debug mode = throwing an error when comparing original file and + * recompiled + */ + @ConfigurationDefaultBoolean(false) + @ConfigurationDescription("Debug mode = throwing an error when comparing original file and recompiled") + public static final ConfigurationItem debugMode = null; + /** + * Turn off reading unsafe tags (tags which can cause problems with + * recompiling) + */ + @ConfigurationDefaultBoolean(false) + @ConfigurationDescription("Turn off reading unsafe tags (tags which can cause problems with recompiling)") + public static final ConfigurationItem disableDangerous = null; + /** + * Turn off resolving constants in ActionScript 2 + */ + @ConfigurationDefaultBoolean(true) + @ConfigurationDescription("Turn off resolving constants in ActionScript 2") + public static final ConfigurationItem resolveConstants = null; + /** + * Limit of code subs (for obfuscated code) + */ + @ConfigurationDefaultInt(500) + @ConfigurationDescription("Limit of code subs (for obfuscated code)") + public static final ConfigurationItem sublimiter = null; + /** + * Total export timeout in seconds + */ + @ConfigurationDefaultInt(30 * 60) + @ConfigurationDescription("Total export timeout in seconds") + public static final ConfigurationItem exportTimeout = null; + /** + * Decompilation timeout in seconds for a single file + */ + @ConfigurationDefaultInt(5 * 60) + @ConfigurationDescription("Decompilation timeout in seconds for a single file") + public static final ConfigurationItem decompilationTimeoutFile = null; + /** + * Using parameter names in decompiling may cause problems because official + * programs like Flash CS 5.5 inserts wrong parameter names indices + */ + @ConfigurationDefaultBoolean(false) + @ConfigurationDescription("Using parameter names in decompiling may cause problems because official programs like Flash CS 5.5 inserts wrong parameter names indices") + public static final ConfigurationItem paramNamesEnable = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem displayFileName = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem debugCopy = null; - @ConfigurationDefaultBoolean(false) - public static final ConfigurationItem dumpTags = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem displayFileName = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem debugCopy = null; + @ConfigurationDefaultBoolean(false) + public static final ConfigurationItem dumpTags = null; - @ConfigurationDefaultInt(60) - public static final ConfigurationItem decompilationTimeoutSingleMethod = null; - @ConfigurationDefaultInt(1) - public static final ConfigurationItem lastRenameType = null; + @ConfigurationDefaultInt(60) + public static final ConfigurationItem decompilationTimeoutSingleMethod = null; + @ConfigurationDefaultInt(1) + public static final ConfigurationItem lastRenameType = null; - @ConfigurationDefaultString(".") - public static final ConfigurationItem lastSaveDir = null; - @ConfigurationDefaultString(".") - public static final ConfigurationItem lastOpenDir = null; - @ConfigurationDefaultString(".") - public static final ConfigurationItem lastExportDir = null; - @ConfigurationDefaultString("en") - public static final ConfigurationItem locale = null; - @ConfigurationDefaultString("_loc%d_") - public static final ConfigurationItem registerNameFormat = null; - @ConfigurationDefaultInt(8) - public static final ConfigurationItem maxRecentFileCount = null; - public static final ConfigurationItem recentFiles = null; - public static final ConfigurationItem fontPairing = null; + @ConfigurationDefaultString(".") + public static final ConfigurationItem lastSaveDir = null; + @ConfigurationDefaultString(".") + public static final ConfigurationItem lastOpenDir = null; + @ConfigurationDefaultString(".") + public static final ConfigurationItem lastExportDir = null; + @ConfigurationDefaultString("en") + public static final ConfigurationItem locale = null; + @ConfigurationDefaultString("_loc%d_") + public static final ConfigurationItem registerNameFormat = null; + @ConfigurationDefaultInt(8) + public static final ConfigurationItem maxRecentFileCount = null; + public static final ConfigurationItem recentFiles = null; + public static final ConfigurationItem fontPairing = null; - public static final ConfigurationItem lastUpdatesCheckDate = null; + public static final ConfigurationItem lastUpdatesCheckDate = null; - @ConfigurationDefaultInt(1000) - @ConfigurationName("gui.window.width") - public static final ConfigurationItem guiWindowWidth = null; - @ConfigurationDefaultInt(700) - @ConfigurationName("gui.window.height") - public static final ConfigurationItem guiWindowHeight = null; - @ConfigurationDefaultBoolean(false) - @ConfigurationName("gui.window.maximized.horizontal") - public static final ConfigurationItem guiWindowMaximizedHorizontal = null; - @ConfigurationDefaultBoolean(false) - @ConfigurationName("gui.window.maximized.vertical") - public static final ConfigurationItem guiWindowMaximizedVertical = null; - @ConfigurationName("gui.avm2.splitPane.dividerLocation") - public static final ConfigurationItem guiAvm2SplitPaneDividerLocation = null; - @ConfigurationName("guiActionSplitPaneDividerLocation") - public static final ConfigurationItem guiActionSplitPaneDividerLocation = null; - @ConfigurationName("guiPreviewSplitPaneDividerLocation") - public static final ConfigurationItem guiPreviewSplitPaneDividerLocation = null; - @ConfigurationName("gui.splitPane1.dividerLocation") - public static final ConfigurationItem guiSplitPane1DividerLocation = null; - @ConfigurationName("gui.splitPane2.dividerLocation") - public static final ConfigurationItem guiSplitPane2DividerLocation = null; - @ConfigurationDefaultInt(3) - public static final ConfigurationItem saveAsExeScaleMode = null; - @ConfigurationDefaultInt(1024 * 100/*100KB*/) - public static final ConfigurationItem syntaxHighlightLimit = null; - public static final ConfigurationItem guiFontPreviewSampleText = null; - @ConfigurationName("gui.fontPreviewWindow.width") - public static final ConfigurationItem guiFontPreviewWidth = null; - @ConfigurationName("gui.fontPreviewWindow.height") - public static final ConfigurationItem guiFontPreviewHeight = null; - @ConfigurationName("gui.fontPreviewWindow.posX") - public static final ConfigurationItem guiFontPreviewPosX = null; - @ConfigurationName("gui.fontPreviewWindow.posY") - public static final ConfigurationItem guiFontPreviewPosY = null; + @ConfigurationDefaultInt(1000) + @ConfigurationName("gui.window.width") + public static final ConfigurationItem guiWindowWidth = null; + @ConfigurationDefaultInt(700) + @ConfigurationName("gui.window.height") + public static final ConfigurationItem guiWindowHeight = null; + @ConfigurationDefaultBoolean(false) + @ConfigurationName("gui.window.maximized.horizontal") + public static final ConfigurationItem guiWindowMaximizedHorizontal = null; + @ConfigurationDefaultBoolean(false) + @ConfigurationName("gui.window.maximized.vertical") + public static final ConfigurationItem guiWindowMaximizedVertical = null; + @ConfigurationName("gui.avm2.splitPane.dividerLocation") + public static final ConfigurationItem guiAvm2SplitPaneDividerLocation = null; + @ConfigurationName("guiActionSplitPaneDividerLocation") + public static final ConfigurationItem guiActionSplitPaneDividerLocation = null; + @ConfigurationName("guiPreviewSplitPaneDividerLocation") + public static final ConfigurationItem guiPreviewSplitPaneDividerLocation = null; + @ConfigurationName("gui.splitPane1.dividerLocation") + public static final ConfigurationItem guiSplitPane1DividerLocation = null; + @ConfigurationName("gui.splitPane2.dividerLocation") + public static final ConfigurationItem guiSplitPane2DividerLocation = null; + @ConfigurationDefaultInt(3) + public static final ConfigurationItem saveAsExeScaleMode = null; + @ConfigurationDefaultInt(1024 * 100/*100KB*/) + public static final ConfigurationItem syntaxHighlightLimit = null; + public static final ConfigurationItem guiFontPreviewSampleText = null; + @ConfigurationName("gui.fontPreviewWindow.width") + public static final ConfigurationItem guiFontPreviewWidth = null; + @ConfigurationName("gui.fontPreviewWindow.height") + public static final ConfigurationItem guiFontPreviewHeight = null; + @ConfigurationName("gui.fontPreviewWindow.posX") + public static final ConfigurationItem guiFontPreviewPosX = null; + @ConfigurationName("gui.fontPreviewWindow.posY") + public static final ConfigurationItem guiFontPreviewPosY = null; - @ConfigurationDefaultInt(3) - @ConfigurationName("formatting.indent.size") - @ConfigurationDescription("Number or spaces(or tabs) for one indentation") - public static final ConfigurationItem indentSize = null; + @ConfigurationDefaultInt(3) + @ConfigurationName("formatting.indent.size") + @ConfigurationDescription("Number or spaces(or tabs) for one indentation") + public static final ConfigurationItem indentSize = null; - @ConfigurationDefaultBoolean(false) - @ConfigurationName("formatting.indent.useTabs") - @ConfigurationDescription("Use tabs instead of spaces for indentation") - public static final ConfigurationItem indentUseTabs = null; + @ConfigurationDefaultBoolean(false) + @ConfigurationName("formatting.indent.useTabs") + @ConfigurationDescription("Use tabs instead of spaces for indentation") + public static final ConfigurationItem indentUseTabs = null; - @ConfigurationDefaultBoolean(true) - public static final ConfigurationItem beginBlockOnNewLine = null; - - private enum OSId { + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem beginBlockOnNewLine = null; - WINDOWS, OSX, UNIX - } + private enum OSId { - 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; - } + WINDOWS, OSX, UNIX + } - 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.SHORT_APPLICATION_NAME; - 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); + private static OSId getOSId() { + PrivilegedAction doGetOSName = new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("os.name"); } - } - } - if (!directory.exists()) { - if (!directory.mkdirs()) { - if (!directory.exists()) { - throw new IOException("cannot create directory " + directory); + }; + 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; } - } - } - String ret = directory.getAbsolutePath(); - if (!ret.endsWith(File.separator)) { - ret += File.separator; - } - return ret; - } + } + return id; + } - public static List getRecentFiles() { - String files = recentFiles.get(); - if (files == null || files.isEmpty()) { - return new ArrayList<>(); - } - return Arrays.asList(files.split("::")); - } - - public static void addRecentFile(String path) { - List recentFilesArray = new ArrayList<>(getRecentFiles()); - int idx = recentFilesArray.indexOf(path); - if (idx != -1) { - recentFilesArray.remove(idx); - } - recentFilesArray.add(path); - while (recentFilesArray.size() >= maxRecentFileCount.get()) { - recentFilesArray.remove(0); - } - recentFiles.set(Helper.joinStrings(recentFilesArray, "::")); - } - - public static void removeRecentFile(String path) { - List recentFilesArray = new ArrayList<>(getRecentFiles()); - int idx = recentFilesArray.indexOf(path); - if (idx != -1) { - recentFilesArray.remove(idx); - } - recentFiles.set(Helper.joinStrings(recentFilesArray, "::")); - } - - public static Map getFontPairs() { - String fonts = fontPairing.get(); - if (fonts == null) { - return new HashMap<>(); - } - - Map result = new HashMap<>(); - for (String pair : fonts.split("::")) { - String[] splittedPair = pair.split("="); - result.put(splittedPair[0], splittedPair[1]); - } - return result; - } - - public static void addFontPair(String fileName, int fontId, String fontName, String systemFontName) { - String key = fileName + "_" + fontId + "_" + fontName; - Map fontPairs = getFontPairs(); - fontPairs.put(key, systemFontName); - fontPairs.put(fontName, systemFontName); - StringBuilder sb = new StringBuilder(); - int i = 0; - for (Entry pair : fontPairs.entrySet()) { - if (i != 0) { - sb.append("::"); - } - sb.append(pair.getKey()).append("=").append(pair.getValue()); - i++; - } - fontPairing.set(sb.toString()); - } - - /** - * Saves replacements to file for future use - */ - private static void saveReplacements(String replacementsFile) { - if (replacements.isEmpty()) { - File rf = new File(replacementsFile); - if (rf.exists()) { - if (!rf.delete()) { - Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Cannot delete replacements file"); + public static String getFFDecHome() throws IOException { + if (directory == unspecifiedFile) { + directory = null; + String userHome = null; + try { + userHome = System.getProperty("user.home"); + } catch (SecurityException ignore) { } - } - } else { - try (PrintWriter pw = new PrintWriter(new Utf8OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(replacementsFile))))) { - for (Replacement r : replacements) { - pw.println(r.urlPattern); - pw.println(r.targetFile); + if (userHome != null) { + String applicationId = ApplicationInfo.SHORT_APPLICATION_NAME; + 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); + } } - } catch (IOException ex) { - Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Exception during saving replacements", ex); - } - } - } - - /** - * Load replacements from file - */ - private static void loadReplacements(String replacementsFile) { - if (!(new File(replacementsFile)).exists()) { - return; - } - replacements = new ArrayList<>(); - try (BufferedReader br = new BufferedReader(new Utf8InputStreamReader(new FileInputStream(replacementsFile)))) { - String s; - while ((s = br.readLine()) != null) { - Replacement r = new Replacement(s, br.readLine()); - replacements.add(r); - } - } catch (IOException e) { - Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Error during load replacements", e); - } - } - - private static String getReplacementsFile() throws IOException { - return getFFDecHome() + REPLACEMENTS_NAME; - } - - private static String getConfigFile() throws IOException { - return getFFDecHome() + CONFIG_NAME; - } - - private static HashMap loadFromFile(String file, String replacementsFile) { - HashMap config = new HashMap<>(); - try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) { - - @SuppressWarnings("unchecked") - HashMap cfg = (HashMap) ois.readObject(); - config = cfg; - } catch (FileNotFoundException ex) { - } catch (ClassNotFoundException cnf) { - } catch (IOException ex) { - } - if (replacementsFile != null) { - loadReplacements(replacementsFile); - } - if (config.containsKey("paralelSpeedUp")) { - config.put("parallelSpeedUp", config.get("paralelSpeedUp")); - config.remove("paralelSpeedUp"); - } - return config; - } - - private static void saveToFile(String file, String replacementsFile) { - HashMap config = new HashMap<>(); - for (Entry entry : getConfigurationFields().entrySet()) { - try { - String name = entry.getKey(); - Field field = entry.getValue(); - ConfigurationItem item = (ConfigurationItem) field.get(null); - if (item.hasValue) { - config.put(name, item.get()); + } + if (!directory.exists()) { + if (!directory.mkdirs()) { + if (!directory.exists()) { + throw new IOException("cannot create directory " + directory); + } } - } catch (IllegalArgumentException | IllegalAccessException ex) { + } + String ret = directory.getAbsolutePath(); + if (!ret.endsWith(File.separator)) { + ret += File.separator; + } + return ret; + } + + public static List getRecentFiles() { + String files = recentFiles.get(); + if (files == null || files.isEmpty()) { + return new ArrayList<>(); + } + return Arrays.asList(files.split("::")); + } + + public static void addRecentFile(String path) { + List recentFilesArray = new ArrayList<>(getRecentFiles()); + int idx = recentFilesArray.indexOf(path); + if (idx != -1) { + recentFilesArray.remove(idx); + } + recentFilesArray.add(path); + while (recentFilesArray.size() >= maxRecentFileCount.get()) { + recentFilesArray.remove(0); + } + recentFiles.set(Helper.joinStrings(recentFilesArray, "::")); + } + + public static void removeRecentFile(String path) { + List recentFilesArray = new ArrayList<>(getRecentFiles()); + int idx = recentFilesArray.indexOf(path); + if (idx != -1) { + recentFilesArray.remove(idx); + } + recentFiles.set(Helper.joinStrings(recentFilesArray, "::")); + } + + public static Map getFontPairs() { + String fonts = fontPairing.get(); + if (fonts == null) { + return new HashMap<>(); + } + + Map result = new HashMap<>(); + for (String pair : fonts.split("::")) { + String[] splittedPair = pair.split("="); + result.put(splittedPair[0], splittedPair[1]); + } + return result; + } + + public static void addFontPair(String fileName, int fontId, String fontName, String systemFontName) { + String key = fileName + "_" + fontId + "_" + fontName; + Map fontPairs = getFontPairs(); + fontPairs.put(key, systemFontName); + fontPairs.put(fontName, systemFontName); + StringBuilder sb = new StringBuilder(); + int i = 0; + for (Entry pair : fontPairs.entrySet()) { + if (i != 0) { + sb.append("::"); + } + sb.append(pair.getKey()).append("=").append(pair.getValue()); + i++; + } + fontPairing.set(sb.toString()); + } + + /** + * Saves replacements to file for future use + */ + private static void saveReplacements(String replacementsFile) { + if (replacements.isEmpty()) { + File rf = new File(replacementsFile); + if (rf.exists()) { + if (!rf.delete()) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Cannot delete replacements file"); + } + } + } else { + try (PrintWriter pw = new PrintWriter(new Utf8OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(replacementsFile))))) { + for (Replacement r : replacements) { + pw.println(r.urlPattern); + pw.println(r.targetFile); + } + } catch (IOException ex) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Exception during saving replacements", ex); + } + } + } + + /** + * Load replacements from file + */ + private static void loadReplacements(String replacementsFile) { + if (!(new File(replacementsFile)).exists()) { + return; + } + replacements = new ArrayList<>(); + try (BufferedReader br = new BufferedReader(new Utf8InputStreamReader(new FileInputStream(replacementsFile)))) { + String s; + while ((s = br.readLine()) != null) { + Replacement r = new Replacement(s, br.readLine()); + replacements.add(r); + } + } catch (IOException e) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Error during load replacements", e); + } + } + + private static String getReplacementsFile() throws IOException { + return getFFDecHome() + REPLACEMENTS_NAME; + } + + private static String getConfigFile() throws IOException { + return getFFDecHome() + CONFIG_NAME; + } + + private static HashMap loadFromFile(String file, String replacementsFile) { + HashMap config = new HashMap<>(); + try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) { + + @SuppressWarnings("unchecked") + HashMap cfg = (HashMap) ois.readObject(); + config = cfg; + } catch (FileNotFoundException ex) { + } catch (ClassNotFoundException cnf) { + } catch (IOException ex) { + } + if (replacementsFile != null) { + loadReplacements(replacementsFile); + } + if (config.containsKey("paralelSpeedUp")) { + config.put("parallelSpeedUp", config.get("paralelSpeedUp")); + config.remove("paralelSpeedUp"); + } + return config; + } + + private static void saveToFile(String file, String replacementsFile) { + HashMap config = new HashMap<>(); + for (Entry entry : getConfigurationFields().entrySet()) { + try { + String name = entry.getKey(); + Field field = entry.getValue(); + ConfigurationItem item = (ConfigurationItem) field.get(null); + if (item.hasValue) { + config.put(name, item.get()); + } + } catch (IllegalArgumentException | IllegalAccessException ex) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); + } + } + try (ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))) { + oos.writeObject(config); + } catch (IOException ex) { + JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE); + Logger.getLogger(Configuration.class.getName()).severe("Configuration directory is read only."); + } + if (replacementsFile != null) { + saveReplacements(replacementsFile); + } + } + + public static List getReplacements() { + return replacements; + } + + public static void saveConfig() { + try { + saveToFile(getConfigFile(), getReplacementsFile()); + } catch (IOException ex) { Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); - } - } - try (ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))) { - oos.writeObject(config); - } catch (IOException ex) { - JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE); - Logger.getLogger(Configuration.class.getName()).severe("Configuration directory is read only."); - } - if (replacementsFile != null) { - saveReplacements(replacementsFile); - } - } + } + } - public static List getReplacements() { - return replacements; - } + static { + setConfigurationFields(); + if (useDetailedLogging.get() || debugMode.get()) { + logLevel = Level.CONFIG; + } else { + logLevel = Level.WARNING; + } + } - public static void saveConfig() { - try { - saveToFile(getConfigFile(), getReplacementsFile()); - } catch (IOException ex) { - Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); - } - } + @SuppressWarnings("unchecked") + public static void setConfigurationFields() { + try { + HashMap config = loadFromFile(getConfigFile(), getReplacementsFile()); + for (Entry entry : getConfigurationFields().entrySet()) { + String name = entry.getKey(); + Field field = entry.getValue(); + // remove final modifier from field + Field modifiersField = field.getClass().getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - static { - setConfigurationFields(); - if (useDetailedLogging.get() || debugMode.get()) { - logLevel = Level.CONFIG; - } else { - logLevel = Level.WARNING; - } - } + Object defaultValue = getDefaultValue(field); + Object value = null; + if (config.containsKey(name)) { + value = config.get(name); + } - @SuppressWarnings("unchecked") - public static void setConfigurationFields() { - try { - HashMap config = loadFromFile(getConfigFile(), getReplacementsFile()); - for (Entry entry : getConfigurationFields().entrySet()) { - String name = entry.getKey(); - Field field = entry.getValue(); - // remove final modifier from field - Field modifiersField = field.getClass().getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - - Object defaultValue = getDefaultValue(field); - Object value = null; - if (config.containsKey(name)) { - value = config.get(name); + if (value != null) { + field.set(null, new ConfigurationItem(name, defaultValue, value)); + } else { + field.set(null, new ConfigurationItem(name, defaultValue)); + } } + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ex) { + // Reflection exceptions. This should never happen + throw new Error(ex.getMessage()); + } catch (IOException ex) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); + } + } - if (value != null) { - field.set(null, new ConfigurationItem(name, defaultValue, value)); - } else { - field.set(null, new ConfigurationItem(name, defaultValue)); + public static Object getDefaultValue(Field field) { + Object defaultValue = null; + ConfigurationDefaultBoolean aBool = field.getAnnotation(ConfigurationDefaultBoolean.class); + if (aBool != null) { + defaultValue = aBool.value(); + } + ConfigurationDefaultInt aInt = field.getAnnotation(ConfigurationDefaultInt.class); + if (aInt != null) { + defaultValue = aInt.value(); + } + ConfigurationDefaultString aString = field.getAnnotation(ConfigurationDefaultString.class); + if (aString != null) { + defaultValue = aString.value(); + } + return defaultValue; + } + + public static String getDescription(Field field) { + ConfigurationDescription a = field.getAnnotation(ConfigurationDescription.class); + if (a != null) { + return a.value(); + } + return null; + } + + public static Map getConfigurationFields() { + Field[] fields = Configuration.class.getFields(); + Map result = new HashMap<>(); + for (Field field : fields) { + if (ConfigurationItem.class.isAssignableFrom(field.getType())) { + ConfigurationName annotation = field.getAnnotation(ConfigurationName.class); + String name = annotation == null ? field.getName() : annotation.value(); + result.put(name, field); } - } - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ex) { - // Reflection exceptions. This should never happen - throw new Error(ex.getMessage()); - } catch (IOException ex) { - Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); - } - } + } + return result; + } - public static Object getDefaultValue(Field field) { - Object defaultValue = null; - ConfigurationDefaultBoolean aBool = field.getAnnotation(ConfigurationDefaultBoolean.class); - if (aBool != null) { - defaultValue = aBool.value(); - } - ConfigurationDefaultInt aInt = field.getAnnotation(ConfigurationDefaultInt.class); - if (aInt != null) { - defaultValue = aInt.value(); - } - ConfigurationDefaultString aString = field.getAnnotation(ConfigurationDefaultString.class); - if (aString != null) { - defaultValue = aString.value(); - } - return defaultValue; - } - - public static String getDescription(Field field) { - ConfigurationDescription a = field.getAnnotation(ConfigurationDescription.class); - if (a != null) { - return a.value(); - } - return null; - } - - public static Map getConfigurationFields() { - Field[] fields = Configuration.class.getFields(); - Map result = new HashMap<>(); - for (Field field : fields) { - if (ConfigurationItem.class.isAssignableFrom(field.getType())) { - ConfigurationName annotation = field.getAnnotation(ConfigurationName.class); - String name = annotation == null ? field.getName() : annotation.value(); - result.put(name, field); - } - } - return result; - } - - public static CodeFormatting getCodeFormatting() { - CodeFormatting ret = new CodeFormatting(); - String indentString = ""; - for (int i = 0; i < indentSize.get(); i++) { - indentString += indentUseTabs.get() ? "\t" : " "; - } - ret.indentString = indentString; - ret.beginBlockOnNewLine = beginBlockOnNewLine.get(); - return ret; - } + public static CodeFormatting getCodeFormatting() { + CodeFormatting ret = new CodeFormatting(); + String indentString = ""; + for (int i = 0; i < indentSize.get(); i++) { + indentString += indentUseTabs.get() ? "\t" : " "; + } + ret.indentString = indentString; + ret.beginBlockOnNewLine = beginBlockOnNewLine.get(); + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 94ab90d4c..345240f89 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -763,7 +763,7 @@ public class CommandLineArgumentParser { break; } } - + try { SWFSourceInfo sourceInfo = new SWFSourceInfo(null, fileName, null); if (!sourceInfo.isBundle()) { @@ -791,11 +791,11 @@ public class CommandLineArgumentParser { break; } } - + if (mode == ExtractMode.BIGGEST && biggest != null) { streamsToExtract.add(biggest); } - + for (Map.Entry streamEntry : streamsToExtract) { InputStream stream = streamEntry.getValue(); stream.reset(); diff --git a/trunk/src/com/jpexs/decompiler/flash/console/ExtractMode.java b/trunk/src/com/jpexs/decompiler/flash/console/ExtractMode.java index fd1ccfd88..ac7bf4143 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/ExtractMode.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/ExtractMode.java @@ -21,6 +21,6 @@ package com.jpexs.decompiler.flash.console; * @author JPEXS */ public enum ExtractMode { - + ALL, BIGGEST } diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/ExportRectangle.java b/trunk/src/com/jpexs/decompiler/flash/exporters/ExportRectangle.java index ec1b1a823..6c1a979d3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/ExportRectangle.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/ExportRectangle.java @@ -42,15 +42,15 @@ public class ExportRectangle { this.xMax = rect.Xmax; this.yMax = rect.Ymax; } - + public double getWidth() { return xMax - xMin; - } - + } + public double getHeight() { return yMax - yMin; - } - + } + @Override public int hashCode() { long bits = Double.doubleToLongBits(xMin); diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java b/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java index 6b0f1ce1c..7ec7e8c05 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java @@ -50,7 +50,7 @@ public class Matrix { } public Matrix(MATRIX matrix) { - if(matrix == null){ + if (matrix == null) { matrix = new MATRIX(); } translateX = matrix.translateX; @@ -86,11 +86,11 @@ public class Matrix { rotateSkew0 * x + scaleY * y + translateY); return result; } - + public Point transform(Point point) { return transform(point.x, point.y); } - + public ExportRectangle transform(ExportRectangle rect) { double minX = Double.MAX_VALUE; double minY = Double.MAX_VALUE; @@ -98,28 +98,60 @@ public class Matrix { double maxY = Double.MIN_VALUE; Point point; point = transform(rect.xMin, rect.yMin); - if (point.x < minX) minX = point.x; - if (point.x > maxX) maxX = point.x; - if (point.y < minY) minY = point.y; - if (point.y > maxY) maxY = point.y; + if (point.x < minX) { + minX = point.x; + } + if (point.x > maxX) { + maxX = point.x; + } + if (point.y < minY) { + minY = point.y; + } + if (point.y > maxY) { + maxY = point.y; + } point = transform(rect.xMax, rect.yMin); - if (point.x < minX) minX = point.x; - if (point.x > maxX) maxX = point.x; - if (point.y < minY) minY = point.y; - if (point.y > maxY) maxY = point.y; + if (point.x < minX) { + minX = point.x; + } + if (point.x > maxX) { + maxX = point.x; + } + if (point.y < minY) { + minY = point.y; + } + if (point.y > maxY) { + maxY = point.y; + } point = transform(rect.xMin, rect.yMax); - if (point.x < minX) minX = point.x; - if (point.x > maxX) maxX = point.x; - if (point.y < minY) minY = point.y; - if (point.y > maxY) maxY = point.y; + if (point.x < minX) { + minX = point.x; + } + if (point.x > maxX) { + maxX = point.x; + } + if (point.y < minY) { + minY = point.y; + } + if (point.y > maxY) { + maxY = point.y; + } point = transform(rect.xMax, rect.yMax); - if (point.x < minX) minX = point.x; - if (point.x > maxX) maxX = point.x; - if (point.y < minY) minY = point.y; - if (point.y > maxY) maxY = point.y; + if (point.x < minX) { + minX = point.x; + } + if (point.x > maxX) { + maxX = point.x; + } + if (point.y < minY) { + minY = point.y; + } + if (point.y > maxY) { + maxY = point.y; + } return new ExportRectangle(minX, minY, maxX, maxY); } - + public void translate(double x, double y) { translateX += x; translateY += y; 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 daea6dc9a..c0df3cc36 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -67,7 +67,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } private HilightedText getHilightedText(ExportMode exportMode) { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); abc.bodies[bodyIndex].code.toASMSource(abc.constants, trait, abc.method_info[abc.bodies[bodyIndex].method_info], abc.bodies[bodyIndex], exportMode, writer); return new HilightedText(writer); } @@ -93,7 +93,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } else { setContentType("text/plain"); if (textHexOnly == null) { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); Helper.byteArrayToHexWithHeader(writer, abc.bodies[bodyIndex].code.getBytes()); textHexOnly = new HilightedText(writer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index b9ec38f04..41ddb20af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -446,7 +446,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL } if (!cache.contains(scriptLeaf)) { boolean parallel = Configuration.parallelSpeedUp.get(); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); scriptLeaf.toSource(writer, abcList, script.traits.traits, ExportMode.SOURCE, parallel); hilightedCode = new HilightedText(writer); cache.put(scriptLeaf, new CachedDecompilation(hilightedCode)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java index 1657b4461..a5bdbaf0c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java @@ -93,7 +93,7 @@ public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail { public void load(TraitSlotConst trait, ABC abc, boolean isStatic) { this.abc = abc; this.trait = trait; - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); writer.appendNoHilight("trait "); writer.hilightSpecial(abc.constants.multinameToString(trait.name_index), "traitname"); writer.appendNoHilight(" "); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java index 8c262f7b1..c75abcc84 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java @@ -90,12 +90,12 @@ public class TraitsListItem { try { if ((type != Type.INITIALIZER) && isStatic) { abc.class_info[classIndex].static_traits.traits[index].convertHeader(null, "", abcTags, abc, true, ExportMode.SOURCE, scriptIndex, classIndex, new NulWriter(), new ArrayList(), false); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); abc.class_info[classIndex].static_traits.traits[index].toStringHeader(null, "", abcTags, abc, true, ExportMode.SOURCE, scriptIndex, classIndex, writer, new ArrayList(), false); s = writer.toString(); } else if ((type != Type.INITIALIZER) && (!isStatic)) { abc.instance_info[classIndex].instance_traits.traits[index].convertHeader(null, "", abcTags, abc, false, ExportMode.SOURCE, scriptIndex, classIndex, new NulWriter(), new ArrayList(), false); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); abc.instance_info[classIndex].instance_traits.traits[index].toStringHeader(null, "", abcTags, abc, false, ExportMode.SOURCE, scriptIndex, classIndex, writer, new ArrayList(), false); s = writer.toString(); } else if (!isStatic) { 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 f5367d024..800eac78c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -189,7 +189,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene if (actions == null) { actions = src.getActions(SWF.DEFAULT_VERSION); } - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); Action.actionsToSource(src, actions, SWF.DEFAULT_VERSION, src.toString()/*FIXME?*/, writer); List hilights = writer.instructionHilights; String srcNoHex = writer.toString(); @@ -309,7 +309,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene ASMSource asm = (ASMSource) src; DisassemblyListener listener = getDisassemblyListener(); asm.addDisassemblyListener(listener); - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); try { asm.getASMSource(SWF.DEFAULT_VERSION, exportMode, writer, lastCode); } catch (InterruptedException ex) { @@ -334,7 +334,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene } } else { if (srcHexOnly == null) { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),true); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); Helper.byteArrayToHexWithHeader(writer, src.getActionBytes()); srcHexOnly = new HilightedText(writer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java b/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java index 7629821d5..28acc5665 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.helpers; /** @@ -22,7 +21,8 @@ package com.jpexs.decompiler.flash.helpers; * @author JPEXS */ public class CodeFormatting { - public String newLineChars = "\r\n"; - public String indentString = " "; - public boolean beginBlockOnNewLine = true; + + public String newLineChars = "\r\n"; + public String indentString = " "; + public boolean beginBlockOnNewLine = true; } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java index 1d031a63c..6956da598 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/FileTextWriter.java @@ -36,7 +36,7 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable { private int indent; private int writtenBytes; - public FileTextWriter(CodeFormatting formatting,FileOutputStream fos) { + public FileTextWriter(CodeFormatting formatting, FileOutputStream fos) { super(formatting); this.writer = new BufferedWriter(new Utf8OutputStreamWriter(fos)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java index 154432c78..1071c62d4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java @@ -29,13 +29,13 @@ public class GraphTextWriter { protected long suspendTime; protected CodeFormatting formatting; - public CodeFormatting getFormatting() { - return formatting; - } - + public CodeFormatting getFormatting() { + return formatting; + } + public GraphTextWriter(CodeFormatting formatting) { - startTime = System.currentTimeMillis(); - this.formatting = formatting; + startTime = System.currentTimeMillis(); + this.formatting = formatting; } public boolean getIsHighlighted() { @@ -164,24 +164,24 @@ public class GraphTextWriter { public String toString() { return ""; } - + public GraphTextWriter startBlock(String opening) { - if(formatting.beginBlockOnNewLine){ + if (formatting.beginBlockOnNewLine) { newLine(); - }else{ + } else { append(" "); - } + } return append(opening).newLine().indent(); } - + public GraphTextWriter startBlock() { return startBlock("{"); } - + public GraphTextWriter endBlock(String closing) { return unindent().append(closing); } - + public GraphTextWriter endBlock() { return endBlock("}"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java index 070c90034..39d840524 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/HilightedTextWriter.java @@ -48,12 +48,12 @@ public class HilightedTextWriter extends GraphTextWriter { public List instructionHilights = new ArrayList<>(); public List specialHilights = new ArrayList<>(); - public HilightedTextWriter(CodeFormatting formatting,boolean hilight) { + public HilightedTextWriter(CodeFormatting formatting, boolean hilight) { super(formatting); this.hilight = hilight; } - public HilightedTextWriter(CodeFormatting formatting,boolean hilight, int indent) { + public HilightedTextWriter(CodeFormatting formatting, boolean hilight, int indent) { super(formatting); this.hilight = hilight; this.indent = indent; diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java index f78a1b528..39df879b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/NulWriter.java @@ -30,7 +30,7 @@ public class NulWriter extends GraphTextWriter { private boolean stringAdded = false; public NulWriter() { - super(new CodeFormatting()); + super(new CodeFormatting()); } public void startLoop(long loopId, int loopType) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index 98ac17f01..8fddf521e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -44,7 +44,7 @@ public class CSMTextSettingsTag extends Tag { public int gridFit; @Reserved - @SWFType(value = BasicType.UB, count=3) + @SWFType(value = BasicType.UB, count = 3) public int reserved; @SWFType(value = BasicType.FLOAT) //F32 = FLOAT diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index c7ea1d2a8..a1ca80a1e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -285,7 +285,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded visited.push(buttonId); SWF.frameToImage(buttonId, maxDepth, layers, new Color(0, 0, 0, 0), characters, 1, tags, tags, displayRect, visited, image, transformation); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { RECT r = getRect(characters, visited); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index 86329d07b..81a11ac2e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -309,7 +309,7 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT SWF.frameToImage(buttonId, maxDepth, layers, new Color(0, 0, 0, 0), characters, 1, tags, tags, displayRect, visited, image, transformation); visited.pop(); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { RECT r = getRect(characters, visited); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java index c826bcfc6..8d4ec86a6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java @@ -34,7 +34,7 @@ public class DefineFont4Tag extends CharacterTag { public int fontID; @Reserved - @SWFType(value = BasicType.UB, count=5) + @SWFType(value = BasicType.UB, count = 5) public int reserved; public boolean fontFlagsHasFontData; public boolean fontFlagsItalic; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index 975cb4a7b..be8d15c56 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -40,7 +40,7 @@ public class DefineFontAlignZonesTag extends Tag { @Reserved @SWFType(value = BasicType.UB, count = 6) public int reserved; - @SWFArray(value="zone",countField = "glyphCount") + @SWFArray(value = "zone", countField = "glyphCount") public List zoneTable; public static final int ID = 73; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 4a6ef0516..031871a20 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -67,7 +67,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo public RECT startEdgeBounds; public RECT endEdgeBounds; @Reserved - @SWFType(value = BasicType.UB, count=6) + @SWFType(value = BasicType.UB, count = 6) public int reserved; public boolean usesNonScalingStrokes; public boolean usesScalingStrokes; @@ -205,10 +205,10 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo int startPosX = 0, startPosY = 0; int endPosX = 0, endPosY = 0; int posX = 0, posY = 0; - + for (int startIndex = 0, endIndex = 0; - startIndex < startEdges.shapeRecords.size() && - endIndex < endEdges.shapeRecords.size(); startIndex++, endIndex++) { + startIndex < startEdges.shapeRecords.size() + && endIndex < endEdges.shapeRecords.size(); startIndex++, endIndex++) { SHAPERECORD edge1 = startEdges.shapeRecords.get(startIndex); SHAPERECORD edge2 = endEdges.shapeRecords.get(endIndex); @@ -314,7 +314,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo shape.shapeRecords = finalRecords; return shape; } - + @Override public SerializableImage toImage(int frame, List tags, Map characters, Stack visited, Matrix transformation) { throw new Error("this overload of toImage call is not supported on BoundedTag"); @@ -329,7 +329,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo // recreated BitmapExporter.exportTo(swf, shape, null, image, transformation); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { return new Point( diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index 9b111d98f..e9351dcd3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -188,10 +188,10 @@ public class DefineMorphShapeTag extends CharacterTag implements BoundedTag, Mor int startPosX = 0, startPosY = 0; int endPosX = 0, endPosY = 0; int posX = 0, posY = 0; - + for (int startIndex = 0, endIndex = 0; - startIndex < startEdges.shapeRecords.size() && - endIndex < endEdges.shapeRecords.size(); startIndex++, endIndex++) { + startIndex < startEdges.shapeRecords.size() + && endIndex < endEdges.shapeRecords.size(); startIndex++, endIndex++) { SHAPERECORD edge1 = startEdges.shapeRecords.get(startIndex); SHAPERECORD edge2 = endEdges.shapeRecords.get(endIndex); @@ -297,7 +297,7 @@ public class DefineMorphShapeTag extends CharacterTag implements BoundedTag, Mor shape.shapeRecords = finalRecords; return shape; } - + @Override public SerializableImage toImage(int frame, List tags, Map characters, Stack visited, Matrix transformation) { throw new Error("this overload of toImage call is not supported on BoundedTag"); @@ -312,7 +312,7 @@ public class DefineMorphShapeTag extends CharacterTag implements BoundedTag, Mor // recreated BitmapExporter.exportTo(swf, shape, null, image, transformation); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { return new Point( diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java index 1327df322..bb52b92d5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java @@ -34,14 +34,14 @@ import java.io.OutputStream; */ public class DefineSceneAndFrameLabelDataTag extends Tag { - @SWFType(value=BasicType.EncodedU32) - @SWFArray(value="offset",countField="sceneCount") + @SWFType(value = BasicType.EncodedU32) + @SWFArray(value = "offset", countField = "sceneCount") public long[] sceneOffsets; - @SWFArray(value="name",countField="sceneCount") + @SWFArray(value = "name", countField = "sceneCount") public String[] sceneNames; - @SWFType(value=BasicType.EncodedU32) - @SWFArray(value="frameNum", countField="frameLabelCount") + @SWFType(value = BasicType.EncodedU32) + @SWFArray(value = "frameNum", countField = "frameLabelCount") public long[] frameNums; @SWFArray(countField = "frameLabelCount") diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java index 152616e58..53a73bf52 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java @@ -80,7 +80,7 @@ public class DefineShape2Tag extends CharacterTag implements ShapeTag { public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { BitmapExporter.exportTo(swf, getShapes(), null, image, transformation); } - + @Override public int getCharacterId() { return shapeId; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java index 04f55f056..a7fdcd85f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java @@ -85,7 +85,7 @@ public class DefineShape3Tag extends CharacterTag implements ShapeTag { public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { BitmapExporter.exportTo(swf, getShapes(), null, image, transformation); } - + @Override public int getCharacterId() { return shapeId; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index b04d9856c..7e551a11f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -88,7 +88,7 @@ public class DefineShape4Tag extends CharacterTag implements ShapeTag { public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { BitmapExporter.exportTo(swf, getShapes(), null, image, transformation); } - + @Override public int getCharacterId() { return shapeId; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index a4996e969..43692f327 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -114,7 +114,7 @@ public class DefineShapeTag extends CharacterTag implements ShapeTag { public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { BitmapExporter.exportTo(swf, getShapes(), null, image, transformation); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { return new Point(shapeBounds.Xmin / SWF.unitDivisor, shapeBounds.Ymin / SWF.unitDivisor); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index e4fdb5e00..ca1bb24a1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -299,7 +299,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT SWF.frameToImage(spriteId, frame, tags, subTags, rect, frameCount, visited, image, transformation); visited.pop(); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { //RECT displayRect = getRect(characters, visited); //use visited diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 0dac13c15..642984fca 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -500,7 +500,7 @@ public class DefineText2Tag extends TextTag implements DrawableTag { public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { staticTextToImage(swf, characters, textRecords, 2, image, getTextMatrix(), transformation); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { return new Point(textBounds.Xmin / 20, textBounds.Ymin / 20); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 53774cab8..a79fa839d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -516,7 +516,7 @@ public class DefineTextTag extends TextTag implements DrawableTag { public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { staticTextToImage(swf, characters, textRecords, 1, image, getTextMatrix(), transformation); } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { return new Point(textBounds.Xmin / SWF.unitDivisor, textBounds.Ymin / SWF.unitDivisor); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java index 6aad7e22f..7589b63b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java @@ -40,17 +40,17 @@ public class ExportAssetsTag extends Tag { * HashMap with assets */ @SWFType(value = BasicType.UI16) - @SWFArray(value="tag",countField = "count") + @SWFArray(value = "tag", countField = "count") public List tags; - - @SWFArray(value="name",countField = "count") + + @SWFArray(value = "name", countField = "count") public List names; public static final int ID = 56; public ExportAssetsTag() { super(null, ID, "ExportAssets", new byte[]{}, 0); tags = new ArrayList<>(); - names = new ArrayList<>(); + names = new ArrayList<>(); } /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java index 00cff8512..60929136f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java @@ -50,10 +50,10 @@ public class ImportAssets2Tag extends Tag implements ImportTag { /** * HashMap with assets */ - @SWFType(value=BasicType.UI16) - @SWFArray(value="tag",countField = "count") + @SWFType(value = BasicType.UI16) + @SWFArray(value = "tag", countField = "count") public List tags; - @SWFArray(value="name",countField = "count") + @SWFArray(value = "name", countField = "count") public List names; public static final int ID = 71; @@ -99,7 +99,7 @@ public class ImportAssets2Tag extends Tag implements ImportTag { sos.writeUI8(reserved1); sos.writeUI8(reserved2); sos.writeUI16(tags.size()); - for (int i=0;i tags; - @SWFArray(value="name",countField = "count") + @SWFArray(value = "name", countField = "count") public List names; public static final int ID = 57; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java index bbb356d42..0a7a2bfb8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java @@ -71,7 +71,7 @@ public class ProtectTag extends Tag { SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); if (sis.available() > 0) { passwordHash = sis.readString(); - }else{ + } else { passwordHash = ""; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java index 88c3cde4c..0df081992 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java @@ -29,10 +29,10 @@ import java.io.OutputStream; public class SymbolClassTag extends Tag { - @SWFType(value=BasicType.UI16) - @SWFArray(value="tag",countField = "numSymbols") + @SWFType(value = BasicType.UI16) + @SWFArray(value = "tag", countField = "numSymbols") public int[] tags; - @SWFArray(value="name",countField = "numSymbols") + @SWFArray(value = "name", countField = "numSymbols") public String[] names; public static final int ID = 76; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java index 82bdf0b65..0caa089e5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -62,7 +62,7 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ private final long pos; protected String name; @Internal - public Tag previousTag; + public Tag previousTag; @Internal protected transient SWF swf; @Internal 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 b085d31e3..8e7eefe3e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java @@ -61,10 +61,10 @@ public abstract class CharacterIdTag extends Tag { if (className != null) { nameAppend = ": " + className; } - if(getCharacterId()!=-1) { + if (getCharacterId() != -1) { return super.getName() + " (" + getCharacterId() + nameAppend + ")"; } - if(!nameAppend.equals("")){ + if (!nameAppend.equals("")) { return super.getName() + " (" + nameAppend + ")"; } return super.getName(); 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 40ef2cd5d..8169acf06 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -252,9 +252,9 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable @Override public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { - + } - + @Override public Point getImagePos(int frame, Map characters, Stack visited) { return new Point(0, 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ImportTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ImportTag.java index 40a96cf27..1fcfe63b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ImportTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ImportTag.java @@ -25,6 +25,6 @@ import java.util.Map; public interface ImportTag { public String getUrl(); - + public Map getAssets(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index d81270a92..301f644ac 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -224,7 +224,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag { } double rat = textHeight / 1024.0 / font.getDivider(); - + for (GLYPHENTRY entry : rec.glyphEntries) { Matrix mat = transformation.clone(); mat = mat.concatenate(new Matrix(textMatrix)); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java b/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java index d16ff1ef8..9f5f7a27a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java @@ -371,6 +371,7 @@ public final class TextLexer { /** * Closes the input stream. + * * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { @@ -406,7 +407,8 @@ public final class TextLexer { /** * Returns the current lexical state. - * @return + * + * @return */ public final int yystate() { return zzLexicalState; @@ -423,7 +425,8 @@ public final class TextLexer { /** * Returns the text matched by the current regular expression. - * @return + * + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -445,7 +448,8 @@ public final class TextLexer { /** * Returns the length of the matched text region. - * @return + * + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; diff --git a/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java index 43e523b16..4a9fe86cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java @@ -138,7 +138,7 @@ public class TagNode extends ContainerNode { File file = new File(f); ASMSource asm = ((ASMSource) node.item); - try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(),new FileOutputStream(f))) { + try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(f))) { if (exportMode == ExportMode.HEX) { asm.getActionSourcePrefix(writer); asm.getActionBytesAsHex(writer); diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java b/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java index 73af496ed..d30871728 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java @@ -56,13 +56,15 @@ public class ARGB implements Serializable { public Color toColor() { return new Color(red, green, blue, alpha); } - public ARGB(){ - + + public ARGB() { + } + public ARGB(Color color) { this.alpha = color.getAlpha(); this.red = color.getRed(); this.green = color.getGreen(); - this.blue = color.getBlue(); + this.blue = color.getBlue(); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java index 9e73be994..bab53f24b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java @@ -121,7 +121,7 @@ public class CLIPEVENTFLAGS implements Serializable { */ @Conditional(minSwfVersion = 6) public boolean clipEventDragOut = false; - + @Reserved @SWFType(value = BasicType.UB, count = 8) @Conditional(minSwfVersion = 6) diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java index 3440b57a4..6c1dd46dd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java @@ -27,7 +27,7 @@ import java.util.Set; * * @author JPEXS */ -public class MORPHFILLSTYLE implements NeedsCharacters,Serializable { +public class MORPHFILLSTYLE implements NeedsCharacters, Serializable { @SWFType(BasicType.UI8) public int fillStyleType; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLEARRAY.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLEARRAY.java index ecba1d03e..d7f731c82 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLEARRAY.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLEARRAY.java @@ -25,7 +25,7 @@ import java.util.Set; * * @author JPEXS */ -public class MORPHFILLSTYLEARRAY implements NeedsCharacters,Serializable { +public class MORPHFILLSTYLEARRAY implements NeedsCharacters, Serializable { public MORPHFILLSTYLE[] fillStyles; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java b/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java index fc6820864..4c14339c9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java @@ -25,7 +25,7 @@ import java.io.Serializable; * * @author JPEXS */ -public class RGBA extends RGB implements Serializable{ +public class RGBA extends RGB implements Serializable { /** * Alpha value defining opacity diff --git a/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java b/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java index 45e58a2ce..d6aabe50a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java @@ -28,7 +28,7 @@ import java.util.Set; * * @author JPEXS */ -public class SHAPE implements NeedsCharacters,Serializable { +public class SHAPE implements NeedsCharacters, Serializable { @SWFType(value = BasicType.UB, count = 4) public int numFillBits; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java b/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java index 5294f5dd0..39b93be6d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java @@ -24,7 +24,7 @@ import java.io.Serializable; * * @author JPEXS */ -public class ZONEDATA implements Serializable{ +public class ZONEDATA implements Serializable { @SWFType(BasicType.FLOAT16) public int alignmentCoordinate; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java index 293abea10..11eacf070 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ZONERECORD.java @@ -24,9 +24,9 @@ import java.io.Serializable; * * @author JPEXS */ -public class ZONERECORD implements Serializable{ +public class ZONERECORD implements Serializable { - @SWFArray(value="zone",countField = "numZoneData") + @SWFArray(value = "zone", countField = "numZoneData") public ZONEDATA[] zonedata = new ZONEDATA[0]; public boolean zoneMaskX; public boolean zoneMaskY; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java index 735282ce1..68df7734a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.types.annotations; /** @@ -23,5 +22,5 @@ package com.jpexs.decompiler.flash.types.annotations; * @author JPEXS */ public @interface Multiline { - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java index 0e397911b..4f09c4fd9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java @@ -101,13 +101,13 @@ public class ConditionEvaluator { try { expression(fields, stack, lex); } catch (IOException | EmptyStackException ex) { - throw new ParseException("Invalid condition:"+prepareCond(), lex.yyline()); + throw new ParseException("Invalid condition:" + prepareCond(), lex.yyline()); } - if(prepareCond().equals("")){ + if (prepareCond().equals("")) { return true; } if (stack.size() != 1) { - throw new ParseException("Invalid condition:"+prepareCond(), lex.yyline()); + throw new ParseException("Invalid condition:" + prepareCond(), lex.yyline()); } return stack.pop(); @@ -136,7 +136,7 @@ public class ConditionEvaluator { } } } catch (IOException ex) { - throw new ParseException("Invalid condition:"+prepareCond(), lex.yyline()); + throw new ParseException("Invalid condition:" + prepareCond(), lex.yyline()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionLexer.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionLexer.java index 8c4427bc7..39401d06f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionLexer.java @@ -20,224 +20,264 @@ package com.jpexs.decompiler.flash.types.annotations.parser; import java.util.Stack; - /** - * This class is a scanner generated by - * JFlex 1.5.0-SNAPSHOT - * from the specification file D:/Dropbox/Programovani/JavaSE/FFDec/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/conditions.flex + * This class is a scanner generated by + * JFlex 1.5.0-SNAPSHOT from the + * specification file + * D:/Dropbox/Programovani/JavaSE/FFDec/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/conditions.flex */ public final class ConditionLexer { - /** This character denotes the end of file */ - public static final int YYEOF = -1; + /** + * This character denotes the end of file + */ + public static final int YYEOF = -1; - /** initial size of the lookahead buffer */ - private static final int ZZ_BUFFERSIZE = 16384; + /** + * initial size of the lookahead buffer + */ + private static final int ZZ_BUFFERSIZE = 16384; - /** lexical states */ - public static final int YYINITIAL = 0; + /** + * lexical states + */ + public static final int YYINITIAL = 0; - /** - * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l - * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l - * at the beginning of a line - * l is of the form l = 2*k, k a non negative integer - */ - private static final int ZZ_LEXSTATE[] = { - 0, 0 - }; + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l at the + * beginning of a line l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0 + }; - /** - * Translates characters to character classes - */ - private static final String ZZ_CMAP_PACKED = - "\12\0\1\10\1\10\1\10\1\10\23\0\1\5\4\0\1\3\1\0"+ - "\1\6\1\7\2\0\1\4\1\0\1\1\1\0\12\1\7\0\32\1"+ - "\4\0\1\1\1\0\32\1\1\0\1\2\10\0\1\10\u1fa2\0\1\10"+ - "\1\10\udfd6\0"; + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED + = "\12\0\1\10\1\10\1\10\1\10\23\0\1\5\4\0\1\3\1\0" + + "\1\6\1\7\2\0\1\4\1\0\1\1\1\0\12\1\7\0\32\1" + + "\4\0\1\1\1\0\32\1\1\0\1\2\10\0\1\10\u1fa2\0\1\10" + + "\1\10\udfd6\0"; - /** - * Translates characters to character classes - */ - private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + /** + * Translates characters to character classes + */ + private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); - /** - * Translates DFA states to action switch labels. - */ - private static final int [] ZZ_ACTION = zzUnpackAction(); + /** + * Translates DFA states to action switch labels. + */ + private static final int[] ZZ_ACTION = zzUnpackAction(); - private static final String ZZ_ACTION_PACKED_0 = - "\1\0\1\1\1\2\1\3\2\4\1\5\1\6\1\7"+ - "\1\3"; + private static final String ZZ_ACTION_PACKED_0 + = "\1\0\1\1\1\2\1\3\2\4\1\5\1\6\1\7" + + "\1\3"; - private static int [] zzUnpackAction() { - int [] result = new int[10]; - int offset = 0; - offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackAction(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int count = packed.charAt(i++); - int value = packed.charAt(i++); - do result[j++] = value; while (--count > 0); + private static int[] zzUnpackAction() { + int[] result = new int[10]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; } - return j; - } + private static int zzUnpackAction(String packed, int offset, int[] result) { + int i = 0; /* index in packed string */ - /** - * Translates a state to a row index in the transition table - */ - private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + int j = offset; /* index in unpacked array */ - private static final String ZZ_ROWMAP_PACKED_0 = - "\0\0\0\11\0\22\0\33\0\44\0\11\0\11\0\11"+ - "\0\11\0\11"; - - private static int [] zzUnpackRowMap() { - int [] result = new int[10]; - int offset = 0; - offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackRowMap(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int high = packed.charAt(i++) << 16; - result[j++] = high | packed.charAt(i++); + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; } - return j; - } - /** - * The transition table of the DFA - */ - private static final int [] ZZ_TRANS = zzUnpackTrans(); + /** + * Translates a state to a row index in the transition table + */ + private static final int[] ZZ_ROWMAP = zzUnpackRowMap(); - private static final String ZZ_TRANS_PACKED_0 = - "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11"+ - "\13\0\1\3\11\0\1\12\11\0\1\6\5\0"; + private static final String ZZ_ROWMAP_PACKED_0 + = "\0\0\0\11\0\22\0\33\0\44\0\11\0\11\0\11" + + "\0\11\0\11"; - private static int [] zzUnpackTrans() { - int [] result = new int[45]; - int offset = 0; - offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackTrans(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int count = packed.charAt(i++); - int value = packed.charAt(i++); - value--; - do result[j++] = value; while (--count > 0); + private static int[] zzUnpackRowMap() { + int[] result = new int[10]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; } - return j; - } + private static int zzUnpackRowMap(String packed, int offset, int[] result) { + int i = 0; /* index in packed string */ - /* error codes */ - private static final int ZZ_UNKNOWN_ERROR = 0; - private static final int ZZ_NO_MATCH = 1; - private static final int ZZ_PUSHBACK_2BIG = 2; + int j = offset; /* index in unpacked array */ - /* error messages for the codes above */ - private static final String ZZ_ERROR_MSG[] = { - "Unkown internal scanner error", - "Error: could not match input", - "Error: pushback value was too large" - }; - - /** - * ZZ_ATTRIBUTE[aState] contains the attributes of state aState - */ - private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); - - private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\1\0\1\11\3\1\5\11"; - - private static int [] zzUnpackAttribute() { - int [] result = new int[10]; - int offset = 0; - offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackAttribute(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int count = packed.charAt(i++); - int value = packed.charAt(i++); - do result[j++] = value; while (--count > 0); + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; } - return j; - } - /** the input device */ - private java.io.Reader zzReader; + /** + * The transition table of the DFA + */ + private static final int[] ZZ_TRANS = zzUnpackTrans(); - /** the current state of the DFA */ - private int zzState; + private static final String ZZ_TRANS_PACKED_0 + = "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11" + + "\13\0\1\3\11\0\1\12\11\0\1\6\5\0"; - /** the current lexical state */ - private int zzLexicalState = YYINITIAL; + private static int[] zzUnpackTrans() { + int[] result = new int[45]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } - /** this buffer contains the current text to be matched and is - the source of the yytext() string */ - private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + private static int zzUnpackTrans(String packed, int offset, int[] result) { + int i = 0; /* index in packed string */ - /** the textposition at the last accepting state */ - private int zzMarkedPos; + int j = offset; /* index in unpacked array */ - /** the current text position in the buffer */ - private int zzCurrentPos; - - /** startRead marks the beginning of the yytext() string in the buffer */ - private int zzStartRead; - - /** endRead marks the last character in the buffer, that has been read - from input */ - private int zzEndRead; - - /** number of newlines encountered up to the start of the matched text */ - private int yyline; - - /** the number of characters up to the start of the matched text */ - private int yychar; - - /** - * the number of characters from the last newline up to the start of the - * matched text - */ - private int yycolumn; - - /** - * zzAtBOL == true <=> the scanner is currently at the beginning of a line - */ - private boolean zzAtBOL = true; - - /** zzAtEOF == true <=> the scanner is at the EOF */ - private boolean zzAtEOF; - - /** denotes if the user-EOF-code has already been executed */ - private boolean zzEOFDone; - - /* user code: */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 + = "\1\0\1\11\3\1\5\11"; + + private static int[] zzUnpackAttribute() { + int[] result = new int[10]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int[] result) { + int i = 0; /* index in packed string */ + + int j = offset; /* index in unpacked array */ + + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + /** + * the input device + */ + private java.io.Reader zzReader; + + /** + * the current state of the DFA + */ + private int zzState; + + /** + * the current lexical state + */ + private int zzLexicalState = YYINITIAL; + + /** + * this buffer contains the current text to be matched and is the source of + * the yytext() string + */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** + * the textposition at the last accepting state + */ + private int zzMarkedPos; + + /** + * the current text position in the buffer + */ + private int zzCurrentPos; + + /** + * startRead marks the beginning of the yytext() string in the buffer + */ + private int zzStartRead; + + /** + * endRead marks the last character in the buffer, that has been read from + * input + */ + private int zzEndRead; + + /** + * number of newlines encountered up to the start of the matched text + */ + private int yyline; + + /** + * the number of characters up to the start of the matched text + */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** + * zzAtEOF == true <=> the scanner is at the EOF + */ + private boolean zzAtEOF; + + /** + * denotes if the user-EOF-code has already been executed + */ + private boolean zzEOFDone; + + /* user code: */ /** * Create an empty lexer, yyrset will be called later to reset and assign * the reader @@ -251,439 +291,446 @@ public final class ConditionLexer { } public int yyline() { - return yyline+1; + return yyline + 1; } - private final Stack pushedBack=new Stack<>(); + private final Stack pushedBack = new Stack<>(); public void pushback(ConditionToken symb) { pushedBack.push(symb); } - public ConditionToken lex() throws java.io.IOException, ParseException{ - ConditionToken ret=null; - if(!pushedBack.isEmpty()){ + public ConditionToken lex() throws java.io.IOException, ParseException { + ConditionToken ret = null; + if (!pushedBack.isEmpty()) { ret = pushedBack.pop(); - }else{ + } else { ret = yylex(); } return ret; } - - - /** - * Creates a new scanner - * There is also a java.io.InputStream version of this constructor. - * - * @param in the java.io.Reader to read input from. - */ - public ConditionLexer(java.io.Reader in) { - this.zzReader = in; - } - - /** - * Creates a new scanner. - * There is also java.io.Reader version of this constructor. - * - * @param in the java.io.Inputstream to read input from. - */ - public ConditionLexer(java.io.InputStream in) { - this(new java.io.InputStreamReader - (in, java.nio.charset.Charset.forName("UTF-8"))); - } - - /** - * Unpacks the compressed character translation table. - * - * @param packed the packed character translation table - * @return the unpacked character translation table - */ - private static char [] zzUnpackCMap(String packed) { - char [] map = new char[0x10000]; - int i = 0; /* index in packed string */ - int j = 0; /* index in unpacked array */ - while (i < 64) { - int count = packed.charAt(i++); - char value = packed.charAt(i++); - do map[j++] = value; while (--count > 0); - } - return map; - } - - - /** - * Refills the input buffer. - * - * @return false, iff there was new input. - * - * @exception java.io.IOException if any I/O-Error occurs - */ - private boolean zzRefill() throws java.io.IOException { - - /* first: make room (if you can) */ - if (zzStartRead > 0) { - System.arraycopy(zzBuffer, zzStartRead, - zzBuffer, 0, - zzEndRead-zzStartRead); - - /* translate stored positions */ - zzEndRead-= zzStartRead; - zzCurrentPos-= zzStartRead; - zzMarkedPos-= zzStartRead; - zzStartRead = 0; + /** + * Creates a new scanner There is also a java.io.InputStream version of this + * constructor. + * + * @param in the java.io.Reader to read input from. + */ + public ConditionLexer(java.io.Reader in) { + this.zzReader = in; } - /* is the buffer big enough? */ - if (zzCurrentPos >= zzBuffer.length) { - /* if not: blow it up */ - char newBuffer[] = new char[zzCurrentPos*2]; - System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); - zzBuffer = newBuffer; + /** + * Creates a new scanner. There is also java.io.Reader version of this + * constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public ConditionLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in, java.nio.charset.Charset.forName("UTF-8"))); } - /* finally: fill the buffer with new input */ - int numRead = zzReader.read(zzBuffer, zzEndRead, - zzBuffer.length-zzEndRead); + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char[] zzUnpackCMap(String packed) { + char[] map = new char[0x10000]; + int i = 0; /* index in packed string */ - if (numRead > 0) { - zzEndRead+= numRead; - return false; + int j = 0; /* index in unpacked array */ + + while (i < 64) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do { + map[j++] = value; + } while (--count > 0); + } + return map; } - // unlikely but not impossible: read 0 characters, but not at end of stream - if (numRead == 0) { - int c = zzReader.read(); - if (c == -1) { + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead - zzStartRead); + + /* translate stored positions */ + zzEndRead -= zzStartRead; + zzCurrentPos -= zzStartRead; + zzMarkedPos -= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos * 2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length - zzEndRead); + + if (numRead > 0) { + zzEndRead += numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 return true; - } else { - zzBuffer[zzEndRead++] = (char) c; - return false; - } } - // numRead < 0 - return true; - } - - - /** - * Closes the input stream. + /** + * Closes the input stream. + * * @throws java.io.IOException - */ - public final void yyclose() throws java.io.IOException { - zzAtEOF = true; /* indicate end of file */ - zzEndRead = zzStartRead; /* invalidate buffer */ + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ - if (zzReader != null) - zzReader.close(); - } + zzEndRead = zzStartRead; /* invalidate buffer */ - - /** - * Resets the scanner to read from a new input stream. - * Does not close the old reader. - * - * All internal variables are reset, the old input stream - * cannot be reused (internal buffer is discarded and lost). - * Lexical state is set to ZZ_INITIAL. - * - * Internal scan buffer is resized down to its initial length, if it has grown. - * - * @param reader the new input stream - */ - public final void yyreset(java.io.Reader reader) { - zzReader = reader; - zzAtBOL = true; - zzAtEOF = false; - zzEOFDone = false; - zzEndRead = zzStartRead = 0; - zzCurrentPos = zzMarkedPos = 0; - yyline = yychar = yycolumn = 0; - zzLexicalState = YYINITIAL; - if (zzBuffer.length > ZZ_BUFFERSIZE) - zzBuffer = new char[ZZ_BUFFERSIZE]; - } - - - /** - * Returns the current lexical state. - * @return - */ - public final int yystate() { - return zzLexicalState; - } - - - /** - * Enters a new lexical state - * - * @param newState the new lexical state - */ - public final void yybegin(int newState) { - zzLexicalState = newState; - } - - - /** - * Returns the text matched by the current regular expression. - * @return - */ - public final String yytext() { - return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); - } - - - /** - * Returns the character at position pos from the - * matched text. - * - * It is equivalent to yytext().charAt(pos), but faster - * - * @param pos the position of the character to fetch. - * A value from 0 to yylength()-1. - * - * @return the character at position pos - */ - public final char yycharat(int pos) { - return zzBuffer[zzStartRead+pos]; - } - - - /** - * Returns the length of the matched text region. - * @return - */ - public final int yylength() { - return zzMarkedPos-zzStartRead; - } - - - /** - * Reports an error that occured while scanning. - * - * In a wellformed scanner (no or only correct usage of - * yypushback(int) and a match-all fallback rule) this method - * will only be called with things that "Can't Possibly Happen". - * If this method is called, something is seriously wrong - * (e.g. a JFlex bug producing a faulty scanner etc.). - * - * Usual syntax/scanner level error handling should be done - * in error fallback rules. - * - * @param errorCode the code of the errormessage to display - */ - private void zzScanError(int errorCode) { - String message; - try { - message = ZZ_ERROR_MSG[errorCode]; - } - catch (ArrayIndexOutOfBoundsException e) { - message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + if (zzReader != null) { + zzReader.close(); + } } - throw new Error(message); - } - - - /** - * Pushes the specified amount of characters back into the input stream. - * - * They will be read again by then next call of the scanning method - * - * @param number the number of characters to be read again. - * This number must not be greater than yylength()! - */ - public void yypushback(int number) { - if ( number > yylength() ) - zzScanError(ZZ_PUSHBACK_2BIG); - - zzMarkedPos -= number; - } - - - /** - * Resumes scanning until the next regular expression is matched, - * the end of input is encountered or an I/O-Error occurs. - * - * @return the next token - * @exception java.io.IOException if any I/O-Error occurs - * @throws com.jpexs.decompiler.flash.types.annotations.parser.ParseException - */ - public ConditionToken yylex() throws java.io.IOException, ParseException { - int zzInput; - int zzAction; - - // cached fields: - int zzCurrentPosL; - int zzMarkedPosL; - int zzEndReadL = zzEndRead; - char [] zzBufferL = zzBuffer; - char [] zzCMapL = ZZ_CMAP; - - int [] zzTransL = ZZ_TRANS; - int [] zzRowMapL = ZZ_ROWMAP; - int [] zzAttrL = ZZ_ATTRIBUTE; - - while (true) { - zzMarkedPosL = zzMarkedPos; - - yychar+= zzMarkedPosL-zzStartRead; - - boolean zzR = false; - for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL; - zzCurrentPosL++) { - switch (zzBufferL[zzCurrentPosL]) { - case '\u000B': - case '\u000C': - case '\u0085': - case '\u2028': - case '\u2029': - yyline++; - yycolumn = 0; - zzR = false; - break; - case '\r': - yyline++; - yycolumn = 0; - zzR = true; - break; - case '\n': - if (zzR) - zzR = false; - else { - yyline++; - yycolumn = 0; - } - break; - default: - zzR = false; - yycolumn++; + /** + * Resets the scanner to read from a new input stream. Does not close the + * old reader. + * + * All internal variables are reset, the old input stream + * cannot be reused (internal buffer is discarded and lost). Lexical + * state is set to ZZ_INITIAL. + * + * Internal scan buffer is resized down to its initial length, if it has + * grown. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + if (zzBuffer.length > ZZ_BUFFERSIZE) { + zzBuffer = new char[ZZ_BUFFERSIZE]; } - } + } - if (zzR) { - // peek one character ahead if it is \n (if we have counted one line too much) - boolean zzPeek; - if (zzMarkedPosL < zzEndReadL) - zzPeek = zzBufferL[zzMarkedPosL] == '\n'; - else if (zzAtEOF) - zzPeek = false; - else { - boolean eof = zzRefill(); - zzEndReadL = zzEndRead; - zzMarkedPosL = zzMarkedPos; - zzBufferL = zzBuffer; - if (eof) - zzPeek = false; - else - zzPeek = zzBufferL[zzMarkedPosL] == '\n'; + /** + * Returns the current lexical state. + * + * @return + */ + public final int yystate() { + return zzLexicalState; + } + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + /** + * Returns the text matched by the current regular expression. + * + * @return + */ + public final String yytext() { + return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); + } + + /** + * Returns the character at position pos from the matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. A value from 0 to + * yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead + pos]; + } + + /** + * Returns the length of the matched text region. + * + * @return + */ + public final int yylength() { + return zzMarkedPos - zzStartRead; + } + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of yypushback(int) and + * a match-all fallback rule) this method will only be called with things + * that "Can't Possibly Happen". If this method is called, something is + * seriously wrong (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done in error + * fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } - if (zzPeek) yyline--; - } - zzAction = -1; - zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; - - zzState = ZZ_LEXSTATE[zzLexicalState]; + throw new Error(message); + } - // set up zzAction for empty match case: - int zzAttributes = zzAttrL[zzState]; - if ( (zzAttributes & 1) == 1 ) { - zzAction = zzState; - } + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. This number must + * not be greater than yylength()! + */ + public void yypushback(int number) { + if (number > yylength()) { + zzScanError(ZZ_PUSHBACK_2BIG); + } + zzMarkedPos -= number; + } + + /** + * Resumes scanning until the next regular expression is matched, the end of + * input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + * @throws + * com.jpexs.decompiler.flash.types.annotations.parser.ParseException + */ + public ConditionToken yylex() throws java.io.IOException, ParseException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char[] zzBufferL = zzBuffer; + char[] zzCMapL = ZZ_CMAP; + + int[] zzTransL = ZZ_TRANS; + int[] zzRowMapL = ZZ_ROWMAP; + int[] zzAttrL = ZZ_ATTRIBUTE; - zzForAction: { while (true) { - - if (zzCurrentPosL < zzEndReadL) - zzInput = zzBufferL[zzCurrentPosL++]; - else if (zzAtEOF) { - zzInput = YYEOF; - break zzForAction; - } - else { - // store back cached positions - zzCurrentPos = zzCurrentPosL; - zzMarkedPos = zzMarkedPosL; - boolean eof = zzRefill(); - // get translated positions and possibly new buffer - zzCurrentPosL = zzCurrentPos; - zzMarkedPosL = zzMarkedPos; - zzBufferL = zzBuffer; - zzEndReadL = zzEndRead; - if (eof) { - zzInput = YYEOF; - break zzForAction; - } - else { - zzInput = zzBufferL[zzCurrentPosL++]; - } - } - int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; - if (zzNext == -1) break zzForAction; - zzState = zzNext; + zzMarkedPosL = zzMarkedPos; - zzAttributes = zzAttrL[zzState]; - if ( (zzAttributes & 1) == 1 ) { - zzAction = zzState; - zzMarkedPosL = zzCurrentPosL; - if ( (zzAttributes & 8) == 8 ) break zzForAction; - } + yychar += zzMarkedPosL - zzStartRead; + boolean zzR = false; + for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL; + zzCurrentPosL++) { + switch (zzBufferL[zzCurrentPosL]) { + case '\u000B': + case '\u000C': + case '\u0085': + case '\u2028': + case '\u2029': + yyline++; + yycolumn = 0; + zzR = false; + break; + case '\r': + yyline++; + yycolumn = 0; + zzR = true; + break; + case '\n': + if (zzR) { + zzR = false; + } else { + yyline++; + yycolumn = 0; + } + break; + default: + zzR = false; + yycolumn++; + } + } + + if (zzR) { + // peek one character ahead if it is \n (if we have counted one line too much) + boolean zzPeek; + if (zzMarkedPosL < zzEndReadL) { + zzPeek = zzBufferL[zzMarkedPosL] == '\n'; + } else if (zzAtEOF) { + zzPeek = false; + } else { + boolean eof = zzRefill(); + zzEndReadL = zzEndRead; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + if (eof) { + zzPeek = false; + } else { + zzPeek = zzBufferL[zzMarkedPosL] == '\n'; + } + } + if (zzPeek) { + yyline--; + } + } + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + // set up zzAction for empty match case: + int zzAttributes = zzAttrL[zzState]; + if ((zzAttributes & 1) == 1) { + zzAction = zzState; + } + + zzForAction: + { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL[zzCurrentPosL++]; + } else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput]]; + if (zzNext == -1) { + break zzForAction; + } + zzState = zzNext; + + zzAttributes = zzAttrL[zzState]; + if ((zzAttributes & 1) == 1) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ((zzAttributes & 8) == 8) { + break zzForAction; + } + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 1: { + } + case 8: + break; + case 2: { + return new ConditionToken(ConditionTokenType.FIELD, yytext()); + } + case 9: + break; + case 3: { + return new ConditionToken(ConditionTokenType.OR, yytext()); + } + case 10: + break; + case 4: { + return new ConditionToken(ConditionTokenType.AND, yytext()); + } + case 11: + break; + case 5: { + return new ConditionToken(ConditionTokenType.NOT, yytext()); + } + case 12: + break; + case 6: { + return new ConditionToken(ConditionTokenType.PARENT_OPEN, yytext()); + } + case 13: + break; + case 7: { + return new ConditionToken(ConditionTokenType.PARENT_CLOSE, yytext()); + } + case 14: + break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + switch (zzLexicalState) { + case YYINITIAL: { + return null; + } + case 11: + break; + default: + return null; + } + } else { + zzScanError(ZZ_NO_MATCH); + } + } } - } - - // store back cached position - zzMarkedPos = zzMarkedPosL; - - switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { - case 1: - { - } - case 8: break; - case 2: - { return new ConditionToken(ConditionTokenType.FIELD,yytext()); - } - case 9: break; - case 3: - { return new ConditionToken(ConditionTokenType.OR,yytext()); - } - case 10: break; - case 4: - { return new ConditionToken(ConditionTokenType.AND,yytext()); - } - case 11: break; - case 5: - { return new ConditionToken(ConditionTokenType.NOT,yytext()); - } - case 12: break; - case 6: - { return new ConditionToken(ConditionTokenType.PARENT_OPEN,yytext()); - } - case 13: break; - case 7: - { return new ConditionToken(ConditionTokenType.PARENT_CLOSE,yytext()); - } - case 14: break; - default: - if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { - zzAtEOF = true; - switch (zzLexicalState) { - case YYINITIAL: { - return null; - } - case 11: break; - default: - return null; - } - } - else { - zzScanError(ZZ_NO_MATCH); - } - } } - } - } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionToken.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionToken.java index 6be92a5c1..8e8dcc3e7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionToken.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionToken.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.types.annotations.parser; /** @@ -22,19 +21,18 @@ package com.jpexs.decompiler.flash.types.annotations.parser; * @author JPEXS */ public class ConditionToken { + public String value; public ConditionTokenType type; - public ConditionToken(ConditionTokenType type,String value) { + public ConditionToken(ConditionTokenType type, String value) { this.value = value; this.type = type; } @Override public String toString() { - return type.toString()+(value!=null?"["+value+"]":""); + return type.toString() + (value != null ? "[" + value + "]" : ""); } - - - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionTokenType.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionTokenType.java index 4ff90dcd5..9dfc3f0c5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionTokenType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionTokenType.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.types.annotations.parser; /** @@ -22,6 +21,7 @@ package com.jpexs.decompiler.flash.types.annotations.parser; * @author JPEXS */ public enum ConditionTokenType { + FIELD, OR, AND, diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java index 253d4f25a..97f3d5b3d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java @@ -93,7 +93,8 @@ public final class BlendComposite implements Composite { /** * {@inheritDoc} - * @return + * + * @return */ @Override public int hashCode() { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java index e8dc1dbfd..6a1ac9685 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTBEVELFILTER.java @@ -39,7 +39,7 @@ public class GRADIENTBEVELFILTER extends FILTER { /** * Gradient ratios */ - @SWFType(value=BasicType.UI8,countField = "numColors") + @SWFType(value = BasicType.UI8, countField = "numColors") public int[] gradientRatio = new int[0]; /** * Horizontal blur amount diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java index 9fe5d3347..3a679d35f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/GRADIENTGLOWFILTER.java @@ -39,7 +39,7 @@ public class GRADIENTGLOWFILTER extends FILTER { /** * Gradient ratios */ - @SWFType(value=BasicType.UI8,countField = "numColors") + @SWFType(value = BasicType.UI8, countField = "numColors") public int[] gradientRatio; /** * Horizontal blur amount diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java index 73d93fa16..844e5b602 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java @@ -23,7 +23,7 @@ import java.io.Serializable; * * @author JPEXS */ -public class GLYPHIDX implements Serializable { +public class GLYPHIDX implements Serializable { public int indexInFont; public int indexInTexture; diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/FLAVersion.java b/trunk/src/com/jpexs/decompiler/flash/xfl/FLAVersion.java index cf6a8eaa6..3da6d14f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/FLAVersion.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/FLAVersion.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.xfl; import java.util.HashMap; @@ -25,43 +24,44 @@ import java.util.Map; * @author JPEXS */ public enum FLAVersion { - CS5("CS5","Flash CS 5","2.0",10), - CS5_5("CS5.5","Flash CS 5.5","2.1",11), - CS6("CS6","Flash CS 6","2.2",17), - CC("CC","Flash CC","2.4",Integer.MAX_VALUE){ - @Override - public int minASVersion() { - return 3; //AS 1/2 not supported anymore - } - - }; - + CS5("CS5", "Flash CS 5", "2.0", 10), + CS5_5("CS5.5", "Flash CS 5.5", "2.1", 11), + CS6("CS6", "Flash CS 6", "2.2", 17), + CC("CC", "Flash CC", "2.4", Integer.MAX_VALUE) { + + @Override + public int minASVersion() { + return 3; //AS 1/2 not supported anymore + } + + }; + private final String xflVersion; private final String shortName; private final String applicationName; private final int maxSwfVersion; - - private static final Map versionToPlayerMap=new HashMap<>(); - - static{ - versionToPlayerMap.put(10,"FlashPlayer10.0"); //10 & 10.1 - versionToPlayerMap.put(11,"FlashPlayer10.2"); - versionToPlayerMap.put(12,"FlashPlayer10.3"); - versionToPlayerMap.put(13,"FlashPlayer11.0"); - versionToPlayerMap.put(14,"FlashPlayer11.1"); - versionToPlayerMap.put(15,"FlashPlayer11.2"); - versionToPlayerMap.put(16,"FlashPlayer11.3"); - versionToPlayerMap.put(17,"FlashPlayer11.4"); - versionToPlayerMap.put(18,"FlashPlayer11.5"); - versionToPlayerMap.put(19,"FlashPlayer11.6"); - versionToPlayerMap.put(20,"FlashPlayer11.7"); - versionToPlayerMap.put(21,"FlashPlayer11.8"); - versionToPlayerMap.put(22,"FlashPlayer11.9"); - versionToPlayerMap.put(23,"FlashPlayer12.0"); + + private static final Map versionToPlayerMap = new HashMap<>(); + + static { + versionToPlayerMap.put(10, "FlashPlayer10.0"); //10 & 10.1 + versionToPlayerMap.put(11, "FlashPlayer10.2"); + versionToPlayerMap.put(12, "FlashPlayer10.3"); + versionToPlayerMap.put(13, "FlashPlayer11.0"); + versionToPlayerMap.put(14, "FlashPlayer11.1"); + versionToPlayerMap.put(15, "FlashPlayer11.2"); + versionToPlayerMap.put(16, "FlashPlayer11.3"); + versionToPlayerMap.put(17, "FlashPlayer11.4"); + versionToPlayerMap.put(18, "FlashPlayer11.5"); + versionToPlayerMap.put(19, "FlashPlayer11.6"); + versionToPlayerMap.put(20, "FlashPlayer11.7"); + versionToPlayerMap.put(21, "FlashPlayer11.8"); + versionToPlayerMap.put(22, "FlashPlayer11.9"); + versionToPlayerMap.put(23, "FlashPlayer12.0"); } - - private FLAVersion(String shortName,String applicationName,String xflVersion,int maxSwfVersion){ + + private FLAVersion(String shortName, String applicationName, String xflVersion, int maxSwfVersion) { this.xflVersion = xflVersion; this.shortName = shortName; this.applicationName = applicationName; @@ -71,20 +71,20 @@ public enum FLAVersion { public String xflVersion() { return xflVersion; } - - public int maxSwfVersion(){ + + public int maxSwfVersion() { return maxSwfVersion; } - - public int minASVersion(){ + + public int minASVersion() { return 1; } - - public String applicationName(){ + + public String applicationName() { return applicationName; } - - public String shortName(){ + + public String shortName() { return shortName; } @@ -92,23 +92,23 @@ public enum FLAVersion { public String toString() { return shortName; } - - public static String swfVersionToPlayer(int version){ - if(versionToPlayerMap.containsKey(version)){ + + public static String swfVersionToPlayer(int version) { + if (versionToPlayerMap.containsKey(version)) { return versionToPlayerMap.get(version); } return ""; } - - public static FLAVersion fromString(String s){ - if(s == null){ + + public static FLAVersion fromString(String s) { + if (s == null) { return null; } - for(FLAVersion v:FLAVersion.values()){ - if(v.shortName.toLowerCase().equals(s.toLowerCase())){ + for (FLAVersion v : FLAVersion.values()) { + if (v.shortName.toLowerCase().equals(s.toLowerCase())) { return v; } - if(v.xflVersion.equals(s)){ + if (v.xflVersion.equals(s)) { return v; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 4f9bdc094..107b45591 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -448,13 +448,9 @@ public class XFLConverter { /** * Remove bugs in shape: - * - * ... - * straightrecord - * straightrecord - * stylechange - * straightrecord (-2,0) <-- merge this with previous - * stylegchange + * + * ... straightrecord straightrecord stylechange straightrecord (-2,0) <-- + * merge this with previous stylegchange * * @param shapeRecords * @return @@ -497,7 +493,7 @@ public class XFLConverter { scr2.stateLineStyle = true; scr2.lineStyle = scr.lineStyle; } - i-=2; + i -= 2; } } @@ -1157,7 +1153,7 @@ public class XFLConverter { } private static String convertActionScript(ASMSource as) { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); try { Action.actionsToSource(as, as.getActions(SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION, as.toString(), writer); } catch (InterruptedException ex) { @@ -1871,7 +1867,7 @@ public class XFLConverter { if (t instanceof ShowFrameTag) { elements = ""; - if ((character instanceof ShapeTag) && (nonLibraryShapes.contains(characterId)||shapeTweener!=null)) { + if ((character instanceof ShapeTag) && (nonLibraryShapes.contains(characterId) || shapeTweener != null)) { ShapeTag shape = (ShapeTag) character; elements += convertShape(characters, matrix, shape.getShapeNum(), shape.getShapes().shapeRecords, shape.getShapes().fillStyles, shape.getShapes().lineStyles, false, false); shapeTween = false; diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java index 852227471..8c88dc955 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -117,7 +117,7 @@ public abstract class GraphTargetItem implements Serializable { public abstract GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException; public String toString(LocalData localData) throws InterruptedException { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); toString(writer, localData); return writer.toString(); } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java b/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java index fa741e650..b50c96de9 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java @@ -90,10 +90,10 @@ public class IfItem extends GraphTargetItem implements Block { } writer.endBlock(); if (elseBranch.size() > 0) { - if(writer.getFormatting().beginBlockOnNewLine){ - writer.newLine(); - }else{ - writer.append(" "); + if (writer.getFormatting().beginBlockOnNewLine) { + writer.newLine(); + } else { + writer.append(" "); } writer.append("else").startBlock(); for (GraphTargetItem ti : elseBranch) { diff --git a/trunk/src/com/jpexs/helpers/Helper.java b/trunk/src/com/jpexs/helpers/Helper.java index 40a5ddb61..657a8b63c 100644 --- a/trunk/src/com/jpexs/helpers/Helper.java +++ b/trunk/src/com/jpexs/helpers/Helper.java @@ -706,7 +706,7 @@ public class Helper { } public static String byteArrayToHex(byte[] data, int bytesPerRow) { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(),false); + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); byteArrayToHex(writer, data, bytesPerRow, 8, true, true); return writer.toString(); } @@ -793,11 +793,11 @@ public class Helper { appendNoHilight(AppStrings.translate("decompilationError.error.description")). appendNoHilight("\");").newLine(); } - - public static String escapeHTML(String text){ + + public static String escapeHTML(String text) { String from[] = new String[]{"&", "<", ">", "\"", "'", "/"}; String to[] = new String[]{"&", "<", ">", """, "'", "/"}; - for(int i=0;i