Document alternative TGZ layout

This commit is contained in:
Matt Nadareski
2026-04-25 21:45:53 -04:00
parent b9b1b24f67
commit 201af08f5f
2 changed files with 34 additions and 2 deletions

View File

@@ -66,6 +66,32 @@ namespace SabreTools.Data.Models.GZIP
RESERVED7 = 0x80,
}
/// <summary>
/// TorrentGZ alternative header types
/// </summary>
public enum HeaderFileType
{
// Archive
Nothing = 0x00,
ZIP = 0x01,
GZ = 0x02,
SevenZip = 0x03,
RAR = 0x04,
// Specialty
CHD = 0x05,
// Copier header
A7800 = 0x06,
Lynx = 0x07,
FDS = 0x08,
NES = 0x09,
PCE = 0x0A,
PSID = 0x0B,
SNES = 0x0C,
SPC = 0x0D,
}
/// <see href="https://www.ietf.org/rfc/rfc1952.txt"/>
public enum OperatingSystem : byte
{

View File

@@ -155,9 +155,15 @@ namespace SabreTools.Wrappers
// - 0x00-0x0F - MD5 hash of the internal file
// - 0x10-0x13 - CRC-32 checksum of the internal file
// - 0x14-0x1B - Little-endian file size of the internal file
if (Header.ExtraLength != 0x1C)
// The following fields are included for alternate headers:
// - 0x1C - Alternative header type
// - 0x1D-0x2C - Alternative MD5 hash
// - 0x2D-0x40 - Alternative SHA-1 hash
// - 0x41-0x44 - Alternative CRC-32 checksum
// - 0x45-0x48 - Alternative little-endian uncompressed file size
if (Header.ExtraLength != 0x1C && Header.ExtraLength != 0x4D)
return false;
if (Header.ExtraFieldBytes is null || Header.ExtraFieldBytes.Length != 0x1C)
if (Header.ExtraFieldBytes is null || (Header.ExtraFieldBytes.Length != 0x1C && Header.ExtraFieldBytes.Length != 0x4D))
return false;
return true;