34 Commits
1.1.0 ... 1.1.5

Author SHA1 Message Date
Matt Nadareski
21e22a1476 Bump version 2023-10-25 12:36:33 -04:00
Matt Nadareski
016057a837 Add mapping dictionaries for Xbox 2023-10-24 22:48:41 -04:00
Matt Nadareski
69ca889ac7 Add version guards around LZX.Chunk 2023-10-24 21:45:32 -04:00
Matt Nadareski
cd67a7282b Add version guards to IRD model 2023-10-23 11:33:50 -04:00
Matt Nadareski
948edbad58 Merge pull request #4 from Deterous/Deterous-patch-1
Improve IRD Model
2023-10-23 10:54:21 -04:00
Deterous
d445f02ba6 Specify the reserved attributes 2023-10-23 12:23:55 +13:00
Deterous
835fce7876 Comment on UID 2023-10-23 12:00:05 +13:00
Deterous
97513840e0 ID and UID are the same Property 2023-10-23 11:53:34 +13:00
Matt Nadareski
6112dcb391 Add IRD model 2023-10-22 01:03:34 -04:00
Matt Nadareski
c000e581c8 Bump version 2023-09-28 23:24:58 -04:00
Matt Nadareski
465cef4224 Add XGD4 identifier for PIC 2023-09-28 23:21:44 -04:00
Matt Nadareski
87cadbfd2b Add documentation around Quantum 2023-09-22 21:24:05 -04:00
Matt Nadareski
648ee2eaa5 Add back two properties 2023-09-22 21:15:52 -04:00
Matt Nadareski
daa814728d Simplify the Quantum models for now 2023-09-22 21:13:31 -04:00
Matt Nadareski
68aac36623 Fully create Chunk and ChunkHeader 2023-09-22 21:00:41 -04:00
Matt Nadareski
0c95cfcde4 More LZX cleanup 2023-09-22 20:47:29 -04:00
Matt Nadareski
6d6361c153 Start making LZX models better 2023-09-22 20:40:22 -04:00
Matt Nadareski
e4be402052 Bump version 2023-09-22 16:02:57 -04:00
Matt Nadareski
182c9bc756 Add remark on DeflateBlock 2023-09-22 15:37:49 -04:00
Matt Nadareski
cc62b3ffae This is an array 2023-09-22 15:34:55 -04:00
Matt Nadareski
7d34f486cd Make the MSZIP models better 2023-09-22 15:32:19 -04:00
Matt Nadareski
9c68cfc0c1 Fix issues found during MSZIP research 2023-09-22 11:54:48 -04:00
Matt Nadareski
9a5d681ad2 Bump version 2023-09-13 13:55:46 -04:00
Matt Nadareski
afb20e00be Add PIC models from MPF 2023-09-13 12:20:01 -04:00
Matt Nadareski
5a055a98c7 Add XMID and XeMID models from MPF 2023-09-13 12:11:56 -04:00
Matt Nadareski
793a4e2fdd Add cuesheet models from MPF 2023-09-13 11:34:58 -04:00
Matt Nadareski
43ff569ae3 Bump version 2023-09-10 21:40:05 -04:00
Matt Nadareski
970d2bddf9 Remove some lingering layout 2023-09-10 21:37:44 -04:00
Matt Nadareski
41a90278d5 Remove LayoutKind.Sequential
This may be replaced in the future when byte-serialzable types are more well-defined
2023-09-10 21:33:22 -04:00
Matt Nadareski
670b8428c2 Ensure explicit getters and setters 2023-09-10 21:24:10 -04:00
Matt Nadareski
e3c5c76ee5 Ensure more correct nullability 2023-09-10 20:47:25 -04:00
Matt Nadareski
89ba5f4508 Ensure more correct nullability 2023-09-10 20:27:14 -04:00
Matt Nadareski
ce072691bb Add first set of CHD models 2023-09-08 13:33:50 -04:00
Matt Nadareski
c52226cd3e Add Nuget link 2023-09-04 21:58:17 -04:00
350 changed files with 4769 additions and 3226 deletions

View File

@@ -9,9 +9,9 @@ namespace SabreTools.Models.AACS
/// Null-terminated ASCII string representing the copyright
/// </summary>
#if NET48
public string Copyright;
public string Copyright { get; set; }
#else
public string? Copyright;
public string? Copyright { get; set; }
#endif
}
}

View File

@@ -9,7 +9,7 @@ namespace SabreTools.Models.AACS
/// field indicates that only one ID is being revoked, a value of one
/// in the Range field indicates two IDs are being revoked, and so on.
/// </summary>
public ushort Range;
public ushort Range { get; set; }
/// <summary>
/// A 6-byte Drive ID value identifying the Licensed Drive being revoked
@@ -17,9 +17,9 @@ namespace SabreTools.Models.AACS
/// case of a non-zero Range value).
/// </summary>
#if NET48
public byte[] DriveID;
public byte[] DriveID { get; set; }
#else
public byte[]? DriveID;
public byte[]? DriveID { get; set; }
#endif
}
}

View File

@@ -16,15 +16,15 @@ namespace SabreTools.Models.AACS
/// <summary>
/// The total number of Drive Revocation List Entry fields that follow.
/// </summary>
public uint TotalNumberOfEntries;
public uint TotalNumberOfEntries { get; set; }
/// <summary>
/// Revocation list entries
/// </summary>
#if NET48
public DriveRevocationSignatureBlock[] SignatureBlocks;
public DriveRevocationSignatureBlock[] SignatureBlocks { get; set; }
#else
public DriveRevocationSignatureBlock[]? SignatureBlocks;
public DriveRevocationSignatureBlock?[]? SignatureBlocks { get; set; }
#endif
}
}

View File

@@ -6,16 +6,16 @@ namespace SabreTools.Models.AACS
/// <summary>
/// The number of Drive Revocation List Entry fields in the signature block.
/// </summary>
public uint NumberOfEntries;
public uint NumberOfEntries { get; set; }
/// <summary>
/// A list of 8-byte Host Drive List Entry fields, the length of this
/// list being equal to the number in the signature block.
/// </summary>
#if NET48
public DriveRevocationListEntry[] EntryFields;
public DriveRevocationListEntry[] EntryFields { get; set; }
#else
public DriveRevocationListEntry[]? EntryFields;
public DriveRevocationListEntry?[]? EntryFields { get; set; }
#endif
}
}

View File

@@ -19,9 +19,9 @@ namespace SabreTools.Models.AACS
/// must refuse to use the Media Key.
/// </summary>
#if NET48
public byte[] SignatureData;
public byte[] SignatureData { get; set; }
#else
public byte[]? SignatureData;
public byte[]? SignatureData { get; set; }
#endif
}
}

View File

@@ -7,9 +7,9 @@ namespace SabreTools.Models.AACS
/// In this record, each subset-difference is encoded with 5 bytes.
/// </summary>
#if NET48
public SubsetDifference[] SubsetDifferences;
public SubsetDifference[] SubsetDifferences { get; set; }
#else
public SubsetDifference[]? SubsetDifferences;
public SubsetDifference?[]? SubsetDifferences { get; set; }
#endif
}
}

View File

@@ -9,7 +9,7 @@ namespace SabreTools.Models.AACS
/// field indicates that only one ID is being revoked, a value of one
/// in the Range field indicates two IDs are being revoked, and so on.
/// </summary>
public ushort Range;
public ushort Range { get; set; }
/// <summary>
/// A 6-byte Host ID value identifying the host being revoked (or the
@@ -17,9 +17,9 @@ namespace SabreTools.Models.AACS
/// Range value).
/// </summary>
#if NET48
public byte[] HostID;
public byte[] HostID { get; set; }
#else
public byte[]? HostID;
public byte[]? HostID { get; set; }
#endif
}
}

View File

@@ -19,15 +19,15 @@ namespace SabreTools.Models.AACS
/// <summary>
/// The total number of Host Revocation List Entry fields that follow.
/// </summary>
public uint TotalNumberOfEntries;
public uint TotalNumberOfEntries { get; set; }
/// <summary>
/// Revocation list entries
/// </summary>
#if NET48
public HostRevocationSignatureBlock[] SignatureBlocks;
public HostRevocationSignatureBlock[] SignatureBlocks { get; set; }
#else
public HostRevocationSignatureBlock[]? SignatureBlocks;
public HostRevocationSignatureBlock?[]? SignatureBlocks { get; set; }
#endif
}
}

View File

@@ -6,16 +6,16 @@ namespace SabreTools.Models.AACS
/// <summary>
/// The number of Host Revocation List Entry fields in the signature block.
/// </summary>
public uint NumberOfEntries;
public uint NumberOfEntries { get; set; }
/// <summary>
/// A list of 8-byte Host Revocation List Entry fields, the length of this
/// list being equal to the number in the signature block.
/// </summary>
#if NET48
public HostRevocationListEntry[] EntryFields;
public HostRevocationListEntry[] EntryFields { get; set; }
#else
public HostRevocationListEntry[]? EntryFields;
public HostRevocationListEntry?[]? EntryFields { get; set; }
#endif
}
}

View File

@@ -12,7 +12,7 @@ namespace SabreTools.Models.AACS
#if NET48
public Record[] Records { get; set; }
#else
public Record[]? Records { get; set; }
public Record?[]? Records { get; set; }
#endif
}
}

View File

@@ -14,9 +14,9 @@ namespace SabreTools.Models.AACS
/// key calculation.
/// </summary>
#if NET48
public byte[][] MediaKeyData;
public byte[][] MediaKeyData { get; set; }
#else
public byte[][]? MediaKeyData;
public byte[][]? MediaKeyData { get; set; }
#endif
}
}

View File

@@ -15,7 +15,7 @@ namespace SabreTools.Models.AACS
/// <summary>
/// The Record Type field value indicates the type of the Record.
/// </summary>
public RecordType RecordType;
public RecordType RecordType { get; set; }
/// <summary>
/// The Record Length field value indicates the number of bytes in
@@ -23,6 +23,6 @@ namespace SabreTools.Models.AACS
/// fields themselves. Record lengths are always multiples of 4 bytes.
/// </summary>
// <remarks>UInt24 not UInt32</remarks>
public uint RecordLength;
public uint RecordLength { get; set; }
}
}

View File

@@ -9,12 +9,12 @@ namespace SabreTools.Models.AACS
/// the mask. For example, the value 0x01 denotes a mask of
/// 0xFFFFFFFE; value 0x0A denotes a mask of 0xFFFFFC00.
/// </summary>
public byte Mask;
public byte Mask { get; set; }
/// <summary>
/// The last 4 bytes are the uv number, most significant
/// byte first.
/// </summary>
public uint Number;
public uint Number { get; set; }
}
}

View File

@@ -14,7 +14,7 @@ namespace SabreTools.Models.AACS
/// <summary>
/// The number of devices per index offset.
/// </summary>
public uint Span;
public uint Span { get; set; }
/// <summary>
/// These offsets refer to the offset within the following Explicit
@@ -22,9 +22,9 @@ namespace SabreTools.Models.AACS
/// </summary>
// <remarks>UInt24 not UInt32</remarks>
#if NET48
public uint[] Offsets;
public uint[] Offsets { get; set; }
#else
public uint[]? Offsets;
public uint[]? Offsets { get; set; }
#endif
}
}

View File

@@ -17,7 +17,7 @@ namespace SabreTools.Models.AACS
/// controlling access to AACS Content on pre- recorded media. In
/// this case, the device shall not use the KCD.
/// </summary>
public MediaKeyBlockType MediaKeyBlockType;
public MediaKeyBlockType MediaKeyBlockType { get; set; }
/// <summary>
/// The Version Number is a 32-bit unsigned integer. Each time the
@@ -27,6 +27,6 @@ namespace SabreTools.Models.AACS
/// Version Numbers begin at 1; 0 is a special value used for test
/// Media Key Blocks.
/// </summary>
public uint VersionNumber;
public uint VersionNumber { get; set; }
}
}

View File

@@ -20,9 +20,9 @@ namespace SabreTools.Models.AACS
/// the correct final Media Key value.
/// </summary>
#if NET48
public byte[] CiphertextValue;
public byte[] CiphertextValue { get; set; }
#else
public byte[]? CiphertextValue;
public byte[]? CiphertextValue { get; set; }
#endif
}
}

View File

@@ -10,7 +10,7 @@ namespace SabreTools.Models.ArchiveDotOrg
#if NET48
public File[] File { get; set; }
#else
public File[]? File { get; set; }
public File?[]? File { get; set; }
#endif
#region DO NOT USE IN PRODUCTION

View File

@@ -15,7 +15,7 @@ namespace SabreTools.Models.AttractMode
#if NET48
public Row[] Row { get; set; }
#else
public Row[]? Row { get; set; }
public Row?[]? Row { get; set; }
#endif
}
}

View File

