Flash 6 swf文件的代码 - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- Flash 6 swf文件的代码 (http://www.webasp.net/article/13/12732.htm) |
| -- 作者:未知 -- 发布日期: 2004-08-31 |
| 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; } } |
| webasp.net |