最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Flash 6 swf文件的代码
时间:2022-06-30 11:19:06 编辑:袖梨 来源:一聚教程网
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;
}
}
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;
}
}
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20