Move image and sector verification methods to new interfaces.

This commit is contained in:
2019-01-20 22:24:15 +00:00
parent 640c57b87a
commit 6b1aeb6cbb
96 changed files with 1756 additions and 1602 deletions

View File

@@ -125,6 +125,8 @@
<e p="IPartitionableMediaImage.cs" t="Include" />
<e p="IPluginRegister.cs" t="Include" />
<e p="IReadOnlyFilesystem.cs" t="Include" />
<e p="IVerifiableImage.cs" t="Include" />
<e p="IVerifiableSectorsImage.cs" t="Include" />
<e p="IWritableFloppyImage.cs" t="Include" />
<e p="IWritableImage.cs" t="Include" />
<e p="IWritableOpticalImage.cs" t="Include" />
@@ -615,6 +617,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
</e>
<e p="Anex86" t="Include">
@@ -676,6 +679,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
</e>
<e p="BlindWrite4" t="Include">
@@ -686,6 +690,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="BlindWrite5" t="Include">
<e p="BlindWrite5.cs" t="Include" />
@@ -696,6 +701,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="CDRDAO" t="Include">
<e p="CDRDAO.cs" t="Include" />
@@ -705,7 +711,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
</e>
<e p="CDRWin" t="Include">
@@ -728,6 +734,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="CPCDSK" t="Include">
<e p="CPCDSK.cs" t="Include" />
@@ -755,7 +762,7 @@
<e p="Identify.cs" t="Include" />
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
</e>
<e p="CopyQM" t="Include">
@@ -802,7 +809,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="DiscImageChef" t="Include">
<e p="CdEcc.cs" t="Include" />
@@ -825,6 +832,7 @@
<e p="Identify.cs" t="Include" />
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="DiskCopy42" t="Include">
<e p="Constants.cs" t="Include" />
@@ -835,6 +843,7 @@
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
</e>
<e p="DriDiskCopy" t="Include">
@@ -856,6 +865,7 @@
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="HDCopy" t="Include">
<e p="HDCopy.cs" t="Include" />
@@ -883,7 +893,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="MaxiDisk" t="Include">
<e p="Enums.cs" t="Include" />
@@ -923,6 +933,7 @@
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="Parallels" t="Include">
<e p="Constants.cs" t="Include" />
@@ -943,6 +954,7 @@
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="Partimage" t="Include">
<e p="Constants.cs" t="Include" />
@@ -954,6 +966,7 @@
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="QCOW" t="Include">
<e p="Constants.cs" t="Include" />
@@ -1018,6 +1031,7 @@
<e p="SaveDskF.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
</e>
<e p="SuperCardPro" t="Include">
@@ -1029,6 +1043,7 @@
<e p="Read.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="SuperCardPro.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="T98" t="Include">
<e p="Identify.cs" t="Include" />
@@ -1047,6 +1062,7 @@
<e p="Structs.cs" t="Include" />
<e p="TeleDisk.cs" t="Include" />
<e p="Unsupported.cs" t="Include" />
<e p="Verify.cs" t="Include" />
</e>
<e p="UDIF" t="Include">
<e p="Constants.cs" t="Include" />
@@ -1135,6 +1151,7 @@
<e p="Identify.cs" t="Include" />
<e p="Properties.cs" t="Include" />
<e p="Read.cs" t="Include" />
<e p="Verify.cs" t="Include" />
<e p="Write.cs" t="Include" />
<e p="ZZZRawImage.cs" t="Include" />
</e>

View File

@@ -74,6 +74,8 @@
<Compile Include="Interfaces\IPartitionableMediaImage.cs" />
<Compile Include="Interfaces\IPluginRegister.cs" />
<Compile Include="Interfaces\IReadOnlyFilesystem.cs" />
<Compile Include="Interfaces\IVerifiableImage.cs" />
<Compile Include="Interfaces\IVerifiableSectorsImage.cs" />
<Compile Include="Interfaces\IWritableFloppyImage.cs" />
<Compile Include="Interfaces\IWritableImage.cs" />
<Compile Include="Interfaces\IWritableOpticalImage.cs" />

View File

