using System; using SharpCompress.Common.Rar.Headers; namespace SharpCompress.Common.Rar { public abstract class RarEntry : Entry { internal abstract FileHeader FileHeader { get; } /// /// As the V2017 port isn't complete, add this check to use the legacy Rar code. /// internal bool IsRarV3 => FileHeader.CompressionAlgorithm == 29 || FileHeader.CompressionAlgorithm == 36; /// /// The File's 32 bit CRC Hash /// public override long Crc => FileHeader.FileCrc; /// /// The path of the file internal to the Rar Archive. /// public override string Key => FileHeader.FileName; /// /// The entry last modified time in the archive, if recorded /// public override DateTime? LastModifiedTime => FileHeader.FileLastModifiedTime; /// /// The entry create time in the archive, if recorded /// public override DateTime? CreatedTime => FileHeader.FileCreatedTime; /// /// The entry last accessed time in the archive, if recorded /// public override DateTime? LastAccessedTime => FileHeader.FileLastAccessedTime; /// /// The entry time whend archived, if recorded /// public override DateTime? ArchivedTime => FileHeader.FileArchivedTime; /// /// Entry is password protected and encrypted and cannot be extracted. /// public override bool IsEncrypted => FileHeader.IsEncrypted; /// /// Entry is password protected and encrypted and cannot be extracted. /// public override bool IsDirectory => FileHeader.IsDirectory; public override bool IsSplitAfter => FileHeader.IsSplitAfter; public override string ToString() { return string.Format("Entry Path: {0} Compressed Size: {1} Uncompressed Size: {2} CRC: {3}", Key, CompressedSize, Size, Crc); } } }