コード例 #1
0
ファイル: ZipIOLocalFileBlock.cs プロジェクト: slolam/XecMe
 private void ParseRecord(BinaryReader reader, string fileName, long position, ZipIOCentralDirectoryBlock centralDir, ZipIOCentralDirectoryFileHeader centralDirFileHeader)
 {
     this.CheckDisposed();
     this._localFileHeader = ZipIOLocalFileHeader.ParseRecord(reader, this._blockManager.Encoding);
     if (this._localFileHeader.StreamingCreationFlag)
     {
         this._blockManager.Stream.Seek(centralDirFileHeader.CompressedSize, SeekOrigin.Current);
         this._localFileDataDescriptor = ZipIOLocalFileDataDescriptor.ParseRecord(reader, centralDirFileHeader.CompressedSize, centralDirFileHeader.UncompressedSize, centralDirFileHeader.Crc32, this._localFileHeader.VersionNeededToExtract);
     }
     else
     {
         this._localFileDataDescriptor = null;
     }
     this._offset         = position;
     this._dirtyFlag      = false;
     this._fileItemStream = new ZipIOFileItemStream(this._blockManager, this, position + this._localFileHeader.Size, centralDirFileHeader.CompressedSize);
     if (this._localFileHeader.CompressionMethod == CompressionMethodEnum.Deflated)
     {
         this._deflateStream        = new CompressStream(this._fileItemStream, centralDirFileHeader.UncompressedSize);
         this._crcCalculatingStream = new ProgressiveCrcCalculatingStream(this._blockManager, this._deflateStream, this.Crc32);
     }
     else
     {
         if (this._localFileHeader.CompressionMethod != CompressionMethodEnum.Stored)
         {
             throw new NotSupportedException(SR.Get("ZipNotSupportedCompressionMethod"));
         }
         this._crcCalculatingStream = new ProgressiveCrcCalculatingStream(this._blockManager, this._fileItemStream, this.Crc32);
     }
     this.Validate(fileName, centralDir, centralDirFileHeader);
 }
コード例 #2
0
ファイル: ZipIOLocalFileBlock.cs プロジェクト: slolam/XecMe
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && !this._disposedFlag)
     {
         try
         {
             this.CloseExposedStreams();
             this._crcCalculatingStream.Close();
             if (this._deflateStream != null)
             {
                 this._deflateStream.Close();
             }
             this._fileItemStream.Close();
         }
         finally
         {
             this._disposedFlag         = true;
             this._crcCalculatingStream = null;
             this._deflateStream        = null;
             this._fileItemStream       = null;
         }
     }
 }