@@ -7,56 +7,56 @@ namespace SabreTools.Models.BDPlus
/// "BDSVM_CC"
/// </summary>
#if NET48
public string Signature;
public string Signature { get; set; }
#else
public string? Signature;
public string? Signature { get; set; }
#endif
/// <summary>
/// 5 bytes of unknown data
/// </summary>
#if NET48
public byte[] Unknown1;
public byte[] Unknown1 { get; set; }
#else
public byte[]? Unknown1;
public byte[]? Unknown1 { get; set; }
#endif
/// <summary>
/// Version year
/// </summary>
public ushort Year;
public ushort Year { get; set; }
/// <summary>
/// Version month
/// </summary>
public byte Month;
public byte Month { get; set; }
/// <summary>
/// Version day
/// </summary>
public byte Day;
public byte Day { get; set; }
/// <summary>
/// 4 bytes of unknown data
/// </summary>
#if NET48
public byte[] Unknown2;
public byte[] Unknown2 { get; set; }
#else
public byte[]? Unknown2;
public byte[]? Unknown2 { get; set; }
#endif
/// <summary>
/// Length
/// </summary>
public uint Length;
public uint Length { get; set; }
/// <summary>
/// Length bytes of data
/// </summary>
#if NET48
public byte[] Data;
public byte[] Data { get; set; }
#else
public byte[]? Data;
public byte[]? Data { get; set; }
#endif
}
}

View File

@@ -21,7 +21,7 @@
#if NET48
public FileEntry[] Files { get; set; }
#else
public FileEntry[]? Files { get; set; }
public FileEntry?[]? Files { get; set; }
#endif
}
}

View File

@@ -9,30 +9,30 @@
/// <summary>
/// Name size
/// </summary>
public int NameSize;
public int NameSize { get; set; }
/// <summary>
/// Name
/// </summary>
#if NET48
public string Name;
public string Name { get; set; }
#else
public string? Name;
public string? Name { get; set; }
#endif
/// <summary>
/// Uncompressed size
/// </summary>
public int UncompressedSize;
public int UncompressedSize { get; set; }
/// <summary>
/// Offset
/// </summary>
public int Offset;
public int Offset { get; set; }
/// <summary>
/// Compressed size
/// </summary>
public int CompressedSize;
public int CompressedSize { get; set; }
}
}

View File

@@ -1,31 +1,28 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BFPK
namespace SabreTools.Models.BFPK
{
/// <summary>
/// Header
/// </summary>
/// <see cref="https://forum.xentax.com/viewtopic.php?t=5102"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// "BFPK"
/// </summary>
#if NET48
public string Magic;
public string Magic { get; set; }
#else
public string? Magic;
public string? Magic { get; set; }
#endif
/// <summary>
/// Version
/// </summary>
public int Version;
public int Version { get; set; }
/// <summary>
/// Files
/// </summary>
public int Files;
public int Files { get; set; }
}
}

View File

@@ -10,26 +10,26 @@ namespace SabreTools.Models.BMP
/// <summary>
/// The file type; must be BM.
/// </summary>
public ushort Type;
public ushort Type { get; set; }
/// <summary>
/// The size, in bytes, of the bitmap file.
/// </summary>
public uint Size;
public uint Size { get; set; }
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved1;
public ushort Reserved1 { get; set; }
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved2;
public ushort Reserved2 { get; set; }
/// <summary>
/// The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits.
/// </summary>
public uint OffBits;
public uint OffBits { get; set; }
}
}

View File

@@ -11,12 +11,12 @@ namespace SabreTools.Models.BMP
/// not include the size of the color table or the size of the color masks,
/// if they are appended to the end of structure.
/// </summary>
public uint Size;
public uint Size { get; set; }
/// <summary>
/// Specifies the width of the bitmap, in pixels.
/// </summary>
public int Width;
public int Width { get; set; }
/// <summary>
/// Specifies the height of the bitmap, in pixels.
@@ -30,19 +30,19 @@ namespace SabreTools.Models.BMP
/// or negative biHeight.
/// - For compressed formats, biHeight must be positive, regardless of image orientation.
/// </summary>
public int Height;
public int Height { get; set; }
/// <summary>
/// Specifies the number of planes for the target device. This value must be set to 1.
/// </summary>
public ushort Planes;
public ushort Planes { get; set; }
/// <summary>
/// Specifies the number of bits per pixel (bpp). For uncompressed formats, this value
/// is the average number of bits per pixel. For compressed formats, this value is the
/// implied bit depth of the uncompressed image, after the image has been decoded.
/// </summary>
public ushort BitCount;
public ushort BitCount { get; set; }
/// <summary>
/// For compressed video and YUV formats, this member is a FOURCC code, specified as a
@@ -59,36 +59,36 @@ namespace SabreTools.Models.BMP
/// If biCompression equals BI_BITFIELDS, the format is either RGB 555 or RGB 565. Use
/// the subtype GUID in the AM_MEDIA_TYPE structure to determine the specific RGB type.
/// </summary>
public uint Compression;
public uint Compression { get; set; }
/// <summary>
/// Specifies the size, in bytes, of the image. This can be set to 0 for uncompressed
/// RGB bitmaps.
/// </summary>
public uint SizeImage;
public uint SizeImage { get; set; }
/// <summary>
/// Specifies the horizontal resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int XPelsPerMeter;
public int XPelsPerMeter { get; set; }
/// <summary>
/// Specifies the vertical resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int YPelsPerMeter;
public int YPelsPerMeter { get; set; }
/// <summary>
/// Specifies the number of color indices in the color table that are actually used by
/// the bitmap.
/// </summary>
public uint ClrUsed;
public uint ClrUsed { get; set; }
/// <summary>
/// Specifies the number of color indices that are considered important for displaying
/// the bitmap. If this value is zero, all colors are important.
/// </summary>
public uint ClrImportant;
public uint ClrImportant { get; set; }
}
}

View File

@@ -21,7 +21,7 @@ namespace SabreTools.Models.BSP
#if NET48
public Lump[] Lumps { get; set; }
#else
public Lump[]? Lumps { get; set; }
public Lump?[]? Lumps { get; set; }
#endif
/// <summary>
@@ -39,7 +39,7 @@ namespace SabreTools.Models.BSP
#if NET48
public Texture[] Textures { get; set; }
#else
public Texture[]? Textures { get; set; }
public Texture?[]? Textures { get; set; }
#endif
}
}

View File

@@ -6,6 +6,6 @@ namespace SabreTools.Models.BSP
/// <summary>
/// Version
/// </summary>
public uint Version;
public uint Version { get; set; }
}
}

View File

@@ -6,11 +6,11 @@ namespace SabreTools.Models.BSP
/// <summary>
/// Offset
/// </summary>
public uint Offset;
public uint Offset { get; set; }
/// <summary>
/// Length
/// </summary>
public uint Length;
public uint Length { get; set; }
}
}

View File

@@ -7,51 +7,51 @@ namespace SabreTools.Models.BSP
/// Name
/// </summary>
#if NET48
public string Name;
public string Name { get; set; }
#else
public string? Name;
public string? Name { get; set; }
#endif
/// <summary>
/// Width
/// </summary>
public uint Width;
public uint Width { get; set; }
/// <summary>
/// Height
/// </summary>
public uint Height;
public uint Height { get; set; }
/// <summary>
/// Offsets
/// </summary>
#if NET48
public uint[] Offsets;
public uint[] Offsets { get; set; }
#else
public uint[]? Offsets;
public uint[]? Offsets { get; set; }
#endif
/// <summary>
/// Texture data
/// </summary>
#if NET48
public byte[] TextureData;
public byte[] TextureData { get; set; }
#else
public byte[]? TextureData;
public byte[]? TextureData { get; set; }
#endif
/// <summary>
/// Palette size
/// </summary>
public uint PaletteSize;
public uint PaletteSize { get; set; }
/// <summary>
/// Palette data
/// </summary>
#if NET48
public byte[] PaletteData;
public byte[] PaletteData { get; set; }
#else
public byte[]? PaletteData;
public byte[]? PaletteData { get; set; }
#endif
}
}

View File

@@ -6,15 +6,15 @@ namespace SabreTools.Models.BSP
/// <summary>
/// Texture count
/// </summary>
public uint TextureCount;
public uint TextureCount { get; set; }
/// <summary>
/// Offsets
/// </summary>
#if NET48
public uint[] Offsets;
public uint[] Offsets { get; set; }
#else
public uint[]? Offsets;
public uint[]? Offsets { get; set; }
#endif
}
}

View File

@@ -32,7 +32,7 @@ namespace SabreTools.Models.CFB
#if NET48
public SectorNumber[] FATSectorNumbers { get; set; }
#else
public SectorNumber[]? FATSectorNumbers { get; set; }
public SectorNumber?[]? FATSectorNumbers { get; set; }
#endif
/// <summary>
@@ -49,7 +49,7 @@ namespace SabreTools.Models.CFB
#if NET48
public SectorNumber[] MiniFATSectorNumbers { get; set; }
#else
public SectorNumber[]? MiniFATSectorNumbers { get; set; }
public SectorNumber?[]? MiniFATSectorNumbers { get; set; }
#endif
/// <summary>
@@ -70,7 +70,7 @@ namespace SabreTools.Models.CFB
#if NET48
public SectorNumber[] DIFATSectorNumbers { get; set; }
#else
public SectorNumber[]? DIFATSectorNumbers { get; set; }
public SectorNumber?[]? DIFATSectorNumbers { get; set; }
#endif
/// <summary>
@@ -106,7 +106,7 @@ namespace SabreTools.Models.CFB
#if NET48
public DirectoryEntry[] DirectoryEntries { get; set; }
#else
public DirectoryEntry[]? DirectoryEntries { get; set; }
public DirectoryEntry?[]? DirectoryEntries { get; set; }
#endif
}
}

View File

@@ -17,16 +17,16 @@ namespace SabreTools.Models.CFB
/// name: '/', '\', ':', '!'.
/// </summary>
#if NET48
public string Name;
public string Name { get; set; }
#else
public string? Name;
public string? Name { get; set; }
#endif
/// <summary>
/// This field MUST be 0x00, 0x01, 0x02, or 0x05, depending on the
/// actual type of object. All other values are not valid.
/// </summary>
public ushort NameLength;
public ushort NameLength { get; set; }
/// <summary>
/// This field MUST match the length of the Directory Entry Name Unicode
@@ -34,31 +34,31 @@ namespace SabreTools.Models.CFB
/// terminating null character in the count. This length MUST NOT exceed 64,
/// the maximum size of the Directory Entry Name field.
/// </summary>
public ObjectType ObjectType;
public ObjectType ObjectType { get; set; }
/// <summary>
/// This field MUST be 0x00 (red) or 0x01 (black). All other values are not valid.
/// </summary>
public ColorFlag ColorFlag;
public ColorFlag ColorFlag { get; set; }
/// <summary>
/// This field contains the stream ID of the left sibling. If there
/// is no left sibling, the field MUST be set to NOSTREAM (0xFFFFFFFF).
/// </summary>
public StreamID LeftSiblingID;
public StreamID LeftSiblingID { get; set; }
/// <summary>
/// This field contains the stream ID of the right sibling. If there
/// is no right sibling, the field MUST be set to NOSTREAM (0xFFFFFFFF).
/// </summary>
public StreamID RightSiblingID;
public StreamID RightSiblingID { get; set; }
/// <summary>
/// This field contains the stream ID of a child object. If there is no
/// child object, including all entries for stream objects, the field
/// MUST be set to NOSTREAM (0xFFFFFFFF).
/// </summary>
public StreamID ChildID;
public StreamID ChildID { get; set; }
/// <summary>
/// This field contains an object class GUID, if this entry is for a
@@ -71,7 +71,7 @@ namespace SabreTools.Models.CFB
/// this value is not all zeroes, the object class GUID can be used as a
/// parameter to start applications.
/// </summary>
public Guid CLSID;
public Guid CLSID { get; set; }
/// <summary>
/// This field contains the user-defined flags if this entry is for a storage
@@ -82,7 +82,7 @@ namespace SabreTools.Models.CFB
/// objects without explicitly setting state bits, it MUST write all zeroes
/// by default.
/// </summary>
public uint StateBits;
public uint StateBits { get; set; }
/// <summary>
/// This field contains the creation time for a storage object, or all zeroes
@@ -92,7 +92,7 @@ namespace SabreTools.Models.CFB
/// object, this field MUST be all zeroes, and the creation time is retrieved
/// or set on the compound file itself.
/// </summary>
public ulong CreationTime;
public ulong CreationTime { get; set; }
/// <summary>
/// This field contains the modification time for a storage object, or all
@@ -102,7 +102,7 @@ namespace SabreTools.Models.CFB
/// storage object, this field MAY<2> be set to all zeroes, and the modified
/// time is retrieved or set on the compound file itself.
/// </summary>
public ulong ModifiedTime;
public ulong ModifiedTime { get; set; }
/// <summary>
/// This field contains the first sector location if this is a stream object.
@@ -110,7 +110,7 @@ namespace SabreTools.Models.CFB
/// mini stream, if the mini stream exists. For a storage object, this field MUST
/// be set to all zeroes.
/// </summary>
public uint StartingSectorLocation;
public uint StartingSectorLocation { get; set; }
/// <summary>
/// This 64-bit integer field contains the size of the user-defined data if this
@@ -132,6 +132,6 @@ namespace SabreTools.Models.CFB
/// unless there is a specific reason to do otherwise (for example, a parser whose
/// purpose is to verify the correctness of a compound file).
/// </remarks>
public ulong StreamSize;
public ulong StreamSize { get; set; }
}
}

View File

