New tags,

Other code: organize imports
This commit is contained in:
Jindra Pet��k
2013-01-04 17:12:27 +01:00
parent b1ab3ca35b
commit 644110dd40
101 changed files with 4051 additions and 299 deletions
+33 -34
View File
@@ -19,9 +19,9 @@ package com.jpexs.asdec;
import SevenZip.Compression.LZMA.Encoder;
import com.jpexs.asdec.action.TagNode;
import com.jpexs.asdec.helpers.Highlighting;
import com.jpexs.asdec.tags.base.ASMSource;
import com.jpexs.asdec.tags.DoABCTag;
import com.jpexs.asdec.tags.Tag;
import com.jpexs.asdec.tags.base.ASMSource;
import com.jpexs.asdec.tags.base.TagName;
import com.jpexs.asdec.types.RECT;
import java.io.*;
@@ -287,8 +287,7 @@ public class SWF {
}
return true;
}
/**
* Decompress LZMA compressed SWF file
*
@@ -298,40 +297,40 @@ public class SWF {
public static boolean zws2fws(InputStream fis, OutputStream fos) {
try {
byte hdr[] = new byte[3];
fis.read(hdr);
String shdr = new String(hdr);
if (!shdr.equals("ZWS")) {
return false;
}
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
fis.read(hdr);
String shdr = new String(hdr);
if (!shdr.equals("ZWS")) {
return false;
}
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
if (hdr[0] == 'Z') {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
long outSize = sis.readUI32();
int propertiesSize = 5;
byte lzmaProperties[] = new byte[propertiesSize];
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
throw new IOException("LZMA:input .lzma file is too short");
}
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
if (!decoder.SetDecoderProperties(lzmaProperties)) {
throw new IOException("LZMA:Incorrect stream properties");
}
if (hdr[0] == 'Z') {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
long outSize = sis.readUI32();
int propertiesSize = 5;
byte lzmaProperties[] = new byte[propertiesSize];
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
throw new IOException("LZMA:input .lzma file is too short");
}
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
if (!decoder.SetDecoderProperties(lzmaProperties)) {
throw new IOException("LZMA:Incorrect stream properties");
}
if (!decoder.Code(sis, baos, fileSize - 8)) {
throw new IOException("LZMA:Error in data stream");
if (!decoder.Code(sis, baos, fileSize - 8)) {
throw new IOException("LZMA:Error in data stream");
}
SWFOutputStream sos = new SWFOutputStream(fos, version);
sos.write("FWS".getBytes());
sos.write(version);
sos.writeUI32(fileSize);
sos.write(baos.toByteArray());
sos.close();
} else {
return false;
}
SWFOutputStream sos=new SWFOutputStream(fos,version);
sos.write("FWS".getBytes());
sos.write(version);
sos.writeUI32(fileSize);
sos.write(baos.toByteArray());
sos.close();
}else{
return false;
}
} catch (FileNotFoundException ex) {
return false;
} catch (IOException ex) {