问题描述
||
从示例中,我对如何提取一个zip文件有了很好的了解。
在几乎每个示例中,标识ZipEntry是目录的方法如下
string directoryName = Path.GetDirectoryName(theEntry.Name);
string fileName = Path.GetFileName(theEntry.Name);
if (directoryName.Length > 0)
Directory.CreateDirectory(Path.Combine(destinationDirectory,directoryName));
if (fileName != String.Empty)
{
//read data and write to file
}
现在就可以了,提取文件时所有目录都可以使用(创建目录)。
我可以将文件添加到zip中,但是如何添加文件夹?我知道我将遍历目录,添加遇到的文件(并且正确填充了它们的ZipEntry.Name属性),但是如何将ZipEntry添加到存档中并指示ZipOutputStream它是目录?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)