@@ -9,30 +9,30 @@ namespace SabreTools.Models.CFB
/// Iddentification signature for the compound file structure, and MUST be
/// set to the value 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1.
/// </summary>
public ulong Signature;
public ulong Signature { get; set; }
/// <summary>
/// Reserved and unused class ID that MUST be set to all zeroes (CLSID_NULL)
/// </summary>
public Guid CLSID;
public Guid CLSID { get; set; }
/// <summary>
/// Version number for nonbreaking changes. This field SHOULD be set to
/// 0x003E if the major version field is either 0x0003 or 0x0004.
/// </summary>
public ushort MinorVersion;
public ushort MinorVersion { get; set; }
/// <summary>
/// Version number for breaking changes. This field MUST be set to either
/// 0x0003 (version 3) or 0x0004 (version 4).
/// </summary>
public ushort MajorVersion;
public ushort MajorVersion { get; set; }
/// <summary>
/// This field MUST be set to 0xFFFE. This field is a byte order mark for
/// all integer fields, specifying little-endian byte order.
/// </summary>
public ushort ByteOrder;
public ushort ByteOrder { get; set; }
/// <summary>
/// This field MUST be set to 0x0009, or 0x000c, depending on the Major
@@ -45,22 +45,22 @@ namespace SabreTools.Models.CFB
/// If Major Version is 4, the Sector Shift MUST be 0x000C, specifying a
/// sector size of 4096 bytes.
/// </summary>
public ushort SectorShift;
public ushort SectorShift { get; set; }
/// <summary>
/// This field MUST be set to 0x0006. This field specifies the sector size
/// of the Mini Stream as a power of 2. The sector size of the Mini Stream
/// MUST be 64 bytes.
/// </summary>
public ushort MiniSectorShift;
public ushort MiniSectorShift { get; set; }
/// <summary>
/// This field MUST be set to all zeroes.
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
@@ -70,18 +70,18 @@ namespace SabreTools.Models.CFB
/// If Major Version is 3, the Number of Directory Sectors MUST be zero. This
/// field is not supported for version 3 compound files.
/// </summary>
public uint NumberOfDirectorySectors;
public uint NumberOfDirectorySectors { get; set; }
/// <summary>
/// This integer field contains the count of the number of FAT sectors in the
/// compound file.
/// </summary>
public uint NumberOfFATSectors;
public uint NumberOfFATSectors { get; set; }
/// <summary>
/// This integer field contains the starting sector number for the directory stream.
/// </summary>
public uint FirstDirectorySectorLocation;
public uint FirstDirectorySectorLocation { get; set; }
/// <summary>
/// This integer field MAY contain a sequence number that is incremented every time
@@ -89,7 +89,7 @@ namespace SabreTools.Models.CFB
/// This is the field that MUST be set to all zeroes if file transactions are not
/// implemented.
/// </summary>
public uint TransactionSignatureNumber;
public uint TransactionSignatureNumber { get; set; }
/// <summary>
/// This integer field MUST be set to 0x00001000. This field specifies the maximum
@@ -98,38 +98,38 @@ namespace SabreTools.Models.CFB
/// greater than or equal to this cutoff size must be allocated as normal sectors from
/// the FAT.
/// </summary>
public uint MiniStreamCutoffSize;
public uint MiniStreamCutoffSize { get; set; }
/// <summary>
/// This integer field contains the starting sector number for the mini FAT.
/// </summary>
public uint FirstMiniFATSectorLocation;
public uint FirstMiniFATSectorLocation { get; set; }
/// <summary>
/// This integer field contains the count of the number of mini FAT sectors in the
/// compound file.
/// </summary>
public uint NumberOfMiniFATSectors;
public uint NumberOfMiniFATSectors { get; set; }
/// <summary>
/// This integer field contains the starting sector number for the DIFAT.
/// </summary>
public uint FirstDIFATSectorLocation;
public uint FirstDIFATSectorLocation { get; set; }
/// <summary>
/// This integer field contains the count of the number of DIFAT sectors in the
/// compound file.
/// </summary>
public uint NumberOfDIFATSectors;
public uint NumberOfDIFATSectors { get; set; }
/// <summary>
/// This array of 32-bit integer fields contains the first 109 FAT sector
/// locations of the compound file
/// </summary>
#if NET48
public SectorNumber[] DIFAT;
public SectorNumber[] DIFAT { get; set; }
#else
public SectorNumber[]? DIFAT;
public SectorNumber?[]? DIFAT { get; set; }
#endif
}
}

View File

@@ -11,35 +11,35 @@ namespace SabreTools.Models.CFB
/// This field MUST be set to 0xFFFE. This field is a byte order mark for
/// all integer fields, specifying little-endian byte order.
/// </summary>
public ushort ByteOrder;
public ushort ByteOrder { get; set; }
/// <summary>
/// Format
/// </summary>
public ushort Format;
public ushort Format { get; set; }
/// <summary>
/// Build
/// </summary>
public ushort Build;
public ushort Build { get; set; }
/// <summary>
/// Platform ID
/// </summary>
public ushort PlatformID;
public ushort PlatformID { get; set; }
/// <summary>
/// CLSID
/// </summary>
public Guid CLSID;
public Guid CLSID { get; set; }
/// <summary>
/// 4 bytes of reserved data
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
#endregion
@@ -49,15 +49,15 @@ namespace SabreTools.Models.CFB
/// <summary>
/// Format ID, should be <see cref="Constants.FMTID_SummaryInformation"/>
/// </summary>
public Guid FormatID;
public Guid FormatID { get; set; }
/// <summary>
/// 16 bytes of unknown data
/// </summary>
#if NET48
public byte[] Unknown;
public byte[] Unknown { get; set; }
#else
public byte[]? Unknown;
public byte[]? Unknown { get; set; }
#endif
#endregion
@@ -67,26 +67,26 @@ namespace SabreTools.Models.CFB
/// <summary>
/// Location of the section
/// </summary>
public uint Offset;
public uint Offset { get; set; }
/// <summary>
/// Section count(?)
/// </summary>
public uint SectionCount;
public uint SectionCount { get; set; }
/// <summary>
/// Property count
/// </summary>
public uint PropertyCount;
public uint PropertyCount { get; set; }
/// <summary>
/// Properties
/// </summary>
/// <remarks>Each Variant might be followed by an index and offset value</remarks>
#if NET48
public Variant[] Properties;
public Variant[] Properties { get; set; }
#else
public Variant[]? Properties;
public Variant?[]? Properties { get; set; }
#endif
#endregion

View File

@@ -9,41 +9,41 @@ namespace SabreTools.Models.CFB
/// <summary>
/// MUST be set to the size, in quad words (64 bits), of the structure.
/// </summary>
public uint Size;
public uint Size { get; set; }
/// <summary>
/// MUST be set to 0 and MUST be ignored by the recipient.
/// </summary>
public uint RpcReserved;
public uint RpcReserved { get; set; }
/// <summary>
/// MUST be set to one of the values specified with a "V".
/// </summary>
public VariantType VariantType;
public VariantType VariantType { get; set; }
/// <summary>
/// MAY be set to 0 and MUST be ignored by the recipient.
/// </summary>
public ushort Reserved1;
public ushort Reserved1 { get; set; }
/// <summary>
/// MAY be set to 0 and MUST be ignored by the recipient.
/// </summary>
public ushort Reserved2;
public ushort Reserved2 { get; set; }
/// <summary>
/// MAY be set to 0 and MUST be ignored by the recipient.
/// </summary>
public ushort Reserved3;
public ushort Reserved3 { get; set; }
/// <summary>
/// MUST contain an instance of the type, according to the value
/// in the <see cref="VariantType"/> field.
/// </summary>
#if NET48
public object Union;
public object Union { get; set; }
#else
public object? Union;
public object? Union { get; set; }
#endif
}
}

View File

@@ -0,0 +1,28 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class CompressedMapEntryV5
{
/// <summary>
/// Compression type
/// </summary>
public byte Compression { get; set; }
/// <summary>
/// Compressed length
/// </summary>
/// <remarks>Actually UInt24</remarks>
public uint CompLength { get; set; }
/// <summary>
/// Offset
/// </summary>
/// <remarks>Actually UInt48</remarks>
public ulong Offset { get; set; }
/// <summary>
/// CRC-16 of the data
/// </summary>
public ushort CRC { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class CompressedMapHeaderV5
{
/// <summary>
/// Length of compressed map
/// </summary>
public uint Length { get; set; }
/// <summary>
/// Offset of first block
/// </summary>
/// <remarks>Actually UInt48</remarks>
public ulong DataStart { get; set; }
/// <summary>
/// CRC-16 of the map
/// </summary>
public ushort CRC { get; set; }
/// <summary>
/// Bits used to encode complength
/// </summary>
public byte LengthBits { get; set; }
/// <summary>
/// Bits used to encode self-refs
/// </summary>
public byte HunkBits { get; set; }
/// <summary>
/// Bits used to encode parent unit refs
/// </summary>
public byte ParentUnitBits { get; set; }
/// <summary>
/// Future use
/// </summary>
public byte Reserved { get; set; }
}
}

42
CHD/Enums.cs Normal file
View File

@@ -0,0 +1,42 @@
using System;
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public enum CompressionType : uint
{
#region V1
CHDCOMPRESSION_NONE = 0,
CHDCOMPRESSION_ZLIB = 1,
#endregion
#region V3
CHDCOMPRESSION_ZLIB_PLUS = 2,
#endregion
#region V4
CHDCOMPRESSION_AV = 3,
#endregion
}
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
[Flags]
public enum Flags : uint
{
/// <summary>
/// Set if this drive has a parent
/// </summary>
DriveHasParent = 0x00000001,
/// <summary>
/// Set if this drive allows writes
/// </summary>
DriveAllowsWrites = 0x00000002,
}
}

25
CHD/Header.cs Normal file
View File

@@ -0,0 +1,25 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public abstract class Header
{
/// <summary>
/// 'MComprHD'
/// </summary>
#if NET48
public string Tag { get; set; }
#else
public string? Tag { get; set; }
#endif
/// <summary>
/// Length of header (including tag and length fields)
/// </summary>
public uint Length { get; set; }
/// <summary>
/// Drive format version
/// </summary>
public uint Version { get; set; }
}
}

59
CHD/HeaderV1.cs Normal file
View File

@@ -0,0 +1,59 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class HeaderV1 : Header
{
/// <summary>
/// Flags
/// </summary>
public Flags Flags { get; set; }
/// <summary>
/// Compression type
/// </summary>
public CompressionType Compression { get; set; }
/// <summary>
/// 512-byte sectors per hunk
/// </summary>
public uint HunkSize { get; set; }
/// <summary>
/// Total # of hunks represented
/// </summary>
public uint TotalHunks { get; set; }
/// <summary>
/// Number of cylinders on hard disk
/// </summary>
public uint Cylinders { get; set; }
/// <summary>
/// Number of heads on hard disk
/// </summary>
public uint Heads { get; set; }
/// <summary>
/// Number of sectors on hard disk
/// </summary>
public uint Sectors { get; set; }
/// <summary>
/// MD5 checksum of raw data
/// </summary>
#if NET48
public byte[] MD5 { get; set; } = new byte[16];
#else
public byte[]? MD5 { get; set; } = new byte[16];
#endif
/// <summary>
/// MD5 checksum of parent file
/// </summary>
#if NET48
public byte[] ParentMD5 { get; set; } = new byte[16];
#else
public byte[]? ParentMD5 { get; set; } = new byte[16];
#endif
}
}

64
CHD/HeaderV2.cs Normal file
View File

@@ -0,0 +1,64 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class HeaderV2 : Header
{
/// <summary>
/// Flags
/// </summary>
public Flags Flags { get; set; }
/// <summary>
/// Compression type
/// </summary>
public CompressionType Compression { get; set; }
/// <summary>
/// Seclen-byte sectors per hunk
/// </summary>
public uint HunkSize { get; set; }
/// <summary>
/// Total # of hunks represented
/// </summary>
public uint TotalHunks { get; set; }
/// <summary>
/// Number of cylinders on hard disk
/// </summary>
public uint Cylinders { get; set; }
/// <summary>
/// Number of heads on hard disk
/// </summary>
public uint Heads { get; set; }
/// <summary>
/// Number of sectors on hard disk
/// </summary>
public uint Sectors { get; set; }
/// <summary>
/// MD5 checksum of raw data
/// </summary>
#if NET48
public byte[] MD5 { get; set; } = new byte[16];
#else
public byte[]? MD5 { get; set; } = new byte[16];
#endif
/// <summary>
/// MD5 checksum of parent file
/// </summary>
#if NET48
public byte[] ParentMD5 { get; set; } = new byte[16];
#else
public byte[]? ParentMD5 { get; set; } = new byte[16];
#endif
/// <summary>
/// Number of bytes per sector
/// </summary>
public uint BytesPerSector { get; set; }
}
}

72
CHD/HeaderV3.cs Normal file
View File

