日期:2014-05-20  浏览次数:20934 次

如何将多个文件打包成一个文件?(300分求解)
看到许多软件皮肤被打包成一个文件,却可以用ZIP/RAR一类的软件打开。而用ZIP/RAR压缩后却和原来的打包文件大小不一样(估计格式肯定不一样)

我发现有个规律是:被打包的N个文件“在磁盘上所占的大小”==“打包文件的大小”(请仔细理解这句话),也就是说,好像此打包文件是一个“目录”,它里面的文件并没有被压缩,而是按照一定的方式组织起来了(用FAT32方式组织的?不知道),所以才有上面的规律。

哪位曾经研究过吗?请帮忙,谢谢了。

如能帮助解决,我愿意另开贴,再送100分。再次谢谢。

帮顶的也送分,结贴时送。

另外200分在此贴:
http://community.csdn.net/Expert/topic/5280/5280434.xml?temp=.3603937
结贴时一同给出


------解决方案--------------------
沙发,顶!
------解决方案--------------------
我觉得用wise打包较好,至于多个文件都不是问题,最后就一个exe
------解决方案--------------------
轻轻的我来了
轻轻的我带着分走了
------解决方案--------------------
楼主标题没有整对~

看了半天不知道描述的问题主体
------解决方案--------------------
http://www.icsharpcode.com/OpenSource/SharpZipLib/Default.aspx

http://www.codeproject.com/csharp/vmeasyzipunzip.asp


------解决方案--------------------
是那个皮肤压缩软件吗?

------解决方案--------------------
你是想问这种打包文件的内部格式吧?
------解决方案--------------------
帮、顶
------解决方案--------------------
不就是一个压缩文件吗?可以ShareZip开源的C#你去看看吧!
------解决方案--------------------
from http://www.cnblogs.com/aiyagaze/archive/2006/11/30/576995.html

using System;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.IO;
using System.IO.Compression;

namespace GreatCHN.GZipCompression
{
public class GZipCompress
{
/**//// <summary>
/// 对目标文件夹进行压缩,将压缩结果保存为指定文件
/// </summary>
/// <param name= "dirPath "> 目标文件夹 </param>
/// <param name= "fileName "> 压缩文件 </param>
public static void Compress(string dirPath, string fileName)
{
ArrayList list = new ArrayList();
foreach (string f in Directory.GetFiles(dirPath))
{
byte[] destBuffer = File.ReadAllBytes(f);
SerializeFileInfo sfi = new SerializeFileInfo(f, destBuffer);
list.Add(sfi);
}
IFormatter formatter = new BinaryFormatter();
using (Stream s = new MemoryStream())
{
formatter.Serialize(s, list);
s.Position = 0;
CreateCompressFile(s, fileName);
}
}

/**//// <summary>
/// 对目标压缩文件解压缩,将内容解压缩到指定文件夹
/// </summary>
/// <param name= "fileName "> 压缩文件 </param>
/// <param name= "dirPath "> 解压缩目录 </param>
public static void DeCompress(string fileName, string dirPath)
{
using (Stream source = File.OpenRead(fileName))
{
using (Stream destination = new MemoryStream())
{
using (GZipStream input = new GZipStream(source, CompressionMode.Decompress, true))
{
byte[] bytes = new byte[4096];