最新下载
热门教程
- 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;
}
}
相关文章
- 《彩色点点战争》推图常用三大主c玩法详解 01-23
- 《燕云十六声》池鱼林木任务攻略 01-23
- 《大连地铁e出行》查看行程记录方法 01-23
- 《明日方舟》2025春节限定干员余角色介绍 01-23
- 《崩坏:星穹铁道》万敌光锥搭配攻略 01-23
- 《燕云十六声》一药千金任务攻略 01-23