@@ -0,0 +1,72 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class HeaderV3 : Header
{
/// <summary>
/// Flags
/// </summary>
public Flags Flags { get; set; }
/// <summary>
/// Compression type
/// </summary>
public CompressionType Compression { get; set; }
/// <summary>
/// Total # of hunks represented
/// </summary>
public uint TotalHunks { get; set; }
/// <summary>
/// Logical size of the data (in bytes)
/// </summary>
public ulong LogicalBytes { get; set; }
/// <summary>
/// Offset to the first blob of metadata
/// </summary>
public ulong MetaOffset { get; set; }
/// <summary>
/// MD5 checksum of raw data
/// </summary>
#if NET48
public byte[] MD5 { get; set; } = new byte[16];
#else
public byte[]? MD5 { get; set; } = new byte[16];
#endif
/// <summary>
/// MD5 checksum of parent file
/// </summary>
#if NET48
public byte[] ParentMD5 { get; set; } = new byte[16];
#else
public byte[]? ParentMD5 { get; set; } = new byte[16];
#endif
/// <summary>
/// Number of bytes per hunk
/// </summary>
public uint HunkBytes { get; set; }
/// <summary>
/// SHA1 checksum of raw data
/// </summary>
#if NET48
public byte[] SHA1 { get; set; } = new byte[20];
#else
public byte[]? SHA1 { get; set; } = new byte[20];
#endif
/// <summary>
/// SHA1 checksum of parent file
/// </summary>
#if NET48
public byte[] ParentSHA1 { get; set; } = new byte[20];
#else
public byte[]? ParentSHA1 { get; set; } = new byte[20];
#endif
}
}

63
CHD/HeaderV4.cs Normal file
View File

@@ -0,0 +1,63 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class HeaderV4 : Header
{
/// <summary>
/// Flags
/// </summary>
public Flags Flags { get; set; }
/// <summary>
/// Compression type
/// </summary>
public CompressionType Compression { get; set; }
/// <summary>
/// Total # of hunks represented
/// </summary>
public uint TotalHunks { get; set; }
/// <summary>
/// Logical size of the data (in bytes)
/// </summary>
public ulong LogicalBytes { get; set; }
/// <summary>
/// Offset to the first blob of metadata
/// </summary>
public ulong MetaOffset { get; set; }
/// <summary>
/// Number of bytes per hunk
/// </summary>
public uint HunkBytes { get; set; }
/// <summary>
/// Combined raw+meta SHA1
/// </summary>
#if NET48
public byte[] SHA1 { get; set; } = new byte[20];
#else
public byte[]? SHA1 { get; set; } = new byte[20];
#endif
/// <summary>
/// Combined raw+meta SHA1 of parent
/// </summary>
#if NET48
public byte[] ParentSHA1 { get; set; } = new byte[20];
#else
public byte[]? ParentSHA1 { get; set; } = new byte[20];
#endif
/// <summary>
/// Raw data SHA1
/// </summary>
#if NET48
public byte[] RawSHA1 { get; set; } = new byte[20];
#else
public byte[]? RawSHA1 { get; set; } = new byte[20];
#endif
}
}

63
CHD/HeaderV5.cs Normal file
View File

@@ -0,0 +1,63 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class HeaderV5 : Header
{
/// <summary>
/// Which custom compressors are used?
/// </summary>
public uint[] Compressors { get; set; } = new uint[4];
/// <summary>
/// Logical size of the data (in bytes)
/// </summary>
public ulong LogicalBytes { get; set; }
/// <summary>
/// Offset to the map
/// </summary>
public ulong MapOffset { get; set; }
/// <summary>
/// Offset to the first blob of metadata
/// </summary>
public ulong MetaOffset { get; set; }
/// <summary>
/// Number of bytes per hunk (512k maximum)
/// </summary>
public uint HunkBytes { get; set; }
/// <summary>
/// Number of bytes per unit within each hunk
/// </summary>
public uint UnitBytes { get; set; }
/// <summary>
/// Raw data SHA1
/// </summary>
#if NET48
public byte[] RawSHA1 { get; set; }
#else
public byte[]? RawSHA1 { get; set; }
#endif
/// <summary>
/// Combined raw+meta SHA1
/// </summary>
#if NET48
public byte[] SHA1 { get; set; }
#else
public byte[]? SHA1 { get; set; }
#endif
/// <summary>
/// Combined raw+meta SHA1 of parent
/// </summary>
#if NET48
public byte[] ParentSHA1 { get; set; }
#else
public byte[]? ParentSHA1 { get; set; }
#endif
}
}

16
CHD/MapV1.cs Normal file
View File

@@ -0,0 +1,16 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class MapV1
{
/// <summary>
/// Starting offset within the file
/// </summary>
public ulong StartingOffset { get; set; }
/// <summary>
/// Length of data; If == hunksize, data is uncompressed
/// </summary>
public ulong Length { get; set; }
}
}

31
CHD/MapV3.cs Normal file
View File

@@ -0,0 +1,31 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class MapV3
{
/// <summary>
/// Starting offset within the file
/// </summary>
public ulong StartingOffset { get; set; }
/// <summary>
/// 32-bit CRC of the uncompressed data
/// </summary>
public uint CRC32 { get; set; }
/// <summary>
/// Lower 16 bits of length
/// </summary>
public ushort LengthLo { get; set; }
/// <summary>
/// Upper 8 bits of length
/// </summary>
public byte LengthHi { get; set; }
/// <summary>
/// Flags, indicating compression info
/// </summary>
public byte Flags { get; set; }
}
}

11
CHD/UncompressedMapV5.cs Normal file
View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.CHD
{
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
public class UncompressedMapV5
{
/// <summary>
/// Starting offset / hunk size
/// </summary>
public uint StartingOffset { get; set; }
}
}

View File

@@ -23,7 +23,7 @@ namespace SabreTools.Models.Charts
#if NET48
public Dictionary<string, (string Name, string UnlockId)> Sections { get; set; }
#else
public Dictionary<string, (string Name, string UnlockId)>? Sections { get; set; }
public Dictionary<string, (string? Name, string? UnlockId)>? Sections { get; set; }
#endif
}
}

View File

@@ -13,7 +13,7 @@ namespace SabreTools.Models.ClrMamePro
#if NET48
public GameBase[] Game { get; set; }
#else
public GameBase[]? Game { get; set; }
public GameBase?[]? Game { get; set; }
#endif
#region DO NOT USE IN PRODUCTION

View File

@@ -7,15 +7,15 @@ namespace SabreTools.Models.Compression.LZ
public sealed class FileHeaader
{
#if NET48
public string Magic;
public string Magic { get; set; }
#else
public string? Magic;
public string? Magic { get; set; }
#endif
public byte CompressionType;
public byte CompressionType { get; set; }
public char LastChar;
public char LastChar { get; set; }
public uint RealLength;
public uint RealLength { get; set; }
}
}

View File

@@ -5,25 +5,16 @@ namespace SabreTools.Models.Compression.LZX
/// tree preceding the other trees.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class AlignedOffsetBlock
public class AlignedOffsetBlockData : BlockData
{
/// <summary>
/// Generic block header
/// </summary>
#if NET48
public BlockHeader Header;
#else
public BlockHeader? Header;
#endif
/// <summary>
/// Aligned offset tree
/// </summary>
/// <remarks>8 elements, 3 bits each</remarks>
#if NET48
public byte[] AlignedOffsetTree;
public byte[] AlignedOffsetTree { get; set; }
#else
public byte[]? AlignedOffsetTree;
public byte[]? AlignedOffsetTree { get; set; }
#endif
/// <summary>
@@ -31,9 +22,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeFirst256;
public byte[] PretreeFirst256 { get; set; }
#else
public byte[]? PretreeFirst256;
public byte[]? PretreeFirst256 { get; set; }
#endif
/// <summary>
@@ -41,9 +32,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsFirst256;
public int[] PathLengthsFirst256 { get; set; }
#else
public int[]? PathLengthsFirst256;
public int[]? PathLengthsFirst256 { get; set; }
#endif
/// <summary>
@@ -51,9 +42,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeRemainder;
public byte[] PretreeRemainder { get; set; }
#else
public byte[]? PretreeRemainder;
public byte[]? PretreeRemainder { get; set; }
#endif
/// <summary>
@@ -61,9 +52,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsRemainder;
public int[] PathLengthsRemainder { get; set; }
#else
public int[]? PathLengthsRemainder;
public int[]? PathLengthsRemainder { get; set; }
#endif
/// <summary>
@@ -71,9 +62,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeLengthTree;
public byte[] PretreeLengthTree { get; set; }
#else
public byte[]? PretreeLengthTree;
public byte[]? PretreeLengthTree { get; set; }
#endif
/// <summary>
@@ -81,13 +72,19 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsLengthTree;
public int[] PathLengthsLengthTree { get; set; }
#else
public int[]? PathLengthsLengthTree;
public int[]? PathLengthsLengthTree { get; set; }
#endif
// Entry Comments Size
// ---------------------------------------------------------------------------------------
// Token sequence (matches and literals) Specified in section 2.6 Variable
/// <summary>
/// Token sequence (matches and literals)
/// </summary>
/// <remarks>Variable</remarks>
#if NET48
public byte[] TokenSequence { get; set; }
#else
public byte[]? TokenSequence { get; set; }
#endif
}
}

32
Compression/LZX/Block.cs Normal file
View File

@@ -0,0 +1,32 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// An LZXD block represents a sequence of compressed data that is encoded with the same set of
/// Huffman trees, or a sequence of uncompressed data. There can be one or more LZXD blocks in a
/// compressed stream, each with its own set of Huffman trees. Blocks do not have to start or end on a
/// chunk boundary; blocks can span multiple chunks, or a single chunk can contain multiple blocks. The
/// number of chunks is related to the size of the data being compressed, while the number of blocks is
/// related to how well the data is compressed.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class Block
{
/// <summary>
/// Block header
/// </summary>
#if NET48
public BlockHeader Header { get; set; }
#else
public BlockHeader? Header { get; set; }
#endif
/// <summary>
/// Block data
/// </summary>
#if NET48
public BlockData BlockData { get; set; }
#else
public BlockData? BlockData { get; set; }
#endif
}
}

View File

@@ -0,0 +1,8 @@
namespace SabreTools.Models.Compression.LZX
{
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public abstract class BlockData
{
// No common fields between all block data
}
}

View File

@@ -1,38 +1,33 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// An LZXD block represents a sequence of compressed data that is encoded with the same set of
/// Huffman trees, or a sequence of uncompressed data. There can be one or more LZXD blocks in a
/// compressed stream, each with its own set of Huffman trees. Blocks do not have to start or end on a
/// chunk boundary; blocks can span multiple chunks, or a single chunk can contain multiple blocks. The
/// number of chunks is related to the size of the data being compressed, while the number of blocks is
/// related to how well the data is compressed. The Block Type field, as specified in section 2.3.1.1,
/// indicates which type of block follows, and the Block Size field, as specified in section 2.3.1.2,
/// indicates the number of uncompressed bytes represented by the block. Following the generic block
/// The Block Type field, as specified in section 2.3.1.1, indicates which type of block follows,
/// and the Block Size field, as specified in section 2.3.1.2, indicates the number of
/// uncompressed bytes represented by the block. Following the generic block
/// header is a type-specific header that describes the remainder of the block.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class BlockHeader
{
/// <remarks>3 bits</remarks>
public BlockType BlockType;
public BlockType BlockType { get; set; }
/// <summary>
/// Block size is the high 8 bits of 24
/// </summary>
/// <remarks>8 bits</remarks>
public byte BlockSizeMSB;
public byte BlockSizeMSB { get; set; }
/// <summary>
/// Block size is the middle 8 bits of 24
/// </summary>
/// <remarks>8 bits</remarks>
public byte BlockSizeByte2;
public byte BlockSizeByte2 { get; set; }
/// <summary>
/// Block size is the low 8 bits of 24
/// </summary>
/// <remarks>8 bits</remarks>
public byte BlocksizeLSB;
public byte BlocksizeLSB { get; set; }
}
}

33
Compression/LZX/Chunk.cs Normal file
View File

@@ -0,0 +1,33 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
/// uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
/// ensure that an exact number of input bytes represent an exact number of output bytes for each
/// chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
/// output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
/// (even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
/// size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
/// incompressible when the chunk is not the last one.
/// </summary>
public class Chunk
{
/// <summary>
/// Chunk header
/// </summary>
#if NET48
public ChunkHeader Header { get; set; }
#else
public ChunkHeader? Header { get; set; }
#endif
/// <summary>
/// Block headers and data
/// </summary>
#if NET48
public Block[] Blocks { get; set; }
#else
public Block[]? Blocks { get; set; }
#endif
}
}

View File

@@ -0,0 +1,46 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
/// uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
/// ensure that an exact number of input bytes represent an exact number of output bytes for each
/// chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
/// output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
/// (even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
/// size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
/// incompressible when the chunk is not the last one.
/// </summary>
public class ChunkHeader
{
/// <summary>
/// The LZXD engine encodes a compressed, chunk-size prefix field preceding each compressed chunk in
/// the compressed byte stream. The compressed, chunk-size prefix field is a byte aligned, little-endian,
/// 16-bit field. The chunk prefix chain could be followed in the compressed stream without
/// decompressing any data. The next chunk prefix is at a location computed by the absolute byte offset
/// location of this chunk prefix plus 2 (for the size of the chunk-size prefix field) plus the current chunk
/// size.
/// </summary>
public ushort ChunkSize { get; set; }
/// <summary>
/// The first bit in the first chunk in the LZXD bitstream (following the 2-byte, chunk-size prefix described
/// in section 2.2.1) indicates the presence or absence of two 16-bit fields immediately following the
/// single bit. If the bit is set, E8 translation is enabled for all the following chunks in the stream using the
/// 32-bit value derived from the two 16-bit fields as the E8_file_size provided to the compressor when E8
/// translation was enabled. Note that E8_file_size is completely independent of the length of the
/// uncompressed data. E8 call translation is disabled after the 32,768th chunk (after 1 gigabyte (GB) of
/// uncompressed data).
/// </summary>
public byte E8Translation { get; set; }
/// <summary>
/// E8 translation size, high WORD
/// </summary>
public ushort? TranslationSizeHighWord { get; set; }
/// <summary>
/// E8 translation size, low WORD
/// </summary>
public ushort? TranslationSizeLowWord { get; set; }
}
}

