Example #1
0
        public Stream Open()
        {
            if (Archive.disposed)
            {
                throw new ObjectDisposedException("The zip archive for this entry has been disposed.");
            }

            if (openStream != null && Archive.Mode == ZipArchiveMode.Update)
            {
                throw new IOException("The entry is already currently open for writing.");
            }

            if (wasDeleted)
            {
                throw new IOException("The entry has been deleted from the archive.");
            }

            if (Archive.Mode == ZipArchiveMode.Create && openStream != null)
            {
                throw new IOException("The archive for this entry was opened with the Create mode, and this entry has already been written to.");
            }

            var entryStream = entry.OpenEntryStream();

            openStream = new ZipArchiveEntryStream(this, entryStream);

            return(openStream);
        }
Example #2
0
		public Stream Open()
		{
			if (Archive.disposed)
				throw new ObjectDisposedException("The zip archive for this entry has been disposed.");

			if (openStream != null && Archive.Mode == ZipArchiveMode.Update)
				throw new IOException("The entry is already currently open for writing.");

			if (wasDeleted)
				throw new IOException("The entry has been deleted from the archive.");

			if (Archive.Mode == ZipArchiveMode.Create && openStream != null)
				throw new IOException("The archive for this entry was opened with the Create mode, and this entry has already been written to.");

			openStream = new ZipArchiveEntryStream(this, entry.OpenEntryStream());

			return openStream;
		}