这是代码
ZipFile zipnew = ZipFile.Read(strPath);
if (!File.Exists(path))
{
using (ZipFile zip = new ZipFile())
{
zip.Save(path);
}
}
string tmpname = fpath + "\\abtemp";
ZipFile zipold = ZipFile.Read(path);
foreach (ZipEntry zenew in zipnew)
{
string flna = zenew.FileName.ToString();
string tfn = '@' + flna.Replace("\\", "/");
Stream fstream = File.Open(tmpname, FileMode.OpenOrCreate, FileAccess.Write);
zenew.Extract(fstream);
string l = fstream.Length.ToString();
fstream.Close();
using (StreamReader sr = new StreamReader(tmpname))
{
var zn = zipold.UpdateEntry(flna, sr.BaseStream);
sr.Close();
sr.Dispose();
fstream.Dispose();
}
}
zipnew.Dispose();
File.Delete(tmpname);
File.Delete(strPath);
问题是:我没有收到任何错误,也没有文件从 zipnew 合并到 zipold。Zipold 是一个空白的 zip 文件