View File

@@ -3,44 +3,36 @@ namespace SabreTools.Models.Compression.LZX
public static class Constants
{
/* some constants defined by the LZX specification */
public const int LZX_MIN_MATCH = (2);
public const int LZX_MAX_MATCH = (257);
public const int LZX_NUM_CHARS = (256);
/// <summary>
/// also blocktypes 4-7 invalid
/// </summary>
public const int LZX_BLOCKTYPE_INVALID = (0);
public const int LZX_BLOCKTYPE_VERBATIM = (1);
public const int LZX_BLOCKTYPE_ALIGNED = (2);
public const int LZX_BLOCKTYPE_UNCOMPRESSED = (3);
public const int LZX_PRETREE_NUM_ELEMENTS = (20);
public const int LZX_MIN_MATCH = 2;
public const int LZX_MAX_MATCH = 257;
public const int LZX_NUM_CHARS = 256;
public const int LZX_PRETREE_NUM_ELEMENTS = 20;
/// <summary>
/// aligned offset tree #elements
/// </summary>
public const int LZX_ALIGNED_NUM_ELEMENTS = (8);
public const int LZX_ALIGNED_NUM_ELEMENTS = 8;
/// <summary>
/// this one missing from spec!
/// </summary>
public const int LZX_NUM_PRIMARY_LENGTHS = (7);
public const int LZX_NUM_PRIMARY_LENGTHS = 7;
/// <summary>
/// length tree #elements
/// </summary>
public const int LZX_NUM_SECONDARY_LENGTHS = (249);
public const int LZX_NUM_SECONDARY_LENGTHS = 249;
/* LZX huffman defines: tweak tablebits as desired */
public const int LZX_PRETREE_MAXSYMBOLS = (LZX_PRETREE_NUM_ELEMENTS);
public const int LZX_PRETREE_TABLEBITS = (6);
public const int LZX_MAINTREE_MAXSYMBOLS = (LZX_NUM_CHARS + 50 * 8);
public const int LZX_MAINTREE_TABLEBITS = (12);
public const int LZX_LENGTH_MAXSYMBOLS = (LZX_NUM_SECONDARY_LENGTHS + 1);
public const int LZX_LENGTH_TABLEBITS = (12);
public const int LZX_ALIGNED_MAXSYMBOLS = (LZX_ALIGNED_NUM_ELEMENTS);
public const int LZX_ALIGNED_TABLEBITS = (7);
public const int LZX_PRETREE_MAXSYMBOLS = LZX_PRETREE_NUM_ELEMENTS;
public const int LZX_PRETREE_TABLEBITS = 6;
public const int LZX_MAINTREE_MAXSYMBOLS = LZX_NUM_CHARS + 50 * 8;
public const int LZX_MAINTREE_TABLEBITS = 12;
public const int LZX_LENGTH_MAXSYMBOLS = LZX_NUM_SECONDARY_LENGTHS + 1;
public const int LZX_LENGTH_TABLEBITS = 12;
public const int LZX_ALIGNED_MAXSYMBOLS = LZX_ALIGNED_NUM_ELEMENTS;
public const int LZX_ALIGNED_TABLEBITS = 7;
public const int LZX_LENTABLE_SAFETY = (64); /* we allow length table decoding overruns */
public const int LZX_LENTABLE_SAFETY = 64; /* we allow length table decoding overruns */
}
}

View File

@@ -1,102 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
public class Header
{
/*
2.2 Header
2.2.1 Chunk Size
The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
ensure that an exact number of input bytes represent an exact number of output bytes for each
chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
(even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
incompressible when the chunk is not the last one.
The LZXD engine encodes a compressed, chunk-size prefix field preceding each compressed chunk in
the compressed byte stream. The compressed, chunk-size prefix field is a byte aligned, little-endian,
16-bit field. The chunk prefix chain could be followed in the compressed stream without
decompressing any data. The next chunk prefix is at a location computed by the absolute byte offset
location of this chunk prefix plus 2 (for the size of the chunk-size prefix field) plus the current chunk
size.
2.2.2 E8 Call Translation
E8 call translation is an optional feature that can be used when the data to compress contains x86
instruction sequences. E8 translation operates as a preprocessing stage before compressing each
chunk, and the compressed stream header contains a bit that indicates whether the decoder shall
reverse the translation as a postprocessing step after decompressing each chunk.
The x86 instruction beginning with a byte value of 0xE8 is followed by a 32-bit, little-endian relative
displacement to the call target. When E8 call translation is enabled, the following preprocessing steps
are performed on the uncompressed input before compression (assuming little-endian byte ordering):
Let chunk_offset refer to the total number of uncompressed bytes preceding this chunk.
Let E8_file_size refer to the caller-specified value given to the compressor or decoded from the header
of the compressed stream during decompression.
The following example shows how E8 translation is performed for each 32-KB chunk of uncompressed
data (or less than 32 KB if last chunk to compress).
if (( chunk_offset < 0x40000000 ) && ( chunk_size > 10 ))
for ( i = 0; i < (chunk_size 10); i++ )
if ( chunk_byte[ i ] == 0xE8 )
long current_pointer = chunk_offset + i;
long displacement = chunk_byte[ i+1 ] |
chunk_byte[ i+2 ] << 8 |
chunk_byte[ i+3 ] << 16 |
chunk_byte[ i+4 ] << 24;
long target = current_pointer + displacement;
if (( target >= 0 ) && ( target < E8_file_size+current_pointer))
if ( target >= E8_file_size )
target = displacement E8_file_size;
endif
chunk_byte[ i+1 ] = (byte)( target );
chunk_byte[ i+2 ] = (byte)( target >> 8 );
chunk_byte[ i+3 ] = (byte)( target >> 16 );
chunk_byte[ i+4 ] = (byte)( target >> 24 );
endif
i += 4;
endif
endfor
endif
After decompression, the E8 scanning algorithm is the same. The following example shows how E8
translation reversal is performed.
long value = chunk_byte[ i+1 ] |
chunk_byte[ i+2 ] << 8 |
chunk_byte[ i+3 ] << 16 |
chunk_byte[ i+4 ] << 24;
if (( value >= -current_pointer ) && ( value < E8_file_size ))
if ( value >= 0 )
displacement = value current_pointer;
else
displacement = value + E8_file_size;
endif
chunk_byte[ i+1 ] = (byte)( displacement );
chunk_byte[ i+2 ] = (byte)( displacement >> 8 );
chunk_byte[ i+3 ] = (byte)( displacement >> 16 );
chunk_byte[ i+4 ] = (byte)( displacement >> 24 );
endif
The first bit in the first chunk in the LZXD bitstream (following the 2-byte, chunk-size prefix described
in section 2.2.1) indicates the presence or absence of two 16-bit fields immediately following the
single bit. If the bit is set, E8 translation is enabled for all the following chunks in the stream using the
32-bit value derived from the two 16-bit fields as the E8_file_size provided to the compressor when E8
translation was enabled. Note that E8_file_size is completely independent of the length of the
uncompressed data. E8 call translation is disabled after the 32,768th chunk (after 1 gigabyte (GB) of
uncompressed data).
Field Comments Size
----------------------------------------------------------------
E8 translation 0-disabled, 1-enabled 1 bit
Translation size high word Only present if enabled 0 or 16 bits
Translation size low word Only present if enabled 0 or 16 bits
*/
}
}

View File

@@ -14,54 +14,45 @@ namespace SabreTools.Models.Compression.LZX
/// subsequent compressed block if present.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class UncompressedBlock
public class UncompressedBlockData : BlockData
{
/// <summary>
/// Generic block header
/// </summary>
#if NET48
public BlockHeader Header;
#else
public BlockHeader? Header;
#endif
/// <summary>
/// Padding to align following field on 16-bit boundary
/// </summary>
/// <remarks>Bits have a value of zero</remarks>
public ushort PaddingBits;
public ushort PaddingBits { get; set; }
/// <summary>
/// Least significant to most significant byte (little-endian DWORD ([MS-DTYP]))
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public uint R0;
public uint R0 { get; set; }
/// <summary>
/// Least significant to most significant byte (little-endian DWORD)
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public uint R1;
public uint R1 { get; set; }
/// <summary>
/// Least significant to most significant byte (little-endian DWORD)
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public uint R2;
public uint R2 { get; set; }
/// <summary>
/// Can use the direct memcpy function, as specified in [IEEE1003.1]
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
#if NET48
public byte[] RawDataBytes;
public byte[] RawDataBytes { get; set; }
#else
public byte[]? RawDataBytes;
public byte[]? RawDataBytes { get; set; }
#endif
/// <summary>
/// Only if uncompressed size is odd
/// </summary>
public byte AlignmentByte;
public byte AlignmentByte { get; set; }
}
}

View File

@@ -4,25 +4,16 @@ namespace SabreTools.Models.Compression.LZX
/// The fields of a verbatim block that follow the generic block header
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class VerbatimBlock
public class VerbatimBlockData : BlockData
{
/// <summary>
/// Generic block header
/// </summary>
#if NET48
public BlockHeader Header;
#else
public BlockHeader? Header;
#endif
/// <summary>
/// Pretree for first 256 elements of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeFirst256;
public byte[] PretreeFirst256 { get; set; }
#else
public byte[]? PretreeFirst256;
public byte[]? PretreeFirst256 { get; set; }
#endif
/// <summary>
@@ -30,9 +21,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsFirst256;
public int[] PathLengthsFirst256 { get; set; }
#else
public int[]? PathLengthsFirst256;
public int[]? PathLengthsFirst256 { get; set; }
#endif
/// <summary>
@@ -40,9 +31,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeRemainder;
public byte[] PretreeRemainder { get; set; }
#else
public byte[]? PretreeRemainder;
public byte[]? PretreeRemainder { get; set; }
#endif
/// <summary>
@@ -50,9 +41,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsRemainder;
public int[] PathLengthsRemainder { get; set; }
#else
public int[]? PathLengthsRemainder;
public int[]? PathLengthsRemainder { get; set; }
#endif
/// <summary>
@@ -60,9 +51,9 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeLengthTree;
public byte[] PretreeLengthTree { get; set; }
#else
public byte[]? PretreeLengthTree;
public byte[]? PretreeLengthTree { get; set; }
#endif
/// <summary>
@@ -70,13 +61,19 @@ namespace SabreTools.Models.Compression.LZX
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsLengthTree;
public int[] PathLengthsLengthTree { get; set; }
#else
public int[]? PathLengthsLengthTree;
public int[]? PathLengthsLengthTree { get; set; }
#endif
// Entry Comments Size
// ---------------------------------------------------------------------------------------
// Token sequence (matches and literals) Specified in section 2.6 Variable
/// <summary>
/// Token sequence (matches and literals)
/// </summary>
/// <remarks>Variable</remarks>
#if NET48
public byte[] TokenSequence { get; set; }
#else
public byte[]? TokenSequence { get; set; }
#endif
}
}

View File

@@ -0,0 +1,41 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Each MSZIP block MUST consist of a 2-byte MSZIP signature and one or more RFC 1951 blocks. The
/// 2-byte MSZIP signature MUST consist of the bytes 0x43 and 0x4B. The MSZIP signature MUST be
/// the first 2 bytes in the MSZIP block. The MSZIP signature is shown in the following packet diagram.
///
/// Each MSZIP block is the result of a single deflate compression operation, as defined in [RFC1951].
/// The compressor that performs the compression operation MUST generate one or more RFC 1951
/// blocks, as defined in [RFC1951]. The number, deflation mode, and type of RFC 1951 blocks in each
/// MSZIP block is determined by the compressor, as defined in [RFC1951]. The last RFC 1951 block in
/// each MSZIP block MUST be marked as the "end" of the stream(1), as defined by [RFC1951]
/// section 3.2.3. Decoding trees MUST be discarded after each RFC 1951 block, but the history buffer
/// MUST be maintained.Each MSZIP block MUST represent no more than 32 KB of uncompressed data.
///
/// The maximum compressed size of each MSZIP block is 32 KB + 12 bytes. This enables the MSZIP
/// block to contain 32 KB of data split between two noncompressed RFC 1951 blocks, each of which
/// has a value of BTYPE = 00.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
public class Block
{
/// <summary>
/// Block header
/// </summary>
#if NET48
public BlockHeader BlockHeader { get; set; }
#else
public BlockHeader? BlockHeader { get; set; }
#endif
/// <summary>
/// Compressed blocks
/// </summary>
#if NET48
public DeflateBlock[] CompressedBlocks { get; set; }
#else
public DeflateBlock[]? CompressedBlocks { get; set; }
#endif
}
}

View File

