diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
index 570672a31..ec75100f7 100644
--- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml
+++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
@@ -125,6 +125,8 @@
+
+
@@ -615,6 +617,7 @@
+
@@ -676,6 +679,7 @@
+
@@ -686,6 +690,7 @@
+
@@ -696,6 +701,7 @@
+
@@ -705,7 +711,7 @@
-
+
@@ -728,6 +734,7 @@
+
@@ -755,7 +762,7 @@
-
+
@@ -802,7 +809,7 @@
-
+
@@ -825,6 +832,7 @@
+
@@ -835,6 +843,7 @@
+
@@ -856,6 +865,7 @@
+
@@ -883,7 +893,7 @@
-
+
@@ -923,6 +933,7 @@
+
@@ -943,6 +954,7 @@
+
@@ -954,6 +966,7 @@
+
@@ -1018,6 +1031,7 @@
+
@@ -1029,6 +1043,7 @@
+
@@ -1047,6 +1062,7 @@
+
@@ -1135,6 +1151,7 @@
+
diff --git a/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj b/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj
index 03d3dafbf..7800e7082 100644
--- a/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj
+++ b/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj
@@ -74,6 +74,8 @@
+
+
diff --git a/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs b/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs
index 16ff53c39..b02a10e6f 100644
--- a/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs
+++ b/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs
@@ -135,28 +135,5 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// Starting sector address (LBA).
/// How many sectors to read.
byte[] ReadSectorsLong(ulong sectorAddress, uint length);
-
- ///
- /// Verifies a sector.
- ///
- /// True if correct, false if incorrect, null if uncheckable.
- /// Sector address (LBA).
- bool? VerifySector(ulong sectorAddress);
-
- ///
- /// Verifies several sectors.
- ///
- /// True if all are correct, false if any is incorrect, null if any is uncheckable.
- /// Starting sector address (LBA).
- /// How many sectors to read.
- /// List of incorrect sectors
- /// List of uncheckable sectors
- bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, out List unknownLbas);
-
- ///
- /// Verifies media image internal checksum.
- ///
- /// True if correct, false if incorrect, null if there is no internal checksum available
- bool? VerifyMediaImage();
}
}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs b/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs
index a99beab79..7cb50c838 100644
--- a/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs
+++ b/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs
@@ -45,7 +45,7 @@ namespace DiscImageChef.CommonTypes.Interfaces
///
/// Abstract class to implement disk image reading plugins.
///
- public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage
+ public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage
{
///
/// Gets the disc track extents (start, length).
diff --git a/DiscImageChef.CommonTypes/Interfaces/IVerifiableImage.cs b/DiscImageChef.CommonTypes/Interfaces/IVerifiableImage.cs
new file mode 100644
index 000000000..af6d77eda
--- /dev/null
+++ b/DiscImageChef.CommonTypes/Interfaces/IVerifiableImage.cs
@@ -0,0 +1,50 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : IVerifiableImage.cs
+// Author(s) : Natalia Portillo
+//
+// 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
+ {
+ ///
+ /// Verifies media image internal checksum.
+ ///
+ /// True if correct, false if incorrect, null if there is no internal checksum available
+ bool? VerifyMediaImage();
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IVerifiableSectorsImage.cs b/DiscImageChef.CommonTypes/Interfaces/IVerifiableSectorsImage.cs
new file mode 100644
index 000000000..f9da0d59a
--- /dev/null
+++ b/DiscImageChef.CommonTypes/Interfaces/IVerifiableSectorsImage.cs
@@ -0,0 +1,63 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : IVerifiableSectorsImage.cs
+// Author(s) : Natalia Portillo
+//
+// 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
+ {
+ ///
+ /// Verifies a sector.
+ ///
+ /// True if correct, false if incorrect, null if uncheckable.
+ /// Sector address (LBA).
+ bool? VerifySector(ulong sectorAddress);
+
+ ///
+ /// Verifies several sectors.
+ ///
+ /// True if all are correct, false if any is incorrect, null if any is uncheckable.
+ /// Starting sector address (LBA).
+ /// How many sectors to read.
+ /// List of incorrect sectors
+ /// List of uncheckable sectors
+ bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, out List unknownLbas);
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/Alcohol120/Read.cs b/DiscImageChef.DiscImages/Alcohol120/Read.cs
index 551ac7f4d..a171bf1ea 100644
--- a/DiscImageChef.DiscImages/Alcohol120/Read.cs
+++ b/DiscImageChef.DiscImages/Alcohol120/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
- }
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/Alcohol120/Verify.cs b/DiscImageChef.DiscImages/Alcohol120/Verify.cs
new file mode 100644
index 000000000..357520454
--- /dev/null
+++ b/DiscImageChef.DiscImages/Alcohol120/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/Anex86/Read.cs b/DiscImageChef.DiscImages/Anex86/Read.cs
index ab72fc15b..d4758e0b9 100644
--- a/DiscImageChef.DiscImages/Anex86/Read.cs
+++ b/DiscImageChef.DiscImages/Anex86/Read.cs
@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
-using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using DiscImageChef.CommonTypes;
@@ -60,8 +59,8 @@ namespace DiscImageChef.DiscImages
handle.Free();
imageInfo.MediaType = Geometry.GetMediaType(((ushort)fdihdr.cylinders, (byte)fdihdr.heads,
- (ushort)fdihdr.spt, (uint)fdihdr.bps, MediaEncoding.MFM,
- false));
+ (ushort)fdihdr.spt, (uint)fdihdr.bps, MediaEncoding.MFM,
+ false));
if(imageInfo.MediaType == MediaType.Unknown) imageInfo.MediaType = MediaType.GENERIC_HDD;
DicConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", imageInfo.MediaType);
@@ -102,19 +101,5 @@ namespace DiscImageChef.DiscImages
return buffer;
}
-
- public bool? VerifySector(ulong sectorAddress) => null;
-
- public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/Apple2MG/Unsupported.cs b/DiscImageChef.DiscImages/Apple2MG/Unsupported.cs
index 0263c66ed..89e475f7b 100644
--- a/DiscImageChef.DiscImages/Apple2MG/Unsupported.cs
+++ b/DiscImageChef.DiscImages/Apple2MG/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/AppleDOS/Unsupported.cs b/DiscImageChef.DiscImages/AppleDOS/Unsupported.cs
index 8d0db3470..83cc67cfa 100644
--- a/DiscImageChef.DiscImages/AppleDOS/Unsupported.cs
+++ b/DiscImageChef.DiscImages/AppleDOS/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- 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");
diff --git a/DiscImageChef.DiscImages/AppleNIB/Unsupported.cs b/DiscImageChef.DiscImages/AppleNIB/Unsupported.cs
index d1d20429f..b5845bba3 100644
--- a/DiscImageChef.DiscImages/AppleNIB/Unsupported.cs
+++ b/DiscImageChef.DiscImages/AppleNIB/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/Apridisk/Unsupported.cs b/DiscImageChef.DiscImages/Apridisk/Unsupported.cs
index 3bb3aa6f9..af6da3804 100644
--- a/DiscImageChef.DiscImages/Apridisk/Unsupported.cs
+++ b/DiscImageChef.DiscImages/Apridisk/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BLU/BLU.cs b/DiscImageChef.DiscImages/BLU/BLU.cs
index 26529039f..f37a6174b 100644
--- a/DiscImageChef.DiscImages/BLU/BLU.cs
+++ b/DiscImageChef.DiscImages/BLU/BLU.cs
@@ -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;
diff --git a/DiscImageChef.DiscImages/BLU/Read.cs b/DiscImageChef.DiscImages/BLU/Read.cs
index 4ae3f6111..43e876573 100644
--- a/DiscImageChef.DiscImages/BLU/Read.cs
+++ b/DiscImageChef.DiscImages/BLU/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
-
- return null;
- }
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BLU/Unsupported.cs b/DiscImageChef.DiscImages/BLU/Unsupported.cs
index ea2f4da10..7565ffb40 100644
--- a/DiscImageChef.DiscImages/BLU/Unsupported.cs
+++ b/DiscImageChef.DiscImages/BLU/Unsupported.cs
@@ -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;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BLU/Verify.cs b/DiscImageChef.DiscImages/BLU/Verify.cs
new file mode 100644
index 000000000..b953700c0
--- /dev/null
+++ b/DiscImageChef.DiscImages/BLU/Verify.cs
@@ -0,0 +1,53 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BlindWrite4/Read.cs b/DiscImageChef.DiscImages/BlindWrite4/Read.cs
index 87e28f513..a05c5ff7a 100644
--- a/DiscImageChef.DiscImages/BlindWrite4/Read.cs
+++ b/DiscImageChef.DiscImages/BlindWrite4/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BlindWrite4/Verify.cs b/DiscImageChef.DiscImages/BlindWrite4/Verify.cs
new file mode 100644
index 000000000..e5cfbe4bd
--- /dev/null
+++ b/DiscImageChef.DiscImages/BlindWrite4/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BlindWrite5/Read.cs b/DiscImageChef.DiscImages/BlindWrite5/Read.cs
index cc0af12d8..344c3a048 100644
--- a/DiscImageChef.DiscImages/BlindWrite5/Read.cs
+++ b/DiscImageChef.DiscImages/BlindWrite5/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/BlindWrite5/Verify.cs b/DiscImageChef.DiscImages/BlindWrite5/Verify.cs
new file mode 100644
index 000000000..f85dbe3fb
--- /dev/null
+++ b/DiscImageChef.DiscImages/BlindWrite5/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CDRDAO/Read.cs b/DiscImageChef.DiscImages/CDRDAO/Read.cs
index a9c199637..7cca3d148 100644
--- a/DiscImageChef.DiscImages/CDRDAO/Read.cs
+++ b/DiscImageChef.DiscImages/CDRDAO/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
- }
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CDRDAO/Verify.cs b/DiscImageChef.DiscImages/CDRDAO/Verify.cs
new file mode 100644
index 000000000..952a4ee0e
--- /dev/null
+++ b/DiscImageChef.DiscImages/CDRDAO/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CDRWin/CDRWin.cs b/DiscImageChef.DiscImages/CDRWin/CDRWin.cs
index 0db8acfc5..47ce5084c 100644
--- a/DiscImageChef.DiscImages/CDRWin/CDRWin.cs
+++ b/DiscImageChef.DiscImages/CDRWin/CDRWin.cs
@@ -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;
diff --git a/DiscImageChef.DiscImages/CHD/CHD.cs b/DiscImageChef.DiscImages/CHD/CHD.cs
index 3f056f672..5a40ca2a2 100644
--- a/DiscImageChef.DiscImages/CHD/CHD.cs
+++ b/DiscImageChef.DiscImages/CHD/CHD.cs
@@ -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
{
/// "MComprHD"
readonly byte[] chdTag = {0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44};
diff --git a/DiscImageChef.DiscImages/CHD/Read.cs b/DiscImageChef.DiscImages/CHD/Read.cs
index 64a030c7b..05dc73700 100644
--- a/DiscImageChef.DiscImages/CHD/Read.cs
+++ b/DiscImageChef.DiscImages/CHD/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- unknownLbas = new List();
- failingLbas = new List();
- 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 failingLbas,
- out List unknownLbas)
- {
- unknownLbas = new List();
- failingLbas = new List();
- 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)
diff --git a/DiscImageChef.DiscImages/CHD/Verify.cs b/DiscImageChef.DiscImages/CHD/Verify.cs
new file mode 100644
index 000000000..5b37bd8cd
--- /dev/null
+++ b/DiscImageChef.DiscImages/CHD/Verify.cs
@@ -0,0 +1,144 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ unknownLbas = new List();
+ failingLbas = new List();
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ unknownLbas = new List();
+ failingLbas = new List();
+ 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));
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CPCDSK/Unsupported.cs b/DiscImageChef.DiscImages/CPCDSK/Unsupported.cs
index b2ba527ce..f349bcca3 100644
--- a/DiscImageChef.DiscImages/CPCDSK/Unsupported.cs
+++ b/DiscImageChef.DiscImages/CPCDSK/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- 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 failingLbas,
- out List unknownLbas) =>
- throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CisCopy/Unsupported.cs b/DiscImageChef.DiscImages/CisCopy/Unsupported.cs
index cfc56a397..400c12016 100644
--- a/DiscImageChef.DiscImages/CisCopy/Unsupported.cs
+++ b/DiscImageChef.DiscImages/CisCopy/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CloneCD/Read.cs b/DiscImageChef.DiscImages/CloneCD/Read.cs
index a9bd2b4d8..056686bc7 100644
--- a/DiscImageChef.DiscImages/CloneCD/Read.cs
+++ b/DiscImageChef.DiscImages/CloneCD/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
- }
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CloneCD/Verify.cs b/DiscImageChef.DiscImages/CloneCD/Verify.cs
new file mode 100644
index 000000000..8f670ddfd
--- /dev/null
+++ b/DiscImageChef.DiscImages/CloneCD/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/CopyQM/CopyQM.cs b/DiscImageChef.DiscImages/CopyQM/CopyQM.cs
index a0087d3e8..5ed75e645 100644
--- a/DiscImageChef.DiscImages/CopyQM/CopyQM.cs
+++ b/DiscImageChef.DiscImages/CopyQM/CopyQM.cs
@@ -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;
diff --git a/DiscImageChef.DiscImages/CopyQM/Unsupported.cs b/DiscImageChef.DiscImages/CopyQM/Unsupported.cs
index ac1e9eb22..0d0b04da8 100644
--- a/DiscImageChef.DiscImages/CopyQM/Unsupported.cs
+++ b/DiscImageChef.DiscImages/CopyQM/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
-
- return null;
- }
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/D88/Unsupported.cs b/DiscImageChef.DiscImages/D88/Unsupported.cs
index 452ca1b4e..1f78523bf 100644
--- a/DiscImageChef.DiscImages/D88/Unsupported.cs
+++ b/DiscImageChef.DiscImages/D88/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DART/Unsupported.cs b/DiscImageChef.DiscImages/DART/Unsupported.cs
index daf7bc6f0..d9e28e012 100644
--- a/DiscImageChef.DiscImages/DART/Unsupported.cs
+++ b/DiscImageChef.DiscImages/DART/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DIM/Unsupported.cs b/DiscImageChef.DiscImages/DIM/Unsupported.cs
index f017ba964..fbde286d8 100644
--- a/DiscImageChef.DiscImages/DIM/Unsupported.cs
+++ b/DiscImageChef.DiscImages/DIM/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DiscFerret/DiscFerret.cs b/DiscImageChef.DiscImages/DiscFerret/DiscFerret.cs
index ca5b97250..ba846787a 100644
--- a/DiscImageChef.DiscImages/DiscFerret/DiscFerret.cs
+++ b/DiscImageChef.DiscImages/DiscFerret/DiscFerret.cs
@@ -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
diff --git a/DiscImageChef.DiscImages/DiscFerret/Read.cs b/DiscImageChef.DiscImages/DiscFerret/Read.cs
index ed3ce1703..faa708e27 100644
--- a/DiscImageChef.DiscImages/DiscFerret/Read.cs
+++ b/DiscImageChef.DiscImages/DiscFerret/Read.cs
@@ -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 failingLbas,
- out List unknownLbas) =>
- throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DiscFerret/Unsupported.cs b/DiscImageChef.DiscImages/DiscFerret/Verify.cs
similarity index 69%
rename from DiscImageChef.DiscImages/DiscFerret/Unsupported.cs
rename to DiscImageChef.DiscImages/DiscFerret/Verify.cs
index 21903c34f..2e1fce550 100644
--- a/DiscImageChef.DiscImages/DiscFerret/Unsupported.cs
+++ b/DiscImageChef.DiscImages/DiscFerret/Verify.cs
@@ -1,15 +1,15 @@
-// /***************************************************************************
+// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
-// Filename : Unsupported.cs
+// Filename : Verify.cs
// Author(s) : Natalia Portillo
//
// 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 failingLbas,
+ out List unknownLbas) =>
+ throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj b/DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj
index a81b5beb7..6dc7ba929 100644
--- a/DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj
+++ b/DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj
@@ -66,6 +66,7 @@
+
@@ -111,6 +112,7 @@
+
@@ -118,11 +120,13 @@
+
+
@@ -130,7 +134,7 @@
-
+
@@ -147,6 +151,7 @@
+
@@ -158,7 +163,7 @@
-
+
@@ -198,7 +203,7 @@
-
+
@@ -215,6 +220,7 @@
+
@@ -222,6 +228,7 @@
+
@@ -237,6 +244,7 @@
+
@@ -260,7 +268,7 @@
-
+
@@ -282,6 +290,7 @@
+
@@ -303,6 +312,7 @@
+
@@ -311,6 +321,7 @@
+
@@ -357,6 +368,7 @@
+
@@ -366,6 +378,7 @@
+
@@ -379,6 +392,7 @@
+
@@ -443,6 +457,7 @@
+
diff --git a/DiscImageChef.DiscImages/DiscImageChef/DiscImageChef.cs b/DiscImageChef.DiscImages/DiscImageChef/DiscImageChef.cs
index 6492d63cb..c8f9900fc 100644
--- a/DiscImageChef.DiscImages/DiscImageChef/DiscImageChef.cs
+++ b/DiscImageChef.DiscImages/DiscImageChef/DiscImageChef.cs
@@ -81,7 +81,7 @@ using SharpCompress.Compressors.LZMA;
namespace DiscImageChef.DiscImages
{
- public partial class DiscImageChef : IWritableOpticalImage
+ public partial class DiscImageChef : IWritableOpticalImage, IVerifiableImage
{
bool alreadyWrittenZero;
/// Cache of uncompressed blocks.
diff --git a/DiscImageChef.DiscImages/DiscJuggler/DiscJuggler.cs b/DiscImageChef.DiscImages/DiscJuggler/DiscJuggler.cs
index 957905adc..0be08bec3 100644
--- a/DiscImageChef.DiscImages/DiscJuggler/DiscJuggler.cs
+++ b/DiscImageChef.DiscImages/DiscJuggler/DiscJuggler.cs
@@ -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;
diff --git a/DiscImageChef.DiscImages/DiscJuggler/Read.cs b/DiscImageChef.DiscImages/DiscJuggler/Read.cs
index 6b45340e5..60cbfaf93 100644
--- a/DiscImageChef.DiscImages/DiscJuggler/Read.cs
+++ b/DiscImageChef.DiscImages/DiscJuggler/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DiscJuggler/Verify.cs b/DiscImageChef.DiscImages/DiscJuggler/Verify.cs
new file mode 100644
index 000000000..e19496d95
--- /dev/null
+++ b/DiscImageChef.DiscImages/DiscJuggler/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DiskCopy42/DiskCopy42.cs b/DiscImageChef.DiscImages/DiskCopy42/DiskCopy42.cs
index 2e3f13986..d2722b3aa 100644
--- a/DiscImageChef.DiscImages/DiskCopy42/DiskCopy42.cs
+++ b/DiscImageChef.DiscImages/DiskCopy42/DiskCopy42.cs
@@ -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
{
/// Bytes per tag, should be 12
uint bptag;
diff --git a/DiscImageChef.DiscImages/DiskCopy42/Read.cs b/DiscImageChef.DiscImages/DiskCopy42/Read.cs
index 9d3353e5e..e1c8c6fb4 100644
--- a/DiscImageChef.DiscImages/DiskCopy42/Read.cs
+++ b/DiscImageChef.DiscImages/DiskCopy42/Read.cs
@@ -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);
diff --git a/DiscImageChef.DiscImages/DiskCopy42/Unsupported.cs b/DiscImageChef.DiscImages/DiskCopy42/Unsupported.cs
index b07cf39dc..9fc999c79 100644
--- a/DiscImageChef.DiscImages/DiskCopy42/Unsupported.cs
+++ b/DiscImageChef.DiscImages/DiskCopy42/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- 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");
}
diff --git a/DiscImageChef.DiscImages/DiskCopy42/Verify.cs b/DiscImageChef.DiscImages/DiskCopy42/Verify.cs
new file mode 100644
index 000000000..87c884de9
--- /dev/null
+++ b/DiscImageChef.DiscImages/DiskCopy42/Verify.cs
@@ -0,0 +1,71 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/DriDiskCopy/Unsupported.cs b/DiscImageChef.DiscImages/DriDiskCopy/Unsupported.cs
index 01a83280a..a04e68bc8 100644
--- a/DiscImageChef.DiscImages/DriDiskCopy/Unsupported.cs
+++ b/DiscImageChef.DiscImages/DriDiskCopy/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/GDI/Read.cs b/DiscImageChef.DiscImages/GDI/Read.cs
index 0e5496ace..91166e8ee 100644
--- a/DiscImageChef.DiscImages/GDI/Read.cs
+++ b/DiscImageChef.DiscImages/GDI/Read.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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 failingLbas,
- out List unknownLbas)
- {
- byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
- int bps = (int)(buffer.Length / length);
- byte[] sector = new byte[bps];
- failingLbas = new List();
- unknownLbas = new List();
-
- 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;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/GDI/Verify.cs b/DiscImageChef.DiscImages/GDI/Verify.cs
new file mode 100644
index 000000000..c6154db94
--- /dev/null
+++ b/DiscImageChef.DiscImages/GDI/Verify.cs
@@ -0,0 +1,113 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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 failingLbas,
+ out List unknownLbas)
+ {
+ byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
+ int bps = (int)(buffer.Length / length);
+ byte[] sector = new byte[bps];
+ failingLbas = new List();
+ unknownLbas = new List();
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/HDCopy/Unsupported.cs b/DiscImageChef.DiscImages/HDCopy/Unsupported.cs
index 4500ec1c0..0eeb3abdd 100644
--- a/DiscImageChef.DiscImages/HDCopy/Unsupported.cs
+++ b/DiscImageChef.DiscImages/HDCopy/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
- for(ulong i = 0; i < imageInfo.Sectors; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/IMD/Unsupported.cs b/DiscImageChef.DiscImages/IMD/Unsupported.cs
index ca652d0c1..fa599b13a 100644
--- a/DiscImageChef.DiscImages/IMD/Unsupported.cs
+++ b/DiscImageChef.DiscImages/IMD/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/KryoFlux/KryoFlux.cs b/DiscImageChef.DiscImages/KryoFlux/KryoFlux.cs
index d50852a65..57d5daca3 100644
--- a/DiscImageChef.DiscImages/KryoFlux/KryoFlux.cs
+++ b/DiscImageChef.DiscImages/KryoFlux/KryoFlux.cs
@@ -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 tracks;
diff --git a/DiscImageChef.DiscImages/KryoFlux/Read.cs b/DiscImageChef.DiscImages/KryoFlux/Read.cs
index a83e7e0aa..7c21b5cba 100644
--- a/DiscImageChef.DiscImages/KryoFlux/Read.cs
+++ b/DiscImageChef.DiscImages/KryoFlux/Read.cs
@@ -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 failingLbas,
- out List unknownLbas) =>
- throw new NotImplementedException("Flux decoding is not yet implemented.");
}
}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/KryoFlux/Verify.cs b/DiscImageChef.DiscImages/KryoFlux/Verify.cs
new file mode 100644
index 000000000..4fcf08999
--- /dev/null
+++ b/DiscImageChef.DiscImages/KryoFlux/Verify.cs
@@ -0,0 +1,47 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Verify.cs
+// Author(s) : Natalia Portillo
+//
+// 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 .
+//
+// ----------------------------------------------------------------------------
+// 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 failingLbas,
+ out List unknownLbas) =>
+ throw new NotImplementedException("Flux decoding is not yet implemented.");
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.DiscImages/MaxiDisk/Unsupported.cs b/DiscImageChef.DiscImages/MaxiDisk/Unsupported.cs
index 9bd79b7af..e597a3455 100644
--- a/DiscImageChef.DiscImages/MaxiDisk/Unsupported.cs
+++ b/DiscImageChef.DiscImages/MaxiDisk/Unsupported.cs
@@ -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 failingLbas,
- out List unknownLbas)
- {
- failingLbas = new List();
- unknownLbas = new List();
-
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
-
- return null;
- }
-
- public bool? VerifyMediaImage() => null;
-
- public List