using System.Runtime.InteropServices; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; namespace Aaru.Images; public sealed partial class AaruFormat { #region Nested type: AaruFormatImageInfo /// /// This structure aggregates essential information extracted from an Aaru format image file, providing callers /// with a comprehensive view of the imaged media without requiring access to internal image structures. All fields /// are read-only from the caller's perspective and reflect the state at the time the image was created or last /// modified. /// [StructLayout(LayoutKind.Sequential)] public struct AaruFormatImageInfo { /// /// Image contains partitions (or tracks for optical media); 0=no, non-zero=yes /// [MarshalAs(UnmanagedType.U1)] public bool HasPartitions; /// /// Image contains multiple sessions (optical media); 0=single/none, non-zero=multi /// [MarshalAs(UnmanagedType.U1)] public bool HasSessions; /// /// Size of the image payload in bytes (excludes headers/metadata) /// public ulong ImageSize; /// /// Total count of addressable logical sectors/blocks /// public ulong Sectors; /// /// Size of each logical sector in bytes (512, 2048, 2352, 4096, etc.) /// public uint SectorSize; /// /// Image format version string (NUL-terminated, e.g., "6.0") /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] Version; /// /// Name of application that created the image (NUL-terminated) /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] Application; /// /// Version of the creating application (NUL-terminated) /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] ApplicationVersion; /// /// Image creation timestamp (Windows FILETIME: 100ns since 1601-01-01 UTC) /// public long CreationTime; /// /// Last modification timestamp (Windows FILETIME format) /// public long LastModificationTime; /// /// Media type identifier (see \ref MediaType enum; 0=Unknown) /// public MediaType MediaType; /// /// Media type for sidecar generation (internal archival use) /// public MetadataMediaType MetadataMediaType; } #endregion #region Nested type: DumpHardwareEntry [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DumpHardwareEntry { /// /// Length in bytes of manufacturer UTF-8 string. /// public uint ManufacturerLength; /// /// Length in bytes of model UTF-8 string. /// public uint ModelLength; /// /// Length in bytes of revision / hardware revision string. /// public uint RevisionLength; /// /// Length in bytes of firmware version string. /// public uint FirmwareLength; /// /// Length in bytes of device serial number string. /// public uint SerialLength; /// /// Length in bytes of dumping software name string. /// public uint SoftwareNameLength; /// /// Length in bytes of dumping software version string. /// public uint SoftwareVersionLength; /// /// Length in bytes of host operating system string. /// public uint SoftwareOperatingSystemLength; /// /// Number of DumpExtent records following the strings (0 = none). /// public uint Extents; } #endregion #region Nested type: DumpHardwareHeader [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DumpHardwareHeader { /// /// Block identifier, must be BlockType::DumpHardwareBlock. /// public BlockType Identifier; /// /// Number of DumpHardwareEntry records that follow. /// public ushort Entries; /// /// Total payload bytes after this header (sum of entries, strings, and extents arrays). /// public uint Length; /// /// CRC64-ECMA of the payload (byte-swapped for legacy v1 images, handled automatically). /// public ulong Crc64; } #endregion #region Nested type: TapeFileEntry [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TapeFileEntry { /// /// File number (unique within the partition). Identifies this file among all files in the same /// partition. Numbering scheme is tape-format-dependent. /// public uint File; /// /// Partition number containing this file. References a partition defined in the /// TapePartitionHeader block. Valid range: 0-255. /// public byte Partition; /// /// First block of the file (inclusive). This is the starting block address of the file data. /// Block addresses are 0-based within the partition. /// public ulong FirstBlock; /// /// Last block of the file (inclusive). This is the ending block address of the file data. Must be /// ≥ FirstBlock. The file contains all blocks from FirstBlock through LastBlock inclusive. /// public ulong LastBlock; } #endregion #region Nested type: TapePartitionEntry [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TapePartitionEntry { /// /// Partition number (unique identifier for this partition). Identifies this partition among all /// partitions on the tape. Valid range: 0-255, though most tapes use 0-3. /// public byte Number; /// /// First block in the partition (inclusive). Starting block address for this partition's /// address space. Often 0, but format-dependent. /// public ulong FirstBlock; /// /// Last block in the partition (inclusive). Ending block address for this partition's address /// space. Must be ≥ FirstBlock. The partition contains all blocks from FirstBlock through /// LastBlock inclusive. /// public ulong LastBlock; } #endregion #region Nested type: TrackEntry [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TrackEntry { /// /// Track number (1..99 typical for CD audio/data). 0 may indicate placeholder/non-standard. /// public byte Sequence; /// /// Track type (value from \ref TrackType). /// public byte Type; /// /// Inclusive starting LBA of the track. /// public long Start; /// /// Inclusive ending LBA of the track. /// public long End; /// /// Pre-gap length in sectors preceding track start (0 if none). /// public long Pregap; /// /// Session number (1-based). 1 for single-session discs. /// public byte Session; /// /// ISRC raw 13-byte code (no null terminator). All zeros if not present. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] Isrc; /// /// Control / attribute bitfield (see file documentation for suggested bit mapping). /// public byte Flags; } #endregion }