@@ -4,18 +4,6 @@ namespace SabreTools.Models.Compression.MSZIP
/// Each MSZIP block MUST consist of a 2-byte MSZIP signature and one or more RFC 1951 blocks. The
/// 2-byte MSZIP signature MUST consist of the bytes 0x43 and 0x4B. The MSZIP signature MUST be
/// the first 2 bytes in the MSZIP block. The MSZIP signature is shown in the following packet diagram.
///
/// Each MSZIP block is the result of a single deflate compression operation, as defined in [RFC1951].
/// The compressor that performs the compression operation MUST generate one or more RFC 1951
/// blocks, as defined in [RFC1951]. The number, deflation mode, and type of RFC 1951 blocks in each
/// MSZIP block is determined by the compressor, as defined in [RFC1951]. The last RFC 1951 block in
/// each MSZIP block MUST be marked as the "end" of the stream(1), as defined by [RFC1951]
/// section 3.2.3. Decoding trees MUST be discarded after each RFC 1951 block, but the history buffer
/// MUST be maintained.Each MSZIP block MUST represent no more than 32 KB of uncompressed data.
///
/// The maximum compressed size of each MSZIP block is 32 KB + 12 bytes. This enables the MSZIP
/// block to contain 32 KB of data split between two noncompressed RFC 1951 blocks, each of which
/// has a value of BTYPE = 00.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
public class BlockHeader
@@ -23,6 +11,6 @@ namespace SabreTools.Models.Compression.MSZIP
/// <summary>
/// 'CK'
/// </summary>
public ushort Signature;
public ushort Signature { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Compression with Huffman codes (BTYPE=01 or BTYPE=02)
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
public abstract class CompressedDataHeader : DataHeader
{
/// <summary>
/// Huffman code lengths for the literal / length alphabet
/// </summary>
#if NET48
public virtual uint[] LiteralLengths { get; set; }
#else
public virtual uint[]? LiteralLengths { get; set; }
#endif
/// <summary>
/// Huffman distance codes for the literal / length alphabet
/// </summary>
#if NET48
public virtual uint[] DistanceCodes { get; set; }
#else
public virtual uint[]? DistanceCodes { get; set; }
#endif
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Base class for all data headers (BTYPE=00, BTYPE=01, or BTYPE=02)
/// </summary>
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
public abstract class DataHeader
{
// No common fields between all data headers
}
}

View File

@@ -0,0 +1,47 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Each MSZIP block is the result of a single deflate compression operation, as defined in [RFC1951].
/// The compressor that performs the compression operation MUST generate one or more RFC 1951
/// blocks, as defined in [RFC1951]. The number, deflation mode, and type of RFC 1951 blocks in each
/// MSZIP block is determined by the compressor, as defined in [RFC1951]. The last RFC 1951 block in
/// each MSZIP block MUST be marked as the "end" of the stream(1), as defined by [RFC1951]
/// section 3.2.3. Decoding trees MUST be discarded after each RFC 1951 block, but the history buffer
/// MUST be maintained.Each MSZIP block MUST represent no more than 32 KB of uncompressed data.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
public class DeflateBlock
{
/// <summary>
/// Deflate block (RFC-1951) header
/// </summary>
#if NET48
public DeflateBlockHeader Header { get; set; }
#else
public DeflateBlockHeader? Header { get; set; }
#endif
/// <summary>
/// Compression-specific data header
/// </summary>
#if NET48
public DataHeader DataHeader { get; set; }
#else
public DataHeader? DataHeader { get; set; }
#endif
/// <summary>
/// MSZIP data
/// </summary>
/// <remarks>
/// Depending on the implementation of these models, this property could either be
/// compressed or uncompressed data. Keep this in mind when using the built
/// versions of this model.
/// </remarks>
#if NET48
public byte[] Data { get; set; }
#else
public byte[]? Data { get; set; }
#endif
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Compression with dynamic Huffman codes (BTYPE=10)
/// </summary>
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
public class DynamicCompressedDataHeader : CompressedDataHeader
{
// Codes are provided externally
}
}

View File

@@ -1,27 +0,0 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Compression with dynamic Huffman codes (BTYPE=10)
/// </summary>
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
public class DynamicHuffmanCompressedBlockHeader
{
/// <summary>
/// Huffman code lengths for the literal / length alphabet
/// </summary>
#if NET48
public int[] LiteralLengths;
#else
public int[]? LiteralLengths;
#endif
/// <summary>
/// Huffman distance codes for the literal / length alphabet
/// </summary>
#if NET48
public int[] DistanceCodes;
#else
public int[]? DistanceCodes;
#endif
}
}

View File

@@ -7,7 +7,7 @@ namespace SabreTools.Models.Compression.MSZIP
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
public class FixedHuffmanCompressedBlockHeader
public class FixedCompressedDataHeader : CompressedDataHeader
{
#region Properties
@@ -15,9 +15,9 @@ namespace SabreTools.Models.Compression.MSZIP
/// Huffman code lengths for the literal / length alphabet
/// </summary>
#if NET48
public uint[] LiteralLengths
public override uint[] LiteralLengths
#else
public uint[]? LiteralLengths
public override uint[]? LiteralLengths
#endif
{
get
@@ -57,9 +57,9 @@ namespace SabreTools.Models.Compression.MSZIP
/// Huffman distance codes for the literal / length alphabet
/// </summary>
#if NET48
public uint[] DistanceCodes
public override uint[] DistanceCodes
#else
public uint[]? DistanceCodes
public override uint[]? DistanceCodes
#endif
{
get

View File

@@ -4,18 +4,18 @@ namespace SabreTools.Models.Compression.MSZIP
/// Non-compressed blocks (BTYPE=00)
/// </summary>
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
public class NonCompressedBlockHeader
public class NonCompressedBlockHeader : DataHeader
{
/// <summary>
/// The number of data bytes in the block
/// </summary>
/// <remarks>Bytes 0-1</remarks>
public ushort LEN;
public ushort LEN { get; set; }
/// <summary>
/// The one's complement of LEN
/// </summary>
/// <remarks>Bytes 2-3</remarks>
public ushort NLEN;
public ushort NLEN { get; set; }
}
}

View File

@@ -1,45 +1,50 @@
namespace SabreTools.Models.Compression.Quantum
{
/// <see href="www.russotto.net/quantumcomp.html"/>
public static class Constants
{
/// <summary>
/// Mask for Quantum Compression Level
/// </summary>
public const ushort MASK_QUANTUM_LEVEL = 0x00F0;
public static readonly int[] PositionSlot = new int[]
{
0x00000, 0x00001, 0x00002, 0x00003, 0x00004, 0x00006, 0x00008, 0x0000c,
0x00010, 0x00018, 0x00020, 0x00030, 0x00040, 0x00060, 0x00080, 0x000c0,
0x00100, 0x00180, 0x00200, 0x00300, 0x00400, 0x00600, 0x00800, 0x00c00,
0x01000, 0x01800, 0x02000, 0x03000, 0x04000, 0x06000, 0x08000, 0x0c000,
0x10000, 0x18000, 0x20000, 0x30000, 0x40000, 0x60000, 0x80000, 0xc0000,
0x100000, 0x180000
};
public static readonly int[] PositionExtraBits = new int[]
{
0, 0, 0, 0, 1, 1, 2, 2,
3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10,
11, 11, 12, 12, 13, 13, 14, 14,
15, 15, 16, 16, 17, 17, 18, 18,
19, 19
};
public static readonly int[] LengthSlot = new int[]
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08,
0x0a, 0x0c, 0x0e, 0x12, 0x16, 0x1a, 0x1e, 0x26,
0x2e, 0x36, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x9e,
0xbe, 0xde, 0xfe
};
public static readonly int[] LengthExtraBits = new int[]
{
0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 2, 2, 2, 2, 3, 3,
3, 3, 4, 4, 4, 4, 5, 5,
5, 5, 0
};
/// <summary>
/// Lowest Quantum Level (1)
/// Number of position slots for (tsize - 10)
/// </summary>
public const ushort QUANTUM_LEVEL_LO = 0x0010;
/// <summary>
/// Highest Quantum Level (7)
/// </summary>
public const ushort QUANTUM_LEVEL_HI = 0x0070;
/// <summary>
/// Amount to shift over to get int
/// </summary>
public const ushort SHIFT_QUANTUM_LEVEL = 4;
/// <summary>
/// Mask for Quantum Compression Memory
/// </summary>
public const ushort MASK_QUANTUM_MEM = 0x1F00;
/// <summary>
/// Lowest Quantum Memory (10)
/// </summary>
public const ushort QUANTUM_MEM_LO = 0x0A00;
/// <summary>
/// Highest Quantum Memory (21)
/// </summary>
public const ushort QUANTUM_MEM_HI = 0x1500;
/// <summary>
/// Amount to shift over to get int
/// </summary>
public const ushort SHIFT_QUANTUM_MEM = 8;
public static readonly int[] NumPositionSlots = new int[]
{
20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
};
}
}

View File

@@ -1,23 +1,28 @@
namespace SabreTools.Models.Compression.Quantum
{
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/cabinet/cabinet.h"/>
/// <see href="http://www.russotto.net/quantumcomp.html"/>
public sealed class Model
{
public int TimeToReorder;
public int Entries;
public int Entries { get; set; }
/// <remarks>
/// All the models are initialized with the symbols in symbol
/// order in the table, and with every symbol in the table
/// having a frequency of 1
/// </remarks>
#if NET48
public ModelSymbol[] Symbols;
public ModelSymbol[] Symbols { get; set; }
#else
public ModelSymbol[]? Symbols;
public ModelSymbol?[]? Symbols { get; set; }
#endif
#if NET48
public ushort[] LookupTable = new ushort[256];
#else
public ushort[]? LookupTable = new ushort[256];
#endif
/// <remarks>
/// The initial total frequency is equal to the number of entries
/// in the table
/// </remarks>
public int TotalFrequency { get; set; }
/// <remarks>The initial time_to_reorder value is 4</remarks>
public int TimeToReorder { get; set; }
}
}

View File

@@ -1,11 +1,15 @@
namespace SabreTools.Models.Compression.Quantum
{
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/cabinet/cabinet.h"/>
/// <see href="http://www.russotto.net/quantumcomp.html"/>
public sealed class ModelSymbol
{
public ushort Symbol;
public ushort Symbol { get; set; }
public ushort CumulativeFrequency;
/// <summary>
/// The cumulative frequency is the frequency of all the symbols
/// which are at a higher index in the table than that symbol —
/// thus the last entry in the table has a cumulative frequency of 0.
/// </summary>
public ushort CumulativeFrequency { get; set; }
}
}

38
CueSheets/CueFile.cs Normal file
View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.IO;
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single FILE in a cuesheet
/// </summary>
public class CueFile
{
/// <summary>
/// filename
/// </summary>
#if NET48
public string FileName { get; set; }
#else
public string? FileName { get; set; }
#endif
/// <summary>
/// filetype
/// </summary>
public CueFileType FileType { get; set; }
/// <summary>
/// List of TRACK in FILE
/// </summary>
#if NET48
public CueTrack[] Tracks { get; set; }
#else
public CueTrack?[]? Tracks { get; set; }
#endif
}
}

33
CueSheets/CueIndex.cs Normal file
View File

@@ -0,0 +1,33 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single INDEX in a TRACK
/// </summary>
public class CueIndex
{
/// <summary>
/// INDEX number, between 0 and 99
/// </summary>
public int Index { get; set; }
/// <summary>
/// Starting time of INDEX in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Starting time of INDEX in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Starting time of INDEX in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

65
CueSheets/CueSheet.cs Normal file
View File

@@ -0,0 +1,65 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single cuesheet
/// </summary>
public class CueSheet
{
/// <summary>
/// CATALOG
/// </summary>
#if NET48
public string Catalog { get; set; }
#else
public string? Catalog { get; set; }
#endif
/// <summary>
/// CDTEXTFILE
/// </summary>
#if NET48
public string CdTextFile { get; set; }
#else
public string? CdTextFile { get; set; }
#endif
/// <summary>
/// PERFORMER
/// </summary>
#if NET48
public string Performer { get; set; }
#else
public string? Performer { get; set; }
#endif
/// <summary>
/// SONGWRITER
/// </summary>
#if NET48
public string Songwriter { get; set; }
#else
public string? Songwriter { get; set; }
#endif
/// <summary>
/// TITLE
/// </summary>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// List of FILE in cuesheet
/// </summary>
#if NET48
public CueFile[] Files { get; set; }
#else
public CueFile?[]? Files { get; set; }
#endif
}
}

91
CueSheets/CueTrack.cs Normal file
View File

@@ -0,0 +1,91 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single TRACK in a FILE
/// </summary>
public class CueTrack
{
/// <summary>
/// Track number. The range is 1 to 99.
/// </summary>
public int Number { get; set; }
/// <summary>
/// Track datatype
/// </summary>
public CueTrackDataType DataType { get; set; }
/// <summary>
/// FLAGS
/// </summary>
public CueTrackFlag Flags { get; set; }
/// <summary>
/// ISRC
/// </summary>
/// <remarks>12 characters in length</remarks>
#if NET48
public string ISRC { get; set; }
#else
public string? ISRC { get; set; }
#endif
/// <summary>
/// PERFORMER
/// </summary>
#if NET48
public string Performer { get; set; }
#else
public string? Performer { get; set; }
#endif
/// <summary>
/// SONGWRITER
/// </summary>
#if NET48
public string Songwriter { get; set; }
#else
public string? Songwriter { get; set; }
#endif
/// <summary>
/// TITLE
/// </summary>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// PREGAP
/// </summary>
#if NET48
public PreGap PreGap { get; set; }
#else
public PreGap? PreGap { get; set; }
#endif
/// <summary>
/// List of INDEX in TRACK
/// </summary>
/// <remarks>Must start with 0 or 1 and then sequential</remarks>
#if NET48
public CueIndex[] Indices { get; set; }
#else
public CueIndex?[]? Indices { get; set; }
#endif
/// <summary>
/// POSTGAP
/// </summary>
#if NET48
public PostGap PostGap { get; set; }
#else
public PostGap? PostGap { get; set; }
#endif
}
}

