public static Archive ReadZip(Purl path)
 {
   ZipFile zip = new ZipFile(path.AsString);
   Archive archive = new Archive(path, zip);
   foreach (ZipEntry entry in zip)
   {
     if (!entry.IsDirectory)
     {
       Purl entryPath = new Purl(entry.Name);
       ArchivedFileInZip fileInZip = new ArchivedFileInZip(entryPath, zip, entry);
       ManifestEntry manifestEntry = new ManifestEntry(entryPath, fileInZip);
       archive.Add(manifestEntry);
     }
   }
   return archive;
 }
示例#2
0
 public FileSystemFile WriteZip(Purl path)
 {
   _pathOfArchive = path;
   _totalBytes = _archive.UncompressedBytes;
   _otherBytesSoFar = 0;
   using (ZipOutputStream zip = OpenZipStream(path))
   {
     foreach (ManifestEntry entry in _archive.Entries)
     {
       using (Stream source = entry.FileAsset.OpenForReading())
       {
         _currentEntry = entry;
         ZipEntry zipEntry = new ZipEntry(entry.ArchivePath.AsString);
         zipEntry.DateTime = entry.FileAsset.ModifiedAt;
         zip.PutNextEntry(zipEntry);
         StreamHelper.Copy(source, zip, ReportProgress);
         zip.CloseEntry();
         _otherBytesSoFar += entry.UncompressedLength;
       }
     }
   }
   return FileSystemFileFactory.CreateFile(path);
 }
示例#3
0
 public void Add(ManifestEntry manifestEntry)
 {
   _entries.Add(manifestEntry);
 }
 public ArchiveFileProgressEventArgs(double percentComplete, Purl archive, ManifestEntry manifestEntry)
  : base(percentComplete, manifestEntry.FileAsset, archive)
 {
   _archive = archive;
   _manifestEntry = manifestEntry;
 }