// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : IMediaImage.cs // Author(s) : Natalia Portillo // // Component : Disc image plugins. // // --[ Description ] ---------------------------------------------------------- // // Defines interface to be implemented by disc image plugins. // // --[ License ] -------------------------------------------------------------- // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, see . // // ---------------------------------------------------------------------------- // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ using System; using System.Collections.Generic; using DiscImageChef.CommonTypes.Enums; using DiscImageChef.CommonTypes.Structs; using Schemas; namespace DiscImageChef.CommonTypes.Interfaces { /// /// Abstract class to implement disk image reading plugins. /// public interface IMediaImage { /// Image information ImageInfo Info { get; } /// Plugin name. string Name { get; } /// Plugin UUID. Guid Id { get; } /// /// Gets the image format. /// /// The image format. string Format { get; } /// /// Gets an array partitions. Typically only useful for optical disc /// images where each track and index means a different partition, as /// reads can be relative to them. /// /// The partitions. List Partitions { get; } /// /// Gets the disc track extents (start, length). /// /// The track extents. List Tracks { get; } /// /// Gets the sessions (optical discs only). /// /// The sessions. List Sessions { get; } /// List of dump hardware used to create the image from real media List DumpHardware { get; } /// Gets the CICM XML metadata for the image CICMMetadataType CicmMetadata { get; } /// /// Identifies the image. /// /// true, if image was identified, false otherwise. /// Image filter. bool Identify(IFilter imageFilter); /// /// Opens the image. /// /// true, if image was opened, false otherwise. /// Image filter. bool Open(IFilter imageFilter); /// /// Reads a disk tag. /// /// Disk tag /// Tag type to read. byte[] ReadDiskTag(MediaTagType tag); /// /// Reads a sector's user data. /// /// The sector's user data. /// Sector address (LBA). byte[] ReadSector(ulong sectorAddress); /// /// Reads a sector's tag. /// /// The sector's tag. /// Sector address (LBA). /// Tag type. byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag); /// /// Reads a sector's user data, relative to track. /// /// The sector's user data. /// Sector address (relative LBA). /// Track. byte[] ReadSector(ulong sectorAddress, uint track); /// /// Reads a sector's tag, relative to track. /// /// The sector's tag. /// Sector address (relative LBA). /// Track. /// Tag type. byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag); /// /// Reads user data from several sectors. /// /// The sectors user data. /// Starting sector address (LBA). /// How many sectors to read. byte[] ReadSectors(ulong sectorAddress, uint length); /// /// Reads tag from several sectors. /// /// The sectors tag. /// Starting sector address (LBA). /// How many sectors to read. /// Tag type. byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag); /// /// Reads user data from several sectors, relative to track. /// /// The sectors user data. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. byte[] ReadSectors(ulong sectorAddress, uint length, uint track); /// /// Reads tag from several sectors, relative to track. /// /// The sectors tag. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// Tag type. byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag); /// /// Reads a complete sector (user data + all tags). /// /// The complete sector. Format depends on disk type. /// Sector address (LBA). byte[] ReadSectorLong(ulong sectorAddress); /// /// Reads a complete sector (user data + all tags), relative to track. /// /// The complete sector. Format depends on disk type. /// Sector address (relative LBA). /// Track. byte[] ReadSectorLong(ulong sectorAddress, uint track); /// /// Reads several complete sector (user data + all tags). /// /// The complete sectors. Format depends on disk type. /// Starting sector address (LBA). /// How many sectors to read. byte[] ReadSectorsLong(ulong sectorAddress, uint length); /// /// Reads several complete sector (user data + all tags), relative to track. /// /// The complete sectors. Format depends on disk type. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track); /// /// Gets the disc track extents for a specified session. /// /// The track exents for that session. /// Session. List GetSessionTracks(Session session); /// /// Gets the disc track extents for a specified session. /// /// The track exents for that session. /// Session. List GetSessionTracks(ushort session); /// /// Verifies a sector. /// /// True if correct, false if incorrect, null if uncheckable. /// Sector address (LBA). bool? VerifySector(ulong sectorAddress); /// /// Verifies a sector, relative to track. /// /// True if correct, false if incorrect, null if uncheckable. /// Sector address (relative LBA). /// Track. bool? VerifySector(ulong sectorAddress, uint track); /// /// Verifies several sectors. /// /// True if all are correct, false if any is incorrect, null if any is uncheckable. /// Starting sector address (LBA). /// How many sectors to read. /// List of incorrect sectors /// List of uncheckable sectors bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, out List unknownLbas); /// /// Verifies several sectors, relative to track. /// /// True if all are correct, false if any is incorrect, null if any is uncheckable. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// List of incorrect sectors /// List of uncheckable sectors bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, out List unknownLbas); /// /// Verifies media image internal checksum. /// /// True if correct, false if incorrect, null if there is no internal checksum available bool? VerifyMediaImage(); } }