mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Rename project folder.
This commit is contained in:
2067
DiscImageChef/ImagePlugins/CDRWin.cs
Normal file
2067
DiscImageChef/ImagePlugins/CDRWin.cs
Normal file
File diff suppressed because it is too large
Load Diff
597
DiscImageChef/ImagePlugins/DiskCopy42.cs
Normal file
597
DiscImageChef/ImagePlugins/DiskCopy42.cs
Normal file
@@ -0,0 +1,597 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : DiskCopy42.cs
|
||||
Version : 1.0
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
Component : Disc image plugins
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Manages Apple DiskCopy 4.2 disc images, including unofficial modifications.
|
||||
|
||||
--[ 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscImageChef.ImagePlugins
|
||||
{
|
||||
// Checked using several images and strings inside Apple's DiskImages.framework
|
||||
class DiskCopy42 : ImagePlugin
|
||||
{
|
||||
#region Internal Structures
|
||||
|
||||
// DiskCopy 4.2 header, big-endian, data-fork, start of file, 84 bytes
|
||||
struct DC42Header
|
||||
{
|
||||
// 0x00, 64 bytes, pascal string, disk name or "-not a Macintosh disk-", filled with garbage
|
||||
public string diskName;
|
||||
// 0x40, size of data in bytes (usually sectors*512)
|
||||
public UInt32 dataSize;
|
||||
// 0x44, size of tags in bytes (usually sectors*12)
|
||||
public UInt32 tagSize;
|
||||
// 0x48, checksum of data bytes
|
||||
public UInt32 dataChecksum;
|
||||
// 0x4C, checksum of tag bytes
|
||||
public UInt32 tagChecksum;
|
||||
// 0x50, format of disk, see constants
|
||||
public byte format;
|
||||
// 0x51, format of sectors, see constants
|
||||
public byte fmtByte;
|
||||
// 0x52, is disk image valid? always 0x01
|
||||
public byte valid;
|
||||
// 0x53, reserved, always 0x00
|
||||
public byte reserved;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Constants
|
||||
|
||||
// format byte
|
||||
// 3.5", single side, double density, GCR
|
||||
const byte kSonyFormat400K = 0x00;
|
||||
// 3.5", double side, double density, GCR
|
||||
const byte kSonyFormat800K = 0x01;
|
||||
// 3.5", double side, double density, MFM
|
||||
const byte kSonyFormat720K = 0x02;
|
||||
// 3.5", double side, high density, MFM
|
||||
const byte kSonyFormat1440K = 0x03;
|
||||
// 3.5", double side, high density, MFM, 21 sectors/track (aka, Microsoft DMF)
|
||||
// Unchecked value
|
||||
const byte kSonyFormat1680K = 0x04;
|
||||
// Defined by Sigma Seven's BLU
|
||||
const byte kSigmaFormatTwiggy = 0x54;
|
||||
// There should be a value for Apple HD20 hard disks, unknown...
|
||||
// fmyByte byte
|
||||
// Based on GCR nibble
|
||||
// Always 0x02 for MFM disks
|
||||
// Unknown for Apple HD20
|
||||
// Defined by Sigma Seven's BLU
|
||||
const byte kSignaFmtByteTwiggy = 0x01;
|
||||
// 3.5" single side double density GCR and MFM all use same code
|
||||
const byte kSonyFmtByte400K = 0x02;
|
||||
const byte kSonyFmtByte720K = kSonyFmtByte400K;
|
||||
const byte kSonyFmtByte1440K = kSonyFmtByte400K;
|
||||
const byte kSonyFmtByte1680K = kSonyFmtByte400K;
|
||||
// 3.5" double side double density GCR, 512 bytes/sector, interleave 2:1
|
||||
const byte kSonyFmtByte800K = 0x22;
|
||||
// 3.5" double side double density GCR, 512 bytes/sector, interleave 2:1, incorrect value (but appears on official documentation)
|
||||
const byte kSonyFmtByte800KIncorrect = 0x12;
|
||||
// 3.5" double side double density GCR, ProDOS format, interleave 4:1
|
||||
const byte kSonyFmtByteProDos = 0x24;
|
||||
// Unformatted sectors
|
||||
const byte kInvalidFmtByte = 0x96;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal variables
|
||||
|
||||
// Start of data sectors in disk image, should be 0x58
|
||||
UInt32 dataOffset;
|
||||
// Start of tags in disk image, after data sectors
|
||||
UInt32 tagOffset;
|
||||
// Sectors
|
||||
UInt32 sectors;
|
||||
// Bytes per sector, should be 512
|
||||
UInt32 bps;
|
||||
// Bytes per tag, should be 12
|
||||
UInt32 bptag;
|
||||
// Header of opened image
|
||||
DC42Header header;
|
||||
// Disk image file
|
||||
string dc42ImagePath;
|
||||
|
||||
#endregion
|
||||
|
||||
public DiskCopy42(PluginBase Core)
|
||||
{
|
||||
Name = "Apple DiskCopy 4.2";
|
||||
PluginUUID = new Guid("0240B7B1-E959-4CDC-B0BD-386D6E467B88");
|
||||
}
|
||||
|
||||
public override bool IdentifyImage(string imagePath)
|
||||
{
|
||||
FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
byte[] buffer = new byte[0x58];
|
||||
byte[] pString = new byte[64];
|
||||
stream.Read(buffer, 0, 0x58);
|
||||
|
||||
// Incorrect pascal string length, not DC42
|
||||
if (buffer[0] > 63)
|
||||
return false;
|
||||
|
||||
DC42Header tmp_header = new DC42Header();
|
||||
|
||||
Array.Copy(buffer, 0, pString, 0, 64);
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
tmp_header.diskName = StringHandlers.PascalToString(pString);
|
||||
tmp_header.dataSize = BigEndianBitConverter.ToUInt32(buffer, 0x40);
|
||||
tmp_header.tagSize = BigEndianBitConverter.ToUInt32(buffer, 0x44);
|
||||
tmp_header.dataChecksum = BigEndianBitConverter.ToUInt32(buffer, 0x48);
|
||||
tmp_header.tagChecksum = BigEndianBitConverter.ToUInt32(buffer, 0x4C);
|
||||
tmp_header.format = buffer[0x50];
|
||||
tmp_header.fmtByte = buffer[0x51];
|
||||
tmp_header.valid = buffer[0x52];
|
||||
tmp_header.reserved = buffer[0x53];
|
||||
|
||||
if (MainClass.isDebug)
|
||||
{
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.diskName = \"{0}\"", tmp_header.diskName);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.dataSize = {0} bytes", tmp_header.dataSize);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.tagSize = {0} bytes", tmp_header.tagSize);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.dataChecksum = 0x{0:X8}", tmp_header.dataChecksum);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.tagChecksum = 0x{0:X8}", tmp_header.tagChecksum);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.format = 0x{0:X2}", tmp_header.format);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.fmtByte = 0x{0:X2}", tmp_header.fmtByte);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.valid = {0}", tmp_header.valid);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): tmp_header.reserved = {0}", tmp_header.reserved);
|
||||
}
|
||||
|
||||
if (tmp_header.valid != 1 || tmp_header.reserved != 0)
|
||||
return false;
|
||||
|
||||
FileInfo fi = new FileInfo(imagePath);
|
||||
|
||||
if (tmp_header.dataSize + tmp_header.tagSize + 0x54 != fi.Length && tmp_header.format != kSigmaFormatTwiggy)
|
||||
return false;
|
||||
|
||||
if (tmp_header.format != kSonyFormat400K && tmp_header.format != kSonyFormat800K && tmp_header.format != kSonyFormat720K &&
|
||||
tmp_header.format != kSonyFormat1440K && tmp_header.format != kSonyFormat1680K && tmp_header.format != kSigmaFormatTwiggy)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("Unknown tmp_header.format = 0x{0:X2} value", tmp_header.format);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tmp_header.fmtByte != kSonyFmtByte400K && tmp_header.fmtByte != kSonyFmtByte800K && tmp_header.fmtByte != kSonyFmtByte800KIncorrect &&
|
||||
tmp_header.fmtByte != kSonyFmtByteProDos && tmp_header.fmtByte != kInvalidFmtByte && tmp_header.fmtByte != kSignaFmtByteTwiggy)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("Unknown tmp_header.fmtByte = 0x{0:X2} value", tmp_header.fmtByte);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tmp_header.fmtByte == kInvalidFmtByte)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("Image says it's unformatted");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OpenImage(string imagePath)
|
||||
{
|
||||
FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
byte[] buffer = new byte[0x58];
|
||||
byte[] pString = new byte[64];
|
||||
stream.Read(buffer, 0, 0x58);
|
||||
|
||||
// Incorrect pascal string length, not DC42
|
||||
if (buffer[0] > 63)
|
||||
return false;
|
||||
|
||||
header = new DC42Header();
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
Array.Copy(buffer, 0, pString, 0, 64);
|
||||
header.diskName = StringHandlers.PascalToString(pString);
|
||||
header.dataSize = BigEndianBitConverter.ToUInt32(buffer, 0x40);
|
||||
header.tagSize = BigEndianBitConverter.ToUInt32(buffer, 0x44);
|
||||
header.dataChecksum = BigEndianBitConverter.ToUInt32(buffer, 0x48);
|
||||
header.tagChecksum = BigEndianBitConverter.ToUInt32(buffer, 0x4C);
|
||||
header.format = buffer[0x50];
|
||||
header.fmtByte = buffer[0x51];
|
||||
header.valid = buffer[0x52];
|
||||
header.reserved = buffer[0x53];
|
||||
|
||||
if (MainClass.isDebug)
|
||||
{
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.diskName = \"{0}\"", header.diskName);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.dataSize = {0} bytes", header.dataSize);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.tagSize = {0} bytes", header.tagSize);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.dataChecksum = 0x{0:X8}", header.dataChecksum);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.tagChecksum = 0x{0:X8}", header.tagChecksum);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.format = 0x{0:X2}", header.format);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.fmtByte = 0x{0:X2}", header.fmtByte);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.valid = {0}", header.valid);
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.reserved = {0}", header.reserved);
|
||||
}
|
||||
|
||||
if (header.valid != 1 || header.reserved != 0)
|
||||
return false;
|
||||
|
||||
FileInfo fi = new FileInfo(imagePath);
|
||||
|
||||
if (header.dataSize + header.tagSize + 0x54 != fi.Length && header.format != kSigmaFormatTwiggy)
|
||||
return false;
|
||||
|
||||
if (header.format != kSonyFormat400K && header.format != kSonyFormat800K && header.format != kSonyFormat720K &&
|
||||
header.format != kSonyFormat1440K && header.format != kSonyFormat1680K && header.format != kSigmaFormatTwiggy)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (DC42 plugin): Unknown header.format = 0x{0:X2} value", header.format);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header.fmtByte != kSonyFmtByte400K && header.fmtByte != kSonyFmtByte800K && header.fmtByte != kSonyFmtByte800KIncorrect &&
|
||||
header.fmtByte != kSonyFmtByteProDos && header.fmtByte != kInvalidFmtByte && header.fmtByte != kSignaFmtByteTwiggy)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (DC42 plugin): Unknown tmp_header.fmtByte = 0x{0:X2} value", header.fmtByte);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header.fmtByte == kInvalidFmtByte)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (DC42 plugin): Image says it's unformatted");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
dataOffset = 0x54;
|
||||
tagOffset = header.tagSize != 0 ? 0x54 + header.dataSize : 0;
|
||||
bps = 512;
|
||||
bptag = (uint)(header.tagSize != 0 ? 12 : 0);
|
||||
dc42ImagePath = imagePath;
|
||||
|
||||
sectors = header.dataSize / 512;
|
||||
|
||||
if (header.tagSize != 0)
|
||||
{
|
||||
if (header.tagSize / 12 != sectors)
|
||||
{
|
||||
if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (DC42 plugin): header.tagSize / 12 != sectors");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ImageHasPartitions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override UInt64 GetImageSize()
|
||||
{
|
||||
return sectors * bps + sectors * bptag;
|
||||
}
|
||||
|
||||
public override UInt64 GetSectors()
|
||||
{
|
||||
return sectors;
|
||||
}
|
||||
|
||||
public override UInt32 GetSectorSize()
|
||||
{
|
||||
return bps;
|
||||
}
|
||||
|
||||
public override byte[] ReadSector(UInt64 sectorAddress)
|
||||
{
|
||||
return ReadSectors(sectorAddress, 1);
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorTag(UInt64 sectorAddress, SectorTagType tag)
|
||||
{
|
||||
return ReadSectorsTag(sectorAddress, 1, tag);
|
||||
}
|
||||
|
||||
public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length)
|
||||
{
|
||||
if (sectorAddress > sectors - 1)
|
||||
throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
|
||||
|
||||
if (sectorAddress + length > sectors)
|
||||
throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
|
||||
|
||||
byte[] buffer = new byte[length * bps];
|
||||
|
||||
FileStream stream = new FileStream(dc42ImagePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
stream.Seek((long)(dataOffset + sectorAddress * bps), SeekOrigin.Begin);
|
||||
|
||||
stream.Read(buffer, 0, (int)(length * bps));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag)
|
||||
{
|
||||
if (tag != SectorTagType.AppleSectorTag)
|
||||
throw new FeatureUnsupportedImageException(String.Format("Tag {0} not supported by image format", tag));
|
||||
|
||||
if (header.tagSize == 0)
|
||||
throw new FeatureNotPresentImageException("Disk image does not have tags");
|
||||
|
||||
if (sectorAddress > sectors - 1)
|
||||
throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
|
||||
|
||||
if (sectorAddress + length > sectors)
|
||||
throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
|
||||
|
||||
byte[] buffer = new byte[length * bptag];
|
||||
|
||||
FileStream stream = new FileStream(dc42ImagePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
stream.Seek((long)(tagOffset + sectorAddress * bptag), SeekOrigin.Begin);
|
||||
|
||||
stream.Read(buffer, 0, (int)(length * bptag));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorLong(UInt64 sectorAddress)
|
||||
{
|
||||
return ReadSectorsLong(sectorAddress, 1);
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length)
|
||||
{
|
||||
if (sectorAddress > sectors - 1)
|
||||
throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
|
||||
|
||||
if (sectorAddress + length > sectors)
|
||||
throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
|
||||
|
||||
byte[] data = ReadSectors(sectorAddress, length);
|
||||
byte[] tags = ReadSectorsTag(sectorAddress, length, SectorTagType.AppleSectorTag);
|
||||
byte[] buffer = new byte[data.Length + tags.Length];
|
||||
|
||||
for (uint i = 0; i < length; i++)
|
||||
{
|
||||
Array.Copy(data, i * (bps), buffer, i * (bps + bptag), bps);
|
||||
Array.Copy(tags, i * (bptag), buffer, i * (bps + bptag) + bps, bptag);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public override string GetImageFormat()
|
||||
{
|
||||
return "Apple DiskCopy 4.2";
|
||||
}
|
||||
|
||||
public override string GetImageVersion()
|
||||
{
|
||||
return "4.2";
|
||||
}
|
||||
|
||||
public override string GetImageApplication()
|
||||
{
|
||||
return "Apple DiskCopy";
|
||||
}
|
||||
|
||||
public override string GetImageApplicationVersion()
|
||||
{
|
||||
return "4.2";
|
||||
}
|
||||
|
||||
public override DateTime GetImageCreationTime()
|
||||
{
|
||||
FileInfo fi = new FileInfo(dc42ImagePath);
|
||||
|
||||
return fi.CreationTimeUtc;
|
||||
}
|
||||
|
||||
public override DateTime GetImageLastModificationTime()
|
||||
{
|
||||
FileInfo fi = new FileInfo(dc42ImagePath);
|
||||
|
||||
return fi.LastWriteTimeUtc;
|
||||
}
|
||||
|
||||
public override string GetImageName()
|
||||
{
|
||||
return header.diskName;
|
||||
}
|
||||
|
||||
public override DiskType GetDiskType()
|
||||
{
|
||||
switch (header.format)
|
||||
{
|
||||
case kSonyFormat400K:
|
||||
return DiskType.AppleSonySS;
|
||||
case kSonyFormat800K:
|
||||
return DiskType.AppleSonyDS;
|
||||
case kSonyFormat720K:
|
||||
return DiskType.DOS_35_DS_DD_9;
|
||||
case kSonyFormat1440K:
|
||||
return DiskType.DOS_35_HD;
|
||||
case kSonyFormat1680K:
|
||||
return DiskType.DMF;
|
||||
case kSigmaFormatTwiggy:
|
||||
return DiskType.AppleFileWare;
|
||||
default:
|
||||
return DiskType.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
#region Unsupported features
|
||||
|
||||
public override byte[] ReadDiskTag(DiskTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageCreator()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageComments()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskManufacturer()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskModel()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskSerialNumber()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskBarcode()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskPartNumber()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override int GetDiskSequence()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override int GetLastDiskSequence()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDriveManufacturer()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDriveModel()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDriveSerialNumber()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<PartPlugins.Partition> GetPartitions()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Track> GetTracks()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Track> GetSessionTracks(Session session)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Track> GetSessionTracks(UInt16 session)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Session> GetSessions()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSector(UInt64 sectorAddress, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorTag(UInt64 sectorAddress, UInt32 track, SectorTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, UInt32 track, SectorTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorLong(UInt64 sectorAddress, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
#endregion Unsupported features
|
||||
}
|
||||
}
|
||||
|
||||
947
DiscImageChef/ImagePlugins/ImagePlugin.cs
Normal file
947
DiscImageChef/ImagePlugins/ImagePlugin.cs
Normal file
@@ -0,0 +1,947 @@
|
||||
/***************************************************************************
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscImageChef.ImagePlugins
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract class to implement disk image reading plugins.
|
||||
/// </summary>
|
||||
public abstract class ImagePlugin
|
||||
{
|
||||
/// <summary>Plugin name.</summary>
|
||||
public string Name;
|
||||
/// <summary>Plugin UUID.</summary>
|
||||
public Guid PluginUUID;
|
||||
|
||||
protected ImagePlugin()
|
||||
{
|
||||
}
|
||||
|
||||
// Basic image handling functions
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the image.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if image was identified, <c>false</c> otherwise.</returns>
|
||||
/// <param name="imagePath">Image path.</param>
|
||||
public abstract bool IdentifyImage(string imagePath);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the image.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if image was opened, <c>false</c> otherwise.</returns>
|
||||
/// <param name="imagePath">Image path.</param>
|
||||
public abstract bool OpenImage(string imagePath);
|
||||
|
||||
/// <summary>
|
||||
/// Asks the disk image plugin if the image contains partitions
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if the image contains partitions, <c>false</c> otherwise.</returns>
|
||||
public abstract bool ImageHasPartitions();
|
||||
|
||||
// Image size functions
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the image, without headers.
|
||||
/// </summary>
|
||||
/// <returns>The image size.</returns>
|
||||
public abstract UInt64 GetImageSize();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of sectors in the image.
|
||||
/// </summary>
|
||||
/// <returns>Sectors in image.</returns>
|
||||
public abstract UInt64 GetSectors();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the size of the biggest sector, counting user data only.
|
||||
/// </summary>
|
||||
/// <returns>Biggest sector size (user data only).</returns>
|
||||
public abstract UInt32 GetSectorSize();
|
||||
|
||||
// Image reading functions
|
||||
|
||||
/// <summary>
|
||||
/// Reads a disk tag.
|
||||
/// </summary>
|
||||
/// <returns>Disk tag</returns>
|
||||
/// <param name="tag">Tag type to read.</param>
|
||||
public abstract byte[] ReadDiskTag(DiskTagType tag);
|
||||
|
||||
// Gets a disk tag
|
||||
/// <summary>
|
||||
/// Reads a sector's user data.
|
||||
/// </summary>
|
||||
/// <returns>The sector's user data.</returns>
|
||||
/// <param name="sectorAddress">Sector address (LBA).</param>
|
||||
public abstract byte[] ReadSector(UInt64 sectorAddress);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a sector's tag.
|
||||
/// </summary>
|
||||
/// <returns>The sector's tag.</returns>
|
||||
/// <param name="sectorAddress">Sector address (LBA).</param>
|
||||
/// <param name="tag">Tag type.</param>
|
||||
public abstract byte[] ReadSectorTag(UInt64 sectorAddress, SectorTagType tag);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a sector's user data, relative to track.
|
||||
/// </summary>
|
||||
/// <returns>The sector's user data.</returns>
|
||||
/// <param name="sectorAddress">Sector address (relative LBA).</param>
|
||||
/// <param name="track">Track.</param>
|
||||
public abstract byte[] ReadSector(UInt64 sectorAddress, UInt32 track);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a sector's tag, relative to track.
|
||||
/// </summary>
|
||||
/// <returns>The sector's tag.</returns>
|
||||
/// <param name="sectorAddress">Sector address (relative LBA).</param>
|
||||
/// <param name="track">Track.</param>
|
||||
/// <param name="tag">Tag type.</param>
|
||||
public abstract byte[] ReadSectorTag(UInt64 sectorAddress, UInt32 track, SectorTagType tag);
|
||||
|
||||
/// <summary>
|
||||
/// Reads user data from several sectors.
|
||||
/// </summary>
|
||||
/// <returns>The sectors user data.</returns>
|
||||
/// <param name="sectorAddress">Starting sector address (LBA).</param>
|
||||
/// <param name="length">How many sectors to read.</param>
|
||||
public abstract byte[] ReadSectors(UInt64 sectorAddress, UInt32 length);
|
||||
|
||||
/// <summary>
|
||||
/// Reads tag from several sectors.
|
||||
/// </summary>
|
||||
/// <returns>The sectors tag.</returns>
|
||||
/// <param name="sectorAddress">Starting sector address (LBA).</param>
|
||||
/// <param name="length">How many sectors to read.</param>
|
||||
/// <param name="tag">Tag type.</param>
|
||||
public abstract byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag);
|
||||
|
||||
/// <summary>
|
||||
/// Reads user data from several sectors, relative to track.
|
||||
/// </summary>
|
||||
/// <returns>The sectors user data.</returns>
|
||||
/// <param name="sectorAddress">Starting sector address (relative LBA).</param>
|
||||
/// <param name="length">How many sectors to read.</param>
|
||||
/// <param name="track">Track.</param>
|
||||
public abstract byte[] ReadSectors(UInt64 sectorAddress, UInt32 length, UInt32 track);
|
||||
|
||||
/// <summary>
|
||||
/// Reads tag from several sectors, relative to track.
|
||||
/// </summary>
|
||||
/// <returns>The sectors tag.</returns>
|
||||
/// <param name="sectorAddress">Starting sector address (relative LBA).</param>
|
||||
/// <param name="length">How many sectors to read.</param>
|
||||
/// <param name="track">Track.</param>
|
||||
/// <param name="tag">Tag type.</param>
|
||||
public abstract byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, UInt32 track, SectorTagType tag);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a complete sector (user data + all tags).
|
||||
/// </summary>
|
||||
/// <returns>The complete sector. Format depends on disk type.</returns>
|
||||
/// <param name="sectorAddress">Sector address (LBA).</param>
|
||||
public abstract byte[] ReadSectorLong(UInt64 sectorAddress);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a complete sector (user data + all tags), relative to track.
|
||||
/// </summary>
|
||||
/// <returns>The complete sector. Format depends on disk type.</returns>
|
||||
/// <param name="sectorAddress">Sector address (relative LBA).</param>
|
||||
/// <param name="track">Track.</param>
|
||||
public abstract byte[] ReadSectorLong(UInt64 sectorAddress, UInt32 track);
|
||||
|
||||
/// <summary>
|
||||
/// Reads several complete sector (user data + all tags).
|
||||
/// </summary>
|
||||
/// <returns>The complete sectors. Format depends on disk type.</returns>
|
||||
/// <param name="sectorAddress">Starting sector address (LBA).</param>
|
||||
/// <param name="length">How many sectors to read.</param>
|
||||
public abstract byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length);
|
||||
|
||||
/// <summary>
|
||||
/// Reads several complete sector (user data + all tags), relative to track.
|
||||
/// </summary>
|
||||
/// <returns>The complete sectors. Format depends on disk type.</returns>
|
||||
/// <param name="sectorAddress">Starting sector address (relative LBA).</param>
|
||||
/// <param name="length">How many sectors to read.</param>
|
||||
/// <param name="track">Track.</param>
|
||||
public abstract byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length, UInt32 track);
|
||||
|
||||
// Image information functions
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image format.
|
||||
/// </summary>
|
||||
/// <returns>The image format.</returns>
|
||||
public abstract string GetImageFormat();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image version.
|
||||
/// </summary>
|
||||
/// <returns>The image version.</returns>
|
||||
public abstract string GetImageVersion();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application that created the image.
|
||||
/// </summary>
|
||||
/// <returns>The application that created the image.</returns>
|
||||
public abstract string GetImageApplication();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the application that created the image.
|
||||
/// </summary>
|
||||
/// <returns>The version of the application that created the image.</returns>
|
||||
public abstract string GetImageApplicationVersion();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image creator.
|
||||
/// </summary>
|
||||
/// <returns>Who created the image.</returns>
|
||||
public abstract string GetImageCreator();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image creation time.
|
||||
/// </summary>
|
||||
/// <returns>The image creation time.</returns>
|
||||
public abstract DateTime GetImageCreationTime();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image last modification time.
|
||||
/// </summary>
|
||||
/// <returns>The image last modification time.</returns>
|
||||
public abstract DateTime GetImageLastModificationTime();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the image.
|
||||
/// </summary>
|
||||
/// <returns>The image name.</returns>
|
||||
public abstract string GetImageName();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image comments.
|
||||
/// </summary>
|
||||
/// <returns>The image comments.</returns>
|
||||
public abstract string GetImageComments();
|
||||
|
||||
// Functions to get information from disk represented by image
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disk manufacturer.
|
||||
/// </summary>
|
||||
/// <returns>The disk manufacturer.</returns>
|
||||
public abstract string GetDiskManufacturer();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disk model.
|
||||
/// </summary>
|
||||
/// <returns>The disk model.</returns>
|
||||
public abstract string GetDiskModel();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disk serial number.
|
||||
/// </summary>
|
||||
/// <returns>The disk serial number.</returns>
|
||||
public abstract string GetDiskSerialNumber();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disk (or product) barcode.
|
||||
/// </summary>
|
||||
/// <returns>The disk barcode.</returns>
|
||||
public abstract string GetDiskBarcode();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disk part number.
|
||||
/// </summary>
|
||||
/// <returns>The disk part number.</returns>
|
||||
public abstract string GetDiskPartNumber();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the disk.
|
||||
/// </summary>
|
||||
/// <returns>The disk type.</returns>
|
||||
public abstract DiskType GetDiskType();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disk sequence.
|
||||
/// </summary>
|
||||
/// <returns>The disk sequence, starting at 1.</returns>
|
||||
public abstract int GetDiskSequence();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last disk in the sequence.
|
||||
/// </summary>
|
||||
/// <returns>The last disk in the sequence.</returns>
|
||||
public abstract int GetLastDiskSequence();
|
||||
|
||||
// Functions to get information from drive used to create image
|
||||
|
||||
/// <summary>
|
||||
/// Gets the manufacturer of the drive used to create the image.
|
||||
/// </summary>
|
||||
/// <returns>The drive manufacturer.</returns>
|
||||
public abstract string GetDriveManufacturer();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model of the drive used to create the image.
|
||||
/// </summary>
|
||||
/// <returns>The drive model.</returns>
|
||||
public abstract string GetDriveModel();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the serial number of the drive used to create the image.
|
||||
/// </summary>
|
||||
/// <returns>The drive serial number.</returns>
|
||||
public abstract string GetDriveSerialNumber();
|
||||
|
||||
// Partitioning functions
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns>The partitions.</returns>
|
||||
public abstract List<PartPlugins.Partition> GetPartitions();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disc track extents (start, length).
|
||||
/// </summary>
|
||||
/// <returns>The track extents.</returns>
|
||||
public abstract List<Track> GetTracks();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disc track extents for a specified session.
|
||||
/// </summary>
|
||||
/// <returns>The track exents for that session.</returns>
|
||||
/// <param name="session">Session.</param>
|
||||
public abstract List<Track> GetSessionTracks(Session session);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disc track extents for a specified session.
|
||||
/// </summary>
|
||||
/// <returns>The track exents for that session.</returns>
|
||||
/// <param name="session">Session.</param>
|
||||
public abstract List<Track> GetSessionTracks(UInt16 session);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sessions (optical discs only).
|
||||
/// </summary>
|
||||
/// <returns>The sessions.</returns>
|
||||
public abstract List<Session> GetSessions();
|
||||
// Returns disc sessions
|
||||
|
||||
// CD flags bitmask
|
||||
|
||||
/// <summary>Track is quadraphonic.</summary>
|
||||
public const byte CDFlagsFourChannel = 0x20;
|
||||
/// <summary>Track is non-audio (data).</summary>
|
||||
public const byte CDFlagsDataTrack = 0x10;
|
||||
/// <summary>Track is copy protected.</summary>
|
||||
public const byte CDFlagsCopyPrevent = 0x08;
|
||||
/// <summary>Track has pre-emphasis.</summary>
|
||||
public const byte CDFlagsPreEmphasis = 0x04;
|
||||
}
|
||||
|
||||
// Disk types
|
||||
public enum DiskType
|
||||
{
|
||||
/// <summary>Unknown disk type</summary>
|
||||
Unknown,
|
||||
|
||||
// Somewhat standard Compact Disc formats
|
||||
/// <summary>CD Digital Audio (Red Book)</summary>
|
||||
CDDA,
|
||||
/// <summary>CD+G (Red Book)</summary>
|
||||
CDG,
|
||||
/// <summary>CD+EG (Red Book)</summary>
|
||||
CDEG,
|
||||
/// <summary>CD-i (Green Book)</summary>
|
||||
CDI,
|
||||
/// <summary>CD-ROM (Yellow Book)</summary>
|
||||
CDROM,
|
||||
/// <summary>CD-ROM XA (Yellow Book)</summary>
|
||||
CDROMXA,
|
||||
/// <summary>CD+ (Blue Book)</summary>
|
||||
CDPLUS,
|
||||
/// <summary>CD-MO (Orange Book)</summary>
|
||||
CDMO,
|
||||
/// <summary>CD-Recordable (Orange Book)</summary>
|
||||
CDR,
|
||||
/// <summary>CD-ReWritable (Orange Book)</summary>
|
||||
CDRW,
|
||||
/// <summary>Mount-Rainier CD-RW</summary>
|
||||
CDMRW,
|
||||
/// <summary>Video CD (White Book)</summary>
|
||||
VCD,
|
||||
/// <summary>Super Video CD (White Book)</summary>
|
||||
SVCD,
|
||||
/// <summary>Photo CD (Beige Book)</summary>
|
||||
PCD,
|
||||
/// <summary>Super Audio CD (Scarlet Book)</summary>
|
||||
SACD,
|
||||
/// <summary>Double-Density CD-ROM (Purple Book)</summary>
|
||||
DDCD,
|
||||
/// <summary>DD CD-R (Purple Book)</summary>
|
||||
DDCDR,
|
||||
/// <summary>DD CD-RW (Purple Book)</summary>
|
||||
DDCDRW,
|
||||
/// <summary>DTS audio CD (non-standard)</summary>
|
||||
DTSCD,
|
||||
/// <summary>CD-MIDI (Red Book)</summary>
|
||||
CDMIDI,
|
||||
/// <summary>Any unknown or standard violating CD</summary>
|
||||
CD,
|
||||
|
||||
// Standard DVD formats
|
||||
/// <summary>DVD-ROM (applies to DVD Video and DVD Audio)</summary>
|
||||
DVDROM,
|
||||
/// <summary>DVD-R</summary>
|
||||
DVDR,
|
||||
/// <summary>DVD-RW</summary>
|
||||
DVDRW,
|
||||
/// <summary>DVD+R</summary>
|
||||
DVDPR,
|
||||
/// <summary>DVD+RW</summary>
|
||||
DVDPRW,
|
||||
/// <summary>DVD+RW DL</summary>
|
||||
DVDPRWDL,
|
||||
/// <summary>DVD-R DL</summary>
|
||||
DVDRDL,
|
||||
/// <summary>DVD+R DL</summary>
|
||||
DVDPRDL,
|
||||
/// <summary>DVD-RAM</summary>
|
||||
DVDRAM,
|
||||
|
||||
// Standard HD-DVD formats
|
||||
/// <summary>HD DVD-ROM (applies to HD DVD Video)</summary>
|
||||
HDDVDROM,
|
||||
/// <summary>HD DVD-RAM</summary>
|
||||
HDDVDRAM,
|
||||
/// <summary>HD DVD-R</summary>
|
||||
HDDVDR,
|
||||
/// <summary>HD DVD-RW</summary>
|
||||
HDDVDRW,
|
||||
|
||||
// Standard Blu-ray formats
|
||||
/// <summary>BD-ROM (and BD Video)</summary>
|
||||
BDROM,
|
||||
/// <summary>BD-R</summary>
|
||||
BDR,
|
||||
/// <summary>BD-RE</summary>
|
||||
BDRE,
|
||||
/// <summary>BD-R XL</summary>
|
||||
BDRXL,
|
||||
/// <summary>BD-RE XL</summary>
|
||||
BDREXL,
|
||||
|
||||
// Rare or uncommon standards
|
||||
/// <summary>Enhanced Versatile Disc</summary>
|
||||
EVD,
|
||||
/// <summary>Forward Versatile Disc</summary>
|
||||
FVD,
|
||||
/// <summary>Holographic Versatile Disc</summary>
|
||||
HVD,
|
||||
/// <summary>China Blue High Definition</summary>
|
||||
CBHD,
|
||||
/// <summary>High Definition Versatile Multilayer Disc</summary>
|
||||
HDVMD,
|
||||
/// <summary>Versatile Compact Disc High Density</summary>
|
||||
VCDHD,
|
||||
/// <summary>Pioneer LaserDisc</summary>
|
||||
LD,
|
||||
/// <summary>Pioneer LaserDisc data</summary>
|
||||
LDROM,
|
||||
/// <summary>Sony MiniDisc</summary>
|
||||
MD,
|
||||
/// <summary>Sony Hi-MD</summary>
|
||||
HiMD,
|
||||
/// <summary>Ultra Density Optical</summary>
|
||||
UDO,
|
||||
/// <summary>Stacked Volumetric Optical Disc</summary>
|
||||
SVOD,
|
||||
/// <summary>Five Dimensional disc</summary>
|
||||
FDDVD,
|
||||
|
||||
// Propietary game discs
|
||||
/// <summary>Sony PlayStation game CD</summary>
|
||||
PS1CD,
|
||||
/// <summary>Sony PlayStation 2 game CD</summary>
|
||||
PS2CD,
|
||||
/// <summary>Sony PlayStation 2 game DVD</summary>
|
||||
PS2DVD,
|
||||
/// <summary>Sony PlayStation 3 game DVD</summary>
|
||||
PS3DVD,
|
||||
/// <summary>Sony PlayStation 3 game Blu-ray</summary>
|
||||
PS3BD,
|
||||
/// <summary>Sony PlayStation 4 game Blu-ray</summary>
|
||||
PS4BD,
|
||||
/// <summary>Sony PlayStation Portable Universal Media Disc (ECMA-365)</summary>
|
||||
UMD,
|
||||
/// <summary>Nintendo GameCube Optical Disc</summary>
|
||||
GOD,
|
||||
/// <summary>Nintendo Wii Optical Disc</summary>
|
||||
WOD,
|
||||
/// <summary>Nintendo Wii U Optical Disc</summary>
|
||||
WUOD,
|
||||
/// <summary>Microsoft X-box Game Disc</summary>
|
||||
XGD,
|
||||
/// <summary>Microsoft X-box 360 Game Disc</summary>
|
||||
XGD2,
|
||||
/// <summary>Microsoft X-box 360 Game Disc</summary>
|
||||
XGD3,
|
||||
/// <summary>Microsoft X-box One Game Disc</summary>
|
||||
XGD4,
|
||||
/// <summary>Sega MegaCD</summary>
|
||||
MEGACD,
|
||||
/// <summary>Sega Saturn disc</summary>
|
||||
SATURNCD,
|
||||
/// <summary>Sega/Yamaha Gigabyte Disc</summary>
|
||||
GDROM,
|
||||
/// <summary>Sega/Yamaha recordable Gigabyte Disc}}</summary>
|
||||
GDR,
|
||||
|
||||
// Apple standard floppy format
|
||||
/// <summary>5.25", SS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR</summary>
|
||||
Apple32SS,
|
||||
/// <summary>5.25", DS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR</summary>
|
||||
Apple32DS,
|
||||
/// <summary>5.25", SS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR</summary>
|
||||
Apple33SS,
|
||||
/// <summary>5.25", DS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR</summary>
|
||||
Apple33DS,
|
||||
/// <summary>3.5", SS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR</summary>
|
||||
AppleSonySS,
|
||||
/// <summary>3.5", DS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR</summary>
|
||||
AppleSonyDS,
|
||||
/// <summary>5.25", DS, ?D, ?? tracks, ?? spt, 512 bytes/sector, GCR, opposite side heads, aka Twiggy</summary>
|
||||
AppleFileWare,
|
||||
|
||||
// IBM/Microsoft PC standard floppy formats
|
||||
/// <summary>5.25", SS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_525_SS_DD_8,
|
||||
/// <summary>5.25", SS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_525_SS_DD_9,
|
||||
/// <summary>5.25", DS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_525_DS_DD_8,
|
||||
/// <summary>5.25", DS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_525_DS_DD_9,
|
||||
/// <summary>5.25", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_525_HD,
|
||||
/// <summary>3.5", SS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_35_SS_DD_8,
|
||||
/// <summary>3.5", SS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_35_SS_DD_9,
|
||||
/// <summary>3.5", DS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_35_DS_DD_8,
|
||||
/// <summary>3.5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_35_DS_DD_9,
|
||||
/// <summary>3.5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_35_HD,
|
||||
/// <summary>3.5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM</summary>
|
||||
DOS_35_ED,
|
||||
|
||||
// Microsoft non standard floppy formats
|
||||
/// <summary>3.5", DS, DD, 80 tracks, 21 spt, 512 bytes/sector, MFM</summary>
|
||||
DMF,
|
||||
/// <summary>3.5", DS, DD, 82 tracks, 21 spt, 512 bytes/sector, MFM</summary>
|
||||
DMF_82,
|
||||
|
||||
// IBM non standard floppy formats
|
||||
XDF_525,
|
||||
XDF_35,
|
||||
|
||||
// IBM standard floppy formats
|
||||
/// <summary>8", SS, SD, 32 tracks, 8 spt, 319 bytes/sector, FM</summary>
|
||||
IBM23FD,
|
||||
/// <summary>8", SS, SD, 73 tracks, 26 spt, 128 bytes/sector, FM</summary>
|
||||
IBM33FD_128,
|
||||
/// <summary>8", SS, SD, 74 tracks, 15 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector</summary>
|
||||
IBM33FD_256,
|
||||
/// <summary>8", SS, SD, 74 tracks, 8 spt, 512 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector</summary>
|
||||
IBM33FD_512,
|
||||
/// <summary>8", DS, SD, 74 tracks, 26 spt, 128 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector</summary>
|
||||
IBM43FD_128,
|
||||
/// <summary>8", DS, SD, 74 tracks, 26 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector</summary>
|
||||
IBM43FD_256,
|
||||
/// <summary>8", DS, DD, 74 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
IBM53FD_256,
|
||||
/// <summary>8", DS, DD, 74 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
IBM53FD_512,
|
||||
/// <summary>8", DS, DD, 74 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
IBM53FD_1024,
|
||||
|
||||
// DEC standard floppy formats
|
||||
/// <summary>8", SS, DD, 77 tracks, 26 spt, 128 bytes/sector, FM</summary>
|
||||
RX01,
|
||||
/// <summary>8", SS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM</summary>
|
||||
RX02,
|
||||
|
||||
// Acorn standard floppy formats
|
||||
/// <summary>5,25", SS, SD, 40 tracks, 10 spt, 256 bytes/sector, FM</summary>
|
||||
ACORN_525_SS_SD_40,
|
||||
/// <summary>5,25", SS, SD, 80 tracks, 10 spt, 256 bytes/sector, FM</summary>
|
||||
ACORN_525_SS_SD_80,
|
||||
/// <summary>5,25", SS, DD, 40 tracks, 16 spt, 256 bytes/sector, MFM</summary>
|
||||
ACORN_525_SS_DD_40,
|
||||
/// <summary>5,25", SS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM</summary>
|
||||
ACORN_525_SS_DD_80,
|
||||
/// <summary>5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM</summary>
|
||||
ACORN_525_DS_DD,
|
||||
|
||||
// Atari standard floppy formats
|
||||
/// <summary>5,25", SS, SD, 40 tracks, 18 spt, 128 bytes/sector, FM</summary>
|
||||
ATARI_525_SD,
|
||||
/// <summary>5,25", SS, ED, 40 tracks, 26 spt, 128 bytes/sector, MFM</summary>
|
||||
ATARI_525_ED,
|
||||
/// <summary>5,25", SS, DD, 40 tracks, 18 spt, 256 bytes/sector, MFM</summary>
|
||||
ATARI_525_DD,
|
||||
|
||||
// Commodore standard floppy formats
|
||||
/// <summary>3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM</summary>
|
||||
CBM_35_DD,
|
||||
/// <summary>3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM (Amiga)</summary>
|
||||
CBM_AMIGA_35_DD,
|
||||
/// <summary>3,5", DS, HD, 80 tracks, 22 spt, 512 bytes/sector, MFM (Amiga)</summary>
|
||||
CBM_AMIGA_35_HD,
|
||||
|
||||
// NEC standard floppy formats
|
||||
/// <summary>8", SS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM</summary>
|
||||
NEC_8_SD,
|
||||
/// <summary>8", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, MFM</summary>
|
||||
NEC_8_DD,
|
||||
/// <summary>5,25", DS, HD, 80 tracks, 8 spt, 1024 bytes/sector, MFM</summary>
|
||||
NEC_525_HD,
|
||||
/// <summary>3,5", DS, HD, 80 tracks, 8 spt, 1024 bytes/sector, MFM</summary>
|
||||
NEC_35_HD_8,
|
||||
/// <summary>3,5", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM</summary>
|
||||
NEC_35_HD_15,
|
||||
|
||||
// SHARP standard floppy formats
|
||||
/// <summary>5,25", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, FM</summary>
|
||||
SHARP_525,
|
||||
/// <summary>3,5", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, FM</summary>
|
||||
SHARP_35,
|
||||
|
||||
// ECMA standards
|
||||
/// <summary>5,25", DS, DD, 80 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
ECMA_99_8,
|
||||
/// <summary>5,25", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
ECMA_99_15,
|
||||
/// <summary>5,25", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
ECMA_99_26,
|
||||
/// <summary>3,5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM</summary>
|
||||
ECMA_100,
|
||||
/// <summary>3,5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM</summary>
|
||||
ECMA_125,
|
||||
/// <summary>3,5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM</summary>
|
||||
ECMA_147,
|
||||
/// <summary>8", SS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM</summary>
|
||||
ECMA_54,
|
||||
/// <summary>8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM</summary>
|
||||
ECMA_59,
|
||||
/// <summary>5,25", SS, DD, 35 tracks, 9 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector</summary>
|
||||
ECMA_66,
|
||||
/// <summary>8", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
ECMA_69_8,
|
||||
/// <summary>8", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
ECMA_69_15,
|
||||
/// <summary>8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector</summary>
|
||||
ECMA_69_26,
|
||||
/// <summary>5,25", DS, DD, 40 tracks, 16 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector, track 0 side 1 = 16 sectors, 256 bytes/sector</summary>
|
||||
ECMA_70,
|
||||
/// <summary>5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector, track 0 side 1 = 16 sectors, 256 bytes/sector</summary>
|
||||
ECMA_78,
|
||||
/// <summary>5,25", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, FM</summary>
|
||||
ECMA_78_2,
|
||||
/// <summary>3,5", M.O., 250000 sectors, 512 bytes/sector</summary>
|
||||
ECMA_154,
|
||||
/// <summary>5,25", M.O., 940470 sectors, 512 bytes/sector</summary>
|
||||
ECMA_183_512,
|
||||
/// <summary>5,25", M.O., 520902 sectors, 1024 bytes/sector</summary>
|
||||
ECMA_183_1024,
|
||||
/// <summary>5,25", M.O., 1165600 sectors, 512 bytes/sector</summary>
|
||||
ECMA_184_512,
|
||||
/// <summary>5,25", M.O., 639200 sectors, 1024 bytes/sector</summary>
|
||||
ECMA_184_1024,
|
||||
/// <summary>3,5", M.O., 448500 sectors, 512 bytes/sector</summary>
|
||||
ECMA_201,
|
||||
|
||||
// FDFORMAT, non-standard floppy formats
|
||||
/// <summary>5,25", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM</summary>
|
||||
FDFORMAT_525_DD,
|
||||
/// <summary>5,25", DS, HD, 82 tracks, 17 spt, 512 bytes/sector, MFM</summary>
|
||||
FDFORMAT_525_HD,
|
||||
/// <summary>5,25", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM</summary>
|
||||
FDFORMAT_35_DD,
|
||||
/// <summary>5,25", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM</summary>
|
||||
FDFORMAT_35_HD,
|
||||
|
||||
// Generic hard disks
|
||||
GENERIC_HDD
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Track (as partitioning element) types.
|
||||
/// </summary>
|
||||
public enum TrackType
|
||||
{
|
||||
/// <summary>Audio track</summary>
|
||||
Audio,
|
||||
/// <summary>Data track (not any of the below defined ones)</summary>
|
||||
Data,
|
||||
/// <summary>Data track, compact disc mode 1</summary>
|
||||
CDMode1,
|
||||
/// <summary>Data track, compact disc mode 2, formless</summary>
|
||||
CDMode2Formless,
|
||||
/// <summary>Data track, compact disc mode 2, form 1</summary>
|
||||
CDMode2Form1,
|
||||
/// <summary>Data track, compact disc mode 2, form 2</summary>
|
||||
CDMode2Form2
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Track defining structure.
|
||||
/// </summary>
|
||||
public struct Track
|
||||
{
|
||||
/// <summary>Track number, 1-started</summary>
|
||||
public UInt32 TrackSequence;
|
||||
/// <summary>Partition type</summary>
|
||||
public TrackType TrackType;
|
||||
/// <summary>Track starting sector</summary>
|
||||
public UInt64 TrackStartSector;
|
||||
/// <summary>Track ending sector</summary>
|
||||
public UInt64 TrackEndSector;
|
||||
/// <summary>Track pre-gap</summary>
|
||||
public UInt64 TrackPregap;
|
||||
/// <summary>Session this track belongs to</summary>
|
||||
public UInt16 TrackSession;
|
||||
/// <summary>Information that does not find space in this struct</summary>
|
||||
public string TrackDescription;
|
||||
/// <summary>Indexes, 00 to 99 and sector offset</summary>
|
||||
public Dictionary<int, UInt64> Indexes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Session defining structure.
|
||||
/// </summary>
|
||||
public struct Session
|
||||
{
|
||||
/// <summary>Session number, 1-started</summary>
|
||||
public UInt16 SessionSequence;
|
||||
/// <summary>First track present on this session</summary>
|
||||
public UInt32 StartTrack;
|
||||
/// <summary>Last track present on this session</summary>
|
||||
public UInt32 EndTrack;
|
||||
/// <summary>First sector present on this session</summary>
|
||||
public UInt64 StartSector;
|
||||
/// <summary>Last sector present on this session</summary>
|
||||
public UInt64 EndSector;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metadata present for each sector (aka, "tag").
|
||||
/// </summary>
|
||||
public enum SectorTagType
|
||||
{
|
||||
/// <summary>Apple's GCR sector tags, 12 bytes</summary>
|
||||
AppleSectorTag,
|
||||
/// <summary>Sync frame from CD sector, 12 bytes</summary>
|
||||
CDSectorSync,
|
||||
/// <summary>CD sector header, 4 bytes</summary>
|
||||
CDSectorHeader,
|
||||
/// <summary>CD mode 2 sector subheader</summary>
|
||||
CDSectorSubHeader,
|
||||
/// <summary>CD sector EDC, 4 bytes</summary>
|
||||
CDSectorEDC,
|
||||
/// <summary>CD sector ECC P, 172 bytes</summary>
|
||||
CDSectorECC_P,
|
||||
/// <summary>CD sector ECC Q, 104 bytes</summary>
|
||||
CDSectorECC_Q,
|
||||
/// <summary>CD sector ECC (P and Q), 276 bytes</summary>
|
||||
CDSectorECC,
|
||||
/// <summary>CD sector subchannel, 96 bytes</summary>
|
||||
CDSectorSubchannel,
|
||||
/// <summary>CD track ISRC, string, 12 bytes</summary>
|
||||
CDTrackISRC,
|
||||
/// <summary>CD track text, string, 13 bytes</summary>
|
||||
CDTrackText,
|
||||
/// <summary>CD track flags, 1 byte</summary>
|
||||
CDTrackFlags,
|
||||
/// <summary>DVD sector copyright information</summary>
|
||||
DVD_CMI
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Metadata present for each disk.
|
||||
/// </summary>
|
||||
public enum DiskTagType
|
||||
{
|
||||
/// <summary>CD PMA</summary>
|
||||
CD_PMA,
|
||||
/// <summary>CD Adress-Time-In-Pregroove</summary>
|
||||
CD_ATIP,
|
||||
/// <summary>CD-Text</summary>
|
||||
CD_TEXT,
|
||||
/// <summary>CD Media Catalogue Number</summary>
|
||||
CD_MCN,
|
||||
/// <summary>DVD Burst Cutting Area</summary>
|
||||
DVD_BCA,
|
||||
/// <summary>DVD Physical Format Information</summary>
|
||||
DVD_PFI,
|
||||
/// <summary>DVD Copyright Management Information</summary>
|
||||
DVD_CMI,
|
||||
/// <summary>DVD Disc Manufacturer Information</summary>
|
||||
DVD_DMI
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Feature is supported by image but not implemented yet.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FeatureSupportedButNotImplementedImageException : Exception
|
||||
{
|
||||
public FeatureSupportedButNotImplementedImageException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
public FeatureSupportedButNotImplementedImageException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
protected FeatureSupportedButNotImplementedImageException(System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Feature is not supported by image.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FeatureUnsupportedImageException : Exception
|
||||
{
|
||||
public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
public FeatureUnsupportedImageException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
protected FeatureUnsupportedImageException(System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Feature is supported by image but not present on it.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FeatureNotPresentImageException : Exception
|
||||
{
|
||||
public FeatureNotPresentImageException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
public FeatureNotPresentImageException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
protected FeatureNotPresentImageException(System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Feature is supported by image but not by the disc it represents.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FeaturedNotSupportedByDiscImageException : Exception
|
||||
{
|
||||
public FeaturedNotSupportedByDiscImageException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
public FeaturedNotSupportedByDiscImageException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
protected FeaturedNotSupportedByDiscImageException(System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Corrupt, incorrect or unhandled feature found on image
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ImageNotSupportedException : Exception
|
||||
{
|
||||
public ImageNotSupportedException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
public ImageNotSupportedException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
protected ImageNotSupportedException(System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
}
|
||||
}
|
||||
1127
DiscImageChef/ImagePlugins/TeleDisk.cs
Normal file
1127
DiscImageChef/ImagePlugins/TeleDisk.cs
Normal file
File diff suppressed because it is too large
Load Diff
618
DiscImageChef/ImagePlugins/ZZZRawImage.cs
Normal file
618
DiscImageChef/ImagePlugins/ZZZRawImage.cs
Normal file
@@ -0,0 +1,618 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : ZZZRawImage.cs
|
||||
Version : 1.0
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
Component : Disc image plugins
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Manages raw image, that is, user data sector by sector copy.
|
||||
|
||||
--[ 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscImageChef.ImagePlugins
|
||||
{
|
||||
// Checked using several images and strings inside Apple's DiskImages.framework
|
||||
class ZZZRawImage : ImagePlugin
|
||||
{
|
||||
#region Internal variables
|
||||
|
||||
UInt64 imageSize;
|
||||
UInt64 sectors;
|
||||
UInt32 sectorSize;
|
||||
DateTime creationTime;
|
||||
DateTime modificationTime;
|
||||
string imageName;
|
||||
string rawImagePath;
|
||||
bool differentTrackZeroSize;
|
||||
#endregion
|
||||
|
||||
public ZZZRawImage(PluginBase Core)
|
||||
{
|
||||
Name = "Raw Disk Image";
|
||||
// Non-random UUID to recognize this specific plugin
|
||||
PluginUUID = new Guid("12345678-AAAA-BBBB-CCCC-123456789000");
|
||||
}
|
||||
|
||||
public override bool IdentifyImage(string imagePath)
|
||||
{
|
||||
FileInfo fi = new FileInfo(imagePath);
|
||||
|
||||
// Check if file is not multiple of 512
|
||||
if ((fi.Length % 512) != 0)
|
||||
{
|
||||
// Check known disk sizes with sectors smaller than 512
|
||||
switch (fi.Length)
|
||||
{
|
||||
case 81664:
|
||||
case 116480:
|
||||
case 242944:
|
||||
case 256256:
|
||||
case 287488:
|
||||
case 306432:
|
||||
case 495872:
|
||||
case 988416:
|
||||
case 995072:
|
||||
case 1021696:
|
||||
case 1146624:
|
||||
case 1177344:
|
||||
case 1222400:
|
||||
case 1304320:
|
||||
case 1255168:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OpenImage(string imagePath)
|
||||
{
|
||||
FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
FileInfo fi = new FileInfo(imagePath);
|
||||
string extension = Path.GetExtension(imagePath).ToLower();
|
||||
if (extension == ".iso" && (fi.Length % 2048) == 0)
|
||||
sectorSize = 2048;
|
||||
else
|
||||
{
|
||||
switch (fi.Length)
|
||||
{
|
||||
case 242944:
|
||||
case 256256:
|
||||
case 495872:
|
||||
case 92160:
|
||||
case 133120:
|
||||
sectorSize = 128;
|
||||
break;
|
||||
case 116480:
|
||||
case 287488: // T0S0 = 128bps
|
||||
case 988416: // T0S0 = 128bps
|
||||
case 995072: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 1021696: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 232960:
|
||||
case 143360:
|
||||
case 286720:
|
||||
case 512512:
|
||||
case 102400:
|
||||
case 204800:
|
||||
case 163840:
|
||||
case 327680:
|
||||
case 655360:
|
||||
case 80384: // T0S0 = 128bps
|
||||
case 325632: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 653312: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectorSize = 256;
|
||||
break;
|
||||
case 81664:
|
||||
sectorSize = 319;
|
||||
break;
|
||||
case 306432: // T0S0 = 128bps
|
||||
case 1146624: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 1177344: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectorSize = 512;
|
||||
break;
|
||||
case 1222400: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 1304320: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 1255168: // T0S0 = 128bps, T0S1 = 256bps
|
||||
case 1261568:
|
||||
case 1310720:
|
||||
sectorSize = 1024;
|
||||
break;
|
||||
default:
|
||||
sectorSize = 512;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
imageSize = (ulong)fi.Length;
|
||||
creationTime = fi.CreationTimeUtc;
|
||||
modificationTime = fi.LastWriteTimeUtc;
|
||||
imageName = Path.GetFileNameWithoutExtension(imagePath);
|
||||
differentTrackZeroSize = false;
|
||||
rawImagePath = imagePath;
|
||||
|
||||
switch (fi.Length)
|
||||
{
|
||||
case 242944:
|
||||
sectors = 1898;
|
||||
break;
|
||||
case 256256:
|
||||
sectors = 2002;
|
||||
break;
|
||||
case 495872:
|
||||
sectors = 3874;
|
||||
break;
|
||||
case 116480:
|
||||
sectors = 455;
|
||||
break;
|
||||
case 287488: // T0S0 = 128bps
|
||||
sectors = 1136;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 988416: // T0S0 = 128bps
|
||||
sectors = 3874;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 995072: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 3900;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1021696: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 4004;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 81664:
|
||||
sectors = 256;
|
||||
break;
|
||||
case 306432: // T0S0 = 128bps
|
||||
sectors = 618;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1146624: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 2272;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1177344: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 2332;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1222400: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 1236;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1304320: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 1316;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1255168: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 1268;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 80384: // T0S0 = 128bps
|
||||
sectors = 322;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 325632: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 1280;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 653312: // T0S0 = 128bps, T0S1 = 256bps
|
||||
sectors = 2560;
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
case 1880064: // IBM XDF, 3,5", real number of sectors
|
||||
sectors = 670;
|
||||
sectorSize = 8192; // Biggest sector size
|
||||
differentTrackZeroSize = true;
|
||||
break;
|
||||
default:
|
||||
sectors = imageSize / sectorSize;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ImageHasPartitions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override UInt64 GetImageSize()
|
||||
{
|
||||
return imageSize;
|
||||
}
|
||||
|
||||
public override UInt64 GetSectors()
|
||||
{
|
||||
return sectors;
|
||||
}
|
||||
|
||||
public override UInt32 GetSectorSize()
|
||||
{
|
||||
return sectorSize;
|
||||
}
|
||||
|
||||
public override byte[] ReadSector(UInt64 sectorAddress)
|
||||
{
|
||||
return ReadSectors(sectorAddress, 1);
|
||||
}
|
||||
|
||||
public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length)
|
||||
{
|
||||
if (differentTrackZeroSize)
|
||||
{
|
||||
throw new NotImplementedException("Not yet implemented");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sectorAddress > sectors - 1)
|
||||
throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
|
||||
|
||||
if (sectorAddress + length > sectors)
|
||||
throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
|
||||
|
||||
byte[] buffer = new byte[length * sectorSize];
|
||||
|
||||
FileStream stream = new FileStream(rawImagePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
stream.Seek((long)(sectorAddress * sectorSize), SeekOrigin.Begin);
|
||||
|
||||
stream.Read(buffer, 0, (int)(length * sectorSize));
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetImageFormat()
|
||||
{
|
||||
return "Raw disk image (sector by sector copy)";
|
||||
}
|
||||
|
||||
public override DateTime GetImageCreationTime()
|
||||
{
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public override DateTime GetImageLastModificationTime()
|
||||
{
|
||||
return modificationTime;
|
||||
}
|
||||
|
||||
public override string GetImageName()
|
||||
{
|
||||
return imageName;
|
||||
}
|
||||
|
||||
public override DiskType GetDiskType()
|
||||
{
|
||||
if (sectorSize == 2048)
|
||||
{
|
||||
if (sectors <= 360000)
|
||||
return DiskType.CD;
|
||||
if (sectors <= 2295104)
|
||||
return DiskType.DVDPR;
|
||||
if (sectors <= 2298496)
|
||||
return DiskType.DVDR;
|
||||
if (sectors <= 4171712)
|
||||
return DiskType.DVDRDL;
|
||||
if (sectors <= 4173824)
|
||||
return DiskType.DVDPRDL;
|
||||
if (sectors <= 24438784)
|
||||
return DiskType.BDR;
|
||||
if (sectors <= 62500864)
|
||||
return DiskType.BDRXL;
|
||||
return DiskType.Unknown;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (imageSize)
|
||||
{
|
||||
case 80384:
|
||||
return DiskType.ECMA_66;
|
||||
case 81664:
|
||||
return DiskType.IBM23FD;
|
||||
case 92160:
|
||||
return DiskType.ATARI_525_SD;
|
||||
case 102400:
|
||||
return DiskType.ACORN_525_SS_SD_40;
|
||||
case 116480:
|
||||
return DiskType.Apple32SS;
|
||||
case 133120:
|
||||
return DiskType.ATARI_525_ED;
|
||||
case 143360:
|
||||
return DiskType.Apple33SS;
|
||||
case 163840:
|
||||
return DiskType.DOS_525_SS_DD_8;
|
||||
case 184320:
|
||||
return DiskType.DOS_525_SS_DD_9;
|
||||
case 204800:
|
||||
return DiskType.ACORN_525_SS_SD_80;
|
||||
case 232960:
|
||||
return DiskType.Apple32DS;
|
||||
case 242944:
|
||||
return DiskType.IBM33FD_128;
|
||||
case 256256:
|
||||
return DiskType.ECMA_54;
|
||||
case 286720:
|
||||
return DiskType.Apple33DS;
|
||||
case 287488:
|
||||
return DiskType.IBM33FD_256;
|
||||
case 306432:
|
||||
return DiskType.IBM33FD_512;
|
||||
case 325632:
|
||||
return DiskType.ECMA_70;
|
||||
case 327680:
|
||||
return DiskType.DOS_525_DS_DD_8;
|
||||
case 368640:
|
||||
return DiskType.DOS_525_DS_DD_9;
|
||||
case 409600:
|
||||
return DiskType.AppleSonySS;
|
||||
case 495872:
|
||||
return DiskType.IBM43FD_128;
|
||||
case 512512:
|
||||
return DiskType.ECMA_59;
|
||||
case 653312:
|
||||
return DiskType.ECMA_78;
|
||||
case 655360:
|
||||
return DiskType.ACORN_525_DS_DD;
|
||||
case 737280:
|
||||
return DiskType.DOS_35_DS_DD_9;
|
||||
case 819200:
|
||||
return DiskType.AppleSonyDS;
|
||||
case 839680:
|
||||
return DiskType.FDFORMAT_35_DD;
|
||||
case 901120:
|
||||
return DiskType.CBM_AMIGA_35_DD;
|
||||
case 988416:
|
||||
return DiskType.IBM43FD_256;
|
||||
case 995072:
|
||||
return DiskType.IBM53FD_256;
|
||||
case 1021696:
|
||||
return DiskType.ECMA_99_26;
|
||||
case 1146624:
|
||||
return DiskType.IBM53FD_512;
|
||||
case 1177344:
|
||||
return DiskType.ECMA_99_15;
|
||||
case 1222400:
|
||||
return DiskType.IBM53FD_1024;
|
||||
case 1228800:
|
||||
return DiskType.DOS_525_HD;
|
||||
case 1255168:
|
||||
return DiskType.ECMA_69_8;
|
||||
case 1261568:
|
||||
return DiskType.NEC_8_DD;
|
||||
case 1304320:
|
||||
return DiskType.ECMA_99_8;
|
||||
case 1310720:
|
||||
return DiskType.NEC_525_HD;
|
||||
case 1427456:
|
||||
return DiskType.FDFORMAT_525_HD;
|
||||
case 1474560:
|
||||
return DiskType.DOS_35_HD;
|
||||
case 1720320:
|
||||
return DiskType.DMF;
|
||||
case 1763328:
|
||||
return DiskType.FDFORMAT_35_HD;
|
||||
case 1802240:
|
||||
return DiskType.CBM_AMIGA_35_HD;
|
||||
case 1880064:
|
||||
return DiskType.XDF_35;
|
||||
case 1884160:
|
||||
return DiskType.XDF_35;
|
||||
case 2949120:
|
||||
return DiskType.DOS_35_ED;
|
||||
case 128000000:
|
||||
return DiskType.ECMA_154;
|
||||
case 229632000:
|
||||
return DiskType.ECMA_201;
|
||||
case 481520640:
|
||||
return DiskType.ECMA_183_512;
|
||||
case 533403648:
|
||||
return DiskType.ECMA_183_1024;
|
||||
case 596787200:
|
||||
return DiskType.ECMA_184_512;
|
||||
case 654540800:
|
||||
return DiskType.ECMA_184_1024;
|
||||
default:
|
||||
return DiskType.GENERIC_HDD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Unsupported features
|
||||
|
||||
public override byte[] ReadSectorTag(UInt64 sectorAddress, SectorTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorLong(UInt64 sectorAddress)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageVersion()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageApplication()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageApplicationVersion()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadDiskTag(DiskTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageCreator()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetImageComments()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskManufacturer()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskModel()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskSerialNumber()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskBarcode()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDiskPartNumber()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override int GetDiskSequence()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override int GetLastDiskSequence()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDriveManufacturer()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDriveModel()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override string GetDriveSerialNumber()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<PartPlugins.Partition> GetPartitions()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Track> GetTracks()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Track> GetSessionTracks(Session session)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Track> GetSessionTracks(UInt16 session)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override List<Session> GetSessions()
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSector(UInt64 sectorAddress, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorTag(UInt64 sectorAddress, UInt32 track, SectorTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, UInt32 track, SectorTagType tag)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorLong(UInt64 sectorAddress, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length, UInt32 track)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
#endregion Unsupported features
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user