GZipEntry.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. namespace SharpCompress.Common.GZip
  6. {
  7. public class GZipEntry : Entry
  8. {
  9. private readonly GZipFilePart _filePart;
  10. internal GZipEntry(GZipFilePart filePart)
  11. {
  12. _filePart = filePart;
  13. }
  14. public override CompressionType CompressionType => CompressionType.GZip;
  15. public override long Crc => 0;
  16. public override string Key => _filePart.FilePartName;
  17. public override long CompressedSize => 0;
  18. public override long Size => 0;
  19. public override DateTime? LastModifiedTime => _filePart.DateModified;
  20. public override DateTime? CreatedTime => null;
  21. public override DateTime? LastAccessedTime => null;
  22. public override DateTime? ArchivedTime => null;
  23. public override bool IsEncrypted => false;
  24. public override bool IsDirectory => false;
  25. public override bool IsSplitAfter => false;
  26. internal override IEnumerable<FilePart> Parts => _filePart.AsEnumerable<FilePart>();
  27. internal static IEnumerable<GZipEntry> GetEntries(Stream stream, OptionsBase options)
  28. {
  29. yield return new GZipEntry(new GZipFilePart(stream, options.ArchiveEncoding));
  30. }
  31. }
  32. }