@@ -135,28 +135,5 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// <param name="sectorAddress">Starting sector address (LBA).</param>
/// <param name="length">How many sectors to read.</param>
byte[] ReadSectorsLong(ulong sectorAddress, uint length);
/// <summary>
/// Verifies a sector.
/// </summary>
/// <returns>True if correct, false if incorrect, null if uncheckable.</returns>
/// <param name="sectorAddress">Sector address (LBA).</param>
bool? VerifySector(ulong sectorAddress);
/// <summary>
/// Verifies several sectors.
/// </summary>
/// <returns>True if all are correct, false if any is incorrect, null if any is uncheckable.</returns>
/// <param name="sectorAddress">Starting sector address (LBA).</param>
/// <param name="length">How many sectors to read.</param>
/// <param name="failingLbas">List of incorrect sectors</param>
/// <param name="unknownLbas">List of uncheckable sectors</param>
bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas, out List<ulong> unknownLbas);
/// <summary>
/// Verifies media image internal checksum.
/// </summary>
/// <returns>True if correct, false if incorrect, null if there is no internal checksum available</returns>
bool? VerifyMediaImage();
}
}

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// <summary>
/// Abstract class to implement disk image reading plugins.
/// </summary>
public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage
public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage
{
/// <summary>
/// Gets the disc track extents (start, length).

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : IVerifiableImage.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines interface to be implemented by image plugins that can verify the
// image itself.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.CommonTypes.Interfaces
{
public interface IVerifiableImage
{
/// <summary>
/// Verifies media image internal checksum.
/// </summary>
/// <returns>True if correct, false if incorrect, null if there is no internal checksum available</returns>
bool? VerifyMediaImage();
}
}

View File

@@ -0,0 +1,63 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : IVerifiableSectorsImage.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines interface to be implemented by image plugins that can verify the
// sectors contained in the image.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace DiscImageChef.CommonTypes.Interfaces
{
public interface IVerifiableSectorsImage
{
/// <summary>
/// Verifies a sector.
/// </summary>
/// <returns>True if correct, false if incorrect, null if uncheckable.</returns>
/// <param name="sectorAddress">Sector address (LBA).</param>
bool? VerifySector(ulong sectorAddress);
/// <summary>
/// Verifies several sectors.
/// </summary>
/// <returns>True if all are correct, false if any is incorrect, null if any is uncheckable.</returns>
/// <param name="sectorAddress">Starting sector address (LBA).</param>
/// <param name="length">How many sectors to read.</param>
/// <param name="failingLbas">List of incorrect sectors</param>
/// <param name="unknownLbas">List of uncheckable sectors</param>
bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas, out List<ulong> unknownLbas);
}
}

View File

