2 using System.Collections.Generic;
4 using SharpCompress.Common;
5 using SharpCompress.IO;
7 namespace SharpCompress.Archive.Zip
9 internal class ZipWritableArchiveEntry : ZipArchiveEntry, IWritableArchiveEntry
11 private readonly string path;
12 private readonly long size;
13 private readonly DateTime? lastModified;
14 private readonly bool closeStream;
15 private readonly Stream stream;
16 private bool isDisposed;
18 internal ZipWritableArchiveEntry(ZipArchive archive, Stream stream, string path, long size,
19 DateTime? lastModified, bool closeStream)
25 this.lastModified = lastModified;
26 this.closeStream = closeStream;
29 public override uint Crc
34 public override string Key
39 public override long CompressedSize
44 public override long Size
49 public override DateTime? LastModifiedTime
51 get { return lastModified; }
54 public override DateTime? CreatedTime
59 public override DateTime? LastAccessedTime
64 public override DateTime? ArchivedTime
69 public override bool IsEncrypted
74 public override bool IsDirectory
79 public override bool IsSplit
84 internal override IEnumerable<FilePart> Parts
86 get { throw new NotImplementedException(); }
89 Stream IWritableArchiveEntry.Stream
97 public override Stream OpenEntryStream()
99 //ensure new stream is at the start, this could be reset
100 stream.Seek(0, SeekOrigin.Begin);
101 return new NonDisposingStream(stream);
104 internal override void Close()
106 if (closeStream && !isDisposed)