用#ziplib可不可以不解压,直接删除zip中的部分文件 如题~~~先拜谢下回帖的达人们TvT 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class ZipDAO { public string file; public ZipDAO(string dir) { Console.WriteLine("开始压缩....."); file = dir; } public void ZipFold() { //获得压缩的文件夹 //压缩文件夹的名字 string name = file + ".rar"; //压缩文件的流对象 // MessageBox.Show(name); ZipOutputStream output = new ZipOutputStream(File.Create(name)); output.SetLevel(6); string[] dir = Directory.GetFiles(file); //存放文件数据 Crc32 crc = new Crc32(); foreach (string myFile in dir) { FileStream fs = new FileStream(myFile, FileMode.Open, FileAccess.Read); byte[] bt = new byte[fs.Length]; fs.Read(bt, 0, bt.Length); //存储要压缩的文件 ZipEntry entry = new ZipEntry(myFile); entry.Size = fs.Length; entry.DateTime = DateTime.Now; fs.Close(); crc.Reset(); //清除crc内容 crc.Update(bt); //更新文件内容到crc中 entry.Crc = crc.Value; //将文件内容放到压缩文件中 output.PutNextEntry(entry); //将数据写入压缩流中 output.Write(bt, 0, bt.Length); } output.Close(); Console.WriteLine("压缩成功!"); } } 貌似不是我想要实现的功能><不过还是谢谢了~~ DataGridView 删除行 关于放大实时曲线的问题(参与有分) vs2005开发的asp.net网站能放到linux平台上吗? BackGroudWorker控件的问题! 翻译了"C#中多路IP摄像机的视频监控系统" 高手门帮我把下面这句话转成vb.net C#应用程序,窗体如何自动适应不同的分辨率? myString1和myString2指的是同一个对象吗? 招聘.NET程序员 更新DataTable时出现这样的错误 C#可否在一个类里面再定义一个类? Infragistics.Win.UltraWinEditors有人用过没有?怎么用?里面都有什么样的控件?
{
public string file;
public ZipDAO(string dir)
{
Console.WriteLine("开始压缩.....");
file = dir;
} public void ZipFold()
{
//获得压缩的文件夹
//压缩文件夹的名字
string name = file + ".rar";
//压缩文件的流对象
// MessageBox.Show(name);
ZipOutputStream output = new ZipOutputStream(File.Create(name));
output.SetLevel(6);
string[] dir = Directory.GetFiles(file);
//存放文件数据
Crc32 crc = new Crc32();
foreach (string myFile in dir)
{
FileStream fs = new FileStream(myFile, FileMode.Open, FileAccess.Read);
byte[] bt = new byte[fs.Length];
fs.Read(bt, 0, bt.Length);
//存储要压缩的文件
ZipEntry entry = new ZipEntry(myFile);
entry.Size = fs.Length;
entry.DateTime = DateTime.Now;
fs.Close();
crc.Reset(); //清除crc内容
crc.Update(bt); //更新文件内容到crc中
entry.Crc = crc.Value; //将文件内容放到压缩文件中
output.PutNextEntry(entry);
//将数据写入压缩流中
output.Write(bt, 0, bt.Length);
}
output.Close();
Console.WriteLine("压缩成功!");
}
}
不过还是谢谢了~~