public void Initialize(EncryptionSettings settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     this.cryptoSettings = settings as DefaultEncryptionSettings;
     if (this.cryptoSettings == null)
     {
         throw new ArgumentException("Invalid argument type", nameof(settings));
     }
 }
示例#2
0
 private Stream OpenForWriting()
 {
     if (this.written)
     {
         throw new IOException("Create mode writes entry once and one entry at a time");
     }
     this.WriteLocalFileHeader();
     if (this.Archive.EncryptionSettings != null)
     {
         DefaultEncryptionSettings encryptionSettings = this.Archive.EncryptionSettings as DefaultEncryptionSettings;
         if (encryptionSettings != null)
         {
             encryptionSettings.FileTime = this.header.FileTime;
         }
     }
     this.compressedData = new CompressedStream(this.Archive.Writer.BaseStream, StreamOperationMode.Write, this.settings, true, this.Archive.EncryptionSettings);
     this.compressedData.ChecksumReady += new EventHandler(this.CompressedData_ChecksumReady);
     return((Stream)this.compressedData);
 }