using System; using System.Collections.Generic; using System.Linq; using SharpCompress.Common.Options; namespace SharpCompress.Common; public abstract class Entry : IEntry { /// /// The File's 32 bit CRC Hash /// public abstract long Crc { get; } /// /// The string key of the file internal to the Archive. /// public abstract string? Key { get; } /// /// The target of a symlink entry internal to the Archive. Will be null if not a symlink. /// public abstract string? LinkTarget { get; } /// /// The compressed file size /// public abstract long CompressedSize { get; } /// /// The compression type /// public abstract CompressionType CompressionType { get; } /// /// The uncompressed file size /// public abstract long Size { get; } /// /// The entry last modified time in the archive, if recorded /// public abstract DateTime? LastModifiedTime { get; } /// /// The entry create time in the archive, if recorded /// public abstract DateTime? CreatedTime { get; } /// /// The entry last accessed time in the archive, if recorded /// public abstract DateTime? LastAccessedTime { get; } /// /// The entry time when archived, if recorded /// public abstract DateTime? ArchivedTime { get; } /// /// Entry is password protected and encrypted and cannot be extracted. /// public abstract bool IsEncrypted { get; } /// /// Entry is directory. /// public abstract bool IsDirectory { get; } /// /// Entry is split among multiple volumes /// public abstract bool IsSplitAfter { get; } public int VolumeIndexFirst => Parts.FirstOrDefault()?.Index ?? 0; public int VolumeIndexLast => Parts.LastOrDefault()?.Index ?? 0; /// public override string ToString() => Key ?? "Entry"; internal abstract IEnumerable Parts { get; } public bool IsSolid { get; set; } internal virtual void Close() { } /// /// Entry file attribute. /// public virtual int? Attrib => throw new NotImplementedException(); /// /// The options used when opening this entry's source (reader or archive). /// public IReaderOptions Options { get; protected set; } protected Entry(IReaderOptions readerOptions) { Options = readerOptions; } }