mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-05-06 20:43:36 +00:00
Document alternative TGZ layout
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user