2014-06-07 23:32:59 +01:00
|
|
|
|
/***************************************************************************
|
2014-06-15 23:39:34 +01:00
|
|
|
|
The Disc Image Chef
|
2014-06-07 23:32:59 +01:00
|
|
|
|
----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2015-11-23 21:44:58 +00:00
|
|
|
|
using DiscImageChef.CommonTypes;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
|
2014-06-15 23:39:34 +01:00
|
|
|
|
namespace DiscImageChef.ImagePlugins
|
2014-06-07 23:32:59 +01:00
|
|
|
|
{
|
|
|
|
|
|
// Checked using several images and strings inside Apple's DiskImages.framework
|
|
|
|
|
|
class ZZZRawImage : ImagePlugin
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Internal variables
|
2014-08-25 05:00:25 +01:00
|
|
|
|
|
2014-06-07 23:32:59 +01:00
|
|
|
|
string rawImagePath;
|
|
|
|
|
|
bool differentTrackZeroSize;
|
2014-08-25 05:00:25 +01:00
|
|
|
|
|
2014-06-07 23:32:59 +01:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2015-10-05 19:45:07 +01:00
|
|
|
|
public ZZZRawImage()
|
2014-06-07 23:32:59 +01:00
|
|
|
|
{
|
|
|
|
|
|
Name = "Raw Disk Image";
|
|
|
|
|
|
// Non-random UUID to recognize this specific plugin
|
|
|
|
|
|
PluginUUID = new Guid("12345678-AAAA-BBBB-CCCC-123456789000");
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo = new ImageInfo();
|
|
|
|
|
|
ImageInfo.readableSectorTags = new List<SectorTagType>();
|
|
|
|
|
|
ImageInfo.readableDiskTags = new List<DiskTagType>();
|
|
|
|
|
|
ImageInfo.imageHasPartitions = false;
|
|
|
|
|
|
ImageInfo.imageHasSessions = false;
|
|
|
|
|
|
ImageInfo.imageVersion = null;
|
|
|
|
|
|
ImageInfo.imageApplication = null;
|
|
|
|
|
|
ImageInfo.imageApplicationVersion = null;
|
|
|
|
|
|
ImageInfo.imageCreator = null;
|
|
|
|
|
|
ImageInfo.imageComments = null;
|
|
|
|
|
|
ImageInfo.diskManufacturer = null;
|
|
|
|
|
|
ImageInfo.diskModel = null;
|
|
|
|
|
|
ImageInfo.diskSerialNumber = null;
|
|
|
|
|
|
ImageInfo.diskBarcode = null;
|
|
|
|
|
|
ImageInfo.diskPartNumber = null;
|
|
|
|
|
|
ImageInfo.diskSequence = 0;
|
|
|
|
|
|
ImageInfo.lastDiskSequence = 0;
|
|
|
|
|
|
ImageInfo.driveManufacturer = null;
|
|
|
|
|
|
ImageInfo.driveModel = null;
|
|
|
|
|
|
ImageInfo.driveSerialNumber = null;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2014-07-03 18:31:27 +01:00
|
|
|
|
stream.Close();
|
2014-06-07 23:32:59 +01:00
|
|
|
|
|
|
|
|
|
|
FileInfo fi = new FileInfo(imagePath);
|
|
|
|
|
|
string extension = Path.GetExtension(imagePath).ToLower();
|
|
|
|
|
|
if (extension == ".iso" && (fi.Length % 2048) == 0)
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 2048;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (fi.Length)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 242944:
|
|
|
|
|
|
case 256256:
|
|
|
|
|
|
case 495872:
|
|
|
|
|
|
case 92160:
|
|
|
|
|
|
case 133120:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 128;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
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
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 256;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 81664:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 319;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 306432: // T0S0 = 128bps
|
|
|
|
|
|
case 1146624: // T0S0 = 128bps, T0S1 = 256bps
|
|
|
|
|
|
case 1177344: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 512;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 1222400: // T0S0 = 128bps, T0S1 = 256bps
|
|
|
|
|
|
case 1304320: // T0S0 = 128bps, T0S1 = 256bps
|
|
|
|
|
|
case 1255168: // T0S0 = 128bps, T0S1 = 256bps
|
|
|
|
|
|
case 1261568:
|
|
|
|
|
|
case 1310720:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 1024;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectorSize = 512;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.imageSize = (ulong)fi.Length;
|
|
|
|
|
|
ImageInfo.imageCreationTime = fi.CreationTimeUtc;
|
|
|
|
|
|
ImageInfo.imageLastModificationTime = fi.LastWriteTimeUtc;
|
|
|
|
|
|
ImageInfo.imageName = Path.GetFileNameWithoutExtension(imagePath);
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = false;
|
|
|
|
|
|
rawImagePath = imagePath;
|
|
|
|
|
|
|
|
|
|
|
|
switch (fi.Length)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 242944:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 1898;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 256256:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 2002;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 495872:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 3874;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 116480:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 455;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 287488: // T0S0 = 128bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 1136;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 988416: // T0S0 = 128bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 3874;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 995072: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 3900;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1021696: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 4004;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 81664:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 256;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case 306432: // T0S0 = 128bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 618;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1146624: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 2272;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1177344: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 2332;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1222400: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 1236;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1304320: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 1316;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1255168: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 1268;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 80384: // T0S0 = 128bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 322;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 325632: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 1280;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 653312: // T0S0 = 128bps, T0S1 = 256bps
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 2560;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1880064: // IBM XDF, 3,5", real number of sectors
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = 670;
|
|
|
|
|
|
ImageInfo.sectorSize = 8192; // Biggest sector size
|
2014-06-07 23:32:59 +01:00
|
|
|
|
differentTrackZeroSize = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-28 19:29:18 +01:00
|
|
|
|
ImageInfo.diskType = CalculateDiskType();
|
2014-08-24 17:46:29 +01:00
|
|
|
|
|
2015-12-05 17:21:47 +00:00
|
|
|
|
switch (ImageInfo.diskType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DiskType.CD:
|
|
|
|
|
|
case DiskType.DVDPR:
|
|
|
|
|
|
case DiskType.DVDR:
|
|
|
|
|
|
case DiskType.DVDRDL:
|
|
|
|
|
|
case DiskType.DVDPRDL:
|
|
|
|
|
|
case DiskType.BDR:
|
|
|
|
|
|
case DiskType.BDRXL:
|
|
|
|
|
|
ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool ImageHasPartitions()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageHasPartitions;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override UInt64 GetImageSize()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageSize;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override UInt64 GetSectors()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.sectors;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override UInt32 GetSectorSize()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.sectorSize;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (sectorAddress > ImageInfo.sectors - 1)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
|
|
|
|
|
|
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (sectorAddress + length > ImageInfo.sectors)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
|
|
|
|
|
|
|
2014-08-28 19:29:18 +01:00
|
|
|
|
byte[] buffer = new byte[length * ImageInfo.sectorSize];
|
2014-06-07 23:32:59 +01:00
|
|
|
|
|
|
|
|
|
|
FileStream stream = new FileStream(rawImagePath, FileMode.Open, FileAccess.Read);
|
|
|
|
|
|
|
2014-08-28 19:29:18 +01:00
|
|
|
|
stream.Seek((long)(sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin);
|
2014-06-07 23:32:59 +01:00
|
|
|
|
|
2014-08-28 19:29:18 +01:00
|
|
|
|
stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize));
|
2014-06-07 23:32:59 +01:00
|
|
|
|
|
2014-07-03 18:31:27 +01:00
|
|
|
|
stream.Close();
|
|
|
|
|
|
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageFormat()
|
|
|
|
|
|
{
|
|
|
|
|
|
return "Raw disk image (sector by sector copy)";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DateTime GetImageCreationTime()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageCreationTime;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DateTime GetImageLastModificationTime()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageLastModificationTime;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageName()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageName;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DiskType GetDiskType()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskType;
|
2014-08-24 17:46:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-25 05:00:25 +01:00
|
|
|
|
public override bool? VerifySector(UInt64 sectorAddress)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifySector(UInt64 sectorAddress, UInt32 track)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifySectors(UInt64 sectorAddress, UInt32 length, out List<UInt64> FailingLBAs, out List<UInt64> UnknownLBAs)
|
|
|
|
|
|
{
|
|
|
|
|
|
FailingLBAs = new List<UInt64>();
|
|
|
|
|
|
UnknownLBAs = new List<UInt64>();
|
|
|
|
|
|
|
|
|
|
|
|
for (UInt64 i = sectorAddress; i < sectorAddress + length; i++)
|
|
|
|
|
|
UnknownLBAs.Add(i);
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifySectors(UInt64 sectorAddress, UInt32 length, UInt32 track, out List<UInt64> FailingLBAs, out List<UInt64> UnknownLBAs)
|
|
|
|
|
|
{
|
|
|
|
|
|
FailingLBAs = new List<UInt64>();
|
|
|
|
|
|
UnknownLBAs = new List<UInt64>();
|
|
|
|
|
|
|
|
|
|
|
|
for (UInt64 i = sectorAddress; i < sectorAddress + length; i++)
|
|
|
|
|
|
UnknownLBAs.Add(i);
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifyDiskImage()
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-24 17:46:29 +01:00
|
|
|
|
#region Private methods
|
2014-08-25 05:00:25 +01:00
|
|
|
|
|
2014-08-28 19:02:45 +01:00
|
|
|
|
DiskType CalculateDiskType()
|
2014-08-24 17:46:29 +01:00
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectorSize == 2048)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 360000)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.CD;
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 2295104)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.DVDPR;
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 2298496)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.DVDR;
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 4171712)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.DVDRDL;
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 4173824)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.DVDPRDL;
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 24438784)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.BDR;
|
2014-08-28 19:29:18 +01:00
|
|
|
|
if (ImageInfo.sectors <= 62500864)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
return DiskType.BDRXL;
|
|
|
|
|
|
return DiskType.Unknown;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
switch (ImageInfo.imageSize)
|
2014-06-07 23:32:59 +01:00
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-08-25 05:00:25 +01:00
|
|
|
|
|
2014-08-24 17:46:29 +01:00
|
|
|
|
#endregion
|
2014-06-07 23:32:59 +01:00
|
|
|
|
|
|
|
|
|
|
#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()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageVersion;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageApplication()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageApplication;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageApplicationVersion()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageApplicationVersion;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadDiskTag(DiskTagType tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageCreator()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageCreator;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageComments()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.imageComments;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDiskManufacturer()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskManufacturer;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDiskModel()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskModel;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDiskSerialNumber()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskSerialNumber;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDiskBarcode()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskBarcode;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDiskPartNumber()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskPartNumber;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetDiskSequence()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.diskSequence;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetLastDiskSequence()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.lastDiskSequence;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDriveManufacturer()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.driveManufacturer;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDriveModel()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.driveModel;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDriveSerialNumber()
|
|
|
|
|
|
{
|
2014-08-28 19:29:18 +01:00
|
|
|
|
return ImageInfo.driveSerialNumber;
|
2014-06-07 23:32:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-10-05 19:45:07 +01:00
|
|
|
|
public override List<CommonTypes.Partition> GetPartitions()
|
2014-06-07 23:32:59 +01:00
|
|
|
|
{
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|