예제 #1
0
 private void VersionToExtractAtLeast(ZipVersionNeededValues value)
 {
     if (this._versionToExtract < value)
     {
         this._versionToExtract = value;
     }
 }
예제 #2
0
 internal ZipArchiveEntry(ZipArchive archive, ZipCentralDirectoryFileHeader cd)
 {
     this._archive                      = archive;
     this._originallyInArchive          = true;
     this._diskNumberStart              = cd.DiskNumberStart;
     this._versionToExtract             = (ZipVersionNeededValues)cd.VersionNeededToExtract;
     this._generalPurposeBitFlag        = (ZipArchiveEntry.BitFlagValues)cd.GeneralPurposeBitFlag;
     this.CompressionMethod             = (ZipArchiveEntry.CompressionMethodValues)cd.CompressionMethod;
     this._lastModified                 = new DateTimeOffset(ZipHelper.DosTimeToDateTime(cd.LastModified));
     this._compressedSize               = cd.CompressedSize;
     this._uncompressedSize             = cd.UncompressedSize;
     this._externalFileAttr             = cd.ExternalFileAttributes;
     this._offsetOfLocalHeader          = cd.RelativeOffsetOfLocalHeader;
     this._storedOffsetOfCompressedData = null;
     this._crc32                  = cd.Crc32;
     this._compressedBytes        = null;
     this._storedUncompressedData = null;
     this._currentlyOpenForWrite  = false;
     this._everOpenedForWrite     = false;
     this._outstandingWriteStream = null;
     this.FullName                = this.DecodeEntryName(cd.Filename);
     this._lhUnknownExtraFields   = null;
     this._cdUnknownExtraFields   = cd.ExtraFields;
     this._fileComment            = cd.FileComment;
     this._compressionLevel       = null;
 }
예제 #3
0
 internal ZipArchiveEntry(ZipArchive archive, string entryName)
 {
     this._archive                      = archive;
     this._originallyInArchive          = false;
     this._diskNumberStart              = 0;
     this._versionToExtract             = ZipVersionNeededValues.Default;
     this._generalPurposeBitFlag        = (ZipArchiveEntry.BitFlagValues) 0;
     this.CompressionMethod             = ZipArchiveEntry.CompressionMethodValues.Deflate;
     this._lastModified                 = DateTimeOffset.Now;
     this._compressedSize               = (long)0;
     this._uncompressedSize             = (long)0;
     this._externalFileAttr             = 0;
     this._offsetOfLocalHeader          = (long)0;
     this._storedOffsetOfCompressedData = null;
     this._crc32                  = 0;
     this._compressedBytes        = null;
     this._storedUncompressedData = null;
     this._currentlyOpenForWrite  = false;
     this._everOpenedForWrite     = false;
     this._outstandingWriteStream = null;
     this.FullName                = entryName;
     this._cdUnknownExtraFields   = null;
     this._lhUnknownExtraFields   = null;
     this._fileComment            = null;
     this._compressionLevel       = null;
     if ((int)this._storedEntryNameBytes.Length > 65535)
     {
         throw new ArgumentException(Messages.EntryNamesTooLong);
     }
     if (this._archive.Mode == ZipArchiveMode.Create)
     {
         this._archive.AcquireArchiveStream(this);
     }
 }
예제 #4
0
        //Initializes, attaches it to archive
        internal ZipArchiveEntry(ZipArchive archive, ZipCentralDirectoryFileHeader cd)
        {
            _archive = archive;

            _originallyInArchive = true;

            _diskNumberStart = cd.DiskNumberStart;
            _versionToExtract = (ZipVersionNeededValues)cd.VersionNeededToExtract;
            _generalPurposeBitFlag = (BitFlagValues)cd.GeneralPurposeBitFlag;
            CompressionMethod = (CompressionMethodValues)cd.CompressionMethod;
            _lastModified = new DateTimeOffset(ZipHelper.DosTimeToDateTime(cd.LastModified));
            _compressedSize = cd.CompressedSize;
            _uncompressedSize = cd.UncompressedSize;
            _offsetOfLocalHeader = cd.RelativeOffsetOfLocalHeader;
            /* we don't know this yet: should be _offsetOfLocalHeader + 30 + _storedEntryNameBytes.Length + extrafieldlength
                * but entryname/extra length could be different in LH
                */
            _storedOffsetOfCompressedData = null;
            _crc32 = cd.Crc32;

            _compressedBytes = null;
            _storedUncompressedData = null;
            _currentlyOpenForWrite = false;
            _everOpenedForWrite = false;
            _outstandingWriteStream = null;

            FullName = DecodeEntryName(cd.Filename);

            _lhUnknownExtraFields = null;
            //the cd should have these as null if we aren't in Update mode
            _cdUnknownExtraFields = cd.ExtraFields;
            _fileComment = cd.FileComment;

            _compressionLevel = null;
        }
