28 Commits
1.2.0 ... 1.4.3

Author SHA1 Message Date
Matt Nadareski
8f78c73c6f Fix publish scripts 2024-04-23 14:12:10 -04:00
Matt Nadareski
af4ff3d383 Bump version 2024-04-23 14:10:58 -04:00
Matt Nadareski
3e638a5c57 Make Linux publish script executable 2024-04-23 14:10:27 -04:00
Matt Nadareski
638d0226c1 Add publish scripts 2024-04-23 14:10:03 -04:00
Matt Nadareski
07c6d5b43a Obsolete is not an error... for now 2024-04-23 13:38:37 -04:00
Matt Nadareski
108e63a099 Add some null-terminated type flags 2024-04-23 13:36:24 -04:00
Matt Nadareski
c636d3252b Migrate many models to StructLayout 2024-04-23 13:30:43 -04:00
Matt Nadareski
b19dbf2254 Update APPNOTE link, add more Header IDs 2024-04-17 16:43:02 -04:00
Matt Nadareski
111b84170c Add relevant information to PKZIP archive 2024-04-17 16:09:30 -04:00
Matt Nadareski
2d7df0d4fb Add PKZIP archive model 2024-04-17 15:59:56 -04:00
Matt Nadareski
aba02663e5 Start adding PKZIP models 2024-04-17 15:47:41 -04:00
Matt Nadareski
594fec923a Bump version 2024-04-03 22:44:18 -04:00
Deterous
b5cf4e870d Add fields for v1.0 catalog.js files (#6) 2024-04-03 19:43:17 -07:00
Matt Nadareski
e6976796c2 Initial attempt at Delphi models 2024-04-02 10:58:20 -04:00
Deterous
295d8c7612 XboxOne/XboxSX catalog.js Model (#5)
* XboxOne catalog.js model

* Split Catalog object, bump version

* Minor fixes

* Custom JsonConverter for launchPackage

* Make launchPackage an abstract object

* Don't ignore packages

* Fix field types for Catalog/Package
2024-04-02 07:54:57 -07:00
Matt Nadareski
4dd184583c Revert XML tag for OfflineList duplicate ID 2024-03-19 15:30:45 -04:00
Matt Nadareski
081c9c9245 Bump version 2024-03-12 16:21:06 -04:00
Matt Nadareski
b974380ccf Fix SoftwareList.Disk field name 2024-03-12 15:28:58 -04:00
Matt Nadareski
41ed2cbc9a Fix XML element name for duplicateId 2024-03-12 00:07:47 -04:00
Matt Nadareski
2cfcb49e35 Fix missing OfflineList field 2024-03-11 23:35:22 -04:00
Matt Nadareski
b3f3f12b3e Use "main" instead of "master" 2024-02-27 19:06:26 -05:00
Matt Nadareski
b41700ff92 Update copyright date 2024-02-27 17:18:02 -05:00
Matt Nadareski
e8a357546b Add nuget package and PR workflows 2024-02-27 17:17:50 -05:00
Matt Nadareski
68f0201c11 Add SafeDisc encrypted file entry model 2023-11-30 19:11:52 -05:00
Matt Nadareski
25b6493249 Bump version 2023-11-21 11:15:24 -05:00
Matt Nadareski
a551363c0b Support .NET Framework 2.0 2023-11-20 23:44:05 -05:00
Matt Nadareski
2fd92aea8f Support .NET Framework 3.5 2023-11-20 21:10:43 -05:00
Matt Nadareski
a61b3d0ed9 Add IS Archive V3 models 2023-11-15 14:30:25 -05:00
147 changed files with 3217 additions and 615 deletions

43
.github/workflows/build_nupkg.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Nuget Pack
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Pack
run: dotnet pack
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: 'bin/Release/*.nupkg'
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: True
artifacts: 'bin/Release/*.nupkg'
body: 'Last built commit: ${{ github.sha }}'
name: 'Rolling Release'
prerelease: True
replacesArtifacts: True
tag: "rolling"
updateOnlyUnreleased: True

17
.github/workflows/check_pr.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Build PR
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build

View File

@@ -1,13 +1,17 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <summary>
/// This record type is undocumented but found in real media key blocks
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public sealed class CopyrightRecord : Record
{
/// <summary>
/// Null-terminated ASCII string representing the copyright
/// </summary>
public string? Copyright { get; set; }
[MarshalAs(UnmanagedType.LPStr)]
public string? Copyright;
}
}

View File

@@ -1,6 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DriveRevocationListEntry
{
/// <summary>
@@ -9,13 +12,14 @@ 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 { get; set; }
public ushort Range;
/// <summary>
/// A 6-byte Drive ID value identifying the Licensed Drive being revoked
/// (or the first in a range of Licensed Drives being revoked, in the
/// case of a non-zero Range value).
/// </summary>
public byte[]? DriveID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? DriveID;
}
}

View File

@@ -1,6 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class HostRevocationListEntry
{
/// <summary>
@@ -9,13 +12,14 @@ 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 { get; set; }
public ushort Range;
/// <summary>
/// A 6-byte Host ID value identifying the host being revoked (or the
/// first in a range of hosts being revoked, in the case of a non-zero
/// Range value).
/// </summary>
public byte[]? HostID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? HostID;
}
}

View File

@@ -1,6 +1,9 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SubsetDifference
{
/// <summary>
@@ -9,12 +12,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 { get; set; }
public byte Mask;
/// <summary>
/// The last 4 bytes are the uv number, most significant
/// byte first.
/// </summary>
public uint Number { get; set; }
public uint Number;
}
}

View File

