最新下载
热门教程
- 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;
}
}
相关文章
- 2026年Perplexity使用说明:搜索配置、文件上传与账户权限 06-18
- 抖音神龙召唤游玩教程 06-18
- 2026年Perplexity访问入口与账号配置说明 06-18
- Perplexity版权风险说明:引用来源与生成内容的使用边界 06-18
- 中国最矮的山有多高 支付宝蚂蚁庄园11月3日答案 06-18
- Perplexity 2026年常见问题排查:权限、费用与适用场景说明 06-18