namespace SabreTools.Data.Models.ZArchive
{
///
public static class Constants
{
///
/// Number of compressed blocks referred to by a record
///
public const int BlockSize = 64 * 1024;
///
/// Number of compressed blocks referred to by a record
///
public const int BlocksPerOffsetRecord = 16;
///
/// Number of bytes stored in an offset record
///
public const int OffsetRecordSize = sizeof(ulong) + (sizeof(ushort) * BlocksPerOffsetRecord);
///
/// Number of bytes stored in a file/directory entry
///
public const int FileDirectoryEntrySize = 16;
///
/// Number of bytes stored in the footer
/// 6 OffsetInfo fields,
///
public const int FooterSize = 144;
///
/// NameOffsetAndTypeFlag value for the root node in the FileTree
///
public const uint RootNode = 0x7FFFFFFF;
///
/// Mask for the NameOffsetAndTypeFlag value when checking if it is a file
///
public const uint FileFlag = 0x80000000;
///
/// Maximum size of the Offset Records section
///
public const ulong MaxOffsetRecordsSize = 0xFFFFFFFF;
///
/// Maximum size of the Offset Records section
///
public const ulong MaxNameTableSize = 0x7FFFFFFF;
///
/// Maximum size of the File Tree section
///
public const ulong MaxFileTreeSize = 0x7FFFFFFF;
///
/// ZArchive magic bytes at end of file
///
public static readonly byte[] MagicBytes = [0x16, 0x9F, 0x52, 0xD6];
///
/// ZArchive version field that acts as an extended magic immediately before final 4 magic bytes
/// Currently only version 1 is implemented, any future version bytes are not suppported yet
///
public static readonly byte[] Version1Bytes = [0x61, 0xBF, 0x3A, 0x01];
}
}