Using System;
Using System.Text;
Using System.IO;
Using ICSharpCode.SharpZipLib.Zip.Compression;
/**************
* * Dumb Cat works
/**************
Namespace Getflashrect
{
Class Myflash
{
Public Myflash
{}
Public stream Decompress (stream SRCStream)
{
Determine if the Flash MX swf file is compressed
Take file Header 3
BinaryReader br=new BinaryReader (SRCStream);
Char[] CHRARRAY=BR. ReadChars (3);
String Strflag=new string (Chrarray);
int intversion= (int) br. ReadByte ();
if (String.Compare (Strflag, "CWS", True) ==0&& intversion==6)
{
Inflater inflater=new inflater ();
int INTDECOMPRESSLENGTH=BR. ReadInt32 () -8;//to obtain the flow length after the pressure
Byte[] Btarraybuffer=new byte[intdecompresslength]; Open up the decompression cache
int intcompressionlength= (int) srcstream.length-8;//The length of the compressed stream
byte[] btarraysourcebuffer=new byte[srcstream.length-8];//zip file cache length minus 8 for stream length
Br. Read (btarraysourcebuffer,0,intcompressionlength);
Inflater. SetInput (Btarraysourcebuffer);
Inflater. Inflate (Btarraybuffer);
The stream position is pointed to the beginning and is rewritten
srcstream.position=0;
Srcstream.writebyte ((byte) ' F ');
srcstream.position=8;
Srcstream.write (btarraybuffer,0,intdecompresslength);
Srcstream.flush ();
}
Br. Close ();
return srcstream;
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.