116
CueSheets/Enums.cs Normal file
View File

@@ -0,0 +1,116 @@
using System;
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// The audio or data files filetype
/// </summary>
public enum CueFileType
{
/// <summary>
/// Intel binary file (least significant byte first). Use for data files.
/// </summary>
BINARY,
/// <summary>
/// Motorola binary file (most significant byte first). Use for data files.
/// </summary>
MOTOROLA,
/// <summary>
/// Audio AIFF file (44.1KHz 16-bit stereo)
/// </summary>
AIFF,
/// <summary>
/// Audio WAVE file (44.1KHz 16-bit stereo)
/// </summary>
WAVE,
/// <summary>
/// Audio MP3 file (44.1KHz 16-bit stereo)
/// </summary>
MP3,
}
/// <summary>
/// Track datatype
/// </summary>
public enum CueTrackDataType
{
/// <summary>
/// AUDIO, Audio/Music (2352)
/// </summary>
AUDIO,
/// <summary>
/// CDG, Karaoke CD+G (2448)
/// </summary>
CDG,
/// <summary>
/// MODE1/2048, CD-ROM Mode1 Data (cooked)
/// </summary>
MODE1_2048,
/// <summary>
/// MODE1/2352 CD-ROM Mode1 Data (raw)
/// </summary>
MODE1_2352,
/// <summary>
/// MODE2/2336, CD-ROM XA Mode2 Data
/// </summary>
MODE2_2336,
/// <summary>
/// MODE2/2352, CD-ROM XA Mode2 Data
/// </summary>
MODE2_2352,
/// <summary>
/// CDI/2336, CD-I Mode2 Data
/// </summary>
CDI_2336,
/// <summary>
/// CDI/2352, CD-I Mode2 Data
/// </summary>
CDI_2352,
}
/// <summary>
/// Special subcode flags within a track
/// </summary>
[Flags]
public enum CueTrackFlag
{
/// <summary>
/// DCP, Digital copy permitted
/// </summary>
DCP = 1 << 0,
/// <summary>
/// 4CH, Four channel audio
/// </summary>
FourCH = 1 << 1,
/// <summary>
/// PRE, Pre-emphasis enabled (audio tracks only)
/// </summary>
PRE = 1 << 2,
/// <summary>
/// SCMS, Serial Copy Management System (not supported by all recorders)
/// </summary>
SCMS = 1 << 3,
/// <summary>
/// DATA, set for data files. This flag is set automatically based on the tracks filetype
/// </summary>
DATA = 1 << 4,
}
}

28
CueSheets/PostGap.cs Normal file
View File

@@ -0,0 +1,28 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents POSTGAP information of a track
/// </summary>
public class PostGap
{
/// <summary>
/// Length of POSTGAP in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Length of POSTGAP in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Length of POSTGAP in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

28
CueSheets/PreGap.cs Normal file
View File

@@ -0,0 +1,28 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents PREGAP information of a track
/// </summary>
public class PreGap
{
/// <summary>
/// Length of PREGAP in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Length of PREGAP in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Length of PREGAP in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

View File

@@ -6,38 +6,38 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets;
public ushort NumberOfTitleSets { get; set; }
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
/// End address (last byte of last VTS_ATRT)
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// Offset to VTS_ATRT n
/// </summary>
#if NET48
public uint[] Offsets;
public uint[] Offsets { get; set; }
#else
public uint[]? Offsets;
public uint[]? Offsets { get; set; }
#endif
/// <summary>
/// Entries
/// </summary>
#if NET48
public AudioSubPictureAttributesTableEntry[] Entries;
public AudioSubPictureAttributesTableEntry[] Entries { get; set; }
#else
public AudioSubPictureAttributesTableEntry[]? Entries;
public AudioSubPictureAttributesTableEntry?[]? Entries { get; set; }
#endif
}
}

View File

@@ -6,22 +6,22 @@ namespace SabreTools.Models.DVD
/// <summary>
/// End address (EA)
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// VTS_CAT (copy of offset 022-025 of the VTS IFO file)
/// 0=unspecified, 1=Karaoke
/// </summary>
public uint Category;
public uint Category { get; set; }
/// <summary>
/// Copy of VTS attributes (offset 100 and on from the VTS IFO
/// file, usually 0x300 bytes long)
/// </summary>
#if NET48
public byte[] AttributesCopy;
public byte[] AttributesCopy { get; set; }
#else
public byte[]? AttributesCopy;
public byte[]? AttributesCopy { get; set; }
#endif
}
}

View File

@@ -6,29 +6,29 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Number of VOB IDs
/// </summary>
public ushort NumberOfVOBIDs;
public ushort NumberOfVOBIDs { get; set; }
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
/// End address (last byte of last entry)
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// 12-byte entries
/// </summary>
#if NET48
public CellAddressTableEntry[] Entries;
public CellAddressTableEntry[] Entries { get; set; }
#else
public CellAddressTableEntry[]? Entries;
public CellAddressTableEntry?[]? Entries { get; set; }
#endif
}
}

View File

@@ -6,26 +6,26 @@ namespace SabreTools.Models.DVD
/// <summary>
/// VOBidn
/// </summary>
public ushort VOBIdentity;
public ushort VOBIdentity { get; set; }
/// <summary>
/// CELLidn
/// </summary>
public byte CellIdentity;
public byte CellIdentity { get; set; }
/// <summary>
/// Reserved
/// </summary>
public byte Reserved;
public byte Reserved { get; set; }
/// <summary>
/// Starting sector within VOB
/// </summary>
public uint StartingSectorWithinVOB;
public uint StartingSectorWithinVOB { get; set; }
/// <summary>
/// Ending sector within VOB
/// </summary>
public uint EndingSectorWithinVOB;
public uint EndingSectorWithinVOB { get; set; }
}
}

View File

@@ -6,39 +6,39 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Number of Language Units
/// </summary>
public ushort NumberOfLanguageUnits;
public ushort NumberOfLanguageUnits { get; set; }
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
/// End address (last byte of last PGC in last LU)
/// relative to VMGM_PGCI_UT
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// Language Units
/// </summary>
#if NET48
public LanguageUnitTableEntry[] Entries;
public LanguageUnitTableEntry[] Entries { get; set; }
#else
public LanguageUnitTableEntry[]? Entries;
public LanguageUnitTableEntry?[]? Entries { get; set; }
#endif
/// <summary>
/// Program Chains
/// </summary>
#if NET48
public ProgramChainTable[] ProgramChains;
public ProgramChainTable[] ProgramChains { get; set; }
#else
public ProgramChainTable[]? ProgramChains;
public ProgramChainTable?[]? ProgramChains { get; set; }
#endif
}
}

View File

@@ -6,21 +6,21 @@ namespace SabreTools.Models.DVD
/// <summary>
/// ISO639 language code
/// </summary>
public ushort ISO639LanguageCode;
public ushort ISO639LanguageCode { get; set; }
/// <summary>
/// Reserved for language code extension
/// </summary>
public byte Reserved;
public byte Reserved { get; set; }
/// <summary>
/// Menu existence flag [80 = title]
/// </summary>
public byte MenuExistenceFlag;
public byte MenuExistenceFlag { get; set; }
/// <summary>
/// Offset to VMGM_LU, relative to VMGM_PGCI_UT
/// </summary>
public uint LanguageUnitOffset;
public uint LanguageUnitOffset { get; set; }
}
}

View File

@@ -10,25 +10,25 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Number of countries
/// </summary>
public ushort NumberOfCountries;
public ushort NumberOfCountries { get; set; }
/// <summary>
/// Number of title sets (NTs)
/// </summary>
public ushort NumberOfTitleSets;
public ushort NumberOfTitleSets { get; set; }
/// <summary>
/// End address (last byte of last PTL_MAIT)
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// Entries
/// </summary>
#if NET48
public ParentalManagementMasksTableEntry[] Entries;
public ParentalManagementMasksTableEntry[] Entries { get; set; }
#else
public ParentalManagementMasksTableEntry[]? Entries;
public ParentalManagementMasksTableEntry?[]? Entries { get; set; }
#endif
/// <summary>
@@ -37,9 +37,9 @@ namespace SabreTools.Models.DVD
/// by the masks for level 7, and so on to level 1.
/// </summary>
#if NET48
public byte[][] BitMasks;
public byte[][] BitMasks { get; set; }
#else
public byte[][]? BitMasks;
public byte[][]? BitMasks { get; set; }
#endif
}
}

View File

@@ -6,20 +6,20 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Country code
/// </summary>
public ushort CountryCode;
public ushort CountryCode { get; set; }
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
/// Offset to PTL_MAIT
/// </summary>
public uint Offset;
public uint Offset { get; set; }
}
}

View File

@@ -6,30 +6,30 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Number of Program Chains
/// </summary>
public ushort NumberOfProgramChains;
public ushort NumberOfProgramChains { get; set; }
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
/// End address (last byte of last PGC in this LU)
/// relative to VMGM_LU
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// Program Chains
/// </summary>
#if NET48
public ProgramChainTableEntry[] Entries;
public ProgramChainTableEntry[] Entries { get; set; }
#else
public ProgramChainTableEntry[]? Entries;
public ProgramChainTableEntry?[]? Entries { get; set; }
#endif
}
}

View File

@@ -6,21 +6,21 @@ namespace SabreTools.Models.DVD
/// <summary>
/// PGC category
/// </summary>
public ProgramChainCategory Category;
public ProgramChainCategory Category { get; set; }
/// <summary>
/// Unknown
/// </summary>
public byte Unknown;
public byte Unknown { get; set; }
/// <summary>
/// Parental management mask
/// </summary>
public ushort ParentalManagementMask;
public ushort ParentalManagementMask { get; set; }
/// <summary>
/// Offset to VMGM_PGC, relative to VMGM_LU
/// </summary>
public uint Offset;
public uint Offset { get; set; }
}
}

View File

@@ -6,29 +6,29 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Number of titles
/// </summary>
public ushort NumberOfTitles;
public ushort NumberOfTitles { get; set; }
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
/// <summary>
/// End address (last byte of last entry)
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// 12-byte entries
/// </summary>
#if NET48
public TitlesTableEntry[] Entries;
public TitlesTableEntry[] Entries { get; set; }
#else
public TitlesTableEntry[]? Entries;
public TitlesTableEntry?[]? Entries { get; set; }
#endif
}
}

View File

@@ -6,37 +6,37 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Title type
/// </summary>
public TitleType TitleType;
public TitleType TitleType { get; set; }
/// <summary>
/// Number of angles
/// </summary>
public byte NumberOfAngles;
public byte NumberOfAngles { get; set; }
/// <summary>
/// Number of chapters (PTTs)
/// </summary>
public ushort NumberOfChapters;
public ushort NumberOfChapters { get; set; }
/// <summary>
/// Parental management mask
/// </summary>
public ushort ParentalManagementMask;
public ushort ParentalManagementMask { get; set; }
/// <summary>
/// Video Title Set number (VTSN)
/// </summary>
public byte VideoTitleSetNumber;
public byte VideoTitleSetNumber { get; set; }
/// <summary>
/// Title number within VTS (VTS_TTN)
/// </summary>
public byte TitleNumberWithinVTS;
public byte TitleNumberWithinVTS { get; set; }
/// <summary>
/// Start sector for VTS, referenced to whole disk
/// (video_ts.ifo starts at sector 00000000)
/// </summary>
public uint VTSStartSector;
public uint VTSStartSector { get; set; }
}
}

View File

@@ -6,15 +6,15 @@ namespace SabreTools.Models.DVD
/// <summary>
/// End address (last byte of last entry)
/// </summary>
public uint EndAddress;
public uint EndAddress { get; set; }
/// <summary>
/// Starting sector within VOB of nth VOBU
/// </summary>
#if NET48
public uint[] StartingSectors;
public uint[] StartingSectors { get; set; }
#else
public uint[]? StartingSectors;
public uint[]? StartingSectors { get; set; }
#endif
}
}

View File

