Beispiel #1
0
 private void EnsureCentralDirectoryHeader()
 {
     if (this.header != null)
     {
         return;
     }
     this.header = new CentralDirectoryHeader();
 }
Beispiel #2
0
 internal ZipArchiveEntry(ZipArchive archive, CentralDirectoryHeader header)
 {
     this.Archive  = archive;
     this.header   = header;
     this.settings = ZipHelper.GetCompressionSettings((CompressionMethod)this.header.CompressionMethod, this.Archive.CompressionSettings);
     this.settings.PrepareForZip((CentralDirectoryHeader)null);
     this.existedInArchive = true;
 }
Beispiel #3
0
 private void ReadCentralDirectory()
 {
     this.Reader.BaseStream.Seek(this.CentralDirectoryStart, SeekOrigin.Begin);
     for (ulong index = 0; index < this.NumberOfEntriesInTheCentralDirectory; ++index)
     {
         CentralDirectoryHeader header = new CentralDirectoryHeader();
         if (!header.TryReadBlock(this.archiveReader))
         {
             throw new InvalidDataException("Central directory header is broken.");
         }
         ZipArchiveEntry zipArchiveEntry = new ZipArchiveEntry(this, header);
         this.entries.Add(zipArchiveEntry.FullName, zipArchiveEntry);
     }
 }
Beispiel #4
0
 internal ZipArchiveEntry(ZipArchive archive, string entryName)
 {
     this.Archive  = archive;
     this.settings = this.Archive.CompressionSettings;
     this.header   = new CentralDirectoryHeader();
     this.header.VersionNeededToExtract = (ushort)10;
     this.header.GeneralPurposeBitFlag  = (ushort)8;
     if (this.Archive.EncryptionSettings is DefaultEncryptionSettings)
     {
         this.header.GeneralPurposeBitFlag |= (ushort)1;
         this.ValidateVersionNeeded(VersionNeededToExtract.Deflate);
     }
     this.FullName      = entryName;
     this.LastWriteTime = DateTimeOffset.Now;
 }
Beispiel #5
0
 internal virtual void PrepareForZip(CentralDirectoryHeader header = null)
 {
 }