예제 #5
0
        private void VersionToExtractAtLeast(ZipVersionNeededValues value)
        {
            if (this._versionToExtract >= value)
            {
                return;
            }

            this._versionToExtract = value;
        }
예제 #6
0
 private void VersionToExtractAtLeast(ZipVersionNeededValues value)
 {
     if (_versionToExtract < value)
     {
         _versionToExtract = value;
     }
     if (_versionMadeBySpecification < value)
     {
         _versionMadeBySpecification = value;
     }
 }
예제 #7
0
        // Initializes new entry
        internal ZipArchiveEntry(ZipArchive archive, string entryName)
        {
            _archive = archive;

            _originallyInArchive = false;

            _diskNumberStart            = 0;
            _versionMadeByPlatform      = CurrentZipPlatform;
            _versionMadeBySpecification = ZipVersionNeededValues.Default;
            _versionToExtract           = ZipVersionNeededValues.Default; // this must happen before following two assignment
            _generalPurposeBitFlag      = 0;
            CompressionMethod           = CompressionMethodValues.Deflate;
            _lastModified = DateTimeOffset.Now;

            _compressedSize               = 0; // we don't know these yet
            _uncompressedSize             = 0;
            _externalFileAttr             = 0;
            _offsetOfLocalHeader          = 0;
            _storedOffsetOfCompressedData = null;
            _crc32 = 0;

            _compressedBytes        = null;
            _storedUncompressedData = null;
            _currentlyOpenForWrite  = false;
            _everOpenedForWrite     = false;
            _outstandingWriteStream = null;

            FullName = entryName;

            _cdUnknownExtraFields = null;
            _lhUnknownExtraFields = null;
            _fileComment          = null;

            _compressionLevel = null;

            if (_storedEntryNameBytes.Length > ushort.MaxValue)
            {
                throw new ArgumentException();
            }

            // grab the stream if we're in create mode
            if (_archive.Mode == ZipArchiveMode.Create)
            {
                _archive.AcquireArchiveStream(this);
            }
        }
예제 #8
0
        // Initializes, attaches it to archive
        internal ReadOnlyZipArchiveEntry(ReadOnlyZipArchive archive, ZipCentralDirectoryFileHeader cd)
        {
            _archive = archive;

            _originallyInArchive = true;

            _diskNumberStart            = cd.DiskNumberStart;
            _versionMadeByPlatform      = ( ZipVersionMadeByPlatform )cd.VersionMadeByCompatibility;
            _versionMadeBySpecification = ( ZipVersionNeededValues )cd.VersionMadeBySpecification;
            _versionToExtract           = ( ZipVersionNeededValues )cd.VersionNeededToExtract;
            _generalPurposeBitFlag      = ( BitFlagValues )cd.GeneralPurposeBitFlag;
            CompressionMethod           = ( CompressionMethodValues )cd.CompressionMethod;
            _lastModified        = new DateTimeOffset(ZipHelper.DosTimeToDateTime(cd.LastModified));
            _compressedSize      = cd.CompressedSize;
            _uncompressedSize    = cd.UncompressedSize;
            _externalFileAttr    = cd.ExternalFileAttributes;
            _offsetOfLocalHeader = cd.RelativeOffsetOfLocalHeader;
            // we don't know this yet: should be _offsetOfLocalHeader + 30 + _storedEntryNameBytes.Length + extrafieldlength
            // but entryname/extra length could be different in LH
            _storedOffsetOfCompressedData = null;
            _crc32 = cd.Crc32;

            _compressedBytes        = null;
            _storedUncompressedData = null;
            _currentlyOpenForWrite  = false;
            _everOpenedForWrite     = false;
            _outstandingWriteStream = null;

            FullName = DecodeEntryName(cd.Filename);

            _lhUnknownExtraFields = null;
            // the cd should have these as null if we aren't in Update mode
            _cdUnknownExtraFields = cd.ExtraFields;
            _fileComment          = cd.FileComment;

            _compressionLevel = null;
        }
