mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 13:50:43 +00:00
Fixed Java code does not export tags
This commit is contained in:
@@ -16,13 +16,16 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters.swf;
|
||||
|
||||
import com.jpexs.decompiler.flash.ReadOnlyTagList;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.helpers.CodeFormatting;
|
||||
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.LazyObject;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
@@ -54,7 +57,11 @@ public class SwfJavaExporter {
|
||||
"FILLSTYLEARRAY", "LINESTYLE", "LINESTYLE2", "LINESTYLEARRAY", "SHAPERECORD", "SHAPE", "SHAPEWITHSTYLE", "SHAPERECORDS",
|
||||
"SOUNDINFO", "SOUNDENVELOPE", "GLYPHENTRY", "TEXTRECORD", "MORPHGRADRECORD", "MORPHGRADIENT", "MORPHFOCALGRADIENT",
|
||||
"MORPHFILLSTYLE", "MORPHFILLSTYLEARRAY", "MORPHLINESTYLE", "MORPHLINESTYLE2", "MORPHLINESTYLEARRAY", "KERNINGRECORD",
|
||||
"LANGCODE", "ZONERECORD", "ZONEDATA", "PIX15", "PIX24", "COLORMAPDATA", "BITMAPDATA", "ALPHABITMAPDATA", "ALPHACOLORMAPDATA"};
|
||||
"LANGCODE", "ZONERECORD", "ZONEDATA", "PIX15", "PIX24", "COLORMAPDATA", "BITMAPDATA", "ALPHABITMAPDATA", "ALPHACOLORMAPDATA",
|
||||
|
||||
//GFX
|
||||
"ContourType", "EdgeType", "FONTINFO", "FontType", "GLYPHIDX", "GlyphInfoType", "GlyphType", "KerningPairType", "TEXGLYPH"
|
||||
};
|
||||
|
||||
public List<File> exportJavaCode(SWF swf, String outdir) throws IOException {
|
||||
final File file = new File(outdir + File.separator + Helper.makeFileName("SwfFile.java"));
|
||||
@@ -76,7 +83,13 @@ public class SwfJavaExporter {
|
||||
writer.append("import com.jpexs.decompiler.flash.SWF;").newLine();
|
||||
writer.append("import com.jpexs.decompiler.flash.SWFCompression;").newLine();
|
||||
writer.append("import com.jpexs.decompiler.flash.tags.*;").newLine();
|
||||
if (swf.gfx) {
|
||||
writer.append("import com.jpexs.decompiler.flash.tags.gfx.*;").newLine();
|
||||
}
|
||||
writer.append("import com.jpexs.decompiler.flash.types.*;").newLine();
|
||||
if (swf.gfx) {
|
||||
writer.append("import com.jpexs.decompiler.flash.types.gfx.*;").newLine();
|
||||
}
|
||||
writer.append("import com.jpexs.decompiler.flash.types.filters.*;").newLine();
|
||||
writer.append("import com.jpexs.decompiler.flash.types.shaperecords.*;").newLine();
|
||||
writer.append("import com.jpexs.helpers.ByteArrayRange;").newLine();
|
||||
@@ -102,7 +115,7 @@ public class SwfJavaExporter {
|
||||
writer.append(" SWF swf = getSwf();").newLine();
|
||||
writer.append(" swf.clearModified();").newLine();
|
||||
writer.append(" try (FileOutputStream fos = new FileOutputStream(fileName)) {").newLine();
|
||||
writer.append(" swf.saveTo(fos, SWFCompression.ZLIB);").newLine();
|
||||
writer.append(" swf.saveTo(fos);").newLine();
|
||||
writer.append(" }").newLine();
|
||||
writer.append(" }").newLine();
|
||||
writer.append("}").newLine();
|
||||
@@ -241,14 +254,29 @@ public class SwfJavaExporter {
|
||||
Logger.getLogger(SwfJavaExporter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
if ((obj instanceof SWF) || (obj instanceof DefineSpriteTag)) {
|
||||
Timelined tim = (Timelined) obj;
|
||||
ReadOnlyTagList tags = tim.getTags();
|
||||
sb2.appendLine("Tag tag;");
|
||||
for (Tag t : tags) {
|
||||
Object value2 = generateJavaCode(writer, sb2, objectNames, t, level + 1);
|
||||
if (value2 != null) {
|
||||
sb2.appendLine("tag = " + value2 + ";");
|
||||
sb2.appendLine(resultName + ".addTag(tag);");
|
||||
sb2.appendLine("tag.setTimelined(" + resultName + ");");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
writer.append("private ").append(className).append(" ").append(tagObjName).append("(").append(isSwf ? "" : "SWF swf").append(") {").newLine();
|
||||
writer.indent();
|
||||
writer.append(className).append(" ").append(resultName).append(" = new ").append(className).append("(").append(obj instanceof Tag ? "swf" : "").append(");");
|
||||
writer.unindent().unindent();
|
||||
writer.newLine();
|
||||
writer.newLine();
|
||||
writer.append(sb2.toString());
|
||||
writer.indent().indent();
|
||||
writer.indent().indent();
|
||||
writer.append(indent).append("return ").append(resultName).append(";").newLine();
|
||||
writer.unindent();
|
||||
writer.append("}").newLine().newLine();
|
||||
|
||||
Reference in New Issue
Block a user