@@ -1,24 +1,28 @@
namespace SabreTools.Models.BFPK
using System.Runtime.InteropServices;
namespace SabreTools.Models.BFPK
{
/// <summary>
/// Header
/// </summary>
/// <see cref="https://forum.xentax.com/viewtopic.php?t=5102"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// "BFPK"
/// </summary>
public string? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Magic;
/// <summary>
/// Version
/// </summary>
public int Version { get; set; }
public int Version;
/// <summary>
/// Files
/// </summary>
public int Files { get; set; }
public int Files;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BMP
{
/// <summary>
@@ -5,31 +7,32 @@ namespace SabreTools.Models.BMP
/// and layout of a file that contains a DIB.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapfileheader"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BITMAPFILEHEADER
{
/// <summary>
/// The file type; must be BM.
/// </summary>
public ushort Type { get; set; }
public ushort Type;
/// <summary>
/// The size, in bytes, of the bitmap file.
/// </summary>
public uint Size { get; set; }
public uint Size;
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved1 { get; set; }
public ushort Reserved1;
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved2 { get; set; }
public ushort Reserved2;
/// <summary>
/// The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits.
/// </summary>
public uint OffBits { get; set; }
public uint OffBits;
}
}

View File

@@ -1,9 +1,12 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BMP
{
/// <summary>
/// The BITMAPINFOHEADER structure contains information about the dimensions and
/// color format of a device-independent bitmap (DIB).
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public sealed class BITMAPINFOHEADER
{
/// <summary>
@@ -11,12 +14,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 { get; set; }
public uint Size;
/// <summary>
/// Specifies the width of the bitmap, in pixels.
/// </summary>
public int Width { get; set; }
public int Width;
/// <summary>
/// Specifies the height of the bitmap, in pixels.
@@ -30,19 +33,19 @@ namespace SabreTools.Models.BMP
/// or negative biHeight.
/// - For compressed formats, biHeight must be positive, regardless of image orientation.
/// </summary>
public int Height { get; set; }
public int Height;
/// <summary>
/// Specifies the number of planes for the target device. This value must be set to 1.
/// </summary>
public ushort Planes { get; set; }
public ushort Planes;
/// <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 { get; set; }
public ushort BitCount;
/// <summary>
/// For compressed video and YUV formats, this member is a FOURCC code, specified as a
@@ -59,36 +62,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 { get; set; }
public uint Compression;
/// <summary>
/// Specifies the size, in bytes, of the image. This can be set to 0 for uncompressed
/// RGB bitmaps.
/// </summary>
public uint SizeImage { get; set; }
public uint SizeImage;
/// <summary>
/// Specifies the horizontal resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int XPelsPerMeter { get; set; }
public int XPelsPerMeter;
/// <summary>
/// Specifies the vertical resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int YPelsPerMeter { get; set; }
public int YPelsPerMeter;
/// <summary>
/// Specifies the number of color indices in the color table that are actually used by
/// the bitmap.
/// </summary>
public uint ClrUsed { get; set; }
public uint ClrUsed;
/// <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 { get; set; }
public uint ClrImportant;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Version
/// </summary>
public uint Version { get; set; }
public uint Version;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Lump
{
/// <summary>
/// Offset
/// </summary>
public uint Offset { get; set; }
public uint Offset;
/// <summary>
/// Length
/// </summary>
public uint Length { get; set; }
public uint Length;
}
}

View File

@@ -1,17 +1,22 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.Compression.LZ
{
/// <summary>
/// Format of first 14 byte of LZ compressed file
/// </summary>
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/kernel32/lzexpand.c"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class FileHeaader
{
public string? Magic { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? Magic;
public byte CompressionType { get; set; }
public byte CompressionType;
public char LastChar { get; set; }
[MarshalAs(UnmanagedType.U1)]
public char LastChar;
public uint RealLength { get; set; }
public uint RealLength;
}
}

View File

@@ -1,31 +1,34 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CellAddressTableEntry
{
/// <summary>
/// VOBidn
/// </summary>
public ushort VOBIdentity { get; set; }
public ushort VOBIdentity;
/// <summary>
/// CELLidn
/// </summary>
public byte CellIdentity { get; set; }
public byte CellIdentity;
/// <summary>
/// Reserved
/// </summary>
public byte Reserved { get; set; }
public byte Reserved;
/// <summary>
/// Starting sector within VOB
/// </summary>
public uint StartingSectorWithinVOB { get; set; }
public uint StartingSectorWithinVOB;
/// <summary>
/// Ending sector within VOB
/// </summary>
public uint EndingSectorWithinVOB { get; set; }
public uint EndingSectorWithinVOB;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class LanguageUnitTableEntry
{
/// <summary>
/// ISO639 language code
/// </summary>
public ushort ISO639LanguageCode { get; set; }
public ushort ISO639LanguageCode;
/// <summary>
/// Reserved for language code extension
/// </summary>
public byte Reserved { get; set; }
public byte Reserved;
/// <summary>
/// Menu existence flag [80 = title]
/// </summary>
public byte MenuExistenceFlag { get; set; }
public byte MenuExistenceFlag;
/// <summary>
/// Offset to VMGM_LU, relative to VMGM_PGCI_UT
/// </summary>
public uint LanguageUnitOffset { get; set; }
public uint LanguageUnitOffset;
}
}

View File

@@ -1,21 +1,24 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ParentalManagementMasksTableEntry
{
/// <summary>
/// Country code
/// </summary>
public ushort CountryCode { get; set; }
public ushort CountryCode;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
public ushort Reserved;
/// <summary>
/// Offset to PTL_MAIT
/// </summary>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
public ushort Reserved { get; set; }
/// <summary>
/// End address (last byte of last PGC in this LU)

View File

@@ -1,26 +1,30 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ProgramChainTableEntry
{
/// <summary>
/// PGC category
/// </summary>
public ProgramChainCategory Category { get; set; }
[MarshalAs(UnmanagedType.U1)]
public ProgramChainCategory Category;
/// <summary>
/// Unknown
/// </summary>
public byte Unknown { get; set; }
public byte Unknown;
/// <summary>
/// Parental management mask
/// </summary>
public ushort ParentalManagementMask { get; set; }
public ushort ParentalManagementMask;
/// <summary>
/// Offset to VMGM_PGC, relative to VMGM_LU
/// </summary>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Models.DVD
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
public ushort Reserved { get; set; }
/// <summary>
/// End address (last byte of last entry)

View File

@@ -1,42 +1,46 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo_vmg.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class TitlesTableEntry
{
/// <summary>
/// Title type
/// </summary>
public TitleType TitleType { get; set; }
[MarshalAs(UnmanagedType.U1)]
public TitleType TitleType;
/// <summary>
/// Number of angles
/// </summary>
public byte NumberOfAngles { get; set; }
public byte NumberOfAngles;
/// <summary>
/// Number of chapters (PTTs)
/// </summary>
public ushort NumberOfChapters { get; set; }
public ushort NumberOfChapters;
/// <summary>
/// Parental management mask
/// </summary>
public ushort ParentalManagementMask { get; set; }
public ushort ParentalManagementMask;
/// <summary>
/// Video Title Set number (VTSN)
/// </summary>
public byte VideoTitleSetNumber { get; set; }
public byte VideoTitleSetNumber;
/// <summary>
/// Title number within VTS (VTS_TTN)
/// </summary>
public byte TitleNumberWithinVTS { get; set; }
public byte TitleNumberWithinVTS;
/// <summary>
/// Start sector for VTS, referenced to whole disk
/// (video_ts.ifo starts at sector 00000000)
/// </summary>
public uint VTSStartSector { get; set; }
public uint VTSStartSector;
}
}

View File

@@ -1,22 +1,27 @@
using System.Drawing;
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo.html"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class VideoManagerIFO
{
/// <summary>
/// "DVDVIDEO-VMG"
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public string? Signature;
/// <summary>
/// Last sector of VMG set (last sector of BUP)
/// </summary>
public uint LastVMGSetSector { get; set; }
public uint LastVMGSetSector;
/// <summary>
/// Last sector of IFO
/// </summary>
public uint LastIFOSector { get; set; }
public uint LastIFOSector;
/// <summary>
/// Version number
@@ -24,127 +29,132 @@ namespace SabreTools.Models.DVD
/// - Byte 1, Bits 7-4 - Major version number
/// - Byte 1, Bits 3-0 - Minor version number
/// </summary>
public ushort VersionNumber { get; set; }
public ushort VersionNumber;
/// <summary>
/// VMG category
/// </summary>
/// <remarks>byte1=prohibited region mask</remarks>
public uint VMGCategory { get; set; }
public uint VMGCategory;
/// <summary>
/// Number of volumes
/// </summary>
public ushort NumberOfVolumes { get; set; }
public ushort NumberOfVolumes;
/// <summary>
/// Volume number
/// </summary>
public ushort VolumeNumber { get; set; }
public ushort VolumeNumber;
/// <summary>
/// Side ID
/// </summary>
public byte SideID { get; set; }
public byte SideID;
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets { get; set; }
public ushort NumberOfTitleSets;
/// <summary>
/// Provider ID
/// </summary>
public byte[]? ProviderID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[]? ProviderID;
/// <summary>
/// VMG POS
/// </summary>
public ulong VMGPOS { get; set; }
public ulong VMGPOS;
/// <summary>
/// End byte address of VMGI_MAT
/// </summary>
public uint InformationManagementTableEndByteAddress { get; set; }
public uint InformationManagementTableEndByteAddress;
/// <summary>
/// Start address of FP_PGC (First Play program chain)
/// </summary>
public uint FirstPlayProgramChainStartAddress { get; set; }
public uint FirstPlayProgramChainStartAddress;
/// <summary>
/// Start sector of Menu VOB
/// </summary>
public uint MenuVOBStartSector { get; set; }
public uint MenuVOBStartSector;
/// <summary>
/// Sector pointer to TT_SRPT (table of titles)
/// </summary>
public uint TableOfTitlesSectorPointer { get; set; }
public uint TableOfTitlesSectorPointer;
/// <summary>
/// Sector pointer to VMGM_PGCI_UT (Menu Program Chain table)
/// </summary>
public uint MenuProgramChainTableSectorPointer { get; set; }
public uint MenuProgramChainTableSectorPointer;
/// <summary>
/// Sector pointer to VMG_PTL_MAIT (Parental Management masks)
/// </summary>
public uint ParentalManagementMasksSectorPointer { get; set; }
public uint ParentalManagementMasksSectorPointer;
/// <summary>
/// Sector pointer to VMG_VTS_ATRT (copies of VTS audio/sub-picture attributes)
/// </summary>
public uint AudioSubPictureAttributesSectorPointer { get; set; }
public uint AudioSubPictureAttributesSectorPointer;
/// <summary>
/// Sector pointer to VMG_TXTDT_MG (text data)
/// </summary>
public uint TextDataSectorPointer { get; set; }
public uint TextDataSectorPointer;
/// <summary>
/// Sector pointer to VMGM_C_ADT (menu cell address table)
/// </summary>
public uint MenuCellAddressTableSectorPointer { get; set; }
public uint MenuCellAddressTableSectorPointer;
/// <summary>
/// Sector pointer to VMGM_VOBU_ADMAP (menu VOBU address map)
/// </summary>
public uint MenuVOBUAddressMapSectorPointer { get; set; }
public uint MenuVOBUAddressMapSectorPointer;
/// <summary>
/// Video attributes of VMGM_VOBS
/// </summary>
public byte[]? VideoAttributes { get; set; }
public ushort VideoAttributes;
/// <summary>
/// Number of audio streams in VMGM_VOBS
/// </summary>
public ushort NumberOfAudioStreams { get; set; }
public ushort NumberOfAudioStreams;
/// <summary>
/// Audio attributes of VMGM_VOBS
/// </summary>
public byte[][]? AudioAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public ulong[]? AudioAttributes;
/// <summary>
/// Unknown
/// </summary>
public byte[]? Unknown { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[]? Unknown;
/// <summary>
/// Number of subpicture streams in VMGM_VOBS (0 or 1)
/// </summary>
public ushort NumberOfSubpictureStreams { get; set; }
public ushort NumberOfSubpictureStreams;
/// <summary>
/// Subpicture attributes of VMGM_VOBS
/// </summary>
public byte[]? SubpictureAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? SubpictureAttributes;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 164)]
public byte[]? Reserved;
}
}

View File

@@ -1,22 +1,26 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.DVD
{
/// <see href="https://dvd.sourceforge.net/dvdinfo/ifo.html"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class VideoTitleSetIFO
{
/// <summary>
/// "DVDVIDEO-VTS"
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
public string? Signature;
/// <summary>
/// Last sector of title set (last sector of BUP)
/// </summary>
public uint LastTitleSetSector { get; set; }
public uint LastTitleSetSector;
/// <summary>
/// Last sector of IFO
/// </summary>
public uint LastIFOSector { get; set; }
public uint LastIFOSector;
/// <summary>
/// Version number
@@ -24,137 +28,142 @@ namespace SabreTools.Models.DVD
/// - Byte 1, Bits 7-4 - Major version number
/// - Byte 1, Bits 3-0 - Minor version number
/// </summary>
public ushort VersionNumber { get; set; }
public ushort VersionNumber;
/// <summary>
/// VTS category
/// </summary>
/// <remarks>0=unspecified, 1=Karaoke</remarks>
public uint VMGCategory { get; set; }
public uint VMGCategory;
/// <summary>
/// Number of volumes
/// </summary>
public ushort NumberOfVolumes { get; set; }
public ushort NumberOfVolumes;
/// <summary>
/// Volume number
/// </summary>
public ushort VolumeNumber { get; set; }
public ushort VolumeNumber;
/// <summary>
/// Side ID
/// </summary>
public byte SideID { get; set; }
public byte SideID;
/// <summary>
/// Number of title sets
/// </summary>
public ushort NumberOfTitleSets { get; set; }
public ushort NumberOfTitleSets;
/// <summary>
/// Provider ID
/// </summary>
public byte[]? ProviderID { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[]? ProviderID;
/// <summary>
/// VMG POS
/// </summary>
public ulong VMGPOS { get; set; }
public ulong VMGPOS;
/// <summary>
/// End byte address of VTS_MAT
/// </summary>
public uint InformationManagementTableEndByteAddress { get; set; }
public uint InformationManagementTableEndByteAddress;
/// <summary>
/// Start address of FP_PGC (First Play program chain)
/// </summary>
public uint FirstPlayProgramChainStartAddress { get; set; }
public uint FirstPlayProgramChainStartAddress;
/// <summary>
/// Start sector of Menu VOB
/// </summary>
public uint MenuVOBStartSector { get; set; }
public uint MenuVOBStartSector;
/// <summary>
/// Start sector of Title VOB
/// </summary>
public uint TitleVOBStartSector { get; set; }
public uint TitleVOBStartSector;
/// <summary>
/// Sector pointer to VTS_PTT_SRPT (table of Titles and Chapters)
/// </summary>
public uint TableOfTitlesAndChaptersSectorPointer { get; set; }
public uint TableOfTitlesAndChaptersSectorPointer;
/// <summary>
/// Sector pointer to VTS_PGCI (Title Program Chain table)
/// </summary>
public uint TitleProgramChainTableSectorPointer { get; set; }
public uint TitleProgramChainTableSectorPointer;
/// <summary>
/// Sector pointer to VTSM_PGCI_UT (Menu Program Chain table)
/// </summary>
public uint MenuProgramChainTableSectorPointer { get; set; }
public uint MenuProgramChainTableSectorPointer;
/// <summary>
/// Sector pointer to VTS_TMAPTI (time map)
/// </summary>
public uint TimeMapSectorPointer { get; set; }
public uint TimeMapSectorPointer;
/// <summary>
/// Sector pointer to VTSM_C_ADT (menu cell address table)
/// </summary>
public uint MenuCellAddressTableSectorPointer { get; set; }
public uint MenuCellAddressTableSectorPointer;
/// <summary>
/// Sector pointer to VTSM_VOBU_ADMAP (menu VOBU address map)
/// </summary>
public uint MenuVOBUAddressMapSectorPointer { get; set; }
public uint MenuVOBUAddressMapSectorPointer;
/// <summary>
/// Sector pointer to VTS_C_ADT (title set cell address table)
/// </summary>
public uint TitleSetCellAddressTableSectorPointer { get; set; }
public uint TitleSetCellAddressTableSectorPointer;
/// <summary>
/// Sector pointer to VTS_VOBU_ADMAP (title set VOBU address map)
/// </summary>
public uint TitleSetVOBUAddressMapSectorPointer { get; set; }
public uint TitleSetVOBUAddressMapSectorPointer;
/// <summary>
/// Video attributes of VTSM_VOBS
/// </summary>
public byte[]? VideoAttributes { get; set; }
public ushort VideoAttributes;
/// <summary>
/// Number of audio streams in VTSM_VOBS
/// </summary>
public ushort NumberOfAudioStreams { get; set; }
public ushort NumberOfAudioStreams;
/// <summary>
/// Audio attributes of VTSM_VOBS
/// </summary>
public byte[][]? AudioAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public ulong[]? AudioAttributes;
/// <summary>
/// Unknown
/// </summary>
public byte[]? Unknown { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[]? Unknown;
/// <summary>
/// Number of subpicture streams in VTSM_VOBS (0 or 1)
/// </summary>
public ushort NumberOfSubpictureStreams { get; set; }
public ushort NumberOfSubpictureStreams;
/// <summary>
/// Subpicture attributes of VTSM_VOBS
/// </summary>
public byte[]? SubpictureAttributes { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? SubpictureAttributes;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 164)]
public byte[]? Reserved;
}
}

14
Delphi/Constants.cs Normal file
View File

@@ -0,0 +1,14 @@
/// <remarks>
/// Information sourced from https://stackoverflow.com/questions/18720045/what-are-the-list-of-all-possible-values-for-dvclal
/// </remarks>
namespace SabreTools.Models.Delphi
{
public static class Constants
{
public static readonly byte[] DVCLALStandard = [0x23, 0x78, 0x5D, 0x23, 0xB6, 0xA5, 0xF3, 0x19, 0x43, 0xF3, 0x40, 0x02, 0x26, 0xD1, 0x11, 0xC7];
public static readonly byte[] DVCLALProfessional = [0xA2, 0x8C, 0xDF, 0x98, 0x7B, 0x3C, 0x3A, 0x79, 0x26, 0x71, 0x3F, 0x09, 0x0F, 0x2A, 0x25, 0x17];
public static readonly byte[] DVCLALEnterprise = [0x26, 0x3D, 0x4F, 0x38, 0xC2, 0x82, 0x37, 0xB8, 0xF3, 0x24, 0x42, 0x03, 0x17, 0x9B, 0x3A, 0x83];
}
}

View File

@@ -0,0 +1,14 @@
/// <remarks>
/// Information sourced from https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.PackageInfoTable
/// </remarks>
namespace SabreTools.Models.Delphi
{
public class PackageInfoTable
{
public int UnitCount { get; set; }
public PackageUnitEntry[]? UnitInfo { get; set; }
public PackageTypeInfo? TypeInfo { get; set; }
}
}

19
Delphi/PackageTypeInfo.cs Normal file
View File

@@ -0,0 +1,19 @@
/// <remarks>
/// Information sourced from https://docwiki.embarcadero.com/Libraries/Sydney/en/System.TPackageTypeInfo
/// </remarks>
namespace SabreTools.Models.Delphi
{
public class PackageTypeInfo
{
public int TypeCount { get; set; }
/// <remarks>
/// System-dependent pointer type, assumed to be encoded for x86
/// </remarks>
public uint[]? TypeTable { get; set; }
public int UnitCount { get; set; }
public string[]? UnitNames { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System.Runtime.InteropServices;
/// <remarks>
/// Information sourced from https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.PackageUnitEntry
/// </remarks>
namespace SabreTools.Models.Delphi
{
[StructLayout(LayoutKind.Sequential)]
public class PackageUnitEntry
{
/// <remarks>
/// System-dependent pointer type, assumed to be encoded for x86
/// </remarks>
public uint Init;
/// <remarks>
/// System-dependent pointer type, assumed to be encoded for x86
/// </remarks>
public uint FInit;
}
}

View File

@@ -1,41 +1,44 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntry
{
/// <summary>
/// Flags for the block entry. 0x200F0000 == Not used.
/// </summary>
public uint EntryFlags { get; set; }
public uint EntryFlags;
/// <summary>
/// The offset for the data contained in this block entry in the file.
/// </summary>
public uint FileDataOffset { get; set; }
public uint FileDataOffset;
/// <summary>
/// The length of the data in this block entry.
/// </summary>
public uint FileDataSize { get; set; }
public uint FileDataSize;
/// <summary>
/// The offset to the first data block of this block entry's data.
/// </summary>
public uint FirstDataBlockIndex { get; set; }
public uint FirstDataBlockIndex;
/// <summary>
/// The next block entry in the series. (N/A if == BlockCount.)
/// </summary>
public uint NextBlockEntryIndex { get; set; }
public uint NextBlockEntryIndex;
/// <summary>
/// The previous block entry in the series. (N/A if == BlockCount.)
/// </summary>
public uint PreviousBlockEntryIndex { get; set; }
public uint PreviousBlockEntryIndex;
/// <summary>
/// The offset of the block entry in the directory.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,46 +1,49 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntryHeader
{
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Number of data blocks that point to data.
/// </summary>
public uint BlocksUsed { get; set; }
public uint BlocksUsed;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy4 { get; set; }
public uint Dummy4;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,19 +1,22 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <remarks>
/// Part of version 5 but not version 6.
/// </remarks>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntryMap
{
/// <summary>
/// The previous block entry. (N/A if == BlockCount.)
/// </summary>
public uint PreviousBlockEntryIndex { get; set; }
public uint PreviousBlockEntryIndex;
/// <summary>
/// The next block entry. (N/A if == BlockCount.)
/// </summary>
public uint NextBlockEntryIndex { get; set; }
public uint NextBlockEntryIndex;
}
}

View File

@@ -1,34 +1,37 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <remarks>
/// Part of version 5 but not version 6.
/// </remarks>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntryMapHeader
{
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Index of the first block entry.
/// </summary>
public uint FirstBlockEntryIndex { get; set; }
public uint FirstBlockEntryIndex;
/// <summary>
/// Index of the last block entry.
/// </summary>
public uint LastBlockEntryIndex { get; set; }
public uint LastBlockEntryIndex;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumEntry
{
/// <summary>
/// Checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Size of LPGCFCHECKSUMHEADER & LPGCFCHECKSUMMAPHEADER & in bytes.
/// </summary>
public uint ChecksumSize { get; set; }
public uint ChecksumSize;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapEntry
{
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
/// <summary>
/// Index of first checksum.
/// </summary>
public uint FirstChecksumIndex { get; set; }
public uint FirstChecksumIndex;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapHeader
{
/// <summary>
/// Always 0x14893721
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Number of items.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
}
}

View File

@@ -1,36 +1,39 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DataBlockHeader
{
/// <summary>
/// GCF file version. This field is not part of all file versions.
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Size of each data block in bytes.
/// </summary>
public uint BlockSize { get; set; }
public uint BlockSize;
/// <summary>
/// Offset to first data block.
/// </summary>
public uint FirstBlockOffset { get; set; }
public uint FirstBlockOffset;
/// <summary>
/// Number of data blocks that contain data.
/// </summary>
public uint BlocksUsed { get; set; }
public uint BlocksUsed;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryCopyEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,76 +1,79 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryHeader
{
/// <summary>
/// Always 0x00000004
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Cache ID.
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// GCF file version.
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Number of items in the directory.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of files in the directory.
/// </summary>
public uint FileCount { get; set; }
public uint FileCount;
/// <summary>
/// Always 0x00008000. Data per checksum?
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Size of lpGCFDirectoryEntries & lpGCFDirectoryNames & lpGCFDirectoryInfo1Entries & lpGCFDirectoryInfo2Entries & lpGCFDirectoryCopyEntries & lpGCFDirectoryLocalEntries in bytes.
/// </summary>
public uint DirectorySize { get; set; }
public uint DirectorySize;
/// <summary>
/// Size of the directory names in bytes.
/// </summary>
public uint NameSize { get; set; }
public uint NameSize;
/// <summary>
/// Number of Info1 entires.
/// </summary>
public uint Info1Count { get; set; }
public uint Info1Count;
/// <summary>
/// Number of files to copy.
/// </summary>
public uint CopyCount { get; set; }
public uint CopyCount;
/// <summary>
/// Number of files to keep local.
/// </summary>
public uint LocalCount { get; set; }
public uint LocalCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo1Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo2Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryLocalEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryMapEntry
{
/// <summary>
/// Index of the first data block. (N/A if == BlockCount.)
/// </summary>
public uint FirstBlockIndex { get; set; }
public uint FirstBlockIndex;
}
}

View File

@@ -1,19 +1,22 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <remarks>
/// Added in version 4 or version 5.
/// </remarks>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryMapHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000000
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FragmentationMap
{
/// <summary>
/// The index of the next data block.
/// </summary>
public uint NextDataBlockIndex { get; set; }
public uint NextDataBlockIndex;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FragmentationMapHeader
{
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// The index of the first unused fragmentation map entry.
/// </summary>
public uint FirstUnusedEntry { get; set; }
public uint FirstUnusedEntry;
/// <summary>
/// The block entry terminator; 0 = 0x0000ffff or 1 = 0xffffffff.
/// </summary>
public uint Terminator { get; set; }
public uint Terminator;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,61 +1,64 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.GCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/GCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000001
/// </summary>
public uint MajorVersion { get; set; }
public uint MajorVersion;
/// <summary>
/// GCF version number.
/// </summary>
public uint MinorVersion { get; set; }
public uint MinorVersion;
/// <summary>
/// Cache ID
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// Last version played
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Total size of GCF file in bytes.
/// </summary>
public uint FileSize { get; set; }
public uint FileSize;
/// <summary>
/// Size of each data block in bytes.
/// </summary>
public uint BlockSize { get; set; }
public uint BlockSize;
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
}
}

View File

@@ -0,0 +1,21 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.cpp"/>
public class Archive
{
/// <summary>
/// Archive header information
/// </summary>
public Header? Header { get; set; }
/// <summary>
/// Directories found in the archive
/// </summary>
public Directory[]? Directories { get; set; }
/// <summary>
/// Files found in the archive
/// </summary>
public File[]? Files { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.cpp"/>
[StructLayout(LayoutKind.Sequential)]
public class Directory
{
[MarshalAs(UnmanagedType.BStr)]
public string? Name;
public ushort FileCount;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
public enum Attributes : byte
{
READONLY = 0x01,
HIDDEN = 0x02,
SYSTEM = 0x04,
UNCOMPRESSED = 0x10,
ARCHIVE = 0x20,
}
}

View File

@@ -0,0 +1,37 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
[StructLayout(LayoutKind.Sequential)]
public class File
{
public byte VolumeEnd;
public ushort Index;
public uint UncompressedSize;
public uint CompressedSize;
public uint Offset;
public uint DateTime;
public uint Reserved0;
public ushort ChunkSize;
[MarshalAs(UnmanagedType.U1)]
public Attributes Attrib;
public byte IsSplit;
public byte Reserved1;
public byte VolumeStart;
[MarshalAs(UnmanagedType.AnsiBStr)]
public string? Name;
}
}

View File

@@ -0,0 +1,53 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
[StructLayout(LayoutKind.Sequential)]
public class Header
{
public uint Signature1;
public uint Signature2;
public ushort Reserved0;
public ushort IsMultivolume;
public ushort FileCount;
public uint DateTime;
public uint CompressedSize;
public uint UncompressedSize;
public uint Reserved1;
/// <remarks>
/// Set in first vol only, zero in subsequent vols
/// </remarks>
public byte VolumeTotal;
/// <remarks>
/// [1...n]
/// </remarks>
public byte VolumeNumber;
public byte Reserved2;
public uint SplitBeginAddress;
public uint SplitEndAddress;
public uint TocAddress;
public uint Reserved3;
public ushort DirCount;
public uint Reserved4;
public uint Reserved5;
}
}

View File

@@ -1,31 +1,35 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldCabinet
{
/// <see href="https://github.com/twogood/unshield/blob/main/lib/cabfile.h"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class CommonHeader
{
/// <summary>
/// "ISc("
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Signature;
/// <summary>
/// Encoded version
/// </summary>
public uint Version { get; set; }
public uint Version;
/// <summary>
/// Volume information
/// </summary>
public uint VolumeInfo { get; set; }
public uint VolumeInfo;
/// <summary>
/// Offset to cabinet descriptor
/// </summary>
public uint DescriptorOffset { get; set; }
public uint DescriptorOffset;
/// <summary>
/// Cabinet descriptor size
/// </summary>
public uint DescriptorSize { get; set; }
public uint DescriptorSize;
}
}

View File

@@ -33,7 +33,7 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved0 { get; set; }
public ushort Reserved0 { get; set; }
/// <summary>
/// Reserved offset
@@ -78,6 +78,7 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Reserved
/// </summary>
/// <remarks>32 bytes</remarks>
public byte[]? Reserved1 { get; set; }
/// <summary>
@@ -93,11 +94,13 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Reserved
/// </summary>
/// <remarks>28 bytes</remarks>
public byte[]? Reserved2 { get; set; }
/// <summary>
/// Reserved
/// </summary>
/// <remarks>2 bytes (<= v5), 1 byte (> v5)</remarks>
public byte[]? Reserved3 { get; set; }
/// <summary>

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.InstallShieldCabinet
{
/// <see href="https://github.com/twogood/unshield/blob/main/lib/cabfile.h"/>
@@ -6,116 +8,118 @@ namespace SabreTools.Models.InstallShieldCabinet
/// <summary>
/// Offset to the descriptor strings
/// </summary>
public uint StringsOffset { get; set; }
public uint StringsOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved0 { get; set; }
public uint Reserved0;
/// <summary>
/// Offset to the component list
/// </summary>
public uint ComponentListOffset { get; set; }
public uint ComponentListOffset;
/// <summary>
/// Offset to the file table
/// </summary>
public uint FileTableOffset { get; set; }
public uint FileTableOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved1 { get; set; }
public uint Reserved1;
/// <summary>
/// Size of the file table
/// </summary>
public uint FileTableSize { get; set; }
public uint FileTableSize;
/// <summary>
/// Redundant size of the file table
/// </summary>
public uint FileTableSize2 { get; set; }
public uint FileTableSize2;
/// <summary>
/// Number of directories
/// </summary>
public ushort DirectoryCount { get; set; }
public ushort DirectoryCount;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved2 { get; set; }
public uint Reserved2;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved3 { get; set; }
public ushort Reserved3;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved4 { get; set; }
public uint Reserved4;
/// <summary>
/// Number of files
/// </summary>
public uint FileCount { get; set; }
public uint FileCount;
/// <summary>
/// Redundant offset to the file table
/// </summary>
public uint FileTableOffset2 { get; set; }
public uint FileTableOffset2;
/// <summary>
/// Number of component table infos
/// </summary>
public ushort ComponentTableInfoCount { get; set; }
public ushort ComponentTableInfoCount;
/// <summary>
/// Offset to the component table
/// </summary>
public uint ComponentTableOffset { get; set; }
public uint ComponentTableOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved5 { get; set; }
public uint Reserved5;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved6 { get; set; }
public uint Reserved6;
/// <summary>
/// Offsets to the file groups
/// </summary>
public uint[]? FileGroupOffsets { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 71)]
public uint[]? FileGroupOffsets;
/// <summary>
/// Offsets to the components
/// </summary>
public uint[]? ComponentOffsets { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 71)]
public uint[]? ComponentOffsets;
/// <summary>
/// Offset to the setup types
/// </summary>
public uint SetupTypesOffset { get; set; }
public uint SetupTypesOffset;
/// <summary>
/// Offset to the setup table
/// </summary>
public uint SetupTableOffset { get; set; }
public uint SetupTableOffset;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved7 { get; set; }
public uint Reserved7;
/// <summary>
/// Reserved
/// </summary>
public byte[]? Reserved8 { get; set; }
public uint Reserved8;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Fixup Page Table provides a simple mapping of a logical page number
@@ -15,6 +17,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class FixupPageTableEntry
{
/// <summary>
@@ -28,6 +31,6 @@
/// This field specifies the offset following the last fixup record in the
/// fixup record table. This is the last entry in the fixup page table. (n + 1)
/// </remarks>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The `information block` in the LE header contains the linker version number,
@@ -10,6 +12,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class InformationBlock
{
/// <summary>
@@ -21,7 +24,8 @@
/// The signature word is used by the loader to identify the EXE
/// file as a valid 32-bit Linear Executable Module Format.
/// </remarks>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? Signature;
/// <summary>
/// Byte Ordering.
@@ -29,7 +33,8 @@
/// <remarks>
/// This byte specifies the byte ordering for the linear EXE format.
/// </remarks>
public ByteOrder ByteOrder { get; set; }
[MarshalAs(UnmanagedType.U1)]
public ByteOrder ByteOrder;
/// <summary>
/// Word Ordering.
@@ -37,7 +42,8 @@
/// <remarks>
/// This byte specifies the Word ordering for the linear EXE format.
/// </remarks>
public WordOrder WordOrder { get; set; }
[MarshalAs(UnmanagedType.U1)]
public WordOrder WordOrder;
/// <summary>
/// Linear EXE Format Level.
@@ -49,7 +55,7 @@
/// future EXE file versions so that an appropriate error message may be
/// displayed if an attempt is made to load them.
/// </remarks>
public uint ExecutableFormatLevel { get; set; }
public uint ExecutableFormatLevel;
/// <summary>
/// Module CPU Type.
@@ -57,7 +63,8 @@
/// <remarks>
/// This field specifies the type of CPU required by this module to run.
/// </remarks>
public CPUType CPUType { get; set; }
[MarshalAs(UnmanagedType.U2)]
public CPUType CPUType;
/// <summary>
/// Module OS Type.
@@ -65,7 +72,8 @@
/// <remarks>
/// This field specifies the type of Operating system required to run this module.
/// </remarks>
public OperatingSystem ModuleOS { get; set; }
[MarshalAs(UnmanagedType.U2)]
public OperatingSystem ModuleOS;
/// <summary>
/// Module version
@@ -74,12 +82,13 @@
/// This is useful for differentiating between revisions of dynamic linked modules.
/// This value is specified at link time by the user.
/// </remarks>
public uint ModuleVersion { get; set; }
public uint ModuleVersion;
/// <summary>
/// Module type flags
/// </summary>
public ModuleFlags ModuleTypeFlags { get; set; }
[MarshalAs(UnmanagedType.U4)]
public ModuleFlags ModuleTypeFlags;
/// <summary>
/// Number of pages in module.
@@ -94,7 +103,7 @@
/// EXE module. This is used to determine the size of the page information tables
/// in the linear EXE module.
/// </remarks>
public uint ModuleNumberPages { get; set; }
public uint ModuleNumberPages;
/// <summary>
/// The Object number to which the Entry Address is relative.
@@ -109,7 +118,7 @@
/// is set, then the object to which this field refers must be a 32-bit object (i.e.,
/// the Big/Default bit must be set in the object flags; see below).
/// </remarks>
public uint InitialObjectCS { get; set; }
public uint InitialObjectCS;
/// <summary>
/// Entry Address of module.
@@ -118,7 +127,7 @@
/// The Entry Address is the starting address for program modules and the library
/// initialization and Library termination address for library modules.
/// </remarks>
public uint InitialEIP { get; set; }
public uint InitialEIP;
/// <summary>
/// The Object number to which the ESP is relative.
@@ -128,7 +137,7 @@
/// nonzero value for a program module to be correctly loaded. This field is ignored
/// for a library module.
/// </remarks>
public uint InitialObjectSS { get; set; }
public uint InitialObjectSS;
/// <summary>
/// Starting stack address of module.
@@ -138,7 +147,7 @@
/// value in this field indicates that the stack pointer is to be initialized to the
/// highest address/offset in the object. This field is ignored for a library module.
/// </remarks>
public uint InitialESP { get; set; }
public uint InitialESP;
/// <summary>
/// The size of one page for this system.
@@ -148,7 +157,7 @@
/// For the initial version of this linear EXE format the page size is 4Kbytes.
/// (The 4K page size is specified by a value of 4096 in this field.)
/// </remarks>
public uint MemoryPageSize { get; set; }
public uint MemoryPageSize;
/// <summary>
/// The shift left bits for page offsets.
@@ -162,7 +171,7 @@
/// 512 byte (disk sector) basis. The default value for this field is 12 (decimal),
/// which give a 4096 byte alignment. All other offsets are byte aligned.
/// </remarks>
public uint BytesOnLastPage { get; set; }
public uint BytesOnLastPage;
/// <summary>
/// Total size of the fixup information in bytes.
@@ -174,7 +183,7 @@
/// - Import Module name Table
/// - Import Procedure Name Table
/// </remarks>
public uint FixupSectionSize { get; set; }
public uint FixupSectionSize;
/// <summary>
/// Checksum for fixup information.
@@ -185,7 +194,7 @@
/// not always loaded into main memory with the 'loader section'. If the checksum
/// feature is not implemented, then the linker will set these fields to zero.
/// </remarks>
public uint FixupSectionChecksum { get; set; }
public uint FixupSectionChecksum;
/// <summary>
/// Size of memory resident tables.
@@ -195,7 +204,7 @@
/// for the module, while the module is in use. This total size includes all
/// tables from the Object Table down to and including the Per-Page Checksum Table.
/// </remarks>
public uint LoaderSectionSize { get; set; }
public uint LoaderSectionSize;
/// <summary>
/// Checksum for loader section.
@@ -205,7 +214,7 @@
/// If the checksum feature is not implemented, then the linker will set these fields
/// to zero.
/// </remarks>
public uint LoaderSectionChecksum { get; set; }
public uint LoaderSectionChecksum;
/// <summary>
/// Object Table offset.
@@ -213,7 +222,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ObjectTableOffset { get; set; }
public uint ObjectTableOffset;
/// <summary>
/// Object Table Count.
@@ -221,7 +230,7 @@
/// <remarks>
/// This defines the number of entries in Object Table.
/// </remarks>
public uint ObjectTableCount { get; set; }
public uint ObjectTableCount;
/// <summary>
/// Object Page Table offset
@@ -229,7 +238,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ObjectPageMapOffset { get; set; }
public uint ObjectPageMapOffset;
/// <summary>
/// Object Iterated Pages offset.
@@ -237,7 +246,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ObjectIterateDataMapOffset { get; set; }
public uint ObjectIterateDataMapOffset;
/// <summary>
/// Resource Table offset
@@ -245,12 +254,12 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ResourceTableOffset { get; set; }
public uint ResourceTableOffset;
/// <summary>
/// Number of entries in Resource Table.
/// </summary>
public uint ResourceTableCount { get; set; }
public uint ResourceTableCount;
/// <summary>
/// Resident Name Table offset.
@@ -258,7 +267,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ResidentNamesTableOffset { get; set; }
public uint ResidentNamesTableOffset;
/// <summary>
/// Entry Table offset.
@@ -266,7 +275,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint EntryTableOffset { get; set; }
public uint EntryTableOffset;
/// <summary>
/// Module Format Directives Table offset.
@@ -274,7 +283,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ModuleDirectivesTableOffset { get; set; }
public uint ModuleDirectivesTableOffset;
/// <summary>
/// Number of Module Format Directives in the Table.
@@ -283,7 +292,7 @@
/// This field specifies the number of entries in the
/// Module Format Directives Table.
/// </remarks>
public uint ModuleDirectivesCount { get; set; }
public uint ModuleDirectivesCount;
/// <summary>
/// Fixup Page Table offset.
@@ -291,7 +300,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint FixupPageTableOffset { get; set; }
public uint FixupPageTableOffset;
/// <summary>
/// Fixup Record Table offset.
@@ -299,7 +308,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint FixupRecordTableOffset { get; set; }
public uint FixupRecordTableOffset;
/// <summary>
/// Import Module Name Table offset.
@@ -307,12 +316,12 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ImportedModulesNameTableOffset { get; set; }
public uint ImportedModulesNameTableOffset;
/// <summary>
/// The number of entries in the Import Module Name Table.
/// </summary>
public uint ImportedModulesCount { get; set; }
public uint ImportedModulesCount;
/// <summary>
/// Import Procedure Name Table offset.
@@ -320,7 +329,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint ImportProcedureNameTableOffset { get; set; }
public uint ImportProcedureNameTableOffset;
/// <summary>
/// Per-page Checksum Table offset.
@@ -328,7 +337,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint PerPageChecksumTableOffset { get; set; }
public uint PerPageChecksumTableOffset;
/// <summary>
/// Data Pages Offset.
@@ -336,7 +345,7 @@
/// <remarks>
/// This offset is relative to the beginning of the EXE file.
/// </remarks>
public uint DataPagesOffset { get; set; }
public uint DataPagesOffset;
/// <summary>
/// Number of Preload pages for this module.
@@ -345,7 +354,7 @@
/// Note that OS/2 2.0 does not respect the preload of pages as specified
/// in the executable file for performance reasons.
/// </remarks>
public uint PreloadPageCount { get; set; }
public uint PreloadPageCount;
/// <summary>
/// Non-Resident Name Table offset.
@@ -353,12 +362,12 @@
/// <remarks>
/// This offset is relative to the beginning of the EXE file.
/// </remarks>
public uint NonResidentNamesTableOffset { get; set; }
public uint NonResidentNamesTableOffset;
/// <summary>
/// Number of bytes in the Non-resident name table.
/// </summary>
public uint NonResidentNamesTableLength { get; set; }
public uint NonResidentNamesTableLength;
/// <summary>
/// Non-Resident Name Table Checksum.
@@ -366,7 +375,7 @@
/// <remarks>
/// This is a cryptographic checksum of the Non-Resident Name Table.
/// </remarks>
public uint NonResidentNamesTableChecksum { get; set; }
public uint NonResidentNamesTableChecksum;
/// <summary>
/// The Auto Data Segment Object number.
@@ -376,7 +385,7 @@
/// This field is supported for 16-bit compatibility only and is not used by
/// 32-bit modules.
/// </remarks>
public uint AutomaticDataObject { get; set; }
public uint AutomaticDataObject;
/// <summary>
/// Debug Information offset.
@@ -384,7 +393,7 @@
/// <remarks>
/// This offset is relative to the beginning of the linear EXE header.
/// </remarks>
public uint DebugInformationOffset { get; set; }
public uint DebugInformationOffset;
/// <summary>
/// Debug Information length.
@@ -392,7 +401,7 @@
/// <remarks>
/// The length of the debug information in bytes.
/// </remarks>
public uint DebugInformationLength { get; set; }
public uint DebugInformationLength;
/// <summary>
/// Instance pages in preload section.
@@ -400,7 +409,7 @@
/// <remarks>
/// The number of instance data pages found in the preload section.
/// </remarks>
public uint PreloadInstancePagesNumber { get; set; }
public uint PreloadInstancePagesNumber;
/// <summary>
/// Instance pages in demand section.
@@ -408,7 +417,7 @@
/// <remarks>
/// The number of instance data pages found in the demand section.
/// </remarks>
public uint DemandInstancePagesNumber { get; set; }
public uint DemandInstancePagesNumber;
/// <summary>
/// Heap size added to the Auto DS Object.
@@ -418,6 +427,6 @@
/// by the loader. This field is supported for 16-bit compatibility only and
/// is not used by 32-bit modules.
/// </remarks>
public uint ExtraHeapAllocation { get; set; }
public uint ExtraHeapAllocation;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Module Format Directives Table is an optional table that allows additional
@@ -13,6 +15,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ModuleFormatDirectivesTableEntry
{
/// <summary>
@@ -22,7 +25,8 @@
/// The directive number specifies the type of directive defined. This can be
/// used to determine the format of the information in the directive data.
/// </remarks>
public DirectiveNumber DirectiveNumber { get; set; }
[MarshalAs(UnmanagedType.U2)]
public DirectiveNumber DirectiveNumber;
/// <summary>
/// Directive data length.
@@ -30,7 +34,7 @@
/// <remarks>
/// This specifies the length in byte of the directive data for this directive number.
/// </remarks>
public ushort DirectiveDataLength { get; set; }
public ushort DirectiveDataLength;
/// <summary>
/// Directive data offset.
@@ -40,6 +44,6 @@
/// to beginning of linear EXE header for a resident table, and relative to the
/// beginning of the EXE file for non-resident tables.
/// </remarks>
public uint DirectiveDataOffset { get; set; }
public uint DirectiveDataOffset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Object page table provides information about a logical page in an object.
@@ -13,6 +15,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ObjectPageMapEntry
{
/// <summary>
@@ -35,7 +38,7 @@
/// The logical page number (Object Page Table index), is used to index the Fixup
/// Page Table to find any fixups associated with the logical page.
/// </remarks>
public uint PageDataOffset { get; set; }
public uint PageDataOffset;
/// <summary>
/// Number of bytes of data for this page.
@@ -47,11 +50,12 @@
/// bytes are to be filled with zeros. If the FLAGS field indicates an Iterated Data
/// Page, the iterated data records will completely fill out the remainder.
/// </remarks>
public ushort DataSize { get; set; }
public ushort DataSize;
/// <summary>
/// Attributes specifying characteristics of this logical page.
/// </summary>
public ObjectPageFlags Flags { get; set; }
[MarshalAs(UnmanagedType.U2)]
public ObjectPageFlags Flags;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The object table contains information that describes each segment in
@@ -12,6 +14,7 @@
/// </remarks>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ObjectTableEntry
{
/// <summary>
@@ -24,7 +27,7 @@
/// file for the object. This memory size must also be large enough to
/// contain all of the iterated data and uninitialized data in the EXE file.
/// </remarks>
public uint VirtualSegmentSize { get; set; }
public uint VirtualSegmentSize;
/// <summary>
/// Relocation Base Address.
@@ -34,12 +37,13 @@
/// internal relocation fixups for the module have been removed, this is the
/// address the object will be allocated at by the loader.
/// </remarks>
public uint RelocationBaseAddress { get; set; }
public uint RelocationBaseAddress;
/// <summary>
/// Flag bits for the object.
/// </summary>
public ObjectFlags ObjectFlags { get; set; }
[MarshalAs(UnmanagedType.U2)]
public ObjectFlags ObjectFlags;
/// <summary>
/// Object Page Table Index.
@@ -53,7 +57,7 @@
/// other words the object table entries are sorted based on the object page table
/// index value.
/// </remarks>
public uint PageTableIndex { get; set; }
public uint PageTableIndex;
/// <summary>
/// # of object page table entries for this object.
@@ -69,11 +73,11 @@
/// was neither a zero filled or invalid page, then the additional pages are treated
/// as zero filled pages.
/// </remarks>
public uint PageTableEntries { get; set; }
public uint PageTableEntries;
/// <summary>
/// Reserved for future use. Must be set to zero.
/// </summary>
public uint Reserved { get; set; }
public uint Reserved;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Per-Page Checksum table provides space for a cryptographic checksum for
@@ -11,11 +13,12 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class PerPageChecksumTableEntry
{
/// <summary>
/// Cryptographic checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The resource table is an array of resource table entries. Each resource table
@@ -13,31 +15,33 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceTableEntry
{
/// <summary>
/// Resource type ID.
/// </summary>
public ResourceTableEntryType TypeID { get; set; }
[MarshalAs(UnmanagedType.U4)]
public ResourceTableEntryType TypeID;
/// <summary>
/// An ID used as a name for the resource when referred to.
/// </summary>
public ushort NameID { get; set; }
public ushort NameID;
/// <summary>
/// The number of bytes the resource consists of.
/// </summary>
public uint ResourceSize { get; set; }
public uint ResourceSize;
/// <summary>
/// The number of the object which contains the resource.
/// </summary>
public ushort ObjectNumber { get; set; }
public ushort ObjectNumber;
/// <summary>
/// The offset within the specified object where the resource begins.
/// </summary>
public uint Offset { get; set; }
public uint Offset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.LinearExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.LinearExecutable
{
/// <summary>
/// The Verify Record Directive Table is an optional table. It maintains a record
@@ -9,6 +11,7 @@
/// </summary>
/// <see href="https://faydoc.tripod.com/formats/exe-LE.htm"/>
/// <see href="http://www.edm2.com/index.php/LX_-_Linear_eXecutable_Module_Format_Description"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class VerifyRecordDirectiveTableEntry
{
/// <summary>
@@ -19,7 +22,7 @@
/// directive table. This is equal to the number of modules referenced by
/// this module.
/// </remarks>
public ushort EntryCount { get; set; }
public ushort EntryCount;
/// <summary>
/// Ordinal index into the Import Module Name Table.
@@ -28,7 +31,7 @@
/// This value is an ordered index in to the Import Module Name Table for
/// the referenced module.
/// </remarks>
public ushort OrdinalIndex { get; set; }
public ushort OrdinalIndex;
/// <summary>
/// Module Version.
@@ -41,7 +44,7 @@
/// number in a module to be incremented anytime the entry point offsets
/// change.
/// </remarks>
public ushort Version { get; set; }
public ushort Version;
/// <summary>
/// Module # of Object Entries.
@@ -50,7 +53,7 @@
/// This field is used to identify the number of object verify entries
/// that follow for the referenced module.
/// </remarks>
public ushort ObjectEntriesCount { get; set; }
public ushort ObjectEntriesCount;
/// <summary>
/// Object # in Module.
@@ -59,7 +62,7 @@
/// This field specifies the object number in the referenced module that
/// is being verified.
/// </remarks>
public ushort ObjectNumberInModule { get; set; }
public ushort ObjectNumberInModule;
/// <summary>
/// Object load base address.
@@ -68,7 +71,7 @@
/// This is the address that the object was loaded at when the fixups were
/// performed.
/// </remarks>
public ushort ObjectLoadBaseAddress { get; set; }
public ushort ObjectLoadBaseAddress;
/// <summary>
/// Object virtual address size.
@@ -77,6 +80,6 @@
/// This field specifies the total amount of virtual memory required for
/// this object.
/// </remarks>
public ushort ObjectVirtualAddressSize { get; set; }
public ushort ObjectVirtualAddressSize;
}
}

View File

@@ -1,19 +1,22 @@
namespace SabreTools.Models.MSDOS
using System.Runtime.InteropServices;
namespace SabreTools.Models.MSDOS
{
/// <summary>
/// Each pointer in the relocation table looks as such
/// </summary>
/// <see href="https://wiki.osdev.org/MZ"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class RelocationEntry
{
/// <summary>
/// Offset of the relocation within provided segment.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// Segment of the relocation, relative to the load segment address.
/// </summary>
public ushort Segment { get; set; }
public ushort Segment;
}
}

View File

@@ -126,11 +126,11 @@ namespace SabreTools.Models.Metadata
string? asString = Read<string>(key);
if (asString != null)
return new string[] { asString };
return [asString];
asString = this[key]!.ToString();
if (asString != null)
return new string[] { asString };
return [asString];
return null;
}
@@ -140,7 +140,7 @@ namespace SabreTools.Models.Metadata
/// </summary>
private bool ValidateKey(string key)
{
if (string.IsNullOrWhiteSpace(key))
if (string.IsNullOrEmpty(key))
return false;
else if (!ContainsKey(key))
return false;

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.MoPaQ
using System.Runtime.InteropServices;
namespace SabreTools.Models.MoPaQ
{
/// <summary>
/// Block table contains informations about file sizes and way of their storage within
@@ -6,26 +8,28 @@
/// of block table entry is (like hash table entry). The block table is also encrypted.
/// </summary>
/// <see href="http://zezula.net/en/mpq/mpqformat.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BlockEntry
{
/// <summary>
/// Offset of the beginning of the file data, relative to the beginning of the archive.
/// </summary>
public uint FilePosition { get; set; }
public uint FilePosition;
/// <summary>
/// Compressed file size
/// </summary>
public uint CompressedSize { get; set; }
public uint CompressedSize;
/// <summary>
/// Size of uncompressed file
/// </summary>
public uint UncompressedSize { get; set; }
public uint UncompressedSize;
/// <summary>
/// Flags for the file.
/// </summary>
public FileFlags Flags { get; set; }
[MarshalAs(UnmanagedType.U4)]
public FileFlags Flags;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.MoPaQ
using System.Runtime.InteropServices;
namespace SabreTools.Models.MoPaQ
{
/// <summary>
/// Hash table is used for searching files by name. The file name is converted to
@@ -8,29 +10,31 @@
/// table is 16 bytes.
/// </summary>
/// <see href="http://zezula.net/en/mpq/mpqformat.html"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class HashEntry
{
/// <summary>
/// The hash of the full file name (part A)
/// </summary>
public uint NameHashPartA { get; set; }
public uint NameHashPartA;
/// <summary>
/// The hash of the full file name (part B)
/// </summary>
public uint NameHashPartB { get; set; }
public uint NameHashPartB;
/// <summary>
/// The language of the file. This is a Windows LANGID data type, and uses the same values.
/// 0 indicates the default language (American English), or that the file is language-neutral.
/// </summary>
public Locale Locale { get; set; }
[MarshalAs(UnmanagedType.I2)]
public Locale Locale;
/// <summary>
/// The platform the file is used for. 0 indicates the default platform.
/// No other values have been observed.
/// </summary>
public ushort Platform { get; set; }
public ushort Platform;
/// <summary>
/// If the hash table entry is valid, this is the index into the block table of the file.
@@ -40,6 +44,6 @@
/// - FFFFFFFEh: Hash table entry is empty, but was valid at some point (a deleted file).
/// Does not terminate searches for a given file.
/// </summary>
public uint BlockIndex { get; set; }
public uint BlockIndex;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumEntry
{
/// <summary>
/// Checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Size of LPNCFCHECKSUMHEADER & LPNCFCHECKSUMMAPHEADER & in bytes.
/// </summary>
public uint ChecksumSize { get; set; }
public uint ChecksumSize;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapEntry
{
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
/// <summary>
/// Index of first checksum.
/// </summary>
public uint FirstChecksumIndex { get; set; }
public uint FirstChecksumIndex;
}
}

View File

@@ -1,26 +1,29 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ChecksumMapHeader
{
/// <summary>
/// Always 0x14893721
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Number of items.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of checksums.
/// </summary>
public uint ChecksumCount { get; set; }
public uint ChecksumCount;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryCopyEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,76 +1,79 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryHeader
{
/// <summary>
/// Always 0x00000004
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Cache ID.
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// NCF file version.
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Number of items in the directory.
/// </summary>
public uint ItemCount { get; set; }
public uint ItemCount;
/// <summary>
/// Number of files in the directory.
/// </summary>
public uint FileCount { get; set; }
public uint FileCount;
/// <summary>
/// Always 0x00008000. Data per checksum?
/// </summary>
public uint ChecksumDataLength { get; set; }
public uint ChecksumDataLength;
/// <summary>
/// Size of lpNCFDirectoryEntries & lpNCFDirectoryNames & lpNCFDirectoryInfo1Entries & lpNCFDirectoryInfo2Entries & lpNCFDirectoryCopyEntries & lpNCFDirectoryLocalEntries in bytes.
/// </summary>
public uint DirectorySize { get; set; }
public uint DirectorySize;
/// <summary>
/// Size of the directory names in bytes.
/// </summary>
public uint NameSize { get; set; }
public uint NameSize;
/// <summary>
/// Number of Info1 entires.
/// </summary>
public uint Info1Count { get; set; }
public uint Info1Count;
/// <summary>
/// Number of files to copy.
/// </summary>
public uint CopyCount { get; set; }
public uint CopyCount;
/// <summary>
/// Number of files to keep local.
/// </summary>
public uint LocalCount { get; set; }
public uint LocalCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Header checksum.
/// </summary>
public uint Checksum { get; set; }
public uint Checksum;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo1Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryInfo2Entry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DirectoryLocalEntry
{
/// <summary>
/// Index of the directory item.
/// </summary>
public uint DirectoryIndex { get; set; }
public uint DirectoryIndex;
}
}

View File

@@ -1,61 +1,64 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000002
/// </summary>
public uint MajorVersion { get; set; }
public uint MajorVersion;
/// <summary>
/// NCF version number.
/// </summary>
public uint MinorVersion { get; set; }
public uint MinorVersion;
/// <summary>
/// Cache ID
/// </summary>
public uint CacheID { get; set; }
public uint CacheID;
/// <summary>
/// Last version played
/// </summary>
public uint LastVersionPlayed { get; set; }
public uint LastVersionPlayed;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy2 { get; set; }
public uint Dummy2;
/// <summary>
/// Total size of NCF file in bytes.
/// </summary>
public uint FileSize { get; set; }
public uint FileSize;
/// <summary>
/// Size of each data block in bytes.
/// </summary>
public uint BlockSize { get; set; }
public uint BlockSize;
/// <summary>
/// Number of data blocks.
/// </summary>
public uint BlockCount { get; set; }
public uint BlockCount;
/// <summary>
/// Reserved
/// </summary>
public uint Dummy3 { get; set; }
public uint Dummy3;
}
}

View File

@@ -1,11 +1,14 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class UnknownEntry
{
/// <summary>
/// Reserved
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
}
}

View File

@@ -1,16 +1,19 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NCF
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/NCFFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class UnknownHeader
{
/// <summary>
/// Always 0x00000001
/// </summary>
public uint Dummy0 { get; set; }
public uint Dummy0;
/// <summary>
/// Always 0x00000000
/// </summary>
public uint Dummy1 { get; set; }
public uint Dummy1;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
@@ -6,6 +8,7 @@ namespace SabreTools.Models.NewExecutable
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://github.com/libyal/libexe/blob/main/documentation/Executable%20(EXE)%20file%20format.asciidoc#24-ne-extended-header"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class ExecutableHeader
{
/// <summary>
@@ -13,38 +16,40 @@ namespace SabreTools.Models.NewExecutable
/// "N" is low-order byte.
/// "E" is high-order byte.
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? Magic;
/// <summary>
/// Version number of the linker.
/// </summary>
public byte LinkerVersion { get; set; }
public byte LinkerVersion;
/// <summary>
/// Revision number of the linker.
/// </summary>
public byte LinkerRevision { get; set; }
public byte LinkerRevision;
/// <summary>
/// Entry Table file offset, relative to the beginning of the segmented EXE header.
/// </summary>
public ushort EntryTableOffset { get; set; }
public ushort EntryTableOffset;
/// <summary>
/// Number of bytes in the entry table.
/// </summary>
public ushort EntryTableSize { get; set; }
public ushort EntryTableSize;
/// <summary>
/// 32-bit CRC of entire contents of file.
/// </summary>
/// <remarks>These words are taken as 00 during the calculation.</remarks>
public uint CrcChecksum { get; set; }
public uint CrcChecksum;
/// <summary>
/// Flag word
/// </summary>
public HeaderFlag FlagWord { get; set; }
[MarshalAs(UnmanagedType.U2)]
public HeaderFlag FlagWord;
/// <summary>
/// Segment number of automatic data segment.
@@ -57,26 +62,26 @@ namespace SabreTools.Models.NewExecutable
/// table. The first entry in the segment table is segment
/// number 1.
/// </remarks>
public ushort AutomaticDataSegmentNumber { get; set; }
public ushort AutomaticDataSegmentNumber;
/// <summary>
/// Initial size, in bytes, of dynamic heap added to the
/// data segment. This value is zero if no initial local
/// heap is allocated.
/// </summary>
public ushort InitialHeapAlloc { get; set; }
public ushort InitialHeapAlloc;
/// <summary>
/// Initial size, in bytes, of stack added to the data
/// segment. This value is zero to indicate no initial
/// stack allocation, or when SS is not equal to DS.
/// </summary>
public ushort InitialStackAlloc { get; set; }
public ushort InitialStackAlloc;
/// <summary>
/// Segment number:offset of CS:IP.
/// </summary>
public uint InitialCSIPSetting { get; set; }
public uint InitialCSIPSetting;
/// <summary>
/// Segment number:offset of SS:SP.
@@ -87,108 +92,110 @@ namespace SabreTools.Models.NewExecutable
/// automatic data segment just below the additional heap
/// area.
/// </remarks>
public uint InitialSSSPSetting { get; set; }
public uint InitialSSSPSetting;
/// <summary>
/// Number of entries in the Segment Table.
/// </summary>
public ushort FileSegmentCount { get; set; }
public ushort FileSegmentCount;
/// <summary>
/// Number of entries in the Module Reference Table.
/// </summary>
public ushort ModuleReferenceTableSize { get; set; }
public ushort ModuleReferenceTableSize;
/// <summary>
/// Number of bytes in the Non-Resident Name Table.
/// </summary>
public ushort NonResidentNameTableSize { get; set; }
public ushort NonResidentNameTableSize;
/// <summary>
/// Segment Table file offset, relative to the beginning
/// of the segmented EXE header.
/// </summary>
public ushort SegmentTableOffset { get; set; }
public ushort SegmentTableOffset;
/// <summary>
/// Resource Table file offset, relative to the beginning
/// of the segmented EXE header.
/// </summary>
public ushort ResourceTableOffset { get; set; }
public ushort ResourceTableOffset;
/// <summary>
/// Resident Name Table file offset, relative to the
/// beginning of the segmented EXE header.
/// </summary>
public ushort ResidentNameTableOffset { get; set; }
public ushort ResidentNameTableOffset;
/// <summary>
/// Module Reference Table file offset, relative to the
/// beginning of the segmented EXE header.
/// </summary>
public ushort ModuleReferenceTableOffset { get; set; }
public ushort ModuleReferenceTableOffset;
/// <summary>
/// Imported Names Table file offset, relative to the
/// beginning of the segmented EXE header.
/// </summary>
public ushort ImportedNamesTableOffset { get; set; }
public ushort ImportedNamesTableOffset;
/// <summary>
/// Non-Resident Name Table offset, relative to the
/// beginning of the file.
/// </summary>
public uint NonResidentNamesTableOffset { get; set; }
public uint NonResidentNamesTableOffset;
/// <summary>
/// Number of movable entries in the Entry Table.
/// </summary>
public ushort MovableEntriesCount { get; set; }
public ushort MovableEntriesCount;
/// <summary>
/// Logical sector alignment shift count, log(base 2) of
/// the segment sector size (default 9).
/// </summary>
public ushort SegmentAlignmentShiftCount { get; set; }
public ushort SegmentAlignmentShiftCount;
/// <summary>
/// Number of resource entries.
/// </summary>
public ushort ResourceEntriesCount { get; set; }
public ushort ResourceEntriesCount;
/// <summary>
/// Executable type, used by loader.
/// </summary>
public OperatingSystem TargetOperatingSystem { get; set; }
[MarshalAs(UnmanagedType.U1)]
public OperatingSystem TargetOperatingSystem;
/// <summary>
/// Other OS/2 flags
/// </summary>
public OS2Flag AdditionalFlags { get; set; }
[MarshalAs(UnmanagedType.U1)]
public OS2Flag AdditionalFlags;
/// <summary>
/// Offset to return thunks or start of gangload area
/// </summary>
public ushort ReturnThunkOffset { get; set; }
public ushort ReturnThunkOffset;
/// <summary>
/// Offset to segment reference thunks or size of gangload area
/// </summary>
public ushort SegmentReferenceThunkOffset { get; set; }
public ushort SegmentReferenceThunkOffset;
/// <summary>
/// Minimum code swap area size
/// </summary>
public ushort MinCodeSwapAreaSize { get; set; }
public ushort MinCodeSwapAreaSize;
/// <summary>
/// Windows SDK revison number
/// </summary>
public byte WindowsSDKRevision { get; set; }
public byte WindowsSDKRevision;
/// <summary>
/// Windows SDK version number
/// </summary>
public byte WindowsSDKVersion { get; set; }
public byte WindowsSDKVersion;
}
}

View File

@@ -1,16 +1,19 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportNameRelocationRecord
{
/// <summary>
/// Index into module reference table for the imported module.
/// </summary>
public ushort Index { get; set; }
public ushort Index;
/// <summary>
/// Offset within Imported Names Table to procedure name string.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
}
}

View File

@@ -1,16 +1,19 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportOrdinalRelocationRecord
{
/// <summary>
/// Index into module reference table for the imported module.
/// </summary>
public ushort Index { get; set; }
public ushort Index;
/// <summary>
/// Procedure ordinal number.
/// </summary>
public ushort Ordinal { get; set; }
public ushort Ordinal;
}
}

View File

@@ -1,23 +1,26 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class InternalRefRelocationRecord
{
/// <summary>
/// Segment number for a fixed segment, or 0FFh for a
/// movable segment.
/// </summary>
public byte SegmentNumber { get; set; }
public byte SegmentNumber;
/// <summary>
/// 0
/// </summary>
public byte Reserved { get; set; }
public byte Reserved;
/// <summary>
/// Offset into segment if fixed segment, or ordinal
/// number index into Entry Table if movable segment.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
/// The module-reference table follows the resident-name table. Each entry
@@ -6,11 +8,12 @@
/// names table; each entry is 2 bytes long.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ModuleReferenceTableEntry
{
/// <summary>
/// Offset within Imported Names Table to referenced module name string.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
}
}

View File

@@ -1,17 +1,21 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class OSFixupRelocationRecord
{
/// <summary>
/// Operating system fixup type.
/// Floating-point fixups.
/// </summary>
public OSFixupType FixupType { get; set; }
[MarshalAs(UnmanagedType.U2)]
public OSFixupType FixupType;
/// <summary>
/// 0
/// </summary>
public ushort Reserved { get; set; }
public ushort Reserved;
}
}

View File

@@ -1,10 +1,13 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
/// A table of resources for this type follows. The following is
/// the format of each resource (8 bytes each):
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceTypeResourceEntry
{
/// <summary>
@@ -13,17 +16,18 @@
/// of the alignment shift count value specified at
/// beginning of the resource table.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// Length of the resource in the file (in bytes).
/// </summary>
public ushort Length { get; set; }
public ushort Length;
/// <summary>
/// Flag word.
/// </summary>
public ResourceTypeResourceFlag FlagWord { get; set; }
[MarshalAs(UnmanagedType.U2)]
public ResourceTypeResourceFlag FlagWord;
/// <summary>
/// Resource ID. This is an integer type if the high-order
@@ -31,11 +35,11 @@
/// resource string, the offset is relative to the
/// beginning of the resource table.
/// </summary>
public ushort ResourceID { get; set; }
public ushort ResourceID;
/// <summary>
/// Reserved.
/// </summary>
public uint Reserved { get; set; }
public uint Reserved;
}
}

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Models.NewExecutable
using System.Runtime.InteropServices;
namespace SabreTools.Models.NewExecutable
{
/// <summary>
/// The segment table contains an entry for each segment in the executable
@@ -7,6 +9,7 @@
/// The following is the structure of a segment table entry.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SegmentTableEntry
{
/// <summary>
@@ -14,22 +17,23 @@
/// data, relative to the beginning of the file. Zero means no
/// file data.
/// </summary>
public ushort Offset { get; set; }
public ushort Offset;
/// <summary>
/// Length of the segment in the file, in bytes. Zero means 64K.
/// </summary>
public ushort Length { get; set; }
public ushort Length;
/// <summary>
/// Flag word.
/// </summary>
public SegmentTableEntryFlag FlagWord { get; set; }
[MarshalAs(UnmanagedType.U2)]
public SegmentTableEntryFlag FlagWord;
/// <summary>
/// Minimum allocation size of the segment, in bytes. Total size
/// of the segment. Zero means 64K.
/// </summary>
public ushort MinimumAllocationSize { get; set; }
public ushort MinimumAllocationSize;
}
}

View File

@@ -27,6 +27,9 @@ namespace SabreTools.Models.OfflineList
[XmlElement("releaseNumber")]
public ReleaseNumber? ReleaseNumber { get; set; }
[XmlElement("imageNumber")]
public ImageNumber? ImageNumber { get; set; }
[XmlElement("languageNumber")]
public LanguageNumber? LanguageNumber { get; set; }

View File

@@ -1,21 +1,25 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PAK
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/PAKFile.h"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class DirectoryItem
{
/// <summary>
/// Item Name
/// </summary>
public string? ItemName { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 56)]
public string? ItemName;
/// <summary>
/// Item Offset
/// </summary>
public uint ItemOffset { get; set; }
public uint ItemOffset;
/// <summary>
/// Item Length
/// </summary>
public uint ItemLength { get; set; }
public uint ItemLength;
}
}

View File

@@ -1,21 +1,25 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PAK
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/PAKFile.h"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// Signature
/// </summary>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Signature;
/// <summary>
/// Directory Offset
/// </summary>
public uint DirectoryOffset { get; set; }
public uint DirectoryOffset;
/// <summary>
/// Directory Length
/// </summary>
public uint DirectoryLength { get; set; }
public uint DirectoryLength;
}
}

View File

@@ -1,24 +1,28 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PFF
{
/// <summary>
/// PFF file footer
/// </summary>
/// <see href="https://devilsclaws.net/download/file-pff-new-bz2"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Footer
{
/// <summary>
/// Current system IP
/// </summary>
public uint SystemIP { get; set; }
public uint SystemIP;
/// <summary>
/// Reserved
/// </summary>
public uint Reserved { get; set; }
public uint Reserved;
/// <summary>
/// King tag
/// </summary>
public string? KingTag { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? KingTag;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PFF
{
/// <summary>
@@ -5,32 +7,34 @@ namespace SabreTools.Models.PFF
/// </summary>
/// <remarks>Versions 2, 3, and 4 supported</remarks>
/// <see href="https://devilsclaws.net/download/file-pff-new-bz2"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// Size of the following header
/// </summary>
public uint HeaderSize { get; set; }
public uint HeaderSize;
/// <summary>
/// Signature
/// </summary>
/// <remarks>Versions 2 and 3 share the same signature but different header sizes</remarks>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Signature;
/// <summary>
/// Number of files
/// </summary>
public uint NumberOfFiles { get; set; }
public uint NumberOfFiles;
/// <summary>
/// File segment size
/// </summary>
public uint FileSegmentSize { get; set; }
public uint FileSegmentSize;
/// <summary>
/// File list offset
/// </summary>
public uint FileListOffset { get; set; }
public uint FileListOffset;
}
}

View File

@@ -7,10 +7,6 @@ namespace SabreTools.Models.PIC
{
/// <summary>
/// Disc Type Identifier
/// = "BDO" for BD-ROM
/// = "BDU" for BD-ROM Ultra
/// = "BDW" for BD-RE
/// = "BDR" for BD-R
/// </summary>
public string? DiscTypeIdentifier { get; set; }

View File

@@ -1,43 +1,47 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class DiscInformationUnitHeader
{
/// <summary>
/// Disc Information Identifier "DI"
/// Emergency Brake Identifier "EB"
/// </summary>
public string? DiscInformationIdentifier { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? DiscInformationIdentifier;
/// <summary>
/// Disc Information Format
/// </summary>
public byte DiscInformationFormat { get; set; }
public byte DiscInformationFormat;
/// <summary>
/// Number of DI units in each DI block
/// </summary>
public byte NumberOfUnitsInBlock { get; set; }
public byte NumberOfUnitsInBlock;
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved0 { get; set; }
public byte Reserved0;
/// <summary>
/// DI unit Sequence Number
/// </summary>
public byte SequenceNumber { get; set; }
public byte SequenceNumber;
/// <summary>
/// Number of bytes in use in this DI unit
/// </summary>
public byte BytesInUse { get; set; }
public byte BytesInUse;
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved1 { get; set; }
public byte Reserved1;
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PIC
{
/// <summary>
@@ -5,28 +7,31 @@ namespace SabreTools.Models.PIC
/// </summary>
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
[StructLayout(LayoutKind.Sequential)]
public class DiscInformationUnitTrailer
{
/// <summary>
/// Disc Manufacturer ID
/// </summary>
/// <remarks>6 bytes</remarks>
public byte[]? DiscManufacturerID { get; set; } = new byte[6];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? DiscManufacturerID;
/// <summary>
/// Media Type ID
/// </summary>
/// <remarks>3 bytes</remarks>
public byte[]? MediaTypeID { get; set; } = new byte[3];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[]? MediaTypeID;
/// <summary>
/// Time Stamp
/// </summary>
public ushort TimeStamp { get; set; }
public ushort TimeStamp;
/// <summary>
/// Product Revision Number
/// </summary>
public byte ProductRevisionNumber { get; set; }
public byte ProductRevisionNumber;
}
}

72
PKZIP/Archive.cs Normal file
View File

@@ -0,0 +1,72 @@
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Represents a single ZIP/ZIP64 archive
/// </summary>
/// <remarks>PKZIP archives are meant to be read from the end</remarks>
public class Archive
{
#region Entries, Interleaved
/// <summary>
/// Local file headers, always appear first in each group
/// </summary>
public LocalFileHeader[]? LocalFileHeaders { get; set; }
/// <summary>
/// Encryption headers, may appear second in each group
/// </summary>
/// TODO: Determine the model for the encryption headers
public byte[]?[]? EncryptionHeaders { get; set; }
/// <summary>
/// File data, appears after the encryption header
/// if it exists or after the local file header otherwise
/// </summary>
public byte[][]? FileData { get; set; }
/// <summary>
/// Data descriptors, appears after the file data
/// </summary>
public DataDescriptor?[]? DataDescriptors { get; set; }
/// <summary>
/// ZIP64 Data descriptors, appears after the file data
/// </summary>
public DataDescriptor64?[]? ZIP64DataDescriptors { get; set; }
#endregion
/// <summary>
/// Optional archive decryption header, appears after all entries
/// </summary>
/// TODO: Determine the model
public byte[]? ArchiveDecryptionHeader { get; set; }
/// <summary>
/// Optional archive extra data record, appears after either
/// the archive decryption header or after all entries
/// </summary>
public ArchiveExtraDataRecord? ArchiveExtraDataRecord { get; set; }
/// <summary>
/// Central directory headers in sequential order
/// </summary>
public CentralDirectoryFileHeader[]? CentralDirectoryHeaders { get; set; }
/// <summary>
/// Optional ZIP64 end of central directory record
/// </summary>
public EndOfCentralDirectoryRecord64? ZIP64EndOfCentralDirectoryRecord { get; set; }
/// <summary>
/// Optional ZIP64 end of central directory locator
/// </summary>
public EndOfCentralDirectoryLocator64? ZIP64EndOfCentralDirectoryLocator { get; set; }
/// <summary>
/// Required end of central directory record, always must be last
/// </summary>
public EndOfCentralDirectoryRecord? EndOfCentralDirectoryRecord { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Archive extra data record
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
public class ArchiveExtraDataRecord
{
/// <summary>
/// Archive extra data signature (0x08064B50)
/// </summary>
public uint Signature { get; set; }
/// <summary>
/// Extra field length
/// </summary>
public uint ExtraFieldLength { get; set; }
/// <summary>
/// Extra field data (variable size)
/// </summary>
public byte[]? ExtraFieldData { get; set; }
}
}

View File

@@ -0,0 +1,119 @@
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Central directory file header
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
public class CentralDirectoryFileHeader
{
/// <summary>
/// Central file header signature (0x02014B50)
/// </summary>
public uint Signature { get; set; }
/// <summary>
/// Host system on which the file attributes are compatible
/// </summary>
public HostSystem HostSystem { get; set; }
/// <summary>
/// ZIP specification version
/// </summary>
public byte VersionMadeBy { get; set; }
/// <summary>
/// Version needed to extract
/// </summary>
/// <remarks>TODO: Add mapping of versions</remarks>
public ushort VersionNeededToExtract { get; set; }
/// <summary>
/// General purpose bit flag
/// </summary>
public GeneralPurposeBitFlags Flags { get; set; }
/// <summary>
/// Compression method
/// </summary>
public CompressionMethod CompressionMethod { get; set; }
/// <summary>
/// Last modified file time
/// </summary>
public ushort LastModifedFileTime { get; set; }
/// <summary>
/// Last modified file date
/// </summary>
public ushort LastModifiedFileDate { get; set; }
/// <summary>
/// CRC-32
/// </summary>
public uint CRC32 { get; set; }
/// <summary>
/// Compressed size
/// </summary>
public uint CompressedSize { get; set; }
/// <summary>
/// Uncompressed size
/// </summary>
public uint UncompressedSize { get; set; }
/// <summary>
/// File name length
/// </summary>
public ushort FileNameLength { get; set; }
/// <summary>
/// Extra field length
/// </summary>
public ushort ExtraFieldLength { get; set; }
/// <summary>
/// File comment length
/// </summary>
public ushort FileCommentLength { get; set; }
/// <summary>
/// Disk number start
/// </summary>
public ushort DiskNumberStart { get; set; }
/// <summary>
/// Internal file attributes
/// </summary>
public InternalFileAttributes InternalFileAttributes { get; set; }
/// <summary>
/// External file attributes
/// </summary>
public uint ExternalFileAttributes { get; set; }
/// <summary>
/// Relative offset of local header
/// </summary>
/// <remarks>
/// If ZIP64 and value is 0xFFFFFFFF, size will be in the
/// extended information extra field
/// </remarks>
public uint RelativeOffsetOfLocalHeader { get; set; }
/// <summary>
/// File name (variable size)
/// </summary>
public string? FileName { get; set; }
/// <summary>
/// Extra field (variable size)
/// </summary>
public byte[]? ExtraField { get; set; }
/// <summary>
/// File comment (variable size)
/// </summary>
public string? FileComment { get; set; }
}
}

85
PKZIP/Constants.cs Normal file
View File

@@ -0,0 +1,85 @@
namespace SabreTools.Models.PKZIP
{
public static class Constants
{
#region Archive Extra Data Record
public const uint ArchiveExtraDataRecordSignature = 0x08064B50;
public static readonly byte[] ArchiveExtraDataRecordSignatureBytes = [0x50, 0x4B, 0x06, 0x08];
public static readonly string ArchiveExtraDataRecordSignatureString = "PK" + (char)0x06 + (char)0x08;
#endregion
#region Central Directory File Header
public const uint CentralDirectoryFileHeaderSignature = 0x02014B50;
public static readonly byte[] CentralDirectoryFileHeaderSignatureBytes = [0x50, 0x4B, 0x01, 0x02];
public static readonly string CentralDirectoryFileHeaderSignatureString = "PK" + (char)0x01 + (char)0x02;
#endregion
#region Data Descriptor
public const uint DataDescriptorSignature = 0x08074B50;
public static readonly byte[] DataDescriptorSignatureBytes = [0x50, 0x4B, 0x07, 0x08];
public static readonly string DataDescriptorSignatureString = "PK" + (char)0x07 + (char)0x08;
#endregion
#region Digital Signature
public const uint DigitalSignatureSignature = 0x05054B50;
public static readonly byte[] DigitalSignatureSignatureBytes = [0x50, 0x4B, 0x05, 0x05];
public static readonly string DigitalSignatureSignatureString = "PK" + (char)0x05 + (char)0x05;
#endregion
#region End of Central Directory Locator (ZIP64)
public const uint EndOfCentralDirectoryLocator64Signature = 0x07064B50;
public static readonly byte[] EndOfCentralDirectoryLocator64SignatureBytes = [0x50, 0x4B, 0x06, 0x07];
public static readonly string EndOfCentralDirectoryLocator64SignatureString = "PK" + (char)0x06 + (char)0x07;
#endregion
#region End of Central Directory Record
public const uint EndOfCentralDirectoryRecordSignature = 0x06054B50;
public static readonly byte[] EndOfCentralDirectoryRecordSignatureBytes = [0x50, 0x4B, 0x05, 0x06];
public static readonly string EndOfCentralDirectoryRecordSignatureString = "PK" + (char)0x05 + (char)0x06;
#endregion
#region End of Central Directory Record (ZIP64)
public const uint EndOfCentralDirectoryRecord64Signature = 0x06064B50;
public static readonly byte[] EndOfCentralDirectoryRecord64SignatureBytes = [0x50, 0x4B, 0x06, 0x06];
public static readonly string EndOfCentralDirectoryRecord64SignatureString = "PK" + (char)0x06 + (char)0x06;
#endregion
#region Local File Header
public const uint LocalFileHeaderSignature = 0x04034B50;
public static readonly byte[] LocalFileHeaderSignatureBytes = [0x50, 0x4B, 0x03, 0x04];
public static readonly string LocalFileHeaderSignatureString = "PK" + (char)0x03 + (char)0x04;
#endregion
}
}

29
PKZIP/DataDescriptor.cs Normal file
View File

@@ -0,0 +1,29 @@
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Data descriptor
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
public class DataDescriptor
{
/// <summary>
/// Recommended, but optional, signature (0x08074B50)
/// </summary>
public uint? Signature { get; set; }
/// <summary>
/// CRC-32
/// </summary>
public uint CRC32 { get; set; }
/// <summary>
/// Compressed size
/// </summary>
public uint CompressedSize { get; set; }
/// <summary>
/// Uncompressed size
/// </summary>
public uint UncompressedSize { get; set; }
}
}

29
PKZIP/DataDescriptor64.cs Normal file
View File

@@ -0,0 +1,29 @@
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Data descriptor (ZIP64)
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
public class DataDescriptor64
{
/// <summary>
/// Recommended, but optional, signature (0x08074B50)
/// </summary>
public uint? Signature { get; set; }
/// <summary>
/// CRC-32
/// </summary>
public uint CRC32 { get; set; }
/// <summary>
/// Compressed size
/// </summary>
public ulong CompressedSize { get; set; }
/// <summary>
/// Uncompressed size
/// </summary>
public ulong UncompressedSize { get; set; }
}
}

24
PKZIP/DigitalSignature.cs Normal file
View File

@@ -0,0 +1,24 @@
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Digital signature
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
public class DigitalSignature
{
/// <summary>
/// Header signature (0x05054B50)
/// </summary>
public uint Signature { get; set; }
/// <summary>
/// Data length
/// </summary>
public ushort DataLength { get; set; }
/// <summary>
/// Signature data (variable size)
/// </summary>
public byte[]? SignatureData { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PKZIP
{
/// <summary>
/// Zip64 end of central directory locator
/// </summary>
/// <see href="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
[StructLayout(LayoutKind.Sequential)]
public class EndOfCentralDirectoryLocator64
{
/// <summary>
/// ZIP64 end of central directory locator signature (0x07064B50)
/// </summary>
public uint Signature;
/// <summary>
/// Number of the disk with the start of the end of central directory
/// </summary>
public uint StartDiskNumber;
/// <summary>
/// Relative offset of start of central directory record
/// </summary>
public ulong CentralDirectoryOffset;
/// <summary>
/// Total number of disks
/// </summary>
public uint TotalDisks;
}
}

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