From 2d7df0d4fb26143becb6c5619c8f4a7edbdc6576 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 17 Apr 2024 15:59:56 -0400 Subject: [PATCH] Add PKZIP archive model --- PKZIP/Archive.cs | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 PKZIP/Archive.cs diff --git a/PKZIP/Archive.cs b/PKZIP/Archive.cs new file mode 100644 index 0000000..6d96999 --- /dev/null +++ b/PKZIP/Archive.cs @@ -0,0 +1,71 @@ +namespace SabreTools.Models.PKZIP +{ + /// + /// Represents a single ZIP/ZIP64 archive + /// + public class Archive + { + #region Entries, Interleaved + + /// + /// Local file headers, always appear first in each group + /// + public LocalFileHeader[]? LocalFileHeaders { get; set; } + + /// + /// Encryption headers, may appear second in each group + /// + /// TODO: Determine the model for the encryption headers + public byte[]?[]? EncryptionHeaders { get; set; } + + /// + /// File data, appears after the encryption header + /// if it exists or after the local file header otherwise + /// + public byte[][]? FileData { get; set; } + + /// + /// Data descriptors, appears after the file data + /// + public DataDescriptor?[]? DataDescriptors { get; set; } + + /// + /// ZIP64 Data descriptors, appears after the file data + /// + public DataDescriptor64?[]? ZIP64DataDescriptors { get; set; } + + #endregion + + /// + /// Optional archive decryption header, appears after all entries + /// + /// TODO: Determine the model + public byte[]? ArchiveDecryptionHeader { get; set; } + + /// + /// Optional archive extra data record, appears after either + /// the archive decryption header or after all entries + /// + public ArchiveExtraDataRecord? ArchiveExtraDataRecord { get; set; } + + /// + /// Central directory headers in sequential order + /// + public CentralDirectoryFileHeader[]? CentralDirectoryHeaders { get; set; } + + /// + /// Optional ZIP64 end of central directory record + /// + public EndOfCentralDirectoryRecord64? ZIP64EndOfCentralDirectoryRecord { get; set; } + + /// + /// Optional ZIP64 end of central directory locator + /// + public EndOfCentralDirectoryLocator64? ZIP64EndOfCentralDirectoryLocator { get; set; } + + /// + /// Required end of central directory record, always must be last + /// + public EndOfCentralDirectoryRecord? EndOfCentralDirectoryRecord { get; set; } + } +} \ No newline at end of file