2017-06-22 01:11:50 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : SaveDskF.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : Disk image plugins.
|
2017-06-22 01:11:50 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-06-22 16:20:49 +01:00
|
|
|
|
// Manages IBM SaveDskF disk images.
|
2017-06-22 01:11:50 +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-06-22 01:11:50 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-06-22 16:20:49 +01:00
|
|
|
|
|
2017-06-22 01:11:50 +01:00
|
|
|
|
using System;
|
2017-06-22 16:20:49 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using DiscImageChef.CommonTypes;
|
|
|
|
|
|
using DiscImageChef.Console;
|
|
|
|
|
|
using DiscImageChef.Filters;
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
namespace DiscImageChef.DiscImages
|
2017-06-22 01:11:50 +01:00
|
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
|
public class SaveDskF : IMediaImage
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-28 04:57:26 +00:00
|
|
|
|
const ushort SDF_MAGIC_OLD = 0x58AA;
|
|
|
|
|
|
const ushort SDF_MAGIC = 0x59AA;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
const ushort SDF_MAGIC_COMPRESSED = 0x5AAA;
|
2017-12-28 04:57:26 +00:00
|
|
|
|
uint calculatedChk;
|
|
|
|
|
|
byte[] decodedDisk;
|
2017-12-24 00:12:31 +00:00
|
|
|
|
|
|
|
|
|
|
SaveDskFHeader header;
|
2017-12-28 04:57:26 +00:00
|
|
|
|
ImageInfo imageInfo;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
public SaveDskF()
|
|
|
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo = new ImageInfo
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-28 04:57:26 +00:00
|
|
|
|
ReadableSectorTags = new List<SectorTagType>(),
|
|
|
|
|
|
ReadableMediaTags = new List<MediaTagType>(),
|
|
|
|
|
|
HasPartitions = false,
|
|
|
|
|
|
HasSessions = false,
|
|
|
|
|
|
Version = null,
|
|
|
|
|
|
Application = null,
|
|
|
|
|
|
ApplicationVersion = null,
|
|
|
|
|
|
Creator = null,
|
|
|
|
|
|
Comments = null,
|
|
|
|
|
|
MediaManufacturer = null,
|
|
|
|
|
|
MediaModel = null,
|
|
|
|
|
|
MediaSerialNumber = null,
|
|
|
|
|
|
MediaBarcode = null,
|
|
|
|
|
|
MediaPartNumber = null,
|
|
|
|
|
|
MediaSequence = 0,
|
|
|
|
|
|
LastMediaSequence = 0,
|
|
|
|
|
|
DriveManufacturer = null,
|
|
|
|
|
|
DriveModel = null,
|
|
|
|
|
|
DriveSerialNumber = null,
|
2017-12-20 17:15:26 +00:00
|
|
|
|
DriveFirmwareRevision = null
|
2017-12-19 20:33:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
public string Name => "IBM SaveDskF";
|
|
|
|
|
|
public Guid Id => new Guid("288CE058-1A51-4034-8C45-5A256CAE1461");
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public ImageInfo Info => imageInfo;
|
2017-12-26 02:51:10 +00:00
|
|
|
|
|
2017-12-28 19:56:36 +00:00
|
|
|
|
public string Format => "IBM SaveDskF";
|
2017-12-26 06:05:12 +00:00
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Partition> Partitions =>
|
2017-12-26 02:51:10 +00:00
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Track> Tracks =>
|
2017-12-26 02:51:10 +00:00
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Session> Sessions =>
|
2017-12-26 02:51:10 +00:00
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
|
2017-12-28 19:56:36 +00:00
|
|
|
|
public bool Identify(IFilter imageFilter)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
Stream stream = imageFilter.GetDataForkStream();
|
|
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
|
if(stream.Length < 41) return false;
|
|
|
|
|
|
|
|
|
|
|
|
byte[] hdr = new byte[40];
|
|
|
|
|
|
stream.Read(hdr, 0, 40);
|
|
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
header = new SaveDskFHeader();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
IntPtr hdrPtr = Marshal.AllocHGlobal(40);
|
|
|
|
|
|
Marshal.Copy(hdr, 0, hdrPtr, 40);
|
|
|
|
|
|
header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader));
|
|
|
|
|
|
Marshal.FreeHGlobal(hdrPtr);
|
|
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
return (header.magic == SDF_MAGIC || header.magic == SDF_MAGIC_COMPRESSED ||
|
|
|
|
|
|
header.magic == SDF_MAGIC_OLD) && header.fatCopies <= 2 && header.padding == 0 &&
|
|
|
|
|
|
header.commentOffset < stream.Length && header.dataOffset < stream.Length;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-28 19:56:36 +00:00
|
|
|
|
public bool Open(IFilter imageFilter)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
Stream stream = imageFilter.GetDataForkStream();
|
|
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
|
|
|
|
|
|
|
byte[] hdr = new byte[40];
|
|
|
|
|
|
|
|
|
|
|
|
stream.Read(hdr, 0, 40);
|
2017-12-28 04:57:26 +00:00
|
|
|
|
header = new SaveDskFHeader();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
IntPtr hdrPtr = Marshal.AllocHGlobal(40);
|
|
|
|
|
|
Marshal.Copy(hdr, 0, hdrPtr, 40);
|
|
|
|
|
|
header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader));
|
|
|
|
|
|
Marshal.FreeHGlobal(hdrPtr);
|
|
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.magic = 0x{0:X4}", header.magic);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.mediaType = 0x{0:X2}", header.mediaType);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorSize = {0}", header.sectorSize);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.clusterMask = {0}", header.clusterMask);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.clusterShift = {0}", header.clusterShift);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.reservedSectors = {0}", header.reservedSectors);
|
2017-12-28 04:57:26 +00:00
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.fatCopies = {0}", header.fatCopies);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.rootEntries = {0}", header.rootEntries);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.firstCluster = {0}", header.firstCluster);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.clustersCopied = {0}", header.clustersCopied);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsPerFat = {0}", header.sectorsPerFat);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.checksum = 0x{0:X8}", header.checksum);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.cylinders = {0}", header.cylinders);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.heads = {0}", header.heads);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsPerTrack = {0}", header.sectorsPerTrack);
|
2017-12-28 04:57:26 +00:00
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.padding = {0}", header.padding);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsCopied = {0}", header.sectorsCopied);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.commentOffset = {0}", header.commentOffset);
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "header.dataOffset = {0}", header.dataOffset);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
if(header.dataOffset == 0 && header.magic == SDF_MAGIC_OLD) header.dataOffset = 512;
|
|
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
byte[] cmt = new byte[header.dataOffset - header.commentOffset];
|
2017-12-19 20:33:03 +00:00
|
|
|
|
stream.Seek(header.commentOffset, SeekOrigin.Begin);
|
|
|
|
|
|
stream.Read(cmt, 0, cmt.Length);
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(cmt.Length > 1) imageInfo.Comments = StringHandlers.CToString(cmt, Encoding.GetEncoding("ibm437"));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
calculatedChk = 0;
|
|
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
|
|
2017-12-21 16:07:20 +00:00
|
|
|
|
int b;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
do
|
|
|
|
|
|
{
|
2017-12-28 04:57:26 +00:00
|
|
|
|
b = stream.ReadByte();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(b >= 0) calculatedChk += (uint)b;
|
|
|
|
|
|
}
|
|
|
|
|
|
while(b >= 0);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.DebugWriteLine("SaveDskF plugin", "Calculated checksum = 0x{0:X8}, {1}", calculatedChk,
|
|
|
|
|
|
calculatedChk == header.checksum);
|
|
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
imageInfo.Application = "SaveDskF";
|
|
|
|
|
|
imageInfo.CreationTime = imageFilter.GetCreationTime();
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.LastModificationTime = imageFilter.GetLastWriteTime();
|
2017-12-28 04:57:26 +00:00
|
|
|
|
imageInfo.MediaTitle = imageFilter.GetFilename();
|
|
|
|
|
|
imageInfo.ImageSize = (ulong)(stream.Length - header.dataOffset);
|
|
|
|
|
|
imageInfo.Sectors = (ulong)(header.sectorsPerTrack * header.heads * header.cylinders);
|
|
|
|
|
|
imageInfo.SectorSize = header.sectorSize;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
imageInfo.MediaType =
|
|
|
|
|
|
Geometry.GetMediaType((header.cylinders, (byte)header.heads, header.sectorsPerTrack, header.sectorSize,
|
|
|
|
|
|
MediaEncoding.MFM, false));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.XmlMediaType = XmlMediaType.BlockMedia;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
DicConsole.VerboseWriteLine("SaveDskF image contains a disk of type {0}", imageInfo.MediaType);
|
|
|
|
|
|
if(!string.IsNullOrEmpty(imageInfo.Comments))
|
|
|
|
|
|
DicConsole.VerboseWriteLine("SaveDskF comments: {0}", imageInfo.Comments);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
// TODO: Support compressed images
|
|
|
|
|
|
if(header.magic == SDF_MAGIC_COMPRESSED)
|
|
|
|
|
|
throw new
|
|
|
|
|
|
FeatureSupportedButNotImplementedImageException("Compressed SaveDskF images are not supported.");
|
|
|
|
|
|
|
|
|
|
|
|
// SaveDskF only ommits ending clusters, leaving no gaps behind, so reading all data we have...
|
|
|
|
|
|
stream.Seek(header.dataOffset, SeekOrigin.Begin);
|
2017-12-26 06:05:12 +00:00
|
|
|
|
decodedDisk = new byte[imageInfo.Sectors * imageInfo.SectorSize];
|
2017-12-19 20:33:03 +00:00
|
|
|
|
stream.Read(decodedDisk, 0, (int)(stream.Length - header.dataOffset));
|
|
|
|
|
|
|
2017-12-28 04:57:26 +00:00
|
|
|
|
imageInfo.Cylinders = header.cylinders;
|
|
|
|
|
|
imageInfo.Heads = header.heads;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.SectorsPerTrack = header.sectorsPerTrack;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool? VerifySector(ulong sectorAddress)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool? VerifySector(ulong sectorAddress, uint track)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
|
2017-12-28 04:57:26 +00:00
|
|
|
|
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-26 07:28:40 +00:00
|
|
|
|
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
|
2017-12-28 04:57:26 +00:00
|
|
|
|
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-26 07:28:40 +00:00
|
|
|
|
public bool? VerifyMediaImage()
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
return calculatedChk == header.checksum;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSector(ulong sectorAddress)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
return ReadSectors(sectorAddress, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectors(ulong sectorAddress, uint length)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-26 06:05:12 +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-26 06:05:12 +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-26 06:05:12 +00:00
|
|
|
|
byte[] buffer = new byte[length * imageInfo.SectorSize];
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
Array.Copy(decodedDisk, (int)sectorAddress * imageInfo.SectorSize, buffer, 0,
|
2017-12-28 04:57:26 +00:00
|
|
|
|
length * imageInfo.SectorSize);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorLong(ulong sectorAddress)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsLong(ulong sectorAddress, uint length)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadDiskTag(MediaTagType tag)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Track> GetSessionTracks(Session session)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Track> GetSessionTracks(ushort session)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSector(ulong sectorAddress, uint track)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectors(ulong sectorAddress, uint length, uint track)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorLong(ulong sectorAddress, uint track)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
2017-12-24 00:12:31 +00:00
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
struct SaveDskFHeader
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>0x00 magic number</summary>
|
|
|
|
|
|
public ushort magic;
|
|
|
|
|
|
/// <summary>0x02 media type from FAT</summary>
|
|
|
|
|
|
public ushort mediaType;
|
|
|
|
|
|
/// <summary>0x04 bytes per sector</summary>
|
|
|
|
|
|
public ushort sectorSize;
|
|
|
|
|
|
/// <summary>0x06 sectors per cluster - 1</summary>
|
|
|
|
|
|
public byte clusterMask;
|
|
|
|
|
|
/// <summary>0x07 log2(cluster / sector)</summary>
|
|
|
|
|
|
public byte clusterShift;
|
|
|
|
|
|
/// <summary>0x08 reserved sectors</summary>
|
|
|
|
|
|
public ushort reservedSectors;
|
|
|
|
|
|
/// <summary>0x0A copies of FAT</summary>
|
|
|
|
|
|
public byte fatCopies;
|
|
|
|
|
|
/// <summary>0x0B entries in root directory</summary>
|
|
|
|
|
|
public ushort rootEntries;
|
|
|
|
|
|
/// <summary>0x0D first cluster</summary>
|
|
|
|
|
|
public ushort firstCluster;
|
|
|
|
|
|
/// <summary>0x0F clusters present in image</summary>
|
|
|
|
|
|
public ushort clustersCopied;
|
|
|
|
|
|
/// <summary>0x11 sectors per FAT</summary>
|
|
|
|
|
|
public byte sectorsPerFat;
|
|
|
|
|
|
/// <summary>0x12 sector number of root directory</summary>
|
|
|
|
|
|
public ushort rootDirectorySector;
|
|
|
|
|
|
/// <summary>0x14 sum of all image bytes</summary>
|
|
|
|
|
|
public uint checksum;
|
|
|
|
|
|
/// <summary>0x18 cylinders</summary>
|
|
|
|
|
|
public ushort cylinders;
|
|
|
|
|
|
/// <summary>0x1A heads</summary>
|
|
|
|
|
|
public ushort heads;
|
|
|
|
|
|
/// <summary>0x1C sectors per track</summary>
|
|
|
|
|
|
public ushort sectorsPerTrack;
|
|
|
|
|
|
/// <summary>0x1E always zero</summary>
|
|
|
|
|
|
public uint padding;
|
|
|
|
|
|
/// <summary>0x22 sectors present in image</summary>
|
|
|
|
|
|
public ushort sectorsCopied;
|
|
|
|
|
|
/// <summary>0x24 offset to comment</summary>
|
|
|
|
|
|
public ushort commentOffset;
|
|
|
|
|
|
/// <summary>0x26 offset to data</summary>
|
|
|
|
|
|
public ushort dataOffset;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|