



下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、解压缩,压缩和读取flash头文件信息swf文件在flash6以后多了压缩的选项,使用zlib压缩,有人写的zlib的链接库(下面是我写的解压缩,压缩和读取flash头文件信息的代码:压缩:openFileDialog1.Filter = JPG Files|*.swf;openFileDialog1.Title = Select a Swf File;if(openFileDialog1.ShowDialog() = DialogResult.OK)string fileName = Path.GetFullPath(openFileDialog1.FileName); FileStream
2、 fs1 = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs1); byte writedata = r.ReadBytes(int)(fs1.Length - 1); ManagedZLib.ManagedZLib.Initialize();string tempfile = aaa.swf; FileStream fs = new FileStream(tempfile, FileMode.OpenOrCreate); byte writefiled
3、ata = new byte8; writefiledata0 = Convert.ToByte(C); for(int i=1;i8;i+) writefiledatai = writedatai; fs.Write(writefiledata,0,8); ManagedZLib.CompressionStream zlibStream = new ManagedZLib.CompressionStream(fs, ManagedZLib.CompressionOptions.CompressBest); BinaryWriter zlibWriter = new BinaryWriter(
4、zlibStream); zlibWriter.Write(writedata,8,writedata.Length - 8); zlibWriter.Close(); zlibStream.Close(); r.Close(); fs1.Close(); 解压缩: 程序代码FileStream stream color=#0000ff= new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);BinaryReader reader = new BinaryReader(stream);try
5、byte dataPart = new bytestream.Length-8; string mark = new string(reader.ReadChars(3); if(mark = FWS) MessageBox.Show(已经是解压缩过的文件); return; int version = Convert.ToInt32(reader.ReadByte(); int fileLength = reader.ReadInt32(); reader.Read(dataPart, 0, dataPart.Length); byte savedata = new bytefileLeng
6、th; savedata0 = Convert.ToByte(F); savedata1 = Convert.ToByte(W); savedata2 = Convert.ToByte(S); savedata3 = version; savedata4 = Convert.ToByte(fileLength%256); savedata5 = Convert.ToByte(fileLength/256%256); savedata6 = Convert.ToByte(fileLength/256/256%256); savedata7 = Convert.ToByte(fileLength/
7、256/256/256%256); MemoryStream dataStream = new MemoryStream(dataPart); try ManagedZLib.ManagedZLib.Initialize(); ManagedZLib.CompressionStream zlibStream = new ManagedZLib.CompressionStream(dataStream, ManagedZLib.CompressionOptions.Decompress); BinaryReader zlibReader = new BinaryReader(zlibStream
8、); try byte decompressedPart = new bytefileLength - 8; zlibReader.Read(decompressedPart, 0, decompressedPart.Length); for(int i=8;ifileLength;i+) savedatai = decompressedParti-8; string FILE_NAME = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,filename); FileStream fss = new FileStream(FILE_NAME, FileMode.OpenOrCreate); BinaryWriter ww = new BinaryWriter(fss); ww.Write(savedata); ww.Close(); fss.Close(); finally zlibReader.Close(); zlibStream.Close(); ManagedZLib.ManagedZLib.Terminate(); finally dataStream.Close(); finally reader
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 玩具企业的客户服务与售后支持体系考核试卷
- 智能手持设备稳定性测试考核试卷
- 幼儿园中班课程故事:特工超市
- 小兔子班本课程
- 体育健康教育禁毒
- 2025医疗机构数据库维护服务合同
- 2025园林绿化养护管理合同书
- 义务教育学校工作汇报
- 2025年的食堂管理合同范本
- 2025年合同续签无需试用期
- 课件:《科学社会主义概论(第二版)》第四章
- 2025年上半年江苏省苏州市总工会招录社会化工会工作者18人易考易错模拟试题(共500题)试卷后附参考答案
- 工厂废料运输清理协议
- 2025超市出兑合同书模板
- 《基于宁德时代的财务报表的公司财务分析》4100字(论文)
- 湖南省长沙市雅礼实验中学-主题班会-《阳光心态美丽青春》【课件】
- 提高单病种上报率
- The+Person+I+respect+高考应用文写作+导学案 高三上学期英语一轮复习专项
- 2025年中考考前物理押题密卷(河北卷)(考试版A4)
- 临床护理实践指南2024版
- 人教版七年级下册数学第七章平面直角坐标系-测试题及答案
评论
0/150
提交评论