2017-08-22 15:46:02 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : CisCopy.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : Disk image plugins.
|
2017-08-22 15:46:02 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-08-23 01:29:45 +01:00
|
|
|
|
// Manages CisCopy disk images.
|
2017-08-22 15:46:02 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2017-08-22 15:46:02 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-08-23 01:29:45 +01:00
|
|
|
|
|
2017-08-22 15:46:02 +01:00
|
|
|
|
using System;
|
2017-08-23 01:29:45 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using DiscImageChef.CommonTypes;
|
|
|
|
|
|
using DiscImageChef.Console;
|
|
|
|
|
|
using DiscImageChef.Filters;
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
namespace DiscImageChef.DiscImages
|
2017-08-22 15:46:02 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
/* This is a very simple format created by a German application called CisCopy, aka CCOPY.EXE, with extension .DCF.
|
|
|
|
|
|
* First byte indicates the floppy type, limited to standard formats.
|
|
|
|
|
|
* Indeed if the floppy is not DOS formatted, user must choose from the list of supported formats manually.
|
|
|
|
|
|
* Next 80 bytes (for 5.25" DD disks) or 160 bytes (for 5.25" HD and 3.5" disks) indicate if a track has been copied
|
|
|
|
|
|
* or not.
|
|
|
|
|
|
* It offers three copy methods:
|
|
|
|
|
|
* a) All, copies all tracks
|
|
|
|
|
|
* b) FAT, copies all tracks which contain sectors marked as sued by FAT
|
|
|
|
|
|
* c) "Belelung" similarly to FAT. On some disk tests FAT cuts data, while belelung does not.
|
|
|
|
|
|
* Finally, next byte indicates compression:
|
|
|
|
|
|
* 0) No compression
|
|
|
|
|
|
* 1) Normal compression, algorithm unknown
|
|
|
|
|
|
* 2) High compression, algorithm unknown
|
|
|
|
|
|
* Then the data for whole tracks follow.
|
|
|
|
|
|
*/
|
|
|
|
|
|
public class CisCopy : ImagePlugin
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Internal enumerations
|
|
|
|
|
|
enum DiskType : byte
|
|
|
|
|
|
{
|
|
|
|
|
|
MD1DD8 = 1,
|
|
|
|
|
|
MD1DD = 2,
|
|
|
|
|
|
MD2DD8 = 3,
|
|
|
|
|
|
MD2DD = 4,
|
|
|
|
|
|
MF2DD = 5,
|
|
|
|
|
|
MD2HD = 6,
|
|
|
|
|
|
MF2HD = 7
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum Compression : byte
|
|
|
|
|
|
{
|
|
|
|
|
|
None = 0,
|
|
|
|
|
|
Normal = 1,
|
|
|
|
|
|
High = 2
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum TrackType : byte
|
|
|
|
|
|
{
|
|
|
|
|
|
Copied = 0x4C,
|
|
|
|
|
|
Omitted = 0xFA,
|
|
|
|
|
|
OmittedAlternate = 0xFE
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion Internal enumeration
|
|
|
|
|
|
|
|
|
|
|
|
#region Internal variables
|
|
|
|
|
|
byte[] decodedDisk;
|
|
|
|
|
|
#endregion Internal variables
|
|
|
|
|
|
|
|
|
|
|
|
public CisCopy()
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "CisCopy Disk Image (DC-File)";
|
2017-12-20 17:15:26 +00:00
|
|
|
|
PluginUuid = new Guid("EDF20CC7-6012-49E2-9E92-663A53E42130");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
ImageInfo = new ImageInfo();
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.ReadableSectorTags = new List<SectorTagType>();
|
|
|
|
|
|
ImageInfo.ReadableMediaTags = new List<MediaTagType>();
|
|
|
|
|
|
ImageInfo.ImageHasPartitions = false;
|
|
|
|
|
|
ImageInfo.ImageHasSessions = false;
|
|
|
|
|
|
ImageInfo.ImageVersion = null;
|
|
|
|
|
|
ImageInfo.ImageApplication = null;
|
|
|
|
|
|
ImageInfo.ImageApplicationVersion = null;
|
|
|
|
|
|
ImageInfo.ImageCreator = null;
|
|
|
|
|
|
ImageInfo.ImageComments = null;
|
|
|
|
|
|
ImageInfo.MediaManufacturer = null;
|
|
|
|
|
|
ImageInfo.MediaModel = null;
|
|
|
|
|
|
ImageInfo.MediaSerialNumber = null;
|
|
|
|
|
|
ImageInfo.MediaBarcode = null;
|
|
|
|
|
|
ImageInfo.MediaPartNumber = null;
|
|
|
|
|
|
ImageInfo.MediaSequence = 0;
|
|
|
|
|
|
ImageInfo.LastMediaSequence = 0;
|
|
|
|
|
|
ImageInfo.DriveManufacturer = null;
|
|
|
|
|
|
ImageInfo.DriveModel = null;
|
|
|
|
|
|
ImageInfo.DriveSerialNumber = null;
|
|
|
|
|
|
ImageInfo.DriveFirmwareRevision = null;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Public methods
|
|
|
|
|
|
public override bool IdentifyImage(Filter imageFilter)
|
|
|
|
|
|
{
|
|
|
|
|
|
Stream stream = imageFilter.GetDataForkStream();
|
|
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
|
|
|
|
|
|
|
DiskType type = (DiskType)stream.ReadByte();
|
2017-12-21 16:07:20 +00:00
|
|
|
|
byte tracks;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DiskType.MD1DD8:
|
|
|
|
|
|
case DiskType.MD1DD:
|
|
|
|
|
|
case DiskType.MD2DD8:
|
|
|
|
|
|
case DiskType.MD2DD:
|
|
|
|
|
|
tracks = 80;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2DD:
|
|
|
|
|
|
case DiskType.MD2HD:
|
|
|
|
|
|
case DiskType.MF2HD:
|
|
|
|
|
|
tracks = 160;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default: return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trackBytes = new byte[tracks];
|
|
|
|
|
|
stream.Read(trackBytes, 0, tracks);
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < tracks; i++)
|
|
|
|
|
|
if(trackBytes[i] != (byte)TrackType.Copied && trackBytes[i] != (byte)TrackType.Omitted &&
|
|
|
|
|
|
trackBytes[i] != (byte)TrackType.OmittedAlternate) return false;
|
|
|
|
|
|
|
|
|
|
|
|
Compression cmpr = (Compression)stream.ReadByte();
|
|
|
|
|
|
|
|
|
|
|
|
if(cmpr != Compression.None && cmpr != Compression.Normal && cmpr != Compression.High) return false;
|
|
|
|
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DiskType.MD1DD8:
|
|
|
|
|
|
if(stream.Length > 40 * 1 * 8 * 512 + 82) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD1DD:
|
|
|
|
|
|
if(stream.Length > 40 * 1 * 9 * 512 + 82) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2DD8:
|
|
|
|
|
|
if(stream.Length > 40 * 2 * 8 * 512 + 82) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2DD:
|
|
|
|
|
|
if(stream.Length > 40 * 2 * 9 * 512 + 82) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2DD:
|
|
|
|
|
|
if(stream.Length > 80 * 2 * 9 * 512 + 162) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2HD:
|
|
|
|
|
|
if(stream.Length > 80 * 2 * 15 * 512 + 162) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2HD:
|
|
|
|
|
|
if(stream.Length > 80 * 2 * 18 * 512 + 162) return false;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool OpenImage(Filter imageFilter)
|
|
|
|
|
|
{
|
|
|
|
|
|
Stream stream = imageFilter.GetDataForkStream();
|
|
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
|
MemoryStream decodedImage;
|
|
|
|
|
|
|
|
|
|
|
|
DiskType type = (DiskType)stream.ReadByte();
|
2017-12-21 16:07:20 +00:00
|
|
|
|
byte tracks;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DiskType.MD1DD8:
|
|
|
|
|
|
case DiskType.MD1DD:
|
|
|
|
|
|
case DiskType.MD2DD8:
|
|
|
|
|
|
case DiskType.MD2DD:
|
|
|
|
|
|
tracks = 80;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2DD:
|
|
|
|
|
|
case DiskType.MD2HD:
|
|
|
|
|
|
case DiskType.MF2HD:
|
|
|
|
|
|
tracks = 160;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default: throw new ImageNotSupportedException(string.Format("Incorrect disk type {0}", (byte)type));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
byte[] trackBytes = new byte[tracks];
|
|
|
|
|
|
stream.Read(trackBytes, 0, tracks);
|
|
|
|
|
|
|
|
|
|
|
|
Compression cmpr = (Compression)stream.ReadByte();
|
|
|
|
|
|
|
|
|
|
|
|
if(cmpr != Compression.None)
|
|
|
|
|
|
throw new FeatureSupportedButNotImplementedImageException("Compressed images are not supported.");
|
|
|
|
|
|
|
|
|
|
|
|
int tracksize = 0;
|
|
|
|
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DiskType.MD1DD8:
|
|
|
|
|
|
case DiskType.MD2DD8:
|
|
|
|
|
|
tracksize = 8 * 512;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD1DD:
|
|
|
|
|
|
case DiskType.MD2DD:
|
|
|
|
|
|
case DiskType.MF2DD:
|
|
|
|
|
|
tracksize = 9 * 512;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2HD:
|
|
|
|
|
|
tracksize = 15 * 512;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2HD:
|
|
|
|
|
|
tracksize = 18 * 512;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int headstep = 1;
|
|
|
|
|
|
if(type == DiskType.MD1DD || type == DiskType.MD1DD8) headstep = 2;
|
|
|
|
|
|
|
|
|
|
|
|
decodedImage = new MemoryStream();
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < tracks; i += headstep)
|
|
|
|
|
|
{
|
|
|
|
|
|
byte[] track = new byte[tracksize];
|
|
|
|
|
|
|
|
|
|
|
|
if((TrackType)trackBytes[i] == TrackType.Copied) stream.Read(track, 0, tracksize);
|
|
|
|
|
|
else ArrayHelpers.ArrayFill(track, (byte)0xF6);
|
|
|
|
|
|
|
|
|
|
|
|
decodedImage.Write(track, 0, tracksize);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite);
|
|
|
|
|
|
debugStream.Write(decodedImage.ToArray(), 0, (int)decodedImage.Length);
|
|
|
|
|
|
debugStream.Close();
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.ImageApplication = "CisCopy";
|
|
|
|
|
|
ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
|
|
|
|
|
|
ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
|
|
|
|
|
|
ImageInfo.ImageName = imageFilter.GetFilename();
|
|
|
|
|
|
ImageInfo.ImageSize = (ulong)(stream.Length - 2 - trackBytes.Length);
|
|
|
|
|
|
ImageInfo.SectorSize = 512;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DiskType.MD1DD8:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_525_SS_DD_8;
|
|
|
|
|
|
ImageInfo.Sectors = 40 * 1 * 8;
|
|
|
|
|
|
ImageInfo.Heads = 1;
|
|
|
|
|
|
ImageInfo.Cylinders = 40;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 8;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2DD8:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_525_DS_DD_8;
|
|
|
|
|
|
ImageInfo.Sectors = 40 * 2 * 8;
|
|
|
|
|
|
ImageInfo.Heads = 2;
|
|
|
|
|
|
ImageInfo.Cylinders = 40;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 8;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD1DD:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_525_SS_DD_9;
|
|
|
|
|
|
ImageInfo.Sectors = 40 * 1 * 9;
|
|
|
|
|
|
ImageInfo.Heads = 1;
|
|
|
|
|
|
ImageInfo.Cylinders = 40;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 9;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2DD:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_525_DS_DD_9;
|
|
|
|
|
|
ImageInfo.Sectors = 40 * 2 * 9;
|
|
|
|
|
|
ImageInfo.Heads = 2;
|
|
|
|
|
|
ImageInfo.Cylinders = 40;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 9;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2DD:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_35_DS_DD_9;
|
|
|
|
|
|
ImageInfo.Sectors = 80 * 2 * 9;
|
|
|
|
|
|
ImageInfo.Heads = 2;
|
|
|
|
|
|
ImageInfo.Cylinders = 80;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 9;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MD2HD:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_525_HD;
|
|
|
|
|
|
ImageInfo.Sectors = 80 * 2 * 15;
|
|
|
|
|
|
ImageInfo.Heads = 2;
|
|
|
|
|
|
ImageInfo.Cylinders = 80;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 15;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case DiskType.MF2HD:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.MediaType = MediaType.DOS_35_HD;
|
|
|
|
|
|
ImageInfo.Sectors = 80 * 2 * 18;
|
|
|
|
|
|
ImageInfo.Heads = 2;
|
|
|
|
|
|
ImageInfo.Cylinders = 80;
|
|
|
|
|
|
ImageInfo.SectorsPerTrack = 18;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
decodedDisk = decodedImage.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
decodedImage.Close();
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
DicConsole.VerboseWriteLine("CisCopy image contains a disk of type {0}", ImageInfo.MediaType);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifySector(ulong sectorAddress)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifySector(ulong sectorAddress, uint track)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
|
|
|
|
|
|
out List<ulong> unknownLbas)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
failingLbas = new List<ulong>();
|
|
|
|
|
|
unknownLbas = new List<ulong>();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
|
|
|
|
|
|
out List<ulong> unknownLbas)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
failingLbas = new List<ulong>();
|
|
|
|
|
|
unknownLbas = new List<ulong>();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool? VerifyMediaImage()
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool ImageHasPartitions()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageHasPartitions;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override ulong GetImageSize()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageSize;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override ulong GetSectors()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.Sectors;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override uint GetSectorSize()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.SectorSize;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSector(ulong sectorAddress)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ReadSectors(sectorAddress, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectors(ulong sectorAddress, uint length)
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(sectorAddress > ImageInfo.Sectors - 1)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(sectorAddress + length > ImageInfo.Sectors)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
byte[] buffer = new byte[length * ImageInfo.SectorSize];
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.SectorSize, buffer, 0,
|
|
|
|
|
|
length * ImageInfo.SectorSize);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageFormat()
|
|
|
|
|
|
{
|
|
|
|
|
|
return "CisCopy";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageVersion()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageVersion;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageApplication()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageApplication;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageApplicationVersion()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageApplicationVersion;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DateTime GetImageCreationTime()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageCreationTime;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DateTime GetImageLastModificationTime()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageLastModificationTime;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageName()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageName;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override MediaType GetMediaType()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaType;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageCreator()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageCreator;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetImageComments()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.ImageComments;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetMediaManufacturer()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaManufacturer;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetMediaModel()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaModel;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetMediaSerialNumber()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaSerialNumber;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetMediaBarcode()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaBarcode;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetMediaPartNumber()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaPartNumber;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetMediaSequence()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.MediaSequence;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetLastDiskSequence()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.LastMediaSequence;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDriveManufacturer()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.DriveManufacturer;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDriveModel()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.DriveModel;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string GetDriveSerialNumber()
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
return ImageInfo.DriveSerialNumber;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
#endregion Public methods
|
|
|
|
|
|
|
|
|
|
|
|
#region Unsupported features
|
|
|
|
|
|
public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorLong(ulong sectorAddress)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorsLong(ulong sectorAddress, uint length)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadDiskTag(MediaTagType tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override List<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(ushort 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(ulong sectorAddress, uint track)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorLong(ulong sectorAddress, uint track)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion Unsupported features
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|