@@ -7,20 +7,20 @@ namespace SabreTools.Models.DVD
/// "DVDVIDEO-VMG"
/// </summary>
#if NET48
public string Signature;
public string Signature { get; set; }
#else
public string? Signature;
public string? Signature { get; set; }
#endif
/// <summary>
/// Last sector of VMG set (last sector of BUP)
/// </summary>
public uint LastVMGSetSector;
public uint LastVMGSetSector { get; set; }
/// <summary>
/// Last sector of IFO
/// </summary>
public uint LastIFOSector;
public uint LastIFOSector { get; set; }
/// <summary>
/// Version number
@@ -28,151 +28,151 @@ namespace SabreTools.Models.DVD
/// - Byte 1, Bits 7-4 - Major version number
/// - Byte 1, Bits 3-0 - Minor version number
/// </summary>
public ushort VersionNumber;
public ushort VersionNumber { get; set; }
/// <summary>
/// VMG category
/// </summary>
/// <remarks>byte1=prohibited region mask</remarks>
public uint VMGCategory;
public uint VMGCategory { get; set; }
/// <summary>
/// Number of volumes
/// </summary>
public ushort NumberOfVolumes;
public ushort NumberOfVolumes { get; set; }
/// <summary>
/// Volume number
/// </summary>
public ushort VolumeNumber;
public ushort VolumeNumber { get; set; }
/// <summary>
/// Side ID
/// </summary>
public byte SideID;
public byte SideID { get; set; }
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets;
public ushort NumberOfTitleSets { get; set; }
/// <summary>
/// Provider ID
/// </summary>
#if NET48
public byte[] ProviderID;
public byte[] ProviderID { get; set; }
#else
public byte[]? ProviderID;
public byte[]? ProviderID { get; set; }
#endif
/// <summary>
/// VMG POS
/// </summary>
public ulong VMGPOS;
public ulong VMGPOS { get; set; }
/// <summary>
/// End byte address of VMGI_MAT
/// </summary>
public uint InformationManagementTableEndByteAddress;
public uint InformationManagementTableEndByteAddress { get; set; }
/// <summary>
/// Start address of FP_PGC (First Play program chain)
/// </summary>
public uint FirstPlayProgramChainStartAddress;
public uint FirstPlayProgramChainStartAddress { get; set; }
/// <summary>
/// Start sector of Menu VOB
/// </summary>
public uint MenuVOBStartSector;
public uint MenuVOBStartSector { get; set; }
/// <summary>
/// Sector pointer to TT_SRPT (table of titles)
/// </summary>
public uint TableOfTitlesSectorPointer;
public uint TableOfTitlesSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VMGM_PGCI_UT (Menu Program Chain table)
/// </summary>
public uint MenuProgramChainTableSectorPointer;
public uint MenuProgramChainTableSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VMG_PTL_MAIT (Parental Management masks)
/// </summary>
public uint ParentalManagementMasksSectorPointer;
public uint ParentalManagementMasksSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VMG_VTS_ATRT (copies of VTS audio/sub-picture attributes)
/// </summary>
public uint AudioSubPictureAttributesSectorPointer;
public uint AudioSubPictureAttributesSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VMG_TXTDT_MG (text data)
/// </summary>
public uint TextDataSectorPointer;
public uint TextDataSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VMGM_C_ADT (menu cell address table)
/// </summary>
public uint MenuCellAddressTableSectorPointer;
public uint MenuCellAddressTableSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VMGM_VOBU_ADMAP (menu VOBU address map)
/// </summary>
public uint MenuVOBUAddressMapSectorPointer;
public uint MenuVOBUAddressMapSectorPointer { get; set; }
/// <summary>
/// Video attributes of VMGM_VOBS
/// </summary>
#if NET48
public byte[] VideoAttributes;
public byte[] VideoAttributes { get; set; }
#else
public byte[]? VideoAttributes;
public byte[]? VideoAttributes { get; set; }
#endif
/// <summary>
/// Number of audio streams in VMGM_VOBS
/// </summary>
public ushort NumberOfAudioStreams;
public ushort NumberOfAudioStreams { get; set; }
/// <summary>
/// Audio attributes of VMGM_VOBS
/// </summary>
#if NET48
public byte[][] AudioAttributes;
public byte[][] AudioAttributes { get; set; }
#else
public byte[][]? AudioAttributes;
public byte[][]? AudioAttributes { get; set; }
#endif
/// <summary>
/// Unknown
/// </summary>
#if NET48
public byte[] Unknown;
public byte[] Unknown { get; set; }
#else
public byte[]? Unknown;
public byte[]? Unknown { get; set; }
#endif
/// <summary>
/// Number of subpicture streams in VMGM_VOBS (0 or 1)
/// </summary>
public ushort NumberOfSubpictureStreams;
public ushort NumberOfSubpictureStreams { get; set; }
/// <summary>
/// Subpicture attributes of VMGM_VOBS
/// </summary>
#if NET48
public byte[] SubpictureAttributes;
public byte[] SubpictureAttributes { get; set; }
#else
public byte[]? SubpictureAttributes;
public byte[]? SubpictureAttributes { get; set; }
#endif
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
}
}

View File

@@ -7,20 +7,20 @@ namespace SabreTools.Models.DVD
/// "DVDVIDEO-VTS"
/// </summary>
#if NET48
public string Signature;
public string Signature { get; set; }
#else
public string? Signature;
public string? Signature { get; set; }
#endif
/// <summary>
/// Last sector of title set (last sector of BUP)
/// </summary>
public uint LastTitleSetSector;
public uint LastTitleSetSector { get; set; }
/// <summary>
/// Last sector of IFO
/// </summary>
public uint LastIFOSector;
public uint LastIFOSector { get; set; }
/// <summary>
/// Version number
@@ -28,161 +28,161 @@ namespace SabreTools.Models.DVD
/// - Byte 1, Bits 7-4 - Major version number
/// - Byte 1, Bits 3-0 - Minor version number
/// </summary>
public ushort VersionNumber;
public ushort VersionNumber { get; set; }
/// <summary>
/// VTS category
/// </summary>
/// <remarks>0=unspecified, 1=Karaoke</remarks>
public uint VMGCategory;
public uint VMGCategory { get; set; }
/// <summary>
/// Number of volumes
/// </summary>
public ushort NumberOfVolumes;
public ushort NumberOfVolumes { get; set; }
/// <summary>
/// Volume number
/// </summary>
public ushort VolumeNumber;
public ushort VolumeNumber { get; set; }
/// <summary>
/// Side ID
/// </summary>
public byte SideID;
public byte SideID { get; set; }
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets;
public ushort NumberOfTitleSets { get; set; }
/// <summary>
/// Provider ID
/// </summary>
#if NET48
public byte[] ProviderID;
public byte[] ProviderID { get; set; }
#else
public byte[]? ProviderID;
public byte[]? ProviderID { get; set; }
#endif
/// <summary>
/// VMG POS
/// </summary>
public ulong VMGPOS;
public ulong VMGPOS { get; set; }
/// <summary>
/// End byte address of VTS_MAT
/// </summary>
public uint InformationManagementTableEndByteAddress;
public uint InformationManagementTableEndByteAddress { get; set; }
/// <summary>
/// Start address of FP_PGC (First Play program chain)
/// </summary>
public uint FirstPlayProgramChainStartAddress;
public uint FirstPlayProgramChainStartAddress { get; set; }
/// <summary>
/// Start sector of Menu VOB
/// </summary>
public uint MenuVOBStartSector;
public uint MenuVOBStartSector { get; set; }
/// <summary>
/// Start sector of Title VOB
/// </summary>
public uint TitleVOBStartSector;
public uint TitleVOBStartSector { get; set; }
/// <summary>
/// Sector pointer to VTS_PTT_SRPT (table of Titles and Chapters)
/// </summary>
public uint TableOfTitlesAndChaptersSectorPointer;
public uint TableOfTitlesAndChaptersSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTS_PGCI (Title Program Chain table)
/// </summary>
public uint TitleProgramChainTableSectorPointer;
public uint TitleProgramChainTableSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTSM_PGCI_UT (Menu Program Chain table)
/// </summary>
public uint MenuProgramChainTableSectorPointer;
public uint MenuProgramChainTableSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTS_TMAPTI (time map)
/// </summary>
public uint TimeMapSectorPointer;
public uint TimeMapSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTSM_C_ADT (menu cell address table)
/// </summary>
public uint MenuCellAddressTableSectorPointer;
public uint MenuCellAddressTableSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTSM_VOBU_ADMAP (menu VOBU address map)
/// </summary>
public uint MenuVOBUAddressMapSectorPointer;
public uint MenuVOBUAddressMapSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTS_C_ADT (title set cell address table)
/// </summary>
public uint TitleSetCellAddressTableSectorPointer;
public uint TitleSetCellAddressTableSectorPointer { get; set; }
/// <summary>
/// Sector pointer to VTS_VOBU_ADMAP (title set VOBU address map)
/// </summary>
public uint TitleSetVOBUAddressMapSectorPointer;
public uint TitleSetVOBUAddressMapSectorPointer { get; set; }
/// <summary>
/// Video attributes of VTSM_VOBS
/// </summary>
#if NET48
public byte[] VideoAttributes;
public byte[] VideoAttributes { get; set; }
#else
public byte[]? VideoAttributes;
public byte[]? VideoAttributes { get; set; }
#endif
/// <summary>
/// Number of audio streams in VTSM_VOBS
/// </summary>
public ushort NumberOfAudioStreams;
public ushort NumberOfAudioStreams { get; set; }
/// <summary>
/// Audio attributes of VTSM_VOBS
/// </summary>
#if NET48
public byte[][] AudioAttributes;
public byte[][] AudioAttributes { get; set; }
#else
public byte[][]? AudioAttributes;
public byte[][]? AudioAttributes { get; set; }
#endif
/// <summary>
/// Unknown
/// </summary>
#if NET48
public byte[] Unknown;
public byte[] Unknown { get; set; }
#else
public byte[]? Unknown;
public byte[]? Unknown { get; set; }
#endif
/// <summary>
/// Number of subpicture streams in VTSM_VOBS (0 or 1)
/// </summary>
public ushort NumberOfSubpictureStreams;
public ushort NumberOfSubpictureStreams { get; set; }
/// <summary>
/// Subpicture attributes of VTSM_VOBS
/// </summary>
#if NET48
public byte[] SubpictureAttributes;
public byte[] SubpictureAttributes { get; set; }
#else
public byte[]? SubpictureAttributes;
public byte[]? SubpictureAttributes { get; set; }
#endif
/// <summary>
/// Reserved
/// </summary>
#if NET48
public byte[] Reserved;
public byte[] Reserved { get; set; }
#else
public byte[]? Reserved;
public byte[]? Reserved { get; set; }
#endif
}
}

View File

@@ -6,36 +6,36 @@ namespace SabreTools.Models.GCF
/// <summary>
/// Flags for the block entry. 0x200F0000 == Not used.
/// </summary>
public uint EntryFlags;
public uint EntryFlags { get; set; }
/// <summary>
/// The offset for the data contained in this block entry in the file.
/// </summary>
public uint FileDataOffset;
public uint FileDataOffset { get; set; }
/// <summary>
/// The length of the data in this block entry.
/// </summary>
public uint FileDataSize;
public uint FileDataSize { get; set; }
/// <summary>
/// The offset to the first data block of this block entry's data.
/// </summary>
public uint FirstDataBlockIndex;
public uint FirstDataBlockIndex { get; set; }
/// <summary>
/// The next block entry in the series. (N/A if == BlockCount.)
/// </summary>
public uint NextBlockEntryIndex;
public uint NextBlockEntryIndex { get; set; }
/// <summary>
/// The previous block entry in the series. (N/A if == BlockCount.)
/// </summary>
public uint PreviousBlockEntryIndex;
public uint PreviousBlockEntryIndex { get; set; }
/// <summary>
/// The offset of the block entry in the directory.
/// </summary>
public uint DirectoryIndex;
public uint DirectoryIndex { get; set; }
}
}

View File

@@ -6,41 +6,41 @@ namespace SabreTools.Models.GCF
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount;
public uint BlockCount { get; set; }
/// <summary>
/// Number of data blocks that point to data.
/// </summary>
public uint BlocksUsed;
public uint BlocksUsed { get; set; }
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0;
public uint Dummy0 { get; set; }
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1;
public uint Dummy1 { get; set; }
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2;
public uint Dummy2 { get; set; }
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3;
public uint Dummy3 { get; set; }
/// <summary>
/// Reserved
/// </summary>
public uint Dummy4;
public uint Dummy4 { get; set; }
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum;
public uint Checksum { get; set; }
}
}

View File

@@ -9,11 +9,11 @@ namespace SabreTools.Models.GCF
/// <summary>
/// The previous block entry. (N/A if == BlockCount.)
/// </summary>
public uint PreviousBlockEntryIndex;
public uint PreviousBlockEntryIndex { get; set; }
/// <summary>
/// The next block entry. (N/A if == BlockCount.)
/// </summary>
public uint NextBlockEntryIndex;
public uint NextBlockEntryIndex { get; set; }
}
}

View File

@@ -9,26 +9,26 @@ namespace SabreTools.Models.GCF
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount;
public uint BlockCount { get; set; }
/// <summary>
/// Index of the first block entry.
/// </summary>
public uint FirstBlockEntryIndex;
public uint FirstBlockEntryIndex { get; set; }
/// <summary>
/// Index of the last block entry.
/// </summary>
public uint LastBlockEntryIndex;
public uint LastBlockEntryIndex { get; set; }
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0;
public uint Dummy0 { get; set; }
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum;
public uint Checksum { get; set; }
}
}

View File

@@ -6,6 +6,6 @@ namespace SabreTools.Models.GCF
/// <summary>
/// Checksum.
/// </summary>
public uint Checksum;
public uint Checksum { get; set; }
}
}

View File

@@ -6,11 +6,11 @@ namespace SabreTools.Models.GCF
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0;
public uint Dummy0 { get; set; }
/// <summary>
/// Size of LPGCFCHECKSUMHEADER & LPGCFCHECKSUMMAPHEADER & in bytes.
/// </summary>
public uint ChecksumSize;
public uint ChecksumSize { get; set; }
}
}

View File

@@ -6,11 +6,11 @@ namespace SabreTools.Models.GCF
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount;
public uint ChecksumCount { get; set; }
/// <summary>
/// Index of first checksum.
/// </summary>
public uint FirstChecksumIndex;
public uint FirstChecksumIndex { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More