繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> ASP基础 >> Flash 6 swf文件的代码

Flash 6 swf文件的代码

2006-07-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:using System; using System.Text; using System.IO; using ICSharpCode.SharpZipLib.Zip.Compression; /************** /*笨猫猫作品 /************** namespace GetFlashRect { class MyFlash { public MyFlas...
关键字:代码 文件 Flash swf

using System;

using System.Text;

using System.IO;

using ICSharpCode.SharpZipLib.Zip.Compression;

/**************

/*笨猫猫作品

/**************

namespace GetFlashRect

{

class MyFlash

{

public MyFlash

{}

public Stream DeCompress(Stream srcStream)

{

//判断是否是压缩的Flash mx swf文件

//取文件头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;//获取接压后流长度

byte[] btArrayBuffer=new byte[intDeCompressLength]; //开辟解压缓存

int intCompressionLength=(int)srcStream.Length-8;//被压缩的流的长度

byte[] btArraySourceBuffer=new byte[srcStream.Length-8];//开辟压缩文件缓存 长度为流长度减8

br.Read(btArraySourceBuffer,0,intCompressionLength);

inflater.SetInput(btArraySourceBuffer);

inflater.Inflate(btArrayBuffer);

//流位置指到开头,重新写入

srcStream.Position=0;

srcStream.WriteByte((byte)'F');

srcStream.Position=8;

srcStream.Write(btArrayBuffer,0,intDeCompressLength);

srcStream.Flush();

}

//br.Close();

return srcStream;

}

}

责任编辑:admin
相关文章