/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ImagePlugin.cs
Version : 1.0
Author(s) : Natalia Portillo
Component : Disc image plugins
Revision : $Revision$
Last change by : $Author$
Date : $Date$
--[ Description ] ----------------------------------------------------------
Defines functions to be used by disc image plugins and several constants.
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
----------------------------------------------------------------------------
Copyright (C) 2011-2014 Claunia.com
****************************************************************************/
//$Id$
using System;
using System.Collections.Generic;
namespace DiscImageChef.ImagePlugins
{
///
/// Abstract class to implement disk image reading plugins.
///
public abstract class ImagePlugin
{
/// Plugin name.
public string Name;
/// Plugin UUID.
public Guid PluginUUID;
/// Image information
public ImageInfo ImageInfo;
protected ImagePlugin()
{
}
// Basic image handling functions
///
/// Identifies the image.
///
/// true, if image was identified, false otherwise.
/// Image path.
public abstract bool IdentifyImage(string imagePath);
///
/// Opens the image.
///
/// true, if image was opened, false otherwise.
/// Image path.
public abstract bool OpenImage(string imagePath);
///
/// Asks the disk image plugin if the image contains partitions
///
/// true, if the image contains partitions, false otherwise.
public abstract bool ImageHasPartitions();
// Image size functions
///
/// Gets the size of the image, without headers.
///
/// The image size.
public abstract UInt64 GetImageSize();
///
/// Gets the number of sectors in the image.
///
/// Sectors in image.
public abstract UInt64 GetSectors();
///
/// Returns the size of the biggest sector, counting user data only.
///
/// Biggest sector size (user data only).
public abstract UInt32 GetSectorSize();
// Image reading functions
///
/// Reads a disk tag.
///
/// Disk tag
/// Tag type to read.
public abstract byte[] ReadDiskTag(DiskTagType tag);
// Gets a disk tag
///
/// Reads a sector's user data.
///
/// The sector's user data.
/// Sector address (LBA).
public abstract byte[] ReadSector(UInt64 sectorAddress);
///
/// Reads a sector's tag.
///
/// The sector's tag.
/// Sector address (LBA).
/// Tag type.
public abstract byte[] ReadSectorTag(UInt64 sectorAddress, SectorTagType tag);
///
/// Reads a sector's user data, relative to track.
///
/// The sector's user data.
/// Sector address (relative LBA).
/// Track.
public abstract byte[] ReadSector(UInt64 sectorAddress, UInt32 track);
///
/// Reads a sector's tag, relative to track.
///
/// The sector's tag.
/// Sector address (relative LBA).
/// Track.
/// Tag type.
public abstract byte[] ReadSectorTag(UInt64 sectorAddress, UInt32 track, SectorTagType tag);
///
/// Reads user data from several sectors.
///
/// The sectors user data.
/// Starting sector address (LBA).
/// How many sectors to read.
public abstract byte[] ReadSectors(UInt64 sectorAddress, UInt32 length);
///
/// Reads tag from several sectors.
///
/// The sectors tag.
/// Starting sector address (LBA).
/// How many sectors to read.
/// Tag type.
public abstract byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 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.
public abstract byte[] ReadSectors(UInt64 sectorAddress, UInt32 length, UInt32 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.
public abstract byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, UInt32 track, SectorTagType tag);
///
/// Reads a complete sector (user data + all tags).
///
/// The complete sector. Format depends on disk type.
/// Sector address (LBA).
public abstract byte[] ReadSectorLong(UInt64 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.
public abstract byte[] ReadSectorLong(UInt64 sectorAddress, UInt32 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.
public abstract byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 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.
public abstract byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length, UInt32 track);
// Image information functions
///
/// Gets the image format.
///
/// The image format.
public abstract string GetImageFormat();
///
/// Gets the image version.
///
/// The image version.
public abstract string GetImageVersion();
///
/// Gets the application that created the image.
///
/// The application that created the image.
public abstract string GetImageApplication();
///
/// Gets the version of the application that created the image.
///
/// The version of the application that created the image.
public abstract string GetImageApplicationVersion();
///
/// Gets the image creator.
///
/// Who created the image.
public abstract string GetImageCreator();
///
/// Gets the image creation time.
///
/// The image creation time.
public abstract DateTime GetImageCreationTime();
///
/// Gets the image last modification time.
///
/// The image last modification time.
public abstract DateTime GetImageLastModificationTime();
///
/// Gets the name of the image.
///
/// The image name.
public abstract string GetImageName();
///
/// Gets the image comments.
///
/// The image comments.
public abstract string GetImageComments();
// Functions to get information from disk represented by image
///
/// Gets the disk manufacturer.
///
/// The disk manufacturer.
public abstract string GetDiskManufacturer();
///
/// Gets the disk model.
///
/// The disk model.
public abstract string GetDiskModel();
///
/// Gets the disk serial number.
///
/// The disk serial number.
public abstract string GetDiskSerialNumber();
///
/// Gets the disk (or product) barcode.
///
/// The disk barcode.
public abstract string GetDiskBarcode();
///
/// Gets the disk part number.
///
/// The disk part number.
public abstract string GetDiskPartNumber();
///
/// Gets the type of the disk.
///
/// The disk type.
public abstract DiskType GetDiskType();
///
/// Gets the disk sequence.
///
/// The disk sequence, starting at 1.
public abstract int GetDiskSequence();
///
/// Gets the last disk in the sequence.
///
/// The last disk in the sequence.
public abstract int GetLastDiskSequence();
// Functions to get information from drive used to create image
///
/// Gets the manufacturer of the drive used to create the image.
///
/// The drive manufacturer.
public abstract string GetDriveManufacturer();
///
/// Gets the model of the drive used to create the image.
///
/// The drive model.
public abstract string GetDriveModel();
///
/// Gets the serial number of the drive used to create the image.
///
/// The drive serial number.
public abstract string GetDriveSerialNumber();
// Partitioning functions
///
/// 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.
public abstract List GetPartitions();
///
/// Gets the disc track extents (start, length).
///
/// The track extents.
public abstract List