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: 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
}