简体   繁体   中英

Listing directories in a Zip file using ZipPackage

How can I list directories in a zip file using ZipPackage ? I would like to work with the zip file as if it was a folder structure on disk, ie list files and directories at the current level, open some of the files as needed, then go into every folder, and so on recursively.

If possible, I would like to avoid external dependencies and I am limited to .Net 4.0.

EDIT: To make the question more concrete, assume I would like to create the following structure, that corresponds to the contents of the zip file:

interface IDirectory
{
  IList<IDirectory> SubDirectories {get; }
  IList<IFile> Files{get; }
  string Name {get; }
  //other methods
}

interface IFile
{
  string Name {get; }
  void UnZip (IStream stream);
}

ZipPackage似乎不能处理任意的zip档案,所以我想我的问题的答案是:不可能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM