diff --git a/BurnOutSharp.Models/TAR/Archive.cs b/BurnOutSharp.Models/TAR/Archive.cs new file mode 100644 index 00000000..7e7fdc10 --- /dev/null +++ b/BurnOutSharp.Models/TAR/Archive.cs @@ -0,0 +1,10 @@ +namespace BurnOutSharp.Models.TAR +{ + public sealed class Archive + { + /// + /// File header + /// + public Header Header { get; set; } + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/TAR/Enums.cs b/BurnOutSharp.Models/TAR/Enums.cs new file mode 100644 index 00000000..692211cd --- /dev/null +++ b/BurnOutSharp.Models/TAR/Enums.cs @@ -0,0 +1,157 @@ +using System; + +namespace BurnOutSharp.Models.TAR +{ + [Flags] + public enum Mode : ushort + { + /// + /// Execute/search by other + /// + TOEXEC = 0x0001, + + /// + /// Write by other + /// + TOWRITE = 0x0002, + + /// + /// Read by other + /// + TOREAD = 0x0004, + + /// + /// Execute/search by group + /// + TGEXEC = 0x0008, + + /// + /// Write by group + /// + TGWRITE = 0x0010, + + /// + /// Read by group + /// + TGREAD = 0x0020, + + /// + /// Execute/search by owner + /// + TUEXEC = 0x0040, + + /// + /// Write by owner + /// + TUWRITE = 0x0080, + + /// + /// Read by owner + /// + TUREAD = 0x0100, + + /// + /// Reserved + /// + TSVTX = 0x0200, + + /// + /// Set GID on execution + /// + TSGID = 0x0400, + + /// + /// Set UID on execution + /// + TSUID = 0x0800, + } + + public enum TypeFlag : byte + { + /// + /// Regular file + /// + REGTYPE = (byte)'0', + + /// + /// Regular file + /// + AREGTYPE = 0, + + /// + /// Hard link + /// + LNKTYPE = (byte)'1', + + /// + /// Symbolic link + /// + SYMTYPE = (byte)'2', + + /// + /// Character special + /// + CHRTYPE = (byte)'3', + + /// + /// Block special + /// + BLKTYPE = (byte)'4', + + /// + /// Directory + /// + DIRTYPE = (byte)'5', + + /// + /// FIFO + /// + FIFOTYPE = (byte)'6', + + /// + /// Contiguous file + /// + CONTTYPE = (byte)'7', + + /// + /// Global extended header with meta data (POSIX.1-2001) + /// + XHDTYPE = (byte)'g', + + /// + /// Extended header with metadata for the next file in the archive (POSIX.1-2001) + /// + XGLTYPE = (byte)'x', + + #region Vendor-Specific Extensions (POSIX.1-1988) + + VendorSpecificA = (byte)'A', + VendorSpecificB = (byte)'B', + VendorSpecificC = (byte)'C', + VendorSpecificD = (byte)'D', + VendorSpecificE = (byte)'E', + VendorSpecificF = (byte)'F', + VendorSpecificG = (byte)'G', + VendorSpecificH = (byte)'H', + VendorSpecificI = (byte)'I', + VendorSpecificJ = (byte)'J', + VendorSpecificK = (byte)'K', + VendorSpecificL = (byte)'L', + VendorSpecificM = (byte)'M', + VendorSpecificN = (byte)'N', + VendorSpecificO = (byte)'O', + VendorSpecificP = (byte)'P', + VendorSpecificQ = (byte)'Q', + VendorSpecificR = (byte)'R', + VendorSpecificS = (byte)'S', + VendorSpecificT = (byte)'T', + VendorSpecificU = (byte)'U', + VendorSpecificV = (byte)'V', + VendorSpecificW = (byte)'W', + VendorSpecificX = (byte)'X', + VendorSpecificY = (byte)'Y', + VendorSpecificZ = (byte)'Z', + + #endregion + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/TAR/Header.cs b/BurnOutSharp.Models/TAR/Header.cs new file mode 100644 index 00000000..790680f1 --- /dev/null +++ b/BurnOutSharp.Models/TAR/Header.cs @@ -0,0 +1,85 @@ +namespace BurnOutSharp.Models.TAR +{ + public sealed class Header + { + /// + /// File name + /// + public string FileName; + + /// + /// File mode + /// + public Mode Mode; + + /// + /// Owner's numeric user ID + /// + public uint UID; + + /// + /// Owner's numeric user ID + /// + public uint GID; + + /// + /// File size in bytes + /// + public ulong Size; + + /// + /// Last modification time in numeric Unix time format + /// + public ulong ModifiedTime; + + /// + /// Checksum for header record + /// + public ushort Checksum; + + /// + /// Link indicator (file type) / Type flag + /// + public TypeFlag TypeFlag; + + /// + /// Name of linked file + /// + public string LinkName; + + /// + /// UStar indicator, "ustar", then NUL + /// + public string Magic; + + /// + /// UStar version, "00" + /// + public string Version; + + /// + /// Owner user name + /// + public string UserName; + + /// + /// Owner group name + /// + public string GroupName; + + /// + /// Device major number + /// + public string DevMajor; + + /// + /// Device minor number + /// + public string DevMinor; + + /// + /// Filename prefix + /// + public string Prefix; + } +} \ No newline at end of file