using System; namespace Packaging.Targets.IO { /// /// Represents an entry in a Unix archive (usually a CPIO or tar archive). /// public class ArchiveEntry { /// /// Gets or sets the full path of the file or directory on the target file system. /// public string TargetPath { get; set; } /// /// Gets or sets the name of the owner of the file or directory. /// public string Owner { get; set; } /// /// Gets or sets the name of the group of the file or directory. /// public string Group { get; set; } /// /// Gets or sets the file mode of the file. /// public LinuxFileMode Mode { get; set; } /// /// Gets or sets the full path to the file on the source operating system. /// public string SourceFilename { get; set; } /// /// Gets or sets the total file size, in bytes. /// public uint FileSize { get; set; } /// /// Gets or sets the date at which the file was last modified. /// public DateTimeOffset Modified { get; set; } /// /// Gets or sets the SHA256 of the file contents. /// public byte[] Sha256 { get; set; } /// /// Gets or sets the MD5 of the file contents. /// public byte[] Md5Hash { get; set; } /// /// Gets or sets the file type (executable or not). /// public ArchiveEntryType Type { get; set; } /// /// Gets or sets, if the file is a link, the link target. /// public string LinkTo { get; set; } /// /// Gets or sets the inode number for the file. /// public uint Inode { get; set; } /// /// Gets or sets a value indicating whether the file only contains ASCII characters. /// public bool IsAscii { get; set; } /// /// Gets or sets a value indicating whether this entry (and any child entries) is forcefully /// removed when the application is uninstalled. /// public bool RemoveOnUninstall { get; set; } /// /// Gets the file name, including a final slash if the file is a directory. /// Used when sorting entries to make sure a directory entry immediately preceeds /// all of its children. /// public string TargetPathWithFinalSlash { get { if (this.Mode.HasFlag(LinuxFileMode.S_IFDIR) && !this.TargetPath.EndsWith("/")) { return this.TargetPath + "/"; } else { return this.TargetPath; } } } /// /// Gets the file name, excluding a final slash even if the file is a directory. /// public string TargetPathWithoutFinalSlash { get { return this.TargetPath?.TrimEnd('/'); } } /// public override string ToString() { return this.TargetPath; } } }