ScaleForm GFx opening from open/save dialog

GFx classes refactoring
This commit is contained in:
Jindra Pet��k
2013-09-26 15:42:53 +02:00
parent 823d3ff04c
commit 2e0f3ea3ac
16 changed files with 169 additions and 61 deletions
+27 -5
View File
@@ -185,7 +185,11 @@ public class SWF {
*/
public byte[] lzmaProperties;
public FileAttributesTag fileAttributes;
/**
* ScaleForm GFx
*/
public boolean gfx = false;
/**
* Gets all tags with specified id
*
@@ -225,10 +229,19 @@ public class SWF {
} else if (compressed) {
os.write('C');
} else {
os.write('F');
if (gfx) {
os.write('G');
} else {
os.write('F');
}
}
if (gfx) {
os.write('F');
os.write('X');
} else {
os.write('W');
os.write('S');
}
os.write('W');
os.write('S');
os.write(version);
byte[] data = baos.toByteArray();
sos = new SWFOutputStream(os, version);
@@ -300,13 +313,22 @@ public class SWF {
byte[] hdr = new byte[3];
is.read(hdr);
String shdr = new String(hdr, "utf-8");
if ((!shdr.equals("FWS")) && (!shdr.equals("CWS")) && (!shdr.equals("ZWS"))) {
if (!Arrays.asList(
"FWS", //Uncompressed Flash
"CWS", //ZLib compressed Flash
"ZWS", //LZMA compressed Flash
"GFX", //Uncompressed ScaleForm GFx
"CFX" //Compressed ScaleForm GFx
).contains(shdr)) {
throw new IOException("Invalid SWF file");
}
version = is.read();
SWFInputStream sis = new SWFInputStream(is, version, 4);
fileSize = sis.readUI32();
if(hdr[1] == 'F' && hdr[2] == 'X'){
gfx = true;
}
if (hdr[0] == 'C') {
sis = new SWFInputStream(new InflaterInputStream(is), version, 8);
compressed = true;