예제 #9
0
        internal ZipArchiveEntry(ZipArchive archive, string entryName, FileAttributes entryFileAttributes)
        {
            this._archive                      = archive;
            this._originallyInArchive          = false;
            this._diskNumberStart              = 0;
            this._versionToExtract             = ZipVersionNeededValues.Default;
            this._generalPurposeBitFlag        = (ZipArchiveEntry.BitFlagValues) 0;
            this.CompressionMethod             = ZipArchiveEntry.CompressionMethodValues.Deflate;
            this._lastModified                 = DateTimeOffset.Now;
            this._compressedSize               = 0L;
            this._uncompressedSize             = 0L;
            this._offsetOfLocalHeader          = 0L;
            this._storedOffsetOfCompressedData = new long?();
            this._crc32                  = 0U;
            this._compressedBytes        = (byte[])null;
            this._storedUncompressedData = (MemoryStream)null;
            this._currentlyOpenForWrite  = false;
            this._everOpenedForWrite     = false;
            this._outstandingWriteStream = (Stream)null;
            this.FullName                = entryName;
            this._cdUnknownExtraFields   = (List <ZipGenericExtraField>)null;
            this._lhUnknownExtraFields   = (List <ZipGenericExtraField>)null;
            this._fileComment            = (byte[])null;
            this._externalFileAttributes = (uint)entryFileAttributes;

            if (this._storedEntryNameBytes.Length > (int)ushort.MaxValue)
            {
                throw new ArgumentException(CompressionConstants.EntryNamesTooLong);
            }

            if (this._archive.Mode != ZipArchiveMode.Create)
            {
                return;
            }

            this._archive.AcquireArchiveStream(this);
        }
예제 #10
0
        //Initializes new entry
        internal ZipArchiveEntry(ZipArchive archive, String entryName)
        {
            _archive = archive;

            _originallyInArchive = false;

            _diskNumberStart = 0;
            _versionMadeByPlatform = CurrentZipPlatform;
            _versionMadeBySpecification = ZipVersionNeededValues.Default;
            _versionToExtract = ZipVersionNeededValues.Default; //this must happen before following two assignment
            _generalPurposeBitFlag = 0;
            CompressionMethod = CompressionMethodValues.Deflate;
            _lastModified = DateTimeOffset.Now;

            _compressedSize = 0; //we don't know these yet
            _uncompressedSize = 0;
            _offsetOfLocalHeader = 0;
            _storedOffsetOfCompressedData = null;
            _crc32 = 0;

            _compressedBytes = null;
            _storedUncompressedData = null;
            _currentlyOpenForWrite = false;
            _everOpenedForWrite = false;
            _outstandingWriteStream = null;

            FullName = entryName;

            _cdUnknownExtraFields = null;
            _lhUnknownExtraFields = null;
            _fileComment = null;

            _compressionLevel = null;

            if (_storedEntryNameBytes.Length > UInt16.MaxValue)
                throw new ArgumentException(SR.EntryNamesTooLong);

            //grab the stream if we're in create mode
            if (_archive.Mode == ZipArchiveMode.Create)
            {
                _archive.AcquireArchiveStream(this);
            }
        }
예제 #11
0
 private void VersionToExtractAtLeast(ZipVersionNeededValues value)
 {
     if (_versionToExtract < value)
     {
         _versionToExtract = value;
     }
     if (_versionMadeBySpecification < value)
     {
         _versionMadeBySpecification = value;
     }
 }
예제 #12
0
 private void VersionToExtractAtLeast(ZipVersionNeededValues value)
 {
     if (_versionToExtract < value)
     {
         _versionToExtract = value;
     }
 }