@@ -36,7 +36,6 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -638,25 +637,14 @@ namespace DiscImageChef.DiscImages
}
}
public byte[] ReadSector(ulong sectorAddress)
{
return ReadSectors(sectorAddress, 1);
}
public byte[] ReadSector(ulong sectorAddress) => ReadSectors(sectorAddress, 1);
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag)
{
return ReadSectorsTag(sectorAddress, 1, tag);
}
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => ReadSectorsTag(sectorAddress, 1, tag);
public byte[] ReadSector(ulong sectorAddress, uint track)
{
return ReadSectors(sectorAddress, 1, track);
}
public byte[] ReadSector(ulong sectorAddress, uint track) => ReadSectors(sectorAddress, 1, track);
public byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag)
{
return ReadSectorsTag(sectorAddress, 1, track, tag);
}
public byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) =>
ReadSectorsTag(sectorAddress, 1, track, tag);
public byte[] ReadSectors(ulong sectorAddress, uint length)
{
@@ -1108,15 +1096,9 @@ namespace DiscImageChef.DiscImages
return buffer;
}
public byte[] ReadSectorLong(ulong sectorAddress)
{
return ReadSectorsLong(sectorAddress, 1);
}
public byte[] ReadSectorLong(ulong sectorAddress) => ReadSectorsLong(sectorAddress, 1);
public byte[] ReadSectorLong(ulong sectorAddress, uint track)
{
return ReadSectorsLong(sectorAddress, 1, track);
}
public byte[] ReadSectorLong(ulong sectorAddress, uint track) => ReadSectorsLong(sectorAddress, 1, track);
public byte[] ReadSectorsLong(ulong sectorAddress, uint length)
{
@@ -1248,82 +1230,5 @@ namespace DiscImageChef.DiscImages
return tracks;
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage()
{
return null;
}
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies Alcohol 120% format disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class Alcohol120
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using DiscImageChef.CommonTypes;
@@ -102,19 +101,5 @@ namespace DiscImageChef.DiscImages
return buffer;
}
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -38,21 +37,6 @@ namespace DiscImageChef.DiscImages
{
public partial class AppleDos
{
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -40,19 +39,5 @@ namespace DiscImageChef.DiscImages
{
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -38,7 +38,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class Blu : IWritableImage
public partial class Blu : IWritableImage, IVerifiableSectorsImage
{
IFilter bluImageFilter;
int bptag;

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
@@ -220,19 +219,5 @@ namespace DiscImageChef.DiscImages
return buffer;
}
// TODO: Check tag checkums
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
}
}

View File

@@ -39,7 +39,5 @@ namespace DiscImageChef.DiscImages
{
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -0,0 +1,53 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies DiscJuggler disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace DiscImageChef.DiscImages
{
public partial class Blu
{
// TODO: Check tag checkums
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
}
}

View File

@@ -36,7 +36,6 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1032,79 +1031,5 @@ namespace DiscImageChef.DiscImages
{
return Tracks.Where(track => track.TrackSession == session).ToList();
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies BlindWrite 4 format disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite4
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -37,7 +37,6 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1582,79 +1581,5 @@ namespace DiscImageChef.DiscImages
{
return Tracks.Where(dicTrack => dicTrack.TrackSession == session).ToList();
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies BlindWrite 5 disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite5
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -36,7 +36,6 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1186,77 +1185,5 @@ namespace DiscImageChef.DiscImages
throw new ImageNotSupportedException("Session does not exist in disc image");
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies cdrdao cuesheets (toc/bin).
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class Cdrdao
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -39,7 +39,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
// TODO: Implement track flags
public partial class CdrWin : IWritableOpticalImage
public partial class CdrWin : IWritableOpticalImage, IVerifiableImage
{
IFilter cdrwinFilter;
StreamReader cueStream;

View File

@@ -40,7 +40,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
// TODO: Implement PCMCIA support
public partial class Chd : IOpticalMediaImage
public partial class Chd : IOpticalMediaImage, IVerifiableImage
{
/// <summary>"MComprHD"</summary>
readonly byte[] chdTag = {0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44};

View File

@@ -37,7 +37,6 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1069,107 +1068,6 @@ namespace DiscImageChef.DiscImages
return true;
}
public bool? VerifySector(ulong sectorAddress)
{
if(isHdd) return null;
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(isHdd)
throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image");
return VerifySector(GetAbsoluteSector(sectorAddress, track));
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
unknownLbas = new List<ulong>();
failingLbas = new List<ulong>();
if(isHdd) return null;
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
unknownLbas = new List<ulong>();
failingLbas = new List<ulong>();
if(isHdd) return null;
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage()
{
byte[] calculated;
if(mapVersion >= 3)
{
Sha1Context sha1Ctx = new Sha1Context();
for(uint i = 0; i < totalHunks; i++) sha1Ctx.Update(GetHunk(i));
calculated = sha1Ctx.Final();
}
else
{
Md5Context md5Ctx = new Md5Context();
for(uint i = 0; i < totalHunks; i++) md5Ctx.Update(GetHunk(i));
calculated = md5Ctx.Final();
}
return expectedChecksum.SequenceEqual(calculated);
}
public byte[] ReadSector(ulong sectorAddress)
{
if(sectorAddress > imageInfo.Sectors - 1)

View File

@@ -0,0 +1,144 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies MAME Compressed Hunks of Data disk images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes.Exceptions;
namespace DiscImageChef.DiscImages
{
public partial class Chd
{
public bool? VerifySector(ulong sectorAddress)
{
if(isHdd) return null;
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
unknownLbas = new List<ulong>();
failingLbas = new List<ulong>();
if(isHdd) return null;
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
unknownLbas = new List<ulong>();
failingLbas = new List<ulong>();
if(isHdd) return null;
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage()
{
byte[] calculated;
if(mapVersion >= 3)
{
Sha1Context sha1Ctx = new Sha1Context();
for(uint i = 0; i < totalHunks; i++) sha1Ctx.Update(GetHunk(i));
calculated = sha1Ctx.Final();
}
else
{
Md5Context md5Ctx = new Md5Context();
for(uint i = 0; i < totalHunks; i++) md5Ctx.Update(GetHunk(i));
calculated = md5Ctx.Final();
}
return expectedChecksum.SequenceEqual(calculated);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(isHdd)
throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image");
return VerifySector(GetAbsoluteSector(sectorAddress, track));
}
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -46,23 +45,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,20 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -35,7 +35,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1142,77 +1141,5 @@ namespace DiscImageChef.DiscImages
{
return Tracks.Where(track => track.TrackSession == session).ToList();
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies CloneCD disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class CloneCd
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -38,7 +38,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class CopyQm : IMediaImage
public partial class CopyQm : IMediaImage, IVerifiableImage
{
uint calculatedDataCrc;
byte[] decodedDisk;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,18 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -40,19 +39,5 @@ namespace DiscImageChef.DiscImages
{
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -37,7 +37,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class DiscFerret : IMediaImage
public partial class DiscFerret : IMediaImage, IVerifiableSectorsImage
{
ImageInfo imageInfo;
// TODO: These variables have been made public so create-sidecar can access to this information until I define an API >4.0

View File

@@ -132,12 +132,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySector(ulong sectorAddress) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}

View File

@@ -1,15 +1,15 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Unsupported.cs
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains features unsupported by DiscFerret flux images.
// Verifies DiscFerret disk images.
//
// --[ License ] --------------------------------------------------------------
//
@@ -30,13 +30,18 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using DiscImageChef.CommonTypes.Exceptions;
using System;
using System.Collections.Generic;
namespace DiscImageChef.DiscImages
{
public partial class DiscFerret
{
public bool? VerifyMediaImage() =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}

View File

@@ -66,6 +66,7 @@
<Compile Include="Alcohol120\Properties.cs" />
<Compile Include="Alcohol120\Read.cs" />
<Compile Include="Alcohol120\Structs.cs" />
<Compile Include="Alcohol120\Verify.cs" />
<Compile Include="Alcohol120\Write.cs" />
<Compile Include="Anex86\Anex86.cs" />
<Compile Include="Anex86\Identify.cs" />
@@ -111,6 +112,7 @@
<Compile Include="BlindWrite4\Properties.cs" />
<Compile Include="BlindWrite4\Read.cs" />
<Compile Include="BlindWrite4\Structs.cs" />
<Compile Include="BlindWrite4\Verify.cs" />
<Compile Include="BlindWrite5\Constants.cs" />
<Compile Include="BlindWrite5\Enums.cs" />
<Compile Include="BlindWrite5\Helpers.cs" />
@@ -118,11 +120,13 @@
<Compile Include="BlindWrite5\Properties.cs" />
<Compile Include="BlindWrite5\Read.cs" />
<Compile Include="BlindWrite5\Structs.cs" />
<Compile Include="BlindWrite5\Verify.cs" />
<Compile Include="BLU\Constants.cs" />
<Compile Include="BLU\Identify.cs" />
<Compile Include="BLU\Properties.cs" />
<Compile Include="BLU\Read.cs" />
<Compile Include="BLU\Unsupported.cs" />
<Compile Include="BLU\Verify.cs" />
<Compile Include="BLU\Write.cs" />
<Compile Include="CDRDAO\Constants.cs" />
<Compile Include="CDRDAO\Helpers.cs" />
@@ -130,7 +134,7 @@
<Compile Include="CDRDAO\Properties.cs" />
<Compile Include="CDRDAO\Read.cs" />
<Compile Include="CDRDAO\Structs.cs" />
<Compile Include="CDRDAO\Unsupported.cs" />
<Compile Include="CDRDAO\Verify.cs" />
<Compile Include="CDRDAO\Write.cs" />
<Compile Include="CDRWin\Constants.cs" />
<Compile Include="CDRWin\Helpers.cs" />
@@ -147,6 +151,7 @@
<Compile Include="CHD\Properties.cs" />
<Compile Include="CHD\Read.cs" />
<Compile Include="CHD\Structs.cs" />
<Compile Include="CHD\Verify.cs" />
<Compile Include="CisCopy\Enums.cs" />
<Compile Include="CisCopy\Identify.cs" />
<Compile Include="CisCopy\Properties.cs" />
@@ -158,7 +163,7 @@
<Compile Include="CloneCD\Identify.cs" />
<Compile Include="CloneCD\Properties.cs" />
<Compile Include="CloneCD\Read.cs" />
<Compile Include="CloneCD\Unsupported.cs" />
<Compile Include="CloneCD\Verify.cs" />
<Compile Include="CloneCD\Write.cs" />
<Compile Include="CopyQM\Constants.cs" />
<Compile Include="CopyQM\Identify.cs" />
@@ -198,7 +203,7 @@
<Compile Include="DiscFerret\Properties.cs" />
<Compile Include="DiscFerret\Read.cs" />
<Compile Include="DiscFerret\Structs.cs" />
<Compile Include="DiscFerret\Unsupported.cs" />
<Compile Include="DiscFerret\Verify.cs" />
<Compile Include="DiscImageChef\CdEcc.cs" />
<Compile Include="DiscImageChef\ClauniaSubchannelTransform.cs" />
<Compile Include="DiscImageChef\Constants.cs" />
@@ -215,6 +220,7 @@
<Compile Include="DiscJuggler\Identify.cs" />
<Compile Include="DiscJuggler\Properties.cs" />
<Compile Include="DiscJuggler\Read.cs" />
<Compile Include="DiscJuggler\Verify.cs" />
<Compile Include="DiskCopy42\Constants.cs" />
<Compile Include="DiskCopy42\Helpers.cs" />
<Compile Include="DiskCopy42\Identify.cs" />
@@ -222,6 +228,7 @@
<Compile Include="DiskCopy42\Read.cs" />
<Compile Include="DiskCopy42\Structs.cs" />
<Compile Include="DiskCopy42\Unsupported.cs" />
<Compile Include="DiskCopy42\Verify.cs" />
<Compile Include="DiskCopy42\Write.cs" />
<Compile Include="DriDiskCopy\Constants.cs" />
<Compile Include="DriDiskCopy\Enums.cs" />
@@ -237,6 +244,7 @@
<Compile Include="GDI\Read.cs" />
<Compile Include="GDI\Structs.cs" />
<Compile Include="GDI\Unsupported.cs" />
<Compile Include="GDI\Verify.cs" />
<Compile Include="HDCopy\HDCopy.cs" />
<Compile Include="HDCopy\Helpers.cs" />
<Compile Include="HDCopy\Identify.cs" />
@@ -260,7 +268,7 @@
<Compile Include="KryoFlux\Properties.cs" />
<Compile Include="KryoFlux\Read.cs" />
<Compile Include="KryoFlux\Structs.cs" />
<Compile Include="KryoFlux\Unsupported.cs" />
<Compile Include="KryoFlux\Verify.cs" />
<Compile Include="MaxiDisk\Enums.cs" />
<Compile Include="MaxiDisk\Identify.cs" />
<Compile Include="MaxiDisk\Properties.cs" />
@@ -282,6 +290,7 @@
<Compile Include="Nero\Properties.cs" />
<Compile Include="Nero\Read.cs" />
<Compile Include="Nero\Structs.cs" />
<Compile Include="Nero\Verify.cs" />
<Compile Include="NHDr0\Constants.cs" />
<Compile Include="NHDr0\Identify.cs" />
<Compile Include="NHDr0\Properties.cs" />
@@ -303,6 +312,7 @@
<Compile Include="PartClone\Read.cs" />
<Compile Include="PartClone\Structs.cs" />
<Compile Include="PartClone\Unsupported.cs" />
<Compile Include="PartClone\Verify.cs" />
<Compile Include="Partimage\Constants.cs" />
<Compile Include="Partimage\Enums.cs" />
<Compile Include="Partimage\Helpers.cs" />
@@ -311,6 +321,7 @@
<Compile Include="Partimage\Read.cs" />
<Compile Include="Partimage\Structs.cs" />
<Compile Include="Partimage\Unsupported.cs" />
<Compile Include="Partimage\Verify.cs" />
<Compile Include="QCOW2\Constants.cs" />
<Compile Include="QCOW2\Identify.cs" />
<Compile Include="QCOW2\Properties.cs" />
@@ -357,6 +368,7 @@
<Compile Include="SaveDskF\Read.cs" />
<Compile Include="SaveDskF\Structs.cs" />
<Compile Include="SaveDskF\Unsupported.cs" />
<Compile Include="SaveDskF\Verify.cs" />
<Compile Include="SaveDskF\Write.cs" />
<Compile Include="SuperCardPro\Constants.cs" />
<Compile Include="SuperCardPro\Enums.cs" />
@@ -366,6 +378,7 @@
<Compile Include="SuperCardPro\Read.cs" />
<Compile Include="SuperCardPro\Structs.cs" />
<Compile Include="SuperCardPro\SuperCardPro.cs" />
<Compile Include="SuperCardPro\Verify.cs" />
<Compile Include="T98\Identify.cs" />
<Compile Include="T98\Properties.cs" />
<Compile Include="T98\Read.cs" />
@@ -379,6 +392,7 @@
<Compile Include="TeleDisk\Structs.cs" />
<Compile Include="TeleDisk\TeleDisk.cs" />
<Compile Include="TeleDisk\Unsupported.cs" />
<Compile Include="TeleDisk\Verify.cs" />
<Compile Include="UDIF\Constants.cs" />
<Compile Include="UDIF\Identify.cs" />
<Compile Include="UDIF\Properties.cs" />
@@ -443,6 +457,7 @@
<Compile Include="ZZZRawImage\Identify.cs" />
<Compile Include="ZZZRawImage\Properties.cs" />
<Compile Include="ZZZRawImage\Read.cs" />
<Compile Include="ZZZRawImage\Verify.cs" />
<Compile Include="ZZZRawImage\Write.cs" />
<Compile Include="ZZZRawImage\ZZZRawImage.cs" />
<Compile Include="CDRDAO\CDRDAO.cs" />

View File

@@ -81,7 +81,7 @@ using SharpCompress.Compressors.LZMA;
namespace DiscImageChef.DiscImages
{
public partial class DiscImageChef : IWritableOpticalImage
public partial class DiscImageChef : IWritableOpticalImage, IVerifiableImage
{
bool alreadyWrittenZero;
/// <summary>Cache of uncompressed blocks.</summary>

View File

@@ -40,7 +40,7 @@ namespace DiscImageChef.DiscImages
{
// Support separate data files? Never seen a DiscJuggler image using them anyways...
// TODO: Too many unknowns to make this writable
public partial class DiscJuggler : IMediaImage
public partial class DiscJuggler : IOpticalMediaImage
{
byte[] cdtext;
ImageInfo imageInfo;

View File

@@ -35,7 +35,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1011,79 +1010,5 @@ namespace DiscImageChef.DiscImages
{
return Tracks.Where(track => track.TrackSession == session).ToList();
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies DiscJuggler disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class DiscJuggler
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -41,7 +41,7 @@ namespace DiscImageChef.DiscImages
{
// Checked using several images and strings inside Apple's DiskImages.framework
[SuppressMessage("ReSharper", "InconsistentNaming")]
public partial class DiskCopy42 : IWritableImage
public partial class DiskCopy42 : IWritableImage, IVerifiableImage
{
/// <summary>Bytes per tag, should be 12</summary>
uint bptag;

View File

@@ -391,37 +391,6 @@ namespace DiscImageChef.DiscImages
return true;
}
public bool? VerifyMediaImage()
{
byte[] data = new byte[header.DataSize];
byte[] tags = new byte[header.TagSize];
uint tagsChk = 0;
DicConsole.DebugWriteLine("DC42 plugin", "Reading data");
Stream datastream = dc42ImageFilter.GetDataForkStream();
datastream.Seek(dataOffset, SeekOrigin.Begin);
datastream.Read(data, 0, (int)header.DataSize);
DicConsole.DebugWriteLine("DC42 plugin", "Calculating data checksum");
uint dataChk = DC42CheckSum(data);
DicConsole.DebugWriteLine("DC42 plugin", "Calculated data checksum = 0x{0:X8}", dataChk);
DicConsole.DebugWriteLine("DC42 plugin", "Stored data checksum = 0x{0:X8}", header.DataChecksum);
if(header.TagSize <= 0) return dataChk == header.DataChecksum && tagsChk == header.TagChecksum;
DicConsole.DebugWriteLine("DC42 plugin", "Reading tags");
Stream tagstream = dc42ImageFilter.GetDataForkStream();
tagstream.Seek(tagOffset, SeekOrigin.Begin);
tagstream.Read(tags, 0, (int)header.TagSize);
DicConsole.DebugWriteLine("DC42 plugin", "Calculating tag checksum");
tagsChk = DC42CheckSum(tags);
DicConsole.DebugWriteLine("DC42 plugin", "Calculated tag checksum = 0x{0:X8}", tagsChk);
DicConsole.DebugWriteLine("DC42 plugin", "Stored tag checksum = 0x{0:X8}", header.TagChecksum);
return dataChk == header.DataChecksum && tagsChk == header.TagChecksum;
}
public byte[] ReadSector(ulong sectorAddress) => ReadSectors(sectorAddress, 1);
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => ReadSectorsTag(sectorAddress, 1, tag);

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -38,19 +37,6 @@ namespace DiscImageChef.DiscImages
{
public partial class DiskCopy42
{
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}

View File

@@ -0,0 +1,71 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies Apple DiskCopy 4.2 disk images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.IO;
using DiscImageChef.Console;
namespace DiscImageChef.DiscImages
{
public partial class DiskCopy42
{
public bool? VerifyMediaImage()
{
byte[] data = new byte[header.DataSize];
byte[] tags = new byte[header.TagSize];
uint tagsChk = 0;
DicConsole.DebugWriteLine("DC42 plugin", "Reading data");
Stream datastream = dc42ImageFilter.GetDataForkStream();
datastream.Seek(dataOffset, SeekOrigin.Begin);
datastream.Read(data, 0, (int)header.DataSize);
DicConsole.DebugWriteLine("DC42 plugin", "Calculating data checksum");
uint dataChk = DC42CheckSum(data);
DicConsole.DebugWriteLine("DC42 plugin", "Calculated data checksum = 0x{0:X8}", dataChk);
DicConsole.DebugWriteLine("DC42 plugin", "Stored data checksum = 0x{0:X8}", header.DataChecksum);
if(header.TagSize <= 0) return dataChk == header.DataChecksum && tagsChk == header.TagChecksum;
DicConsole.DebugWriteLine("DC42 plugin", "Reading tags");
Stream tagstream = dc42ImageFilter.GetDataForkStream();
tagstream.Seek(tagOffset, SeekOrigin.Begin);
tagstream.Read(tags, 0, (int)header.TagSize);
DicConsole.DebugWriteLine("DC42 plugin", "Calculating tag checksum");
tagsChk = DC42CheckSum(tags);
DicConsole.DebugWriteLine("DC42 plugin", "Calculated tag checksum = 0x{0:X8}", tagsChk);
DicConsole.DebugWriteLine("DC42 plugin", "Stored tag checksum = 0x{0:X8}", header.TagChecksum);
return dataChk == header.DataChecksum && tagsChk == header.TagChecksum;
}
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,20 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -35,7 +35,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -759,79 +758,5 @@ namespace DiscImageChef.DiscImages
return tracks;
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies Dreamcast GDI disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class Gdi
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -31,7 +31,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -53,19 +52,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,20 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -39,7 +39,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
[SuppressMessage("ReSharper", "InconsistentNaming")]
public partial class KryoFlux : IMediaImage
public partial class KryoFlux : IMediaImage, IVerifiableSectorsImage
{
// TODO: These variables have been made public so create-sidecar can access to this information until I define an API >4.0
public SortedDictionary<byte, IFilter> tracks;

View File

@@ -254,12 +254,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySector(ulong sectorAddress) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}

View File

@@ -0,0 +1,47 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies KryoFlux STREAM images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
namespace DiscImageChef.DiscImages
{
public partial class KryoFlux
{
public bool? VerifySector(ulong sectorAddress) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}

View File

@@ -30,10 +30,8 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
@@ -53,26 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
public List<Track> GetSessionTracks(Session session) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public List<Track> GetSessionTracks(ushort session) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -35,7 +35,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1373,79 +1372,5 @@ namespace DiscImageChef.DiscImages
{
return Tracks.Where(track => track.TrackSession == session).ToList();
}
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies Nero Burning ROM disc images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class Nero
{
public bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -39,7 +39,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class PartClone : IMediaImage
public partial class PartClone : IMediaImage, IVerifiableImage
{
// The used block "bitmap" uses one byte per block
// TODO: Convert on-image bytemap to on-memory bitmap

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,20 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
// TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility.
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -1,15 +1,15 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Unsupported.cs
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains features unsupported by cdrdao cuesheets (toc/bin).
// Verifies partclone disc images.
//
// --[ License ] --------------------------------------------------------------
//
@@ -32,8 +32,9 @@
namespace DiscImageChef.DiscImages
{
public partial class Cdrdao
public partial class PartClone
{
// TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility.
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -41,7 +41,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class Partimage : IMediaImage
public partial class Partimage : IMediaImage, IVerifiableImage
{
byte[] bitmap;
PartimageMainHeader cMainHeader;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,20 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
// TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility.
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -1,15 +1,15 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Unsupported.cs
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains features unsupported by KryoFlux STREAM images.
// Verifies partimage disk images.
//
// --[ License ] --------------------------------------------------------------
//
@@ -30,13 +30,11 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using DiscImageChef.CommonTypes.Exceptions;
namespace DiscImageChef.DiscImages
{
public partial class KryoFlux
public partial class Partimage
{
public bool? VerifyMediaImage() =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
// TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility.
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -38,21 +37,6 @@ namespace DiscImageChef.DiscImages
{
public partial class RayDim
{
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -49,19 +48,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -133,8 +133,6 @@ namespace DiscImageChef.DiscImages
return true;
}
public bool? VerifyMediaImage() => calculatedChk == header.checksum;
public byte[] ReadSector(ulong sectorAddress) => ReadSectors(sectorAddress, 1);
public byte[] ReadSectors(ulong sectorAddress, uint length)

View File

@@ -38,7 +38,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class SaveDskF : IWritableImage
public partial class SaveDskF : IWritableImage, IVerifiableImage
{
uint calculatedChk;
byte[] decodedDisk;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -38,19 +37,6 @@ namespace DiscImageChef.DiscImages
{
public partial class SaveDskF
{
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");

View File

@@ -1,15 +1,15 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Unsupported.cs
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains features unsupported by CloneCD disc images.
// Verifies IBM SaveDskF disk images.
//
// --[ License ] --------------------------------------------------------------
//
@@ -32,8 +32,8 @@
namespace DiscImageChef.DiscImages
{
public partial class CloneCd
public partial class SaveDskF
{
public bool? VerifyMediaImage() => null;
public bool? VerifyMediaImage() => calculatedChk == header.checksum;
}
}

View File

@@ -247,27 +247,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySector(ulong sectorAddress) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifyMediaImage()
{
if(Header.flags.HasFlag(ScpFlags.Writable)) return null;
byte[] wholeFile = new byte[scpStream.Length];
uint sum = 0;
scpStream.Position = 0;
scpStream.Read(wholeFile, 0, wholeFile.Length);
for(int i = 0x10; i < wholeFile.Length; i++) sum += wholeFile[i];
return Header.checksum == sum;
}
}
}

View File

@@ -38,7 +38,7 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
public partial class SuperCardPro : IMediaImage
public partial class SuperCardPro : IMediaImage, IVerifiableImage, IVerifiableSectorsImage
{
// TODO: These variables have been made public so create-sidecar can access to this information until I define an API >4.0
public ScpHeader Header;

View File

@@ -0,0 +1,62 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies SuperCardPro flux images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
namespace DiscImageChef.DiscImages
{
public partial class SuperCardPro
{
public bool? VerifyMediaImage()
{
if(Header.flags.HasFlag(ScpFlags.Writable)) return null;
byte[] wholeFile = new byte[scpStream.Length];
uint sum = 0;
scpStream.Position = 0;
scpStream.Read(wholeFile, 0, wholeFile.Length);
for(int i = 0x10; i < wholeFile.Length; i++) sum += wholeFile[i];
return Header.checksum == sum;
}
public bool? VerifySector(ulong sectorAddress) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas) =>
throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using DiscImageChef.CommonTypes.Enums;
@@ -523,23 +522,6 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) => ReadSectors(sectorAddress, length);
public bool? VerifySector(ulong sectorAddress) => !sectorsWhereCrcHasFailed.Contains(sectorAddress);
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++)
if(sectorsWhereCrcHasFailed.Contains(sectorAddress))
failingLbas.Add(sectorAddress);
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => aDiskCrcHasFailed;
public byte[] ReadDiskTag(MediaTagType tag)
{
if(tag != MediaTagType.Floppy_LeadOut)

View File

@@ -40,7 +40,7 @@ namespace DiscImageChef.DiscImages
{
// Created following notes from Dave Dunfield
// http://www.classiccmp.org/dunfield/img54306/td0notes.txt
public partial class TeleDisk : IMediaImage
public partial class TeleDisk : IMediaImage, IVerifiableImage, IVerifiableSectorsImage
{
bool aDiskCrcHasFailed;
byte[] commentBlock;

View File

@@ -0,0 +1,56 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies Sydex TeleDisk disk images.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace DiscImageChef.DiscImages
{
public partial class TeleDisk
{
public bool? VerifyMediaImage() => aDiskCrcHasFailed;
public bool? VerifySector(ulong sectorAddress) => !sectorsWhereCrcHasFailed.Contains(sectorAddress);
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++)
if(sectorsWhereCrcHasFailed.Contains(sectorAddress))
failingLbas.Add(sectorAddress);
return failingLbas.Count <= 0;
}
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -52,19 +51,5 @@ namespace DiscImageChef.DiscImages
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
public bool? VerifyMediaImage() => null;
}
}

View File

@@ -35,7 +35,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
@@ -1013,104 +1012,6 @@ namespace DiscImageChef.DiscImages
return buffer;
}
public bool? VerifySector(ulong sectorAddress)
{
if(!rawCompactDisc) return null;
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(!rawCompactDisc) return null;
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
if(!rawCompactDisc)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
if(!rawCompactDisc)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifyMediaImage() => null;
public List<Track> GetSessionTracks(Session session)
{
if(imageInfo.XmlMediaType != XmlMediaType.OpticalDisc)

View File

@@ -0,0 +1,137 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Verify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Verifies raw image, that is, user data sector by sector copy.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
namespace DiscImageChef.DiscImages
{
public partial class ZZZRawImage
{
public bool? VerifySector(ulong sectorAddress)
{
if(!rawCompactDisc) return null;
byte[] buffer = ReadSectorLong(sectorAddress);
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
if(!rawCompactDisc)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
if(!rawCompactDisc)
{
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
failingLbas = new List<ulong>();
unknownLbas = new List<ulong>();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
bool? sectorStatus = CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
if(unknownLbas.Count > 0) return null;
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(!rawCompactDisc) return null;
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -64,6 +64,11 @@ namespace DiscImageChef.Gui.Forms
stkProgress.Visible = true;
lblProgress2.Visible = false;
chkVerifySectors.Visible = inputFormat as IOpticalMediaImage != null ||
inputFormat as IVerifiableSectorsImage != null;
// TODO: Do not offer the option to use this form if the image does not support any kind of verification
new Thread(DoWork).Start();
}
@@ -77,6 +82,7 @@ namespace DiscImageChef.Gui.Forms
bool formatHasTracks;
IOpticalMediaImage inputOptical = inputFormat as IOpticalMediaImage;
IVerifiableSectorsImage verifiableSectorsImage = inputFormat as IVerifiableSectorsImage;
try { formatHasTracks = inputOptical?.Tracks?.Count > 0; }
catch { formatHasTracks = false; }
@@ -109,6 +115,14 @@ namespace DiscImageChef.Gui.Forms
});
if(chkVerifyImage.Checked == true)
{
if(!(inputFormat is IVerifiableImage verifiableImage))
Application.Instance.Invoke(() =>
{
lblImageResult.Visible = true;
lblImageResult.Text = "Disc image does not support verification.";
});
else
{
Application.Instance.Invoke(() =>
{
@@ -120,7 +134,7 @@ namespace DiscImageChef.Gui.Forms
});
DateTime startCheck = DateTime.UtcNow;
bool? discCheckStatus = inputFormat.VerifyMediaImage();
bool? discCheckStatus = verifiableImage.VerifyMediaImage();
DateTime endCheck = DateTime.UtcNow;
TimeSpan checkTime = endCheck - startCheck;
@@ -143,13 +157,15 @@ namespace DiscImageChef.Gui.Forms
});
correctDisc = discCheckStatus;
DicConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds", checkTime.TotalSeconds);
DicConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds",
checkTime.TotalSeconds);
}
}
if(chkVerifySectors.Checked == true)
{
DateTime startCheck;
DateTime endCheck;
DateTime startCheck = DateTime.Now;
DateTime endCheck = startCheck;
List<ulong> failingLbas = new List<ulong>();
List<ulong> unknownLbas = new List<ulong>();
@@ -232,7 +248,7 @@ namespace DiscImageChef.Gui.Forms
endCheck = DateTime.UtcNow;
}
else
else if(!(verifiableSectorsImage is null))
{
ulong remainingSectors = inputFormat.Info.Sectors;
ulong currentSector = 0;
@@ -262,9 +278,11 @@ namespace DiscImageChef.Gui.Forms
List<ulong> tempunknownLbas;
if(remainingSectors < 512)
inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempfailingLbas,
verifiableSectorsImage.VerifySectors(currentSector, (uint)remainingSectors,
out tempfailingLbas, out tempunknownLbas);
else
verifiableSectorsImage.VerifySectors(currentSector, 512, out tempfailingLbas,
out tempunknownLbas);
else inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas);
failingLbas.AddRange(tempfailingLbas);

View File

@@ -128,10 +128,19 @@ namespace DiscImageChef.Commands
bool? correctSectors = null;
long unknownSectors = 0;
IVerifiableImage verifiableImage = inputFormat as IVerifiableImage;
IVerifiableSectorsImage verifiableSectorsImage = inputFormat as IVerifiableSectorsImage;
if(verifiableImage is null && verifiableSectorsImage is null)
{
DicConsole.ErrorWriteLine("The specified image does not support any kind of verification");
return (int)ErrorNumber.NotVerificable;
}
if(verifyDisc)
{
DateTime startCheck = DateTime.UtcNow;
bool? discCheckStatus = inputFormat.VerifyMediaImage();
bool? discCheckStatus = verifiableImage.VerifyMediaImage();
DateTime endCheck = DateTime.UtcNow;
TimeSpan checkTime = endCheck - startCheck;
@@ -155,8 +164,8 @@ namespace DiscImageChef.Commands
if(verifySectors)
{
DateTime startCheck;
DateTime endCheck;
DateTime startCheck = DateTime.Now;
DateTime endCheck = startCheck;
List<ulong> failingLbas = new List<ulong>();
List<ulong> unknownLbas = new List<ulong>();
@@ -208,7 +217,7 @@ namespace DiscImageChef.Commands
endCheck = DateTime.UtcNow;
}
else
else if(verifiableSectorsImage != null)
{
ulong remainingSectors = inputFormat.Info.Sectors;
ulong currentSector = 0;
@@ -222,9 +231,11 @@ namespace DiscImageChef.Commands
List<ulong> tempunknownLbas;
if(remainingSectors < 512)
inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempfailingLbas,
verifiableSectorsImage.VerifySectors(currentSector, (uint)remainingSectors,
out tempfailingLbas, out tempunknownLbas);
else
verifiableSectorsImage.VerifySectors(currentSector, 512, out tempfailingLbas,
out tempunknownLbas);
else inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas);
failingLbas.AddRange(tempfailingLbas);